diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index c7964ca1f..a5993ceb1 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -13,7 +13,7 @@ on: env: GOPATH: /opt/go PATH: /opt/go/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin - GO_VER: 1.23.5 + GO_VER: 1.25.3 permissions: contents: read @@ -28,7 +28,7 @@ jobs: - run: sudo apt update name: Run Apt Update - uses: actions/checkout@v4 - name: Checkout Fabric CA Code + name: Checkout Fabric CA Code - uses: actions/setup-go@v5 name: Install Go with: @@ -44,7 +44,7 @@ jobs: - run: sudo apt update name: Run Apt Update - uses: actions/checkout@v4 - name: Checkout Fabric CA Code + name: Checkout Fabric CA Code - uses: actions/setup-go@v5 name: Install Go with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4e2ee8e1c..86ec7d089 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,10 +6,10 @@ name: Release on: push: - tags: [ v1.* ] + tags: [v1.*] env: - GO_VER: 1.23.5 + GO_VER: 1.25.3 UBUNTU_VER: 22.04 IMAGE_NAME: ${{ github.repository }} FABRIC_CA_VER: ${{ github.ref_name }} @@ -37,14 +37,14 @@ jobs: steps: - uses: actions/checkout@v4 name: Checkout Fabric CA Code - + - uses: actions/setup-go@v5 name: Install Go with: go-version: ${{ env.GO_VER }} - name: Install GCC cross-compilers - if: ${{ contains(matrix.platform, 'linux') }} + if: ${{ contains(matrix.platform, 'linux') }} run: | sudo apt-get update sudo apt-get -y install gcc-aarch64-linux-gnu @@ -63,7 +63,6 @@ jobs: # of the artifact may include multiple files. path: release/${{ matrix.platform }}/*.tar.gz - # build native image using a different runner for each architecture (faster and more reliable than using qemu to build multi-architecture images on ubuntu-22.04) build-and-push-native-docker-images: name: Build and Push native image @@ -76,15 +75,14 @@ jobs: strategy: fail-fast: false matrix: - runner: - - ubuntu-22.04 # creates linux-amd64 images - - ubuntu-22.04-arm # creates linux-arm64 images - + - ubuntu-22.04 # creates linux-amd64 images + - ubuntu-22.04-arm # creates linux-arm64 images + # Dynamic matrix # If owner is 'hyperledger' run job for Docker Hub and ghcr, otherwise for personal forks just run job for ghcr registry: ${{ fromJSON(github.repository_owner == 'hyperledger' && '["docker.io", "ghcr.io"]' || '["ghcr.io"]') }} - + steps: - name: Checkout uses: actions/checkout@v4 @@ -124,7 +122,7 @@ jobs: mkdir -p ${{ runner.temp }}/digests/${{ matrix.registry }} digest="${{ steps.build-and-push.outputs.digest }}" touch "${{ runner.temp }}/digests/${{ matrix.registry }}/${digest#sha256:}" - + - name: Upload digest uses: actions/upload-artifact@v4 with: @@ -148,13 +146,11 @@ jobs: strategy: fail-fast: false matrix: - # Dynamic matrix # If owner is 'hyperledger' run job for Docker Hub and ghcr, otherwise for personal forks just run job for ghcr registry: ${{ fromJSON(github.repository_owner == 'hyperledger' && '["docker.io", "ghcr.io"]' || '["ghcr.io"]') }} - - steps: + steps: - name: Download digests uses: actions/download-artifact@v4 with: @@ -181,13 +177,13 @@ jobs: type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}}.{{minor}}.{{patch}} - + - name: Create manifest list and push # combines the downloaded amd64 and arm64 digests and pushes multi-architecture manifest with the tags specified above working-directory: ${{ runner.temp }}/digests/${{ matrix.registry }} run: | docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ $(printf '${{ matrix.registry }}/${{ env.IMAGE_NAME }}@sha256:%s ' *) - + - name: Inspect image run: | docker buildx imagetools inspect ${{ matrix.registry }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }} diff --git a/Makefile b/Makefile index 7f71e291d..82505a873 100644 --- a/Makefile +++ b/Makefile @@ -29,10 +29,10 @@ PROJECT_NAME = fabric-ca -GO_VER = 1.23.5 +GO_VER = 1.25.3 UBUNTU_VER ?= 22.04 DEBIAN_VER ?= stretch -BASE_VERSION ?= v1.5.15 +BASE_VERSION ?= v1.5.16 ARCH=$(shell go env GOARCH) PLATFORM=$(shell go env GOOS)-$(shell go env GOARCH) @@ -42,7 +42,7 @@ PLATFORM=$(shell go env GOOS)-$(shell go env GOARCH) RELEASE_VERSION=$(shell echo $(BASE_VERSION) | sed -e 's/^v\(.*\)/\1/') PROJECT_VERSION=${RELEASE_VERSION} -PG_VER=13 +PG_VER=17 PKGNAME = github.com/hyperledger/$(PROJECT_NAME) diff --git a/README.md b/README.md index acbfe9199..3e32c5627 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ The remainder of this guide is intended for developers contributing to Fabric CA ## Prerequisites -* Go 1.23 installation or later +* Go 1.25 installation or later * docker version 17.03 or later * docker-compose version 1.11 or later diff --git a/go.mod b/go.mod index d55ba6a4c..805ca34fc 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,13 @@ module github.com/hyperledger/fabric-ca -go 1.23.5 +go 1.24.0 + +toolchain go1.25.3 require ( - github.com/IBM/idemix v0.0.2-0.20231011101252-a4feda90f3f7 - github.com/IBM/idemix/bccsp/types v0.0.0-20240612072411-114d281b442d - github.com/IBM/mathlib v0.0.3-0.20231011094432-44ee0eb539da + github.com/IBM/idemix v0.0.2-0.20240913182345-72941a5f41cd + github.com/IBM/idemix/bccsp/types v0.0.0-20240913182345-72941a5f41cd + github.com/IBM/mathlib v0.0.3-0.20250709075152-a138079496c3 github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible github.com/cloudflare/cfssl v1.4.1 github.com/felixge/httpsnoop v1.0.1 @@ -23,17 +25,17 @@ require ( github.com/lib/pq v1.8.0 github.com/mattn/go-sqlite3 v1.14.18 github.com/mitchellh/mapstructure v1.5.0 - github.com/onsi/ginkgo v1.14.2 - github.com/onsi/gomega v1.31.0 + github.com/onsi/ginkgo v1.16.5 + github.com/onsi/gomega v1.38.2 github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 github.com/pkg/errors v0.9.1 github.com/pkg/profile v1.5.0 github.com/prometheus/client_golang v1.11.1 - github.com/spf13/cobra v1.5.0 - github.com/spf13/pflag v1.0.5 + github.com/spf13/cobra v1.8.1 + github.com/spf13/pflag v1.0.6 github.com/spf13/viper v1.7.0 - github.com/stretchr/testify v1.8.4 - golang.org/x/crypto v0.36.0 + github.com/stretchr/testify v1.11.1 + golang.org/x/crypto v0.43.0 gopkg.in/ldap.v2 v2.5.1 gopkg.in/yaml.v2 v2.4.0 ) @@ -41,24 +43,22 @@ require ( require ( github.com/IBM/idemix/bccsp/schemes/weak-bb v0.0.0-20240612072411-114d281b442d // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/bits-and-blooms/bitset v1.13.0 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/consensys/bavard v0.1.13 // indirect - github.com/consensys/gnark-crypto v0.12.1 // indirect + github.com/bits-and-blooms/bitset v1.20.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/consensys/gnark-crypto v0.19.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/go-logfmt/logfmt v0.5.1 // indirect github.com/google/certificate-transparency-go v1.0.21 // indirect - github.com/google/go-cmp v0.6.0 // indirect + github.com/google/go-cmp v0.7.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect - github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmhodges/clock v0.0.0-20160418191101-880ee4c33548 // indirect github.com/kilic/bls12-381 v0.1.0 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/miekg/pkcs11 v1.1.1 // indirect - github.com/mmcloughlin/addchain v0.4.0 // indirect - github.com/nxadm/tail v1.4.4 // indirect + github.com/nxadm/tail v1.4.8 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect @@ -67,7 +67,7 @@ require ( github.com/spf13/afero v1.11.0 // indirect github.com/spf13/cast v1.6.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect - github.com/stretchr/objx v0.5.0 // indirect + github.com/stretchr/objx v0.5.2 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/sykesm/zap-logfmt v0.0.4 // indirect github.com/weppos/publicsuffix-go v0.5.0 // indirect @@ -75,14 +75,14 @@ require ( github.com/zmap/zlint v0.0.0-20190806154020-fd021b4cfbeb // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/net v0.38.0 // indirect - golang.org/x/sys v0.31.0 // indirect - golang.org/x/text v0.23.0 // indirect - google.golang.org/grpc v1.64.1 // indirect - google.golang.org/protobuf v1.34.2 // indirect + go.yaml.in/yaml/v3 v3.0.4 // indirect + golang.org/x/net v0.45.0 // indirect + golang.org/x/sys v0.37.0 // indirect + golang.org/x/text v0.30.0 // indirect + google.golang.org/grpc v1.65.0 // indirect + google.golang.org/protobuf v1.36.7 // indirect gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - rsc.io/tmplfunc v0.0.3 // indirect ) diff --git a/go.sum b/go.sum index 0106a4adc..f04fd7ed0 100644 --- a/go.sum +++ b/go.sum @@ -37,16 +37,18 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/GeertJohan/go.incremental v1.0.0/go.mod h1:6fAjUhbVuX1KcMD3c8TEgVUqmo4seqhv0i0kdATSkM0= github.com/GeertJohan/go.rice v1.0.0/go.mod h1:eH6gbSOAUv07dQuZVnBmoDP8mgsM1rtixis4Tib9if0= -github.com/IBM/idemix v0.0.2-0.20231011101252-a4feda90f3f7 h1:ybW6FaLCYGEF03XaR+WJP7bq7XqeBI4Pfj8uKipQT+A= -github.com/IBM/idemix v0.0.2-0.20231011101252-a4feda90f3f7/go.mod h1:74yugcANjVAC9e8wHDmTDvlKHxnPj0V1L9VJ84ExaoU= +github.com/IBM/idemix v0.0.2-0.20240913182345-72941a5f41cd h1:EKYTJSpfo9AXtwVVx0ifV6C1WWVXYdg/7Dt7DZUU3TY= +github.com/IBM/idemix v0.0.2-0.20240913182345-72941a5f41cd/go.mod h1:2fb0rlSe6ge80nHvprxJESAKkdYrkhJP39ve/soOk9c= github.com/IBM/idemix/bccsp/schemes/weak-bb v0.0.0-20240612072411-114d281b442d h1:jIDz71083inpGWt9IPVGb0DoqyF7tQW/YH0gBLb6sKo= github.com/IBM/idemix/bccsp/schemes/weak-bb v0.0.0-20240612072411-114d281b442d/go.mod h1:FC0vVgNI6bv8GH0VTwjup+arwJ8Tau1iEhroWZ1oPwU= -github.com/IBM/idemix/bccsp/types v0.0.0-20240612072411-114d281b442d h1:cv8IVW3eP0l3SxOLvKtPygBe4SC8+0QpwzQsJW4vtVE= -github.com/IBM/idemix/bccsp/types v0.0.0-20240612072411-114d281b442d/go.mod h1:IMIJ8WcUpBmV4gcOO/BYKuFYpdXCPYZjpNhFSUlO9b8= -github.com/IBM/mathlib v0.0.3-0.20231011094432-44ee0eb539da h1:qqGozq4tF6EOVnWoTgBoJGudRKKZXSAYnEtDggzTnsw= -github.com/IBM/mathlib v0.0.3-0.20231011094432-44ee0eb539da/go.mod h1:Tco9QzE3fQzjMS7nPbHDeFfydAzctStf1Pa8hsh6Hjs= +github.com/IBM/idemix/bccsp/types v0.0.0-20240913182345-72941a5f41cd h1:KQzFMUQtrwJHKwwijxnQ8Lj2D7A+RnSll4Ugv20H3vQ= +github.com/IBM/idemix/bccsp/types v0.0.0-20240913182345-72941a5f41cd/go.mod h1:4bYvi+a50aXxmHf1vwuvR+Wd8YXZ6AhT+0p5oK4xdOA= +github.com/IBM/mathlib v0.0.3-0.20250709075152-a138079496c3 h1:TelnQIceKrhWVmuFnMXyKyq0WUG5zMT6u+7wnRMkcFY= +github.com/IBM/mathlib v0.0.3-0.20250709075152-a138079496c3/go.mod h1:O230ebw6/22B7T4C03b99ZcPtc5XAfBTOp+ZT+xmMCk= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible h1:1G1pk05UrOh0NlF1oeaaix1x8XzrfjIDK47TY0Zehcw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0= +github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= 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= @@ -73,8 +75,8 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= 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/bits-and-blooms/bitset v1.13.0 h1:bAQ9OPNFYbGHV6Nez0tmNI0RiEu7/hxlYJRUA0wFAVE= -github.com/bits-and-blooms/bitset v1.13.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= +github.com/bits-and-blooms/bitset v1.20.0 h1:2F+rfL86jE2d/bmw7OhqUg2Sj/1rURkBn3MdfoPyRVU= +github.com/bits-and-blooms/bitset v1.20.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= @@ -82,8 +84,8 @@ github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA github.com/certifi/gocertifi v0.0.0-20180118203423-deb3ae2ef261/go.mod h1:GJKEexRPVJrBSOjoqN5VNOIKJ5Q3RViH6eu3puDRwx4= 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= @@ -97,10 +99,8 @@ github.com/cloudflare/redoctober v0.0.0-20171127175943-746a508df14c/go.mod h1:6S github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= -github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= -github.com/consensys/gnark-crypto v0.12.1 h1:lHH39WuuFgVHONRl3J0LRBtuYdQTumFSDtJF7HpyG8M= -github.com/consensys/gnark-crypto v0.12.1/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY= +github.com/consensys/gnark-crypto v0.19.2 h1:qrEAIXq3T4egxqiliFFoNrepkIWVEeIYwt3UL0fvS80= +github.com/consensys/gnark-crypto v0.19.2/go.mod h1:rT23F0XSZqE0mUA0+pRtnL56IbPxs6gp4CeRsBk4XS0= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -110,7 +110,7 @@ github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7 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/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.2/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/daaku/go.zipexe v1.0.0/go.mod h1:z8IiR6TsVLEYKwXAoE/I+8ys/sDkgTzSL0CLnGVd57E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -154,16 +154,18 @@ 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-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= -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.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= +github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-sql-driver/mysql v1.3.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= -github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= +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/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= @@ -211,8 +213,8 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.1/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.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -223,10 +225,9 @@ github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hf 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-20240130152714-0ed6a68c8d9e h1:E+3PBMCXn0ma79O7iCrne0iUpKtZ7rIcZvoz+jNtNtw= -github.com/google/pprof v0.0.0-20240130152714-0ed6a68c8d9e/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= +github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 h1:BHT72Gu3keYf3ZEu2J0b1vyeLSOYI8bm5wbJM/8yDe8= +github.com/google/pprof v0.0.0-20250403155104-27863c87afa6/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 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= @@ -278,8 +279,9 @@ github.com/hyperledger/fabric-amcl v0.0.0-20230602173724-9e02669dceb2/go.mod h1: github.com/hyperledger/fabric-lib-go v1.1.2 h1:3eHwudGZC5Ex7go5UAzVKhpF34gypPZGfSZksBKLWvE= github.com/hyperledger/fabric-lib-go v1.1.2/go.mod h1:SHNCq8AB0VpHAmvJEtdbzabv6NNV1F48JdmDihasBjc= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jinzhu/copier v0.3.5 h1:GlvfUwHk62RokgqVNvYsku0TATCF7bAHVwEXoBh3iJg= @@ -321,8 +323,8 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/go-gypsy v0.0.0-20160905020020-08cad365cd28/go.mod h1:T/T7jsxVqf9k/zYOqbgNAsANsjxTd1Yq3htjDhQ1H0c= -github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= -github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= +github.com/leanovate/gopter v0.2.11 h1:vRjThO1EKPb/1NsDXuDrzldR28RLkBflWYcU9CvzWu4= +github.com/leanovate/gopter v0.2.11/go.mod h1:aK3tzZP/C+p1m3SPRE4SYZFGP7jjkuSI4f7Xvpt0S9c= github.com/lib/pq v0.0.0-20180201184707-88edab080323/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.8.0 h1:9xohqzkUwzR4Ga4ivdTcawVS89YSDVxXMa3xJX3cGzg= @@ -356,9 +358,6 @@ github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:F github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= -github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= -github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= 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= @@ -374,8 +373,9 @@ github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxzi 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/nkovacs/streamquote v0.0.0-20170412213628-49af9bddb229/go.mod h1:0aYXnNPJ8l7uZxf45rWW1a/uME32OF0rhiYGNQ2oF2E= -github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= 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= @@ -383,15 +383,15 @@ github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:v 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.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.2 h1:8mVmC9kjFFmA8H4pKMUhcblgifdkOIXPvbhN1T36q1M= -github.com/onsi/ginkgo v1.14.2/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= -github.com/onsi/ginkgo/v2 v2.13.2 h1:Bi2gGVkfn6gQcjNjZJVO8Gf0FHzMPf2phUei9tejVMs= -github.com/onsi/ginkgo/v2 v2.13.2/go.mod h1:XStQ8QcGwLyF4HdfcZB8SFOS/MWCgDuXMSBe6zrvLgM= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= +github.com/onsi/ginkgo/v2 v2.25.1 h1:Fwp6crTREKM+oA6Cz4MsO8RhKQzs2/gOIVOUscMAfZY= +github.com/onsi/ginkgo/v2 v2.25.1/go.mod h1:ppTWQ1dh9KM/F1XgpeRqelR+zHVwV81DGRSDnFxK7Sk= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.31.0 h1:54UJxxj6cPInHS3a35wm6BK/F9nHYueZ1NVujHDrnXE= -github.com/onsi/gomega v1.31.0/go.mod h1:DW9aCi7U6Yi40wNVAvT6kzFnEVEI5n3DloYBiKiT6zk= +github.com/onsi/gomega v1.38.2 h1:eZCjf2xjZAqe+LeWvKb5weQ+NcPwX84kqJ0cZNxok2A= +github.com/onsi/gomega v1.38.2/go.mod h1:W2MJcYxRGV63b418Ai34Ud0hEdTVXq9NW9+Sx6uXf3k= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 h1:lDH9UUVJtmYCjyT0CI4q8xvlXPxeZ0gYCVvWbmPlp88= 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= @@ -484,15 +484,16 @@ github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkU github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU= -github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM= +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/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= 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/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= +github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.7.0 h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= @@ -500,16 +501,14 @@ github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3 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.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= 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.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.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= 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= @@ -528,6 +527,7 @@ github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q 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/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0= github.com/zmap/rc2 v0.0.0-20131011165748-24b9757f5521/go.mod h1:3YZ9o3WnatTIZhuOtot4IcUfzoKVjUHqu6WALIyI0nE= github.com/zmap/zcertificate v0.0.0-20180516150559-0e3d58b1bac4/go.mod h1:5iU54tB79AMBcySS0R2XIyZBAVmeHranShAFELYx7is= @@ -548,6 +548,8 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= 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/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs= +go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= @@ -560,6 +562,8 @@ go.uber.org/zap v1.12.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= 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-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -568,8 +572,8 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= -golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= +golang.org/x/crypto v0.43.0 h1:dduJYIi3A3KOfdGOHX8AVZ/jGiyPa3IbBozJ5kNuE04= +golang.org/x/crypto v0.43.0/go.mod h1:BFbav4mRNlXJL4wNeejLpWxB7wMbc79PdRGhWKncxR0= 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= @@ -635,9 +639,10 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/ 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-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= -golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= +golang.org/x/net v0.45.0 h1:RLBg5JKixCy82FtLJpeNlVM0nrSqpCRYzVU1n8kj0tM= +golang.org/x/net v0.45.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/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-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -652,6 +657,7 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ 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/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= @@ -690,18 +696,19 @@ golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7w 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-20200519105757-fe76b779f299/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-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201101102859-da207088b7d1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/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/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ= +golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= 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= @@ -709,8 +716,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 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.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -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/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k= +golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM= 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= @@ -762,8 +769,9 @@ golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roY 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.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.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.37.0 h1:DVSRzp7FwePZW356yEAChSdNcQo6Nsp+fex1SUW09lE= +golang.org/x/tools v0.37.0/go.mod h1:MBN5QPQtLMHVdvsbtarmTNukZDdgwdwlO5qGacAzF0w= 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= @@ -839,8 +847,8 @@ google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKa 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.64.1 h1:LKtvyfbX3UGVPFcGqJ9ItpVWW6oN/2XqTxfAnwRRXiA= -google.golang.org/grpc v1.64.1/go.mod h1:hiQF4LFZelK2WKaP6W0L92zGHtiQdZxk8CrSdvyjeP0= +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/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= @@ -852,8 +860,8 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD 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.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/protobuf v1.36.7 h1:IgrO7UwFQGJdRNXH/sQux4R1Dj1WAKcLElzeeRaXV2A= +google.golang.org/protobuf v1.36.7/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d h1:TxyelI5cVkbREznMhfzycHdkp5cLA7DpE+GKjSslYhM= gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d/go.mod h1:cuepJuh7vyXfUyUwEgHQXw849cJrilpS5NeIjOWESAw= @@ -883,7 +891,6 @@ gopkg.in/yaml.v2 v2.2.5/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 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= 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.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -897,7 +904,5 @@ honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 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= -rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= -rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/images/fabric-ca-fvt/Dockerfile b/images/fabric-ca-fvt/Dockerfile index c6755c1b2..1d10360b6 100644 --- a/images/fabric-ca-fvt/Dockerfile +++ b/images/fabric-ca-fvt/Dockerfile @@ -3,21 +3,21 @@ # # SPDX-License-Identifier: Apache-2.0 # -ARG GO_VER -FROM golang:${GO_VER}-bullseye as fabric-ca-builder +ARG GO_VER=1 +FROM golang:${GO_VER}-trixie AS fabric-ca-builder ARG GO_LDFLAGS ARG GO_TAGS ADD . /build/fabric-ca WORKDIR /build/fabric-ca RUN go build -tags "${GO_TAGS}" -ldflags "${GO_LDFLAGS}" \ - -o /usr/local/bin/fabric-ca-server \ - github.com/hyperledger/fabric-ca/cmd/fabric-ca-server \ - && go build -tags "${GO_TAGS}" -ldflags "${GO_LDFLAGS}" \ - -o /usr/local/bin/fabric-ca-client \ - github.com/hyperledger/fabric-ca/cmd/fabric-ca-client + -o /usr/local/bin/fabric-ca-server \ + github.com/hyperledger/fabric-ca/cmd/fabric-ca-server \ + && go build -tags "${GO_TAGS}" -ldflags "${GO_LDFLAGS}" \ + -o /usr/local/bin/fabric-ca-client \ + github.com/hyperledger/fabric-ca/cmd/fabric-ca-client -FROM debian:bullseye-20230814-slim +FROM debian:trixie-slim ARG PG_VER ENV PATH="/usr/local/go/bin/:${PATH}" \ diff --git a/images/fabric-ca-fvt/payload/fabric-ca_utils b/images/fabric-ca-fvt/payload/fabric-ca_utils index 20bcd7d73..92750e212 100644 --- a/images/fabric-ca-fvt/payload/fabric-ca_utils +++ b/images/fabric-ca-fvt/payload/fabric-ca_utils @@ -188,7 +188,7 @@ startHttp() { local port="$1" local rootdir="$2" cd $rootdir - python -m SimpleHTTPServer $port & + python -m http.server $port & HTTP_PID=$! pollServer python localhost "$HTTP_PORT" && return $HTTP_PID || return -1 } diff --git a/images/fabric-ca-fvt/payload/mysql_setup.sh b/images/fabric-ca-fvt/payload/mysql_setup.sh index f767c5425..1e95b3e55 100755 --- a/images/fabric-ca-fvt/payload/mysql_setup.sh +++ b/images/fabric-ca-fvt/payload/mysql_setup.sh @@ -3,17 +3,11 @@ # # SPDX-License-Identifier: Apache-2.0 RC=0 -arch=$(uname -m) export DEBIAN_FRONTEND=noninteractive -# Latest mysql download can be found at https://dev.mysql.com/downloads/repo/apt/ -# mysql versions and platform support can be found at http://repo.mysql.com/apt/debian/dists/bullseye/ (no arm support) -echo mysql-apt-config mysql-apt-config/select-server select mysql-8.0 | debconf-set-selections -wget https://dev.mysql.com/get/mysql-apt-config_0.8.29-1_all.deb -dpkg -i mysql-apt-config_0.8.29-1_all.deb apt-get update -apt-get install mysql-server -y +apt-get install default-mysql-server -y mkdir -p /var/run/mysqld chown mysql:mysql /var/run/mysqld @@ -22,17 +16,17 @@ chown mysql:mysql /var/run/mysqld cp $FABRIC_CA_DATA/$TLS_BUNDLE $MYSQLDATA/ cp $FABRIC_CA_DATA/$TLS_SERVER_CERT $MYSQLDATA/ openssl rsa -in $FABRIC_CA_DATA/$TLS_SERVER_KEY -out $MYSQLDATA/$TLS_SERVER_KEY || let RC+=1 -chown mysql.mysql $MYSQLDATA/*pem +chown mysql:mysql $MYSQLDATA/*pem chmod 600 $MYSQLDATA/$TLS_SERVER_KEY -MYCNF=/etc/mysql/mysql.conf.d/mysqld.cnf +MYCNF=/etc/mysql/mariadb.conf.d/50-server.cnf sed -i "s/^[[:blank:]]*#*[[:blank:]]*ssl-ca=.*/ssl-ca=$TLS_BUNDLE/; s/\(^[[:blank:]]*\)#*\([[:blank:]]*max_connections[[:blank:]]*=[[:blank:]]*\).*/\1\22000/; s/^[[:blank:]]*#*[[:blank:]]*ssl-cert=.*/ssl-cert=$TLS_SERVER_CERT/; s/^[[:blank:]]*#*[[:blank:]]*ssl-key=.*/ssl-key=$TLS_SERVER_KEY/" $MYCNF || let RC+=1 -chown -R mysql.mysql $MYSQLDATA +chown -R mysql:mysql $MYSQLDATA -/usr/bin/mysqld_safe --sql-mode=STRICT_TRANS_TABLES & +/usr/bin/mariadbd-safe --sql-mode=STRICT_TRANS_TABLES & sleep 5 -mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'mysql'" +mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED VIA mysql_native_password USING PASSWORD('mysql')" -exit $RC \ No newline at end of file +exit $RC diff --git a/images/fabric-ca-fvt/payload/slapd_setup.sh b/images/fabric-ca-fvt/payload/slapd_setup.sh index 7c0a32ee7..23855285e 100755 --- a/images/fabric-ca-fvt/payload/slapd_setup.sh +++ b/images/fabric-ca-fvt/payload/slapd_setup.sh @@ -37,9 +37,9 @@ done ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/member.ldif || let RC+=1 ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/refint.ldif || let RC+=1 -ldapadd -h localhost -p $LDAPPORT -D cn=$LDAPUSER,dc=example,dc=com -w $LDAPPASWD -f /etc/ldap/base.ldif || let RC+=1 -ldapadd -h localhost -p $LDAPPORT -D cn=$LDAPUSER,dc=example,dc=com -w $LDAPPASWD -f /etc/ldap/add-users.ldif || let RC+=1 -ldapadd -h localhost -p $LDAPPORT -D cn=$LDAPUSER,dc=example,dc=com -w $LDAPPASWD -f /etc/ldap/groups.ldif || let RC+=1 +ldapadd -H ldap://localhost:$LDAPPORT -D cn=$LDAPUSER,dc=example,dc=com -w $LDAPPASWD -f /etc/ldap/base.ldif || let RC+=1 +ldapadd -H ldap://localhost:$LDAPPORT -D cn=$LDAPUSER,dc=example,dc=com -w $LDAPPASWD -f /etc/ldap/add-users.ldif || let RC+=1 +ldapadd -H ldap://localhost:$LDAPPORT -D cn=$LDAPUSER,dc=example,dc=com -w $LDAPPASWD -f /etc/ldap/groups.ldif || let RC+=1 ldapmodify -Y EXTERNAL -H ldapi:/// -f /etc/ldap/certinfo.ldif || let RC+=1 ldapmodify -Y EXTERNAL -H ldapi:/// -f /etc/ldap/forceTimeout.ldif /etc/init.d/slapd stop diff --git a/images/fabric-ca-fvt/payload/start.sh b/images/fabric-ca-fvt/payload/start.sh index 34c7bffea..162c25024 100755 --- a/images/fabric-ca-fvt/payload/start.sh +++ b/images/fabric-ca-fvt/payload/start.sh @@ -12,8 +12,8 @@ PORTS=($POSTGRES_PORT $MYSQL_PORT $LDAP_PORT) timeout=12 su postgres -c 'postgres -D /usr/local/pgsql/data' & -chown -R mysql.mysql $MYSQLDATA -/usr/bin/mysqld_safe --sql-mode=STRICT_TRANS_TABLES & +chown -R mysql:mysql $MYSQLDATA +/usr/bin/mariadbd-safe --sql-mode=STRICT_TRANS_TABLES & /etc/init.d/slapd start & for port in ${PORTS[*]}; do diff --git a/images/fabric-ca-fvt/payload/system_update.sh b/images/fabric-ca-fvt/payload/system_update.sh index fdf8d18d3..b1863b232 100755 --- a/images/fabric-ca-fvt/payload/system_update.sh +++ b/images/fabric-ca-fvt/payload/system_update.sh @@ -19,9 +19,9 @@ dpkg-reconfigure locales && update-locale LANG=en_US.UTF-8 || let RC+=1 # Install more test depedencies apt-get -y install --no-install-recommends rsyslog bc vim lsof sqlite3 haproxy postgresql-$PGVER \ - postgresql-client-common postgresql-contrib-$PGVER isag jq git html2text \ - debconf-utils zsh htop python2.7-minimal libpython2.7-stdlib \ - parallel netcat wget lsb-release gnupg ca-certificates || let RC+=1 + postgresql-client-common isag jq git html2text \ + debconf-utils zsh htop python-is-python3 \ + parallel netcat-openbsd wget lsb-release gnupg ca-certificates || let RC+=1 apt-get -y install ssl-cert || let RC+=1 apt-get -y autoremove @@ -31,9 +31,6 @@ rm /etc/rsyslog.d/*haproxy*conf printf "local2.* /var/log/haproxy.log\n& ~\n" > /etc/rsyslog.d/haproxy.conf printf "local0.* /var/log/postgres.log\n& ~\n" > /etc/rsyslog.d/postgres.conf -# Use python2, not 3 -ln -s /usr/bin/python2.7 /usr/local/bin/python && chmod 777 /usr/local/bin/python || let RC+=1 - # Clean up APT when done. apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* diff --git a/images/fabric-ca/Dockerfile b/images/fabric-ca/Dockerfile index 2e66bd22a..26173df5a 100644 --- a/images/fabric-ca/Dockerfile +++ b/images/fabric-ca/Dockerfile @@ -9,7 +9,7 @@ ############################################################################### ARG UBUNTU_VER -FROM ubuntu:${UBUNTU_VER} as builder +FROM ubuntu:${UBUNTU_VER} AS builder ARG TARGETARCH ARG TARGETOS diff --git a/lib/caerrors/servererror_test.go b/lib/caerrors/servererror_test.go index f6e0c2413..1b8828db1 100644 --- a/lib/caerrors/servererror_test.go +++ b/lib/caerrors/servererror_test.go @@ -47,7 +47,7 @@ func TestHTTPErr(t *testing.T) { func TestRemoteErrorString(t *testing.T) { lmsg := "local message" rmsg := "remote message" - err := CreateHTTPErr(401, ErrMethodNotAllowed, "%s", lmsg).Remote(ErrUnknown, rmsg) + err := CreateHTTPErr(401, ErrMethodNotAllowed, "%s", lmsg).Remote(ErrUnknown, "%s", rmsg) errMsg := Print(err) assert.Contains(t, errMsg, rmsg) } diff --git a/lib/client.go b/lib/client.go index a65add045..764eec460 100644 --- a/lib/client.go +++ b/lib/client.go @@ -823,7 +823,7 @@ func (c *Client) SendReq(req *http.Request, result interface{}) (err error) { errorMsg = errorMsg + fmt.Sprintf("\n%s", msg) } } - return errors.Errorf(errorMsg) + return errors.New(errorMsg) } } scode := resp.StatusCode diff --git a/lib/client/credential/idemix/credential.go b/lib/client/credential/idemix/credential.go index 52ff1e031..0937e7b22 100644 --- a/lib/client/credential/idemix/credential.go +++ b/lib/client/credential/idemix/credential.go @@ -119,7 +119,7 @@ func (cred *Credential) Load() error { val := SignerConfig{} err = json.Unmarshal(signerConfigBytes, &val) if err != nil { - return errors.Wrapf(err, fmt.Sprintf("Failed to unmarshal SignerConfig bytes from %s", cred.signerConfigFile)) + return errors.Wrapf(err, "Failed to unmarshal SignerConfig bytes from %s", cred.signerConfigFile) } if val.CurveID == "" { val.CurveID = idemix4.DefaultIdemixCurve diff --git a/lib/metadata/version.go b/lib/metadata/version.go index af60af7f4..227359de2 100644 --- a/lib/metadata/version.go +++ b/lib/metadata/version.go @@ -29,7 +29,7 @@ const ( // Version specifies fabric-ca-client/fabric-ca-server version // It is defined by the Makefile and passed in with ldflags -var Version = "1.5.15" +var Version = "1.5.16" // GetVersionInfo returns version information for the fabric-ca-client/fabric-ca-server func GetVersionInfo(prgName string) string { diff --git a/lib/server/idemix/nonce.go b/lib/server/idemix/nonce.go index c9bb78e19..3740de670 100644 --- a/lib/server/idemix/nonce.go +++ b/lib/server/idemix/nonce.go @@ -75,13 +75,13 @@ func NewNonceManager(issuer MyIssuer, clock Clock, level int) (NonceManager, err opts := issuer.Config() mgr.nonceExpiration, err = time.ParseDuration(opts.NonceExpiration) if err != nil { - return nil, errors.Wrapf(err, fmt.Sprintf("Failed to parse idemix.nonceexpiration config option while initializing Nonce manager for Issuer '%s'", - issuer.Name())) + return nil, errors.Wrapf(err, "Failed to parse idemix.nonceexpiration config option while initializing Nonce manager for Issuer '%s'", + issuer.Name()) } mgr.nonceSweepInterval, err = time.ParseDuration(opts.NonceSweepInterval) if err != nil { - return nil, errors.Wrapf(err, fmt.Sprintf("Failed to parse idemix.noncesweepinterval config option while initializing Nonce manager for Issuer '%s'", - issuer.Name())) + return nil, errors.Wrapf(err, "Failed to parse idemix.noncesweepinterval config option while initializing Nonce manager for Issuer '%s'", + issuer.Name()) } return mgr, nil } diff --git a/lib/server/idemix/revocationauthority.go b/lib/server/idemix/revocationauthority.go index 985bfda44..4e34aa4a7 100644 --- a/lib/server/idemix/revocationauthority.go +++ b/lib/server/idemix/revocationauthority.go @@ -322,7 +322,7 @@ func doTransaction(funcName string, db db.FabricCADB, doit func(tx db.FabricCATx err2 := tx.Rollback(funcName) if err2 != nil { errMsg := fmt.Sprintf("Error encountered while rolling back transaction: %s, original error: %s", err2.Error(), err.Error()) - log.Errorf(errMsg) + log.Error(errMsg) return nil, errors.New(errMsg) } return nil, err diff --git a/lib/serverendpoint.go b/lib/serverendpoint.go index 4d9f79c20..f4cf4acf8 100644 --- a/lib/serverendpoint.go +++ b/lib/serverendpoint.go @@ -104,7 +104,7 @@ func getHTTPErr(err error) *caerrors.HTTPErr { } curErr := caerrors.GetCause(err) if curErr == nil { - return caerrors.CreateHTTPErr(500, caerrors.ErrUnknown, err.Error()) + return caerrors.CreateHTTPErr(500, caerrors.ErrUnknown, "%s", err.Error()) } return curErr diff --git a/lib/serverrequestcontext.go b/lib/serverrequestcontext.go index 8ba1f3a86..b70f748d4 100644 --- a/lib/serverrequestcontext.go +++ b/lib/serverrequestcontext.go @@ -114,8 +114,8 @@ func (ctx *serverRequestContextImpl) BasicAuthentication() (string, error) { if allowedAttempts > 0 { if attempts == ca.Config.Cfg.Identities.PasswordAttempts { msg := fmt.Sprintf("Incorrect password entered %d times, max incorrect password limit of %d reached", attempts, ca.Config.Cfg.Identities.PasswordAttempts) - log.Errorf(msg) - return "", caerrors.NewHTTPErr(401, caerrors.ErrPasswordAttempts, msg) + log.Error(msg) + return "", caerrors.NewHTTPErr(401, caerrors.ErrPasswordAttempts, "%s", msg) } } @@ -617,7 +617,7 @@ func (ctx *serverRequestContextImpl) canActOnType(requestedType string) (bool, e func strContained(needle string, haystack []string) bool { for _, s := range haystack { - if strings.ToLower(s) == strings.ToLower(needle) { + if strings.EqualFold(s, needle) { return true } } diff --git a/lib/util.go b/lib/util.go index 7014f790c..24cab3d9c 100644 --- a/lib/util.go +++ b/lib/util.go @@ -185,7 +185,7 @@ func (cd *CertificateDecoder) CertificateDecoder(decoder *json.Decoder) error { if err != nil { return err } - fmt.Printf(result) + fmt.Print(result) return nil } diff --git a/scripts/check_format b/scripts/check_format index 7e6b7379e..00e590b92 100755 --- a/scripts/check_format +++ b/scripts/check_format @@ -16,7 +16,7 @@ fi echo "Checking for trailing blanks..." find . -path ./vendor -prune -o -type f -regex ".*\(regenDocs\|\.\(go\|sh\)\)" \ - -exec egrep -q " +$" {} \; \ + -exec grep -E -q " +$" {} \; \ -exec printf "trailing blanks in {}\n" \; | grep -E '.*' if test $? -eq 0; then echo "To fix, run" diff --git a/scripts/fvt/cdp_exploit_test.sh b/scripts/fvt/cdp_exploit_test.sh index 2040751cd..c28e376d3 100755 --- a/scripts/fvt/cdp_exploit_test.sh +++ b/scripts/fvt/cdp_exploit_test.sh @@ -89,7 +89,7 @@ function testLimit { c_dir=$(pwd) cp "$FABRIC_CA/testdata/crl.pem" /$CADOMAIN/crl/crl.pem cd / -python -m SimpleHTTPServer $httpPort & +python -m http.server $httpPort & HTTP_PID=$! pollSimpleHttp cd $c_dir diff --git a/scripts/fvt/cluster_test.sh b/scripts/fvt/cluster_test.sh index 6665433d0..79513d0d0 100755 --- a/scripts/fvt/cluster_test.sh +++ b/scripts/fvt/cluster_test.sh @@ -88,7 +88,13 @@ function enrollUsers() { --csr.hosts ${USERNAME}${ca}-${user}@fab-client.raleigh.ibm.com \ --csr.hosts ${USERNAME}${ca}-${user}.fabric.raleigh.ibm.com \ --caname ca$ca >> $dir/admin$ca/log.txt 2>&1 - test "${USERNAME}${ca}-${user}" = "$(openssl x509 -in $dir/${USERNAME}${ca}-${user}/$ENROLLCERT -noout -subject | awk -F'= ' '{print $NF}')" + local cert_subject="$(openssl x509 -in $dir/${USERNAME}${ca}-${user}/$ENROLLCERT -noout -subject | sed 's/^.* CN *= *//')" + if [ "${USERNAME}${ca}-${user}" != "${cert_subject}" ]; then + echo "Expected '${USERNAME}${ca}-${user}', got '${cert_subject}'" + cat $dir/${USERNAME}${ca}-${user}/$ENROLLCERT + return 1 + fi + return 0 } function reenrollUsers() { @@ -103,7 +109,13 @@ function reenrollUsers() { $FABRIC_CA_CLIENTEXEC reenroll --debug $TLSOPT \ -u ${PROTO}@localhost:$port \ --caname ca$ca >> $dir/admin$ca/log.txt 2>&1 - test "${USERNAME}${ca}-${user}" = "$(openssl x509 -in $dir/${USERNAME}${ca}-${user}/$ENROLLCERT -noout -subject | awk -F'= ' '{print $NF}')" + local cert_subject="$(openssl x509 -in $dir/${USERNAME}${ca}-${user}/$ENROLLCERT -noout -subject | sed 's/^.* CN *= *//')" + if [ "${USERNAME}${ca}-${user}" != "${cert_subject}" ]; then + echo "Expected '${USERNAME}${ca}-${user}', got '${cert_subject}'" + cat $dir/${USERNAME}${ca}-${user}/$ENROLLCERT + return 1 + fi + return 0 } function register() { @@ -166,7 +178,9 @@ function checkStatus() { local number="$2" : ${number:="$NUMUSERS"} awk -v u=$number ' + NR==1 {print $0} NR!=1 && $7==0 {rc+=1} + NR!=1 && $7!=0 {print $0} END {if (rc!=u) exit 1}' $log test $? -ne 0 && ErrorMsg "FAILED" || echo "PASSED" } diff --git a/scripts/fvt/db_test.sh b/scripts/fvt/db_test.sh index 2693525eb..238632c8b 100755 --- a/scripts/fvt/db_test.sh +++ b/scripts/fvt/db_test.sh @@ -309,7 +309,7 @@ if [ $? != 0 ]; then fi # Start mysql server -/usr/bin/mysqld_safe --sql-mode=STRICT_TRANS_TABLES & +/usr/bin/mariadbd-safe --sql-mode=STRICT_TRANS_TABLES & pollMySql # Wait for MySQL to start # Enroll again, this time the server should try to reinitialize the DB before processing enroll request and this should succeed diff --git a/scripts/fvt/fabric-ca_utils b/scripts/fvt/fabric-ca_utils index c74d814a5..8b4da27a3 100755 --- a/scripts/fvt/fabric-ca_utils +++ b/scripts/fvt/fabric-ca_utils @@ -55,7 +55,7 @@ TIME='date +%I:%M:%S%p' stripBlank() { # delete comments and blanks lines - egrep -v "^ *#|^$" + grep -E -v "^ *#|^$" } listUser(){ @@ -241,7 +241,7 @@ pollLogForMsg() { # we find $msg in $log, or reach timeout while test "$(($(date +%s)-starttime))" -lt "$timeout" -a $rc -ne 0 do - egrep "$msg" "$log" + grep -E "$msg" "$log" rc=$? test $rc -eq 0 && break sleep .1 @@ -390,7 +390,7 @@ startHttp() { local port="$1" local rootdir="$2" cd $rootdir - python -m SimpleHTTPServer $port & + python -m http.server $port & HTTP_PID=$! pollSimpleHttp } @@ -962,7 +962,7 @@ signing: csr: keyrequest: algo: $KEYTYPE - size: $KEYLEN + size: $KEYLEN names: - C: US ST: "North Carolina" @@ -1041,5 +1041,5 @@ function killserver { } function grepPrint() { - tee /dev/stderr| egrep "$1" + tee /dev/stderr| grep -E "$1" } diff --git a/scripts/fvt/group_test.sh b/scripts/fvt/group_test.sh index 3f20f6183..bdd0e2e1a 100755 --- a/scripts/fvt/group_test.sh +++ b/scripts/fvt/group_test.sh @@ -14,7 +14,7 @@ export CA_CFG_PATH="/tmp/groups" HTTP_PORT="3755" cd $TESTDATA -python -m SimpleHTTPServer $HTTP_PORT & +python -m http.server $HTTP_PORT & HTTP_PID=$! pollSimpleHttp echo $HTTP_PID diff --git a/scripts/fvt/ldap_test.sh b/scripts/fvt/ldap_test.sh index 115f1b52f..e5168bbca 100755 --- a/scripts/fvt/ldap_test.sh +++ b/scripts/fvt/ldap_test.sh @@ -48,7 +48,7 @@ revokeEcert() { result="$3" certFile=$UDIR/$user/msp/signcerts/cert.pem - AKI=$(openssl x509 -noout -text -in $certFile |awk '/keyid/ {gsub(/ *keyid:|:/,"",$1);print toupper($0)}') + AKI=$(openssl x509 -noout -in $certFile -ext authorityKeyIdentifier | awk 'NR==2 { gsub(/ |:/, "", $0); print $0; exit }') SN=$(openssl x509 -noout -serial -in $certFile | awk -F'=' '{print toupper($2)}') case "$result" in @@ -59,13 +59,13 @@ revokeEcert() { fail) echo "User '$admin is attempting to revoke the ecert of user cert of user '$user' ..." # Caller does not have authority to act on affiliation #$FABRIC_CA_CLIENTEXEC revoke -u $URI -a $AKI -s $SN $TLSOPT -H $UDIR/$admin 2>&1| grep 'does not have authority to revoke' - $FABRIC_CA_CLIENTEXEC revoke -u $URI -a $AKI -s $SN $TLSOPT -H $UDIR/$admin 2>&1| egrep "(does not have authority to (act|revoke)|Authorization failure)" + $FABRIC_CA_CLIENTEXEC revoke -u $URI -a $AKI -s $SN $TLSOPT -H $UDIR/$admin 2>&1| grep -E "(does not have authority to (act|revoke)|Authorization failure)" test "$?" -eq 0 || ErrorMsg "User '$admin' not authorized to revoke '$user'" ;; esac } -for u in ${users1[*]}; do +for u in "${users1[@]}"; do CA_CFG_PATH=$UDIR enroll $u ${u}pw uid,hf.Revoker test $? -ne 0 && ErrorExit "Failed to enroll $u" checkUserCert $u @@ -73,12 +73,12 @@ done $FABRIC_CA_CLIENTEXEC register -d -u "$PROTO${CA_HOST_ADDRESS}:$PROXY_PORT" $TLSOPT \ --id.name "testldapuser" \ - -c /tmp/ldap/users/testUser8/fabric-ca-client-config.yaml 2>&1 | egrep "Registration is not supported when using LDAP" + -c /tmp/ldap/users/testUser8/fabric-ca-client-config.yaml 2>&1 | grep "Registration is not supported when using LDAP" test $? -ne 0 && ErrorExit "Registration while using LDAP should have failed" # Sleep for more than the idle connection timeout limit of 1 second sleep 3 -for u in ${users2[*]}; do +for u in "${users2[@]}"; do CA_CFG_PATH=$UDIR enroll $u ${u}pw uid,hf.Revoker test $? -ne 0 && ErrorExit "Failed to enroll $u" checkUserCert $u diff --git a/scripts/fvt/multica_test.sh b/scripts/fvt/multica_test.sh index eacdf4e31..55a9255d9 100755 --- a/scripts/fvt/multica_test.sh +++ b/scripts/fvt/multica_test.sh @@ -177,7 +177,7 @@ for driver in postgres mysql; do done # notadmin cannot revoke - revokeUser notadmin user11 ca1 2>&1 | egrep "Authorization failure" + revokeUser notadmin user11 ca1 2>&1 | grep "Authorization failure" test "$?" -ne 0 && ErrorMsg "Non-revoker successfully revoked cert or failed for incorrect reason" # Check the DB contents @@ -194,7 +194,7 @@ for driver in postgres mysql; do # Grab the serial number of user$i$j cert SN_UC="$(openssl x509 -noout -serial -in $c | awk -F'=' '{print toupper($2)}')" # and the auth keyid of notadmin cert - translate upper to lower case - AKI_UC=$(openssl x509 -noout -text -in $c |awk '/keyid/ {gsub(/ *keyid:|:/,"",$1);print toupper($0)}') + AKI_UC=$(openssl x509 -noout -in $c -ext authorityKeyIdentifier | awk 'NR==2 { gsub(/ |:/, "", $0); print $0; exit }') # Revoke the certs echo "SN ---> $SN_UC" echo "AKI ---> $AKI_UC" @@ -225,7 +225,7 @@ for driver in postgres mysql; do echo "=========================> REVOKING self" revokeUser admin admin ca$i # Verify that the cert is no longer usable - revokeUser admin user$i$j ca$i 2>&1 | egrep "Authentication failure" + revokeUser admin user$i$j ca$i 2>&1 | grep "Authentication failure" test $? -ne 0 && ErrorMsg "Improper revocation using revoked certificate" RC done done @@ -241,4 +241,3 @@ test "$RC" -eq 0 && $SCRIPTDIR/fabric-ca_setup.sh -R -x $CA_CFG_PATH -d $driver rm -f $TESTDATA/openssl.cnf.base.req CleanUp "$RC" exit $RC - diff --git a/scripts/fvt/passwordsInLog_test.sh b/scripts/fvt/passwordsInLog_test.sh index e23f58e2f..3f3c1c298 100755 --- a/scripts/fvt/passwordsInLog_test.sh +++ b/scripts/fvt/passwordsInLog_test.sh @@ -23,12 +23,12 @@ function checkPasswd() { set -f # Extract password value(s) from logfile case "$Type" in - user) passwd=$(egrep -ao "Pass:[^[:space:]]+" $LOGFILE| awk -F':' '{print $2}') ;; - ldap) passwd=$(egrep -aio "ldap.*@" $LOGFILE| awk -v FS=[:@] '{print $(NF-1)}') ;; - mysql) passwd=$(egrep -ao "[a-z0-9*]+@tcp" $LOGFILE| awk -v FS=@ '{print $(NF-1)}') ;; - postgres) passwd=$(egrep -ao "password=[^ ]+ " $LOGFILE| awk -F '=' '{print $2}') ;; - register) passwd=$(egrep -oar 'Received registration.*Secret[^ ]+' $LOGFILE | awk -F':' '{print $NF}') ;; -intermediateCa) passwd=$(egrep -ao "Enrolling.*Secret:[^ ]+ " $LOGFILE | awk -F':' '{print $NF}') ;; + user) passwd=$(grep -E -ao "Pass:[^[:space:]]+" $LOGFILE| awk -F':' '{print $2}') ;; + ldap) passwd=$(grep -E -aio "ldap.*@" $LOGFILE| awk -v FS=[:@] '{print $(NF-1)}') ;; + mysql) passwd=$(grep -E -ao "[a-z0-9*]+@tcp" $LOGFILE| awk -v FS=@ '{print $(NF-1)}') ;; + postgres) passwd=$(grep -E -ao "password=[^ ]+ " $LOGFILE| awk -F '=' '{print $2}') ;; + register) passwd=$(grep -E -oar 'Received registration.*Secret[^ ]+' $LOGFILE | awk -F':' '{print $NF}') ;; +intermediateCa) passwd=$(grep -E -ao "Enrolling.*Secret:[^ ]+ " $LOGFILE | awk -F':' '{print $NF}') ;; esac # Fail if password is empty diff --git a/scripts/fvt/reenroll_test.sh b/scripts/fvt/reenroll_test.sh index 200f67500..4a4c8f281 100755 --- a/scripts/fvt/reenroll_test.sh +++ b/scripts/fvt/reenroll_test.sh @@ -67,7 +67,7 @@ EOF test -f "$CERT_HOME" || mkdir -p "$CERT_HOME" cd $CERT_HOME cp $TESTDATA/TestCRL.crl $CERT_HOME -python -m SimpleHTTPServer $HTTP_PORT & +python -m http.server $HTTP_PORT & HTTP_PID=$! pollSimpleHttp echo $HTTP_PID diff --git a/scripts/fvt/reregister_test.sh b/scripts/fvt/reregister_test.sh index fb38dd789..09bcbd203 100755 --- a/scripts/fvt/reregister_test.sh +++ b/scripts/fvt/reregister_test.sh @@ -33,7 +33,7 @@ export CA_CFG_PATH export FABRIC_CA_CLIENT_HOME="$CA_CFG_PATH/$REGISTRAR" cd $TESTDATA -python -m SimpleHTTPServer $HTTP_PORT & +python -m http.server $HTTP_PORT & HTTP_PID=$! pollSimpleHttp echo $HTTP_PID diff --git a/scripts/fvt/revoke_test.sh b/scripts/fvt/revoke_test.sh index 04b3c5c6b..418f493c7 100755 --- a/scripts/fvt/revoke_test.sh +++ b/scripts/fvt/revoke_test.sh @@ -73,7 +73,7 @@ revokedRevoked="-1 revoked" TEST_RESULTS=("$revokedRevoked" "$revokedRevoked" "$enrolledRevoked" "$enrolledRevoked" "$enrolledGood" "$enrolledGood" ) cd $TESTDATA -python -m SimpleHTTPServer $HTTP_PORT & +python -m http.server $HTTP_PORT & HTTP_PID=$! pollSimpleHttp echo $HTTP_PID diff --git a/scripts/fvt/roundrobin_test.sh b/scripts/fvt/roundrobin_test.sh index 48baa4413..7e305e4e2 100755 --- a/scripts/fvt/roundrobin_test.sh +++ b/scripts/fvt/roundrobin_test.sh @@ -23,7 +23,7 @@ EXPECTED_DISTRIBUTION=$(((NUM_USERS+1)*2/$NUM_SERVERS)) export CA_CFG_PATH cd $TESTDATA -python -m SimpleHTTPServer $HTTP_PORT & +python -m http.server $HTTP_PORT & HTTP_PID=$! pollSimpleHttp echo $HTTP_PID diff --git a/tools/go.mod b/tools/go.mod index dff1df379..21f98f1ec 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -1,12 +1,19 @@ module tools -go 1.14 +go 1.24.0 require ( - github.com/AlekSi/gocov-xml v0.0.0-20190121064608-3a14fb1c4737 - github.com/axw/gocov v1.0.0 - github.com/hyperledger/fabric-lib-go v1.1.0 - github.com/onsi/ginkgo v1.16.5 // indirect - golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 - golang.org/x/tools v0.17.0 + github.com/AlekSi/gocov-xml v1.2.0 + github.com/axw/gocov v1.2.1 + github.com/hyperledger/fabric-lib-go v1.1.2 + golang.org/x/lint v0.0.0-20241112194109-818c5a804067 + golang.org/x/tools v0.38.0 +) + +require ( + golang.org/x/mod v0.29.0 // indirect + golang.org/x/sync v0.17.0 // indirect + golang.org/x/sys v0.37.0 // indirect + golang.org/x/telemetry v0.0.0-20251008203120-078029d740a8 // indirect + golang.org/x/text v0.30.0 // indirect ) diff --git a/tools/go.sum b/tools/go.sum index c9e3c174e..6790dc28c 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -1,2533 +1,61 @@ -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.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.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.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= -cloud.google.com/go v0.100.1/go.mod h1:fs4QogzfH5n2pBXBP9vRiU+eCny7lD2vmFZy79Iuw1U= -cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= -cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= -cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= -cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= -cloud.google.com/go v0.105.0/go.mod h1:PrLgOJNe5nfE9UMxKxgXj4mD3voiP+YQ6gdt6KMFOKM= -cloud.google.com/go v0.107.0/go.mod h1:wpc2eNrD7hXUTy8EKS10jkxpZBjASrORK7goS+3YX2I= -cloud.google.com/go v0.110.0/go.mod h1:SJnCLqQ0FCFGSZMUNUf84MV3Aia54kn7pi8st7tMzaY= -cloud.google.com/go v0.110.2/go.mod h1:k04UEeEtb6ZBRTv3dZz4CeJC3jKGxyhl0sAiVVquxiw= -cloud.google.com/go v0.110.4/go.mod h1:+EYjdK8e5RME/VY/qLCAtuyALQ9q67dvuum8i+H5xsI= -cloud.google.com/go v0.110.6/go.mod h1:+EYjdK8e5RME/VY/qLCAtuyALQ9q67dvuum8i+H5xsI= -cloud.google.com/go v0.110.7/go.mod h1:+EYjdK8e5RME/VY/qLCAtuyALQ9q67dvuum8i+H5xsI= -cloud.google.com/go v0.110.8/go.mod h1:Iz8AkXJf1qmxC3Oxoep8R1T36w8B92yU29PcBhHO5fk= -cloud.google.com/go v0.110.9/go.mod h1:rpxevX/0Lqvlbc88b7Sc1SPNdyK1riNBTUU6JXhYNpM= -cloud.google.com/go v0.110.10/go.mod h1:v1OoFqYxiBkUrruItNM3eT4lLByNjxmJSV/xDKJNnic= -cloud.google.com/go/accessapproval v1.4.0/go.mod h1:zybIuC3KpDOvotz59lFe5qxRZx6C75OtwbisN56xYB4= -cloud.google.com/go/accessapproval v1.5.0/go.mod h1:HFy3tuiGvMdcd/u+Cu5b9NkO1pEICJ46IR82PoUdplw= -cloud.google.com/go/accessapproval v1.6.0/go.mod h1:R0EiYnwV5fsRFiKZkPHr6mwyk2wxUJ30nL4j2pcFY2E= -cloud.google.com/go/accessapproval v1.7.1/go.mod h1:JYczztsHRMK7NTXb6Xw+dwbs/WnOJxbo/2mTI+Kgg68= -cloud.google.com/go/accessapproval v1.7.2/go.mod h1:/gShiq9/kK/h8T/eEn1BTzalDvk0mZxJlhfw0p+Xuc0= -cloud.google.com/go/accessapproval v1.7.3/go.mod h1:4l8+pwIxGTNqSf4T3ds8nLO94NQf0W/KnMNuQ9PbnP8= -cloud.google.com/go/accessapproval v1.7.4/go.mod h1:/aTEh45LzplQgFYdQdwPMR9YdX0UlhBmvB84uAmQKUc= -cloud.google.com/go/accesscontextmanager v1.3.0/go.mod h1:TgCBehyr5gNMz7ZaH9xubp+CE8dkrszb4oK9CWyvD4o= -cloud.google.com/go/accesscontextmanager v1.4.0/go.mod h1:/Kjh7BBu/Gh83sv+K60vN9QE5NJcd80sU33vIe2IFPE= -cloud.google.com/go/accesscontextmanager v1.6.0/go.mod h1:8XCvZWfYw3K/ji0iVnp+6pu7huxoQTLmxAbVjbloTtM= -cloud.google.com/go/accesscontextmanager v1.7.0/go.mod h1:CEGLewx8dwa33aDAZQujl7Dx+uYhS0eay198wB/VumQ= -cloud.google.com/go/accesscontextmanager v1.8.0/go.mod h1:uI+AI/r1oyWK99NN8cQ3UK76AMelMzgZCvJfsi2c+ps= -cloud.google.com/go/accesscontextmanager v1.8.1/go.mod h1:JFJHfvuaTC+++1iL1coPiG1eu5D24db2wXCDWDjIrxo= -cloud.google.com/go/accesscontextmanager v1.8.2/go.mod h1:E6/SCRM30elQJ2PKtFMs2YhfJpZSNcJyejhuzoId4Zk= -cloud.google.com/go/accesscontextmanager v1.8.3/go.mod h1:4i/JkF2JiFbhLnnpnfoTX5vRXfhf9ukhU1ANOTALTOQ= -cloud.google.com/go/accesscontextmanager v1.8.4/go.mod h1:ParU+WbMpD34s5JFEnGAnPBYAgUHozaTmDJU7aCU9+M= -cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= -cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= -cloud.google.com/go/aiplatform v1.27.0/go.mod h1:Bvxqtl40l0WImSb04d0hXFU7gDOiq9jQmorivIiWcKg= -cloud.google.com/go/aiplatform v1.35.0/go.mod h1:7MFT/vCaOyZT/4IIFfxH4ErVg/4ku6lKv3w0+tFTgXQ= -cloud.google.com/go/aiplatform v1.36.1/go.mod h1:WTm12vJRPARNvJ+v6P52RDHCNe4AhvjcIZ/9/RRHy/k= -cloud.google.com/go/aiplatform v1.37.0/go.mod h1:IU2Cv29Lv9oCn/9LkFiiuKfwrRTq+QQMbW+hPCxJGZw= -cloud.google.com/go/aiplatform v1.45.0/go.mod h1:Iu2Q7sC7QGhXUeOhAj/oCK9a+ULz1O4AotZiqjQ8MYA= -cloud.google.com/go/aiplatform v1.48.0/go.mod h1:Iu2Q7sC7QGhXUeOhAj/oCK9a+ULz1O4AotZiqjQ8MYA= -cloud.google.com/go/aiplatform v1.50.0/go.mod h1:IRc2b8XAMTa9ZmfJV1BCCQbieWWvDnP1A8znyz5N7y4= -cloud.google.com/go/aiplatform v1.51.0/go.mod h1:IRc2b8XAMTa9ZmfJV1BCCQbieWWvDnP1A8znyz5N7y4= -cloud.google.com/go/aiplatform v1.51.1/go.mod h1:kY3nIMAVQOK2XDqDPHaOuD9e+FdMA6OOpfBjsvaFSOo= -cloud.google.com/go/aiplatform v1.51.2/go.mod h1:hCqVYB3mY45w99TmetEoe8eCQEwZEp9WHxeZdcv9phw= -cloud.google.com/go/aiplatform v1.52.0/go.mod h1:pwZMGvqe0JRkI1GWSZCtnAfrR4K1bv65IHILGA//VEU= -cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= -cloud.google.com/go/analytics v0.12.0/go.mod h1:gkfj9h6XRf9+TS4bmuhPEShsh3hH8PAZzm/41OOhQd4= -cloud.google.com/go/analytics v0.17.0/go.mod h1:WXFa3WSym4IZ+JiKmavYdJwGG/CvpqiqczmL59bTD9M= -cloud.google.com/go/analytics v0.18.0/go.mod h1:ZkeHGQlcIPkw0R/GW+boWHhCOR43xz9RN/jn7WcqfIE= -cloud.google.com/go/analytics v0.19.0/go.mod h1:k8liqf5/HCnOUkbawNtrWWc+UAzyDlW89doe8TtoDsE= -cloud.google.com/go/analytics v0.21.2/go.mod h1:U8dcUtmDmjrmUTnnnRnI4m6zKn/yaA5N9RlEkYFHpQo= -cloud.google.com/go/analytics v0.21.3/go.mod h1:U8dcUtmDmjrmUTnnnRnI4m6zKn/yaA5N9RlEkYFHpQo= -cloud.google.com/go/analytics v0.21.4/go.mod h1:zZgNCxLCy8b2rKKVfC1YkC2vTrpfZmeRCySM3aUbskA= -cloud.google.com/go/analytics v0.21.5/go.mod h1:BQtOBHWTlJ96axpPPnw5CvGJ6i3Ve/qX2fTxR8qWyr8= -cloud.google.com/go/analytics v0.21.6/go.mod h1:eiROFQKosh4hMaNhF85Oc9WO97Cpa7RggD40e/RBy8w= -cloud.google.com/go/apigateway v1.3.0/go.mod h1:89Z8Bhpmxu6AmUxuVRg/ECRGReEdiP3vQtk4Z1J9rJk= -cloud.google.com/go/apigateway v1.4.0/go.mod h1:pHVY9MKGaH9PQ3pJ4YLzoj6U5FUDeDFBllIz7WmzJoc= -cloud.google.com/go/apigateway v1.5.0/go.mod h1:GpnZR3Q4rR7LVu5951qfXPJCHquZt02jf7xQx7kpqN8= -cloud.google.com/go/apigateway v1.6.1/go.mod h1:ufAS3wpbRjqfZrzpvLC2oh0MFlpRJm2E/ts25yyqmXA= -cloud.google.com/go/apigateway v1.6.2/go.mod h1:CwMC90nnZElorCW63P2pAYm25AtQrHfuOkbRSHj0bT8= -cloud.google.com/go/apigateway v1.6.3/go.mod h1:k68PXWpEs6BVDTtnLQAyG606Q3mz8pshItwPXjgv44Y= -cloud.google.com/go/apigateway v1.6.4/go.mod h1:0EpJlVGH5HwAN4VF4Iec8TAzGN1aQgbxAWGJsnPCGGY= -cloud.google.com/go/apigeeconnect v1.3.0/go.mod h1:G/AwXFAKo0gIXkPTVfZDd2qA1TxBXJ3MgMRBQkIi9jc= -cloud.google.com/go/apigeeconnect v1.4.0/go.mod h1:kV4NwOKqjvt2JYR0AoIWo2QGfoRtn/pkS3QlHp0Ni04= -cloud.google.com/go/apigeeconnect v1.5.0/go.mod h1:KFaCqvBRU6idyhSNyn3vlHXc8VMDJdRmwDF6JyFRqZ8= -cloud.google.com/go/apigeeconnect v1.6.1/go.mod h1:C4awq7x0JpLtrlQCr8AzVIzAaYgngRqWf9S5Uhg+wWs= -cloud.google.com/go/apigeeconnect v1.6.2/go.mod h1:s6O0CgXT9RgAxlq3DLXvG8riw8PYYbU/v25jqP3Dy18= -cloud.google.com/go/apigeeconnect v1.6.3/go.mod h1:peG0HFQ0si2bN15M6QSjEW/W7Gy3NYkWGz7pFz13cbo= -cloud.google.com/go/apigeeconnect v1.6.4/go.mod h1:CapQCWZ8TCjnU0d7PobxhpOdVz/OVJ2Hr/Zcuu1xFx0= -cloud.google.com/go/apigeeregistry v0.4.0/go.mod h1:EUG4PGcsZvxOXAdyEghIdXwAEi/4MEaoqLMLDMIwKXY= -cloud.google.com/go/apigeeregistry v0.5.0/go.mod h1:YR5+s0BVNZfVOUkMa5pAR2xGd0A473vA5M7j247o1wM= -cloud.google.com/go/apigeeregistry v0.6.0/go.mod h1:BFNzW7yQVLZ3yj0TKcwzb8n25CFBri51GVGOEUcgQsc= -cloud.google.com/go/apigeeregistry v0.7.1/go.mod h1:1XgyjZye4Mqtw7T9TsY4NW10U7BojBvG4RMD+vRDrIw= -cloud.google.com/go/apigeeregistry v0.7.2/go.mod h1:9CA2B2+TGsPKtfi3F7/1ncCCsL62NXBRfM6iPoGSM+8= -cloud.google.com/go/apigeeregistry v0.8.1/go.mod h1:MW4ig1N4JZQsXmBSwH4rwpgDonocz7FPBSw6XPGHmYw= -cloud.google.com/go/apigeeregistry v0.8.2/go.mod h1:h4v11TDGdeXJDJvImtgK2AFVvMIgGWjSb0HRnBSjcX8= -cloud.google.com/go/apikeys v0.4.0/go.mod h1:XATS/yqZbaBK0HOssf+ALHp8jAlNHUgyfprvNcBIszU= -cloud.google.com/go/apikeys v0.5.0/go.mod h1:5aQfwY4D+ewMMWScd3hm2en3hCj+BROlyrt3ytS7KLI= -cloud.google.com/go/apikeys v0.6.0/go.mod h1:kbpXu5upyiAlGkKrJgQl8A0rKNNJ7dQ377pdroRSSi8= -cloud.google.com/go/appengine v1.4.0/go.mod h1:CS2NhuBuDXM9f+qscZ6V86m1MIIqPj3WC/UoEuR1Sno= -cloud.google.com/go/appengine v1.5.0/go.mod h1:TfasSozdkFI0zeoxW3PTBLiNqRmzraodCWatWI9Dmak= -cloud.google.com/go/appengine v1.6.0/go.mod h1:hg6i0J/BD2cKmDJbaFSYHFyZkgBEfQrDg/X0V5fJn84= -cloud.google.com/go/appengine v1.7.0/go.mod h1:eZqpbHFCqRGa2aCdope7eC0SWLV1j0neb/QnMJVWx6A= -cloud.google.com/go/appengine v1.7.1/go.mod h1:IHLToyb/3fKutRysUlFO0BPt5j7RiQ45nrzEJmKTo6E= -cloud.google.com/go/appengine v1.8.1/go.mod h1:6NJXGLVhZCN9aQ/AEDvmfzKEfoYBlfB80/BHiKVputY= -cloud.google.com/go/appengine v1.8.2/go.mod h1:WMeJV9oZ51pvclqFN2PqHoGnys7rK0rz6s3Mp6yMvDo= -cloud.google.com/go/appengine v1.8.3/go.mod h1:2oUPZ1LVZ5EXi+AF1ihNAF+S8JrzQ3till5m9VQkrsk= -cloud.google.com/go/appengine v1.8.4/go.mod h1:TZ24v+wXBujtkK77CXCpjZbnuTvsFNT41MUaZ28D6vg= -cloud.google.com/go/area120 v0.5.0/go.mod h1:DE/n4mp+iqVyvxHN41Vf1CR602GiHQjFPusMFW6bGR4= -cloud.google.com/go/area120 v0.6.0/go.mod h1:39yFJqWVgm0UZqWTOdqkLhjoC7uFfgXRC8g/ZegeAh0= -cloud.google.com/go/area120 v0.7.0/go.mod h1:a3+8EUD1SX5RUcCs3MY5YasiO1z6yLiNLRiFrykbynY= -cloud.google.com/go/area120 v0.7.1/go.mod h1:j84i4E1RboTWjKtZVWXPqvK5VHQFJRF2c1Nm69pWm9k= -cloud.google.com/go/area120 v0.8.1/go.mod h1:BVfZpGpB7KFVNxPiQBuHkX6Ed0rS51xIgmGyjrAfzsg= -cloud.google.com/go/area120 v0.8.2/go.mod h1:a5qfo+x77SRLXnCynFWPUZhnZGeSgvQ+Y0v1kSItkh4= -cloud.google.com/go/area120 v0.8.3/go.mod h1:5zj6pMzVTH+SVHljdSKC35sriR/CVvQZzG/Icdyriw0= -cloud.google.com/go/area120 v0.8.4/go.mod h1:jfawXjxf29wyBXr48+W+GyX/f8fflxp642D/bb9v68M= -cloud.google.com/go/artifactregistry v1.6.0/go.mod h1:IYt0oBPSAGYj/kprzsBjZ/4LnG/zOcHyFHjWPCi6SAQ= -cloud.google.com/go/artifactregistry v1.7.0/go.mod h1:mqTOFOnGZx8EtSqK/ZWcsm/4U8B77rbcLP6ruDU2Ixk= -cloud.google.com/go/artifactregistry v1.8.0/go.mod h1:w3GQXkJX8hiKN0v+at4b0qotwijQbYUqF2GWkZzAhC0= -cloud.google.com/go/artifactregistry v1.9.0/go.mod h1:2K2RqvA2CYvAeARHRkLDhMDJ3OXy26h3XW+3/Jh2uYc= -cloud.google.com/go/artifactregistry v1.11.1/go.mod h1:lLYghw+Itq9SONbCa1YWBoWs1nOucMH0pwXN1rOBZFI= -cloud.google.com/go/artifactregistry v1.11.2/go.mod h1:nLZns771ZGAwVLzTX/7Al6R9ehma4WUEhZGWV6CeQNQ= -cloud.google.com/go/artifactregistry v1.12.0/go.mod h1:o6P3MIvtzTOnmvGagO9v/rOjjA0HmhJ+/6KAXrmYDCI= -cloud.google.com/go/artifactregistry v1.13.0/go.mod h1:uy/LNfoOIivepGhooAUpL1i30Hgee3Cu0l4VTWHUC08= -cloud.google.com/go/artifactregistry v1.14.1/go.mod h1:nxVdG19jTaSTu7yA7+VbWL346r3rIdkZ142BSQqhn5E= -cloud.google.com/go/artifactregistry v1.14.2/go.mod h1:Xk+QbsKEb0ElmyeMfdHAey41B+qBq3q5R5f5xD4XT3U= -cloud.google.com/go/artifactregistry v1.14.3/go.mod h1:A2/E9GXnsyXl7GUvQ/2CjHA+mVRoWAXC0brg2os+kNI= -cloud.google.com/go/artifactregistry v1.14.4/go.mod h1:SJJcZTMv6ce0LDMUnihCN7WSrI+kBSFV0KIKo8S8aYU= -cloud.google.com/go/artifactregistry v1.14.6/go.mod h1:np9LSFotNWHcjnOgh8UVK0RFPCTUGbO0ve3384xyHfE= -cloud.google.com/go/asset v1.5.0/go.mod h1:5mfs8UvcM5wHhqtSv8J1CtxxaQq3AdBxxQi2jGW/K4o= -cloud.google.com/go/asset v1.7.0/go.mod h1:YbENsRK4+xTiL+Ofoj5Ckf+O17kJtgp3Y3nn4uzZz5s= -cloud.google.com/go/asset v1.8.0/go.mod h1:mUNGKhiqIdbr8X7KNayoYvyc4HbbFO9URsjbytpUaW0= -cloud.google.com/go/asset v1.9.0/go.mod h1:83MOE6jEJBMqFKadM9NLRcs80Gdw76qGuHn8m3h8oHQ= -cloud.google.com/go/asset v1.10.0/go.mod h1:pLz7uokL80qKhzKr4xXGvBQXnzHn5evJAEAtZiIb0wY= -cloud.google.com/go/asset v1.11.1/go.mod h1:fSwLhbRvC9p9CXQHJ3BgFeQNM4c9x10lqlrdEUYXlJo= -cloud.google.com/go/asset v1.12.0/go.mod h1:h9/sFOa4eDIyKmH6QMpm4eUK3pDojWnUhTgJlk762Hg= -cloud.google.com/go/asset v1.13.0/go.mod h1:WQAMyYek/b7NBpYq/K4KJWcRqzoalEsxz/t/dTk4THw= -cloud.google.com/go/asset v1.14.1/go.mod h1:4bEJ3dnHCqWCDbWJ/6Vn7GVI9LerSi7Rfdi03hd+WTQ= -cloud.google.com/go/asset v1.15.0/go.mod h1:tpKafV6mEut3+vN9ScGvCHXHj7FALFVta+okxFECHcg= -cloud.google.com/go/asset v1.15.1/go.mod h1:yX/amTvFWRpp5rcFq6XbCxzKT8RJUam1UoboE179jU4= -cloud.google.com/go/asset v1.15.2/go.mod h1:B6H5tclkXvXz7PD22qCA2TDxSVQfasa3iDlM89O2NXs= -cloud.google.com/go/asset v1.15.3/go.mod h1:yYLfUD4wL4X589A9tYrv4rFrba0QlDeag0CMcM5ggXU= -cloud.google.com/go/assuredworkloads v1.5.0/go.mod h1:n8HOZ6pff6re5KYfBXcFvSViQjDwxFkAkmUFffJRbbY= -cloud.google.com/go/assuredworkloads v1.6.0/go.mod h1:yo2YOk37Yc89Rsd5QMVECvjaMKymF9OP+QXWlKXUkXw= -cloud.google.com/go/assuredworkloads v1.7.0/go.mod h1:z/736/oNmtGAyU47reJgGN+KVoYoxeLBoj4XkKYscNI= -cloud.google.com/go/assuredworkloads v1.8.0/go.mod h1:AsX2cqyNCOvEQC8RMPnoc0yEarXQk6WEKkxYfL6kGIo= -cloud.google.com/go/assuredworkloads v1.9.0/go.mod h1:kFuI1P78bplYtT77Tb1hi0FMxM0vVpRC7VVoJC3ZoT0= -cloud.google.com/go/assuredworkloads v1.10.0/go.mod h1:kwdUQuXcedVdsIaKgKTp9t0UJkE5+PAVNhdQm4ZVq2E= -cloud.google.com/go/assuredworkloads v1.11.1/go.mod h1:+F04I52Pgn5nmPG36CWFtxmav6+7Q+c5QyJoL18Lry0= -cloud.google.com/go/assuredworkloads v1.11.2/go.mod h1:O1dfr+oZJMlE6mw0Bp0P1KZSlj5SghMBvTpZqIcUAW4= -cloud.google.com/go/assuredworkloads v1.11.3/go.mod h1:vEjfTKYyRUaIeA0bsGJceFV2JKpVRgyG2op3jfa59Zs= -cloud.google.com/go/assuredworkloads v1.11.4/go.mod h1:4pwwGNwy1RP0m+y12ef3Q/8PaiWrIDQ6nD2E8kvWI9U= -cloud.google.com/go/automl v1.5.0/go.mod h1:34EjfoFGMZ5sgJ9EoLsRtdPSNZLcfflJR39VbVNS2M0= -cloud.google.com/go/automl v1.6.0/go.mod h1:ugf8a6Fx+zP0D59WLhqgTDsQI9w07o64uf/Is3Nh5p8= -cloud.google.com/go/automl v1.7.0/go.mod h1:RL9MYCCsJEOmt0Wf3z9uzG0a7adTT1fe+aObgSpkCt8= -cloud.google.com/go/automl v1.8.0/go.mod h1:xWx7G/aPEe/NP+qzYXktoBSDfjO+vnKMGgsApGJJquM= -cloud.google.com/go/automl v1.12.0/go.mod h1:tWDcHDp86aMIuHmyvjuKeeHEGq76lD7ZqfGLN6B0NuU= -cloud.google.com/go/automl v1.13.1/go.mod h1:1aowgAHWYZU27MybSCFiukPO7xnyawv7pt3zK4bheQE= -cloud.google.com/go/automl v1.13.2/go.mod h1:gNY/fUmDEN40sP8amAX3MaXkxcqPIn7F1UIIPZpy4Mg= -cloud.google.com/go/automl v1.13.3/go.mod h1:Y8KwvyAZFOsMAPqUCfNu1AyclbC6ivCUF/MTwORymyY= -cloud.google.com/go/automl v1.13.4/go.mod h1:ULqwX/OLZ4hBVfKQaMtxMSTlPx0GqGbWN8uA/1EqCP8= -cloud.google.com/go/baremetalsolution v0.3.0/go.mod h1:XOrocE+pvK1xFfleEnShBlNAXf+j5blPPxrhjKgnIFc= -cloud.google.com/go/baremetalsolution v0.4.0/go.mod h1:BymplhAadOO/eBa7KewQ0Ppg4A4Wplbn+PsFKRLo0uI= -cloud.google.com/go/baremetalsolution v0.5.0/go.mod h1:dXGxEkmR9BMwxhzBhV0AioD0ULBmuLZI8CdwalUxuss= -cloud.google.com/go/baremetalsolution v1.1.1/go.mod h1:D1AV6xwOksJMV4OSlWHtWuFNZZYujJknMAP4Qa27QIA= -cloud.google.com/go/baremetalsolution v1.2.0/go.mod h1:68wi9AwPYkEWIUT4SvSGS9UJwKzNpshjHsH4lzk8iOw= -cloud.google.com/go/baremetalsolution v1.2.1/go.mod h1:3qKpKIw12RPXStwQXcbhfxVj1dqQGEvcmA+SX/mUR88= -cloud.google.com/go/baremetalsolution v1.2.2/go.mod h1:O5V6Uu1vzVelYahKfwEWRMaS3AbCkeYHy3145s1FkhM= -cloud.google.com/go/baremetalsolution v1.2.3/go.mod h1:/UAQ5xG3faDdy180rCUv47e0jvpp3BFxT+Cl0PFjw5g= -cloud.google.com/go/batch v0.3.0/go.mod h1:TR18ZoAekj1GuirsUsR1ZTKN3FC/4UDnScjT8NXImFE= -cloud.google.com/go/batch v0.4.0/go.mod h1:WZkHnP43R/QCGQsZ+0JyG4i79ranE2u8xvjq/9+STPE= -cloud.google.com/go/batch v0.7.0/go.mod h1:vLZN95s6teRUqRQ4s3RLDsH8PvboqBK+rn1oevL159g= -cloud.google.com/go/batch v1.3.1/go.mod h1:VguXeQKXIYaeeIYbuozUmBR13AfL4SJP7IltNPS+A4A= -cloud.google.com/go/batch v1.4.1/go.mod h1:KdBmDD61K0ovcxoRHGrN6GmOBWeAOyCgKD0Mugx4Fkk= -cloud.google.com/go/batch v1.5.0/go.mod h1:KdBmDD61K0ovcxoRHGrN6GmOBWeAOyCgKD0Mugx4Fkk= -cloud.google.com/go/batch v1.5.1/go.mod h1:RpBuIYLkQu8+CWDk3dFD/t/jOCGuUpkpX+Y0n1Xccs8= -cloud.google.com/go/batch v1.6.1/go.mod h1:urdpD13zPe6YOK+6iZs/8/x2VBRofvblLpx0t57vM98= -cloud.google.com/go/batch v1.6.3/go.mod h1:J64gD4vsNSA2O5TtDB5AAux3nJ9iV8U3ilg3JDBYejU= -cloud.google.com/go/beyondcorp v0.2.0/go.mod h1:TB7Bd+EEtcw9PCPQhCJtJGjk/7TC6ckmnSFS+xwTfm4= -cloud.google.com/go/beyondcorp v0.3.0/go.mod h1:E5U5lcrcXMsCuoDNyGrpyTm/hn7ne941Jz2vmksAxW8= -cloud.google.com/go/beyondcorp v0.4.0/go.mod h1:3ApA0mbhHx6YImmuubf5pyW8srKnCEPON32/5hj+RmM= -cloud.google.com/go/beyondcorp v0.5.0/go.mod h1:uFqj9X+dSfrheVp7ssLTaRHd2EHqSL4QZmH4e8WXGGU= -cloud.google.com/go/beyondcorp v0.6.1/go.mod h1:YhxDWw946SCbmcWo3fAhw3V4XZMSpQ/VYfcKGAEU8/4= -cloud.google.com/go/beyondcorp v1.0.0/go.mod h1:YhxDWw946SCbmcWo3fAhw3V4XZMSpQ/VYfcKGAEU8/4= -cloud.google.com/go/beyondcorp v1.0.1/go.mod h1:zl/rWWAFVeV+kx+X2Javly7o1EIQThU4WlkynffL/lk= -cloud.google.com/go/beyondcorp v1.0.2/go.mod h1:m8cpG7caD+5su+1eZr+TSvF6r21NdLJk4f9u4SP2Ntc= -cloud.google.com/go/beyondcorp v1.0.3/go.mod h1:HcBvnEd7eYr+HGDd5ZbuVmBYX019C6CEXBonXbCVwJo= -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/bigquery v1.42.0/go.mod h1:8dRTJxhtG+vwBKzE5OseQn/hiydoQN3EedCaOdYmxRA= -cloud.google.com/go/bigquery v1.43.0/go.mod h1:ZMQcXHsl+xmU1z36G2jNGZmKp9zNY5BUua5wDgmNCfw= -cloud.google.com/go/bigquery v1.44.0/go.mod h1:0Y33VqXTEsbamHJvJHdFmtqHvMIY28aK1+dFsvaChGc= -cloud.google.com/go/bigquery v1.47.0/go.mod h1:sA9XOgy0A8vQK9+MWhEQTY6Tix87M/ZurWFIxmF9I/E= -cloud.google.com/go/bigquery v1.48.0/go.mod h1:QAwSz+ipNgfL5jxiaK7weyOhzdoAy1zFm0Nf1fysJac= -cloud.google.com/go/bigquery v1.49.0/go.mod h1:Sv8hMmTFFYBlt/ftw2uN6dFdQPzBlREY9yBh7Oy7/4Q= -cloud.google.com/go/bigquery v1.50.0/go.mod h1:YrleYEh2pSEbgTBZYMJ5SuSr0ML3ypjRB1zgf7pvQLU= -cloud.google.com/go/bigquery v1.52.0/go.mod h1:3b/iXjRQGU4nKa87cXeg6/gogLjO8C6PmuM8i5Bi/u4= -cloud.google.com/go/bigquery v1.53.0/go.mod h1:3b/iXjRQGU4nKa87cXeg6/gogLjO8C6PmuM8i5Bi/u4= -cloud.google.com/go/bigquery v1.55.0/go.mod h1:9Y5I3PN9kQWuid6183JFhOGOW3GcirA5LpsKCUn+2ec= -cloud.google.com/go/bigquery v1.56.0/go.mod h1:KDcsploXTEY7XT3fDQzMUZlpQLHzE4itubHrnmhUrZA= -cloud.google.com/go/bigquery v1.57.1/go.mod h1:iYzC0tGVWt1jqSzBHqCr3lrRn0u13E8e+AqowBsDgug= -cloud.google.com/go/billing v1.4.0/go.mod h1:g9IdKBEFlItS8bTtlrZdVLWSSdSyFUZKXNS02zKMOZY= -cloud.google.com/go/billing v1.5.0/go.mod h1:mztb1tBc3QekhjSgmpf/CV4LzWXLzCArwpLmP2Gm88s= -cloud.google.com/go/billing v1.6.0/go.mod h1:WoXzguj+BeHXPbKfNWkqVtDdzORazmCjraY+vrxcyvI= -cloud.google.com/go/billing v1.7.0/go.mod h1:q457N3Hbj9lYwwRbnlD7vUpyjq6u5U1RAOArInEiD5Y= -cloud.google.com/go/billing v1.12.0/go.mod h1:yKrZio/eu+okO/2McZEbch17O5CB5NpZhhXG6Z766ss= -cloud.google.com/go/billing v1.13.0/go.mod h1:7kB2W9Xf98hP9Sr12KfECgfGclsH3CQR0R08tnRlRbc= -cloud.google.com/go/billing v1.16.0/go.mod h1:y8vx09JSSJG02k5QxbycNRrN7FGZB6F3CAcgum7jvGA= -cloud.google.com/go/billing v1.17.0/go.mod h1:Z9+vZXEq+HwH7bhJkyI4OQcR6TSbeMrjlpEjO2vzY64= -cloud.google.com/go/billing v1.17.1/go.mod h1:Z9+vZXEq+HwH7bhJkyI4OQcR6TSbeMrjlpEjO2vzY64= -cloud.google.com/go/billing v1.17.2/go.mod h1:u/AdV/3wr3xoRBk5xvUzYMS1IawOAPwQMuHgHMdljDg= -cloud.google.com/go/billing v1.17.3/go.mod h1:z83AkoZ7mZwBGT3yTnt6rSGI1OOsHSIi6a5M3mJ8NaU= -cloud.google.com/go/billing v1.17.4/go.mod h1:5DOYQStCxquGprqfuid/7haD7th74kyMBHkjO/OvDtk= -cloud.google.com/go/binaryauthorization v1.1.0/go.mod h1:xwnoWu3Y84jbuHa0zd526MJYmtnVXn0syOjaJgy4+dM= -cloud.google.com/go/binaryauthorization v1.2.0/go.mod h1:86WKkJHtRcv5ViNABtYMhhNWRrD1Vpi//uKEy7aYEfI= -cloud.google.com/go/binaryauthorization v1.3.0/go.mod h1:lRZbKgjDIIQvzYQS1p99A7/U1JqvqeZg0wiI5tp6tg0= -cloud.google.com/go/binaryauthorization v1.4.0/go.mod h1:tsSPQrBd77VLplV70GUhBf/Zm3FsKmgSqgm4UmiDItk= -cloud.google.com/go/binaryauthorization v1.5.0/go.mod h1:OSe4OU1nN/VswXKRBmciKpo9LulY41gch5c68htf3/Q= -cloud.google.com/go/binaryauthorization v1.6.1/go.mod h1:TKt4pa8xhowwffiBmbrbcxijJRZED4zrqnwZ1lKH51U= -cloud.google.com/go/binaryauthorization v1.7.0/go.mod h1:Zn+S6QqTMn6odcMU1zDZCJxPjU2tZPV1oDl45lWY154= -cloud.google.com/go/binaryauthorization v1.7.1/go.mod h1:GTAyfRWYgcbsP3NJogpV3yeunbUIjx2T9xVeYovtURE= -cloud.google.com/go/binaryauthorization v1.7.2/go.mod h1:kFK5fQtxEp97m92ziy+hbu+uKocka1qRRL8MVJIgjv0= -cloud.google.com/go/binaryauthorization v1.7.3/go.mod h1:VQ/nUGRKhrStlGr+8GMS8f6/vznYLkdK5vaKfdCIpvU= -cloud.google.com/go/certificatemanager v1.3.0/go.mod h1:n6twGDvcUBFu9uBgt4eYvvf3sQ6My8jADcOVwHmzadg= -cloud.google.com/go/certificatemanager v1.4.0/go.mod h1:vowpercVFyqs8ABSmrdV+GiFf2H/ch3KyudYQEMM590= -cloud.google.com/go/certificatemanager v1.6.0/go.mod h1:3Hh64rCKjRAX8dXgRAyOcY5vQ/fE1sh8o+Mdd6KPgY8= -cloud.google.com/go/certificatemanager v1.7.1/go.mod h1:iW8J3nG6SaRYImIa+wXQ0g8IgoofDFRp5UMzaNk1UqI= -cloud.google.com/go/certificatemanager v1.7.2/go.mod h1:15SYTDQMd00kdoW0+XY5d9e+JbOPjp24AvF48D8BbcQ= -cloud.google.com/go/certificatemanager v1.7.3/go.mod h1:T/sZYuC30PTag0TLo28VedIRIj1KPGcOQzjWAptHa00= -cloud.google.com/go/certificatemanager v1.7.4/go.mod h1:FHAylPe/6IIKuaRmHbjbdLhGhVQ+CWHSD5Jq0k4+cCE= -cloud.google.com/go/channel v1.8.0/go.mod h1:W5SwCXDJsq/rg3tn3oG0LOxpAo6IMxNa09ngphpSlnk= -cloud.google.com/go/channel v1.9.0/go.mod h1:jcu05W0my9Vx4mt3/rEHpfxc9eKi9XwsdDL8yBMbKUk= -cloud.google.com/go/channel v1.11.0/go.mod h1:IdtI0uWGqhEeatSB62VOoJ8FSUhJ9/+iGkJVqp74CGE= -cloud.google.com/go/channel v1.12.0/go.mod h1:VkxCGKASi4Cq7TbXxlaBezonAYpp1GCnKMY6tnMQnLU= -cloud.google.com/go/channel v1.16.0/go.mod h1:eN/q1PFSl5gyu0dYdmxNXscY/4Fi7ABmeHCJNf/oHmc= -cloud.google.com/go/channel v1.17.0/go.mod h1:RpbhJsGi/lXWAUM1eF4IbQGbsfVlg2o8Iiy2/YLfVT0= -cloud.google.com/go/channel v1.17.1/go.mod h1:xqfzcOZAcP4b/hUDH0GkGg1Sd5to6di1HOJn/pi5uBQ= -cloud.google.com/go/channel v1.17.2/go.mod h1:aT2LhnftnyfQceFql5I/mP8mIbiiJS4lWqgXA815zMk= -cloud.google.com/go/channel v1.17.3/go.mod h1:QcEBuZLGGrUMm7kNj9IbU1ZfmJq2apotsV83hbxX7eE= -cloud.google.com/go/cloudbuild v1.3.0/go.mod h1:WequR4ULxlqvMsjDEEEFnOG5ZSRSgWOywXYDb1vPE6U= -cloud.google.com/go/cloudbuild v1.4.0/go.mod h1:5Qwa40LHiOXmz3386FrjrYM93rM/hdRr7b53sySrTqA= -cloud.google.com/go/cloudbuild v1.6.0/go.mod h1:UIbc/w9QCbH12xX+ezUsgblrWv+Cv4Tw83GiSMHOn9M= -cloud.google.com/go/cloudbuild v1.7.0/go.mod h1:zb5tWh2XI6lR9zQmsm1VRA+7OCuve5d8S+zJUul8KTg= -cloud.google.com/go/cloudbuild v1.9.0/go.mod h1:qK1d7s4QlO0VwfYn5YuClDGg2hfmLZEb4wQGAbIgL1s= -cloud.google.com/go/cloudbuild v1.10.1/go.mod h1:lyJg7v97SUIPq4RC2sGsz/9tNczhyv2AjML/ci4ulzU= -cloud.google.com/go/cloudbuild v1.13.0/go.mod h1:lyJg7v97SUIPq4RC2sGsz/9tNczhyv2AjML/ci4ulzU= -cloud.google.com/go/cloudbuild v1.14.0/go.mod h1:lyJg7v97SUIPq4RC2sGsz/9tNczhyv2AjML/ci4ulzU= -cloud.google.com/go/cloudbuild v1.14.1/go.mod h1:K7wGc/3zfvmYWOWwYTgF/d/UVJhS4pu+HAy7PL7mCsU= -cloud.google.com/go/cloudbuild v1.14.2/go.mod h1:Bn6RO0mBYk8Vlrt+8NLrru7WXlQ9/RDWz2uo5KG1/sg= -cloud.google.com/go/cloudbuild v1.14.3/go.mod h1:eIXYWmRt3UtggLnFGx4JvXcMj4kShhVzGndL1LwleEM= -cloud.google.com/go/clouddms v1.3.0/go.mod h1:oK6XsCDdW4Ib3jCCBugx+gVjevp2TMXFtgxvPSee3OM= -cloud.google.com/go/clouddms v1.4.0/go.mod h1:Eh7sUGCC+aKry14O1NRljhjyrr0NFC0G2cjwX0cByRk= -cloud.google.com/go/clouddms v1.5.0/go.mod h1:QSxQnhikCLUw13iAbffF2CZxAER3xDGNHjsTAkQJcQA= -cloud.google.com/go/clouddms v1.6.1/go.mod h1:Ygo1vL52Ov4TBZQquhz5fiw2CQ58gvu+PlS6PVXCpZI= -cloud.google.com/go/clouddms v1.7.0/go.mod h1:MW1dC6SOtI/tPNCciTsXtsGNEM0i0OccykPvv3hiYeM= -cloud.google.com/go/clouddms v1.7.1/go.mod h1:o4SR8U95+P7gZ/TX+YbJxehOCsM+fe6/brlrFquiszk= -cloud.google.com/go/clouddms v1.7.2/go.mod h1:Rk32TmWmHo64XqDvW7jgkFQet1tUKNVzs7oajtJT3jU= -cloud.google.com/go/clouddms v1.7.3/go.mod h1:fkN2HQQNUYInAU3NQ3vRLkV2iWs8lIdmBKOx4nrL6Hc= -cloud.google.com/go/cloudtasks v1.5.0/go.mod h1:fD92REy1x5woxkKEkLdvavGnPJGEn8Uic9nWuLzqCpY= -cloud.google.com/go/cloudtasks v1.6.0/go.mod h1:C6Io+sxuke9/KNRkbQpihnW93SWDU3uXt92nu85HkYI= -cloud.google.com/go/cloudtasks v1.7.0/go.mod h1:ImsfdYWwlWNJbdgPIIGJWC+gemEGTBK/SunNQQNCAb4= -cloud.google.com/go/cloudtasks v1.8.0/go.mod h1:gQXUIwCSOI4yPVK7DgTVFiiP0ZW/eQkydWzwVMdHxrI= -cloud.google.com/go/cloudtasks v1.9.0/go.mod h1:w+EyLsVkLWHcOaqNEyvcKAsWp9p29dL6uL9Nst1cI7Y= -cloud.google.com/go/cloudtasks v1.10.0/go.mod h1:NDSoTLkZ3+vExFEWu2UJV1arUyzVDAiZtdWcsUyNwBs= -cloud.google.com/go/cloudtasks v1.11.1/go.mod h1:a9udmnou9KO2iulGscKR0qBYjreuX8oHwpmFsKspEvM= -cloud.google.com/go/cloudtasks v1.12.1/go.mod h1:a9udmnou9KO2iulGscKR0qBYjreuX8oHwpmFsKspEvM= -cloud.google.com/go/cloudtasks v1.12.2/go.mod h1:A7nYkjNlW2gUoROg1kvJrQGhJP/38UaWwsnuBDOBVUk= -cloud.google.com/go/cloudtasks v1.12.3/go.mod h1:GPVXhIOSGEaR+3xT4Fp72ScI+HjHffSS4B8+BaBB5Ys= -cloud.google.com/go/cloudtasks v1.12.4/go.mod h1:BEPu0Gtt2dU6FxZHNqqNdGqIG86qyWKBPGnsb7udGY0= -cloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow= -cloud.google.com/go/compute v1.3.0/go.mod h1:cCZiE1NHEtai4wiufUhW8I8S1JKkAnhnQJWM7YD99wM= -cloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6mkzQJeu0M= -cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz/FMzPu0s= -cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= -cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= -cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= -cloud.google.com/go/compute v1.12.0/go.mod h1:e8yNOBcBONZU1vJKCvCoDw/4JQsA0dpM4x/6PIIOocU= -cloud.google.com/go/compute v1.12.1/go.mod h1:e8yNOBcBONZU1vJKCvCoDw/4JQsA0dpM4x/6PIIOocU= -cloud.google.com/go/compute v1.13.0/go.mod h1:5aPTS0cUNMIc1CE546K+Th6weJUNQErARyZtRXDJ8GE= -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.0/go.mod h1:rikpw2y+UMidAe9tISo04EHNOIf42RLYF/q8Bs93scU= -cloud.google.com/go/compute v1.19.1/go.mod h1:6ylj3a05WF8leseCdIf77NK0g1ey+nj5IKd5/kvShxE= -cloud.google.com/go/compute v1.19.3/go.mod h1:qxvISKp/gYnXkSAD1ppcSOveRAmzxicEv/JlizULFrI= -cloud.google.com/go/compute v1.20.1/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= -cloud.google.com/go/compute v1.21.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= -cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= -cloud.google.com/go/compute v1.23.1/go.mod h1:CqB3xpmPKKt3OJpW2ndFIXnA9A4xAy/F3Xp1ixncW78= -cloud.google.com/go/compute v1.23.2/go.mod h1:JJ0atRC0J/oWYiiVBmsSsrRnh92DhZPG4hFDcR04Rns= -cloud.google.com/go/compute v1.23.3/go.mod h1:VCgBUoMnIVIR0CscqQiPJLAG25E3ZRZMzcFZeQ+h8CI= -cloud.google.com/go/compute/metadata v0.1.0/go.mod h1:Z1VN+bulIf6bt4P/C37K4DyZYZEXYonfTBHHFPO/4UU= -cloud.google.com/go/compute/metadata v0.2.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= -cloud.google.com/go/compute/metadata v0.2.1/go.mod h1:jgHgmJd2RKBGzXqF5LR2EZMGxBkeanZ9wwa75XHJgOM= -cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= -cloud.google.com/go/contactcenterinsights v1.3.0/go.mod h1:Eu2oemoePuEFc/xKFPjbTuPSj0fYJcPls9TFlPNnHHY= -cloud.google.com/go/contactcenterinsights v1.4.0/go.mod h1:L2YzkGbPsv+vMQMCADxJoT9YiTTnSEd6fEvCeHTYVck= -cloud.google.com/go/contactcenterinsights v1.6.0/go.mod h1:IIDlT6CLcDoyv79kDv8iWxMSTZhLxSCofVV5W6YFM/w= -cloud.google.com/go/contactcenterinsights v1.9.1/go.mod h1:bsg/R7zGLYMVxFFzfh9ooLTruLRCG9fnzhH9KznHhbM= -cloud.google.com/go/contactcenterinsights v1.10.0/go.mod h1:bsg/R7zGLYMVxFFzfh9ooLTruLRCG9fnzhH9KznHhbM= -cloud.google.com/go/contactcenterinsights v1.11.0/go.mod h1:hutBdImE4XNZ1NV4vbPJKSFOnQruhC5Lj9bZqWMTKiU= -cloud.google.com/go/contactcenterinsights v1.11.1/go.mod h1:FeNP3Kg8iteKM80lMwSk3zZZKVxr+PGnAId6soKuXwE= -cloud.google.com/go/contactcenterinsights v1.11.2/go.mod h1:A9PIR5ov5cRcd28KlDbmmXE8Aay+Gccer2h4wzkYFso= -cloud.google.com/go/contactcenterinsights v1.11.3/go.mod h1:HHX5wrz5LHVAwfI2smIotQG9x8Qd6gYilaHcLLLmNis= -cloud.google.com/go/container v1.6.0/go.mod h1:Xazp7GjJSeUYo688S+6J5V+n/t+G5sKBTFkKNudGRxg= -cloud.google.com/go/container v1.7.0/go.mod h1:Dp5AHtmothHGX3DwwIHPgq45Y8KmNsgN3amoYfxVkLo= -cloud.google.com/go/container v1.13.1/go.mod h1:6wgbMPeQRw9rSnKBCAJXnds3Pzj03C4JHamr8asWKy4= -cloud.google.com/go/container v1.14.0/go.mod h1:3AoJMPhHfLDxLvrlVWaK57IXzaPnLaZq63WX59aQBfM= -cloud.google.com/go/container v1.15.0/go.mod h1:ft+9S0WGjAyjDggg5S06DXj+fHJICWg8L7isCQe9pQA= -cloud.google.com/go/container v1.22.1/go.mod h1:lTNExE2R7f+DLbAN+rJiKTisauFCaoDq6NURZ83eVH4= -cloud.google.com/go/container v1.24.0/go.mod h1:lTNExE2R7f+DLbAN+rJiKTisauFCaoDq6NURZ83eVH4= -cloud.google.com/go/container v1.26.0/go.mod h1:YJCmRet6+6jnYYRS000T6k0D0xUXQgBSaJ7VwI8FBj4= -cloud.google.com/go/container v1.26.1/go.mod h1:5smONjPRUxeEpDG7bMKWfDL4sauswqEtnBK1/KKpR04= -cloud.google.com/go/container v1.26.2/go.mod h1:YlO84xCt5xupVbLaMY4s3XNE79MUJ+49VmkInr6HvF4= -cloud.google.com/go/container v1.27.1/go.mod h1:b1A1gJeTBXVLQ6GGw9/9M4FG94BEGsqJ5+t4d/3N7O4= -cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= -cloud.google.com/go/containeranalysis v0.6.0/go.mod h1:HEJoiEIu+lEXM+k7+qLCci0h33lX3ZqoYFdmPcoO7s4= -cloud.google.com/go/containeranalysis v0.7.0/go.mod h1:9aUL+/vZ55P2CXfuZjS4UjQ9AgXoSw8Ts6lemfmxBxI= -cloud.google.com/go/containeranalysis v0.9.0/go.mod h1:orbOANbwk5Ejoom+s+DUCTTJ7IBdBQJDcSylAx/on9s= -cloud.google.com/go/containeranalysis v0.10.1/go.mod h1:Ya2jiILITMY68ZLPaogjmOMNkwsDrWBSTyBubGXO7j0= -cloud.google.com/go/containeranalysis v0.11.0/go.mod h1:4n2e99ZwpGxpNcz+YsFT1dfOHPQFGcAC8FN2M2/ne/U= -cloud.google.com/go/containeranalysis v0.11.1/go.mod h1:rYlUOM7nem1OJMKwE1SadufX0JP3wnXj844EtZAwWLY= -cloud.google.com/go/containeranalysis v0.11.2/go.mod h1:xibioGBC1MD2j4reTyV1xY1/MvKaz+fyM9ENWhmIeP8= -cloud.google.com/go/containeranalysis v0.11.3/go.mod h1:kMeST7yWFQMGjiG9K7Eov+fPNQcGhb8mXj/UcTiWw9U= -cloud.google.com/go/datacatalog v1.3.0/go.mod h1:g9svFY6tuR+j+hrTw3J2dNcmI0dzmSiyOzm8kpLq0a0= -cloud.google.com/go/datacatalog v1.5.0/go.mod h1:M7GPLNQeLfWqeIm3iuiruhPzkt65+Bx8dAKvScX8jvs= -cloud.google.com/go/datacatalog v1.6.0/go.mod h1:+aEyF8JKg+uXcIdAmmaMUmZ3q1b/lKLtXCmXdnc0lbc= -cloud.google.com/go/datacatalog v1.7.0/go.mod h1:9mEl4AuDYWw81UGc41HonIHH7/sn52H0/tc8f8ZbZIE= -cloud.google.com/go/datacatalog v1.8.0/go.mod h1:KYuoVOv9BM8EYz/4eMFxrr4DUKhGIOXxZoKYF5wdISM= -cloud.google.com/go/datacatalog v1.8.1/go.mod h1:RJ58z4rMp3gvETA465Vg+ag8BGgBdnRPEMMSTr5Uv+M= -cloud.google.com/go/datacatalog v1.12.0/go.mod h1:CWae8rFkfp6LzLumKOnmVh4+Zle4A3NXLzVJ1d1mRm0= -cloud.google.com/go/datacatalog v1.13.0/go.mod h1:E4Rj9a5ZtAxcQJlEBTLgMTphfP11/lNaAshpoBgemX8= -cloud.google.com/go/datacatalog v1.14.0/go.mod h1:h0PrGtlihoutNMp/uvwhawLQ9+c63Kz65UFqh49Yo+E= -cloud.google.com/go/datacatalog v1.14.1/go.mod h1:d2CevwTG4yedZilwe+v3E3ZBDRMobQfSG/a6cCCN5R4= -cloud.google.com/go/datacatalog v1.16.0/go.mod h1:d2CevwTG4yedZilwe+v3E3ZBDRMobQfSG/a6cCCN5R4= -cloud.google.com/go/datacatalog v1.17.1/go.mod h1:nCSYFHgtxh2MiEktWIz71s/X+7ds/UT9kp0PC7waCzE= -cloud.google.com/go/datacatalog v1.18.0/go.mod h1:nCSYFHgtxh2MiEktWIz71s/X+7ds/UT9kp0PC7waCzE= -cloud.google.com/go/datacatalog v1.18.1/go.mod h1:TzAWaz+ON1tkNr4MOcak8EBHX7wIRX/gZKM+yTVsv+A= -cloud.google.com/go/datacatalog v1.18.2/go.mod h1:SPVgWW2WEMuWHA+fHodYjmxPiMqcOiWfhc9OD5msigk= -cloud.google.com/go/datacatalog v1.18.3/go.mod h1:5FR6ZIF8RZrtml0VUao22FxhdjkoG+a0866rEnObryM= -cloud.google.com/go/dataflow v0.6.0/go.mod h1:9QwV89cGoxjjSR9/r7eFDqqjtvbKxAK2BaYU6PVk9UM= -cloud.google.com/go/dataflow v0.7.0/go.mod h1:PX526vb4ijFMesO1o202EaUmouZKBpjHsTlCtB4parQ= -cloud.google.com/go/dataflow v0.8.0/go.mod h1:Rcf5YgTKPtQyYz8bLYhFoIV/vP39eL7fWNcSOyFfLJE= -cloud.google.com/go/dataflow v0.9.1/go.mod h1:Wp7s32QjYuQDWqJPFFlnBKhkAtiFpMTdg00qGbnIHVw= -cloud.google.com/go/dataflow v0.9.2/go.mod h1:vBfdBZ/ejlTaYIGB3zB4T08UshH70vbtZeMD+urnUSo= -cloud.google.com/go/dataflow v0.9.3/go.mod h1:HI4kMVjcHGTs3jTHW/kv3501YW+eloiJSLxkJa/vqFE= -cloud.google.com/go/dataflow v0.9.4/go.mod h1:4G8vAkHYCSzU8b/kmsoR2lWyHJD85oMJPHMtan40K8w= -cloud.google.com/go/dataform v0.3.0/go.mod h1:cj8uNliRlHpa6L3yVhDOBrUXH+BPAO1+KFMQQNSThKo= -cloud.google.com/go/dataform v0.4.0/go.mod h1:fwV6Y4Ty2yIFL89huYlEkwUPtS7YZinZbzzj5S9FzCE= -cloud.google.com/go/dataform v0.5.0/go.mod h1:GFUYRe8IBa2hcomWplodVmUx/iTL0FrsauObOM3Ipr0= -cloud.google.com/go/dataform v0.6.0/go.mod h1:QPflImQy33e29VuapFdf19oPbE4aYTJxr31OAPV+ulA= -cloud.google.com/go/dataform v0.7.0/go.mod h1:7NulqnVozfHvWUBpMDfKMUESr+85aJsC/2O0o3jWPDE= -cloud.google.com/go/dataform v0.8.1/go.mod h1:3BhPSiw8xmppbgzeBbmDvmSWlwouuJkXsXsb8UBih9M= -cloud.google.com/go/dataform v0.8.2/go.mod h1:X9RIqDs6NbGPLR80tnYoPNiO1w0wenKTb8PxxlhTMKM= -cloud.google.com/go/dataform v0.8.3/go.mod h1:8nI/tvv5Fso0drO3pEjtowz58lodx8MVkdV2q0aPlqg= -cloud.google.com/go/dataform v0.9.1/go.mod h1:pWTg+zGQ7i16pyn0bS1ruqIE91SdL2FDMvEYu/8oQxs= -cloud.google.com/go/datafusion v1.4.0/go.mod h1:1Zb6VN+W6ALo85cXnM1IKiPw+yQMKMhB9TsTSRDo/38= -cloud.google.com/go/datafusion v1.5.0/go.mod h1:Kz+l1FGHB0J+4XF2fud96WMmRiq/wj8N9u007vyXZ2w= -cloud.google.com/go/datafusion v1.6.0/go.mod h1:WBsMF8F1RhSXvVM8rCV3AeyWVxcC2xY6vith3iw3S+8= -cloud.google.com/go/datafusion v1.7.1/go.mod h1:KpoTBbFmoToDExJUso/fcCiguGDk7MEzOWXUsJo0wsI= -cloud.google.com/go/datafusion v1.7.2/go.mod h1:62K2NEC6DRlpNmI43WHMWf9Vg/YvN6QVi8EVwifElI0= -cloud.google.com/go/datafusion v1.7.3/go.mod h1:eoLt1uFXKGBq48jy9LZ+Is8EAVLnmn50lNncLzwYokE= -cloud.google.com/go/datafusion v1.7.4/go.mod h1:BBs78WTOLYkT4GVZIXQCZT3GFpkpDN4aBY4NDX/jVlM= -cloud.google.com/go/datalabeling v0.5.0/go.mod h1:TGcJ0G2NzcsXSE/97yWjIZO0bXj0KbVlINXMG9ud42I= -cloud.google.com/go/datalabeling v0.6.0/go.mod h1:WqdISuk/+WIGeMkpw/1q7bK/tFEZxsrFJOJdY2bXvTQ= -cloud.google.com/go/datalabeling v0.7.0/go.mod h1:WPQb1y08RJbmpM3ww0CSUAGweL0SxByuW2E+FU+wXcM= -cloud.google.com/go/datalabeling v0.8.1/go.mod h1:XS62LBSVPbYR54GfYQsPXZjTW8UxCK2fkDciSrpRFdY= -cloud.google.com/go/datalabeling v0.8.2/go.mod h1:cyDvGHuJWu9U/cLDA7d8sb9a0tWLEletStu2sTmg3BE= -cloud.google.com/go/datalabeling v0.8.3/go.mod h1:tvPhpGyS/V7lqjmb3V0TaDdGvhzgR1JoW7G2bpi2UTI= -cloud.google.com/go/datalabeling v0.8.4/go.mod h1:Z1z3E6LHtffBGrNUkKwbwbDxTiXEApLzIgmymj8A3S8= -cloud.google.com/go/dataplex v1.3.0/go.mod h1:hQuRtDg+fCiFgC8j0zV222HvzFQdRd+SVX8gdmFcZzA= -cloud.google.com/go/dataplex v1.4.0/go.mod h1:X51GfLXEMVJ6UN47ESVqvlsRplbLhcsAt0kZCCKsU0A= -cloud.google.com/go/dataplex v1.5.2/go.mod h1:cVMgQHsmfRoI5KFYq4JtIBEUbYwc3c7tXmIDhRmNNVQ= -cloud.google.com/go/dataplex v1.6.0/go.mod h1:bMsomC/aEJOSpHXdFKFGQ1b0TDPIeL28nJObeO1ppRs= -cloud.google.com/go/dataplex v1.8.1/go.mod h1:7TyrDT6BCdI8/38Uvp0/ZxBslOslP2X2MPDucliyvSE= -cloud.google.com/go/dataplex v1.9.0/go.mod h1:7TyrDT6BCdI8/38Uvp0/ZxBslOslP2X2MPDucliyvSE= -cloud.google.com/go/dataplex v1.9.1/go.mod h1:7TyrDT6BCdI8/38Uvp0/ZxBslOslP2X2MPDucliyvSE= -cloud.google.com/go/dataplex v1.10.1/go.mod h1:1MzmBv8FvjYfc7vDdxhnLFNskikkB+3vl475/XdCDhs= -cloud.google.com/go/dataplex v1.10.2/go.mod h1:xdC8URdTrCrZMW6keY779ZT1cTOfV8KEPNsw+LTRT1Y= -cloud.google.com/go/dataplex v1.11.1/go.mod h1:mHJYQQ2VEJHsyoC0OdNyy988DvEbPhqFs5OOLffLX0c= -cloud.google.com/go/dataproc v1.7.0/go.mod h1:CKAlMjII9H90RXaMpSxQ8EU6dQx6iAYNPcYPOkSbi8s= -cloud.google.com/go/dataproc v1.8.0/go.mod h1:5OW+zNAH0pMpw14JVrPONsxMQYMBqJuzORhIBfBn9uI= -cloud.google.com/go/dataproc v1.12.0/go.mod h1:zrF3aX0uV3ikkMz6z4uBbIKyhRITnxvr4i3IjKsKrw4= -cloud.google.com/go/dataproc/v2 v2.0.1/go.mod h1:7Ez3KRHdFGcfY7GcevBbvozX+zyWGcwLJvvAMwCaoZ4= -cloud.google.com/go/dataproc/v2 v2.2.0/go.mod h1:lZR7AQtwZPvmINx5J87DSOOpTfof9LVZju6/Qo4lmcY= -cloud.google.com/go/dataproc/v2 v2.2.1/go.mod h1:QdAJLaBjh+l4PVlVZcmrmhGccosY/omC1qwfQ61Zv/o= -cloud.google.com/go/dataproc/v2 v2.2.2/go.mod h1:aocQywVmQVF4i8CL740rNI/ZRpsaaC1Wh2++BJ7HEJ4= -cloud.google.com/go/dataproc/v2 v2.2.3/go.mod h1:G5R6GBc9r36SXv/RtZIVfB8SipI+xVn0bX5SxUzVYbY= -cloud.google.com/go/dataqna v0.5.0/go.mod h1:90Hyk596ft3zUQ8NkFfvICSIfHFh1Bc7C4cK3vbhkeo= -cloud.google.com/go/dataqna v0.6.0/go.mod h1:1lqNpM7rqNLVgWBJyk5NF6Uen2PHym0jtVJonplVsDA= -cloud.google.com/go/dataqna v0.7.0/go.mod h1:Lx9OcIIeqCrw1a6KdO3/5KMP1wAmTc0slZWwP12Qq3c= -cloud.google.com/go/dataqna v0.8.1/go.mod h1:zxZM0Bl6liMePWsHA8RMGAfmTG34vJMapbHAxQ5+WA8= -cloud.google.com/go/dataqna v0.8.2/go.mod h1:KNEqgx8TTmUipnQsScOoDpq/VlXVptUqVMZnt30WAPs= -cloud.google.com/go/dataqna v0.8.3/go.mod h1:wXNBW2uvc9e7Gl5k8adyAMnLush1KVV6lZUhB+rqNu4= -cloud.google.com/go/dataqna v0.8.4/go.mod h1:mySRKjKg5Lz784P6sCov3p1QD+RZQONRMRjzGNcFd0c= -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/datastore v1.10.0/go.mod h1:PC5UzAmDEkAmkfaknstTYbNpgE49HAgW2J1gcgUfmdM= -cloud.google.com/go/datastore v1.11.0/go.mod h1:TvGxBIHCS50u8jzG+AW/ppf87v1of8nwzFNgEZU1D3c= -cloud.google.com/go/datastore v1.12.0/go.mod h1:KjdB88W897MRITkvWWJrg2OUtrR5XVj1EoLgSp6/N70= -cloud.google.com/go/datastore v1.12.1/go.mod h1:KjdB88W897MRITkvWWJrg2OUtrR5XVj1EoLgSp6/N70= -cloud.google.com/go/datastore v1.13.0/go.mod h1:KjdB88W897MRITkvWWJrg2OUtrR5XVj1EoLgSp6/N70= -cloud.google.com/go/datastore v1.14.0/go.mod h1:GAeStMBIt9bPS7jMJA85kgkpsMkvseWWXiaHya9Jes8= -cloud.google.com/go/datastore v1.15.0/go.mod h1:GAeStMBIt9bPS7jMJA85kgkpsMkvseWWXiaHya9Jes8= -cloud.google.com/go/datastream v1.2.0/go.mod h1:i/uTP8/fZwgATHS/XFu0TcNUhuA0twZxxQ3EyCUQMwo= -cloud.google.com/go/datastream v1.3.0/go.mod h1:cqlOX8xlyYF/uxhiKn6Hbv6WjwPPuI9W2M9SAXwaLLQ= -cloud.google.com/go/datastream v1.4.0/go.mod h1:h9dpzScPhDTs5noEMQVWP8Wx8AFBRyS0s8KWPx/9r0g= -cloud.google.com/go/datastream v1.5.0/go.mod h1:6TZMMNPwjUqZHBKPQ1wwXpb0d5VDVPl2/XoS5yi88q4= -cloud.google.com/go/datastream v1.6.0/go.mod h1:6LQSuswqLa7S4rPAOZFVjHIG3wJIjZcZrw8JDEDJuIs= -cloud.google.com/go/datastream v1.7.0/go.mod h1:uxVRMm2elUSPuh65IbZpzJNMbuzkcvu5CjMqVIUHrww= -cloud.google.com/go/datastream v1.9.1/go.mod h1:hqnmr8kdUBmrnk65k5wNRoHSCYksvpdZIcZIEl8h43Q= -cloud.google.com/go/datastream v1.10.0/go.mod h1:hqnmr8kdUBmrnk65k5wNRoHSCYksvpdZIcZIEl8h43Q= -cloud.google.com/go/datastream v1.10.1/go.mod h1:7ngSYwnw95YFyTd5tOGBxHlOZiL+OtpjheqU7t2/s/c= -cloud.google.com/go/datastream v1.10.2/go.mod h1:W42TFgKAs/om6x/CdXX5E4oiAsKlH+e8MTGy81zdYt0= -cloud.google.com/go/datastream v1.10.3/go.mod h1:YR0USzgjhqA/Id0Ycu1VvZe8hEWwrkjuXrGbzeDOSEA= -cloud.google.com/go/deploy v1.4.0/go.mod h1:5Xghikd4VrmMLNaF6FiRFDlHb59VM59YoDQnOUdsH/c= -cloud.google.com/go/deploy v1.5.0/go.mod h1:ffgdD0B89tToyW/U/D2eL0jN2+IEV/3EMuXHA0l4r+s= -cloud.google.com/go/deploy v1.6.0/go.mod h1:f9PTHehG/DjCom3QH0cntOVRm93uGBDt2vKzAPwpXQI= -cloud.google.com/go/deploy v1.8.0/go.mod h1:z3myEJnA/2wnB4sgjqdMfgxCA0EqC3RBTNcVPs93mtQ= -cloud.google.com/go/deploy v1.11.0/go.mod h1:tKuSUV5pXbn67KiubiUNUejqLs4f5cxxiCNCeyl0F2g= -cloud.google.com/go/deploy v1.13.0/go.mod h1:tKuSUV5pXbn67KiubiUNUejqLs4f5cxxiCNCeyl0F2g= -cloud.google.com/go/deploy v1.13.1/go.mod h1:8jeadyLkH9qu9xgO3hVWw8jVr29N1mnW42gRJT8GY6g= -cloud.google.com/go/deploy v1.14.1/go.mod h1:N8S0b+aIHSEeSr5ORVoC0+/mOPUysVt8ae4QkZYolAw= -cloud.google.com/go/deploy v1.14.2/go.mod h1:e5XOUI5D+YGldyLNZ21wbp9S8otJbBE4i88PtO9x/2g= -cloud.google.com/go/dialogflow v1.15.0/go.mod h1:HbHDWs33WOGJgn6rfzBW1Kv807BE3O1+xGbn59zZWI4= -cloud.google.com/go/dialogflow v1.16.1/go.mod h1:po6LlzGfK+smoSmTBnbkIZY2w8ffjz/RcGSS+sh1el0= -cloud.google.com/go/dialogflow v1.17.0/go.mod h1:YNP09C/kXA1aZdBgC/VtXX74G/TKn7XVCcVumTflA+8= -cloud.google.com/go/dialogflow v1.18.0/go.mod h1:trO7Zu5YdyEuR+BhSNOqJezyFQ3aUzz0njv7sMx/iek= -cloud.google.com/go/dialogflow v1.19.0/go.mod h1:JVmlG1TwykZDtxtTXujec4tQ+D8SBFMoosgy+6Gn0s0= -cloud.google.com/go/dialogflow v1.29.0/go.mod h1:b+2bzMe+k1s9V+F2jbJwpHPzrnIyHihAdRFMtn2WXuM= -cloud.google.com/go/dialogflow v1.31.0/go.mod h1:cuoUccuL1Z+HADhyIA7dci3N5zUssgpBJmCzI6fNRB4= -cloud.google.com/go/dialogflow v1.32.0/go.mod h1:jG9TRJl8CKrDhMEcvfcfFkkpp8ZhgPz3sBGmAUYJ2qE= -cloud.google.com/go/dialogflow v1.38.0/go.mod h1:L7jnH+JL2mtmdChzAIcXQHXMvQkE3U4hTaNltEuxXn4= -cloud.google.com/go/dialogflow v1.40.0/go.mod h1:L7jnH+JL2mtmdChzAIcXQHXMvQkE3U4hTaNltEuxXn4= -cloud.google.com/go/dialogflow v1.43.0/go.mod h1:pDUJdi4elL0MFmt1REMvFkdsUTYSHq+rTCS8wg0S3+M= -cloud.google.com/go/dialogflow v1.44.0/go.mod h1:pDUJdi4elL0MFmt1REMvFkdsUTYSHq+rTCS8wg0S3+M= -cloud.google.com/go/dialogflow v1.44.1/go.mod h1:n/h+/N2ouKOO+rbe/ZnI186xImpqvCVj2DdsWS/0EAk= -cloud.google.com/go/dialogflow v1.44.2/go.mod h1:QzFYndeJhpVPElnFkUXxdlptx0wPnBWLCBT9BvtC3/c= -cloud.google.com/go/dialogflow v1.44.3/go.mod h1:mHly4vU7cPXVweuB5R0zsYKPMzy240aQdAu06SqBbAQ= -cloud.google.com/go/dlp v1.6.0/go.mod h1:9eyB2xIhpU0sVwUixfBubDoRwP+GjeUoxxeueZmqvmM= -cloud.google.com/go/dlp v1.7.0/go.mod h1:68ak9vCiMBjbasxeVD17hVPxDEck+ExiHavX8kiHG+Q= -cloud.google.com/go/dlp v1.9.0/go.mod h1:qdgmqgTyReTz5/YNSSuueR8pl7hO0o9bQ39ZhtgkWp4= -cloud.google.com/go/dlp v1.10.1/go.mod h1:IM8BWz1iJd8njcNcG0+Kyd9OPnqnRNkDV8j42VT5KOI= -cloud.google.com/go/dlp v1.10.2/go.mod h1:ZbdKIhcnyhILgccwVDzkwqybthh7+MplGC3kZVZsIOQ= -cloud.google.com/go/dlp v1.10.3/go.mod h1:iUaTc/ln8I+QT6Ai5vmuwfw8fqTk2kaz0FvCwhLCom0= -cloud.google.com/go/dlp v1.11.1/go.mod h1:/PA2EnioBeXTL/0hInwgj0rfsQb3lpE3R8XUJxqUNKI= -cloud.google.com/go/documentai v1.7.0/go.mod h1:lJvftZB5NRiFSX4moiye1SMxHx0Bc3x1+p9e/RfXYiU= -cloud.google.com/go/documentai v1.8.0/go.mod h1:xGHNEB7CtsnySCNrCFdCyyMz44RhFEEX2Q7UD0c5IhU= -cloud.google.com/go/documentai v1.9.0/go.mod h1:FS5485S8R00U10GhgBC0aNGrJxBP8ZVpEeJ7PQDZd6k= -cloud.google.com/go/documentai v1.10.0/go.mod h1:vod47hKQIPeCfN2QS/jULIvQTugbmdc0ZvxxfQY1bg4= -cloud.google.com/go/documentai v1.16.0/go.mod h1:o0o0DLTEZ+YnJZ+J4wNfTxmDVyrkzFvttBXXtYRMHkM= -cloud.google.com/go/documentai v1.18.0/go.mod h1:F6CK6iUH8J81FehpskRmhLq/3VlwQvb7TvwOceQ2tbs= -cloud.google.com/go/documentai v1.20.0/go.mod h1:yJkInoMcK0qNAEdRnqY/D5asy73tnPe88I1YTZT+a8E= -cloud.google.com/go/documentai v1.22.0/go.mod h1:yJkInoMcK0qNAEdRnqY/D5asy73tnPe88I1YTZT+a8E= -cloud.google.com/go/documentai v1.22.1/go.mod h1:LKs22aDHbJv7ufXuPypzRO7rG3ALLJxzdCXDPutw4Qc= -cloud.google.com/go/documentai v1.23.0/go.mod h1:LKs22aDHbJv7ufXuPypzRO7rG3ALLJxzdCXDPutw4Qc= -cloud.google.com/go/documentai v1.23.2/go.mod h1:Q/wcRT+qnuXOpjAkvOV4A+IeQl04q2/ReT7SSbytLSo= -cloud.google.com/go/documentai v1.23.4/go.mod h1:4MYAaEMnADPN1LPN5xboDR5QVB6AgsaxgFdJhitlE2Y= -cloud.google.com/go/documentai v1.23.5/go.mod h1:ghzBsyVTiVdkfKaUCum/9bGBEyBjDO4GfooEcYKhN+g= -cloud.google.com/go/domains v0.6.0/go.mod h1:T9Rz3GasrpYk6mEGHh4rymIhjlnIuB4ofT1wTxDeT4Y= -cloud.google.com/go/domains v0.7.0/go.mod h1:PtZeqS1xjnXuRPKE/88Iru/LdfoRyEHYA9nFQf4UKpg= -cloud.google.com/go/domains v0.8.0/go.mod h1:M9i3MMDzGFXsydri9/vW+EWz9sWb4I6WyHqdlAk0idE= -cloud.google.com/go/domains v0.9.1/go.mod h1:aOp1c0MbejQQ2Pjf1iJvnVyT+z6R6s8pX66KaCSDYfE= -cloud.google.com/go/domains v0.9.2/go.mod h1:3YvXGYzZG1Temjbk7EyGCuGGiXHJwVNmwIf+E/cUp5I= -cloud.google.com/go/domains v0.9.3/go.mod h1:29k66YNDLDY9LCFKpGFeh6Nj9r62ZKm5EsUJxAl84KU= -cloud.google.com/go/domains v0.9.4/go.mod h1:27jmJGShuXYdUNjyDG0SodTfT5RwLi7xmH334Gvi3fY= -cloud.google.com/go/edgecontainer v0.1.0/go.mod h1:WgkZ9tp10bFxqO8BLPqv2LlfmQF1X8lZqwW4r1BTajk= -cloud.google.com/go/edgecontainer v0.2.0/go.mod h1:RTmLijy+lGpQ7BXuTDa4C4ssxyXT34NIuHIgKuP4s5w= -cloud.google.com/go/edgecontainer v0.3.0/go.mod h1:FLDpP4nykgwwIfcLt6zInhprzw0lEi2P1fjO6Ie0qbc= -cloud.google.com/go/edgecontainer v1.0.0/go.mod h1:cttArqZpBB2q58W/upSG++ooo6EsblxDIolxa3jSjbY= -cloud.google.com/go/edgecontainer v1.1.1/go.mod h1:O5bYcS//7MELQZs3+7mabRqoWQhXCzenBu0R8bz2rwk= -cloud.google.com/go/edgecontainer v1.1.2/go.mod h1:wQRjIzqxEs9e9wrtle4hQPSR1Y51kqN75dgF7UllZZ4= -cloud.google.com/go/edgecontainer v1.1.3/go.mod h1:Ll2DtIABzEfaxaVSbwj3QHFaOOovlDFiWVDu349jSsA= -cloud.google.com/go/edgecontainer v1.1.4/go.mod h1:AvFdVuZuVGdgaE5YvlL1faAoa1ndRR/5XhXZvPBHbsE= -cloud.google.com/go/errorreporting v0.3.0/go.mod h1:xsP2yaAp+OAW4OIm60An2bbLpqIhKXdWR/tawvl7QzU= -cloud.google.com/go/essentialcontacts v1.3.0/go.mod h1:r+OnHa5jfj90qIfZDO/VztSFqbQan7HV75p8sA+mdGI= -cloud.google.com/go/essentialcontacts v1.4.0/go.mod h1:8tRldvHYsmnBCHdFpvU+GL75oWiBKl80BiqlFh9tp+8= -cloud.google.com/go/essentialcontacts v1.5.0/go.mod h1:ay29Z4zODTuwliK7SnX8E86aUF2CTzdNtvv42niCX0M= -cloud.google.com/go/essentialcontacts v1.6.2/go.mod h1:T2tB6tX+TRak7i88Fb2N9Ok3PvY3UNbUsMag9/BARh4= -cloud.google.com/go/essentialcontacts v1.6.3/go.mod h1:yiPCD7f2TkP82oJEFXFTou8Jl8L6LBRPeBEkTaO0Ggo= -cloud.google.com/go/essentialcontacts v1.6.4/go.mod h1:iju5Vy3d9tJUg0PYMd1nHhjV7xoCXaOAVabrwLaPBEM= -cloud.google.com/go/essentialcontacts v1.6.5/go.mod h1:jjYbPzw0x+yglXC890l6ECJWdYeZ5dlYACTFL0U/VuM= -cloud.google.com/go/eventarc v1.7.0/go.mod h1:6ctpF3zTnaQCxUjHUdcfgcA1A2T309+omHZth7gDfmc= -cloud.google.com/go/eventarc v1.8.0/go.mod h1:imbzxkyAU4ubfsaKYdQg04WS1NvncblHEup4kvF+4gw= -cloud.google.com/go/eventarc v1.10.0/go.mod h1:u3R35tmZ9HvswGRBnF48IlYgYeBcPUCjkr4BTdem2Kw= -cloud.google.com/go/eventarc v1.11.0/go.mod h1:PyUjsUKPWoRBCHeOxZd/lbOOjahV41icXyUY5kSTvVY= -cloud.google.com/go/eventarc v1.12.1/go.mod h1:mAFCW6lukH5+IZjkvrEss+jmt2kOdYlN8aMx3sRJiAI= -cloud.google.com/go/eventarc v1.13.0/go.mod h1:mAFCW6lukH5+IZjkvrEss+jmt2kOdYlN8aMx3sRJiAI= -cloud.google.com/go/eventarc v1.13.1/go.mod h1:EqBxmGHFrruIara4FUQ3RHlgfCn7yo1HYsu2Hpt/C3Y= -cloud.google.com/go/eventarc v1.13.2/go.mod h1:X9A80ShVu19fb4e5sc/OLV7mpFUKZMwfJFeeWhcIObM= -cloud.google.com/go/eventarc v1.13.3/go.mod h1:RWH10IAZIRcj1s/vClXkBgMHwh59ts7hSWcqD3kaclg= -cloud.google.com/go/filestore v1.3.0/go.mod h1:+qbvHGvXU1HaKX2nD0WEPo92TP/8AQuCVEBXNY9z0+w= -cloud.google.com/go/filestore v1.4.0/go.mod h1:PaG5oDfo9r224f8OYXURtAsY+Fbyq/bLYoINEK8XQAI= -cloud.google.com/go/filestore v1.5.0/go.mod h1:FqBXDWBp4YLHqRnVGveOkHDf8svj9r5+mUDLupOWEDs= -cloud.google.com/go/filestore v1.6.0/go.mod h1:di5unNuss/qfZTw2U9nhFqo8/ZDSc466dre85Kydllg= -cloud.google.com/go/filestore v1.7.1/go.mod h1:y10jsorq40JJnjR/lQ8AfFbbcGlw3g+Dp8oN7i7FjV4= -cloud.google.com/go/filestore v1.7.2/go.mod h1:TYOlyJs25f/omgj+vY7/tIG/E7BX369triSPzE4LdgE= -cloud.google.com/go/filestore v1.7.3/go.mod h1:Qp8WaEERR3cSkxToxFPHh/b8AACkSut+4qlCjAmKTV0= -cloud.google.com/go/filestore v1.7.4/go.mod h1:S5JCxIbFjeBhWMTfIYH2Jx24J6BqjwpkkPl+nBA5DlI= -cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= -cloud.google.com/go/firestore v1.9.0/go.mod h1:HMkjKHNTtRyZNiMzu7YAsLr9K3X2udY2AMwDaMEQiiE= -cloud.google.com/go/firestore v1.11.0/go.mod h1:b38dKhgzlmNNGTNZZwe7ZRFEuRab1Hay3/DBsIGKKy4= -cloud.google.com/go/firestore v1.12.0/go.mod h1:b38dKhgzlmNNGTNZZwe7ZRFEuRab1Hay3/DBsIGKKy4= -cloud.google.com/go/firestore v1.13.0/go.mod h1:QojqqOh8IntInDUSTAh0c8ZsPYAr68Ma8c5DWOy8xb8= -cloud.google.com/go/firestore v1.14.0/go.mod h1:96MVaHLsEhbvkBEdZgfN+AS/GIkco1LRpH9Xp9YZfzQ= -cloud.google.com/go/functions v1.6.0/go.mod h1:3H1UA3qiIPRWD7PeZKLvHZ9SaQhR26XIJcC0A5GbvAk= -cloud.google.com/go/functions v1.7.0/go.mod h1:+d+QBcWM+RsrgZfV9xo6KfA1GlzJfxcfZcRPEhDDfzg= -cloud.google.com/go/functions v1.8.0/go.mod h1:RTZ4/HsQjIqIYP9a9YPbU+QFoQsAlYgrwOXJWHn1POY= -cloud.google.com/go/functions v1.9.0/go.mod h1:Y+Dz8yGguzO3PpIjhLTbnqV1CWmgQ5UwtlpzoyquQ08= -cloud.google.com/go/functions v1.10.0/go.mod h1:0D3hEOe3DbEvCXtYOZHQZmD+SzYsi1YbI7dGvHfldXw= -cloud.google.com/go/functions v1.12.0/go.mod h1:AXWGrF3e2C/5ehvwYo/GH6O5s09tOPksiKhz+hH8WkA= -cloud.google.com/go/functions v1.13.0/go.mod h1:EU4O007sQm6Ef/PwRsI8N2umygGqPBS/IZQKBQBcJ3c= -cloud.google.com/go/functions v1.15.1/go.mod h1:P5yNWUTkyU+LvW/S9O6V+V423VZooALQlqoXdoPz5AE= -cloud.google.com/go/functions v1.15.2/go.mod h1:CHAjtcR6OU4XF2HuiVeriEdELNcnvRZSk1Q8RMqy4lE= -cloud.google.com/go/functions v1.15.3/go.mod h1:r/AMHwBheapkkySEhiZYLDBwVJCdlRwsm4ieJu35/Ug= -cloud.google.com/go/functions v1.15.4/go.mod h1:CAsTc3VlRMVvx+XqXxKqVevguqJpnVip4DdonFsX28I= -cloud.google.com/go/gaming v1.5.0/go.mod h1:ol7rGcxP/qHTRQE/RO4bxkXq+Fix0j6D4LFPzYTIrDM= -cloud.google.com/go/gaming v1.6.0/go.mod h1:YMU1GEvA39Qt3zWGyAVA9bpYz/yAhTvaQ1t2sK4KPUA= -cloud.google.com/go/gaming v1.7.0/go.mod h1:LrB8U7MHdGgFG851iHAfqUdLcKBdQ55hzXy9xBJz0+w= -cloud.google.com/go/gaming v1.8.0/go.mod h1:xAqjS8b7jAVW0KFYeRUxngo9My3f33kFmua++Pi+ggM= -cloud.google.com/go/gaming v1.9.0/go.mod h1:Fc7kEmCObylSWLO334NcO+O9QMDyz+TKC4v1D7X+Bc0= -cloud.google.com/go/gaming v1.10.1/go.mod h1:XQQvtfP8Rb9Rxnxm5wFVpAp9zCQkJi2bLIb7iHGwB3s= -cloud.google.com/go/gkebackup v0.2.0/go.mod h1:XKvv/4LfG829/B8B7xRkk8zRrOEbKtEam6yNfuQNH60= -cloud.google.com/go/gkebackup v0.3.0/go.mod h1:n/E671i1aOQvUxT541aTkCwExO/bTer2HDlj4TsBRAo= -cloud.google.com/go/gkebackup v0.4.0/go.mod h1:byAyBGUwYGEEww7xsbnUTBHIYcOPy/PgUWUtOeRm9Vg= -cloud.google.com/go/gkebackup v1.3.0/go.mod h1:vUDOu++N0U5qs4IhG1pcOnD1Mac79xWy6GoBFlWCWBU= -cloud.google.com/go/gkebackup v1.3.1/go.mod h1:vUDOu++N0U5qs4IhG1pcOnD1Mac79xWy6GoBFlWCWBU= -cloud.google.com/go/gkebackup v1.3.2/go.mod h1:OMZbXzEJloyXMC7gqdSB+EOEQ1AKcpGYvO3s1ec5ixk= -cloud.google.com/go/gkebackup v1.3.3/go.mod h1:eMk7/wVV5P22KBakhQnJxWSVftL1p4VBFLpv0kIft7I= -cloud.google.com/go/gkebackup v1.3.4/go.mod h1:gLVlbM8h/nHIs09ns1qx3q3eaXcGSELgNu1DWXYz1HI= -cloud.google.com/go/gkeconnect v0.5.0/go.mod h1:c5lsNAg5EwAy7fkqX/+goqFsU1Da/jQFqArp+wGNr/o= -cloud.google.com/go/gkeconnect v0.6.0/go.mod h1:Mln67KyU/sHJEBY8kFZ0xTeyPtzbq9StAVvEULYK16A= -cloud.google.com/go/gkeconnect v0.7.0/go.mod h1:SNfmVqPkaEi3bF/B3CNZOAYPYdg7sU+obZ+QTky2Myw= -cloud.google.com/go/gkeconnect v0.8.1/go.mod h1:KWiK1g9sDLZqhxB2xEuPV8V9NYzrqTUmQR9shJHpOZw= -cloud.google.com/go/gkeconnect v0.8.2/go.mod h1:6nAVhwchBJYgQCXD2pHBFQNiJNyAd/wyxljpaa6ZPrY= -cloud.google.com/go/gkeconnect v0.8.3/go.mod h1:i9GDTrfzBSUZGCe98qSu1B8YB8qfapT57PenIb820Jo= -cloud.google.com/go/gkeconnect v0.8.4/go.mod h1:84hZz4UMlDCKl8ifVW8layK4WHlMAFeq8vbzjU0yJkw= -cloud.google.com/go/gkehub v0.9.0/go.mod h1:WYHN6WG8w9bXU0hqNxt8rm5uxnk8IH+lPY9J2TV7BK0= -cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y977wO+hBH0= -cloud.google.com/go/gkehub v0.11.0/go.mod h1:JOWHlmN+GHyIbuWQPl47/C2RFhnFKH38jH9Ascu3n0E= -cloud.google.com/go/gkehub v0.12.0/go.mod h1:djiIwwzTTBrF5NaXCGv3mf7klpEMcST17VBTVVDcuaw= -cloud.google.com/go/gkehub v0.14.1/go.mod h1:VEXKIJZ2avzrbd7u+zeMtW00Y8ddk/4V9511C9CQGTY= -cloud.google.com/go/gkehub v0.14.2/go.mod h1:iyjYH23XzAxSdhrbmfoQdePnlMj2EWcvnR+tHdBQsCY= -cloud.google.com/go/gkehub v0.14.3/go.mod h1:jAl6WafkHHW18qgq7kqcrXYzN08hXeK/Va3utN8VKg8= -cloud.google.com/go/gkehub v0.14.4/go.mod h1:Xispfu2MqnnFt8rV/2/3o73SK1snL8s9dYJ9G2oQMfc= -cloud.google.com/go/gkemulticloud v0.3.0/go.mod h1:7orzy7O0S+5kq95e4Hpn7RysVA7dPs8W/GgfUtsPbrA= -cloud.google.com/go/gkemulticloud v0.4.0/go.mod h1:E9gxVBnseLWCk24ch+P9+B2CoDFJZTyIgLKSalC7tuI= -cloud.google.com/go/gkemulticloud v0.5.0/go.mod h1:W0JDkiyi3Tqh0TJr//y19wyb1yf8llHVto2Htf2Ja3Y= -cloud.google.com/go/gkemulticloud v0.6.1/go.mod h1:kbZ3HKyTsiwqKX7Yw56+wUGwwNZViRnxWK2DVknXWfw= -cloud.google.com/go/gkemulticloud v1.0.0/go.mod h1:kbZ3HKyTsiwqKX7Yw56+wUGwwNZViRnxWK2DVknXWfw= -cloud.google.com/go/gkemulticloud v1.0.1/go.mod h1:AcrGoin6VLKT/fwZEYuqvVominLriQBCKmbjtnbMjG8= -cloud.google.com/go/gkemulticloud v1.0.2/go.mod h1:+ee5VXxKb3H1l4LZAcgWB/rvI16VTNTrInWxDjAGsGo= -cloud.google.com/go/gkemulticloud v1.0.3/go.mod h1:7NpJBN94U6DY1xHIbsDqB2+TFZUfjLUKLjUX8NGLor0= -cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc= -cloud.google.com/go/grafeas v0.3.0/go.mod h1:P7hgN24EyONOTMyeJH6DxG4zD7fwiYa5Q6GUgyFSOU8= -cloud.google.com/go/gsuiteaddons v1.3.0/go.mod h1:EUNK/J1lZEZO8yPtykKxLXI6JSVN2rg9bN8SXOa0bgM= -cloud.google.com/go/gsuiteaddons v1.4.0/go.mod h1:rZK5I8hht7u7HxFQcFei0+AtfS9uSushomRlg+3ua1o= -cloud.google.com/go/gsuiteaddons v1.5.0/go.mod h1:TFCClYLd64Eaa12sFVmUyG62tk4mdIsI7pAnSXRkcFo= -cloud.google.com/go/gsuiteaddons v1.6.1/go.mod h1:CodrdOqRZcLp5WOwejHWYBjZvfY0kOphkAKpF/3qdZY= -cloud.google.com/go/gsuiteaddons v1.6.2/go.mod h1:K65m9XSgs8hTF3X9nNTPi8IQueljSdYo9F+Mi+s4MyU= -cloud.google.com/go/gsuiteaddons v1.6.3/go.mod h1:sCFJkZoMrLZT3JTb8uJqgKPNshH2tfXeCwTFRebTq48= -cloud.google.com/go/gsuiteaddons v1.6.4/go.mod h1:rxtstw7Fx22uLOXBpsvb9DUbC+fiXs7rF4U29KHM/pE= -cloud.google.com/go/iam v0.1.0/go.mod h1:vcUNEa0pEm0qRVpmWepWaFMIAI8/hjB9mO8rNCJtF6c= -cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= -cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc= -cloud.google.com/go/iam v0.6.0/go.mod h1:+1AH33ueBne5MzYccyMHtEKqLE4/kJOibtffMHDMFMc= -cloud.google.com/go/iam v0.7.0/go.mod h1:H5Br8wRaDGNc8XP3keLc4unfUUZeyH3Sfl9XpQEYOeg= -cloud.google.com/go/iam v0.8.0/go.mod h1:lga0/y3iH6CX7sYqypWJ33hf7kkfXJag67naqGESjkE= -cloud.google.com/go/iam v0.11.0/go.mod h1:9PiLDanza5D+oWFZiH1uG+RnRCfEGKoyl6yo4cgWZGY= -cloud.google.com/go/iam v0.12.0/go.mod h1:knyHGviacl11zrtZUoDuYpDgLjvr28sLQaG0YB2GYAY= -cloud.google.com/go/iam v0.13.0/go.mod h1:ljOg+rcNfzZ5d6f1nAUJ8ZIxOaZUVoS14bKCtaLZ/D0= -cloud.google.com/go/iam v1.0.1/go.mod h1:yR3tmSL8BcZB4bxByRv2jkSIahVmCtfKZwLYGBalRE8= -cloud.google.com/go/iam v1.1.0/go.mod h1:nxdHjaKfCr7fNYx/HJMM8LgiMugmveWlkatear5gVyk= -cloud.google.com/go/iam v1.1.1/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+KUZOU= -cloud.google.com/go/iam v1.1.2/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+KUZOU= -cloud.google.com/go/iam v1.1.3/go.mod h1:3khUlaBXfPKKe7huYgEpDn6FtgRyMEqbkvBxrQyY5SE= -cloud.google.com/go/iam v1.1.4/go.mod h1:l/rg8l1AaA+VFMho/HYx2Vv6xinPSLMF8qfhRPIZ0L8= -cloud.google.com/go/iam v1.1.5/go.mod h1:rB6P/Ic3mykPbFio+vo7403drjlgvoWfYpJhMXEbzv8= -cloud.google.com/go/iap v1.4.0/go.mod h1:RGFwRJdihTINIe4wZ2iCP0zF/qu18ZwyKxrhMhygBEc= -cloud.google.com/go/iap v1.5.0/go.mod h1:UH/CGgKd4KyohZL5Pt0jSKE4m3FR51qg6FKQ/z/Ix9A= -cloud.google.com/go/iap v1.6.0/go.mod h1:NSuvI9C/j7UdjGjIde7t7HBz+QTwBcapPE07+sSRcLk= -cloud.google.com/go/iap v1.7.0/go.mod h1:beqQx56T9O1G1yNPph+spKpNibDlYIiIixiqsQXxLIo= -cloud.google.com/go/iap v1.7.1/go.mod h1:WapEwPc7ZxGt2jFGB/C/bm+hP0Y6NXzOYGjpPnmMS74= -cloud.google.com/go/iap v1.8.1/go.mod h1:sJCbeqg3mvWLqjZNsI6dfAtbbV1DL2Rl7e1mTyXYREQ= -cloud.google.com/go/iap v1.9.0/go.mod h1:01OFxd1R+NFrg78S+hoPV5PxEzv22HXaNqUUlmNHFuY= -cloud.google.com/go/iap v1.9.1/go.mod h1:SIAkY7cGMLohLSdBR25BuIxO+I4fXJiL06IBL7cy/5Q= -cloud.google.com/go/iap v1.9.2/go.mod h1:GwDTOs047PPSnwRD0Us5FKf4WDRcVvHg1q9WVkKBhdI= -cloud.google.com/go/iap v1.9.3/go.mod h1:DTdutSZBqkkOm2HEOTBzhZxh2mwwxshfD/h3yofAiCw= -cloud.google.com/go/ids v1.1.0/go.mod h1:WIuwCaYVOzHIj2OhN9HAwvW+DBdmUAdcWlFxRl+KubM= -cloud.google.com/go/ids v1.2.0/go.mod h1:5WXvp4n25S0rA/mQWAg1YEEBBq6/s+7ml1RDCW1IrcY= -cloud.google.com/go/ids v1.3.0/go.mod h1:JBdTYwANikFKaDP6LtW5JAi4gubs57SVNQjemdt6xV4= -cloud.google.com/go/ids v1.4.1/go.mod h1:np41ed8YMU8zOgv53MMMoCntLTn2lF+SUzlM+O3u/jw= -cloud.google.com/go/ids v1.4.2/go.mod h1:3vw8DX6YddRu9BncxuzMyWn0g8+ooUjI2gslJ7FH3vk= -cloud.google.com/go/ids v1.4.3/go.mod h1:9CXPqI3GedjmkjbMWCUhMZ2P2N7TUMzAkVXYEH2orYU= -cloud.google.com/go/ids v1.4.4/go.mod h1:z+WUc2eEl6S/1aZWzwtVNWoSZslgzPxAboS0lZX0HjI= -cloud.google.com/go/iot v1.3.0/go.mod h1:r7RGh2B61+B8oz0AGE+J72AhA0G7tdXItODWsaA2oLs= -cloud.google.com/go/iot v1.4.0/go.mod h1:dIDxPOn0UvNDUMD8Ger7FIaTuvMkj+aGk94RPP0iV+g= -cloud.google.com/go/iot v1.5.0/go.mod h1:mpz5259PDl3XJthEmh9+ap0affn/MqNSP4My77Qql9o= -cloud.google.com/go/iot v1.6.0/go.mod h1:IqdAsmE2cTYYNO1Fvjfzo9po179rAtJeVGUvkLN3rLE= -cloud.google.com/go/iot v1.7.1/go.mod h1:46Mgw7ev1k9KqK1ao0ayW9h0lI+3hxeanz+L1zmbbbk= -cloud.google.com/go/iot v1.7.2/go.mod h1:q+0P5zr1wRFpw7/MOgDXrG/HVA+l+cSwdObffkrpnSg= -cloud.google.com/go/iot v1.7.3/go.mod h1:t8itFchkol4VgNbHnIq9lXoOOtHNR3uAACQMYbN9N4I= -cloud.google.com/go/iot v1.7.4/go.mod h1:3TWqDVvsddYBG++nHSZmluoCAVGr1hAcabbWZNKEZLk= -cloud.google.com/go/kms v1.4.0/go.mod h1:fajBHndQ+6ubNw6Ss2sSd+SWvjL26RNo/dr7uxsnnOA= -cloud.google.com/go/kms v1.5.0/go.mod h1:QJS2YY0eJGBg3mnDfuaCyLauWwBJiHRboYxJ++1xJNg= -cloud.google.com/go/kms v1.6.0/go.mod h1:Jjy850yySiasBUDi6KFUwUv2n1+o7QZFyuUJg6OgjA0= -cloud.google.com/go/kms v1.8.0/go.mod h1:4xFEhYFqvW+4VMELtZyxomGSYtSQKzM178ylFW4jMAg= -cloud.google.com/go/kms v1.9.0/go.mod h1:qb1tPTgfF9RQP8e1wq4cLFErVuTJv7UsSC915J8dh3w= -cloud.google.com/go/kms v1.10.0/go.mod h1:ng3KTUtQQU9bPX3+QGLsflZIHlkbn8amFAMY63m8d24= -cloud.google.com/go/kms v1.10.1/go.mod h1:rIWk/TryCkR59GMC3YtHtXeLzd634lBbKenvyySAyYI= -cloud.google.com/go/kms v1.11.0/go.mod h1:hwdiYC0xjnWsKQQCQQmIQnS9asjYVSK6jtXm+zFqXLM= -cloud.google.com/go/kms v1.12.1/go.mod h1:c9J991h5DTl+kg7gi3MYomh12YEENGrf48ee/N/2CDM= -cloud.google.com/go/kms v1.15.0/go.mod h1:c9J991h5DTl+kg7gi3MYomh12YEENGrf48ee/N/2CDM= -cloud.google.com/go/kms v1.15.2/go.mod h1:3hopT4+7ooWRCjc2DxgnpESFxhIraaI2IpAVUEhbT/w= -cloud.google.com/go/kms v1.15.3/go.mod h1:AJdXqHxS2GlPyduM99s9iGqi2nwbviBbhV/hdmt4iOQ= -cloud.google.com/go/kms v1.15.4/go.mod h1:L3Sdj6QTHK8dfwK5D1JLsAyELsNMnd3tAIwGS4ltKpc= -cloud.google.com/go/kms v1.15.5/go.mod h1:cU2H5jnp6G2TDpUGZyqTCoy1n16fbubHZjmVXSMtwDI= -cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic= -cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI= -cloud.google.com/go/language v1.7.0/go.mod h1:DJ6dYN/W+SQOjF8e1hLQXMF21AkH2w9wiPzPCJa2MIE= -cloud.google.com/go/language v1.8.0/go.mod h1:qYPVHf7SPoNNiCL2Dr0FfEFNil1qi3pQEyygwpgVKB8= -cloud.google.com/go/language v1.9.0/go.mod h1:Ns15WooPM5Ad/5no/0n81yUetis74g3zrbeJBE+ptUY= -cloud.google.com/go/language v1.10.1/go.mod h1:CPp94nsdVNiQEt1CNjF5WkTcisLiHPyIbMhvR8H2AW0= -cloud.google.com/go/language v1.11.0/go.mod h1:uDx+pFDdAKTY8ehpWbiXyQdz8tDSYLJbQcXsCkjYyvQ= -cloud.google.com/go/language v1.11.1/go.mod h1:Xyid9MG9WOX3utvDbpX7j3tXDmmDooMyMDqgUVpH17U= -cloud.google.com/go/language v1.12.1/go.mod h1:zQhalE2QlQIxbKIZt54IASBzmZpN/aDASea5zl1l+J4= -cloud.google.com/go/language v1.12.2/go.mod h1:9idWapzr/JKXBBQ4lWqVX/hcadxB194ry20m/bTrhWc= -cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8= -cloud.google.com/go/lifesciences v0.6.0/go.mod h1:ddj6tSX/7BOnhxCSd3ZcETvtNr8NZ6t/iPhY2Tyfu08= -cloud.google.com/go/lifesciences v0.8.0/go.mod h1:lFxiEOMqII6XggGbOnKiyZ7IBwoIqA84ClvoezaA/bo= -cloud.google.com/go/lifesciences v0.9.1/go.mod h1:hACAOd1fFbCGLr/+weUKRAJas82Y4vrL3O5326N//Wc= -cloud.google.com/go/lifesciences v0.9.2/go.mod h1:QHEOO4tDzcSAzeJg7s2qwnLM2ji8IRpQl4p6m5Z9yTA= -cloud.google.com/go/lifesciences v0.9.3/go.mod h1:gNGBOJV80IWZdkd+xz4GQj4mbqaz737SCLHn2aRhQKM= -cloud.google.com/go/lifesciences v0.9.4/go.mod h1:bhm64duKhMi7s9jR9WYJYvjAFJwRqNj+Nia7hF0Z7JA= -cloud.google.com/go/logging v1.6.1/go.mod h1:5ZO0mHHbvm8gEmeEUHrmDlTDSu5imF6MUP9OfilNXBw= -cloud.google.com/go/logging v1.7.0/go.mod h1:3xjP2CjkM3ZkO73aj4ASA5wRPGGCRrPIAeNqVNkzY8M= -cloud.google.com/go/logging v1.8.1/go.mod h1:TJjR+SimHwuC8MZ9cjByQulAMgni+RkXeI3wwctHJEI= -cloud.google.com/go/longrunning v0.1.1/go.mod h1:UUFxuDWkv22EuY93jjmDMFT5GPQKeFVJBIF6QlTqdsE= -cloud.google.com/go/longrunning v0.3.0/go.mod h1:qth9Y41RRSUE69rDcOn6DdK3HfQfsUI0YSmW3iIlLJc= -cloud.google.com/go/longrunning v0.4.1/go.mod h1:4iWDqhBZ70CvZ6BfETbvam3T8FMvLK+eFj0E6AaRQTo= -cloud.google.com/go/longrunning v0.4.2/go.mod h1:OHrnaYyLUV6oqwh0xiS7e5sLQhP1m0QU9R+WhGDMgIQ= -cloud.google.com/go/longrunning v0.5.0/go.mod h1:0JNuqRShmscVAhIACGtskSAWtqtOoPkwP0YF1oVEchc= -cloud.google.com/go/longrunning v0.5.1/go.mod h1:spvimkwdz6SPWKEt/XBij79E9fiTkHSQl/fRUUQJYJc= -cloud.google.com/go/longrunning v0.5.2/go.mod h1:nqo6DQbNV2pXhGDbDMoN2bWz68MjZUzqv2YttZiveCs= -cloud.google.com/go/longrunning v0.5.3/go.mod h1:y/0ga59EYu58J6SHmmQOvekvND2qODbu8ywBBW7EK7Y= -cloud.google.com/go/longrunning v0.5.4/go.mod h1:zqNVncI0BOP8ST6XQD1+VcvuShMmq7+xFSzOL++V0dI= -cloud.google.com/go/managedidentities v1.3.0/go.mod h1:UzlW3cBOiPrzucO5qWkNkh0w33KFtBJU281hacNvsdE= -cloud.google.com/go/managedidentities v1.4.0/go.mod h1:NWSBYbEMgqmbZsLIyKvxrYbtqOsxY1ZrGM+9RgDqInM= -cloud.google.com/go/managedidentities v1.5.0/go.mod h1:+dWcZ0JlUmpuxpIDfyP5pP5y0bLdRwOS4Lp7gMni/LA= -cloud.google.com/go/managedidentities v1.6.1/go.mod h1:h/irGhTN2SkZ64F43tfGPMbHnypMbu4RB3yl8YcuEak= -cloud.google.com/go/managedidentities v1.6.2/go.mod h1:5c2VG66eCa0WIq6IylRk3TBW83l161zkFvCj28X7jn8= -cloud.google.com/go/managedidentities v1.6.3/go.mod h1:tewiat9WLyFN0Fi7q1fDD5+0N4VUoL0SCX0OTCthZq4= -cloud.google.com/go/managedidentities v1.6.4/go.mod h1:WgyaECfHmF00t/1Uk8Oun3CQ2PGUtjc3e9Alh79wyiM= -cloud.google.com/go/maps v0.1.0/go.mod h1:BQM97WGyfw9FWEmQMpZ5T6cpovXXSd1cGmFma94eubI= -cloud.google.com/go/maps v0.6.0/go.mod h1:o6DAMMfb+aINHz/p/jbcY+mYeXBoZoxTfdSQ8VAJaCw= -cloud.google.com/go/maps v0.7.0/go.mod h1:3GnvVl3cqeSvgMcpRlQidXsPYuDGQ8naBis7MVzpXsY= -cloud.google.com/go/maps v1.3.0/go.mod h1:6mWTUv+WhnOwAgjVsSW2QPPECmW+s3PcRyOa9vgG/5s= -cloud.google.com/go/maps v1.4.0/go.mod h1:6mWTUv+WhnOwAgjVsSW2QPPECmW+s3PcRyOa9vgG/5s= -cloud.google.com/go/maps v1.4.1/go.mod h1:BxSa0BnW1g2U2gNdbq5zikLlHUuHW0GFWh7sgML2kIY= -cloud.google.com/go/maps v1.5.1/go.mod h1:NPMZw1LJwQZYCfz4y+EIw+SI+24A4bpdFJqdKVr0lt4= -cloud.google.com/go/maps v1.6.1/go.mod h1:4+buOHhYXFBp58Zj/K+Lc1rCmJssxxF4pJ5CJnhdz18= -cloud.google.com/go/mediatranslation v0.5.0/go.mod h1:jGPUhGTybqsPQn91pNXw0xVHfuJ3leR1wj37oU3y1f4= -cloud.google.com/go/mediatranslation v0.6.0/go.mod h1:hHdBCTYNigsBxshbznuIMFNe5QXEowAuNmmC7h8pu5w= -cloud.google.com/go/mediatranslation v0.7.0/go.mod h1:LCnB/gZr90ONOIQLgSXagp8XUW1ODs2UmUMvcgMfI2I= -cloud.google.com/go/mediatranslation v0.8.1/go.mod h1:L/7hBdEYbYHQJhX2sldtTO5SZZ1C1vkapubj0T2aGig= -cloud.google.com/go/mediatranslation v0.8.2/go.mod h1:c9pUaDRLkgHRx3irYE5ZC8tfXGrMYwNZdmDqKMSfFp8= -cloud.google.com/go/mediatranslation v0.8.3/go.mod h1:F9OnXTy336rteOEywtY7FOqCk+J43o2RF638hkOQl4Y= -cloud.google.com/go/mediatranslation v0.8.4/go.mod h1:9WstgtNVAdN53m6TQa5GjIjLqKQPXe74hwSCxUP6nj4= -cloud.google.com/go/memcache v1.4.0/go.mod h1:rTOfiGZtJX1AaFUrOgsMHX5kAzaTQ8azHiuDoTPzNsE= -cloud.google.com/go/memcache v1.5.0/go.mod h1:dk3fCK7dVo0cUU2c36jKb4VqKPS22BTkf81Xq617aWM= -cloud.google.com/go/memcache v1.6.0/go.mod h1:XS5xB0eQZdHtTuTF9Hf8eJkKtR3pVRCcvJwtm68T3rA= -cloud.google.com/go/memcache v1.7.0/go.mod h1:ywMKfjWhNtkQTxrWxCkCFkoPjLHPW6A7WOTVI8xy3LY= -cloud.google.com/go/memcache v1.9.0/go.mod h1:8oEyzXCu+zo9RzlEaEjHl4KkgjlNDaXbCQeQWlzNFJM= -cloud.google.com/go/memcache v1.10.1/go.mod h1:47YRQIarv4I3QS5+hoETgKO40InqzLP6kpNLvyXuyaA= -cloud.google.com/go/memcache v1.10.2/go.mod h1:f9ZzJHLBrmd4BkguIAa/l/Vle6uTHzHokdnzSWOdQ6A= -cloud.google.com/go/memcache v1.10.3/go.mod h1:6z89A41MT2DVAW0P4iIRdu5cmRTsbsFn4cyiIx8gbwo= -cloud.google.com/go/memcache v1.10.4/go.mod h1:v/d8PuC8d1gD6Yn5+I3INzLR01IDn0N4Ym56RgikSI0= -cloud.google.com/go/metastore v1.5.0/go.mod h1:2ZNrDcQwghfdtCwJ33nM0+GrBGlVuh8rakL3vdPY3XY= -cloud.google.com/go/metastore v1.6.0/go.mod h1:6cyQTls8CWXzk45G55x57DVQ9gWg7RiH65+YgPsNh9s= -cloud.google.com/go/metastore v1.7.0/go.mod h1:s45D0B4IlsINu87/AsWiEVYbLaIMeUSoxlKKDqBGFS8= -cloud.google.com/go/metastore v1.8.0/go.mod h1:zHiMc4ZUpBiM7twCIFQmJ9JMEkDSyZS9U12uf7wHqSI= -cloud.google.com/go/metastore v1.10.0/go.mod h1:fPEnH3g4JJAk+gMRnrAnoqyv2lpUCqJPWOodSaf45Eo= -cloud.google.com/go/metastore v1.11.1/go.mod h1:uZuSo80U3Wd4zi6C22ZZliOUJ3XeM/MlYi/z5OAOWRA= -cloud.google.com/go/metastore v1.12.0/go.mod h1:uZuSo80U3Wd4zi6C22ZZliOUJ3XeM/MlYi/z5OAOWRA= -cloud.google.com/go/metastore v1.13.0/go.mod h1:URDhpG6XLeh5K+Glq0NOt74OfrPKTwS62gEPZzb5SOk= -cloud.google.com/go/metastore v1.13.1/go.mod h1:IbF62JLxuZmhItCppcIfzBBfUFq0DIB9HPDoLgWrVOU= -cloud.google.com/go/metastore v1.13.2/go.mod h1:KS59dD+unBji/kFebVp8XU/quNSyo8b6N6tPGspKszA= -cloud.google.com/go/metastore v1.13.3/go.mod h1:K+wdjXdtkdk7AQg4+sXS8bRrQa9gcOr+foOMF2tqINE= -cloud.google.com/go/monitoring v1.7.0/go.mod h1:HpYse6kkGo//7p6sT0wsIC6IBDET0RhIsnmlA53dvEk= -cloud.google.com/go/monitoring v1.8.0/go.mod h1:E7PtoMJ1kQXWxPjB6mv2fhC5/15jInuulFdYYtlcvT4= -cloud.google.com/go/monitoring v1.12.0/go.mod h1:yx8Jj2fZNEkL/GYZyTLS4ZtZEZN8WtDEiEqG4kLK50w= -cloud.google.com/go/monitoring v1.13.0/go.mod h1:k2yMBAB1H9JT/QETjNkgdCGD9bPF712XiLTVr+cBrpw= -cloud.google.com/go/monitoring v1.15.1/go.mod h1:lADlSAlFdbqQuwwpaImhsJXu1QSdd3ojypXrFSMr2rM= -cloud.google.com/go/monitoring v1.16.0/go.mod h1:Ptp15HgAyM1fNICAojDMoNc/wUmn67mLHQfyqbw+poY= -cloud.google.com/go/monitoring v1.16.1/go.mod h1:6HsxddR+3y9j+o/cMJH6q/KJ/CBTvM/38L/1m7bTRJ4= -cloud.google.com/go/monitoring v1.16.2/go.mod h1:B44KGwi4ZCF8Rk/5n+FWeispDXoKSk9oss2QNlXJBgc= -cloud.google.com/go/monitoring v1.16.3/go.mod h1:KwSsX5+8PnXv5NJnICZzW2R8pWTis8ypC4zmdRD63Tw= -cloud.google.com/go/networkconnectivity v1.4.0/go.mod h1:nOl7YL8odKyAOtzNX73/M5/mGZgqqMeryi6UPZTk/rA= -cloud.google.com/go/networkconnectivity v1.5.0/go.mod h1:3GzqJx7uhtlM3kln0+x5wyFvuVH1pIBJjhCpjzSt75o= -cloud.google.com/go/networkconnectivity v1.6.0/go.mod h1:OJOoEXW+0LAxHh89nXd64uGG+FbQoeH8DtxCHVOMlaM= -cloud.google.com/go/networkconnectivity v1.7.0/go.mod h1:RMuSbkdbPwNMQjB5HBWD5MpTBnNm39iAVpC3TmsExt8= -cloud.google.com/go/networkconnectivity v1.10.0/go.mod h1:UP4O4sWXJG13AqrTdQCD9TnLGEbtNRqjuaaA7bNjF5E= -cloud.google.com/go/networkconnectivity v1.11.0/go.mod h1:iWmDD4QF16VCDLXUqvyspJjIEtBR/4zq5hwnY2X3scM= -cloud.google.com/go/networkconnectivity v1.12.1/go.mod h1:PelxSWYM7Sh9/guf8CFhi6vIqf19Ir/sbfZRUwXh92E= -cloud.google.com/go/networkconnectivity v1.13.0/go.mod h1:SAnGPes88pl7QRLUen2HmcBSE9AowVAcdug8c0RSBFk= -cloud.google.com/go/networkconnectivity v1.14.0/go.mod h1:SAnGPes88pl7QRLUen2HmcBSE9AowVAcdug8c0RSBFk= -cloud.google.com/go/networkconnectivity v1.14.1/go.mod h1:LyGPXR742uQcDxZ/wv4EI0Vu5N6NKJ77ZYVnDe69Zug= -cloud.google.com/go/networkconnectivity v1.14.2/go.mod h1:5UFlwIisZylSkGG1AdwK/WZUaoz12PKu6wODwIbFzJo= -cloud.google.com/go/networkconnectivity v1.14.3/go.mod h1:4aoeFdrJpYEXNvrnfyD5kIzs8YtHg945Og4koAjHQek= -cloud.google.com/go/networkmanagement v1.4.0/go.mod h1:Q9mdLLRn60AsOrPc8rs8iNV6OHXaGcDdsIQe1ohekq8= -cloud.google.com/go/networkmanagement v1.5.0/go.mod h1:ZnOeZ/evzUdUsnvRt792H0uYEnHQEMaz+REhhzJRcf4= -cloud.google.com/go/networkmanagement v1.6.0/go.mod h1:5pKPqyXjB/sgtvB5xqOemumoQNB7y95Q7S+4rjSOPYY= -cloud.google.com/go/networkmanagement v1.8.0/go.mod h1:Ho/BUGmtyEqrttTgWEe7m+8vDdK74ibQc+Be0q7Fof0= -cloud.google.com/go/networkmanagement v1.9.0/go.mod h1:UTUaEU9YwbCAhhz3jEOHr+2/K/MrBk2XxOLS89LQzFw= -cloud.google.com/go/networkmanagement v1.9.1/go.mod h1:CCSYgrQQvW73EJawO2QamemYcOb57LvrDdDU51F0mcI= -cloud.google.com/go/networkmanagement v1.9.2/go.mod h1:iDGvGzAoYRghhp4j2Cji7sF899GnfGQcQRQwgVOWnDw= -cloud.google.com/go/networkmanagement v1.9.3/go.mod h1:y7WMO1bRLaP5h3Obm4tey+NquUvB93Co1oh4wpL+XcU= -cloud.google.com/go/networksecurity v0.5.0/go.mod h1:xS6fOCoqpVC5zx15Z/MqkfDwH4+m/61A3ODiDV1xmiQ= -cloud.google.com/go/networksecurity v0.6.0/go.mod h1:Q5fjhTr9WMI5mbpRYEbiexTzROf7ZbDzvzCrNl14nyU= -cloud.google.com/go/networksecurity v0.7.0/go.mod h1:mAnzoxx/8TBSyXEeESMy9OOYwo1v+gZ5eMRnsT5bC8k= -cloud.google.com/go/networksecurity v0.8.0/go.mod h1:B78DkqsxFG5zRSVuwYFRZ9Xz8IcQ5iECsNrPn74hKHU= -cloud.google.com/go/networksecurity v0.9.1/go.mod h1:MCMdxOKQ30wsBI1eI659f9kEp4wuuAueoC9AJKSPWZQ= -cloud.google.com/go/networksecurity v0.9.2/go.mod h1:jG0SeAttWzPMUILEHDUvFYdQTl8L/E/KC8iZDj85lEI= -cloud.google.com/go/networksecurity v0.9.3/go.mod h1:l+C0ynM6P+KV9YjOnx+kk5IZqMSLccdBqW6GUoF4p/0= -cloud.google.com/go/networksecurity v0.9.4/go.mod h1:E9CeMZ2zDsNBkr8axKSYm8XyTqNhiCHf1JO/Vb8mD1w= -cloud.google.com/go/notebooks v1.2.0/go.mod h1:9+wtppMfVPUeJ8fIWPOq1UnATHISkGXGqTkxeieQ6UY= -cloud.google.com/go/notebooks v1.3.0/go.mod h1:bFR5lj07DtCPC7YAAJ//vHskFBxA5JzYlH68kXVdk34= -cloud.google.com/go/notebooks v1.4.0/go.mod h1:4QPMngcwmgb6uw7Po99B2xv5ufVoIQ7nOGDyL4P8AgA= -cloud.google.com/go/notebooks v1.5.0/go.mod h1:q8mwhnP9aR8Hpfnrc5iN5IBhrXUy8S2vuYs+kBJ/gu0= -cloud.google.com/go/notebooks v1.7.0/go.mod h1:PVlaDGfJgj1fl1S3dUwhFMXFgfYGhYQt2164xOMONmE= -cloud.google.com/go/notebooks v1.8.0/go.mod h1:Lq6dYKOYOWUCTvw5t2q1gp1lAp0zxAxRycayS0iJcqQ= -cloud.google.com/go/notebooks v1.9.1/go.mod h1:zqG9/gk05JrzgBt4ghLzEepPHNwE5jgPcHZRKhlC1A8= -cloud.google.com/go/notebooks v1.10.0/go.mod h1:SOPYMZnttHxqot0SGSFSkRrwE29eqnKPBJFqgWmiK2k= -cloud.google.com/go/notebooks v1.10.1/go.mod h1:5PdJc2SgAybE76kFQCWrTfJolCOUQXF97e+gteUUA6A= -cloud.google.com/go/notebooks v1.11.1/go.mod h1:V2Zkv8wX9kDCGRJqYoI+bQAaoVeE5kSiz4yYHd2yJwQ= -cloud.google.com/go/notebooks v1.11.2/go.mod h1:z0tlHI/lREXC8BS2mIsUeR3agM1AkgLiS+Isov3SS70= -cloud.google.com/go/optimization v1.1.0/go.mod h1:5po+wfvX5AQlPznyVEZjGJTMr4+CAkJf2XSTQOOl9l4= -cloud.google.com/go/optimization v1.2.0/go.mod h1:Lr7SOHdRDENsh+WXVmQhQTrzdu9ybg0NecjHidBq6xs= -cloud.google.com/go/optimization v1.3.1/go.mod h1:IvUSefKiwd1a5p0RgHDbWCIbDFgKuEdB+fPPuP0IDLI= -cloud.google.com/go/optimization v1.4.1/go.mod h1:j64vZQP7h9bO49m2rVaTVoNM0vEBEN5eKPUPbZyXOrk= -cloud.google.com/go/optimization v1.5.0/go.mod h1:evo1OvTxeBRBu6ydPlrIRizKY/LJKo/drDMMRKqGEUU= -cloud.google.com/go/optimization v1.5.1/go.mod h1:NC0gnUD5MWVAF7XLdoYVPmYYVth93Q6BUzqAq3ZwtV8= -cloud.google.com/go/optimization v1.6.1/go.mod h1:hH2RYPTTM9e9zOiTaYPTiGPcGdNZVnBSBxjIAJzUkqo= -cloud.google.com/go/optimization v1.6.2/go.mod h1:mWNZ7B9/EyMCcwNl1frUGEuY6CPijSkz88Fz2vwKPOY= -cloud.google.com/go/orchestration v1.3.0/go.mod h1:Sj5tq/JpWiB//X/q3Ngwdl5K7B7Y0KZ7bfv0wL6fqVA= -cloud.google.com/go/orchestration v1.4.0/go.mod h1:6W5NLFWs2TlniBphAViZEVhrXRSMgUGDfW7vrWKvsBk= -cloud.google.com/go/orchestration v1.6.0/go.mod h1:M62Bevp7pkxStDfFfTuCOaXgaaqRAga1yKyoMtEoWPQ= -cloud.google.com/go/orchestration v1.8.1/go.mod h1:4sluRF3wgbYVRqz7zJ1/EUNc90TTprliq9477fGobD8= -cloud.google.com/go/orchestration v1.8.2/go.mod h1:T1cP+6WyTmh6LSZzeUhvGf0uZVmJyTx7t8z7Vg87+A0= -cloud.google.com/go/orchestration v1.8.3/go.mod h1:xhgWAYqlbYjlz2ftbFghdyqENYW+JXuhBx9KsjMoGHs= -cloud.google.com/go/orchestration v1.8.4/go.mod h1:d0lywZSVYtIoSZXb0iFjv9SaL13PGyVOKDxqGxEf/qI= -cloud.google.com/go/orgpolicy v1.4.0/go.mod h1:xrSLIV4RePWmP9P3tBl8S93lTmlAxjm06NSm2UTmKvE= -cloud.google.com/go/orgpolicy v1.5.0/go.mod h1:hZEc5q3wzwXJaKrsx5+Ewg0u1LxJ51nNFlext7Tanwc= -cloud.google.com/go/orgpolicy v1.10.0/go.mod h1:w1fo8b7rRqlXlIJbVhOMPrwVljyuW5mqssvBtU18ONc= -cloud.google.com/go/orgpolicy v1.11.0/go.mod h1:2RK748+FtVvnfuynxBzdnyu7sygtoZa1za/0ZfpOs1M= -cloud.google.com/go/orgpolicy v1.11.1/go.mod h1:8+E3jQcpZJQliP+zaFfayC2Pg5bmhuLK755wKhIIUCE= -cloud.google.com/go/orgpolicy v1.11.2/go.mod h1:biRDpNwfyytYnmCRWZWxrKF22Nkz9eNVj9zyaBdpm1o= -cloud.google.com/go/orgpolicy v1.11.3/go.mod h1:oKAtJ/gkMjum5icv2aujkP4CxROxPXsBbYGCDbPO8MM= -cloud.google.com/go/orgpolicy v1.11.4/go.mod h1:0+aNV/nrfoTQ4Mytv+Aw+stBDBjNf4d8fYRA9herfJI= -cloud.google.com/go/osconfig v1.7.0/go.mod h1:oVHeCeZELfJP7XLxcBGTMBvRO+1nQ5tFG9VQTmYS2Fs= -cloud.google.com/go/osconfig v1.8.0/go.mod h1:EQqZLu5w5XA7eKizepumcvWx+m8mJUhEwiPqWiZeEdg= -cloud.google.com/go/osconfig v1.9.0/go.mod h1:Yx+IeIZJ3bdWmzbQU4fxNl8xsZ4amB+dygAwFPlvnNo= -cloud.google.com/go/osconfig v1.10.0/go.mod h1:uMhCzqC5I8zfD9zDEAfvgVhDS8oIjySWh+l4WK6GnWw= -cloud.google.com/go/osconfig v1.11.0/go.mod h1:aDICxrur2ogRd9zY5ytBLV89KEgT2MKB2L/n6x1ooPw= -cloud.google.com/go/osconfig v1.12.0/go.mod h1:8f/PaYzoS3JMVfdfTubkowZYGmAhUCjjwnjqWI7NVBc= -cloud.google.com/go/osconfig v1.12.1/go.mod h1:4CjBxND0gswz2gfYRCUoUzCm9zCABp91EeTtWXyz0tE= -cloud.google.com/go/osconfig v1.12.2/go.mod h1:eh9GPaMZpI6mEJEuhEjUJmaxvQ3gav+fFEJon1Y8Iw0= -cloud.google.com/go/osconfig v1.12.3/go.mod h1:L/fPS8LL6bEYUi1au832WtMnPeQNT94Zo3FwwV1/xGM= -cloud.google.com/go/osconfig v1.12.4/go.mod h1:B1qEwJ/jzqSRslvdOCI8Kdnp0gSng0xW4LOnIebQomA= -cloud.google.com/go/oslogin v1.4.0/go.mod h1:YdgMXWRaElXz/lDk1Na6Fh5orF7gvmJ0FGLIs9LId4E= -cloud.google.com/go/oslogin v1.5.0/go.mod h1:D260Qj11W2qx/HVF29zBg+0fd6YCSjSqLUkY/qEenQU= -cloud.google.com/go/oslogin v1.6.0/go.mod h1:zOJ1O3+dTU8WPlGEkFSh7qeHPPSoxrcMbbK1Nm2iX70= -cloud.google.com/go/oslogin v1.7.0/go.mod h1:e04SN0xO1UNJ1M5GP0vzVBFicIe4O53FOfcixIqTyXo= -cloud.google.com/go/oslogin v1.9.0/go.mod h1:HNavntnH8nzrn8JCTT5fj18FuJLFJc4NaZJtBnQtKFs= -cloud.google.com/go/oslogin v1.10.1/go.mod h1:x692z7yAue5nE7CsSnoG0aaMbNoRJRXO4sn73R+ZqAs= -cloud.google.com/go/oslogin v1.11.0/go.mod h1:8GMTJs4X2nOAUVJiPGqIWVcDaF0eniEto3xlOxaboXE= -cloud.google.com/go/oslogin v1.11.1/go.mod h1:OhD2icArCVNUxKqtK0mcSmKL7lgr0LVlQz+v9s1ujTg= -cloud.google.com/go/oslogin v1.12.1/go.mod h1:VfwTeFJGbnakxAY236eN8fsnglLiVXndlbcNomY4iZU= -cloud.google.com/go/oslogin v1.12.2/go.mod h1:CQ3V8Jvw4Qo4WRhNPF0o+HAM4DiLuE27Ul9CX9g2QdY= -cloud.google.com/go/phishingprotection v0.5.0/go.mod h1:Y3HZknsK9bc9dMi+oE8Bim0lczMU6hrX0UpADuMefr0= -cloud.google.com/go/phishingprotection v0.6.0/go.mod h1:9Y3LBLgy0kDTcYET8ZH3bq/7qni15yVUoAxiFxnlSUA= -cloud.google.com/go/phishingprotection v0.7.0/go.mod h1:8qJI4QKHoda/sb/7/YmMQ2omRLSLYSu9bU0EKCNI+Lk= -cloud.google.com/go/phishingprotection v0.8.1/go.mod h1:AxonW7GovcA8qdEk13NfHq9hNx5KPtfxXNeUxTDxB6I= -cloud.google.com/go/phishingprotection v0.8.2/go.mod h1:LhJ91uyVHEYKSKcMGhOa14zMMWfbEdxG032oT6ECbC8= -cloud.google.com/go/phishingprotection v0.8.3/go.mod h1:3B01yO7T2Ra/TMojifn8EoGd4G9jts/6cIO0DgDY9J8= -cloud.google.com/go/phishingprotection v0.8.4/go.mod h1:6b3kNPAc2AQ6jZfFHioZKg9MQNybDg4ixFd4RPZZ2nE= -cloud.google.com/go/policytroubleshooter v1.3.0/go.mod h1:qy0+VwANja+kKrjlQuOzmlvscn4RNsAc0e15GGqfMxg= -cloud.google.com/go/policytroubleshooter v1.4.0/go.mod h1:DZT4BcRw3QoO8ota9xw/LKtPa8lKeCByYeKTIf/vxdE= -cloud.google.com/go/policytroubleshooter v1.5.0/go.mod h1:Rz1WfV+1oIpPdN2VvvuboLVRsB1Hclg3CKQ53j9l8vw= -cloud.google.com/go/policytroubleshooter v1.6.0/go.mod h1:zYqaPTsmfvpjm5ULxAyD/lINQxJ0DDsnWOP/GZ7xzBc= -cloud.google.com/go/policytroubleshooter v1.7.1/go.mod h1:0NaT5v3Ag1M7U5r0GfDCpUFkWd9YqpubBWsQlhanRv0= -cloud.google.com/go/policytroubleshooter v1.8.0/go.mod h1:tmn5Ir5EToWe384EuboTcVQT7nTag2+DuH3uHmKd1HU= -cloud.google.com/go/policytroubleshooter v1.9.0/go.mod h1:+E2Lga7TycpeSTj2FsH4oXxTnrbHJGRlKhVZBLGgU64= -cloud.google.com/go/policytroubleshooter v1.9.1/go.mod h1:MYI8i0bCrL8cW+VHN1PoiBTyNZTstCg2WUw2eVC4c4U= -cloud.google.com/go/policytroubleshooter v1.10.1/go.mod h1:5C0rhT3TDZVxAu8813bwmTvd57Phbl8mr9F4ipOsxEs= -cloud.google.com/go/policytroubleshooter v1.10.2/go.mod h1:m4uF3f6LseVEnMV6nknlN2vYGRb+75ylQwJdnOXfnv0= -cloud.google.com/go/privatecatalog v0.5.0/go.mod h1:XgosMUvvPyxDjAVNDYxJ7wBW8//hLDDYmnsNcMGq1K0= -cloud.google.com/go/privatecatalog v0.6.0/go.mod h1:i/fbkZR0hLN29eEWiiwue8Pb+GforiEIBnV9yrRUOKI= -cloud.google.com/go/privatecatalog v0.7.0/go.mod h1:2s5ssIFO69F5csTXcwBP7NPFTZvps26xGzvQ2PQaBYg= -cloud.google.com/go/privatecatalog v0.8.0/go.mod h1:nQ6pfaegeDAq/Q5lrfCQzQLhubPiZhSaNhIgfJlnIXs= -cloud.google.com/go/privatecatalog v0.9.1/go.mod h1:0XlDXW2unJXdf9zFz968Hp35gl/bhF4twwpXZAW50JA= -cloud.google.com/go/privatecatalog v0.9.2/go.mod h1:RMA4ATa8IXfzvjrhhK8J6H4wwcztab+oZph3c6WmtFc= -cloud.google.com/go/privatecatalog v0.9.3/go.mod h1:K5pn2GrVmOPjXz3T26mzwXLcKivfIJ9R5N79AFCF9UE= -cloud.google.com/go/privatecatalog v0.9.4/go.mod h1:SOjm93f+5hp/U3PqMZAHTtBtluqLygrDrVO8X8tYtG0= -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/pubsub v1.26.0/go.mod h1:QgBH3U/jdJy/ftjPhTkyXNj543Tin1pRYcdcPRnFIRI= -cloud.google.com/go/pubsub v1.27.1/go.mod h1:hQN39ymbV9geqBnfQq6Xf63yNhUAhv9CZhzp5O6qsW0= -cloud.google.com/go/pubsub v1.28.0/go.mod h1:vuXFpwaVoIPQMGXqRyUQigu/AX1S3IWugR9xznmcXX8= -cloud.google.com/go/pubsub v1.30.0/go.mod h1:qWi1OPS0B+b5L+Sg6Gmc9zD1Y+HaM0MdUr7LsupY1P4= -cloud.google.com/go/pubsub v1.32.0/go.mod h1:f+w71I33OMyxf9VpMVcZbnG5KSUkCOUHYpFd5U1GdRc= -cloud.google.com/go/pubsub v1.33.0/go.mod h1:f+w71I33OMyxf9VpMVcZbnG5KSUkCOUHYpFd5U1GdRc= -cloud.google.com/go/pubsublite v1.5.0/go.mod h1:xapqNQ1CuLfGi23Yda/9l4bBCKz/wC3KIJ5gKcxveZg= -cloud.google.com/go/pubsublite v1.6.0/go.mod h1:1eFCS0U11xlOuMFV/0iBqw3zP12kddMeCbj/F3FSj9k= -cloud.google.com/go/pubsublite v1.7.0/go.mod h1:8hVMwRXfDfvGm3fahVbtDbiLePT3gpoiJYJY+vxWxVM= -cloud.google.com/go/pubsublite v1.8.1/go.mod h1:fOLdU4f5xldK4RGJrBMm+J7zMWNj/k4PxwEZXy39QS0= -cloud.google.com/go/recaptchaenterprise v1.3.1/go.mod h1:OdD+q+y4XGeAlxRaMn1Y7/GveP6zmq76byL6tjPE7d4= -cloud.google.com/go/recaptchaenterprise/v2 v2.1.0/go.mod h1:w9yVqajwroDNTfGuhmOjPDN//rZGySaf6PtFVcSCa7o= -cloud.google.com/go/recaptchaenterprise/v2 v2.2.0/go.mod h1:/Zu5jisWGeERrd5HnlS3EUGb/D335f9k51B/FVil0jk= -cloud.google.com/go/recaptchaenterprise/v2 v2.3.0/go.mod h1:O9LwGCjrhGHBQET5CA7dd5NwwNQUErSgEDit1DLNTdo= -cloud.google.com/go/recaptchaenterprise/v2 v2.4.0/go.mod h1:Am3LHfOuBstrLrNCBrlI5sbwx9LBg3te2N6hGvHn2mE= -cloud.google.com/go/recaptchaenterprise/v2 v2.5.0/go.mod h1:O8LzcHXN3rz0j+LBC91jrwI3R+1ZSZEWrfL7XHgNo9U= -cloud.google.com/go/recaptchaenterprise/v2 v2.6.0/go.mod h1:RPauz9jeLtB3JVzg6nCbe12qNoaa8pXc4d/YukAmcnA= -cloud.google.com/go/recaptchaenterprise/v2 v2.7.0/go.mod h1:19wVj/fs5RtYtynAPJdDTb69oW0vNHYDBTbB4NvMD9c= -cloud.google.com/go/recaptchaenterprise/v2 v2.7.2/go.mod h1:kR0KjsJS7Jt1YSyWFkseQ756D45kaYNTlDPPaRAvDBU= -cloud.google.com/go/recaptchaenterprise/v2 v2.8.0/go.mod h1:QuE8EdU9dEnesG8/kG3XuJyNsjEqMlMzg3v3scCJ46c= -cloud.google.com/go/recaptchaenterprise/v2 v2.8.1/go.mod h1:JZYZJOeZjgSSTGP4uz7NlQ4/d1w5hGmksVgM0lbEij0= -cloud.google.com/go/recaptchaenterprise/v2 v2.8.2/go.mod h1:kpaDBOpkwD4G0GVMzG1W6Doy1tFFC97XAV3xy+Rd/pw= -cloud.google.com/go/recaptchaenterprise/v2 v2.8.3/go.mod h1:Dak54rw6lC2gBY8FBznpOCAR58wKf+R+ZSJRoeJok4w= -cloud.google.com/go/recommendationengine v0.5.0/go.mod h1:E5756pJcVFeVgaQv3WNpImkFP8a+RptV6dDLGPILjvg= -cloud.google.com/go/recommendationengine v0.6.0/go.mod h1:08mq2umu9oIqc7tDy8sx+MNJdLG0fUi3vaSVbztHgJ4= -cloud.google.com/go/recommendationengine v0.7.0/go.mod h1:1reUcE3GIu6MeBz/h5xZJqNLuuVjNg1lmWMPyjatzac= -cloud.google.com/go/recommendationengine v0.8.1/go.mod h1:MrZihWwtFYWDzE6Hz5nKcNz3gLizXVIDI/o3G1DLcrE= -cloud.google.com/go/recommendationengine v0.8.2/go.mod h1:QIybYHPK58qir9CV2ix/re/M//Ty10OxjnnhWdaKS1Y= -cloud.google.com/go/recommendationengine v0.8.3/go.mod h1:m3b0RZV02BnODE9FeSvGv1qibFo8g0OnmB/RMwYy4V8= -cloud.google.com/go/recommendationengine v0.8.4/go.mod h1:GEteCf1PATl5v5ZsQ60sTClUE0phbWmo3rQ1Js8louU= -cloud.google.com/go/recommender v1.5.0/go.mod h1:jdoeiBIVrJe9gQjwd759ecLJbxCDED4A6p+mqoqDvTg= -cloud.google.com/go/recommender v1.6.0/go.mod h1:+yETpm25mcoiECKh9DEScGzIRyDKpZ0cEhWGo+8bo+c= -cloud.google.com/go/recommender v1.7.0/go.mod h1:XLHs/W+T8olwlGOgfQenXBTbIseGclClff6lhFVe9Bs= -cloud.google.com/go/recommender v1.8.0/go.mod h1:PkjXrTT05BFKwxaUxQmtIlrtj0kph108r02ZZQ5FE70= -cloud.google.com/go/recommender v1.9.0/go.mod h1:PnSsnZY7q+VL1uax2JWkt/UegHssxjUVVCrX52CuEmQ= -cloud.google.com/go/recommender v1.10.1/go.mod h1:XFvrE4Suqn5Cq0Lf+mCP6oBHD/yRMA8XxP5sb7Q7gpA= -cloud.google.com/go/recommender v1.11.0/go.mod h1:kPiRQhPyTJ9kyXPCG6u/dlPLbYfFlkwHNRwdzPVAoII= -cloud.google.com/go/recommender v1.11.1/go.mod h1:sGwFFAyI57v2Hc5LbIj+lTwXipGu9NW015rkaEM5B18= -cloud.google.com/go/recommender v1.11.2/go.mod h1:AeoJuzOvFR/emIcXdVFkspVXVTYpliRCmKNYDnyBv6Y= -cloud.google.com/go/recommender v1.11.3/go.mod h1:+FJosKKJSId1MBFeJ/TTyoGQZiEelQQIZMKYYD8ruK4= -cloud.google.com/go/redis v1.7.0/go.mod h1:V3x5Jq1jzUcg+UNsRvdmsfuFnit1cfe3Z/PGyq/lm4Y= -cloud.google.com/go/redis v1.8.0/go.mod h1:Fm2szCDavWzBk2cDKxrkmWBqoCiL1+Ctwq7EyqBCA/A= -cloud.google.com/go/redis v1.9.0/go.mod h1:HMYQuajvb2D0LvMgZmLDZW8V5aOC/WxstZHiy4g8OiA= -cloud.google.com/go/redis v1.10.0/go.mod h1:ThJf3mMBQtW18JzGgh41/Wld6vnDDc/F/F35UolRZPM= -cloud.google.com/go/redis v1.11.0/go.mod h1:/X6eicana+BWcUda5PpwZC48o37SiFVTFSs0fWAJ7uQ= -cloud.google.com/go/redis v1.13.1/go.mod h1:VP7DGLpE91M6bcsDdMuyCm2hIpB6Vp2hI090Mfd1tcg= -cloud.google.com/go/redis v1.13.2/go.mod h1:0Hg7pCMXS9uz02q+LoEVl5dNHUkIQv+C/3L76fandSA= -cloud.google.com/go/redis v1.13.3/go.mod h1:vbUpCKUAZSYzFcWKmICnYgRAhTFg9r+djWqFxDYXi4U= -cloud.google.com/go/redis v1.14.1/go.mod h1:MbmBxN8bEnQI4doZPC1BzADU4HGocHBk2de3SbgOkqs= -cloud.google.com/go/resourcemanager v1.3.0/go.mod h1:bAtrTjZQFJkiWTPDb1WBjzvc6/kifjj4QBYuKCCoqKA= -cloud.google.com/go/resourcemanager v1.4.0/go.mod h1:MwxuzkumyTX7/a3n37gmsT3py7LIXwrShilPh3P1tR0= -cloud.google.com/go/resourcemanager v1.5.0/go.mod h1:eQoXNAiAvCf5PXxWxXjhKQoTMaUSNrEfg+6qdf/wots= -cloud.google.com/go/resourcemanager v1.6.0/go.mod h1:YcpXGRs8fDzcUl1Xw8uOVmI8JEadvhRIkoXXUNVYcVo= -cloud.google.com/go/resourcemanager v1.7.0/go.mod h1:HlD3m6+bwhzj9XCouqmeiGuni95NTrExfhoSrkC/3EI= -cloud.google.com/go/resourcemanager v1.9.1/go.mod h1:dVCuosgrh1tINZ/RwBufr8lULmWGOkPS8gL5gqyjdT8= -cloud.google.com/go/resourcemanager v1.9.2/go.mod h1:OujkBg1UZg5lX2yIyMo5Vz9O5hf7XQOSV7WxqxxMtQE= -cloud.google.com/go/resourcemanager v1.9.3/go.mod h1:IqrY+g0ZgLsihcfcmqSe+RKp1hzjXwG904B92AwBz6U= -cloud.google.com/go/resourcemanager v1.9.4/go.mod h1:N1dhP9RFvo3lUfwtfLWVxfUWq8+KUQ+XLlHLH3BoFJ0= -cloud.google.com/go/resourcesettings v1.3.0/go.mod h1:lzew8VfESA5DQ8gdlHwMrqZs1S9V87v3oCnKCWoOuQU= -cloud.google.com/go/resourcesettings v1.4.0/go.mod h1:ldiH9IJpcrlC3VSuCGvjR5of/ezRrOxFtpJoJo5SmXg= -cloud.google.com/go/resourcesettings v1.5.0/go.mod h1:+xJF7QSG6undsQDfsCJyqWXyBwUoJLhetkRMDRnIoXA= -cloud.google.com/go/resourcesettings v1.6.1/go.mod h1:M7mk9PIZrC5Fgsu1kZJci6mpgN8o0IUzVx3eJU3y4Jw= -cloud.google.com/go/resourcesettings v1.6.2/go.mod h1:mJIEDd9MobzunWMeniaMp6tzg4I2GvD3TTmPkc8vBXk= -cloud.google.com/go/resourcesettings v1.6.3/go.mod h1:pno5D+7oDYkMWZ5BpPsb4SO0ewg3IXcmmrUZaMJrFic= -cloud.google.com/go/resourcesettings v1.6.4/go.mod h1:pYTTkWdv2lmQcjsthbZLNBP4QW140cs7wqA3DuqErVI= -cloud.google.com/go/retail v1.8.0/go.mod h1:QblKS8waDmNUhghY2TI9O3JLlFk8jybHeV4BF19FrE4= -cloud.google.com/go/retail v1.9.0/go.mod h1:g6jb6mKuCS1QKnH/dpu7isX253absFl6iE92nHwlBUY= -cloud.google.com/go/retail v1.10.0/go.mod h1:2gDk9HsL4HMS4oZwz6daui2/jmKvqShXKQuB2RZ+cCc= -cloud.google.com/go/retail v1.11.0/go.mod h1:MBLk1NaWPmh6iVFSz9MeKG/Psyd7TAgm6y/9L2B4x9Y= -cloud.google.com/go/retail v1.12.0/go.mod h1:UMkelN/0Z8XvKymXFbD4EhFJlYKRx1FGhQkVPU5kF14= -cloud.google.com/go/retail v1.14.1/go.mod h1:y3Wv3Vr2k54dLNIrCzenyKG8g8dhvhncT2NcNjb/6gE= -cloud.google.com/go/retail v1.14.2/go.mod h1:W7rrNRChAEChX336QF7bnMxbsjugcOCPU44i5kbLiL8= -cloud.google.com/go/retail v1.14.3/go.mod h1:Omz2akDHeSlfCq8ArPKiBxlnRpKEBjUH386JYFLUvXo= -cloud.google.com/go/retail v1.14.4/go.mod h1:l/N7cMtY78yRnJqp5JW8emy7MB1nz8E4t2yfOmklYfg= -cloud.google.com/go/run v0.2.0/go.mod h1:CNtKsTA1sDcnqqIFR3Pb5Tq0usWxJJvsWOCPldRU3Do= -cloud.google.com/go/run v0.3.0/go.mod h1:TuyY1+taHxTjrD0ZFk2iAR+xyOXEA0ztb7U3UNA0zBo= -cloud.google.com/go/run v0.8.0/go.mod h1:VniEnuBwqjigv0A7ONfQUaEItaiCRVujlMqerPPiktM= -cloud.google.com/go/run v0.9.0/go.mod h1:Wwu+/vvg8Y+JUApMwEDfVfhetv30hCG4ZwDR/IXl2Qg= -cloud.google.com/go/run v1.2.0/go.mod h1:36V1IlDzQ0XxbQjUx6IYbw8H3TJnWvhii963WW3B/bo= -cloud.google.com/go/run v1.3.0/go.mod h1:S/osX/4jIPZGg+ssuqh6GNgg7syixKe3YnprwehzHKU= -cloud.google.com/go/run v1.3.1/go.mod h1:cymddtZOzdwLIAsmS6s+Asl4JoXIDm/K1cpZTxV4Q5s= -cloud.google.com/go/run v1.3.2/go.mod h1:SIhmqArbjdU/D9M6JoHaAqnAMKLFtXaVdNeq04NjnVE= -cloud.google.com/go/run v1.3.3/go.mod h1:WSM5pGyJ7cfYyYbONVQBN4buz42zFqwG67Q3ch07iK4= -cloud.google.com/go/scheduler v1.4.0/go.mod h1:drcJBmxF3aqZJRhmkHQ9b3uSSpQoltBPGPxGAWROx6s= -cloud.google.com/go/scheduler v1.5.0/go.mod h1:ri073ym49NW3AfT6DZi21vLZrG07GXr5p3H1KxN5QlI= -cloud.google.com/go/scheduler v1.6.0/go.mod h1:SgeKVM7MIwPn3BqtcBntpLyrIJftQISRrYB5ZtT+KOk= -cloud.google.com/go/scheduler v1.7.0/go.mod h1:jyCiBqWW956uBjjPMMuX09n3x37mtyPJegEWKxRsn44= -cloud.google.com/go/scheduler v1.8.0/go.mod h1:TCET+Y5Gp1YgHT8py4nlg2Sew8nUHMqcpousDgXJVQc= -cloud.google.com/go/scheduler v1.9.0/go.mod h1:yexg5t+KSmqu+njTIh3b7oYPheFtBWGcbVUYF1GGMIc= -cloud.google.com/go/scheduler v1.10.1/go.mod h1:R63Ldltd47Bs4gnhQkmNDse5w8gBRrhObZ54PxgR2Oo= -cloud.google.com/go/scheduler v1.10.2/go.mod h1:O3jX6HRH5eKCA3FutMw375XHZJudNIKVonSCHv7ropY= -cloud.google.com/go/scheduler v1.10.3/go.mod h1:8ANskEM33+sIbpJ+R4xRfw/jzOG+ZFE8WVLy7/yGvbc= -cloud.google.com/go/scheduler v1.10.4/go.mod h1:MTuXcrJC9tqOHhixdbHDFSIuh7xZF2IysiINDuiq6NI= -cloud.google.com/go/secretmanager v1.6.0/go.mod h1:awVa/OXF6IiyaU1wQ34inzQNc4ISIDIrId8qE5QGgKA= -cloud.google.com/go/secretmanager v1.8.0/go.mod h1:hnVgi/bN5MYHd3Gt0SPuTPPp5ENina1/LxM+2W9U9J4= -cloud.google.com/go/secretmanager v1.9.0/go.mod h1:b71qH2l1yHmWQHt9LC80akm86mX8AL6X1MA01dW8ht4= -cloud.google.com/go/secretmanager v1.10.0/go.mod h1:MfnrdvKMPNra9aZtQFvBcvRU54hbPD8/HayQdlUgJpU= -cloud.google.com/go/secretmanager v1.11.1/go.mod h1:znq9JlXgTNdBeQk9TBW/FnR/W4uChEKGeqQWAJ8SXFw= -cloud.google.com/go/secretmanager v1.11.2/go.mod h1:MQm4t3deoSub7+WNwiC4/tRYgDBHJgJPvswqQVB1Vss= -cloud.google.com/go/secretmanager v1.11.3/go.mod h1:0bA2o6FabmShrEy328i67aV+65XoUFFSmVeLBn/51jI= -cloud.google.com/go/secretmanager v1.11.4/go.mod h1:wreJlbS9Zdq21lMzWmJ0XhWW2ZxgPeahsqeV/vZoJ3w= -cloud.google.com/go/security v1.5.0/go.mod h1:lgxGdyOKKjHL4YG3/YwIL2zLqMFCKs0UbQwgyZmfJl4= -cloud.google.com/go/security v1.7.0/go.mod h1:mZklORHl6Bg7CNnnjLH//0UlAlaXqiG7Lb9PsPXLfD0= -cloud.google.com/go/security v1.8.0/go.mod h1:hAQOwgmaHhztFhiQ41CjDODdWP0+AE1B3sX4OFlq+GU= -cloud.google.com/go/security v1.9.0/go.mod h1:6Ta1bO8LXI89nZnmnsZGp9lVoVWXqsVbIq/t9dzI+2Q= -cloud.google.com/go/security v1.10.0/go.mod h1:QtOMZByJVlibUT2h9afNDWRZ1G96gVywH8T5GUSb9IA= -cloud.google.com/go/security v1.12.0/go.mod h1:rV6EhrpbNHrrxqlvW0BWAIawFWq3X90SduMJdFwtLB8= -cloud.google.com/go/security v1.13.0/go.mod h1:Q1Nvxl1PAgmeW0y3HTt54JYIvUdtcpYKVfIB8AOMZ+0= -cloud.google.com/go/security v1.15.1/go.mod h1:MvTnnbsWnehoizHi09zoiZob0iCHVcL4AUBj76h9fXA= -cloud.google.com/go/security v1.15.2/go.mod h1:2GVE/v1oixIRHDaClVbHuPcZwAqFM28mXuAKCfMgYIg= -cloud.google.com/go/security v1.15.3/go.mod h1:gQ/7Q2JYUZZgOzqKtw9McShH+MjNvtDpL40J1cT+vBs= -cloud.google.com/go/security v1.15.4/go.mod h1:oN7C2uIZKhxCLiAAijKUCuHLZbIt/ghYEo8MqwD/Ty4= -cloud.google.com/go/securitycenter v1.13.0/go.mod h1:cv5qNAqjY84FCN6Y9z28WlkKXyWsgLO832YiWwkCWcU= -cloud.google.com/go/securitycenter v1.14.0/go.mod h1:gZLAhtyKv85n52XYWt6RmeBdydyxfPeTrpToDPw4Auc= -cloud.google.com/go/securitycenter v1.15.0/go.mod h1:PeKJ0t8MoFmmXLXWm41JidyzI3PJjd8sXWaVqg43WWk= -cloud.google.com/go/securitycenter v1.16.0/go.mod h1:Q9GMaLQFUD+5ZTabrbujNWLtSLZIZF7SAR0wWECrjdk= -cloud.google.com/go/securitycenter v1.18.1/go.mod h1:0/25gAzCM/9OL9vVx4ChPeM/+DlfGQJDwBy/UC8AKK0= -cloud.google.com/go/securitycenter v1.19.0/go.mod h1:LVLmSg8ZkkyaNy4u7HCIshAngSQ8EcIRREP3xBnyfag= -cloud.google.com/go/securitycenter v1.23.0/go.mod h1:8pwQ4n+Y9WCWM278R8W3nF65QtY172h4S8aXyI9/hsQ= -cloud.google.com/go/securitycenter v1.23.1/go.mod h1:w2HV3Mv/yKhbXKwOCu2i8bCuLtNP1IMHuiYQn4HJq5s= -cloud.google.com/go/securitycenter v1.24.1/go.mod h1:3h9IdjjHhVMXdQnmqzVnM7b0wMn/1O/U20eWVpMpZjI= -cloud.google.com/go/securitycenter v1.24.2/go.mod h1:l1XejOngggzqwr4Fa2Cn+iWZGf+aBLTXtB/vXjy5vXM= -cloud.google.com/go/servicecontrol v1.4.0/go.mod h1:o0hUSJ1TXJAmi/7fLJAedOovnujSEvjKCAFNXPQ1RaU= -cloud.google.com/go/servicecontrol v1.5.0/go.mod h1:qM0CnXHhyqKVuiZnGKrIurvVImCs8gmqWsDoqe9sU1s= -cloud.google.com/go/servicecontrol v1.10.0/go.mod h1:pQvyvSRh7YzUF2efw7H87V92mxU8FnFDawMClGCNuAA= -cloud.google.com/go/servicecontrol v1.11.0/go.mod h1:kFmTzYzTUIuZs0ycVqRHNaNhgR+UMUpw9n02l/pY+mc= -cloud.google.com/go/servicecontrol v1.11.1/go.mod h1:aSnNNlwEFBY+PWGQ2DoM0JJ/QUXqV5/ZD9DOLB7SnUk= -cloud.google.com/go/servicedirectory v1.4.0/go.mod h1:gH1MUaZCgtP7qQiI+F+A+OpeKF/HQWgtAddhTbhL2bs= -cloud.google.com/go/servicedirectory v1.5.0/go.mod h1:QMKFL0NUySbpZJ1UZs3oFAmdvVxhhxB6eJ/Vlp73dfg= -cloud.google.com/go/servicedirectory v1.6.0/go.mod h1:pUlbnWsLH9c13yGkxCmfumWEPjsRs1RlmJ4pqiNjVL4= -cloud.google.com/go/servicedirectory v1.7.0/go.mod h1:5p/U5oyvgYGYejufvxhgwjL8UVXjkuw7q5XcG10wx1U= -cloud.google.com/go/servicedirectory v1.8.0/go.mod h1:srXodfhY1GFIPvltunswqXpVxFPpZjf8nkKQT7XcXaY= -cloud.google.com/go/servicedirectory v1.9.0/go.mod h1:29je5JjiygNYlmsGz8k6o+OZ8vd4f//bQLtvzkPPT/s= -cloud.google.com/go/servicedirectory v1.10.1/go.mod h1:Xv0YVH8s4pVOwfM/1eMTl0XJ6bzIOSLDt8f8eLaGOxQ= -cloud.google.com/go/servicedirectory v1.11.0/go.mod h1:Xv0YVH8s4pVOwfM/1eMTl0XJ6bzIOSLDt8f8eLaGOxQ= -cloud.google.com/go/servicedirectory v1.11.1/go.mod h1:tJywXimEWzNzw9FvtNjsQxxJ3/41jseeILgwU/QLrGI= -cloud.google.com/go/servicedirectory v1.11.2/go.mod h1:KD9hCLhncWRV5jJphwIpugKwM5bn1x0GyVVD4NO8mGg= -cloud.google.com/go/servicedirectory v1.11.3/go.mod h1:LV+cHkomRLr67YoQy3Xq2tUXBGOs5z5bPofdq7qtiAw= -cloud.google.com/go/servicemanagement v1.4.0/go.mod h1:d8t8MDbezI7Z2R1O/wu8oTggo3BI2GKYbdG4y/SJTco= -cloud.google.com/go/servicemanagement v1.5.0/go.mod h1:XGaCRe57kfqu4+lRxaFEAuqmjzF0r+gWHjWqKqBvKFo= -cloud.google.com/go/servicemanagement v1.6.0/go.mod h1:aWns7EeeCOtGEX4OvZUWCCJONRZeFKiptqKf1D0l/Jc= -cloud.google.com/go/servicemanagement v1.8.0/go.mod h1:MSS2TDlIEQD/fzsSGfCdJItQveu9NXnUniTrq/L8LK4= -cloud.google.com/go/serviceusage v1.3.0/go.mod h1:Hya1cozXM4SeSKTAgGXgj97GlqUvF5JaoXacR1JTP/E= -cloud.google.com/go/serviceusage v1.4.0/go.mod h1:SB4yxXSaYVuUBYUml6qklyONXNLt83U0Rb+CXyhjEeU= -cloud.google.com/go/serviceusage v1.5.0/go.mod h1:w8U1JvqUqwJNPEOTQjrMHkw3IaIFLoLsPLvsE3xueec= -cloud.google.com/go/serviceusage v1.6.0/go.mod h1:R5wwQcbOWsyuOfbP9tGdAnCAc6B9DRwPG1xtWMDeuPA= -cloud.google.com/go/shell v1.3.0/go.mod h1:VZ9HmRjZBsjLGXusm7K5Q5lzzByZmJHf1d0IWHEN5X4= -cloud.google.com/go/shell v1.4.0/go.mod h1:HDxPzZf3GkDdhExzD/gs8Grqk+dmYcEjGShZgYa9URw= -cloud.google.com/go/shell v1.6.0/go.mod h1:oHO8QACS90luWgxP3N9iZVuEiSF84zNyLytb+qE2f9A= -cloud.google.com/go/shell v1.7.1/go.mod h1:u1RaM+huXFaTojTbW4g9P5emOrrmLE69KrxqQahKn4g= -cloud.google.com/go/shell v1.7.2/go.mod h1:KqRPKwBV0UyLickMn0+BY1qIyE98kKyI216sH/TuHmc= -cloud.google.com/go/shell v1.7.3/go.mod h1:cTTEz/JdaBsQAeTQ3B6HHldZudFoYBOqjteev07FbIc= -cloud.google.com/go/shell v1.7.4/go.mod h1:yLeXB8eKLxw0dpEmXQ/FjriYrBijNsONpwnWsdPqlKM= -cloud.google.com/go/spanner v1.41.0/go.mod h1:MLYDBJR/dY4Wt7ZaMIQ7rXOTLjYrmxLE/5ve9vFfWos= -cloud.google.com/go/spanner v1.44.0/go.mod h1:G8XIgYdOK+Fbcpbs7p2fiprDw4CaZX63whnSMLVBxjk= -cloud.google.com/go/spanner v1.45.0/go.mod h1:FIws5LowYz8YAE1J8fOS7DJup8ff7xJeetWEo5REA2M= -cloud.google.com/go/spanner v1.47.0/go.mod h1:IXsJwVW2j4UKs0eYDqodab6HgGuA1bViSqW4uH9lfUI= -cloud.google.com/go/spanner v1.49.0/go.mod h1:eGj9mQGK8+hkgSVbHNQ06pQ4oS+cyc4tXXd6Dif1KoM= -cloud.google.com/go/spanner v1.50.0/go.mod h1:eGj9mQGK8+hkgSVbHNQ06pQ4oS+cyc4tXXd6Dif1KoM= -cloud.google.com/go/spanner v1.51.0/go.mod h1:c5KNo5LQ1X5tJwma9rSQZsXNBDNvj4/n8BVc3LNahq0= -cloud.google.com/go/speech v1.6.0/go.mod h1:79tcr4FHCimOp56lwC01xnt/WPJZc4v3gzyT7FoBkCM= -cloud.google.com/go/speech v1.7.0/go.mod h1:KptqL+BAQIhMsj1kOP2la5DSEEerPDuOP/2mmkhHhZQ= -cloud.google.com/go/speech v1.8.0/go.mod h1:9bYIl1/tjsAnMgKGHKmBZzXKEkGgtU+MpdDPTE9f7y0= -cloud.google.com/go/speech v1.9.0/go.mod h1:xQ0jTcmnRFFM2RfX/U+rk6FQNUF6DQlydUSyoooSpco= -cloud.google.com/go/speech v1.14.1/go.mod h1:gEosVRPJ9waG7zqqnsHpYTOoAS4KouMRLDFMekpJ0J0= -cloud.google.com/go/speech v1.15.0/go.mod h1:y6oH7GhqCaZANH7+Oe0BhgIogsNInLlz542tg3VqeYI= -cloud.google.com/go/speech v1.17.1/go.mod h1:8rVNzU43tQvxDaGvqOhpDqgkJTFowBpDvCJ14kGlJYo= -cloud.google.com/go/speech v1.19.0/go.mod h1:8rVNzU43tQvxDaGvqOhpDqgkJTFowBpDvCJ14kGlJYo= -cloud.google.com/go/speech v1.19.1/go.mod h1:WcuaWz/3hOlzPFOVo9DUsblMIHwxP589y6ZMtaG+iAA= -cloud.google.com/go/speech v1.19.2/go.mod h1:2OYFfj+Ch5LWjsaSINuCZsre/789zlcCI3SY4oAi2oI= -cloud.google.com/go/speech v1.20.1/go.mod h1:wwolycgONvfz2EDU8rKuHRW3+wc9ILPsAWoikBEWavY= -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/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= -cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= -cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= -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/storage v1.30.1/go.mod h1:NfxhC0UJE1aXSx7CIIbCf7y9HKT7BiccwkR7+P7gN8E= -cloud.google.com/go/storage v1.35.1/go.mod h1:M6M/3V/D3KpzMTJyPOR/HU6n2Si5QdaXYEsng2xgOs8= -cloud.google.com/go/storagetransfer v1.5.0/go.mod h1:dxNzUopWy7RQevYFHewchb29POFv3/AaBgnhqzqiK0w= -cloud.google.com/go/storagetransfer v1.6.0/go.mod h1:y77xm4CQV/ZhFZH75PLEXY0ROiS7Gh6pSKrM8dJyg6I= -cloud.google.com/go/storagetransfer v1.7.0/go.mod h1:8Giuj1QNb1kfLAiWM1bN6dHzfdlDAVC9rv9abHot2W4= -cloud.google.com/go/storagetransfer v1.8.0/go.mod h1:JpegsHHU1eXg7lMHkvf+KE5XDJ7EQu0GwNJbbVGanEw= -cloud.google.com/go/storagetransfer v1.10.0/go.mod h1:DM4sTlSmGiNczmV6iZyceIh2dbs+7z2Ayg6YAiQlYfA= -cloud.google.com/go/storagetransfer v1.10.1/go.mod h1:rS7Sy0BtPviWYTTJVWCSV4QrbBitgPeuK4/FKa4IdLs= -cloud.google.com/go/storagetransfer v1.10.2/go.mod h1:meIhYQup5rg9juQJdyppnA/WLQCOguxtk1pr3/vBWzA= -cloud.google.com/go/storagetransfer v1.10.3/go.mod h1:Up8LY2p6X68SZ+WToswpQbQHnJpOty/ACcMafuey8gc= -cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw= -cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g= -cloud.google.com/go/talent v1.3.0/go.mod h1:CmcxwJ/PKfRgd1pBjQgU6W3YBwiewmUzQYH5HHmSCmM= -cloud.google.com/go/talent v1.4.0/go.mod h1:ezFtAgVuRf8jRsvyE6EwmbTK5LKciD4KVnHuDEFmOOA= -cloud.google.com/go/talent v1.5.0/go.mod h1:G+ODMj9bsasAEJkQSzO2uHQWXHHXUomArjWQQYkqK6c= -cloud.google.com/go/talent v1.6.2/go.mod h1:CbGvmKCG61mkdjcqTcLOkb2ZN1SrQI8MDyma2l7VD24= -cloud.google.com/go/talent v1.6.3/go.mod h1:xoDO97Qd4AK43rGjJvyBHMskiEf3KulgYzcH6YWOVoo= -cloud.google.com/go/talent v1.6.4/go.mod h1:QsWvi5eKeh6gG2DlBkpMaFYZYrYUnIpo34f6/V5QykY= -cloud.google.com/go/talent v1.6.5/go.mod h1:Mf5cma696HmE+P2BWJ/ZwYqeJXEeU0UqjHFXVLadEDI= -cloud.google.com/go/texttospeech v1.4.0/go.mod h1:FX8HQHA6sEpJ7rCMSfXuzBcysDAuWusNNNvN9FELDd8= -cloud.google.com/go/texttospeech v1.5.0/go.mod h1:oKPLhR4n4ZdQqWKURdwxMy0uiTS1xU161C8W57Wkea4= -cloud.google.com/go/texttospeech v1.6.0/go.mod h1:YmwmFT8pj1aBblQOI3TfKmwibnsfvhIBzPXcW4EBovc= -cloud.google.com/go/texttospeech v1.7.1/go.mod h1:m7QfG5IXxeneGqTapXNxv2ItxP/FS0hCZBwXYqucgSk= -cloud.google.com/go/texttospeech v1.7.2/go.mod h1:VYPT6aTOEl3herQjFHYErTlSZJ4vB00Q2ZTmuVgluD4= -cloud.google.com/go/texttospeech v1.7.3/go.mod h1:Av/zpkcgWfXlDLRYob17lqMstGZ3GqlvJXqKMp2u8so= -cloud.google.com/go/texttospeech v1.7.4/go.mod h1:vgv0002WvR4liGuSd5BJbWy4nDn5Ozco0uJymY5+U74= -cloud.google.com/go/tpu v1.3.0/go.mod h1:aJIManG0o20tfDQlRIej44FcwGGl/cD0oiRyMKG19IQ= -cloud.google.com/go/tpu v1.4.0/go.mod h1:mjZaX8p0VBgllCzF6wcU2ovUXN9TONFLd7iz227X2Xg= -cloud.google.com/go/tpu v1.5.0/go.mod h1:8zVo1rYDFuW2l4yZVY0R0fb/v44xLh3llq7RuV61fPM= -cloud.google.com/go/tpu v1.6.1/go.mod h1:sOdcHVIgDEEOKuqUoi6Fq53MKHJAtOwtz0GuKsWSH3E= -cloud.google.com/go/tpu v1.6.2/go.mod h1:NXh3NDwt71TsPZdtGWgAG5ThDfGd32X1mJ2cMaRlVgU= -cloud.google.com/go/tpu v1.6.3/go.mod h1:lxiueqfVMlSToZY1151IaZqp89ELPSrk+3HIQ5HRkbY= -cloud.google.com/go/tpu v1.6.4/go.mod h1:NAm9q3Rq2wIlGnOhpYICNI7+bpBebMJbh0yyp3aNw1Y= -cloud.google.com/go/trace v1.3.0/go.mod h1:FFUE83d9Ca57C+K8rDl/Ih8LwOzWIV1krKgxg6N0G28= -cloud.google.com/go/trace v1.4.0/go.mod h1:UG0v8UBqzusp+z63o7FK74SdFE+AXpCLdFb1rshXG+Y= -cloud.google.com/go/trace v1.8.0/go.mod h1:zH7vcsbAhklH8hWFig58HvxcxyQbaIqMarMg9hn5ECA= -cloud.google.com/go/trace v1.9.0/go.mod h1:lOQqpE5IaWY0Ixg7/r2SjixMuc6lfTFeO4QGM4dQWOk= -cloud.google.com/go/trace v1.10.1/go.mod h1:gbtL94KE5AJLH3y+WVpfWILmqgc6dXcqgNXdOPAQTYk= -cloud.google.com/go/trace v1.10.2/go.mod h1:NPXemMi6MToRFcSxRl2uDnu/qAlAQ3oULUphcHGh1vA= -cloud.google.com/go/trace v1.10.3/go.mod h1:Ke1bgfc73RV3wUFml+uQp7EsDw4dGaETLxB7Iq/r4CY= -cloud.google.com/go/trace v1.10.4/go.mod h1:Nso99EDIK8Mj5/zmB+iGr9dosS/bzWCJ8wGmE6TXNWY= -cloud.google.com/go/translate v1.3.0/go.mod h1:gzMUwRjvOqj5i69y/LYLd8RrNQk+hOmIXTi9+nb3Djs= -cloud.google.com/go/translate v1.4.0/go.mod h1:06Dn/ppvLD6WvA5Rhdp029IX2Mi3Mn7fpMRLPvXT5Wg= -cloud.google.com/go/translate v1.5.0/go.mod h1:29YDSYveqqpA1CQFD7NQuP49xymq17RXNaUDdc0mNu0= -cloud.google.com/go/translate v1.6.0/go.mod h1:lMGRudH1pu7I3n3PETiOB2507gf3HnfLV8qlkHZEyos= -cloud.google.com/go/translate v1.7.0/go.mod h1:lMGRudH1pu7I3n3PETiOB2507gf3HnfLV8qlkHZEyos= -cloud.google.com/go/translate v1.8.1/go.mod h1:d1ZH5aaOA0CNhWeXeC8ujd4tdCFw8XoNWRljklu5RHs= -cloud.google.com/go/translate v1.8.2/go.mod h1:d1ZH5aaOA0CNhWeXeC8ujd4tdCFw8XoNWRljklu5RHs= -cloud.google.com/go/translate v1.9.0/go.mod h1:d1ZH5aaOA0CNhWeXeC8ujd4tdCFw8XoNWRljklu5RHs= -cloud.google.com/go/translate v1.9.1/go.mod h1:TWIgDZknq2+JD4iRcojgeDtqGEp154HN/uL6hMvylS8= -cloud.google.com/go/translate v1.9.2/go.mod h1:E3Tc6rUTsQkVrXW6avbUhKJSr7ZE3j7zNmqzXKHqRrY= -cloud.google.com/go/translate v1.9.3/go.mod h1:Kbq9RggWsbqZ9W5YpM94Q1Xv4dshw/gr/SHfsl5yCZ0= -cloud.google.com/go/video v1.8.0/go.mod h1:sTzKFc0bUSByE8Yoh8X0mn8bMymItVGPfTuUBUyRgxk= -cloud.google.com/go/video v1.9.0/go.mod h1:0RhNKFRF5v92f8dQt0yhaHrEuH95m068JYOvLZYnJSw= -cloud.google.com/go/video v1.12.0/go.mod h1:MLQew95eTuaNDEGriQdcYn0dTwf9oWiA4uYebxM5kdg= -cloud.google.com/go/video v1.13.0/go.mod h1:ulzkYlYgCp15N2AokzKjy7MQ9ejuynOJdf1tR5lGthk= -cloud.google.com/go/video v1.14.0/go.mod h1:SkgaXwT+lIIAKqWAJfktHT/RbgjSuY6DobxEp0C5yTQ= -cloud.google.com/go/video v1.15.0/go.mod h1:SkgaXwT+lIIAKqWAJfktHT/RbgjSuY6DobxEp0C5yTQ= -cloud.google.com/go/video v1.17.1/go.mod h1:9qmqPqw/Ib2tLqaeHgtakU+l5TcJxCJbhFXM7UJjVzU= -cloud.google.com/go/video v1.19.0/go.mod h1:9qmqPqw/Ib2tLqaeHgtakU+l5TcJxCJbhFXM7UJjVzU= -cloud.google.com/go/video v1.20.0/go.mod h1:U3G3FTnsvAGqglq9LxgqzOiBc/Nt8zis8S+850N2DUM= -cloud.google.com/go/video v1.20.1/go.mod h1:3gJS+iDprnj8SY6pe0SwLeC5BUW80NjhwX7INWEuWGU= -cloud.google.com/go/video v1.20.2/go.mod h1:lrixr5JeKNThsgfM9gqtwb6Okuqzfo4VrY2xynaViTA= -cloud.google.com/go/video v1.20.3/go.mod h1:TnH/mNZKVHeNtpamsSPygSR0iHtvrR/cW1/GDjN5+GU= -cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU= -cloud.google.com/go/videointelligence v1.7.0/go.mod h1:k8pI/1wAhjznARtVT9U1llUaFNPh7muw8QyOUpavru4= -cloud.google.com/go/videointelligence v1.8.0/go.mod h1:dIcCn4gVDdS7yte/w+koiXn5dWVplOZkE+xwG9FgK+M= -cloud.google.com/go/videointelligence v1.9.0/go.mod h1:29lVRMPDYHikk3v8EdPSaL8Ku+eMzDljjuvRs105XoU= -cloud.google.com/go/videointelligence v1.10.0/go.mod h1:LHZngX1liVtUhZvi2uNS0VQuOzNi2TkY1OakiuoUOjU= -cloud.google.com/go/videointelligence v1.11.1/go.mod h1:76xn/8InyQHarjTWsBR058SmlPCwQjgcvoW0aZykOvo= -cloud.google.com/go/videointelligence v1.11.2/go.mod h1:ocfIGYtIVmIcWk1DsSGOoDiXca4vaZQII1C85qtoplc= -cloud.google.com/go/videointelligence v1.11.3/go.mod h1:tf0NUaGTjU1iS2KEkGWvO5hRHeCkFK3nPo0/cOZhZAo= -cloud.google.com/go/videointelligence v1.11.4/go.mod h1:kPBMAYsTPFiQxMLmmjpcZUMklJp3nC9+ipJJtprccD8= -cloud.google.com/go/vision v1.2.0/go.mod h1:SmNwgObm5DpFBme2xpyOyasvBc1aPdjvMk2bBk0tKD0= -cloud.google.com/go/vision/v2 v2.2.0/go.mod h1:uCdV4PpN1S0jyCyq8sIM42v2Y6zOLkZs+4R9LrGYwFo= -cloud.google.com/go/vision/v2 v2.3.0/go.mod h1:UO61abBx9QRMFkNBbf1D8B1LXdS2cGiiCRx0vSpZoUo= -cloud.google.com/go/vision/v2 v2.4.0/go.mod h1:VtI579ll9RpVTrdKdkMzckdnwMyX2JILb+MhPqRbPsY= -cloud.google.com/go/vision/v2 v2.5.0/go.mod h1:MmaezXOOE+IWa+cS7OhRRLK2cNv1ZL98zhqFFZaaH2E= -cloud.google.com/go/vision/v2 v2.6.0/go.mod h1:158Hes0MvOS9Z/bDMSFpjwsUrZ5fPrdwuyyvKSGAGMY= -cloud.google.com/go/vision/v2 v2.7.0/go.mod h1:H89VysHy21avemp6xcf9b9JvZHVehWbET0uT/bcuY/0= -cloud.google.com/go/vision/v2 v2.7.2/go.mod h1:jKa8oSYBWhYiXarHPvP4USxYANYUEdEsQrloLjrSwJU= -cloud.google.com/go/vision/v2 v2.7.3/go.mod h1:V0IcLCY7W+hpMKXK1JYE0LV5llEqVmj+UJChjvA1WsM= -cloud.google.com/go/vision/v2 v2.7.4/go.mod h1:ynDKnsDN/0RtqkKxQZ2iatv3Dm9O+HfRb5djl7l4Vvw= -cloud.google.com/go/vision/v2 v2.7.5/go.mod h1:GcviprJLFfK9OLf0z8Gm6lQb6ZFUulvpZws+mm6yPLM= -cloud.google.com/go/vmmigration v1.2.0/go.mod h1:IRf0o7myyWFSmVR1ItrBSFLFD/rJkfDCUTO4vLlJvsE= -cloud.google.com/go/vmmigration v1.3.0/go.mod h1:oGJ6ZgGPQOFdjHuocGcLqX4lc98YQ7Ygq8YQwHh9A7g= -cloud.google.com/go/vmmigration v1.5.0/go.mod h1:E4YQ8q7/4W9gobHjQg4JJSgXXSgY21nA5r8swQV+Xxc= -cloud.google.com/go/vmmigration v1.6.0/go.mod h1:bopQ/g4z+8qXzichC7GW1w2MjbErL54rk3/C843CjfY= -cloud.google.com/go/vmmigration v1.7.1/go.mod h1:WD+5z7a/IpZ5bKK//YmT9E047AD+rjycCAvyMxGJbro= -cloud.google.com/go/vmmigration v1.7.2/go.mod h1:iA2hVj22sm2LLYXGPT1pB63mXHhrH1m/ruux9TwWLd8= -cloud.google.com/go/vmmigration v1.7.3/go.mod h1:ZCQC7cENwmSWlwyTrZcWivchn78YnFniEQYRWQ65tBo= -cloud.google.com/go/vmmigration v1.7.4/go.mod h1:yBXCmiLaB99hEl/G9ZooNx2GyzgsjKnw5fWcINRgD70= -cloud.google.com/go/vmwareengine v0.1.0/go.mod h1:RsdNEf/8UDvKllXhMz5J40XxDrNJNN4sagiox+OI208= -cloud.google.com/go/vmwareengine v0.2.2/go.mod h1:sKdctNJxb3KLZkE/6Oui94iw/xs9PRNC2wnNLXsHvH8= -cloud.google.com/go/vmwareengine v0.3.0/go.mod h1:wvoyMvNWdIzxMYSpH/R7y2h5h3WFkx6d+1TIsP39WGY= -cloud.google.com/go/vmwareengine v0.4.1/go.mod h1:Px64x+BvjPZwWuc4HdmVhoygcXqEkGHXoa7uyfTgSI0= -cloud.google.com/go/vmwareengine v1.0.0/go.mod h1:Px64x+BvjPZwWuc4HdmVhoygcXqEkGHXoa7uyfTgSI0= -cloud.google.com/go/vmwareengine v1.0.1/go.mod h1:aT3Xsm5sNx0QShk1Jc1B8OddrxAScYLwzVoaiXfdzzk= -cloud.google.com/go/vmwareengine v1.0.2/go.mod h1:xMSNjIk8/itYrz1JA8nV3Ajg4L4n3N+ugP8JKzk3OaA= -cloud.google.com/go/vmwareengine v1.0.3/go.mod h1:QSpdZ1stlbfKtyt6Iu19M6XRxjmXO+vb5a/R6Fvy2y4= -cloud.google.com/go/vpcaccess v1.4.0/go.mod h1:aQHVbTWDYUR1EbTApSVvMq1EnT57ppDmQzZ3imqIk4w= -cloud.google.com/go/vpcaccess v1.5.0/go.mod h1:drmg4HLk9NkZpGfCmZ3Tz0Bwnm2+DKqViEpeEpOq0m8= -cloud.google.com/go/vpcaccess v1.6.0/go.mod h1:wX2ILaNhe7TlVa4vC5xce1bCnqE3AeH27RV31lnmZes= -cloud.google.com/go/vpcaccess v1.7.1/go.mod h1:FogoD46/ZU+JUBX9D606X21EnxiszYi2tArQwLY4SXs= -cloud.google.com/go/vpcaccess v1.7.2/go.mod h1:mmg/MnRHv+3e8FJUjeSibVFvQF1cCy2MsFaFqxeY1HU= -cloud.google.com/go/vpcaccess v1.7.3/go.mod h1:YX4skyfW3NC8vI3Fk+EegJnlYFatA+dXK4o236EUCUc= -cloud.google.com/go/vpcaccess v1.7.4/go.mod h1:lA0KTvhtEOb/VOdnH/gwPuOzGgM+CWsmGu6bb4IoMKk= -cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xXZmFiHmGE= -cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= -cloud.google.com/go/webrisk v1.6.0/go.mod h1:65sW9V9rOosnc9ZY7A7jsy1zoHS5W9IAXv6dGqhMQMc= -cloud.google.com/go/webrisk v1.7.0/go.mod h1:mVMHgEYH0r337nmt1JyLthzMr6YxwN1aAIEc2fTcq7A= -cloud.google.com/go/webrisk v1.8.0/go.mod h1:oJPDuamzHXgUc+b8SiHRcVInZQuybnvEW72PqTc7sSg= -cloud.google.com/go/webrisk v1.9.1/go.mod h1:4GCmXKcOa2BZcZPn6DCEvE7HypmEJcJkr4mtM+sqYPc= -cloud.google.com/go/webrisk v1.9.2/go.mod h1:pY9kfDgAqxUpDBOrG4w8deLfhvJmejKB0qd/5uQIPBc= -cloud.google.com/go/webrisk v1.9.3/go.mod h1:RUYXe9X/wBDXhVilss7EDLW9ZNa06aowPuinUOPCXH8= -cloud.google.com/go/webrisk v1.9.4/go.mod h1:w7m4Ib4C+OseSr2GL66m0zMBywdrVNTDKsdEsfMl7X0= -cloud.google.com/go/websecurityscanner v1.3.0/go.mod h1:uImdKm2wyeXQevQJXeh8Uun/Ym1VqworNDlBXQevGMo= -cloud.google.com/go/websecurityscanner v1.4.0/go.mod h1:ebit/Fp0a+FWu5j4JOmJEV8S8CzdTkAS77oDsiSqYWQ= -cloud.google.com/go/websecurityscanner v1.5.0/go.mod h1:Y6xdCPy81yi0SQnDY1xdNTNpfY1oAgXUlcfN3B3eSng= -cloud.google.com/go/websecurityscanner v1.6.1/go.mod h1:Njgaw3rttgRHXzwCB8kgCYqv5/rGpFCsBOvPbYgszpg= -cloud.google.com/go/websecurityscanner v1.6.2/go.mod h1:7YgjuU5tun7Eg2kpKgGnDuEOXWIrh8x8lWrJT4zfmas= -cloud.google.com/go/websecurityscanner v1.6.3/go.mod h1:x9XANObUFR+83Cya3g/B9M/yoHVqzxPnFtgF8yYGAXw= -cloud.google.com/go/websecurityscanner v1.6.4/go.mod h1:mUiyMQ+dGpPPRkHgknIZeCzSHJ45+fY4F52nZFDHm2o= -cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= -cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= -cloud.google.com/go/workflows v1.8.0/go.mod h1:ysGhmEajwZxGn1OhGOGKsTXc5PyxOc0vfKf5Af+to4M= -cloud.google.com/go/workflows v1.9.0/go.mod h1:ZGkj1aFIOd9c8Gerkjjq7OW7I5+l6cSvT3ujaO/WwSA= -cloud.google.com/go/workflows v1.10.0/go.mod h1:fZ8LmRmZQWacon9UCX1r/g/DfAXx5VcPALq2CxzdePw= -cloud.google.com/go/workflows v1.11.1/go.mod h1:Z+t10G1wF7h8LgdY/EmRcQY8ptBD/nvofaL6FqlET6g= -cloud.google.com/go/workflows v1.12.0/go.mod h1:PYhSk2b6DhZ508tj8HXKaBh+OFe+xdl0dHF/tJdzPQM= -cloud.google.com/go/workflows v1.12.1/go.mod h1:5A95OhD/edtOhQd/O741NSfIMezNTbCwLM1P1tBRGHM= -cloud.google.com/go/workflows v1.12.2/go.mod h1:+OmBIgNqYJPVggnMo9nqmizW0qEXHhmnAzK/CnBqsHc= -cloud.google.com/go/workflows v1.12.3/go.mod h1:fmOUeeqEwPzIU81foMjTRQIdwQHADi/vEr1cx9R1m5g= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zumjgTw83q2ge/PI+yyw8= -git.sr.ht/~sbinet/gg v0.3.1/go.mod h1:KGYtlADtqsqANL9ueOFkWymvzUvLMQllU5Ixo+8v3pc= -github.com/AlekSi/gocov-xml v0.0.0-20190121064608-3a14fb1c4737 h1:JZHBkt0GhM+ARQykshqpI49yaWCHQbJonH3XpDTwMZQ= -github.com/AlekSi/gocov-xml v0.0.0-20190121064608-3a14fb1c4737/go.mod h1:w1KSuh2JgIL3nyRiZijboSUwbbxOrTzWwyWVFUHtXBQ= -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/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c/go.mod h1:X0CRv0ky0k6m906ixxpzmDRLvX58TFUKS2eePweuyxk= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= -github.com/ajstarks/deck v0.0.0-20200831202436-30c9fc6549a9/go.mod h1:JynElWSGnm/4RlzPXRlREEwqTHAN3T56Bv2ITsFT3gY= -github.com/ajstarks/deck/generate v0.0.0-20210309230005-c3f852c02e19/go.mod h1:T13YZdzov6OU0A1+RfKZiZN9ca6VeKdBdyDV+BY97Tk= -github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= -github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b/go.mod h1:1KcenG0jGWcpt8ov532z81sp/kMMUG485J2InIOyADM= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/apache/arrow/go/v10 v10.0.1/go.mod h1:YvhnlEePVnBS4+0z3fhPfUy7W1Ikj0Ih0vcRo/gZ1M0= -github.com/apache/arrow/go/v11 v11.0.0/go.mod h1:Eg5OsL5H+e299f7u5ssuXsuHQVEGC4xei5aX110hRiI= -github.com/apache/arrow/go/v12 v12.0.0/go.mod h1:d+tV/eHZZ7Dz7RPrFKtPK02tpr+c9/PEd/zm8mDS9Vg= -github.com/apache/thrift v0.16.0/go.mod h1:PHK3hniurgQaNMZYaCLEqXKsYK8upmhPbmdP2FXSqgU= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -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/axw/gocov v1.0.0 h1:YsqYR66hUmilVr23tu8USgnJIJvnwh3n7j5zRn7x4LU= -github.com/axw/gocov v1.0.0/go.mod h1:LvQpEYiwwIb2nYkXY2fDWhg9/AsYqkhmrCshjlUJECE= -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/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/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= -github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= -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/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw= -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/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chromedp/cdproto v0.0.0-20230802225258-3cf4e6d46a89/go.mod h1:GKljq0VrfU4D5yc+2qA6OVr8pmO/MBbPEWqWQ/oqGEs= -github.com/chromedp/chromedp v0.9.2/go.mod h1:LkSXJKONWTCHAfQasKFUZI+mxqS4tZqhmtGzzhLsnLs= -github.com/chromedp/sysutil v1.0.0/go.mod h1:kgWmDdq8fTzXYcKIBqIYvRRTnYb9aNS9moAV0xufSww= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38GC8= -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/udpa/go v0.0.0-20220112060539-c52dc94e7fbe/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-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-20230310173818-32f1caf87195/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20230428030218-4003588d1b74/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20231109132714-523115ebc101/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/AlekSi/gocov-xml v1.2.0 h1:TGx+qVSgBn655Ejv8b2mgPIGvIa8ZxGFSPXuWf0J3Vw= +github.com/AlekSi/gocov-xml v1.2.0/go.mod h1:g1dRVOCHjKkMtlPfW6BokJ/qxoeZ1uPNAK7A/ii3CUo= +github.com/axw/gocov v1.1.0/go.mod h1:H9G4tivgdN3pYSSVrTFBr6kGDCmAkgbJhtxFzAvgcdw= +github.com/axw/gocov v1.2.1 h1:bqtQDBC2tQWcPzTYIVxK0EDCfNRLwsk4NZ0+GB4hX8Q= +github.com/axw/gocov v1.2.1/go.mod h1:l11/vZBBKfQEE+42jF47myjDrRZHM+hR+XgGjI6FopU= 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/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/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -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.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= -github.com/envoyproxy/go-control-plane v0.10.3/go.mod h1:fJJn/j26vwOu972OllsvAgJJM//w9BV6Fxbg2LuVd34= -github.com/envoyproxy/go-control-plane v0.11.0/go.mod h1:VnHyVMpzcLvCFt9yUz1UnCwHLhwx1WguiVDV7pTG/tI= -github.com/envoyproxy/go-control-plane v0.11.1-0.20230524094728-9239064ad72f/go.mod h1:sfYdkwUW4BA3PbKjySwjJy+O4Pu0h62rlqCMHNk+K+Q= -github.com/envoyproxy/go-control-plane v0.11.1/go.mod h1:uhMcXKCQMEJHiAb0w+YGefQLaTEw+YhGluxZkrTmD0g= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -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.0/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss= -github.com/envoyproxy/protoc-gen-validate v0.10.1/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss= -github.com/envoyproxy/protoc-gen-validate v1.0.1/go.mod h1:0vj8bNkYbSTNS2PIyH87KZaeN4x9zpL9Qt8fQC7d+vs= -github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= -github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= -github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= -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/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-fonts/dejavu v0.1.0/go.mod h1:4Wt4I4OU2Nq9asgDCteaAaWZOV24E+0/Pwo0gppep4g= -github.com/go-fonts/latin-modern v0.2.0/go.mod h1:rQVLdDMK+mK1xscDwsqM5J8U2jrRa3T0ecnM9pNujks= -github.com/go-fonts/liberation v0.1.1/go.mod h1:K6qoJYypsmfVjWg8KOVDQhLc8UDgIK2HYqyqAO9z7GY= -github.com/go-fonts/liberation v0.2.0/go.mod h1:K6qoJYypsmfVjWg8KOVDQhLc8UDgIK2HYqyqAO9z7GY= -github.com/go-fonts/stix v0.1.0/go.mod h1:w/c1f0ldAUlJmLBvlbkvVXLAD+tAMqobIIQpmnUIzUY= -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-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-latex/latex v0.0.0-20210118124228-b3d85cf34e07/go.mod h1:CO1AlKB2CSIqUrmQPqA0gdRIlnLEY0gK5JGjh37zN5U= -github.com/go-latex/latex v0.0.0-20210823091927-c0d11ff05a81/go.mod h1:SX0U8uGpxhq9o2S/CELCSUxEWWAuoCUcVCQWv7G2OCk= -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-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4/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-pdf/fpdf v0.5.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M= -github.com/go-pdf/fpdf v0.6.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= -github.com/gobwas/httphead v0.1.0/go.mod h1:O/RXo79gxV8G+RqlR/otEwx4Q36zl9rqC5u12GKvMCM= -github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= -github.com/gobwas/ws v1.2.1/go.mod h1:hRKAFb8wOxFROYNsT1bqfWnhX+b5MFeJM9r2ZSwg/KY= -github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -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/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= -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.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.4/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/flatbuffers v2.0.8+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= -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.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-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-pkcs11 v0.2.0/go.mod h1:6eQoGcuNJpa7jnd5pMGdkSaQpNDYvPlXWMcjXXThLlY= -github.com/google/go-pkcs11 v0.2.1-0.20230907215043-c6f79328ddf9/go.mod h1:6eQoGcuNJpa7jnd5pMGdkSaQpNDYvPlXWMcjXXThLlY= -github.com/google/martian v2.1.0+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/martian/v3 v3.3.2/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-20210407192527-94a9f03dee38/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/pprof v0.0.0-20240130152714-0ed6a68c8d9e h1:E+3PBMCXn0ma79O7iCrne0iUpKtZ7rIcZvoz+jNtNtw= github.com/google/pprof v0.0.0-20240130152714-0ed6a68c8d9e/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/s2a-go v0.1.0/go.mod h1:OJpEgntRZo8ugHpF9hkoLJbS5dSI20XZeXJ9JVywLlM= -github.com/google/s2a-go v0.1.3/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= -github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= -github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= -github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= -github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg= -github.com/googleapis/enterprise-certificate-proxy v0.2.1/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= -github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= -github.com/googleapis/enterprise-certificate-proxy v0.2.4/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= -github.com/googleapis/enterprise-certificate-proxy v0.2.5/go.mod h1:RxW0N9901Cko1VOCW3SXCpWP+mlIEkk2tP7jnHy9a3w= -github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= -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/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM= -github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99EXz9pXxye9YM= -github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= -github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo= -github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= -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.8.0/go.mod h1:4orTrqY6hXxxaUL4LHIPl6lGo8vAE38/qKbhSAKP6QI= -github.com/googleapis/gax-go/v2 v2.10.0/go.mod h1:4UOEnMCrxsSqQ940WnTiD6qJ63le2ev3xfyagutxiPw= -github.com/googleapis/gax-go/v2 v2.11.0/go.mod h1:DxmR61SGKkGLa2xigwuZIQpkCI2S5iydzRfb3peWZJI= -github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= -github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= -github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= -github.com/googleapis/google-cloud-go-testing v0.0.0-20210719221736-1c9a4c676720/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -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-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3/go.mod h1:o//XUCC/F+yRGJoPO/VU0GSB0f8Nhgmxx0VIRUvaC0w= -github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= -github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= -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-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 v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -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.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/hyperledger/fabric-lib-go v1.1.0 h1:iVjRr0oxqNn2P0SH2UCiOdLak56kqn/YJ6A/wnxNNaU= -github.com/hyperledger/fabric-lib-go v1.1.0/go.mod h1:SHNCq8AB0VpHAmvJEtdbzabv6NNV1F48JdmDihasBjc= -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/ianlancetaylor/demangle v0.0.0-20230524184225-eabc099b10ab/go.mod h1:gx7rwoVhcfuVKG5uya9Hs3Sxj7EIvldVofAWIUtGouw= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -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/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/jung-kurt/gofpdf v1.0.0/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= -github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= -github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/asmfmt v1.3.2/go.mod h1:AG8TuvYojzulgDAMCnYn50l/5QV3Bs/tp6j0HLHbNSE= -github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= -github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/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.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/ledongthuc/pdf v0.0.0-20220302134840-0c2507a12d80/go.mod h1:imJHygn/1yfhB7XSJJKlFZKl/J+dCPAknuiaGOshXAs= -github.com/lyft/protoc-gen-star v0.6.0/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA= -github.com/lyft/protoc-gen-star v0.6.1/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA= -github.com/lyft/protoc-gen-star/v2 v2.0.1/go.mod h1:RcCdONR2ScXaYnQC5tUzxzlpA3WVYF7/opLeUgcQs/o= -github.com/lyft/protoc-gen-star/v2 v2.0.3/go.mod h1:amey7yeodaJhXSbf/TlLvWiqQfLOSpEk//mLlc+axEk= -github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-sqlite3 v1.14.14/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= -github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/miekg/pkcs11 v1.1.1/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= -github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8/go.mod h1:mC1jAcsrzbxHt8iiaC+zU4b1ylILSosueou12R++wfY= -github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3/go.mod h1:RagcQ7I8IeTMnF8JTXieKnO4Z6JCsikNEzj0DwauVzE= -github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= -github.com/mitchellh/go-homedir v1.0.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.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= -github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= -github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= -github.com/onsi/ginkgo/v2 v2.1.4/go.mod h1:um6tUpWM/cxCK3/FK8BXqEiUMUwRgSM4JXG47RKZmLU= -github.com/onsi/ginkgo/v2 v2.1.6/go.mod h1:MEH45j8TBi6u9BMogfbp0stKC5cdGjumZj5Y7AG4VIk= -github.com/onsi/ginkgo/v2 v2.3.0/go.mod h1:Eew0uilEqZmIEZr8JrvYlvOM7Rr6xzTmMV8AyFNU9d0= -github.com/onsi/ginkgo/v2 v2.4.0/go.mod h1:iHkDK1fKGcBoEHT5W7YBq4RFWaQulw+caOMkAt4OrFo= -github.com/onsi/ginkgo/v2 v2.5.0/go.mod h1:Luc4sArBICYCS8THh8v3i3i5CuSZO+RaQRaJoeNwomw= -github.com/onsi/ginkgo/v2 v2.7.0/go.mod h1:yjiuMwPokqY1XauOgju45q3sJt6VzQ/Fict1LFVcsAo= -github.com/onsi/ginkgo/v2 v2.8.1/go.mod h1:N1/NbDngAFcSLdyZ+/aYTYGSlq9qMCS/cNKGJjy+csc= -github.com/onsi/ginkgo/v2 v2.9.0/go.mod h1:4xkjoL/tZv4SMWeww56BU5kAt19mVB47gTWxmrTcxyk= -github.com/onsi/ginkgo/v2 v2.9.1/go.mod h1:FEcmzVcCHl+4o9bQZVab+4dC9+j+91t2FHSzmGAPfuo= -github.com/onsi/ginkgo/v2 v2.9.2/go.mod h1:WHcJJG2dIlcCqVfBAwUCrJxSPFb6v4azBwgxeMeDuts= -github.com/onsi/ginkgo/v2 v2.9.5/go.mod h1:tvAoo1QUJwNEU2ITftXTpR7R1RbCzoZUOs3RonqW57k= -github.com/onsi/ginkgo/v2 v2.9.7/go.mod h1:cxrmXWykAwTwhQsJOPfdIDiJ+l2RYq7U8hFU+M/1uw0= -github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM= -github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= +github.com/hyperledger/fabric-lib-go v1.1.2 h1:3eHwudGZC5Ex7go5UAzVKhpF34gypPZGfSZksBKLWvE= +github.com/hyperledger/fabric-lib-go v1.1.2/go.mod h1:SHNCq8AB0VpHAmvJEtdbzabv6NNV1F48JdmDihasBjc= github.com/onsi/ginkgo/v2 v2.13.2 h1:Bi2gGVkfn6gQcjNjZJVO8Gf0FHzMPf2phUei9tejVMs= github.com/onsi/ginkgo/v2 v2.13.2/go.mod h1:XStQ8QcGwLyF4HdfcZB8SFOS/MWCgDuXMSBe6zrvLgM= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= -github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= -github.com/onsi/gomega v1.20.1/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= -github.com/onsi/gomega v1.21.1/go.mod h1:iYAIXgPSaDHak0LCMA+AWBpIKBr8WZicMxnE8luStNc= -github.com/onsi/gomega v1.22.1/go.mod h1:x6n7VNe4hw0vkyYUM4mjIXx3JbLiPaBPNgB7PRQ1tuM= -github.com/onsi/gomega v1.24.0/go.mod h1:Z/NWtiqwBrwUt4/2loMmHL63EDLnYHmVbuBpDr2vQAg= -github.com/onsi/gomega v1.24.1/go.mod h1:3AOiACssS3/MajrniINInwbfOOtfZvplPzuRSmvt1jM= -github.com/onsi/gomega v1.26.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM= -github.com/onsi/gomega v1.27.1/go.mod h1:aHX5xOykVYzWOV4WqQy0sy8BQptgukenXpCXfadcIAw= -github.com/onsi/gomega v1.27.3/go.mod h1:5vG284IBtfDAmDyrK+eGyZmUgUlmi+Wngqo557cZ6Gw= -github.com/onsi/gomega v1.27.4/go.mod h1:riYq/GJKh8hhoM01HN6Vmuy93AarCXCBGpvFDK3q3fQ= -github.com/onsi/gomega v1.27.6/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+qQlhg= -github.com/onsi/gomega v1.27.7/go.mod h1:1p8OOlwo2iUUDsHnOrjE5UKYJ+e3W8eQ3qSlRahPmr4= -github.com/onsi/gomega v1.27.8/go.mod h1:2J8vzI/s+2shY9XHRApDkdgPo1TKT7P2u6fXeJKFnNQ= -github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= -github.com/onsi/gomega v1.29.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= github.com/onsi/gomega v1.31.0 h1:54UJxxj6cPInHS3a35wm6BK/F9nHYueZ1NVujHDrnXE= github.com/onsi/gomega v1.31.0/go.mod h1:DW9aCi7U6Yi40wNVAvT6kzFnEVEI5n3DloYBiKiT6zk= -github.com/orisano/pixelmatch v0.0.0-20220722002657-fb0b55479cde/go.mod h1:nZgzbfBr3hhjoZnS66nKrHmduYNpc34ny7RK4z5/HM0= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/phpdave11/gofpdf v1.4.2/go.mod h1:zpO6xFn9yxo3YLyMvW8HcKWVdbNqgIfOOp2dXMnm1mY= -github.com/phpdave11/gofpdi v1.0.12/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= -github.com/phpdave11/gofpdi v1.0.13/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= -github.com/pierrec/lz4/v4 v4.1.15/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -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/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= -github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= -github.com/pkg/sftp v1.13.6/go.mod h1:tz1ryNURKu77RL+GuCzmoJYxQczL3wLNNpPWagdg4Qk= 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/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/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.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= -github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= -github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= -github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -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.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w= -github.com/ruudk/golang-pdf417 v0.0.0-20201230142125-a7e3863a1245/go.mod h1:pQAZKsJ8yyVxGRWYNEm9oFB8ieLgKFnamEyDmSA0BRk= -github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -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/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= -github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= -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.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= 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.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -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.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -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.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= 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/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/sykesm/zap-logfmt v0.0.4/go.mod h1:AuBd9xQjAe3URrWT1BBDk2v2onAZHkZkWRMiYZXiZWA= -github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -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.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0= -github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA= -go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -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.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= -go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.15.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= -go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= -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/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo= -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.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -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.12.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= -go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= -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-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -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-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/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-20211108221036-ceb1ce70b4fa/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.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= -golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= -golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= -golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= -golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= -golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= -golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/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-20191002040644-a1355ae1e2c3/go.mod h1:NOZ3BPKG0ec/BKJQgnvsSFpcKLM5xXVWnvZS97DWHgE= -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-20220827204233-334a2380cb91/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE= -golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= -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/image v0.0.0-20190910094157-69e4b8554b2a/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20200119044424-58c23975cae1/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20200430140353-33d19683fad8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20200618115811-c13761719519/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20201208152932-35266b937fa6/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20210216034530-4410531fe030/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20210607152325-775e3b0c77b9/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= -golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= -golang.org/x/image v0.0.0-20211028202545-6944b10bf410/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= -golang.org/x/image v0.0.0-20220302094943-723b81ca9867/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= -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 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug= -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/lint v0.0.0-20241112194109-818c5a804067 h1:adDmSQyFTCiv19j015EGKJBoaa7ElV0Q1Wovb/4G7NA= +golang.org/x/lint v0.0.0-20241112194109-818c5a804067/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= 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/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= -golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= -golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -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/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= -golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -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-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-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/mod v0.29.0 h1:HV8lRxZC4l2cr3Zq1LvtOsi/ThTgWnUk/y64QSs8GwA= +golang.org/x/mod v0.29.0/go.mod h1:NyhrlYXJ2H4eJiRy/WDBO6HMqZQ6q9nk4JzS3NuCK+w= 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-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= 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-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-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-20200520004742-59133d7f0dd7/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-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-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= -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/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20220617184016-355a448f1bc9/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= -golang.org/x/net v0.0.0-20221012135044-0b7e1fb9d458/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= -golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= -golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= -golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= -golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -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/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= -golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= -golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= -golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= -golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= -golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/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-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-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-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-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.0.0-20220608161450-d0670ef3b1eb/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= -golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= -golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= -golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= -golang.org/x/oauth2 v0.0.0-20221006150949-b44042a4b9c1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= -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/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4= -golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE= -golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI= -golang.org/x/oauth2 v0.11.0/go.mod h1:LdF7O/8bLR/qWK9DrpXmbHLTouvRHK0SgJl0GmDBchk= -golang.org/x/oauth2 v0.13.0/go.mod h1:/JMhi4ZRXAf4HG9LiNmxvk+45+96RUlVThiH8FzNBn0= -golang.org/x/oauth2 v0.14.0/go.mod h1:lAtNWgaWfL4cm7j2OV8TxGi9Qb7ECORx8DktCY74OwM= -golang.org/x/oauth2 v0.15.0/go.mod h1:q48ptWNTY5XWf+JNten23lcvHpLJ0ZSxF5ttTHKVCAM= -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/net v0.46.0 h1:giFlY12I07fugqwPuWJi68oOnpfqFnJIJzaIIm2JVV4= +golang.org/x/net v0.46.0/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210= 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-20220601150217-0de741cfad7f/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.0.0-20220819030929-7fc1605a5dde/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= -golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= -golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -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/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= +golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/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-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-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-20190904154756-749cb33beabd/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-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-20191228213918-04cbcbbfeed8/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-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-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-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-20200930185726-fdedc70b468f/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-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210304124612-50617c2ba197/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/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-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/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-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-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/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-20211210111614-af8b64212486/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-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/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-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/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-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.4.0/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.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -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.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= -golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= -golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= -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.9.0/go.mod h1:M6DEAAIenWoTxdKrOltXcmDY3rSplQUkrvaDU5FcQyo= -golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= -golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= -golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= -golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= -golang.org/x/term v0.14.0/go.mod h1:TySc+nGkYR6qt8km8wUhuFRTVSMIX3XPR58y2lC8vww= -golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= -golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ= +golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/telemetry v0.0.0-20251008203120-078029d740a8 h1:LvzTn0GQhWuvKH/kVRS3R3bVAsdQWI7hvfLHGgh9+lU= +golang.org/x/telemetry v0.0.0-20251008203120-078029d740a8/go.mod h1:Pi4ztBfryZoJEkyFTI5/Ocsu2jXyDr6iSdgJiYE/uwE= 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.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -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.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -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-20220922220347-f3bd1da661af/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.1.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.5.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-20180525024113-a5b4c53f6e8b/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-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/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-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/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k= +golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM= golang.org/x/tools v0.0.0-20190617190820-da514acc4774/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-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-20190927191325-030b2cf1153e/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-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-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-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-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-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -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-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78/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-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/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.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= -golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= -golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= -golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= -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/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4= -golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= -golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= -golang.org/x/tools v0.10.0/go.mod h1:UJwyiVBsOA2uwvK/e5OY3GTpDUJriEd+/YlqAwLPmyM= -golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM= -golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= -golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= -golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= -golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/tools v0.38.0 h1:Hx2Xv8hISq8Lm16jvBZ2VQf+RLmbd7wVUsALibYI/IQ= +golang.org/x/tools v0.38.0/go.mod h1:yEsQ/d/YK8cjh0L6rZlY8tgtlKiBNTL14pGDJPJpYQs= 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= -golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= -gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= -gonum.org/v1/gonum v0.9.3/go.mod h1:TZumC3NeyVQskjXqmyWt4S3bINhy7B4eYwW69EbyX+0= -gonum.org/v1/gonum v0.11.0/go.mod h1:fSG4YDCxxUZQJ7rKsQrj0gMOg00Il0Z96/qMA4bVQhA= -gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= -gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= -gonum.org/v1/plot v0.9.0/go.mod h1:3Pcqqmp6RHvJI72kgb8fThyUnav364FOsdDo2aGW5lY= -gonum.org/v1/plot v0.10.1/go.mod h1:VZW5OlhkL1mysU9vaqNHnsy86inf6Ot+jB3r+BczCEo= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -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.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.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.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.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= -google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= -google.golang.org/api v0.67.0/go.mod h1:ShHKP8E60yPsKNw/w8w+VYaj9H6buA5UqDp8dhbQZ6g= -google.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/SkfA= -google.golang.org/api v0.71.0/go.mod h1:4PyU6e6JogV1f9eA4voyrTY2batOLdgZ5qZ5HOCc4j8= -google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRRyDs= -google.golang.org/api v0.75.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= -google.golang.org/api v0.77.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= -google.golang.org/api v0.78.0/go.mod h1:1Sg78yoMLOhlQTeF+ARBoytAcH1NNyyl390YMy6rKmw= -google.golang.org/api v0.80.0/go.mod h1:xY3nI94gbvBrE0J6NHXhxOmW97HG7Khjkku6AFB3Hyg= -google.golang.org/api v0.84.0/go.mod h1:NTsGnUFJMYROtiquksZHBWtHfeMC7iYthki7Eq3pa8o= -google.golang.org/api v0.85.0/go.mod h1:AqZf8Ep9uZ2pyTvgL+x0D3Zt0eoT9b5E8fmzfu6FO2g= -google.golang.org/api v0.90.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw= -google.golang.org/api v0.93.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw= -google.golang.org/api v0.95.0/go.mod h1:eADj+UBuxkh5zlrSntJghuNeg8HwQ1w5lTKkuqaETEI= -google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= -google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= -google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= -google.golang.org/api v0.99.0/go.mod h1:1YOf74vkVndF7pG6hIHuINsM7eWwpVTAfNMNiL91A08= -google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= -google.golang.org/api v0.102.0/go.mod h1:3VFl6/fzoA+qNuS1N1/VfXY4LjoXN/wzeIp7TweWwGo= -google.golang.org/api v0.103.0/go.mod h1:hGtW6nK1AC+d9si/UBhw8Xli+QMOf6xyNAyJw4qU9w0= -google.golang.org/api v0.106.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/O9MY= -google.golang.org/api v0.107.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/O9MY= -google.golang.org/api v0.108.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.118.0/go.mod h1:76TtD3vkgmZ66zZzp72bUUklpmQmKlhh6sYtIjYK+5E= -google.golang.org/api v0.122.0/go.mod h1:gcitW0lvnyWjSp9nKxAbdHKIZ6vF4aajGueeslZOyms= -google.golang.org/api v0.124.0/go.mod h1:xu2HQurE5gi/3t1aFCvhPD781p0a3p11sdunTJ2BlP4= -google.golang.org/api v0.125.0/go.mod h1:mBwVAtz+87bEN6CbA1GtZPDOqY2R5ONPqJeIlvyo4Aw= -google.golang.org/api v0.126.0/go.mod h1:mBwVAtz+87bEN6CbA1GtZPDOqY2R5ONPqJeIlvyo4Aw= -google.golang.org/api v0.128.0/go.mod h1:Y611qgqaE92On/7g65MQgxYul3c0rEB894kniWLY750= -google.golang.org/api v0.139.0/go.mod h1:CVagp6Eekz9CjGZ718Z+sloknzkDJE7Vc1Ckj9+viBk= -google.golang.org/api v0.149.0/go.mod h1:Mwn1B7JTXrzXtnvmzQE2BD6bYZQ8DShKZDZbeN9I7qI= -google.golang.org/api v0.150.0/go.mod h1:ccy+MJ6nrYFgE3WgRx/AMXOxOmU8Q4hSa+jjibzhxcg= -google.golang.org/api v0.152.0/go.mod h1:3qNJX5eOmhiWYc67jRA/3GsDw97UFb5ivv7Y2PrriAY= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -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.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/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/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-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-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-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/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-20210329143202-679c6ae281ee/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-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-20211118181313-81c1377c94b1/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/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220207164111-0872dc986b00/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= -google.golang.org/genproto v0.0.0-20220329172620-7be39ac1afc7/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220413183235-5e96e2839df9/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220421151946-72621c1f0bd3/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220429170224-98d788798c3e/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= -google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= -google.golang.org/genproto v0.0.0-20220518221133-4f43b3371335/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= -google.golang.org/genproto v0.0.0-20220523171625-347a074981d8/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= -google.golang.org/genproto v0.0.0-20220608133413-ed9918b62aac/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220722212130-b98a9ff5e252/go.mod h1:GkXuJDJ6aQ7lnJcRF+SJVgFdQhypqgl3LB1C9vabdRE= -google.golang.org/genproto v0.0.0-20220801145646-83ce21fca29f/go.mod h1:iHe1svFLAZg9VWz891+QbRMwUv9O/1Ww+/mngYeThbc= -google.golang.org/genproto v0.0.0-20220815135757-37a418bb8959/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= -google.golang.org/genproto v0.0.0-20220817144833-d7fd3f11b9b1/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= -google.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= -google.golang.org/genproto v0.0.0-20220829144015-23454907ede3/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= -google.golang.org/genproto v0.0.0-20220829175752-36a9c930ecbf/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= -google.golang.org/genproto v0.0.0-20220913154956-18f8339a66a5/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= -google.golang.org/genproto v0.0.0-20220914142337-ca0e39ece12f/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= -google.golang.org/genproto v0.0.0-20220915135415-7fd63a7952de/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= -google.golang.org/genproto v0.0.0-20220916172020-2692e8806bfa/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= -google.golang.org/genproto v0.0.0-20220919141832-68c03719ef51/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= -google.golang.org/genproto v0.0.0-20220920201722-2b89144ce006/go.mod h1:ht8XFiar2npT/g4vkk7O0WYS1sHOHbdujxbEp7CJWbw= -google.golang.org/genproto v0.0.0-20220926165614-551eb538f295/go.mod h1:woMGP53BroOrRY3xTxlbr8Y3eB/nzAvvFM83q7kG2OI= -google.golang.org/genproto v0.0.0-20220926220553-6981cbe3cfce/go.mod h1:woMGP53BroOrRY3xTxlbr8Y3eB/nzAvvFM83q7kG2OI= -google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqwhZAwq4wsRUaVG555sVgsNmIjRtO7t/JH29U= -google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= -google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= -google.golang.org/genproto v0.0.0-20221024153911-1573dae28c9c/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= -google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= -google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c/go.mod h1:CGI5F/G+E5bKwmfYo09AXuVN4dD894kIKUFmVbP2/Fo= -google.golang.org/genproto v0.0.0-20221109142239-94d6d90a7d66/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= -google.golang.org/genproto v0.0.0-20221114212237-e4508ebdbee1/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= -google.golang.org/genproto v0.0.0-20221117204609-8f9c96812029/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= -google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= -google.golang.org/genproto v0.0.0-20221201164419-0e50fba7f41c/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= -google.golang.org/genproto v0.0.0-20221201204527-e3fa12d562f3/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= -google.golang.org/genproto v0.0.0-20221202195650-67e5cbc046fd/go.mod h1:cTsE614GARnxrLsqKREzmNYJACSWWpAWdNMwnD7c2BE= -google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230112194545-e10362b5ecf9/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230113154510-dbe35b8444a5/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230123190316-2c411cf9d197/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230124163310-31e0e69b6fc2/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230125152338-dcaf20b6aeaa/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230127162408-596548ed4efa/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-20230216225411-c8e22ba71e44/go.mod h1:8B0gmkoRebU8ukX6HP+4wrVQUY1+6PkQ44BSyIlflHA= -google.golang.org/genproto v0.0.0-20230222225845-10f96fb3dbec/go.mod h1:3Dl5ZL0q0isWJt+FVcfpQyirqemEuLAK/iFvg1UP1Hw= -google.golang.org/genproto v0.0.0-20230223222841-637eb2293923/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-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= -google.golang.org/genproto v0.0.0-20230320184635-7606e756e683/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= -google.golang.org/genproto v0.0.0-20230323212658-478b75c54725/go.mod h1:UUQDJDOlWu4KYeJZffbWgBkS1YFobzKbLVfK69pe0Ak= -google.golang.org/genproto v0.0.0-20230330154414-c0448cd141ea/go.mod h1:UUQDJDOlWu4KYeJZffbWgBkS1YFobzKbLVfK69pe0Ak= -google.golang.org/genproto v0.0.0-20230331144136-dcfb400f0633/go.mod h1:UUQDJDOlWu4KYeJZffbWgBkS1YFobzKbLVfK69pe0Ak= -google.golang.org/genproto v0.0.0-20230403163135-c38d8f061ccd/go.mod h1:UUQDJDOlWu4KYeJZffbWgBkS1YFobzKbLVfK69pe0Ak= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= -google.golang.org/genproto v0.0.0-20230525234025-438c736192d0/go.mod h1:9ExIQyXL5hZrHzQceCwuSYwZZ5QZBazOcprJ5rgs3lY= -google.golang.org/genproto v0.0.0-20230526161137-0005af68ea54/go.mod h1:zqTuNwFlFRsw5zIts5VnzLQxSRqh+CGOTVMlYbY0Eyk= -google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e/go.mod h1:zqTuNwFlFRsw5zIts5VnzLQxSRqh+CGOTVMlYbY0Eyk= -google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:xZnkP7mREFX5MORlOPEzLMr+90PPZQ2QWzrVTWfAq64= -google.golang.org/genproto v0.0.0-20230629202037-9506855d4529/go.mod h1:xZnkP7mREFX5MORlOPEzLMr+90PPZQ2QWzrVTWfAq64= -google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130/go.mod h1:O9kGHb51iE/nOGvQaDUuadVYqovW56s5emA88lQnj6Y= -google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98/go.mod h1:S7mY02OqCJTD0E1OiQy1F72PWFB4bZJ87cAtLPYgDR0= -google.golang.org/genproto v0.0.0-20230726155614-23370e0ffb3e/go.mod h1:0ggbjUrZYpy1q+ANUS30SEoGZ53cdfwtbuG7Ptgy108= -google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5/go.mod h1:oH/ZOT02u4kWEp7oYBGYFFkCdKS/uYR9Z7+0/xuuFp8= -google.golang.org/genproto v0.0.0-20230821184602-ccc8af3d0e93/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= -google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= -google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= -google.golang.org/genproto v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:CCviP9RmpZ1mxVr8MUjCnSiY09IbAXZxhLE6EhHIdPU= -google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97/go.mod h1:t1VqOqqvce95G3hIDCT5FeO3YUc6Q4Oe24L/+rNMxRk= -google.golang.org/genproto v0.0.0-20231012201019-e917dd12ba7a/go.mod h1:EMfReVxb80Dq1hhioy0sOsY9jCE46YDgHlJ7fWVUWRE= -google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:CgAqfJo+Xmu0GwA0411Ht3OU3OntXwsGmrmjI8ioGXI= -google.golang.org/genproto v0.0.0-20231030173426-d783a09b4405/go.mod h1:3WDQMjmJk36UQhjQ89emUzb1mdaHcPeeAh4SCBKznB4= -google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:J7XzRzVy1+IPwWHZUzoD0IccYZIrXILAQpc+Qy9CMhY= -google.golang.org/genproto/googleapis/api v0.0.0-20230525234020-1aefcd67740a/go.mod h1:ts19tUU+Z0ZShN1y3aPyq2+O3d5FUNNgT6FtOzmrNn8= -google.golang.org/genproto/googleapis/api v0.0.0-20230525234035-dd9d682886f9/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/api v0.0.0-20230526203410-71b5a4ffd15e/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/api v0.0.0-20230706204954-ccb25ca9f130/go.mod h1:mPBs5jNgx2GuQGvFwUvVKqtn6HsUw9nP64BedgvqEsQ= -google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= -google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= -google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5/go.mod h1:5DZzOUPCLYL3mNkQ0ms0F3EuUNZ7py1Bqeq6sxzI7/Q= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= -google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= -google.golang.org/genproto/googleapis/api v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:RdyHbowztCGQySiCvQPgWQWgWhGnouTdCflKoDBt32U= -google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97/go.mod h1:iargEX0SFPm3xcfMI0d1domjg0ZF4Aa0p2awqyxhvF0= -google.golang.org/genproto/googleapis/api v0.0.0-20231012201019-e917dd12ba7a/go.mod h1:SUBoKXbI1Efip18FClrQVGjWcyd0QZd8KkvdP34t7ww= -google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:IBQ646DjkDkvUIsVq/cc03FUFQ9wbZu7yE396YcL870= -google.golang.org/genproto/googleapis/api v0.0.0-20231030173426-d783a09b4405/go.mod h1:oT32Z4o8Zv2xPQTg0pbVaPr0MPOH6f14RgXt7zfIpwg= -google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:0xJLfVdJqpAPl8tDg1ujOCGzx6LFLttXT5NhllGOXY4= -google.golang.org/genproto/googleapis/bytestream v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:ylj+BE99M198VPbBh6A8d9n3w8fChvyLK3wwBOjXBFA= -google.golang.org/genproto/googleapis/bytestream v0.0.0-20230807174057-1744710a1577/go.mod h1:NjCQG/D8JandXxM57PZbAJL1DCNL6EypA0vPPwfsc7c= -google.golang.org/genproto/googleapis/bytestream v0.0.0-20231030173426-d783a09b4405/go.mod h1:GRUCuLdzVqZte8+Dl/D4N25yLzcGqqWaYkeVOwulFqw= -google.golang.org/genproto/googleapis/bytestream v0.0.0-20231120223509-83a465c0220f/go.mod h1:iIgEblxoG4klcXsG0d9cpoxJ4xndv6+1FkDROCHhPRI= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234015-3fc162c6f38a/go.mod h1:xURIpW9ES5+/GZhnV6beoEtxQrnkRGIfP5VQG2tCBLc= -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/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230629202037-9506855d4529/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230706204954-ccb25ca9f130/go.mod h1:8mL13HKkDa+IuJ8yruA3ci0q+0vsUz4m//+ottjwS5o= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230731190214-cbb8c96f2d6d/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230803162519-f966b187b2e5/go.mod h1:zBEcrKX2ZOcEkHWxBPAIvYUWOKKMIhYcmNiUIu2ji3I= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230920183334-c177e329c48b/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:KSqppvjFjtoCI+KGd4PELB0qLNxdJHRGqRI09mB6pQA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231012201019-e917dd12ba7a/go.mod h1:4cYg8o5yUbm77w8ZX00LhMVNl/YVBFJRYWDc0uYWMs0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:swOH3j0KzcDDgGUWr+SNpyTen5YrXjS3eyPzFYKc6lc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405/go.mod h1:67X1fPuzjcrkymZzZV1vvkFeTn2Rvc6lYF9MYFGCcwE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:oQ5rr10WTTMvP4A36n8JpR1OrO1BEiV4f78CneXZxkA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f/go.mod h1:L9KNLi232K1/xB6f7AlSX692koaRnKaWSR0stBki0Yc= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0/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.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 v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= -google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= -google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= -google.golang.org/grpc v1.52.3/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= -google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= -google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= -google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= -google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= -google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= -google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= -google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= -google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= -google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= -google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= -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.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.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= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -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-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -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/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -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.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.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -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= -honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= -lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= -lukechampine.com/uint128 v1.2.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= -modernc.org/cc/v3 v3.36.0/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI= -modernc.org/cc/v3 v3.36.2/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI= -modernc.org/cc/v3 v3.36.3/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI= -modernc.org/cc/v3 v3.37.0/go.mod h1:vtL+3mdHx/wcj3iEGz84rQa8vEqR6XM84v5Lcvfph20= -modernc.org/cc/v3 v3.40.0/go.mod h1:/bTg4dnWkSXowUO6ssQKnOV0yMVxDYNIsIrzqTFDGH0= -modernc.org/ccgo/v3 v3.0.0-20220428102840-41399a37e894/go.mod h1:eI31LL8EwEBKPpNpA4bU1/i+sKOwOrQy8D87zWUcRZc= -modernc.org/ccgo/v3 v3.0.0-20220430103911-bc99d88307be/go.mod h1:bwdAnOoaIt8Ax9YdWGjxWsdkPcZyRPHqrOvJxaKAKGw= -modernc.org/ccgo/v3 v3.0.0-20220904174949-82d86e1b6d56/go.mod h1:YSXjPL62P2AMSxBphRHPn7IkzhVHqkvOnRKAKh+W6ZI= -modernc.org/ccgo/v3 v3.16.4/go.mod h1:tGtX0gE9Jn7hdZFeU88slbTh1UtCYKusWOoCJuvkWsQ= -modernc.org/ccgo/v3 v3.16.6/go.mod h1:tGtX0gE9Jn7hdZFeU88slbTh1UtCYKusWOoCJuvkWsQ= -modernc.org/ccgo/v3 v3.16.8/go.mod h1:zNjwkizS+fIFDrDjIAgBSCLkWbJuHF+ar3QRn+Z9aws= -modernc.org/ccgo/v3 v3.16.9/go.mod h1:zNMzC9A9xeNUepy6KuZBbugn3c0Mc9TeiJO4lgvkJDo= -modernc.org/ccgo/v3 v3.16.13-0.20221017192402-261537637ce8/go.mod h1:fUB3Vn0nVPReA+7IG7yZDfjv1TMWjhQP8gCxrFAtL5g= -modernc.org/ccgo/v3 v3.16.13/go.mod h1:2Quk+5YgpImhPjv2Qsob1DnZ/4som1lJTodubIcoUkY= -modernc.org/ccorpus v1.11.6/go.mod h1:2gEUTrWqdpH2pXsmTM1ZkjeSrUWDpjMu2T6m29L/ErQ= -modernc.org/httpfs v1.0.6/go.mod h1:7dosgurJGp0sPaRanU53W4xZYKh14wfzX420oZADeHM= -modernc.org/libc v0.0.0-20220428101251-2d5f3daf273b/go.mod h1:p7Mg4+koNjc8jkqwcoFBJx7tXkpj00G77X7A72jXPXA= -modernc.org/libc v1.16.0/go.mod h1:N4LD6DBE9cf+Dzf9buBlzVJndKr/iJHG97vGLHYnb5A= -modernc.org/libc v1.16.1/go.mod h1:JjJE0eu4yeK7tab2n4S1w8tlWd9MxXLRzheaRnAKymU= -modernc.org/libc v1.16.17/go.mod h1:hYIV5VZczAmGZAnG15Vdngn5HSF5cSkbvfz2B7GRuVU= -modernc.org/libc v1.16.19/go.mod h1:p7Mg4+koNjc8jkqwcoFBJx7tXkpj00G77X7A72jXPXA= -modernc.org/libc v1.17.0/go.mod h1:XsgLldpP4aWlPlsjqKRdHPqCxCjISdHfM/yeWC5GyW0= -modernc.org/libc v1.17.1/go.mod h1:FZ23b+8LjxZs7XtFMbSzL/EhPxNbfZbErxEHc7cbD9s= -modernc.org/libc v1.17.4/go.mod h1:WNg2ZH56rDEwdropAJeZPQkXmDwh+JCA1s/htl6r2fA= -modernc.org/libc v1.18.0/go.mod h1:vj6zehR5bfc98ipowQOM2nIDUZnVew/wNC/2tOGS+q0= -modernc.org/libc v1.20.3/go.mod h1:ZRfIaEkgrYgZDl6pa4W39HgN5G/yDW+NRmNKZBDFrk0= -modernc.org/libc v1.21.4/go.mod h1:przBsL5RDOZajTVslkugzLBj1evTue36jEomFQOoYuI= -modernc.org/libc v1.22.2/go.mod h1:uvQavJ1pZ0hIoC/jfqNoMLURIMhKzINIWypNM17puug= -modernc.org/mathutil v1.2.2/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/mathutil v1.4.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/mathutil v1.5.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/memory v1.1.1/go.mod h1:/0wo5ibyrQiaoUoH7f9D8dnglAmILJ5/cxZlRECf+Nw= -modernc.org/memory v1.2.0/go.mod h1:/0wo5ibyrQiaoUoH7f9D8dnglAmILJ5/cxZlRECf+Nw= -modernc.org/memory v1.2.1/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= -modernc.org/memory v1.3.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= -modernc.org/memory v1.4.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= -modernc.org/memory v1.5.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= -modernc.org/opt v0.1.1/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= -modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= -modernc.org/sqlite v1.18.1/go.mod h1:6ho+Gow7oX5V+OiOQ6Tr4xeqbx13UZ6t+Fw9IRUG4d4= -modernc.org/sqlite v1.18.2/go.mod h1:kvrTLEWgxUcHa2GfHBQtanR1H9ht3hTJNtKpzH9k1u0= -modernc.org/strutil v1.1.1/go.mod h1:DE+MQQ/hjKBZS2zNInV5hhcipt5rLPWkmpbGeW5mmdw= -modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw= -modernc.org/tcl v1.13.1/go.mod h1:XOLfOwzhkljL4itZkK6T72ckMgvj0BDsnKNdZVUOecw= -modernc.org/tcl v1.13.2/go.mod h1:7CLiGIPo1M8Rv1Mitpv5akc2+8fxUd2y2UzC/MfMzy0= -modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= -modernc.org/token v1.0.1/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= -modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= -modernc.org/z v1.5.1/go.mod h1:eWFB510QWW5Th9YGZT81s+LwvaAs3Q2yr4sP0rmLkv8= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/util/util_test.go b/util/util_test.go index 89060d165..73f4c2b8e 100644 --- a/util/util_test.go +++ b/util/util_test.go @@ -480,7 +480,7 @@ func TestECPrivateKey(t *testing.T) { _, err := GetECPrivateKey(getPEM(filepath.Join("testdata", "ec-key.pem"), t)) assert.NoError(t, err) - rsaKey, err := rsa.GenerateKey(rand.Reader, 256) + rsaKey, err := rsa.GenerateKey(rand.Reader, 2048) assert.NoError(t, err, "failed to create RSA key") encodedPK, err := x509.MarshalPKCS8PrivateKey(rsaKey) assert.NoError(t, err, "failed to marshal RSA private key") @@ -508,7 +508,7 @@ func TestRSAPrivateKey(t *testing.T) { _, err = GetRSAPrivateKey(getPEM(filepath.Join("testdata", "rsa-key.pem"), t)) assert.NoError(t, err) - rsaKey, err := rsa.GenerateKey(rand.Reader, 256) + rsaKey, err := rsa.GenerateKey(rand.Reader, 2048) assert.NoError(t, err, "failed to create RSA key") encodedPK, err := x509.MarshalPKCS8PrivateKey(rsaKey) assert.NoError(t, err, "failed to marshal RSA private key") diff --git a/vendor/github.com/IBM/idemix/bccsp/types/idemix.go b/vendor/github.com/IBM/idemix/bccsp/types/idemix.go index 9722bfe93..5fcdaedd3 100644 --- a/vendor/github.com/IBM/idemix/bccsp/types/idemix.go +++ b/vendor/github.com/IBM/idemix/bccsp/types/idemix.go @@ -156,16 +156,20 @@ type SignatureScheme interface { // msg: message signed; // attributes: as described above; // rhIndex: revocation handle index relative to attributes; + // eidIndex: index of the enrollment ID relative to attributes; + // skIndex: index of the secret key relative to attributes; // revocationPublicKey: revocation public key; // epoch: revocation epoch. - Verify(ipk IssuerPublicKey, signature, msg []byte, attributes []IdemixAttribute, rhIndex, eidIndex int, + // verType: type of verification. + // meta: additional verification metadata. + Verify(ipk IssuerPublicKey, signature, msg []byte, attributes []IdemixAttribute, rhIndex, eidIndex, skIndex int, revocationPublicKey *ecdsa.PublicKey, epoch int, verType VerificationType, meta *IdemixSignerMetadata) error // AuditNymEid permits the auditing of the nym eid generated by a signer - AuditNymEid(ipk IssuerPublicKey, eidIndex int, signature []byte, enrollmentID string, RNymEid *math.Zr, verType AuditVerificationType) error + AuditNymEid(ipk IssuerPublicKey, eidIndex, skIndex int, signature []byte, enrollmentID string, RNymEid *math.Zr, verType AuditVerificationType) error // AuditNymRh permits the auditing of the nym rh generated by a signer - AuditNymRh(ipk IssuerPublicKey, rhIndex int, signature []byte, revocationHandle string, RNymRh *math.Zr, verType AuditVerificationType) error + AuditNymRh(ipk IssuerPublicKey, rhIndex, skIndex int, signature []byte, revocationHandle string, RNymRh *math.Zr, verType AuditVerificationType) error } // NymSignatureScheme is a local interface to decouple from the idemix implementation @@ -175,7 +179,7 @@ type NymSignatureScheme interface { Sign(sk *math.Zr, Nym *math.G1, RNym *math.Zr, ipk IssuerPublicKey, digest []byte) ([]byte, error) // Verify verifies an idemix NymSignature - Verify(pk IssuerPublicKey, Nym *math.G1, signature, digest []byte) error + Verify(pk IssuerPublicKey, Nym *math.G1, signature, digest []byte, skIndex int) error } // SmartcardNymSignatureScheme is a local interface to decouple from the idemix implementation diff --git a/vendor/github.com/IBM/idemix/bccsp/types/idemixopts.go b/vendor/github.com/IBM/idemix/bccsp/types/idemixopts.go index fdaf2adca..cd93194b7 100644 --- a/vendor/github.com/IBM/idemix/bccsp/types/idemixopts.go +++ b/vendor/github.com/IBM/idemix/bccsp/types/idemixopts.go @@ -298,6 +298,8 @@ type IdemixSignerOpts struct { RhIndex int // EidIndex contains the index of the EID attrbiute EidIndex int + // SKIndex contains the index of the secret key + SKIndex int // CRI contains the credential revocation information CRI []byte // Epoch is the revocation epoch the signature should be produced against @@ -324,6 +326,7 @@ type EidNymAuditOpts struct { EidIndex int // Index of enrollment ID attribute in signature EnrollmentID string // Enrollment ID of identity RNymEid *math.Zr // Field element of randomness + SKIndex int // index of the secret key } func (o *EidNymAuditOpts) HashFunc() crypto.Hash { @@ -336,6 +339,7 @@ type RhNymAuditOpts struct { RhIndex int // Index of revocation handle attribute in signature RevocationHandle string // Revocation handle of identity RNymRh *math.Zr // Field element of randomness + SKIndex int // index of the secret key } func (o *RhNymAuditOpts) HashFunc() crypto.Hash { @@ -365,6 +369,8 @@ type IdemixNymSignerOpts struct { // data about the nym returned by the smartcard implementation NymG1 *math.G1 RNym *math.Zr + + SKIndex int // index of the secret key } // HashFunc returns an identifier for the hash function used to produce diff --git a/vendor/github.com/IBM/mathlib/driver/amcl/fp256bn.go b/vendor/github.com/IBM/mathlib/driver/amcl/fp256bn.go index 9a9d55d39..49266350b 100644 --- a/vendor/github.com/IBM/mathlib/driver/amcl/fp256bn.go +++ b/vendor/github.com/IBM/mathlib/driver/amcl/fp256bn.go @@ -166,6 +166,14 @@ func (p *Fp256bn) HashToG1WithDomain(data, domain []byte) driver.G1 { return &fp256bnG1{*FP256BN.Bls_hash(string(mac.Sum(nil)))} } +func (p *Fp256bn) HashToG2(data []byte) driver.G2 { + panic("HashToG2 is not available for this curve") +} + +func (p *Fp256bn) HashToG2WithDomain(data, domain []byte) driver.G2 { + panic("HashToG2WithDomain is not available for this curve") +} + /*********************************************************************/ type fp256bnG1 struct { @@ -227,7 +235,7 @@ func (b *fp256bnG1) String() string { } func (e *fp256bnG1) Neg() { - res := e.Mul(NewFp256bn().NewZrFromInt(-1)) + res := e.Mul(NewFp256bn().NewZrFromInt64(-1)) e.ECP = res.(*fp256bnG1).ECP } diff --git a/vendor/github.com/IBM/mathlib/driver/amcl/fp256bn_miracl.go b/vendor/github.com/IBM/mathlib/driver/amcl/fp256bn_miracl.go index 541bccd28..c17e9c9a3 100644 --- a/vendor/github.com/IBM/mathlib/driver/amcl/fp256bn_miracl.go +++ b/vendor/github.com/IBM/mathlib/driver/amcl/fp256bn_miracl.go @@ -168,6 +168,14 @@ func (p *Fp256Miraclbn) HashToG1WithDomain(data, domain []byte) driver.G1 { return &fp256bnMiraclG1{*bls_hash_to_point_miracl(data, domain)} } +func (p *Fp256Miraclbn) HashToG2(data []byte) driver.G2 { + panic("HashToG2 is not available for this curve") +} + +func (p *Fp256Miraclbn) HashToG2WithDomain(data, domain []byte) driver.G2 { + panic("HashToG2WithDomain is not available for this curve") +} + /*********************************************************************/ type fp256bnMiraclG1 struct { diff --git a/vendor/github.com/IBM/mathlib/driver/common/curve.go b/vendor/github.com/IBM/mathlib/driver/common/curve.go index 79cd10eeb..cb653332a 100644 --- a/vendor/github.com/IBM/mathlib/driver/common/curve.go +++ b/vendor/github.com/IBM/mathlib/driver/common/curve.go @@ -61,10 +61,14 @@ func (c *CurveBase) NewZrFromBytes(b []byte) driver.Zr { return res } -func (c *CurveBase) NewZrFromInt(i int64) driver.Zr { +func (c *CurveBase) NewZrFromInt64(i int64) driver.Zr { return &BaseZr{Int: *big.NewInt(i), Modulus: c.Modulus} } +func (c *CurveBase) NewZrFromUint64(i uint64) driver.Zr { + return &BaseZr{Int: *new(big.Int).SetUint64(i), Modulus: c.Modulus} +} + func (c *CurveBase) NewRandomZr(rng io.Reader) driver.Zr { bi, err := rand.Int(rng, &c.Modulus) if err != nil { diff --git a/vendor/github.com/IBM/mathlib/driver/gurvy/bls12-377.go b/vendor/github.com/IBM/mathlib/driver/gurvy/bls12-377.go index c305cc528..ec40aacfc 100644 --- a/vendor/github.com/IBM/mathlib/driver/gurvy/bls12-377.go +++ b/vendor/github.com/IBM/mathlib/driver/gurvy/bls12-377.go @@ -358,6 +358,15 @@ func (c *Bls12_377) HashToG1(data []byte) driver.G1 { return &bls12377G1{g1} } +func (c *Bls12_377) HashToG2(data []byte) driver.G2 { + g2, err := bls12377.HashToG2(data, []byte{}) + if err != nil { + panic(fmt.Sprintf("HashToG2 failed [%s]", err.Error())) + } + + return &bls12377G2{g2} +} + func (p *Bls12_377) HashToG1WithDomain(data, domain []byte) driver.G1 { g1, err := bls12377.HashToG1(data, domain) if err != nil { @@ -366,3 +375,12 @@ func (p *Bls12_377) HashToG1WithDomain(data, domain []byte) driver.G1 { return &bls12377G1{g1} } + +func (p *Bls12_377) HashToG2WithDomain(data, domain []byte) driver.G2 { + g2, err := bls12377.HashToG2(data, domain) + if err != nil { + panic(fmt.Sprintf("HashToG2 failed [%s]", err.Error())) + } + + return &bls12377G2{g2} +} diff --git a/vendor/github.com/IBM/mathlib/driver/gurvy/bls12-381.go b/vendor/github.com/IBM/mathlib/driver/gurvy/bls12-381.go index 48e49b477..6733f04b8 100644 --- a/vendor/github.com/IBM/mathlib/driver/gurvy/bls12-381.go +++ b/vendor/github.com/IBM/mathlib/driver/gurvy/bls12-381.go @@ -368,6 +368,15 @@ func (c *Bls12_381) HashToG1(data []byte) driver.G1 { return &bls12381G1{g1} } +func (c *Bls12_381) HashToG2(data []byte) driver.G2 { + g2, err := bls12381.HashToG2(data, []byte{}) + if err != nil { + panic(fmt.Sprintf("HashToG2 failed [%s]", err.Error())) + } + + return &bls12381G2{g2} +} + func (p *Bls12_381) HashToG1WithDomain(data, domain []byte) driver.G1 { g1, err := bls12381.HashToG1(data, domain) if err != nil { @@ -377,6 +386,15 @@ func (p *Bls12_381) HashToG1WithDomain(data, domain []byte) driver.G1 { return &bls12381G1{g1} } +func (p *Bls12_381) HashToG2WithDomain(data, domain []byte) driver.G2 { + g2, err := bls12381.HashToG2(data, domain) + if err != nil { + panic(fmt.Sprintf("HashToG2 failed [%s]", err.Error())) + } + + return &bls12381G2{g2} +} + func (c *Bls12_381BBS) HashToG1(data []byte) driver.G1 { hashFunc := func() hash.Hash { // We pass a null key so error is impossible here. @@ -392,6 +410,15 @@ func (c *Bls12_381BBS) HashToG1(data []byte) driver.G1 { return &bls12381G1{g1} } +func (c *Bls12_381BBS) HashToG2(data []byte) driver.G2 { + g2, err := bls12381.HashToG2(data, []byte{}) + if err != nil { + panic(fmt.Sprintf("HashToG2 failed [%s]", err.Error())) + } + + return &bls12381G2{g2} +} + func (p *Bls12_381BBS) HashToG1WithDomain(data, domain []byte) driver.G1 { hashFunc := func() hash.Hash { // We pass a null key so error is impossible here. @@ -406,3 +433,12 @@ func (p *Bls12_381BBS) HashToG1WithDomain(data, domain []byte) driver.G1 { return &bls12381G1{g1} } + +func (p *Bls12_381BBS) HashToG2WithDomain(data, domain []byte) driver.G2 { + g2, err := bls12381.HashToG2(data, domain) + if err != nil { + panic(fmt.Sprintf("HashToG2 failed [%s]", err.Error())) + } + + return &bls12381G2{g2} +} diff --git a/vendor/github.com/IBM/mathlib/driver/gurvy/bn254.go b/vendor/github.com/IBM/mathlib/driver/gurvy/bn254.go index a37c5b4cc..55c476bc7 100644 --- a/vendor/github.com/IBM/mathlib/driver/gurvy/bn254.go +++ b/vendor/github.com/IBM/mathlib/driver/gurvy/bn254.go @@ -361,6 +361,15 @@ func (c *Bn254) HashToG1(data []byte) driver.G1 { return &bn254G1{g1} } +func (c *Bn254) HashToG2(data []byte) driver.G2 { + g2, err := bn254.HashToG2(data, []byte{}) + if err != nil { + panic(fmt.Sprintf("HashToG2 failed [%s]", err.Error())) + } + + return &bn254G2{g2} +} + func (p *Bn254) HashToG1WithDomain(data, domain []byte) driver.G1 { g1, err := bn254.HashToG1(data, domain) if err != nil { @@ -369,3 +378,12 @@ func (p *Bn254) HashToG1WithDomain(data, domain []byte) driver.G1 { return &bn254G1{g1} } + +func (p *Bn254) HashToG2WithDomain(data, domain []byte) driver.G2 { + g2, err := bn254.HashToG2(data, domain) + if err != nil { + panic(fmt.Sprintf("HashToG2 failed [%s]", err.Error())) + } + + return &bn254G2{g2} +} diff --git a/vendor/github.com/IBM/mathlib/driver/gurvy/custom.go b/vendor/github.com/IBM/mathlib/driver/gurvy/custom.go index 713697f7f..e09fa8e55 100644 --- a/vendor/github.com/IBM/mathlib/driver/gurvy/custom.go +++ b/vendor/github.com/IBM/mathlib/driver/gurvy/custom.go @@ -15,6 +15,7 @@ import ( "github.com/IBM/mathlib/driver/kilic" bls12381 "github.com/consensys/gnark-crypto/ecc/bls12-381" "github.com/consensys/gnark-crypto/ecc/bls12-381/fp" + "github.com/consensys/gnark-crypto/ecc/bls12-381/hash_to_curve" "github.com/consensys/gnark-crypto/field/pool" ) @@ -26,9 +27,6 @@ type G1Affine struct { X, Y fp.Element } -//go:linkname g1Isogeny github.com/consensys/gnark-crypto/ecc/bls12-381.g1Isogeny -func g1Isogeny(p *G1Affine) - func toKilicElement(p *fp.Element) *kilic.Fe { return (*kilic.Fe)(unsafe.Pointer(p)) } @@ -175,9 +173,9 @@ func HashToG1GenericBESwu(msg, dst []byte, hashFunc func() hash.Hash) (bls12381. Q0 := G1Affine{*_xq0, *_yq0} Q1 := G1Affine{*_xq1, *_yq1} - //TODO (perf): Add in E' first, then apply isogeny - g1Isogeny(&Q0) - g1Isogeny(&Q1) + // TODO (perf): Add in E' first, then apply isogeny + hash_to_curve.G1Isogeny(&Q0.X, &Q0.Y) + hash_to_curve.G1Isogeny(&Q1.X, &Q1.Y) var _Q0, _Q1 bls12381.G1Jac _Q0.FromAffine(toGurvyAffine(&Q0)) diff --git a/vendor/github.com/IBM/mathlib/driver/kilic/bls12-381.go b/vendor/github.com/IBM/mathlib/driver/kilic/bls12-381.go index 60f5ea36f..b565e3fb5 100644 --- a/vendor/github.com/IBM/mathlib/driver/kilic/bls12-381.go +++ b/vendor/github.com/IBM/mathlib/driver/kilic/bls12-381.go @@ -391,6 +391,19 @@ func (c *Bls12_381) HashToG1(data []byte) driver.G1 { } } +func (c *Bls12_381) HashToG2(data []byte) driver.G2 { + g2 := bls12381.NewG2() + p, err := g2.HashToCurve(data, []byte{}) + if err != nil { + panic(fmt.Sprintf("HashToCurve failed [%s]", err.Error())) + } + + return &bls12_381G2{ + PointG2: *p, + G2: *g2, + } +} + func (c *Bls12_381) HashToG1WithDomain(data, domain []byte) driver.G1 { g1 := bls12381.NewG1() p, err := g1.HashToCurve(data, domain) @@ -404,6 +417,19 @@ func (c *Bls12_381) HashToG1WithDomain(data, domain []byte) driver.G1 { } } +func (c *Bls12_381) HashToG2WithDomain(data, domain []byte) driver.G2 { + g2 := bls12381.NewG2() + p, err := g2.HashToCurve(data, domain) + if err != nil { + panic(fmt.Sprintf("HashToCurve failed [%s]", err.Error())) + } + + return &bls12_381G2{ + PointG2: *p, + G2: *g2, + } +} + func (c *Bls12_381BBS) HashToG1(data []byte) driver.G1 { p, err := HashToG1GenericBESwu(data, []byte{}) if err != nil { @@ -416,6 +442,19 @@ func (c *Bls12_381BBS) HashToG1(data []byte) driver.G1 { } } +func (c *Bls12_381BBS) HashToG2(data []byte) driver.G2 { + g2 := bls12381.NewG2() + p, err := g2.HashToCurve(data, []byte{}) + if err != nil { + panic(fmt.Sprintf("HashToCurve failed [%s]", err.Error())) + } + + return &bls12_381G2{ + PointG2: *p, + G2: *g2, + } +} + func (c *Bls12_381BBS) HashToG1WithDomain(data, domain []byte) driver.G1 { p, err := HashToG1GenericBESwu(data, domain) if err != nil { @@ -427,3 +466,16 @@ func (c *Bls12_381BBS) HashToG1WithDomain(data, domain []byte) driver.G1 { G1: *bls12381.NewG1(), } } + +func (c *Bls12_381BBS) HashToG2WithDomain(data, domain []byte) driver.G2 { + g2 := bls12381.NewG2() + p, err := g2.HashToCurve(data, domain) + if err != nil { + panic(fmt.Sprintf("HashToCurve failed [%s]", err.Error())) + } + + return &bls12_381G2{ + PointG2: *p, + G2: *g2, + } +} diff --git a/vendor/github.com/IBM/mathlib/driver/math.go b/vendor/github.com/IBM/mathlib/driver/math.go index ce394379e..a7ccff57e 100644 --- a/vendor/github.com/IBM/mathlib/driver/math.go +++ b/vendor/github.com/IBM/mathlib/driver/math.go @@ -29,7 +29,8 @@ type Curve interface { NewG1() G1 NewG2() G2 NewZrFromBytes(b []byte) Zr - NewZrFromInt(i int64) Zr + NewZrFromInt64(i int64) Zr + NewZrFromUint64(i uint64) Zr NewG1FromBytes(b []byte) G1 NewG1FromCompressed(b []byte) G1 NewG2FromBytes(b []byte) G2 @@ -40,6 +41,8 @@ type Curve interface { HashToZr(data []byte) Zr HashToG1(data []byte) G1 HashToG1WithDomain(data, domain []byte) G1 + HashToG2(data []byte) G2 + HashToG2WithDomain(data, domain []byte) G2 NewRandomZr(rng io.Reader) Zr Rand() (io.Reader, error) } diff --git a/vendor/github.com/IBM/mathlib/math.go b/vendor/github.com/IBM/mathlib/math.go index 286be1b0b..94bbba866 100644 --- a/vendor/github.com/IBM/mathlib/math.go +++ b/vendor/github.com/IBM/mathlib/math.go @@ -177,6 +177,10 @@ type Zr struct { curveID CurveID } +func (z *Zr) CurveID() CurveID { + return z.curveID +} + func (z *Zr) Plus(a *Zr) *Zr { return &Zr{zr: z.zr.Plus(a.zr), curveID: z.curveID} } @@ -228,6 +232,15 @@ func (z *Zr) Neg() { var zerobytes = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} var onebytes = []byte{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255} +func (z *Zr) Uint() (uint64, error) { + b := z.Bytes() + if !bytes.Equal(zerobytes, b[:32-8]) && !bytes.Equal(onebytes, b[:32-8]) { + return 0, fmt.Errorf("out of range") + } + + return uint64(binary.BigEndian.Uint64(b[32-8:])), nil +} + func (z *Zr) Int() (int64, error) { b := z.Bytes() if !bytes.Equal(zerobytes, b[:32-8]) && !bytes.Equal(onebytes, b[:32-8]) { @@ -244,6 +257,10 @@ type G1 struct { curveID CurveID } +func (g *G1) CurveID() CurveID { + return g.curveID +} + func (g *G1) Clone(a *G1) { g.g1.Clone(a.g1) } @@ -299,6 +316,10 @@ type G2 struct { curveID CurveID } +func (g *G2) CurveID() CurveID { + return g.curveID +} + func (g *G2) Clone(a *G2) { g.g2.Clone(a.g2) } @@ -346,6 +367,10 @@ type Gt struct { curveID CurveID } +func (g *Gt) CurveID() CurveID { + return g.curveID +} + func (g *Gt) Equals(a *Gt) bool { return g.gt.Equals(a.gt) } @@ -464,7 +489,11 @@ func (c *Curve) NewGtFromBytes(b []byte) (p *Gt, err error) { } func (c *Curve) NewZrFromInt(i int64) *Zr { - return &Zr{zr: c.c.NewZrFromInt(i), curveID: c.curveID} + return &Zr{zr: c.c.NewZrFromInt64(i), curveID: c.curveID} +} + +func (c *Curve) NewZrFromUint64(i uint64) *Zr { + return &Zr{zr: c.c.NewZrFromUint64(i), curveID: c.curveID} } func (c *Curve) NewG2() *G2 { @@ -499,6 +528,14 @@ func (c *Curve) HashToG1WithDomain(data, domain []byte) *G1 { return &G1{g1: c.c.HashToG1WithDomain(data, domain), curveID: c.curveID} } +func (c *Curve) HashToG2(data []byte) *G2 { + return &G2{g2: c.c.HashToG2(data), curveID: c.curveID} +} + +func (c *Curve) HashToG2WithDomain(data, domain []byte) *G2 { + return &G2{g2: c.c.HashToG2WithDomain(data, domain), curveID: c.curveID} +} + func (c *Curve) ModSub(a, b, m *Zr) *Zr { return &Zr{zr: c.c.ModSub(a.zr, b.zr, m.zr), curveID: c.curveID} } diff --git a/vendor/github.com/bits-and-blooms/bitset/README.md b/vendor/github.com/bits-and-blooms/bitset/README.md index fe7bca65e..ac826cd9f 100644 --- a/vendor/github.com/bits-and-blooms/bitset/README.md +++ b/vendor/github.com/bits-and-blooms/bitset/README.md @@ -12,7 +12,7 @@ This library is part of the [awesome go collection](https://github.com/avelino/a * [beego](https://github.com/beego/beego) * [CubeFS](https://github.com/cubefs/cubefs) * [Amazon EKS Distro](https://github.com/aws/eks-distro) -* [sourcegraph](https://github.com/sourcegraph/sourcegraph) +* [sourcegraph](https://github.com/sourcegraph/sourcegraph-public-snapshot) * [torrent](https://github.com/anacrolix/torrent) @@ -25,7 +25,7 @@ It provides methods for setting, clearing, flipping, and testing individual inte But it also provides set intersection, union, difference, complement, and symmetric operations, as well as tests to check whether any, all, or no bits are set, and querying a bitset's current length and number of positive bits. -BitSets are expanded to the size of the largest set bit; the memory allocation is approximately Max bits, where Max is the largest set bit. BitSets are never shrunk. On creation, a hint can be given for the number of bits that will be used. +BitSets are expanded to the size of the largest set bit; the memory allocation is approximately Max bits, where Max is the largest set bit. BitSets are never shrunk automatically, but `Shrink` and `Compact` methods are available. On creation, a hint can be given for the number of bits that will be used. Many of the methods, including Set, Clear, and Flip, return a BitSet pointer, which allows for chaining. @@ -125,7 +125,7 @@ E.g., ## Memory Usage -The memory usage of a bitset using `N` bits is at least `N/8` bytes. The number of bits in a bitset is at least as large as one plus the greatest bit index you have accessed. Thus it is possible to run out of memory while using a bitset. If you have lots of bits, you might prefer compressed bitsets, like the [Roaring bitmaps](http://roaringbitmap.org) and its [Go implementation](https://github.com/RoaringBitmap/roaring). +The memory usage of a bitset using `N` bits is at least `N/8` bytes. The number of bits in a bitset is at least as large as one plus the greatest bit index you have accessed. Thus it is possible to run out of memory while using a bitset. If you have lots of bits, you might prefer compressed bitsets, like the [Roaring bitmaps](https://roaringbitmap.org) and its [Go implementation](https://github.com/RoaringBitmap/roaring). The `roaring` library allows you to go back and forth between compressed Roaring bitmaps and the conventional bitset instances: ```Go @@ -134,11 +134,11 @@ The `roaring` library allows you to go back and forth between compressed Roaring ``` -## Implementation Note +### Goroutine safety -Go 1.9 introduced a native `math/bits` library. We provide backward compatibility to Go 1.7, which might be removed. +In general, it's not safe to access the same BitSet using different goroutines--they are unsynchronized for performance. -It is possible that a later version will match the `math/bits` return signature for counts (which is `int`, rather than our library's `uint64`). If so, the version will be bumped. +Should you want to access a BitSet from more than one goroutine, you should provide synchronization. Typically this is done by using channels to pass the *BitSet around (in Go style; so there is only ever one owner), or by using `sync.Mutex` to serialize operations on BitSets. ## Installation diff --git a/vendor/github.com/bits-and-blooms/bitset/bitset.go b/vendor/github.com/bits-and-blooms/bitset/bitset.go index 9f38ed3a9..23958ef89 100644 --- a/vendor/github.com/bits-and-blooms/bitset/bitset.go +++ b/vendor/github.com/bits-and-blooms/bitset/bitset.go @@ -44,17 +44,21 @@ import ( "errors" "fmt" "io" + "math/bits" "strconv" ) // the wordSize of a bit set -const wordSize = uint(64) +const wordSize = 64 // the wordSize of a bit set in bytes const wordBytes = wordSize / 8 +// wordMask is wordSize-1, used for bit indexing in a word +const wordMask = wordSize - 1 + // log2WordSize is lg(wordSize) -const log2WordSize = uint(6) +const log2WordSize = 6 // allBits has every bit set const allBits uint64 = 0xffffffffffffffff @@ -68,9 +72,16 @@ var base64Encoding = base64.URLEncoding // Base64StdEncoding Marshal/Unmarshal BitSet with base64.StdEncoding(Default: base64.URLEncoding) func Base64StdEncoding() { base64Encoding = base64.StdEncoding } -// LittleEndian Marshal/Unmarshal Binary as Little Endian(Default: binary.BigEndian) +// LittleEndian sets Marshal/Unmarshal Binary as Little Endian (Default: binary.BigEndian) func LittleEndian() { binaryOrder = binary.LittleEndian } +// BigEndian sets Marshal/Unmarshal Binary as Big Endian (Default: binary.BigEndian) +func BigEndian() { binaryOrder = binary.BigEndian } + +// BinaryOrder returns the current binary order, see also LittleEndian() +// and BigEndian() to change the order. +func BinaryOrder() binary.ByteOrder { return binaryOrder } + // A BitSet is a set of bits. The zero value of a BitSet is an empty set of length 0. type BitSet struct { length uint @@ -99,36 +110,58 @@ func From(buf []uint64) *BitSet { return FromWithLength(uint(len(buf))*64, buf) } -// FromWithLength constructs from an array of words and length. -func FromWithLength(len uint, set []uint64) *BitSet { - return &BitSet{len, set} +// FromWithLength constructs from an array of words and length in bits. +// This function is for advanced users, most users should prefer +// the From function. +// As a user of FromWithLength, you are responsible for ensuring +// that the length is correct: your slice should have length at +// least (length+63)/64 in 64-bit words. +func FromWithLength(length uint, set []uint64) *BitSet { + if len(set) < wordsNeeded(length) { + panic("BitSet.FromWithLength: slice is too short") + } + return &BitSet{length, set} } -// Bytes returns the bitset as array of words +// Bytes returns the bitset as array of 64-bit words, giving direct access to the internal representation. +// It is not a copy, so changes to the returned slice will affect the bitset. +// It is meant for advanced users. +// +// Deprecated: Bytes is deprecated. Use [BitSet.Words] instead. func (b *BitSet) Bytes() []uint64 { return b.set } +// Words returns the bitset as array of 64-bit words, giving direct access to the internal representation. +// It is not a copy, so changes to the returned slice will affect the bitset. +// It is meant for advanced users. +func (b *BitSet) Words() []uint64 { + return b.set +} + // wordsNeeded calculates the number of words needed for i bits func wordsNeeded(i uint) int { - if i > (Cap() - wordSize + 1) { + if i > (Cap() - wordMask) { return int(Cap() >> log2WordSize) } - return int((i + (wordSize - 1)) >> log2WordSize) + return int((i + wordMask) >> log2WordSize) } // wordsNeededUnbound calculates the number of words needed for i bits, possibly exceeding the capacity. -// This function is useful if you know that the capacity cannot be exceeded (e.g., you have an existing bitmap). +// This function is useful if you know that the capacity cannot be exceeded (e.g., you have an existing BitSet). func wordsNeededUnbound(i uint) int { - return int((i + (wordSize - 1)) >> log2WordSize) + return (int(i) + wordMask) >> log2WordSize } // wordsIndex calculates the index of words in a `uint64` func wordsIndex(i uint) uint { - return i & (wordSize - 1) + return i & wordMask } -// New creates a new BitSet with a hint that length bits will be required +// New creates a new BitSet with a hint that length bits will be required. +// The memory usage is at least length/8 bytes. +// In case of allocation failure, the function will return a BitSet with zero +// capacity. func New(length uint) (bset *BitSet) { defer func() { if r := recover(); r != nil { @@ -147,13 +180,30 @@ func New(length uint) (bset *BitSet) { return bset } +// MustNew creates a new BitSet with the given length bits. +// It panics if length exceeds the possible capacity or by a lack of memory. +func MustNew(length uint) (bset *BitSet) { + if length >= Cap() { + panic("You are exceeding the capacity") + } + + return &BitSet{ + length, + make([]uint64, wordsNeeded(length)), // may panic on lack of memory + } +} + // Cap returns the total possible capacity, or number of bits +// that can be stored in the BitSet theoretically. Under 32-bit system, +// it is 4294967295 and under 64-bit system, it is 18446744073709551615. +// Note that this is further limited by the maximum allocation size in Go, +// and your available memory, as any Go data structure. func Cap() uint { return ^uint(0) } // Len returns the number of bits in the BitSet. -// Note the difference to method Count, see example. +// Note that it differ from Count function. func (b *BitSet) Len() uint { return b.length } @@ -184,12 +234,32 @@ func (b *BitSet) Test(i uint) bool { return b.set[i>>log2WordSize]&(1<> log2WordSize) + subWordIndex := wordsIndex(i) + + // The word that the index falls within, shifted so the index is at bit 0 + var firstWord, secondWord uint64 + if firstWordIndex < len(b.set) { + firstWord = b.set[firstWordIndex] >> subWordIndex + } + + // The next word, masked to only include the necessary bits and shifted to cover the + // top of the word + if (firstWordIndex + 1) < len(b.set) { + secondWord = b.set[firstWordIndex+1] << uint64(wordSize-subWordIndex) + } + + return firstWord | secondWord +} + // Set bit i to 1, the capacity of the bitset is automatically // increased accordingly. -// If i>= Cap(), this function will panic. // Warning: using a very large value for 'i' // may lead to a memory shortage and a panic: the caller is responsible // for providing sensible parameters in line with their memory capacity. +// The memory usage is at least slightly over i/8 bytes. func (b *BitSet) Set(i uint) *BitSet { if i >= b.length { // if we need more bits, make 'em b.extendSet(i) @@ -198,7 +268,7 @@ func (b *BitSet) Set(i uint) *BitSet { return b } -// Clear bit i to 0 +// Clear bit i to 0. This never cause a memory allocation. It is always safe. func (b *BitSet) Clear(i uint) *BitSet { if i >= b.length { return b @@ -208,7 +278,6 @@ func (b *BitSet) Clear(i uint) *BitSet { } // SetTo sets bit i to value. -// If i>= Cap(), this function will panic. // Warning: using a very large value for 'i' // may lead to a memory shortage and a panic: the caller is responsible // for providing sensible parameters in line with their memory capacity. @@ -220,7 +289,6 @@ func (b *BitSet) SetTo(i uint, value bool) *BitSet { } // Flip bit at i. -// If i>= Cap(), this function will panic. // Warning: using a very large value for 'i' // may lead to a memory shortage and a panic: the caller is responsible // for providing sensible parameters in line with their memory capacity. @@ -233,7 +301,6 @@ func (b *BitSet) Flip(i uint) *BitSet { } // FlipRange bit in [start, end). -// If end>= Cap(), this function will panic. // Warning: using a very large value for 'end' // may lead to a memory shortage and a panic: the caller is responsible // for providing sensible parameters in line with their memory capacity. @@ -241,23 +308,54 @@ func (b *BitSet) FlipRange(start, end uint) *BitSet { if start >= end { return b } + if end-1 >= b.length { // if we need more bits, make 'em b.extendSet(end - 1) } - var startWord uint = start >> log2WordSize - var endWord uint = end >> log2WordSize + + startWord := int(start >> log2WordSize) + endWord := int(end >> log2WordSize) + + // b.set[startWord] ^= ^(^uint64(0) << wordsIndex(start)) + // e.g: + // start = 71, + // startWord = 1 + // wordsIndex(start) = 71 % 64 = 7 + // (^uint64(0) << 7) = 0b111111....11110000000 + // + // mask = ^(^uint64(0) << 7) = 0b000000....00001111111 + // + // flips the first 7 bits in b.set[1] and + // in the range loop, the b.set[1] gets again flipped + // so the two expressions flip results in a flip + // in b.set[1] from [7,63] + // + // handle startWord special, get's reflipped in range loop b.set[startWord] ^= ^(^uint64(0) << wordsIndex(start)) - if endWord > 0 { - // bounds check elimination - data := b.set - _ = data[endWord-1] - for i := startWord; i < endWord; i++ { - data[i] = ^data[i] - } - } - if end&(wordSize-1) != 0 { - b.set[endWord] ^= ^uint64(0) >> wordsIndex(-end) + + for idx := range b.set[startWord:endWord] { + b.set[startWord+idx] = ^b.set[startWord+idx] + } + + // handle endWord special + // e.g. + // end = 135 + // endWord = 2 + // + // wordsIndex(-7) = 57 + // see the golang spec: + // "For unsigned integer values, the operations +, -, *, and << are computed + // modulo 2n, where n is the bit width of the unsigned integer's type." + // + // mask = ^uint64(0) >> 57 = 0b00000....0001111111 + // + // flips in b.set[2] from [0,7] + // + // is end at word boundary? + if idx := wordsIndex(-end); idx != 0 { + b.set[endWord] ^= ^uint64(0) >> wordsIndex(idx) } + return b } @@ -275,6 +373,7 @@ func (b *BitSet) FlipRange(start, end uint) *BitSet { // memory usage until the GC runs. Normally this should not be a problem, but if you // have an extremely large BitSet its important to understand that the old BitSet will // remain in memory until the GC frees it. +// If you are memory constrained, this function may cause a panic. func (b *BitSet) Shrink(lastbitindex uint) *BitSet { length := lastbitindex + 1 idx := wordsNeeded(length) @@ -294,6 +393,11 @@ func (b *BitSet) Shrink(lastbitindex uint) *BitSet { // Compact shrinks BitSet to so that we preserve all set bits, while minimizing // memory usage. Compact calls Shrink. +// A new slice is allocated to store the new bits, so you may see an increase in +// memory usage until the GC runs. Normally this should not be a problem, but if you +// have an extremely large BitSet its important to understand that the old BitSet will +// remain in memory until the GC frees it. +// If you are memory constrained, this function may cause a panic. func (b *BitSet) Compact() *BitSet { idx := len(b.set) - 1 for ; idx >= 0 && b.set[idx] == 0; idx-- { @@ -353,7 +457,8 @@ func (b *BitSet) InsertAt(idx uint) *BitSet { return b } -// String creates a string representation of the Bitmap +// String creates a string representation of the BitSet. It is only intended for +// human-readable output and not for serialization. func (b *BitSet) String() string { // follows code from https://github.com/RoaringBitmap/roaring var buffer bytes.Buffer @@ -415,6 +520,50 @@ func (b *BitSet) DeleteAt(i uint) *BitSet { return b } +// AppendTo appends all set bits to buf and returns the (maybe extended) buf. +// In case of allocation failure, the function will panic. +// +// See also [BitSet.AsSlice] and [BitSet.NextSetMany]. +func (b *BitSet) AppendTo(buf []uint) []uint { + // In theory, we could overflow uint, but in practice, we will not. + for idx, word := range b.set { + for word != 0 { + // In theory idx<= len(b.set) { return 0, false } - w := b.set[x] - w = w >> wordsIndex(i) - if w != 0 { - return i + trailingZeroes64(w), true + + // process first (partial) word + word := b.set[x] >> wordsIndex(i) + if word != 0 { + return i + uint(bits.TrailingZeros64(word)), true } + + // process the following full words until next bit is set + // x < len(b.set), no out-of-bounds panic in following slice expression x++ - // bounds check elimination in the loop - if x < 0 { - return 0, false - } - for x < len(b.set) { - if b.set[x] != 0 { - return uint(x)*wordSize + trailingZeroes64(b.set[x]), true + for idx, word := range b.set[x:] { + if word != 0 { + return uint((x+idx)<> log2WordSize) if x >= len(b.set) || capacity == 0 { - return 0, myanswer[:0] + return 0, result[:0] } - skip := wordsIndex(i) - word := b.set[x] >> skip - myanswer = myanswer[:capacity] - size := int(0) + + // process first (partial) word + word := b.set[x] >> wordsIndex(i) + + size := 0 for word != 0 { - r := trailingZeroes64(word) - t := word & ((^word) + 1) - myanswer[size] = r + i + result[size] = i + uint(bits.TrailingZeros64(word)) + size++ if size == capacity { - goto End + return result[size-1], result[:size] } - word = word ^ t + + // clear the rightmost set bit + word &= word - 1 } + + // process the following full words + // x < len(b.set), no out-of-bounds panic in following slice expression x++ for idx, word := range b.set[x:] { for word != 0 { - r := trailingZeroes64(word) - t := word & ((^word) + 1) - myanswer[size] = r + (uint(x+idx) << 6) + result[size] = uint((x+idx)< 0 { - return myanswer[size-1], myanswer[:size] + return result[size-1], result[:size] } - return 0, myanswer[:0] + return 0, result[:0] } // NextClear returns the next clear bit from the specified index, @@ -517,31 +676,89 @@ func (b *BitSet) NextClear(i uint) (uint, bool) { if x >= len(b.set) { return 0, false } - w := b.set[x] - w = w >> wordsIndex(i) - wA := allBits >> wordsIndex(i) - index := i + trailingZeroes64(^w) - if w != wA && index < b.length { + + // process first (maybe partial) word + word := b.set[x] + word = word >> wordsIndex(i) + wordAll := allBits >> wordsIndex(i) + + index := i + uint(bits.TrailingZeros64(^word)) + if word != wordAll && index < b.length { return index, true } + + // process the following full words until next bit is cleared + // x < len(b.set), no out-of-bounds panic in following slice expression x++ - // bounds check elimination in the loop - if x < 0 { - return 0, false - } - for x < len(b.set) { - if b.set[x] != allBits { - index = uint(x)*wordSize + trailingZeroes64(^b.set[x]) + for idx, word := range b.set[x:] { + if word != allBits { + index = uint((x+idx)*wordSize + bits.TrailingZeros64(^word)) if index < b.length { return index, true } } - x++ + } + + return 0, false +} + +// PreviousSet returns the previous set bit from the specified index, +// including possibly the current index +// along with an error code (true = valid, false = no bit found i.e. all bits are clear) +func (b *BitSet) PreviousSet(i uint) (uint, bool) { + x := int(i >> log2WordSize) + if x >= len(b.set) { + return 0, false + } + word := b.set[x] + + // Clear the bits above the index + word = word & ((1 << (wordsIndex(i) + 1)) - 1) + if word != 0 { + return uint(x<= 0; x-- { + word = b.set[x] + if word != 0 { + return uint(x<> log2WordSize) + if x >= len(b.set) { + return 0, false + } + word := b.set[x] + + // Flip all bits and find the highest one bit + word = ^word + + // Clear the bits above the index + word = word & ((1 << (wordsIndex(i) + 1)) - 1) + + if word != 0 { + return uint(x<= 0; x-- { + word = b.set[x] + word = ^word + if word != 0 { + return uint(x< length { end = length - buffer = buffer[:wordBytes*uint(end-i)] + buffer = buffer[:wordBytes*(end-i)] } chunk := data[i:end] if _, err := io.ReadFull(reader, buffer); err != nil { @@ -998,12 +1219,12 @@ func readUint64Array(reader io.Reader, data []uint64) error { func writeUint64Array(writer io.Writer, data []uint64) error { bufferSize := 128 - buffer := make([]byte, bufferSize*int(wordBytes)) + buffer := make([]byte, bufferSize*wordBytes) for i := 0; i < len(data); i += bufferSize { end := i + bufferSize if end > len(data) { end = len(data) - buffer = buffer[:wordBytes*uint(end-i)] + buffer = buffer[:wordBytes*(end-i)] } chunk := data[i:end] for i, x := range chunk { @@ -1020,6 +1241,15 @@ func writeUint64Array(writer io.Writer, data []uint64) error { // WriteTo writes a BitSet to a stream. The format is: // 1. uint64 length // 2. []uint64 set +// The length is the number of bits in the BitSet. +// +// The set is a slice of uint64s containing between length and length + 63 bits. +// It is interpreted as a big-endian array of uint64s by default (see BinaryOrder()) +// meaning that the first 8 bits are stored at byte index 7, the next 8 bits are stored +// at byte index 6... the bits 64 to 71 are stored at byte index 8, etc. +// If you change the binary order, you need to do so for both reading and writing. +// We recommend using the default binary order. +// // Upon success, the number of bytes written is returned. // // Performance: if this function is used to write to a disk or network @@ -1050,6 +1280,7 @@ func (b *BitSet) WriteTo(stream io.Writer) (int64, error) { // The format is: // 1. uint64 length // 2. []uint64 set +// See WriteTo for details. // Upon success, the number of bytes read is returned. // If the current BitSet is not large enough to hold the data, // it is extended. In case of error, the BitSet is either @@ -1101,6 +1332,7 @@ func (b *BitSet) ReadFrom(stream io.Reader) (int64, error) { } // MarshalBinary encodes a BitSet into a binary form and returns the result. +// Please see WriteTo for details. func (b *BitSet) MarshalBinary() ([]byte, error) { var buf bytes.Buffer _, err := b.WriteTo(&buf) @@ -1112,6 +1344,7 @@ func (b *BitSet) MarshalBinary() ([]byte, error) { } // UnmarshalBinary decodes the binary form generated by MarshalBinary. +// Please see WriteTo for details. func (b *BitSet) UnmarshalBinary(data []byte) error { buf := bytes.NewReader(data) _, err := b.ReadFrom(buf) @@ -1149,7 +1382,7 @@ func (b *BitSet) UnmarshalJSON(data []byte) error { return err } -// Rank returns the nunber of set bits up to and including the index +// Rank returns the number of set bits up to and including the index // that are set in the bitset. // See https://en.wikipedia.org/wiki/Ranking#Ranking_in_statistics func (b *BitSet) Rank(index uint) uint { @@ -1159,7 +1392,7 @@ func (b *BitSet) Rank(index uint) uint { leftover := (index + 1) & 63 answer := uint(popcntSlice(b.set[:(index+1)>>6])) if leftover != 0 { - answer += uint(popcount(b.set[(index+1)>>6] << (64 - leftover))) + answer += uint(bits.OnesCount64(b.set[(index+1)>>6] << (64 - leftover))) } return answer } @@ -1174,7 +1407,7 @@ func (b *BitSet) Rank(index uint) uint { func (b *BitSet) Select(index uint) uint { leftover := index for idx, word := range b.set { - w := uint(popcount(word)) + w := uint(bits.OnesCount64(word)) if w > leftover { return uint(idx)*64 + select64(word, leftover) } @@ -1182,3 +1415,327 @@ func (b *BitSet) Select(index uint) uint { } return b.length } + +// top detects the top bit set +func (b *BitSet) top() (uint, bool) { + panicIfNull(b) + + idx := len(b.set) - 1 + for ; idx >= 0 && b.set[idx] == 0; idx-- { + } + + // no set bits + if idx < 0 { + return 0, false + } + + return uint(idx*wordSize+bits.Len64(b.set[idx])) - 1, true +} + +// ShiftLeft shifts the bitset like << operation would do. +// +// Left shift may require bitset size extension. We try to avoid the +// unnecessary memory operations by detecting the leftmost set bit. +// The function will panic if shift causes excess of capacity. +func (b *BitSet) ShiftLeft(bits uint) { + panicIfNull(b) + + if bits == 0 { + return + } + + top, ok := b.top() + if !ok { + return + } + + // capacity check + if top+bits < bits { + panic("You are exceeding the capacity") + } + + // destination set + dst := b.set + + // not using extendSet() to avoid unneeded data copying + nsize := wordsNeeded(top + bits) + if len(b.set) < nsize { + dst = make([]uint64, nsize) + } + if top+bits >= b.length { + b.length = top + bits + 1 + } + + pad, idx := top%wordSize, top>>log2WordSize + shift, pages := bits%wordSize, bits>>log2WordSize + if bits%wordSize == 0 { // happy case: just add pages + copy(dst[pages:nsize], b.set) + } else { + if pad+shift >= wordSize { + dst[idx+pages+1] = b.set[idx] >> (wordSize - shift) + } + + for i := int(idx); i >= 0; i-- { + if i > 0 { + dst[i+int(pages)] = (b.set[i] << shift) | (b.set[i-1] >> (wordSize - shift)) + } else { + dst[i+int(pages)] = b.set[i] << shift + } + } + } + + // zeroing extra pages + for i := 0; i < int(pages); i++ { + dst[i] = 0 + } + + b.set = dst +} + +// ShiftRight shifts the bitset like >> operation would do. +func (b *BitSet) ShiftRight(bits uint) { + panicIfNull(b) + + if bits == 0 { + return + } + + top, ok := b.top() + if !ok { + return + } + + if bits >= top { + b.set = make([]uint64, wordsNeeded(b.length)) + return + } + + pad, idx := top%wordSize, top>>log2WordSize + shift, pages := bits%wordSize, bits>>log2WordSize + if bits%wordSize == 0 { // happy case: just clear pages + b.set = b.set[pages:] + b.length -= pages * wordSize + } else { + for i := 0; i <= int(idx-pages); i++ { + if i < int(idx-pages) { + b.set[i] = (b.set[i+int(pages)] >> shift) | (b.set[i+int(pages)+1] << (wordSize - shift)) + } else { + b.set[i] = b.set[i+int(pages)] >> shift + } + } + + if pad < shift { + b.set[int(idx-pages)] = 0 + } + } + + for i := int(idx-pages) + 1; i <= int(idx); i++ { + b.set[i] = 0 + } +} + +// OnesBetween returns the number of set bits in the range [from, to). +// The range is inclusive of 'from' and exclusive of 'to'. +// Returns 0 if from >= to. +func (b *BitSet) OnesBetween(from, to uint) uint { + panicIfNull(b) + + if from >= to { + return 0 + } + + // Calculate indices and masks for the starting and ending words + startWord := from >> log2WordSize // Divide by wordSize + endWord := to >> log2WordSize + startOffset := from & wordMask // Mod wordSize + endOffset := to & wordMask + + // Case 1: Bits lie within a single word + if startWord == endWord { + // Create mask for bits between from and to + mask := uint64((1<= startOffset + count = uint(bits.OnesCount64(b.set[startWord] & startMask)) + + // 2b: Count all bits in complete words between start and end + if endWord > startWord+1 { + count += uint(popcntSlice(b.set[startWord+1 : endWord])) + } + + // 2c: Count bits in last word (from start of word to endOffset) + if endOffset > 0 { + endMask := uint64(1<> log2WordSize + bitOffset := outPos & wordMask + + // Write extracted bits, handling word boundary crossing + dst.set[wordIdx] |= extracted << bitOffset + if bitOffset+bitsExtracted > wordSize { + dst.set[wordIdx+1] = extracted >> (wordSize - bitOffset) + } + + outPos += bitsExtracted + } +} + +// Deposit creates a new BitSet and deposits bits according to a mask. +// See DepositTo for details. +func (b *BitSet) Deposit(mask *BitSet) *BitSet { + dst := New(mask.length) + b.DepositTo(mask, dst) + return dst +} + +// DepositTo spreads bits from a compacted form in the BitSet into positions +// specified by mask in dst. This is the inverse operation of Extract. +// +// For example, if mask has bits set at positions 1,4,5, then DepositTo will +// take consecutive bits 0,1,2 from the source BitSet and place them into +// positions 1,4,5 in the destination BitSet. +func (b *BitSet) DepositTo(mask *BitSet, dst *BitSet) { + panicIfNull(b) + panicIfNull(mask) + panicIfNull(dst) + + if len(dst.set) == 0 || len(mask.set) == 0 || len(b.set) == 0 { + return + } + + inPos := uint(0) + length := len(mask.set) + if len(dst.set) < length { + length = len(dst.set) + } + + // Process each word + for i := 0; i < length; i++ { + if mask.set[i] == 0 { + continue // Skip words with no bits to deposit + } + + // Calculate source word index + wordIdx := inPos >> log2WordSize + if wordIdx >= uint(len(b.set)) { + break // No more source bits available + } + + // Get source bits, handling word boundary crossing + sourceBits := b.set[wordIdx] + bitOffset := inPos & wordMask + if wordIdx+1 < uint(len(b.set)) && bitOffset != 0 { + // Combine bits from current and next word + sourceBits = (sourceBits >> bitOffset) | + (b.set[wordIdx+1] << (wordSize - bitOffset)) + } else { + sourceBits >>= bitOffset + } + + // Deposit bits according to mask + dst.set[i] = (dst.set[i] &^ mask.set[i]) | pdep(sourceBits, mask.set[i]) + inPos += uint(bits.OnesCount64(mask.set[i])) + } +} + +//go:generate go run cmd/pextgen/main.go -pkg=bitset + +func pext(w, m uint64) (result uint64) { + var outPos uint + + // Process byte by byte + for i := 0; i < 8; i++ { + shift := i << 3 // i * 8 using bit shift + b := uint8(w >> shift) + mask := uint8(m >> shift) + + extracted := pextLUT[b][mask] + bits := popLUT[mask] + + result |= uint64(extracted) << outPos + outPos += uint(bits) + } + + return result +} + +func pdep(w, m uint64) (result uint64) { + var inPos uint + + // Process byte by byte + for i := 0; i < 8; i++ { + shift := i << 3 // i * 8 using bit shift + mask := uint8(m >> shift) + bits := popLUT[mask] + + // Get the bits we'll deposit from the source + b := uint8(w >> inPos) + + // Deposit them according to the mask for this byte + deposited := pdepLUT[b][mask] + + // Add to result + result |= uint64(deposited) << shift + inPos += uint(bits) + } + + return result +} diff --git a/vendor/github.com/bits-and-blooms/bitset/pext.gen.go b/vendor/github.com/bits-and-blooms/bitset/pext.gen.go new file mode 100644 index 000000000..94f01ae51 --- /dev/null +++ b/vendor/github.com/bits-and-blooms/bitset/pext.gen.go @@ -0,0 +1,8866 @@ +// Code generated by cmd/pextgen/main.go; DO NOT EDIT. +// +// To regenerate this file: +// go run cmd/pextgen/main.go + +package bitset + +// pextLUT contains pre-computed parallel bit extraction results +var pextLUT = [256][256]uint8{ + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 4, 8, 8, 16, 8, 16, 16, 32, 8, 16, 16, 32, 16, 32, 32, 64, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 4, 8, 8, 16, 8, 16, 16, 32, 8, 16, 16, 32, 16, 32, 32, 64, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 4, 9, 8, 17, 8, 17, 16, 33, 8, 17, 16, 33, 16, 33, 32, 65, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 4, 9, 8, 17, 8, 17, 16, 33, 8, 17, 16, 33, 16, 33, 32, 65, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 4, 8, 9, 18, 8, 16, 17, 34, 8, 16, 17, 34, 16, 32, 33, 66, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 4, 8, 9, 18, 8, 16, 17, 34, 8, 16, 17, 34, 16, 32, 33, 66, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 4, 9, 9, 19, 8, 17, 17, 35, 8, 17, 17, 35, 16, 33, 33, 67, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 4, 9, 9, 19, 8, 17, 17, 35, 8, 17, 17, 35, 16, 33, 33, 67, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 4, 8, 8, 16, 9, 18, 18, 36, 8, 16, 16, 32, 17, 34, 34, 68, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 4, 8, 8, 16, 9, 18, 18, 36, 8, 16, 16, 32, 17, 34, 34, 68, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 4, 9, 8, 17, 9, 19, 18, 37, 8, 17, 16, 33, 17, 35, 34, 69, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 4, 9, 8, 17, 9, 19, 18, 37, 8, 17, 16, 33, 17, 35, 34, 69, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 4, 8, 9, 18, 9, 18, 19, 38, 8, 16, 17, 34, 17, 34, 35, 70, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 4, 8, 9, 18, 9, 18, 19, 38, 8, 16, 17, 34, 17, 34, 35, 70, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 4, 9, 9, 19, 9, 19, 19, 39, 8, 17, 17, 35, 17, 35, 35, 71, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 4, 9, 9, 19, 9, 19, 19, 39, 8, 17, 17, 35, 17, 35, 35, 71, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 4, 8, 8, 16, 8, 16, 16, 32, 9, 18, 18, 36, 18, 36, 36, 72, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 4, 8, 8, 16, 8, 16, 16, 32, 9, 18, 18, 36, 18, 36, 36, 72, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 4, 9, 8, 17, 8, 17, 16, 33, 9, 19, 18, 37, 18, 37, 36, 73, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 4, 9, 8, 17, 8, 17, 16, 33, 9, 19, 18, 37, 18, 37, 36, 73, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 4, 8, 9, 18, 8, 16, 17, 34, 9, 18, 19, 38, 18, 36, 37, 74, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 4, 8, 9, 18, 8, 16, 17, 34, 9, 18, 19, 38, 18, 36, 37, 74, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 4, 9, 9, 19, 8, 17, 17, 35, 9, 19, 19, 39, 18, 37, 37, 75, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 4, 9, 9, 19, 8, 17, 17, 35, 9, 19, 19, 39, 18, 37, 37, 75, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 4, 8, 8, 16, 9, 18, 18, 36, 9, 18, 18, 36, 19, 38, 38, 76, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 4, 8, 8, 16, 9, 18, 18, 36, 9, 18, 18, 36, 19, 38, 38, 76, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 4, 9, 8, 17, 9, 19, 18, 37, 9, 19, 18, 37, 19, 39, 38, 77, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 4, 9, 8, 17, 9, 19, 18, 37, 9, 19, 18, 37, 19, 39, 38, 77, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 4, 8, 9, 18, 9, 18, 19, 38, 9, 18, 19, 38, 19, 38, 39, 78, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 4, 8, 9, 18, 9, 18, 19, 38, 9, 18, 19, 38, 19, 38, 39, 78, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 4, 9, 9, 19, 9, 19, 19, 39, 9, 19, 19, 39, 19, 39, 39, 79, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 4, 9, 9, 19, 9, 19, 19, 39, 9, 19, 19, 39, 19, 39, 39, 79, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 5, 10, 10, 20, 10, 20, 20, 40, 10, 20, 20, 40, 20, 40, 40, 80, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 5, 10, 10, 20, 10, 20, 20, 40, 10, 20, 20, 40, 20, 40, 40, 80, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 5, 11, 10, 21, 10, 21, 20, 41, 10, 21, 20, 41, 20, 41, 40, 81, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 5, 11, 10, 21, 10, 21, 20, 41, 10, 21, 20, 41, 20, 41, 40, 81, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 5, 10, 11, 22, 10, 20, 21, 42, 10, 20, 21, 42, 20, 40, 41, 82, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 5, 10, 11, 22, 10, 20, 21, 42, 10, 20, 21, 42, 20, 40, 41, 82, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 5, 11, 11, 23, 10, 21, 21, 43, 10, 21, 21, 43, 20, 41, 41, 83, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 5, 11, 11, 23, 10, 21, 21, 43, 10, 21, 21, 43, 20, 41, 41, 83, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 5, 10, 10, 20, 11, 22, 22, 44, 10, 20, 20, 40, 21, 42, 42, 84, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 5, 10, 10, 20, 11, 22, 22, 44, 10, 20, 20, 40, 21, 42, 42, 84, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 5, 11, 10, 21, 11, 23, 22, 45, 10, 21, 20, 41, 21, 43, 42, 85, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 5, 11, 10, 21, 11, 23, 22, 45, 10, 21, 20, 41, 21, 43, 42, 85, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 5, 10, 11, 22, 11, 22, 23, 46, 10, 20, 21, 42, 21, 42, 43, 86, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 5, 10, 11, 22, 11, 22, 23, 46, 10, 20, 21, 42, 21, 42, 43, 86, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 5, 11, 11, 23, 11, 23, 23, 47, 10, 21, 21, 43, 21, 43, 43, 87, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 5, 11, 11, 23, 11, 23, 23, 47, 10, 21, 21, 43, 21, 43, 43, 87, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 5, 10, 10, 20, 10, 20, 20, 40, 11, 22, 22, 44, 22, 44, 44, 88, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 5, 10, 10, 20, 10, 20, 20, 40, 11, 22, 22, 44, 22, 44, 44, 88, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 5, 11, 10, 21, 10, 21, 20, 41, 11, 23, 22, 45, 22, 45, 44, 89, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 5, 11, 10, 21, 10, 21, 20, 41, 11, 23, 22, 45, 22, 45, 44, 89, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 5, 10, 11, 22, 10, 20, 21, 42, 11, 22, 23, 46, 22, 44, 45, 90, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 5, 10, 11, 22, 10, 20, 21, 42, 11, 22, 23, 46, 22, 44, 45, 90, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 5, 11, 11, 23, 10, 21, 21, 43, 11, 23, 23, 47, 22, 45, 45, 91, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 5, 11, 11, 23, 10, 21, 21, 43, 11, 23, 23, 47, 22, 45, 45, 91, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 5, 10, 10, 20, 11, 22, 22, 44, 11, 22, 22, 44, 23, 46, 46, 92, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 5, 10, 10, 20, 11, 22, 22, 44, 11, 22, 22, 44, 23, 46, 46, 92, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 5, 11, 10, 21, 11, 23, 22, 45, 11, 23, 22, 45, 23, 47, 46, 93, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 5, 11, 10, 21, 11, 23, 22, 45, 11, 23, 22, 45, 23, 47, 46, 93, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 5, 10, 11, 22, 11, 22, 23, 46, 11, 22, 23, 46, 23, 46, 47, 94, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 5, 10, 11, 22, 11, 22, 23, 46, 11, 22, 23, 46, 23, 46, 47, 94, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 5, 11, 11, 23, 11, 23, 23, 47, 11, 23, 23, 47, 23, 47, 47, 95, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 5, 11, 11, 23, 11, 23, 23, 47, 11, 23, 23, 47, 23, 47, 47, 95, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 6, 12, 12, 24, 12, 24, 24, 48, 12, 24, 24, 48, 24, 48, 48, 96, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 6, 12, 12, 24, 12, 24, 24, 48, 12, 24, 24, 48, 24, 48, 48, 96, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 6, 13, 12, 25, 12, 25, 24, 49, 12, 25, 24, 49, 24, 49, 48, 97, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 6, 13, 12, 25, 12, 25, 24, 49, 12, 25, 24, 49, 24, 49, 48, 97, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 6, 12, 13, 26, 12, 24, 25, 50, 12, 24, 25, 50, 24, 48, 49, 98, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 6, 12, 13, 26, 12, 24, 25, 50, 12, 24, 25, 50, 24, 48, 49, 98, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 6, 13, 13, 27, 12, 25, 25, 51, 12, 25, 25, 51, 24, 49, 49, 99, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 6, 13, 13, 27, 12, 25, 25, 51, 12, 25, 25, 51, 24, 49, 49, 99, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 6, 12, 12, 24, 13, 26, 26, 52, 12, 24, 24, 48, 25, 50, 50, 100, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 6, 12, 12, 24, 13, 26, 26, 52, 12, 24, 24, 48, 25, 50, 50, 100, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 6, 13, 12, 25, 13, 27, 26, 53, 12, 25, 24, 49, 25, 51, 50, 101, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 6, 13, 12, 25, 13, 27, 26, 53, 12, 25, 24, 49, 25, 51, 50, 101, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 6, 12, 13, 26, 13, 26, 27, 54, 12, 24, 25, 50, 25, 50, 51, 102, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 6, 12, 13, 26, 13, 26, 27, 54, 12, 24, 25, 50, 25, 50, 51, 102, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 6, 13, 13, 27, 13, 27, 27, 55, 12, 25, 25, 51, 25, 51, 51, 103, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 6, 13, 13, 27, 13, 27, 27, 55, 12, 25, 25, 51, 25, 51, 51, 103, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 6, 12, 12, 24, 12, 24, 24, 48, 13, 26, 26, 52, 26, 52, 52, 104, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 6, 12, 12, 24, 12, 24, 24, 48, 13, 26, 26, 52, 26, 52, 52, 104, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 6, 13, 12, 25, 12, 25, 24, 49, 13, 27, 26, 53, 26, 53, 52, 105, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 6, 13, 12, 25, 12, 25, 24, 49, 13, 27, 26, 53, 26, 53, 52, 105, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 6, 12, 13, 26, 12, 24, 25, 50, 13, 26, 27, 54, 26, 52, 53, 106, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 6, 12, 13, 26, 12, 24, 25, 50, 13, 26, 27, 54, 26, 52, 53, 106, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 6, 13, 13, 27, 12, 25, 25, 51, 13, 27, 27, 55, 26, 53, 53, 107, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 6, 13, 13, 27, 12, 25, 25, 51, 13, 27, 27, 55, 26, 53, 53, 107, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 6, 12, 12, 24, 13, 26, 26, 52, 13, 26, 26, 52, 27, 54, 54, 108, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 6, 12, 12, 24, 13, 26, 26, 52, 13, 26, 26, 52, 27, 54, 54, 108, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 6, 13, 12, 25, 13, 27, 26, 53, 13, 27, 26, 53, 27, 55, 54, 109, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 6, 13, 12, 25, 13, 27, 26, 53, 13, 27, 26, 53, 27, 55, 54, 109, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 6, 12, 13, 26, 13, 26, 27, 54, 13, 26, 27, 54, 27, 54, 55, 110, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 6, 12, 13, 26, 13, 26, 27, 54, 13, 26, 27, 54, 27, 54, 55, 110, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 6, 13, 13, 27, 13, 27, 27, 55, 13, 27, 27, 55, 27, 55, 55, 111, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 6, 13, 13, 27, 13, 27, 27, 55, 13, 27, 27, 55, 27, 55, 55, 111, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 7, 14, 14, 28, 14, 28, 28, 56, 14, 28, 28, 56, 28, 56, 56, 112, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 7, 14, 14, 28, 14, 28, 28, 56, 14, 28, 28, 56, 28, 56, 56, 112, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 7, 15, 14, 29, 14, 29, 28, 57, 14, 29, 28, 57, 28, 57, 56, 113, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 7, 15, 14, 29, 14, 29, 28, 57, 14, 29, 28, 57, 28, 57, 56, 113, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 7, 14, 15, 30, 14, 28, 29, 58, 14, 28, 29, 58, 28, 56, 57, 114, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 7, 14, 15, 30, 14, 28, 29, 58, 14, 28, 29, 58, 28, 56, 57, 114, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 7, 15, 15, 31, 14, 29, 29, 59, 14, 29, 29, 59, 28, 57, 57, 115, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 7, 15, 15, 31, 14, 29, 29, 59, 14, 29, 29, 59, 28, 57, 57, 115, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 7, 14, 14, 28, 15, 30, 30, 60, 14, 28, 28, 56, 29, 58, 58, 116, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 7, 14, 14, 28, 15, 30, 30, 60, 14, 28, 28, 56, 29, 58, 58, 116, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 7, 15, 14, 29, 15, 31, 30, 61, 14, 29, 28, 57, 29, 59, 58, 117, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 7, 15, 14, 29, 15, 31, 30, 61, 14, 29, 28, 57, 29, 59, 58, 117, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 7, 14, 15, 30, 15, 30, 31, 62, 14, 28, 29, 58, 29, 58, 59, 118, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 7, 14, 15, 30, 15, 30, 31, 62, 14, 28, 29, 58, 29, 58, 59, 118, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 7, 15, 15, 31, 15, 31, 31, 63, 14, 29, 29, 59, 29, 59, 59, 119, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 7, 15, 15, 31, 15, 31, 31, 63, 14, 29, 29, 59, 29, 59, 59, 119, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 7, 14, 14, 28, 14, 28, 28, 56, 15, 30, 30, 60, 30, 60, 60, 120, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 7, 14, 14, 28, 14, 28, 28, 56, 15, 30, 30, 60, 30, 60, 60, 120, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 7, 15, 14, 29, 14, 29, 28, 57, 15, 31, 30, 61, 30, 61, 60, 121, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 7, 15, 14, 29, 14, 29, 28, 57, 15, 31, 30, 61, 30, 61, 60, 121, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 7, 14, 15, 30, 14, 28, 29, 58, 15, 30, 31, 62, 30, 60, 61, 122, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 7, 14, 15, 30, 14, 28, 29, 58, 15, 30, 31, 62, 30, 60, 61, 122, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 7, 15, 15, 31, 14, 29, 29, 59, 15, 31, 31, 63, 30, 61, 61, 123, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 7, 15, 15, 31, 14, 29, 29, 59, 15, 31, 31, 63, 30, 61, 61, 123, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 7, 14, 14, 28, 15, 30, 30, 60, 15, 30, 30, 60, 31, 62, 62, 124, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 7, 14, 14, 28, 15, 30, 30, 60, 15, 30, 30, 60, 31, 62, 62, 124, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 7, 15, 14, 29, 15, 31, 30, 61, 15, 31, 30, 61, 31, 63, 62, 125, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 7, 15, 14, 29, 15, 31, 30, 61, 15, 31, 30, 61, 31, 63, 62, 125, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 7, 14, 15, 30, 15, 30, 31, 62, 15, 30, 31, 62, 31, 62, 63, 126, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 7, 14, 15, 30, 15, 30, 31, 62, 15, 30, 31, 62, 31, 62, 63, 126, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 7, 15, 15, 31, 15, 31, 31, 63, 15, 31, 31, 63, 31, 63, 63, 127, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 7, 15, 15, 31, 15, 31, 31, 63, 15, 31, 31, 63, 31, 63, 63, 127, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 4, 8, 8, 16, 8, 16, 16, 32, 8, 16, 16, 32, 16, 32, 32, 64, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 4, 8, 8, 16, 8, 16, 16, 32, 8, 16, 16, 32, 16, 32, 32, 64, + 4, 8, 8, 16, 8, 16, 16, 32, 8, 16, 16, 32, 16, 32, 32, 64, + 8, 16, 16, 32, 16, 32, 32, 64, 16, 32, 32, 64, 32, 64, 64, 128, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 4, 9, 8, 17, 8, 17, 16, 33, 8, 17, 16, 33, 16, 33, 32, 65, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 4, 9, 8, 17, 8, 17, 16, 33, 8, 17, 16, 33, 16, 33, 32, 65, + 4, 9, 8, 17, 8, 17, 16, 33, 8, 17, 16, 33, 16, 33, 32, 65, + 8, 17, 16, 33, 16, 33, 32, 65, 16, 33, 32, 65, 32, 65, 64, 129, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 4, 8, 9, 18, 8, 16, 17, 34, 8, 16, 17, 34, 16, 32, 33, 66, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 4, 8, 9, 18, 8, 16, 17, 34, 8, 16, 17, 34, 16, 32, 33, 66, + 4, 8, 9, 18, 8, 16, 17, 34, 8, 16, 17, 34, 16, 32, 33, 66, + 8, 16, 17, 34, 16, 32, 33, 66, 16, 32, 33, 66, 32, 64, 65, 130, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 4, 9, 9, 19, 8, 17, 17, 35, 8, 17, 17, 35, 16, 33, 33, 67, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 4, 9, 9, 19, 8, 17, 17, 35, 8, 17, 17, 35, 16, 33, 33, 67, + 4, 9, 9, 19, 8, 17, 17, 35, 8, 17, 17, 35, 16, 33, 33, 67, + 8, 17, 17, 35, 16, 33, 33, 67, 16, 33, 33, 67, 32, 65, 65, 131, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 4, 8, 8, 16, 9, 18, 18, 36, 8, 16, 16, 32, 17, 34, 34, 68, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 4, 8, 8, 16, 9, 18, 18, 36, 8, 16, 16, 32, 17, 34, 34, 68, + 4, 8, 8, 16, 9, 18, 18, 36, 8, 16, 16, 32, 17, 34, 34, 68, + 8, 16, 16, 32, 17, 34, 34, 68, 16, 32, 32, 64, 33, 66, 66, 132, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 4, 9, 8, 17, 9, 19, 18, 37, 8, 17, 16, 33, 17, 35, 34, 69, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 4, 9, 8, 17, 9, 19, 18, 37, 8, 17, 16, 33, 17, 35, 34, 69, + 4, 9, 8, 17, 9, 19, 18, 37, 8, 17, 16, 33, 17, 35, 34, 69, + 8, 17, 16, 33, 17, 35, 34, 69, 16, 33, 32, 65, 33, 67, 66, 133, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 4, 8, 9, 18, 9, 18, 19, 38, 8, 16, 17, 34, 17, 34, 35, 70, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 4, 8, 9, 18, 9, 18, 19, 38, 8, 16, 17, 34, 17, 34, 35, 70, + 4, 8, 9, 18, 9, 18, 19, 38, 8, 16, 17, 34, 17, 34, 35, 70, + 8, 16, 17, 34, 17, 34, 35, 70, 16, 32, 33, 66, 33, 66, 67, 134, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 4, 9, 9, 19, 9, 19, 19, 39, 8, 17, 17, 35, 17, 35, 35, 71, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 4, 9, 9, 19, 9, 19, 19, 39, 8, 17, 17, 35, 17, 35, 35, 71, + 4, 9, 9, 19, 9, 19, 19, 39, 8, 17, 17, 35, 17, 35, 35, 71, + 8, 17, 17, 35, 17, 35, 35, 71, 16, 33, 33, 67, 33, 67, 67, 135, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 4, 8, 8, 16, 8, 16, 16, 32, 9, 18, 18, 36, 18, 36, 36, 72, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 4, 8, 8, 16, 8, 16, 16, 32, 9, 18, 18, 36, 18, 36, 36, 72, + 4, 8, 8, 16, 8, 16, 16, 32, 9, 18, 18, 36, 18, 36, 36, 72, + 8, 16, 16, 32, 16, 32, 32, 64, 17, 34, 34, 68, 34, 68, 68, 136, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 4, 9, 8, 17, 8, 17, 16, 33, 9, 19, 18, 37, 18, 37, 36, 73, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 4, 9, 8, 17, 8, 17, 16, 33, 9, 19, 18, 37, 18, 37, 36, 73, + 4, 9, 8, 17, 8, 17, 16, 33, 9, 19, 18, 37, 18, 37, 36, 73, + 8, 17, 16, 33, 16, 33, 32, 65, 17, 35, 34, 69, 34, 69, 68, 137, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 4, 8, 9, 18, 8, 16, 17, 34, 9, 18, 19, 38, 18, 36, 37, 74, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 4, 8, 9, 18, 8, 16, 17, 34, 9, 18, 19, 38, 18, 36, 37, 74, + 4, 8, 9, 18, 8, 16, 17, 34, 9, 18, 19, 38, 18, 36, 37, 74, + 8, 16, 17, 34, 16, 32, 33, 66, 17, 34, 35, 70, 34, 68, 69, 138, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 4, 9, 9, 19, 8, 17, 17, 35, 9, 19, 19, 39, 18, 37, 37, 75, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 4, 9, 9, 19, 8, 17, 17, 35, 9, 19, 19, 39, 18, 37, 37, 75, + 4, 9, 9, 19, 8, 17, 17, 35, 9, 19, 19, 39, 18, 37, 37, 75, + 8, 17, 17, 35, 16, 33, 33, 67, 17, 35, 35, 71, 34, 69, 69, 139, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 4, 8, 8, 16, 9, 18, 18, 36, 9, 18, 18, 36, 19, 38, 38, 76, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 4, 8, 8, 16, 9, 18, 18, 36, 9, 18, 18, 36, 19, 38, 38, 76, + 4, 8, 8, 16, 9, 18, 18, 36, 9, 18, 18, 36, 19, 38, 38, 76, + 8, 16, 16, 32, 17, 34, 34, 68, 17, 34, 34, 68, 35, 70, 70, 140, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 4, 9, 8, 17, 9, 19, 18, 37, 9, 19, 18, 37, 19, 39, 38, 77, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 4, 9, 8, 17, 9, 19, 18, 37, 9, 19, 18, 37, 19, 39, 38, 77, + 4, 9, 8, 17, 9, 19, 18, 37, 9, 19, 18, 37, 19, 39, 38, 77, + 8, 17, 16, 33, 17, 35, 34, 69, 17, 35, 34, 69, 35, 71, 70, 141, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 4, 8, 9, 18, 9, 18, 19, 38, 9, 18, 19, 38, 19, 38, 39, 78, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 4, 8, 9, 18, 9, 18, 19, 38, 9, 18, 19, 38, 19, 38, 39, 78, + 4, 8, 9, 18, 9, 18, 19, 38, 9, 18, 19, 38, 19, 38, 39, 78, + 8, 16, 17, 34, 17, 34, 35, 70, 17, 34, 35, 70, 35, 70, 71, 142, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 4, 9, 9, 19, 9, 19, 19, 39, 9, 19, 19, 39, 19, 39, 39, 79, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 4, 9, 9, 19, 9, 19, 19, 39, 9, 19, 19, 39, 19, 39, 39, 79, + 4, 9, 9, 19, 9, 19, 19, 39, 9, 19, 19, 39, 19, 39, 39, 79, + 8, 17, 17, 35, 17, 35, 35, 71, 17, 35, 35, 71, 35, 71, 71, 143, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 5, 10, 10, 20, 10, 20, 20, 40, 10, 20, 20, 40, 20, 40, 40, 80, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 5, 10, 10, 20, 10, 20, 20, 40, 10, 20, 20, 40, 20, 40, 40, 80, + 4, 8, 8, 16, 8, 16, 16, 32, 8, 16, 16, 32, 16, 32, 32, 64, + 9, 18, 18, 36, 18, 36, 36, 72, 18, 36, 36, 72, 36, 72, 72, 144, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 5, 11, 10, 21, 10, 21, 20, 41, 10, 21, 20, 41, 20, 41, 40, 81, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 5, 11, 10, 21, 10, 21, 20, 41, 10, 21, 20, 41, 20, 41, 40, 81, + 4, 9, 8, 17, 8, 17, 16, 33, 8, 17, 16, 33, 16, 33, 32, 65, + 9, 19, 18, 37, 18, 37, 36, 73, 18, 37, 36, 73, 36, 73, 72, 145, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 5, 10, 11, 22, 10, 20, 21, 42, 10, 20, 21, 42, 20, 40, 41, 82, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 5, 10, 11, 22, 10, 20, 21, 42, 10, 20, 21, 42, 20, 40, 41, 82, + 4, 8, 9, 18, 8, 16, 17, 34, 8, 16, 17, 34, 16, 32, 33, 66, + 9, 18, 19, 38, 18, 36, 37, 74, 18, 36, 37, 74, 36, 72, 73, 146, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 5, 11, 11, 23, 10, 21, 21, 43, 10, 21, 21, 43, 20, 41, 41, 83, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 5, 11, 11, 23, 10, 21, 21, 43, 10, 21, 21, 43, 20, 41, 41, 83, + 4, 9, 9, 19, 8, 17, 17, 35, 8, 17, 17, 35, 16, 33, 33, 67, + 9, 19, 19, 39, 18, 37, 37, 75, 18, 37, 37, 75, 36, 73, 73, 147, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 5, 10, 10, 20, 11, 22, 22, 44, 10, 20, 20, 40, 21, 42, 42, 84, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 5, 10, 10, 20, 11, 22, 22, 44, 10, 20, 20, 40, 21, 42, 42, 84, + 4, 8, 8, 16, 9, 18, 18, 36, 8, 16, 16, 32, 17, 34, 34, 68, + 9, 18, 18, 36, 19, 38, 38, 76, 18, 36, 36, 72, 37, 74, 74, 148, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 5, 11, 10, 21, 11, 23, 22, 45, 10, 21, 20, 41, 21, 43, 42, 85, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 5, 11, 10, 21, 11, 23, 22, 45, 10, 21, 20, 41, 21, 43, 42, 85, + 4, 9, 8, 17, 9, 19, 18, 37, 8, 17, 16, 33, 17, 35, 34, 69, + 9, 19, 18, 37, 19, 39, 38, 77, 18, 37, 36, 73, 37, 75, 74, 149, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 5, 10, 11, 22, 11, 22, 23, 46, 10, 20, 21, 42, 21, 42, 43, 86, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 5, 10, 11, 22, 11, 22, 23, 46, 10, 20, 21, 42, 21, 42, 43, 86, + 4, 8, 9, 18, 9, 18, 19, 38, 8, 16, 17, 34, 17, 34, 35, 70, + 9, 18, 19, 38, 19, 38, 39, 78, 18, 36, 37, 74, 37, 74, 75, 150, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 5, 11, 11, 23, 11, 23, 23, 47, 10, 21, 21, 43, 21, 43, 43, 87, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 5, 11, 11, 23, 11, 23, 23, 47, 10, 21, 21, 43, 21, 43, 43, 87, + 4, 9, 9, 19, 9, 19, 19, 39, 8, 17, 17, 35, 17, 35, 35, 71, + 9, 19, 19, 39, 19, 39, 39, 79, 18, 37, 37, 75, 37, 75, 75, 151, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 5, 10, 10, 20, 10, 20, 20, 40, 11, 22, 22, 44, 22, 44, 44, 88, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 5, 10, 10, 20, 10, 20, 20, 40, 11, 22, 22, 44, 22, 44, 44, 88, + 4, 8, 8, 16, 8, 16, 16, 32, 9, 18, 18, 36, 18, 36, 36, 72, + 9, 18, 18, 36, 18, 36, 36, 72, 19, 38, 38, 76, 38, 76, 76, 152, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 5, 11, 10, 21, 10, 21, 20, 41, 11, 23, 22, 45, 22, 45, 44, 89, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 5, 11, 10, 21, 10, 21, 20, 41, 11, 23, 22, 45, 22, 45, 44, 89, + 4, 9, 8, 17, 8, 17, 16, 33, 9, 19, 18, 37, 18, 37, 36, 73, + 9, 19, 18, 37, 18, 37, 36, 73, 19, 39, 38, 77, 38, 77, 76, 153, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 5, 10, 11, 22, 10, 20, 21, 42, 11, 22, 23, 46, 22, 44, 45, 90, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 5, 10, 11, 22, 10, 20, 21, 42, 11, 22, 23, 46, 22, 44, 45, 90, + 4, 8, 9, 18, 8, 16, 17, 34, 9, 18, 19, 38, 18, 36, 37, 74, + 9, 18, 19, 38, 18, 36, 37, 74, 19, 38, 39, 78, 38, 76, 77, 154, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 5, 11, 11, 23, 10, 21, 21, 43, 11, 23, 23, 47, 22, 45, 45, 91, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 5, 11, 11, 23, 10, 21, 21, 43, 11, 23, 23, 47, 22, 45, 45, 91, + 4, 9, 9, 19, 8, 17, 17, 35, 9, 19, 19, 39, 18, 37, 37, 75, + 9, 19, 19, 39, 18, 37, 37, 75, 19, 39, 39, 79, 38, 77, 77, 155, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 5, 10, 10, 20, 11, 22, 22, 44, 11, 22, 22, 44, 23, 46, 46, 92, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 5, 10, 10, 20, 11, 22, 22, 44, 11, 22, 22, 44, 23, 46, 46, 92, + 4, 8, 8, 16, 9, 18, 18, 36, 9, 18, 18, 36, 19, 38, 38, 76, + 9, 18, 18, 36, 19, 38, 38, 76, 19, 38, 38, 76, 39, 78, 78, 156, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 5, 11, 10, 21, 11, 23, 22, 45, 11, 23, 22, 45, 23, 47, 46, 93, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 5, 11, 10, 21, 11, 23, 22, 45, 11, 23, 22, 45, 23, 47, 46, 93, + 4, 9, 8, 17, 9, 19, 18, 37, 9, 19, 18, 37, 19, 39, 38, 77, + 9, 19, 18, 37, 19, 39, 38, 77, 19, 39, 38, 77, 39, 79, 78, 157, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 5, 10, 11, 22, 11, 22, 23, 46, 11, 22, 23, 46, 23, 46, 47, 94, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 5, 10, 11, 22, 11, 22, 23, 46, 11, 22, 23, 46, 23, 46, 47, 94, + 4, 8, 9, 18, 9, 18, 19, 38, 9, 18, 19, 38, 19, 38, 39, 78, + 9, 18, 19, 38, 19, 38, 39, 78, 19, 38, 39, 78, 39, 78, 79, 158, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 5, 11, 11, 23, 11, 23, 23, 47, 11, 23, 23, 47, 23, 47, 47, 95, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 5, 11, 11, 23, 11, 23, 23, 47, 11, 23, 23, 47, 23, 47, 47, 95, + 4, 9, 9, 19, 9, 19, 19, 39, 9, 19, 19, 39, 19, 39, 39, 79, + 9, 19, 19, 39, 19, 39, 39, 79, 19, 39, 39, 79, 39, 79, 79, 159, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 6, 12, 12, 24, 12, 24, 24, 48, 12, 24, 24, 48, 24, 48, 48, 96, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 4, 8, 8, 16, 8, 16, 16, 32, 8, 16, 16, 32, 16, 32, 32, 64, + 5, 10, 10, 20, 10, 20, 20, 40, 10, 20, 20, 40, 20, 40, 40, 80, + 10, 20, 20, 40, 20, 40, 40, 80, 20, 40, 40, 80, 40, 80, 80, 160, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 6, 13, 12, 25, 12, 25, 24, 49, 12, 25, 24, 49, 24, 49, 48, 97, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 4, 9, 8, 17, 8, 17, 16, 33, 8, 17, 16, 33, 16, 33, 32, 65, + 5, 11, 10, 21, 10, 21, 20, 41, 10, 21, 20, 41, 20, 41, 40, 81, + 10, 21, 20, 41, 20, 41, 40, 81, 20, 41, 40, 81, 40, 81, 80, 161, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 6, 12, 13, 26, 12, 24, 25, 50, 12, 24, 25, 50, 24, 48, 49, 98, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 4, 8, 9, 18, 8, 16, 17, 34, 8, 16, 17, 34, 16, 32, 33, 66, + 5, 10, 11, 22, 10, 20, 21, 42, 10, 20, 21, 42, 20, 40, 41, 82, + 10, 20, 21, 42, 20, 40, 41, 82, 20, 40, 41, 82, 40, 80, 81, 162, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 6, 13, 13, 27, 12, 25, 25, 51, 12, 25, 25, 51, 24, 49, 49, 99, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 4, 9, 9, 19, 8, 17, 17, 35, 8, 17, 17, 35, 16, 33, 33, 67, + 5, 11, 11, 23, 10, 21, 21, 43, 10, 21, 21, 43, 20, 41, 41, 83, + 10, 21, 21, 43, 20, 41, 41, 83, 20, 41, 41, 83, 40, 81, 81, 163, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 6, 12, 12, 24, 13, 26, 26, 52, 12, 24, 24, 48, 25, 50, 50, 100, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 4, 8, 8, 16, 9, 18, 18, 36, 8, 16, 16, 32, 17, 34, 34, 68, + 5, 10, 10, 20, 11, 22, 22, 44, 10, 20, 20, 40, 21, 42, 42, 84, + 10, 20, 20, 40, 21, 42, 42, 84, 20, 40, 40, 80, 41, 82, 82, 164, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 6, 13, 12, 25, 13, 27, 26, 53, 12, 25, 24, 49, 25, 51, 50, 101, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 4, 9, 8, 17, 9, 19, 18, 37, 8, 17, 16, 33, 17, 35, 34, 69, + 5, 11, 10, 21, 11, 23, 22, 45, 10, 21, 20, 41, 21, 43, 42, 85, + 10, 21, 20, 41, 21, 43, 42, 85, 20, 41, 40, 81, 41, 83, 82, 165, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 6, 12, 13, 26, 13, 26, 27, 54, 12, 24, 25, 50, 25, 50, 51, 102, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 4, 8, 9, 18, 9, 18, 19, 38, 8, 16, 17, 34, 17, 34, 35, 70, + 5, 10, 11, 22, 11, 22, 23, 46, 10, 20, 21, 42, 21, 42, 43, 86, + 10, 20, 21, 42, 21, 42, 43, 86, 20, 40, 41, 82, 41, 82, 83, 166, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 6, 13, 13, 27, 13, 27, 27, 55, 12, 25, 25, 51, 25, 51, 51, 103, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 4, 9, 9, 19, 9, 19, 19, 39, 8, 17, 17, 35, 17, 35, 35, 71, + 5, 11, 11, 23, 11, 23, 23, 47, 10, 21, 21, 43, 21, 43, 43, 87, + 10, 21, 21, 43, 21, 43, 43, 87, 20, 41, 41, 83, 41, 83, 83, 167, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 6, 12, 12, 24, 12, 24, 24, 48, 13, 26, 26, 52, 26, 52, 52, 104, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 4, 8, 8, 16, 8, 16, 16, 32, 9, 18, 18, 36, 18, 36, 36, 72, + 5, 10, 10, 20, 10, 20, 20, 40, 11, 22, 22, 44, 22, 44, 44, 88, + 10, 20, 20, 40, 20, 40, 40, 80, 21, 42, 42, 84, 42, 84, 84, 168, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 6, 13, 12, 25, 12, 25, 24, 49, 13, 27, 26, 53, 26, 53, 52, 105, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 4, 9, 8, 17, 8, 17, 16, 33, 9, 19, 18, 37, 18, 37, 36, 73, + 5, 11, 10, 21, 10, 21, 20, 41, 11, 23, 22, 45, 22, 45, 44, 89, + 10, 21, 20, 41, 20, 41, 40, 81, 21, 43, 42, 85, 42, 85, 84, 169, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 6, 12, 13, 26, 12, 24, 25, 50, 13, 26, 27, 54, 26, 52, 53, 106, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 4, 8, 9, 18, 8, 16, 17, 34, 9, 18, 19, 38, 18, 36, 37, 74, + 5, 10, 11, 22, 10, 20, 21, 42, 11, 22, 23, 46, 22, 44, 45, 90, + 10, 20, 21, 42, 20, 40, 41, 82, 21, 42, 43, 86, 42, 84, 85, 170, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 6, 13, 13, 27, 12, 25, 25, 51, 13, 27, 27, 55, 26, 53, 53, 107, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 4, 9, 9, 19, 8, 17, 17, 35, 9, 19, 19, 39, 18, 37, 37, 75, + 5, 11, 11, 23, 10, 21, 21, 43, 11, 23, 23, 47, 22, 45, 45, 91, + 10, 21, 21, 43, 20, 41, 41, 83, 21, 43, 43, 87, 42, 85, 85, 171, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 6, 12, 12, 24, 13, 26, 26, 52, 13, 26, 26, 52, 27, 54, 54, 108, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 4, 8, 8, 16, 9, 18, 18, 36, 9, 18, 18, 36, 19, 38, 38, 76, + 5, 10, 10, 20, 11, 22, 22, 44, 11, 22, 22, 44, 23, 46, 46, 92, + 10, 20, 20, 40, 21, 42, 42, 84, 21, 42, 42, 84, 43, 86, 86, 172, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 6, 13, 12, 25, 13, 27, 26, 53, 13, 27, 26, 53, 27, 55, 54, 109, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 4, 9, 8, 17, 9, 19, 18, 37, 9, 19, 18, 37, 19, 39, 38, 77, + 5, 11, 10, 21, 11, 23, 22, 45, 11, 23, 22, 45, 23, 47, 46, 93, + 10, 21, 20, 41, 21, 43, 42, 85, 21, 43, 42, 85, 43, 87, 86, 173, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 6, 12, 13, 26, 13, 26, 27, 54, 13, 26, 27, 54, 27, 54, 55, 110, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 4, 8, 9, 18, 9, 18, 19, 38, 9, 18, 19, 38, 19, 38, 39, 78, + 5, 10, 11, 22, 11, 22, 23, 46, 11, 22, 23, 46, 23, 46, 47, 94, + 10, 20, 21, 42, 21, 42, 43, 86, 21, 42, 43, 86, 43, 86, 87, 174, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 6, 13, 13, 27, 13, 27, 27, 55, 13, 27, 27, 55, 27, 55, 55, 111, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 4, 9, 9, 19, 9, 19, 19, 39, 9, 19, 19, 39, 19, 39, 39, 79, + 5, 11, 11, 23, 11, 23, 23, 47, 11, 23, 23, 47, 23, 47, 47, 95, + 10, 21, 21, 43, 21, 43, 43, 87, 21, 43, 43, 87, 43, 87, 87, 175, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 7, 14, 14, 28, 14, 28, 28, 56, 14, 28, 28, 56, 28, 56, 56, 112, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 5, 10, 10, 20, 10, 20, 20, 40, 10, 20, 20, 40, 20, 40, 40, 80, + 5, 10, 10, 20, 10, 20, 20, 40, 10, 20, 20, 40, 20, 40, 40, 80, + 11, 22, 22, 44, 22, 44, 44, 88, 22, 44, 44, 88, 44, 88, 88, 176, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 7, 15, 14, 29, 14, 29, 28, 57, 14, 29, 28, 57, 28, 57, 56, 113, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 5, 11, 10, 21, 10, 21, 20, 41, 10, 21, 20, 41, 20, 41, 40, 81, + 5, 11, 10, 21, 10, 21, 20, 41, 10, 21, 20, 41, 20, 41, 40, 81, + 11, 23, 22, 45, 22, 45, 44, 89, 22, 45, 44, 89, 44, 89, 88, 177, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 7, 14, 15, 30, 14, 28, 29, 58, 14, 28, 29, 58, 28, 56, 57, 114, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 5, 10, 11, 22, 10, 20, 21, 42, 10, 20, 21, 42, 20, 40, 41, 82, + 5, 10, 11, 22, 10, 20, 21, 42, 10, 20, 21, 42, 20, 40, 41, 82, + 11, 22, 23, 46, 22, 44, 45, 90, 22, 44, 45, 90, 44, 88, 89, 178, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 7, 15, 15, 31, 14, 29, 29, 59, 14, 29, 29, 59, 28, 57, 57, 115, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 5, 11, 11, 23, 10, 21, 21, 43, 10, 21, 21, 43, 20, 41, 41, 83, + 5, 11, 11, 23, 10, 21, 21, 43, 10, 21, 21, 43, 20, 41, 41, 83, + 11, 23, 23, 47, 22, 45, 45, 91, 22, 45, 45, 91, 44, 89, 89, 179, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 7, 14, 14, 28, 15, 30, 30, 60, 14, 28, 28, 56, 29, 58, 58, 116, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 5, 10, 10, 20, 11, 22, 22, 44, 10, 20, 20, 40, 21, 42, 42, 84, + 5, 10, 10, 20, 11, 22, 22, 44, 10, 20, 20, 40, 21, 42, 42, 84, + 11, 22, 22, 44, 23, 46, 46, 92, 22, 44, 44, 88, 45, 90, 90, 180, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 7, 15, 14, 29, 15, 31, 30, 61, 14, 29, 28, 57, 29, 59, 58, 117, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 5, 11, 10, 21, 11, 23, 22, 45, 10, 21, 20, 41, 21, 43, 42, 85, + 5, 11, 10, 21, 11, 23, 22, 45, 10, 21, 20, 41, 21, 43, 42, 85, + 11, 23, 22, 45, 23, 47, 46, 93, 22, 45, 44, 89, 45, 91, 90, 181, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 7, 14, 15, 30, 15, 30, 31, 62, 14, 28, 29, 58, 29, 58, 59, 118, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 5, 10, 11, 22, 11, 22, 23, 46, 10, 20, 21, 42, 21, 42, 43, 86, + 5, 10, 11, 22, 11, 22, 23, 46, 10, 20, 21, 42, 21, 42, 43, 86, + 11, 22, 23, 46, 23, 46, 47, 94, 22, 44, 45, 90, 45, 90, 91, 182, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 7, 15, 15, 31, 15, 31, 31, 63, 14, 29, 29, 59, 29, 59, 59, 119, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 5, 11, 11, 23, 11, 23, 23, 47, 10, 21, 21, 43, 21, 43, 43, 87, + 5, 11, 11, 23, 11, 23, 23, 47, 10, 21, 21, 43, 21, 43, 43, 87, + 11, 23, 23, 47, 23, 47, 47, 95, 22, 45, 45, 91, 45, 91, 91, 183, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 7, 14, 14, 28, 14, 28, 28, 56, 15, 30, 30, 60, 30, 60, 60, 120, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 5, 10, 10, 20, 10, 20, 20, 40, 11, 22, 22, 44, 22, 44, 44, 88, + 5, 10, 10, 20, 10, 20, 20, 40, 11, 22, 22, 44, 22, 44, 44, 88, + 11, 22, 22, 44, 22, 44, 44, 88, 23, 46, 46, 92, 46, 92, 92, 184, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 7, 15, 14, 29, 14, 29, 28, 57, 15, 31, 30, 61, 30, 61, 60, 121, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 5, 11, 10, 21, 10, 21, 20, 41, 11, 23, 22, 45, 22, 45, 44, 89, + 5, 11, 10, 21, 10, 21, 20, 41, 11, 23, 22, 45, 22, 45, 44, 89, + 11, 23, 22, 45, 22, 45, 44, 89, 23, 47, 46, 93, 46, 93, 92, 185, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 7, 14, 15, 30, 14, 28, 29, 58, 15, 30, 31, 62, 30, 60, 61, 122, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 5, 10, 11, 22, 10, 20, 21, 42, 11, 22, 23, 46, 22, 44, 45, 90, + 5, 10, 11, 22, 10, 20, 21, 42, 11, 22, 23, 46, 22, 44, 45, 90, + 11, 22, 23, 46, 22, 44, 45, 90, 23, 46, 47, 94, 46, 92, 93, 186, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 7, 15, 15, 31, 14, 29, 29, 59, 15, 31, 31, 63, 30, 61, 61, 123, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 5, 11, 11, 23, 10, 21, 21, 43, 11, 23, 23, 47, 22, 45, 45, 91, + 5, 11, 11, 23, 10, 21, 21, 43, 11, 23, 23, 47, 22, 45, 45, 91, + 11, 23, 23, 47, 22, 45, 45, 91, 23, 47, 47, 95, 46, 93, 93, 187, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 7, 14, 14, 28, 15, 30, 30, 60, 15, 30, 30, 60, 31, 62, 62, 124, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 5, 10, 10, 20, 11, 22, 22, 44, 11, 22, 22, 44, 23, 46, 46, 92, + 5, 10, 10, 20, 11, 22, 22, 44, 11, 22, 22, 44, 23, 46, 46, 92, + 11, 22, 22, 44, 23, 46, 46, 92, 23, 46, 46, 92, 47, 94, 94, 188, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 7, 15, 14, 29, 15, 31, 30, 61, 15, 31, 30, 61, 31, 63, 62, 125, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 5, 11, 10, 21, 11, 23, 22, 45, 11, 23, 22, 45, 23, 47, 46, 93, + 5, 11, 10, 21, 11, 23, 22, 45, 11, 23, 22, 45, 23, 47, 46, 93, + 11, 23, 22, 45, 23, 47, 46, 93, 23, 47, 46, 93, 47, 95, 94, 189, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 7, 14, 15, 30, 15, 30, 31, 62, 15, 30, 31, 62, 31, 62, 63, 126, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 5, 10, 11, 22, 11, 22, 23, 46, 11, 22, 23, 46, 23, 46, 47, 94, + 5, 10, 11, 22, 11, 22, 23, 46, 11, 22, 23, 46, 23, 46, 47, 94, + 11, 22, 23, 46, 23, 46, 47, 94, 23, 46, 47, 94, 47, 94, 95, 190, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 7, 15, 15, 31, 15, 31, 31, 63, 15, 31, 31, 63, 31, 63, 63, 127, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 5, 11, 11, 23, 11, 23, 23, 47, 11, 23, 23, 47, 23, 47, 47, 95, + 5, 11, 11, 23, 11, 23, 23, 47, 11, 23, 23, 47, 23, 47, 47, 95, + 11, 23, 23, 47, 23, 47, 47, 95, 23, 47, 47, 95, 47, 95, 95, 191, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 4, 8, 8, 16, 8, 16, 16, 32, 8, 16, 16, 32, 16, 32, 32, 64, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 4, 8, 8, 16, 8, 16, 16, 32, 8, 16, 16, 32, 16, 32, 32, 64, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 6, 12, 12, 24, 12, 24, 24, 48, 12, 24, 24, 48, 24, 48, 48, 96, + 6, 12, 12, 24, 12, 24, 24, 48, 12, 24, 24, 48, 24, 48, 48, 96, + 12, 24, 24, 48, 24, 48, 48, 96, 24, 48, 48, 96, 48, 96, 96, 192, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 4, 9, 8, 17, 8, 17, 16, 33, 8, 17, 16, 33, 16, 33, 32, 65, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 4, 9, 8, 17, 8, 17, 16, 33, 8, 17, 16, 33, 16, 33, 32, 65, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 6, 13, 12, 25, 12, 25, 24, 49, 12, 25, 24, 49, 24, 49, 48, 97, + 6, 13, 12, 25, 12, 25, 24, 49, 12, 25, 24, 49, 24, 49, 48, 97, + 12, 25, 24, 49, 24, 49, 48, 97, 24, 49, 48, 97, 48, 97, 96, 193, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 4, 8, 9, 18, 8, 16, 17, 34, 8, 16, 17, 34, 16, 32, 33, 66, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 4, 8, 9, 18, 8, 16, 17, 34, 8, 16, 17, 34, 16, 32, 33, 66, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 6, 12, 13, 26, 12, 24, 25, 50, 12, 24, 25, 50, 24, 48, 49, 98, + 6, 12, 13, 26, 12, 24, 25, 50, 12, 24, 25, 50, 24, 48, 49, 98, + 12, 24, 25, 50, 24, 48, 49, 98, 24, 48, 49, 98, 48, 96, 97, 194, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 4, 9, 9, 19, 8, 17, 17, 35, 8, 17, 17, 35, 16, 33, 33, 67, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 4, 9, 9, 19, 8, 17, 17, 35, 8, 17, 17, 35, 16, 33, 33, 67, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 6, 13, 13, 27, 12, 25, 25, 51, 12, 25, 25, 51, 24, 49, 49, 99, + 6, 13, 13, 27, 12, 25, 25, 51, 12, 25, 25, 51, 24, 49, 49, 99, + 12, 25, 25, 51, 24, 49, 49, 99, 24, 49, 49, 99, 48, 97, 97, 195, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 4, 8, 8, 16, 9, 18, 18, 36, 8, 16, 16, 32, 17, 34, 34, 68, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 4, 8, 8, 16, 9, 18, 18, 36, 8, 16, 16, 32, 17, 34, 34, 68, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 6, 12, 12, 24, 13, 26, 26, 52, 12, 24, 24, 48, 25, 50, 50, 100, + 6, 12, 12, 24, 13, 26, 26, 52, 12, 24, 24, 48, 25, 50, 50, 100, + 12, 24, 24, 48, 25, 50, 50, 100, 24, 48, 48, 96, 49, 98, 98, 196, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 4, 9, 8, 17, 9, 19, 18, 37, 8, 17, 16, 33, 17, 35, 34, 69, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 4, 9, 8, 17, 9, 19, 18, 37, 8, 17, 16, 33, 17, 35, 34, 69, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 6, 13, 12, 25, 13, 27, 26, 53, 12, 25, 24, 49, 25, 51, 50, 101, + 6, 13, 12, 25, 13, 27, 26, 53, 12, 25, 24, 49, 25, 51, 50, 101, + 12, 25, 24, 49, 25, 51, 50, 101, 24, 49, 48, 97, 49, 99, 98, 197, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 4, 8, 9, 18, 9, 18, 19, 38, 8, 16, 17, 34, 17, 34, 35, 70, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 4, 8, 9, 18, 9, 18, 19, 38, 8, 16, 17, 34, 17, 34, 35, 70, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 6, 12, 13, 26, 13, 26, 27, 54, 12, 24, 25, 50, 25, 50, 51, 102, + 6, 12, 13, 26, 13, 26, 27, 54, 12, 24, 25, 50, 25, 50, 51, 102, + 12, 24, 25, 50, 25, 50, 51, 102, 24, 48, 49, 98, 49, 98, 99, 198, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 4, 9, 9, 19, 9, 19, 19, 39, 8, 17, 17, 35, 17, 35, 35, 71, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 4, 9, 9, 19, 9, 19, 19, 39, 8, 17, 17, 35, 17, 35, 35, 71, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 6, 13, 13, 27, 13, 27, 27, 55, 12, 25, 25, 51, 25, 51, 51, 103, + 6, 13, 13, 27, 13, 27, 27, 55, 12, 25, 25, 51, 25, 51, 51, 103, + 12, 25, 25, 51, 25, 51, 51, 103, 24, 49, 49, 99, 49, 99, 99, 199, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 4, 8, 8, 16, 8, 16, 16, 32, 9, 18, 18, 36, 18, 36, 36, 72, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 4, 8, 8, 16, 8, 16, 16, 32, 9, 18, 18, 36, 18, 36, 36, 72, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 6, 12, 12, 24, 12, 24, 24, 48, 13, 26, 26, 52, 26, 52, 52, 104, + 6, 12, 12, 24, 12, 24, 24, 48, 13, 26, 26, 52, 26, 52, 52, 104, + 12, 24, 24, 48, 24, 48, 48, 96, 25, 50, 50, 100, 50, 100, 100, 200, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 4, 9, 8, 17, 8, 17, 16, 33, 9, 19, 18, 37, 18, 37, 36, 73, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 4, 9, 8, 17, 8, 17, 16, 33, 9, 19, 18, 37, 18, 37, 36, 73, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 6, 13, 12, 25, 12, 25, 24, 49, 13, 27, 26, 53, 26, 53, 52, 105, + 6, 13, 12, 25, 12, 25, 24, 49, 13, 27, 26, 53, 26, 53, 52, 105, + 12, 25, 24, 49, 24, 49, 48, 97, 25, 51, 50, 101, 50, 101, 100, 201, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 4, 8, 9, 18, 8, 16, 17, 34, 9, 18, 19, 38, 18, 36, 37, 74, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 4, 8, 9, 18, 8, 16, 17, 34, 9, 18, 19, 38, 18, 36, 37, 74, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 6, 12, 13, 26, 12, 24, 25, 50, 13, 26, 27, 54, 26, 52, 53, 106, + 6, 12, 13, 26, 12, 24, 25, 50, 13, 26, 27, 54, 26, 52, 53, 106, + 12, 24, 25, 50, 24, 48, 49, 98, 25, 50, 51, 102, 50, 100, 101, 202, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 4, 9, 9, 19, 8, 17, 17, 35, 9, 19, 19, 39, 18, 37, 37, 75, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 4, 9, 9, 19, 8, 17, 17, 35, 9, 19, 19, 39, 18, 37, 37, 75, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 6, 13, 13, 27, 12, 25, 25, 51, 13, 27, 27, 55, 26, 53, 53, 107, + 6, 13, 13, 27, 12, 25, 25, 51, 13, 27, 27, 55, 26, 53, 53, 107, + 12, 25, 25, 51, 24, 49, 49, 99, 25, 51, 51, 103, 50, 101, 101, 203, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 4, 8, 8, 16, 9, 18, 18, 36, 9, 18, 18, 36, 19, 38, 38, 76, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 4, 8, 8, 16, 9, 18, 18, 36, 9, 18, 18, 36, 19, 38, 38, 76, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 6, 12, 12, 24, 13, 26, 26, 52, 13, 26, 26, 52, 27, 54, 54, 108, + 6, 12, 12, 24, 13, 26, 26, 52, 13, 26, 26, 52, 27, 54, 54, 108, + 12, 24, 24, 48, 25, 50, 50, 100, 25, 50, 50, 100, 51, 102, 102, 204, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 4, 9, 8, 17, 9, 19, 18, 37, 9, 19, 18, 37, 19, 39, 38, 77, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 4, 9, 8, 17, 9, 19, 18, 37, 9, 19, 18, 37, 19, 39, 38, 77, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 6, 13, 12, 25, 13, 27, 26, 53, 13, 27, 26, 53, 27, 55, 54, 109, + 6, 13, 12, 25, 13, 27, 26, 53, 13, 27, 26, 53, 27, 55, 54, 109, + 12, 25, 24, 49, 25, 51, 50, 101, 25, 51, 50, 101, 51, 103, 102, 205, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 4, 8, 9, 18, 9, 18, 19, 38, 9, 18, 19, 38, 19, 38, 39, 78, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 4, 8, 9, 18, 9, 18, 19, 38, 9, 18, 19, 38, 19, 38, 39, 78, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 6, 12, 13, 26, 13, 26, 27, 54, 13, 26, 27, 54, 27, 54, 55, 110, + 6, 12, 13, 26, 13, 26, 27, 54, 13, 26, 27, 54, 27, 54, 55, 110, + 12, 24, 25, 50, 25, 50, 51, 102, 25, 50, 51, 102, 51, 102, 103, 206, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 4, 9, 9, 19, 9, 19, 19, 39, 9, 19, 19, 39, 19, 39, 39, 79, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 4, 9, 9, 19, 9, 19, 19, 39, 9, 19, 19, 39, 19, 39, 39, 79, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 6, 13, 13, 27, 13, 27, 27, 55, 13, 27, 27, 55, 27, 55, 55, 111, + 6, 13, 13, 27, 13, 27, 27, 55, 13, 27, 27, 55, 27, 55, 55, 111, + 12, 25, 25, 51, 25, 51, 51, 103, 25, 51, 51, 103, 51, 103, 103, 207, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 5, 10, 10, 20, 10, 20, 20, 40, 10, 20, 20, 40, 20, 40, 40, 80, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 5, 10, 10, 20, 10, 20, 20, 40, 10, 20, 20, 40, 20, 40, 40, 80, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 7, 14, 14, 28, 14, 28, 28, 56, 14, 28, 28, 56, 28, 56, 56, 112, + 6, 12, 12, 24, 12, 24, 24, 48, 12, 24, 24, 48, 24, 48, 48, 96, + 13, 26, 26, 52, 26, 52, 52, 104, 26, 52, 52, 104, 52, 104, 104, 208, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 5, 11, 10, 21, 10, 21, 20, 41, 10, 21, 20, 41, 20, 41, 40, 81, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 5, 11, 10, 21, 10, 21, 20, 41, 10, 21, 20, 41, 20, 41, 40, 81, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 7, 15, 14, 29, 14, 29, 28, 57, 14, 29, 28, 57, 28, 57, 56, 113, + 6, 13, 12, 25, 12, 25, 24, 49, 12, 25, 24, 49, 24, 49, 48, 97, + 13, 27, 26, 53, 26, 53, 52, 105, 26, 53, 52, 105, 52, 105, 104, 209, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 5, 10, 11, 22, 10, 20, 21, 42, 10, 20, 21, 42, 20, 40, 41, 82, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 5, 10, 11, 22, 10, 20, 21, 42, 10, 20, 21, 42, 20, 40, 41, 82, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 7, 14, 15, 30, 14, 28, 29, 58, 14, 28, 29, 58, 28, 56, 57, 114, + 6, 12, 13, 26, 12, 24, 25, 50, 12, 24, 25, 50, 24, 48, 49, 98, + 13, 26, 27, 54, 26, 52, 53, 106, 26, 52, 53, 106, 52, 104, 105, 210, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 5, 11, 11, 23, 10, 21, 21, 43, 10, 21, 21, 43, 20, 41, 41, 83, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 5, 11, 11, 23, 10, 21, 21, 43, 10, 21, 21, 43, 20, 41, 41, 83, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 7, 15, 15, 31, 14, 29, 29, 59, 14, 29, 29, 59, 28, 57, 57, 115, + 6, 13, 13, 27, 12, 25, 25, 51, 12, 25, 25, 51, 24, 49, 49, 99, + 13, 27, 27, 55, 26, 53, 53, 107, 26, 53, 53, 107, 52, 105, 105, 211, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 5, 10, 10, 20, 11, 22, 22, 44, 10, 20, 20, 40, 21, 42, 42, 84, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 5, 10, 10, 20, 11, 22, 22, 44, 10, 20, 20, 40, 21, 42, 42, 84, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 7, 14, 14, 28, 15, 30, 30, 60, 14, 28, 28, 56, 29, 58, 58, 116, + 6, 12, 12, 24, 13, 26, 26, 52, 12, 24, 24, 48, 25, 50, 50, 100, + 13, 26, 26, 52, 27, 54, 54, 108, 26, 52, 52, 104, 53, 106, 106, 212, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 5, 11, 10, 21, 11, 23, 22, 45, 10, 21, 20, 41, 21, 43, 42, 85, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 5, 11, 10, 21, 11, 23, 22, 45, 10, 21, 20, 41, 21, 43, 42, 85, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 7, 15, 14, 29, 15, 31, 30, 61, 14, 29, 28, 57, 29, 59, 58, 117, + 6, 13, 12, 25, 13, 27, 26, 53, 12, 25, 24, 49, 25, 51, 50, 101, + 13, 27, 26, 53, 27, 55, 54, 109, 26, 53, 52, 105, 53, 107, 106, 213, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 5, 10, 11, 22, 11, 22, 23, 46, 10, 20, 21, 42, 21, 42, 43, 86, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 5, 10, 11, 22, 11, 22, 23, 46, 10, 20, 21, 42, 21, 42, 43, 86, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 7, 14, 15, 30, 15, 30, 31, 62, 14, 28, 29, 58, 29, 58, 59, 118, + 6, 12, 13, 26, 13, 26, 27, 54, 12, 24, 25, 50, 25, 50, 51, 102, + 13, 26, 27, 54, 27, 54, 55, 110, 26, 52, 53, 106, 53, 106, 107, 214, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 5, 11, 11, 23, 11, 23, 23, 47, 10, 21, 21, 43, 21, 43, 43, 87, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 5, 11, 11, 23, 11, 23, 23, 47, 10, 21, 21, 43, 21, 43, 43, 87, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 7, 15, 15, 31, 15, 31, 31, 63, 14, 29, 29, 59, 29, 59, 59, 119, + 6, 13, 13, 27, 13, 27, 27, 55, 12, 25, 25, 51, 25, 51, 51, 103, + 13, 27, 27, 55, 27, 55, 55, 111, 26, 53, 53, 107, 53, 107, 107, 215, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 5, 10, 10, 20, 10, 20, 20, 40, 11, 22, 22, 44, 22, 44, 44, 88, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 5, 10, 10, 20, 10, 20, 20, 40, 11, 22, 22, 44, 22, 44, 44, 88, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 7, 14, 14, 28, 14, 28, 28, 56, 15, 30, 30, 60, 30, 60, 60, 120, + 6, 12, 12, 24, 12, 24, 24, 48, 13, 26, 26, 52, 26, 52, 52, 104, + 13, 26, 26, 52, 26, 52, 52, 104, 27, 54, 54, 108, 54, 108, 108, 216, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 5, 11, 10, 21, 10, 21, 20, 41, 11, 23, 22, 45, 22, 45, 44, 89, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 5, 11, 10, 21, 10, 21, 20, 41, 11, 23, 22, 45, 22, 45, 44, 89, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 7, 15, 14, 29, 14, 29, 28, 57, 15, 31, 30, 61, 30, 61, 60, 121, + 6, 13, 12, 25, 12, 25, 24, 49, 13, 27, 26, 53, 26, 53, 52, 105, + 13, 27, 26, 53, 26, 53, 52, 105, 27, 55, 54, 109, 54, 109, 108, 217, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 5, 10, 11, 22, 10, 20, 21, 42, 11, 22, 23, 46, 22, 44, 45, 90, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 5, 10, 11, 22, 10, 20, 21, 42, 11, 22, 23, 46, 22, 44, 45, 90, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 7, 14, 15, 30, 14, 28, 29, 58, 15, 30, 31, 62, 30, 60, 61, 122, + 6, 12, 13, 26, 12, 24, 25, 50, 13, 26, 27, 54, 26, 52, 53, 106, + 13, 26, 27, 54, 26, 52, 53, 106, 27, 54, 55, 110, 54, 108, 109, 218, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 5, 11, 11, 23, 10, 21, 21, 43, 11, 23, 23, 47, 22, 45, 45, 91, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 5, 11, 11, 23, 10, 21, 21, 43, 11, 23, 23, 47, 22, 45, 45, 91, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 7, 15, 15, 31, 14, 29, 29, 59, 15, 31, 31, 63, 30, 61, 61, 123, + 6, 13, 13, 27, 12, 25, 25, 51, 13, 27, 27, 55, 26, 53, 53, 107, + 13, 27, 27, 55, 26, 53, 53, 107, 27, 55, 55, 111, 54, 109, 109, 219, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 5, 10, 10, 20, 11, 22, 22, 44, 11, 22, 22, 44, 23, 46, 46, 92, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 5, 10, 10, 20, 11, 22, 22, 44, 11, 22, 22, 44, 23, 46, 46, 92, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 7, 14, 14, 28, 15, 30, 30, 60, 15, 30, 30, 60, 31, 62, 62, 124, + 6, 12, 12, 24, 13, 26, 26, 52, 13, 26, 26, 52, 27, 54, 54, 108, + 13, 26, 26, 52, 27, 54, 54, 108, 27, 54, 54, 108, 55, 110, 110, 220, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 5, 11, 10, 21, 11, 23, 22, 45, 11, 23, 22, 45, 23, 47, 46, 93, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 5, 11, 10, 21, 11, 23, 22, 45, 11, 23, 22, 45, 23, 47, 46, 93, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 7, 15, 14, 29, 15, 31, 30, 61, 15, 31, 30, 61, 31, 63, 62, 125, + 6, 13, 12, 25, 13, 27, 26, 53, 13, 27, 26, 53, 27, 55, 54, 109, + 13, 27, 26, 53, 27, 55, 54, 109, 27, 55, 54, 109, 55, 111, 110, 221, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 5, 10, 11, 22, 11, 22, 23, 46, 11, 22, 23, 46, 23, 46, 47, 94, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 5, 10, 11, 22, 11, 22, 23, 46, 11, 22, 23, 46, 23, 46, 47, 94, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 7, 14, 15, 30, 15, 30, 31, 62, 15, 30, 31, 62, 31, 62, 63, 126, + 6, 12, 13, 26, 13, 26, 27, 54, 13, 26, 27, 54, 27, 54, 55, 110, + 13, 26, 27, 54, 27, 54, 55, 110, 27, 54, 55, 110, 55, 110, 111, 222, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 5, 11, 11, 23, 11, 23, 23, 47, 11, 23, 23, 47, 23, 47, 47, 95, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 5, 11, 11, 23, 11, 23, 23, 47, 11, 23, 23, 47, 23, 47, 47, 95, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 7, 15, 15, 31, 15, 31, 31, 63, 15, 31, 31, 63, 31, 63, 63, 127, + 6, 13, 13, 27, 13, 27, 27, 55, 13, 27, 27, 55, 27, 55, 55, 111, + 13, 27, 27, 55, 27, 55, 55, 111, 27, 55, 55, 111, 55, 111, 111, 223, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 6, 12, 12, 24, 12, 24, 24, 48, 12, 24, 24, 48, 24, 48, 48, 96, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 6, 12, 12, 24, 12, 24, 24, 48, 12, 24, 24, 48, 24, 48, 48, 96, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 6, 12, 12, 24, 12, 24, 24, 48, 12, 24, 24, 48, 24, 48, 48, 96, + 7, 14, 14, 28, 14, 28, 28, 56, 14, 28, 28, 56, 28, 56, 56, 112, + 14, 28, 28, 56, 28, 56, 56, 112, 28, 56, 56, 112, 56, 112, 112, 224, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 6, 13, 12, 25, 12, 25, 24, 49, 12, 25, 24, 49, 24, 49, 48, 97, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 2, 5, 4, 9, 4, 9, 8, 17, 4, 9, 8, 17, 8, 17, 16, 33, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 6, 13, 12, 25, 12, 25, 24, 49, 12, 25, 24, 49, 24, 49, 48, 97, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 6, 13, 12, 25, 12, 25, 24, 49, 12, 25, 24, 49, 24, 49, 48, 97, + 7, 15, 14, 29, 14, 29, 28, 57, 14, 29, 28, 57, 28, 57, 56, 113, + 14, 29, 28, 57, 28, 57, 56, 113, 28, 57, 56, 113, 56, 113, 112, 225, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 6, 12, 13, 26, 12, 24, 25, 50, 12, 24, 25, 50, 24, 48, 49, 98, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 2, 4, 5, 10, 4, 8, 9, 18, 4, 8, 9, 18, 8, 16, 17, 34, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 6, 12, 13, 26, 12, 24, 25, 50, 12, 24, 25, 50, 24, 48, 49, 98, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 6, 12, 13, 26, 12, 24, 25, 50, 12, 24, 25, 50, 24, 48, 49, 98, + 7, 14, 15, 30, 14, 28, 29, 58, 14, 28, 29, 58, 28, 56, 57, 114, + 14, 28, 29, 58, 28, 56, 57, 114, 28, 56, 57, 114, 56, 112, 113, 226, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 6, 13, 13, 27, 12, 25, 25, 51, 12, 25, 25, 51, 24, 49, 49, 99, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 2, 5, 5, 11, 4, 9, 9, 19, 4, 9, 9, 19, 8, 17, 17, 35, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 6, 13, 13, 27, 12, 25, 25, 51, 12, 25, 25, 51, 24, 49, 49, 99, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 6, 13, 13, 27, 12, 25, 25, 51, 12, 25, 25, 51, 24, 49, 49, 99, + 7, 15, 15, 31, 14, 29, 29, 59, 14, 29, 29, 59, 28, 57, 57, 115, + 14, 29, 29, 59, 28, 57, 57, 115, 28, 57, 57, 115, 56, 113, 113, 227, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 6, 12, 12, 24, 13, 26, 26, 52, 12, 24, 24, 48, 25, 50, 50, 100, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 2, 4, 4, 8, 5, 10, 10, 20, 4, 8, 8, 16, 9, 18, 18, 36, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 6, 12, 12, 24, 13, 26, 26, 52, 12, 24, 24, 48, 25, 50, 50, 100, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 6, 12, 12, 24, 13, 26, 26, 52, 12, 24, 24, 48, 25, 50, 50, 100, + 7, 14, 14, 28, 15, 30, 30, 60, 14, 28, 28, 56, 29, 58, 58, 116, + 14, 28, 28, 56, 29, 58, 58, 116, 28, 56, 56, 112, 57, 114, 114, 228, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 6, 13, 12, 25, 13, 27, 26, 53, 12, 25, 24, 49, 25, 51, 50, 101, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 2, 5, 4, 9, 5, 11, 10, 21, 4, 9, 8, 17, 9, 19, 18, 37, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 6, 13, 12, 25, 13, 27, 26, 53, 12, 25, 24, 49, 25, 51, 50, 101, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 6, 13, 12, 25, 13, 27, 26, 53, 12, 25, 24, 49, 25, 51, 50, 101, + 7, 15, 14, 29, 15, 31, 30, 61, 14, 29, 28, 57, 29, 59, 58, 117, + 14, 29, 28, 57, 29, 59, 58, 117, 28, 57, 56, 113, 57, 115, 114, 229, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 6, 12, 13, 26, 13, 26, 27, 54, 12, 24, 25, 50, 25, 50, 51, 102, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 2, 4, 5, 10, 5, 10, 11, 22, 4, 8, 9, 18, 9, 18, 19, 38, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 6, 12, 13, 26, 13, 26, 27, 54, 12, 24, 25, 50, 25, 50, 51, 102, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 6, 12, 13, 26, 13, 26, 27, 54, 12, 24, 25, 50, 25, 50, 51, 102, + 7, 14, 15, 30, 15, 30, 31, 62, 14, 28, 29, 58, 29, 58, 59, 118, + 14, 28, 29, 58, 29, 58, 59, 118, 28, 56, 57, 114, 57, 114, 115, 230, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 6, 13, 13, 27, 13, 27, 27, 55, 12, 25, 25, 51, 25, 51, 51, 103, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 2, 5, 5, 11, 5, 11, 11, 23, 4, 9, 9, 19, 9, 19, 19, 39, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 6, 13, 13, 27, 13, 27, 27, 55, 12, 25, 25, 51, 25, 51, 51, 103, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 6, 13, 13, 27, 13, 27, 27, 55, 12, 25, 25, 51, 25, 51, 51, 103, + 7, 15, 15, 31, 15, 31, 31, 63, 14, 29, 29, 59, 29, 59, 59, 119, + 14, 29, 29, 59, 29, 59, 59, 119, 28, 57, 57, 115, 57, 115, 115, 231, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 6, 12, 12, 24, 12, 24, 24, 48, 13, 26, 26, 52, 26, 52, 52, 104, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 2, 4, 4, 8, 4, 8, 8, 16, 5, 10, 10, 20, 10, 20, 20, 40, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 6, 12, 12, 24, 12, 24, 24, 48, 13, 26, 26, 52, 26, 52, 52, 104, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 6, 12, 12, 24, 12, 24, 24, 48, 13, 26, 26, 52, 26, 52, 52, 104, + 7, 14, 14, 28, 14, 28, 28, 56, 15, 30, 30, 60, 30, 60, 60, 120, + 14, 28, 28, 56, 28, 56, 56, 112, 29, 58, 58, 116, 58, 116, 116, 232, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 6, 13, 12, 25, 12, 25, 24, 49, 13, 27, 26, 53, 26, 53, 52, 105, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 2, 5, 4, 9, 4, 9, 8, 17, 5, 11, 10, 21, 10, 21, 20, 41, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 6, 13, 12, 25, 12, 25, 24, 49, 13, 27, 26, 53, 26, 53, 52, 105, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 6, 13, 12, 25, 12, 25, 24, 49, 13, 27, 26, 53, 26, 53, 52, 105, + 7, 15, 14, 29, 14, 29, 28, 57, 15, 31, 30, 61, 30, 61, 60, 121, + 14, 29, 28, 57, 28, 57, 56, 113, 29, 59, 58, 117, 58, 117, 116, 233, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 6, 12, 13, 26, 12, 24, 25, 50, 13, 26, 27, 54, 26, 52, 53, 106, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 2, 4, 5, 10, 4, 8, 9, 18, 5, 10, 11, 22, 10, 20, 21, 42, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 6, 12, 13, 26, 12, 24, 25, 50, 13, 26, 27, 54, 26, 52, 53, 106, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 6, 12, 13, 26, 12, 24, 25, 50, 13, 26, 27, 54, 26, 52, 53, 106, + 7, 14, 15, 30, 14, 28, 29, 58, 15, 30, 31, 62, 30, 60, 61, 122, + 14, 28, 29, 58, 28, 56, 57, 114, 29, 58, 59, 118, 58, 116, 117, 234, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 6, 13, 13, 27, 12, 25, 25, 51, 13, 27, 27, 55, 26, 53, 53, 107, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 2, 5, 5, 11, 4, 9, 9, 19, 5, 11, 11, 23, 10, 21, 21, 43, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 6, 13, 13, 27, 12, 25, 25, 51, 13, 27, 27, 55, 26, 53, 53, 107, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 6, 13, 13, 27, 12, 25, 25, 51, 13, 27, 27, 55, 26, 53, 53, 107, + 7, 15, 15, 31, 14, 29, 29, 59, 15, 31, 31, 63, 30, 61, 61, 123, + 14, 29, 29, 59, 28, 57, 57, 115, 29, 59, 59, 119, 58, 117, 117, 235, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 6, 12, 12, 24, 13, 26, 26, 52, 13, 26, 26, 52, 27, 54, 54, 108, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 2, 4, 4, 8, 5, 10, 10, 20, 5, 10, 10, 20, 11, 22, 22, 44, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 6, 12, 12, 24, 13, 26, 26, 52, 13, 26, 26, 52, 27, 54, 54, 108, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 6, 12, 12, 24, 13, 26, 26, 52, 13, 26, 26, 52, 27, 54, 54, 108, + 7, 14, 14, 28, 15, 30, 30, 60, 15, 30, 30, 60, 31, 62, 62, 124, + 14, 28, 28, 56, 29, 58, 58, 116, 29, 58, 58, 116, 59, 118, 118, 236, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 6, 13, 12, 25, 13, 27, 26, 53, 13, 27, 26, 53, 27, 55, 54, 109, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 2, 5, 4, 9, 5, 11, 10, 21, 5, 11, 10, 21, 11, 23, 22, 45, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 6, 13, 12, 25, 13, 27, 26, 53, 13, 27, 26, 53, 27, 55, 54, 109, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 6, 13, 12, 25, 13, 27, 26, 53, 13, 27, 26, 53, 27, 55, 54, 109, + 7, 15, 14, 29, 15, 31, 30, 61, 15, 31, 30, 61, 31, 63, 62, 125, + 14, 29, 28, 57, 29, 59, 58, 117, 29, 59, 58, 117, 59, 119, 118, 237, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 6, 12, 13, 26, 13, 26, 27, 54, 13, 26, 27, 54, 27, 54, 55, 110, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 2, 4, 5, 10, 5, 10, 11, 22, 5, 10, 11, 22, 11, 22, 23, 46, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 6, 12, 13, 26, 13, 26, 27, 54, 13, 26, 27, 54, 27, 54, 55, 110, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 6, 12, 13, 26, 13, 26, 27, 54, 13, 26, 27, 54, 27, 54, 55, 110, + 7, 14, 15, 30, 15, 30, 31, 62, 15, 30, 31, 62, 31, 62, 63, 126, + 14, 28, 29, 58, 29, 58, 59, 118, 29, 58, 59, 118, 59, 118, 119, 238, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 6, 13, 13, 27, 13, 27, 27, 55, 13, 27, 27, 55, 27, 55, 55, 111, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 2, 5, 5, 11, 5, 11, 11, 23, 5, 11, 11, 23, 11, 23, 23, 47, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 6, 13, 13, 27, 13, 27, 27, 55, 13, 27, 27, 55, 27, 55, 55, 111, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 6, 13, 13, 27, 13, 27, 27, 55, 13, 27, 27, 55, 27, 55, 55, 111, + 7, 15, 15, 31, 15, 31, 31, 63, 15, 31, 31, 63, 31, 63, 63, 127, + 14, 29, 29, 59, 29, 59, 59, 119, 29, 59, 59, 119, 59, 119, 119, 239, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 7, 14, 14, 28, 14, 28, 28, 56, 14, 28, 28, 56, 28, 56, 56, 112, + 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 7, 14, 14, 28, 14, 28, 28, 56, 14, 28, 28, 56, 28, 56, 56, 112, + 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, + 7, 14, 14, 28, 14, 28, 28, 56, 14, 28, 28, 56, 28, 56, 56, 112, + 7, 14, 14, 28, 14, 28, 28, 56, 14, 28, 28, 56, 28, 56, 56, 112, + 15, 30, 30, 60, 30, 60, 60, 120, 30, 60, 60, 120, 60, 120, 120, 240, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 7, 15, 14, 29, 14, 29, 28, 57, 14, 29, 28, 57, 28, 57, 56, 113, + 1, 3, 2, 5, 2, 5, 4, 9, 2, 5, 4, 9, 4, 9, 8, 17, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 7, 15, 14, 29, 14, 29, 28, 57, 14, 29, 28, 57, 28, 57, 56, 113, + 3, 7, 6, 13, 6, 13, 12, 25, 6, 13, 12, 25, 12, 25, 24, 49, + 7, 15, 14, 29, 14, 29, 28, 57, 14, 29, 28, 57, 28, 57, 56, 113, + 7, 15, 14, 29, 14, 29, 28, 57, 14, 29, 28, 57, 28, 57, 56, 113, + 15, 31, 30, 61, 30, 61, 60, 121, 30, 61, 60, 121, 60, 121, 120, 241, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 7, 14, 15, 30, 14, 28, 29, 58, 14, 28, 29, 58, 28, 56, 57, 114, + 1, 2, 3, 6, 2, 4, 5, 10, 2, 4, 5, 10, 4, 8, 9, 18, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 7, 14, 15, 30, 14, 28, 29, 58, 14, 28, 29, 58, 28, 56, 57, 114, + 3, 6, 7, 14, 6, 12, 13, 26, 6, 12, 13, 26, 12, 24, 25, 50, + 7, 14, 15, 30, 14, 28, 29, 58, 14, 28, 29, 58, 28, 56, 57, 114, + 7, 14, 15, 30, 14, 28, 29, 58, 14, 28, 29, 58, 28, 56, 57, 114, + 15, 30, 31, 62, 30, 60, 61, 122, 30, 60, 61, 122, 60, 120, 121, 242, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, 3, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 7, 15, 15, 31, 14, 29, 29, 59, 14, 29, 29, 59, 28, 57, 57, 115, + 1, 3, 3, 7, 2, 5, 5, 11, 2, 5, 5, 11, 4, 9, 9, 19, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 7, 15, 15, 31, 14, 29, 29, 59, 14, 29, 29, 59, 28, 57, 57, 115, + 3, 7, 7, 15, 6, 13, 13, 27, 6, 13, 13, 27, 12, 25, 25, 51, + 7, 15, 15, 31, 14, 29, 29, 59, 14, 29, 29, 59, 28, 57, 57, 115, + 7, 15, 15, 31, 14, 29, 29, 59, 14, 29, 29, 59, 28, 57, 57, 115, + 15, 31, 31, 63, 30, 61, 61, 123, 30, 61, 61, 123, 60, 121, 121, 243, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 1, 2, 2, 4, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 7, 14, 14, 28, 15, 30, 30, 60, 14, 28, 28, 56, 29, 58, 58, 116, + 1, 2, 2, 4, 3, 6, 6, 12, 2, 4, 4, 8, 5, 10, 10, 20, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 7, 14, 14, 28, 15, 30, 30, 60, 14, 28, 28, 56, 29, 58, 58, 116, + 3, 6, 6, 12, 7, 14, 14, 28, 6, 12, 12, 24, 13, 26, 26, 52, + 7, 14, 14, 28, 15, 30, 30, 60, 14, 28, 28, 56, 29, 58, 58, 116, + 7, 14, 14, 28, 15, 30, 30, 60, 14, 28, 28, 56, 29, 58, 58, 116, + 15, 30, 30, 60, 31, 62, 62, 124, 30, 60, 60, 120, 61, 122, 122, 244, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 0, 1, 1, 3, 2, 5, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 7, 15, 14, 29, 15, 31, 30, 61, 14, 29, 28, 57, 29, 59, 58, 117, + 1, 3, 2, 5, 3, 7, 6, 13, 2, 5, 4, 9, 5, 11, 10, 21, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 7, 15, 14, 29, 15, 31, 30, 61, 14, 29, 28, 57, 29, 59, 58, 117, + 3, 7, 6, 13, 7, 15, 14, 29, 6, 13, 12, 25, 13, 27, 26, 53, + 7, 15, 14, 29, 15, 31, 30, 61, 14, 29, 28, 57, 29, 59, 58, 117, + 7, 15, 14, 29, 15, 31, 30, 61, 14, 29, 28, 57, 29, 59, 58, 117, + 15, 31, 30, 61, 31, 63, 62, 125, 30, 61, 60, 121, 61, 123, 122, 245, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 0, 0, 1, 2, 1, 2, 3, 6, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 7, 14, 15, 30, 15, 30, 31, 62, 14, 28, 29, 58, 29, 58, 59, 118, + 1, 2, 3, 6, 3, 6, 7, 14, 2, 4, 5, 10, 5, 10, 11, 22, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 7, 14, 15, 30, 15, 30, 31, 62, 14, 28, 29, 58, 29, 58, 59, 118, + 3, 6, 7, 14, 7, 14, 15, 30, 6, 12, 13, 26, 13, 26, 27, 54, + 7, 14, 15, 30, 15, 30, 31, 62, 14, 28, 29, 58, 29, 58, 59, 118, + 7, 14, 15, 30, 15, 30, 31, 62, 14, 28, 29, 58, 29, 58, 59, 118, + 15, 30, 31, 62, 31, 62, 63, 126, 30, 60, 61, 122, 61, 122, 123, 246, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 0, 1, 1, 3, 1, 3, 3, 7, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 7, 15, 15, 31, 15, 31, 31, 63, 14, 29, 29, 59, 29, 59, 59, 119, + 1, 3, 3, 7, 3, 7, 7, 15, 2, 5, 5, 11, 5, 11, 11, 23, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 7, 15, 15, 31, 15, 31, 31, 63, 14, 29, 29, 59, 29, 59, 59, 119, + 3, 7, 7, 15, 7, 15, 15, 31, 6, 13, 13, 27, 13, 27, 27, 55, + 7, 15, 15, 31, 15, 31, 31, 63, 14, 29, 29, 59, 29, 59, 59, 119, + 7, 15, 15, 31, 15, 31, 31, 63, 14, 29, 29, 59, 29, 59, 59, 119, + 15, 31, 31, 63, 31, 63, 63, 127, 30, 61, 61, 123, 61, 123, 123, 247, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 2, 4, 4, 8, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 7, 14, 14, 28, 14, 28, 28, 56, 15, 30, 30, 60, 30, 60, 60, 120, + 1, 2, 2, 4, 2, 4, 4, 8, 3, 6, 6, 12, 6, 12, 12, 24, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 7, 14, 14, 28, 14, 28, 28, 56, 15, 30, 30, 60, 30, 60, 60, 120, + 3, 6, 6, 12, 6, 12, 12, 24, 7, 14, 14, 28, 14, 28, 28, 56, + 7, 14, 14, 28, 14, 28, 28, 56, 15, 30, 30, 60, 30, 60, 60, 120, + 7, 14, 14, 28, 14, 28, 28, 56, 15, 30, 30, 60, 30, 60, 60, 120, + 15, 30, 30, 60, 30, 60, 60, 120, 31, 62, 62, 124, 62, 124, 124, 248, + }, { + 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 2, 5, 2, 5, 4, 9, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 7, 15, 14, 29, 14, 29, 28, 57, 15, 31, 30, 61, 30, 61, 60, 121, + 1, 3, 2, 5, 2, 5, 4, 9, 3, 7, 6, 13, 6, 13, 12, 25, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 7, 15, 14, 29, 14, 29, 28, 57, 15, 31, 30, 61, 30, 61, 60, 121, + 3, 7, 6, 13, 6, 13, 12, 25, 7, 15, 14, 29, 14, 29, 28, 57, + 7, 15, 14, 29, 14, 29, 28, 57, 15, 31, 30, 61, 30, 61, 60, 121, + 7, 15, 14, 29, 14, 29, 28, 57, 15, 31, 30, 61, 30, 61, 60, 121, + 15, 31, 30, 61, 30, 61, 60, 121, 31, 63, 62, 125, 62, 125, 124, 249, + }, { + 0, 0, 1, 2, 0, 0, 1, 2, 1, 2, 3, 6, 2, 4, 5, 10, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 7, 14, 15, 30, 14, 28, 29, 58, 15, 30, 31, 62, 30, 60, 61, 122, + 1, 2, 3, 6, 2, 4, 5, 10, 3, 6, 7, 14, 6, 12, 13, 26, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 7, 14, 15, 30, 14, 28, 29, 58, 15, 30, 31, 62, 30, 60, 61, 122, + 3, 6, 7, 14, 6, 12, 13, 26, 7, 14, 15, 30, 14, 28, 29, 58, + 7, 14, 15, 30, 14, 28, 29, 58, 15, 30, 31, 62, 30, 60, 61, 122, + 7, 14, 15, 30, 14, 28, 29, 58, 15, 30, 31, 62, 30, 60, 61, 122, + 15, 30, 31, 62, 30, 60, 61, 122, 31, 62, 63, 126, 62, 124, 125, 250, + }, { + 0, 1, 1, 3, 0, 1, 1, 3, 1, 3, 3, 7, 2, 5, 5, 11, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 7, 15, 15, 31, 14, 29, 29, 59, 15, 31, 31, 63, 30, 61, 61, 123, + 1, 3, 3, 7, 2, 5, 5, 11, 3, 7, 7, 15, 6, 13, 13, 27, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 7, 15, 15, 31, 14, 29, 29, 59, 15, 31, 31, 63, 30, 61, 61, 123, + 3, 7, 7, 15, 6, 13, 13, 27, 7, 15, 15, 31, 14, 29, 29, 59, + 7, 15, 15, 31, 14, 29, 29, 59, 15, 31, 31, 63, 30, 61, 61, 123, + 7, 15, 15, 31, 14, 29, 29, 59, 15, 31, 31, 63, 30, 61, 61, 123, + 15, 31, 31, 63, 30, 61, 61, 123, 31, 63, 63, 127, 62, 125, 125, 251, + }, + { + 0, 0, 0, 0, 1, 2, 2, 4, 1, 2, 2, 4, 3, 6, 6, 12, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 7, 14, 14, 28, 15, 30, 30, 60, 15, 30, 30, 60, 31, 62, 62, 124, + 1, 2, 2, 4, 3, 6, 6, 12, 3, 6, 6, 12, 7, 14, 14, 28, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 7, 14, 14, 28, 15, 30, 30, 60, 15, 30, 30, 60, 31, 62, 62, 124, + 3, 6, 6, 12, 7, 14, 14, 28, 7, 14, 14, 28, 15, 30, 30, 60, + 7, 14, 14, 28, 15, 30, 30, 60, 15, 30, 30, 60, 31, 62, 62, 124, + 7, 14, 14, 28, 15, 30, 30, 60, 15, 30, 30, 60, 31, 62, 62, 124, + 15, 30, 30, 60, 31, 62, 62, 124, 31, 62, 62, 124, 63, 126, 126, 252, + }, { + 0, 1, 0, 1, 1, 3, 2, 5, 1, 3, 2, 5, 3, 7, 6, 13, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 7, 15, 14, 29, 15, 31, 30, 61, 15, 31, 30, 61, 31, 63, 62, 125, + 1, 3, 2, 5, 3, 7, 6, 13, 3, 7, 6, 13, 7, 15, 14, 29, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 7, 15, 14, 29, 15, 31, 30, 61, 15, 31, 30, 61, 31, 63, 62, 125, + 3, 7, 6, 13, 7, 15, 14, 29, 7, 15, 14, 29, 15, 31, 30, 61, + 7, 15, 14, 29, 15, 31, 30, 61, 15, 31, 30, 61, 31, 63, 62, 125, + 7, 15, 14, 29, 15, 31, 30, 61, 15, 31, 30, 61, 31, 63, 62, 125, + 15, 31, 30, 61, 31, 63, 62, 125, 31, 63, 62, 125, 63, 127, 126, 253, + }, { + 0, 0, 1, 2, 1, 2, 3, 6, 1, 2, 3, 6, 3, 6, 7, 14, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 7, 14, 15, 30, 15, 30, 31, 62, 15, 30, 31, 62, 31, 62, 63, 126, + 1, 2, 3, 6, 3, 6, 7, 14, 3, 6, 7, 14, 7, 14, 15, 30, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 7, 14, 15, 30, 15, 30, 31, 62, 15, 30, 31, 62, 31, 62, 63, 126, + 3, 6, 7, 14, 7, 14, 15, 30, 7, 14, 15, 30, 15, 30, 31, 62, + 7, 14, 15, 30, 15, 30, 31, 62, 15, 30, 31, 62, 31, 62, 63, 126, + 7, 14, 15, 30, 15, 30, 31, 62, 15, 30, 31, 62, 31, 62, 63, 126, + 15, 30, 31, 62, 31, 62, 63, 126, 31, 62, 63, 126, 63, 126, 127, 254, + }, { + 0, 1, 1, 3, 1, 3, 3, 7, 1, 3, 3, 7, 3, 7, 7, 15, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 7, 15, 15, 31, 15, 31, 31, 63, 15, 31, 31, 63, 31, 63, 63, 127, + 1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 7, 15, 15, 31, 15, 31, 31, 63, 15, 31, 31, 63, 31, 63, 63, 127, + 3, 7, 7, 15, 7, 15, 15, 31, 7, 15, 15, 31, 15, 31, 31, 63, + 7, 15, 15, 31, 15, 31, 31, 63, 15, 31, 31, 63, 31, 63, 63, 127, + 7, 15, 15, 31, 15, 31, 31, 63, 15, 31, 31, 63, 31, 63, 63, 127, + 15, 31, 31, 63, 31, 63, 63, 127, 31, 63, 63, 127, 63, 127, 127, 255, + }, +} + +// pdepLUT contains pre-computed parallel bit deposit results +var pdepLUT = [256][256]uint8{ + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 64, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 128, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 64, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 2, + 0, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 2, + 0, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 2, + 32, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 2, + 0, 64, 64, 2, 64, 4, 4, 2, 64, 8, 8, 2, 8, 4, 4, 2, + 64, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 2, + 64, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 2, + 32, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 2, + 0, 128, 128, 2, 128, 4, 4, 2, 128, 8, 8, 2, 8, 4, 4, 2, + 128, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 2, + 128, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 2, + 32, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 2, + 128, 64, 64, 2, 64, 4, 4, 2, 64, 8, 8, 2, 8, 4, 4, 2, + 64, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 2, + 64, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 2, + 32, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 2, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 3, + 16, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 3, + 32, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 3, + 48, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 3, + 64, 65, 66, 3, 68, 5, 6, 3, 72, 9, 10, 3, 12, 5, 6, 3, + 80, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 3, + 96, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 3, + 48, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 3, + 128, 129, 130, 3, 132, 5, 6, 3, 136, 9, 10, 3, 12, 5, 6, 3, + 144, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 3, + 160, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 3, + 48, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 3, + 192, 65, 66, 3, 68, 5, 6, 3, 72, 9, 10, 3, 12, 5, 6, 3, + 80, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 3, + 96, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 3, + 48, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 3, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 4, + 0, 0, 0, 16, 0, 16, 16, 4, 0, 16, 16, 8, 16, 8, 8, 4, + 0, 0, 0, 32, 0, 32, 32, 4, 0, 32, 32, 8, 32, 8, 8, 4, + 0, 32, 32, 16, 32, 16, 16, 4, 32, 16, 16, 8, 16, 8, 8, 4, + 0, 0, 0, 64, 0, 64, 64, 4, 0, 64, 64, 8, 64, 8, 8, 4, + 0, 64, 64, 16, 64, 16, 16, 4, 64, 16, 16, 8, 16, 8, 8, 4, + 0, 64, 64, 32, 64, 32, 32, 4, 64, 32, 32, 8, 32, 8, 8, 4, + 64, 32, 32, 16, 32, 16, 16, 4, 32, 16, 16, 8, 16, 8, 8, 4, + 0, 0, 0, 128, 0, 128, 128, 4, 0, 128, 128, 8, 128, 8, 8, 4, + 0, 128, 128, 16, 128, 16, 16, 4, 128, 16, 16, 8, 16, 8, 8, 4, + 0, 128, 128, 32, 128, 32, 32, 4, 128, 32, 32, 8, 32, 8, 8, 4, + 128, 32, 32, 16, 32, 16, 16, 4, 32, 16, 16, 8, 16, 8, 8, 4, + 0, 128, 128, 64, 128, 64, 64, 4, 128, 64, 64, 8, 64, 8, 8, 4, + 128, 64, 64, 16, 64, 16, 16, 4, 64, 16, 16, 8, 16, 8, 8, 4, + 128, 64, 64, 32, 64, 32, 32, 4, 64, 32, 32, 8, 32, 8, 8, 4, + 64, 32, 32, 16, 32, 16, 16, 4, 32, 16, 16, 8, 16, 8, 8, 4, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 5, + 16, 1, 2, 17, 4, 17, 18, 5, 8, 17, 18, 9, 20, 9, 10, 5, + 32, 1, 2, 33, 4, 33, 34, 5, 8, 33, 34, 9, 36, 9, 10, 5, + 16, 33, 34, 17, 36, 17, 18, 5, 40, 17, 18, 9, 20, 9, 10, 5, + 64, 1, 2, 65, 4, 65, 66, 5, 8, 65, 66, 9, 68, 9, 10, 5, + 16, 65, 66, 17, 68, 17, 18, 5, 72, 17, 18, 9, 20, 9, 10, 5, + 32, 65, 66, 33, 68, 33, 34, 5, 72, 33, 34, 9, 36, 9, 10, 5, + 80, 33, 34, 17, 36, 17, 18, 5, 40, 17, 18, 9, 20, 9, 10, 5, + 128, 1, 2, 129, 4, 129, 130, 5, 8, 129, 130, 9, 132, 9, 10, 5, + 16, 129, 130, 17, 132, 17, 18, 5, 136, 17, 18, 9, 20, 9, 10, 5, + 32, 129, 130, 33, 132, 33, 34, 5, 136, 33, 34, 9, 36, 9, 10, 5, + 144, 33, 34, 17, 36, 17, 18, 5, 40, 17, 18, 9, 20, 9, 10, 5, + 64, 129, 130, 65, 132, 65, 66, 5, 136, 65, 66, 9, 68, 9, 10, 5, + 144, 65, 66, 17, 68, 17, 18, 5, 72, 17, 18, 9, 20, 9, 10, 5, + 160, 65, 66, 33, 68, 33, 34, 5, 72, 33, 34, 9, 36, 9, 10, 5, + 80, 33, 34, 17, 36, 17, 18, 5, 40, 17, 18, 9, 20, 9, 10, 5, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 6, + 0, 16, 16, 18, 16, 20, 20, 6, 16, 24, 24, 10, 24, 12, 12, 6, + 0, 32, 32, 34, 32, 36, 36, 6, 32, 40, 40, 10, 40, 12, 12, 6, + 32, 48, 48, 18, 48, 20, 20, 6, 48, 24, 24, 10, 24, 12, 12, 6, + 0, 64, 64, 66, 64, 68, 68, 6, 64, 72, 72, 10, 72, 12, 12, 6, + 64, 80, 80, 18, 80, 20, 20, 6, 80, 24, 24, 10, 24, 12, 12, 6, + 64, 96, 96, 34, 96, 36, 36, 6, 96, 40, 40, 10, 40, 12, 12, 6, + 96, 48, 48, 18, 48, 20, 20, 6, 48, 24, 24, 10, 24, 12, 12, 6, + 0, 128, 128, 130, 128, 132, 132, 6, 128, 136, 136, 10, 136, 12, 12, 6, + 128, 144, 144, 18, 144, 20, 20, 6, 144, 24, 24, 10, 24, 12, 12, 6, + 128, 160, 160, 34, 160, 36, 36, 6, 160, 40, 40, 10, 40, 12, 12, 6, + 160, 48, 48, 18, 48, 20, 20, 6, 48, 24, 24, 10, 24, 12, 12, 6, + 128, 192, 192, 66, 192, 68, 68, 6, 192, 72, 72, 10, 72, 12, 12, 6, + 192, 80, 80, 18, 80, 20, 20, 6, 80, 24, 24, 10, 24, 12, 12, 6, + 192, 96, 96, 34, 96, 36, 36, 6, 96, 40, 40, 10, 40, 12, 12, 6, + 96, 48, 48, 18, 48, 20, 20, 6, 48, 24, 24, 10, 24, 12, 12, 6, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 7, + 16, 17, 18, 19, 20, 21, 22, 7, 24, 25, 26, 11, 28, 13, 14, 7, + 32, 33, 34, 35, 36, 37, 38, 7, 40, 41, 42, 11, 44, 13, 14, 7, + 48, 49, 50, 19, 52, 21, 22, 7, 56, 25, 26, 11, 28, 13, 14, 7, + 64, 65, 66, 67, 68, 69, 70, 7, 72, 73, 74, 11, 76, 13, 14, 7, + 80, 81, 82, 19, 84, 21, 22, 7, 88, 25, 26, 11, 28, 13, 14, 7, + 96, 97, 98, 35, 100, 37, 38, 7, 104, 41, 42, 11, 44, 13, 14, 7, + 112, 49, 50, 19, 52, 21, 22, 7, 56, 25, 26, 11, 28, 13, 14, 7, + 128, 129, 130, 131, 132, 133, 134, 7, 136, 137, 138, 11, 140, 13, 14, 7, + 144, 145, 146, 19, 148, 21, 22, 7, 152, 25, 26, 11, 28, 13, 14, 7, + 160, 161, 162, 35, 164, 37, 38, 7, 168, 41, 42, 11, 44, 13, 14, 7, + 176, 49, 50, 19, 52, 21, 22, 7, 56, 25, 26, 11, 28, 13, 14, 7, + 192, 193, 194, 67, 196, 69, 70, 7, 200, 73, 74, 11, 76, 13, 14, 7, + 208, 81, 82, 19, 84, 21, 22, 7, 88, 25, 26, 11, 28, 13, 14, 7, + 224, 97, 98, 35, 100, 37, 38, 7, 104, 41, 42, 11, 44, 13, 14, 7, + 112, 49, 50, 19, 52, 21, 22, 7, 56, 25, 26, 11, 28, 13, 14, 7, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, + 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 16, 0, 16, 16, 8, + 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 32, 0, 32, 32, 8, + 0, 0, 0, 32, 0, 32, 32, 16, 0, 32, 32, 16, 32, 16, 16, 8, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 8, + 0, 0, 0, 64, 0, 64, 64, 16, 0, 64, 64, 16, 64, 16, 16, 8, + 0, 0, 0, 64, 0, 64, 64, 32, 0, 64, 64, 32, 64, 32, 32, 8, + 0, 64, 64, 32, 64, 32, 32, 16, 64, 32, 32, 16, 32, 16, 16, 8, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 8, + 0, 0, 0, 128, 0, 128, 128, 16, 0, 128, 128, 16, 128, 16, 16, 8, + 0, 0, 0, 128, 0, 128, 128, 32, 0, 128, 128, 32, 128, 32, 32, 8, + 0, 128, 128, 32, 128, 32, 32, 16, 128, 32, 32, 16, 32, 16, 16, 8, + 0, 0, 0, 128, 0, 128, 128, 64, 0, 128, 128, 64, 128, 64, 64, 8, + 0, 128, 128, 64, 128, 64, 64, 16, 128, 64, 64, 16, 64, 16, 16, 8, + 0, 128, 128, 64, 128, 64, 64, 32, 128, 64, 64, 32, 64, 32, 32, 8, + 128, 64, 64, 32, 64, 32, 32, 16, 64, 32, 32, 16, 32, 16, 16, 8, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 9, + 16, 1, 2, 1, 4, 1, 2, 17, 8, 1, 2, 17, 4, 17, 18, 9, + 32, 1, 2, 1, 4, 1, 2, 33, 8, 1, 2, 33, 4, 33, 34, 9, + 16, 1, 2, 33, 4, 33, 34, 17, 8, 33, 34, 17, 36, 17, 18, 9, + 64, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 9, + 16, 1, 2, 65, 4, 65, 66, 17, 8, 65, 66, 17, 68, 17, 18, 9, + 32, 1, 2, 65, 4, 65, 66, 33, 8, 65, 66, 33, 68, 33, 34, 9, + 16, 65, 66, 33, 68, 33, 34, 17, 72, 33, 34, 17, 36, 17, 18, 9, + 128, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 9, + 16, 1, 2, 129, 4, 129, 130, 17, 8, 129, 130, 17, 132, 17, 18, 9, + 32, 1, 2, 129, 4, 129, 130, 33, 8, 129, 130, 33, 132, 33, 34, 9, + 16, 129, 130, 33, 132, 33, 34, 17, 136, 33, 34, 17, 36, 17, 18, 9, + 64, 1, 2, 129, 4, 129, 130, 65, 8, 129, 130, 65, 132, 65, 66, 9, + 16, 129, 130, 65, 132, 65, 66, 17, 136, 65, 66, 17, 68, 17, 18, 9, + 32, 129, 130, 65, 132, 65, 66, 33, 136, 65, 66, 33, 68, 33, 34, 9, + 144, 65, 66, 33, 68, 33, 34, 17, 72, 33, 34, 17, 36, 17, 18, 9, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 10, + 0, 16, 16, 2, 16, 4, 4, 18, 16, 8, 8, 18, 8, 20, 20, 10, + 0, 32, 32, 2, 32, 4, 4, 34, 32, 8, 8, 34, 8, 36, 36, 10, + 32, 16, 16, 34, 16, 36, 36, 18, 16, 40, 40, 18, 40, 20, 20, 10, + 0, 64, 64, 2, 64, 4, 4, 66, 64, 8, 8, 66, 8, 68, 68, 10, + 64, 16, 16, 66, 16, 68, 68, 18, 16, 72, 72, 18, 72, 20, 20, 10, + 64, 32, 32, 66, 32, 68, 68, 34, 32, 72, 72, 34, 72, 36, 36, 10, + 32, 80, 80, 34, 80, 36, 36, 18, 80, 40, 40, 18, 40, 20, 20, 10, + 0, 128, 128, 2, 128, 4, 4, 130, 128, 8, 8, 130, 8, 132, 132, 10, + 128, 16, 16, 130, 16, 132, 132, 18, 16, 136, 136, 18, 136, 20, 20, 10, + 128, 32, 32, 130, 32, 132, 132, 34, 32, 136, 136, 34, 136, 36, 36, 10, + 32, 144, 144, 34, 144, 36, 36, 18, 144, 40, 40, 18, 40, 20, 20, 10, + 128, 64, 64, 130, 64, 132, 132, 66, 64, 136, 136, 66, 136, 68, 68, 10, + 64, 144, 144, 66, 144, 68, 68, 18, 144, 72, 72, 18, 72, 20, 20, 10, + 64, 160, 160, 66, 160, 68, 68, 34, 160, 72, 72, 34, 72, 36, 36, 10, + 160, 80, 80, 34, 80, 36, 36, 18, 80, 40, 40, 18, 40, 20, 20, 10, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 11, + 16, 17, 18, 3, 20, 5, 6, 19, 24, 9, 10, 19, 12, 21, 22, 11, + 32, 33, 34, 3, 36, 5, 6, 35, 40, 9, 10, 35, 12, 37, 38, 11, + 48, 17, 18, 35, 20, 37, 38, 19, 24, 41, 42, 19, 44, 21, 22, 11, + 64, 65, 66, 3, 68, 5, 6, 67, 72, 9, 10, 67, 12, 69, 70, 11, + 80, 17, 18, 67, 20, 69, 70, 19, 24, 73, 74, 19, 76, 21, 22, 11, + 96, 33, 34, 67, 36, 69, 70, 35, 40, 73, 74, 35, 76, 37, 38, 11, + 48, 81, 82, 35, 84, 37, 38, 19, 88, 41, 42, 19, 44, 21, 22, 11, + 128, 129, 130, 3, 132, 5, 6, 131, 136, 9, 10, 131, 12, 133, 134, 11, + 144, 17, 18, 131, 20, 133, 134, 19, 24, 137, 138, 19, 140, 21, 22, 11, + 160, 33, 34, 131, 36, 133, 134, 35, 40, 137, 138, 35, 140, 37, 38, 11, + 48, 145, 146, 35, 148, 37, 38, 19, 152, 41, 42, 19, 44, 21, 22, 11, + 192, 65, 66, 131, 68, 133, 134, 67, 72, 137, 138, 67, 140, 69, 70, 11, + 80, 145, 146, 67, 148, 69, 70, 19, 152, 73, 74, 19, 76, 21, 22, 11, + 96, 161, 162, 67, 164, 69, 70, 35, 168, 73, 74, 35, 76, 37, 38, 11, + 176, 81, 82, 35, 84, 37, 38, 19, 88, 41, 42, 19, 44, 21, 22, 11, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 12, + 0, 0, 0, 16, 0, 16, 16, 20, 0, 16, 16, 24, 16, 24, 24, 12, + 0, 0, 0, 32, 0, 32, 32, 36, 0, 32, 32, 40, 32, 40, 40, 12, + 0, 32, 32, 48, 32, 48, 48, 20, 32, 48, 48, 24, 48, 24, 24, 12, + 0, 0, 0, 64, 0, 64, 64, 68, 0, 64, 64, 72, 64, 72, 72, 12, + 0, 64, 64, 80, 64, 80, 80, 20, 64, 80, 80, 24, 80, 24, 24, 12, + 0, 64, 64, 96, 64, 96, 96, 36, 64, 96, 96, 40, 96, 40, 40, 12, + 64, 96, 96, 48, 96, 48, 48, 20, 96, 48, 48, 24, 48, 24, 24, 12, + 0, 0, 0, 128, 0, 128, 128, 132, 0, 128, 128, 136, 128, 136, 136, 12, + 0, 128, 128, 144, 128, 144, 144, 20, 128, 144, 144, 24, 144, 24, 24, 12, + 0, 128, 128, 160, 128, 160, 160, 36, 128, 160, 160, 40, 160, 40, 40, 12, + 128, 160, 160, 48, 160, 48, 48, 20, 160, 48, 48, 24, 48, 24, 24, 12, + 0, 128, 128, 192, 128, 192, 192, 68, 128, 192, 192, 72, 192, 72, 72, 12, + 128, 192, 192, 80, 192, 80, 80, 20, 192, 80, 80, 24, 80, 24, 24, 12, + 128, 192, 192, 96, 192, 96, 96, 36, 192, 96, 96, 40, 96, 40, 40, 12, + 192, 96, 96, 48, 96, 48, 48, 20, 96, 48, 48, 24, 48, 24, 24, 12, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 13, + 16, 1, 2, 17, 4, 17, 18, 21, 8, 17, 18, 25, 20, 25, 26, 13, + 32, 1, 2, 33, 4, 33, 34, 37, 8, 33, 34, 41, 36, 41, 42, 13, + 16, 33, 34, 49, 36, 49, 50, 21, 40, 49, 50, 25, 52, 25, 26, 13, + 64, 1, 2, 65, 4, 65, 66, 69, 8, 65, 66, 73, 68, 73, 74, 13, + 16, 65, 66, 81, 68, 81, 82, 21, 72, 81, 82, 25, 84, 25, 26, 13, + 32, 65, 66, 97, 68, 97, 98, 37, 72, 97, 98, 41, 100, 41, 42, 13, + 80, 97, 98, 49, 100, 49, 50, 21, 104, 49, 50, 25, 52, 25, 26, 13, + 128, 1, 2, 129, 4, 129, 130, 133, 8, 129, 130, 137, 132, 137, 138, 13, + 16, 129, 130, 145, 132, 145, 146, 21, 136, 145, 146, 25, 148, 25, 26, 13, + 32, 129, 130, 161, 132, 161, 162, 37, 136, 161, 162, 41, 164, 41, 42, 13, + 144, 161, 162, 49, 164, 49, 50, 21, 168, 49, 50, 25, 52, 25, 26, 13, + 64, 129, 130, 193, 132, 193, 194, 69, 136, 193, 194, 73, 196, 73, 74, 13, + 144, 193, 194, 81, 196, 81, 82, 21, 200, 81, 82, 25, 84, 25, 26, 13, + 160, 193, 194, 97, 196, 97, 98, 37, 200, 97, 98, 41, 100, 41, 42, 13, + 208, 97, 98, 49, 100, 49, 50, 21, 104, 49, 50, 25, 52, 25, 26, 13, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 14, + 0, 16, 16, 18, 16, 20, 20, 22, 16, 24, 24, 26, 24, 28, 28, 14, + 0, 32, 32, 34, 32, 36, 36, 38, 32, 40, 40, 42, 40, 44, 44, 14, + 32, 48, 48, 50, 48, 52, 52, 22, 48, 56, 56, 26, 56, 28, 28, 14, + 0, 64, 64, 66, 64, 68, 68, 70, 64, 72, 72, 74, 72, 76, 76, 14, + 64, 80, 80, 82, 80, 84, 84, 22, 80, 88, 88, 26, 88, 28, 28, 14, + 64, 96, 96, 98, 96, 100, 100, 38, 96, 104, 104, 42, 104, 44, 44, 14, + 96, 112, 112, 50, 112, 52, 52, 22, 112, 56, 56, 26, 56, 28, 28, 14, + 0, 128, 128, 130, 128, 132, 132, 134, 128, 136, 136, 138, 136, 140, 140, 14, + 128, 144, 144, 146, 144, 148, 148, 22, 144, 152, 152, 26, 152, 28, 28, 14, + 128, 160, 160, 162, 160, 164, 164, 38, 160, 168, 168, 42, 168, 44, 44, 14, + 160, 176, 176, 50, 176, 52, 52, 22, 176, 56, 56, 26, 56, 28, 28, 14, + 128, 192, 192, 194, 192, 196, 196, 70, 192, 200, 200, 74, 200, 76, 76, 14, + 192, 208, 208, 82, 208, 84, 84, 22, 208, 88, 88, 26, 88, 28, 28, 14, + 192, 224, 224, 98, 224, 100, 100, 38, 224, 104, 104, 42, 104, 44, 44, 14, + 224, 112, 112, 50, 112, 52, 52, 22, 112, 56, 56, 26, 56, 28, 28, 14, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 15, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 15, + 48, 49, 50, 51, 52, 53, 54, 23, 56, 57, 58, 27, 60, 29, 30, 15, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 15, + 80, 81, 82, 83, 84, 85, 86, 23, 88, 89, 90, 27, 92, 29, 30, 15, + 96, 97, 98, 99, 100, 101, 102, 39, 104, 105, 106, 43, 108, 45, 46, 15, + 112, 113, 114, 51, 116, 53, 54, 23, 120, 57, 58, 27, 60, 29, 30, 15, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 15, + 144, 145, 146, 147, 148, 149, 150, 23, 152, 153, 154, 27, 156, 29, 30, 15, + 160, 161, 162, 163, 164, 165, 166, 39, 168, 169, 170, 43, 172, 45, 46, 15, + 176, 177, 178, 51, 180, 53, 54, 23, 184, 57, 58, 27, 60, 29, 30, 15, + 192, 193, 194, 195, 196, 197, 198, 71, 200, 201, 202, 75, 204, 77, 78, 15, + 208, 209, 210, 83, 212, 85, 86, 23, 216, 89, 90, 27, 92, 29, 30, 15, + 224, 225, 226, 99, 228, 101, 102, 39, 232, 105, 106, 43, 108, 45, 46, 15, + 240, 113, 114, 51, 116, 53, 54, 23, 120, 57, 58, 27, 60, 29, 30, 15, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, + 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 32, 0, 32, 32, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 16, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 32, + 0, 0, 0, 64, 0, 64, 64, 32, 0, 64, 64, 32, 64, 32, 32, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 16, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 32, + 0, 0, 0, 128, 0, 128, 128, 32, 0, 128, 128, 32, 128, 32, 32, 16, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 64, + 0, 0, 0, 128, 0, 128, 128, 64, 0, 128, 128, 64, 128, 64, 64, 16, + 0, 0, 0, 128, 0, 128, 128, 64, 0, 128, 128, 64, 128, 64, 64, 32, + 0, 128, 128, 64, 128, 64, 64, 32, 128, 64, 64, 32, 64, 32, 32, 16, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 17, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 33, + 16, 1, 2, 1, 4, 1, 2, 33, 8, 1, 2, 33, 4, 33, 34, 17, + 64, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 65, + 16, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 17, + 32, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 33, + 16, 1, 2, 65, 4, 65, 66, 33, 8, 65, 66, 33, 68, 33, 34, 17, + 128, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 129, + 16, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 17, + 32, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 33, + 16, 1, 2, 129, 4, 129, 130, 33, 8, 129, 130, 33, 132, 33, 34, 17, + 64, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 65, + 16, 1, 2, 129, 4, 129, 130, 65, 8, 129, 130, 65, 132, 65, 66, 17, + 32, 1, 2, 129, 4, 129, 130, 65, 8, 129, 130, 65, 132, 65, 66, 33, + 16, 129, 130, 65, 132, 65, 66, 33, 136, 65, 66, 33, 68, 33, 34, 17, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 2, + 0, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 18, + 0, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 34, + 32, 16, 16, 2, 16, 4, 4, 34, 16, 8, 8, 34, 8, 36, 36, 18, + 0, 64, 64, 2, 64, 4, 4, 2, 64, 8, 8, 2, 8, 4, 4, 66, + 64, 16, 16, 2, 16, 4, 4, 66, 16, 8, 8, 66, 8, 68, 68, 18, + 64, 32, 32, 2, 32, 4, 4, 66, 32, 8, 8, 66, 8, 68, 68, 34, + 32, 16, 16, 66, 16, 68, 68, 34, 16, 72, 72, 34, 72, 36, 36, 18, + 0, 128, 128, 2, 128, 4, 4, 2, 128, 8, 8, 2, 8, 4, 4, 130, + 128, 16, 16, 2, 16, 4, 4, 130, 16, 8, 8, 130, 8, 132, 132, 18, + 128, 32, 32, 2, 32, 4, 4, 130, 32, 8, 8, 130, 8, 132, 132, 34, + 32, 16, 16, 130, 16, 132, 132, 34, 16, 136, 136, 34, 136, 36, 36, 18, + 128, 64, 64, 2, 64, 4, 4, 130, 64, 8, 8, 130, 8, 132, 132, 66, + 64, 16, 16, 130, 16, 132, 132, 66, 16, 136, 136, 66, 136, 68, 68, 18, + 64, 32, 32, 130, 32, 132, 132, 66, 32, 136, 136, 66, 136, 68, 68, 34, + 32, 144, 144, 66, 144, 68, 68, 34, 144, 72, 72, 34, 72, 36, 36, 18, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 3, + 16, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 19, + 32, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 35, + 48, 17, 18, 3, 20, 5, 6, 35, 24, 9, 10, 35, 12, 37, 38, 19, + 64, 65, 66, 3, 68, 5, 6, 3, 72, 9, 10, 3, 12, 5, 6, 67, + 80, 17, 18, 3, 20, 5, 6, 67, 24, 9, 10, 67, 12, 69, 70, 19, + 96, 33, 34, 3, 36, 5, 6, 67, 40, 9, 10, 67, 12, 69, 70, 35, + 48, 17, 18, 67, 20, 69, 70, 35, 24, 73, 74, 35, 76, 37, 38, 19, + 128, 129, 130, 3, 132, 5, 6, 3, 136, 9, 10, 3, 12, 5, 6, 131, + 144, 17, 18, 3, 20, 5, 6, 131, 24, 9, 10, 131, 12, 133, 134, 19, + 160, 33, 34, 3, 36, 5, 6, 131, 40, 9, 10, 131, 12, 133, 134, 35, + 48, 17, 18, 131, 20, 133, 134, 35, 24, 137, 138, 35, 140, 37, 38, 19, + 192, 65, 66, 3, 68, 5, 6, 131, 72, 9, 10, 131, 12, 133, 134, 67, + 80, 17, 18, 131, 20, 133, 134, 67, 24, 137, 138, 67, 140, 69, 70, 19, + 96, 33, 34, 131, 36, 133, 134, 67, 40, 137, 138, 67, 140, 69, 70, 35, + 48, 145, 146, 67, 148, 69, 70, 35, 152, 73, 74, 35, 76, 37, 38, 19, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 4, + 0, 0, 0, 16, 0, 16, 16, 4, 0, 16, 16, 8, 16, 8, 8, 20, + 0, 0, 0, 32, 0, 32, 32, 4, 0, 32, 32, 8, 32, 8, 8, 36, + 0, 32, 32, 16, 32, 16, 16, 36, 32, 16, 16, 40, 16, 40, 40, 20, + 0, 0, 0, 64, 0, 64, 64, 4, 0, 64, 64, 8, 64, 8, 8, 68, + 0, 64, 64, 16, 64, 16, 16, 68, 64, 16, 16, 72, 16, 72, 72, 20, + 0, 64, 64, 32, 64, 32, 32, 68, 64, 32, 32, 72, 32, 72, 72, 36, + 64, 32, 32, 80, 32, 80, 80, 36, 32, 80, 80, 40, 80, 40, 40, 20, + 0, 0, 0, 128, 0, 128, 128, 4, 0, 128, 128, 8, 128, 8, 8, 132, + 0, 128, 128, 16, 128, 16, 16, 132, 128, 16, 16, 136, 16, 136, 136, 20, + 0, 128, 128, 32, 128, 32, 32, 132, 128, 32, 32, 136, 32, 136, 136, 36, + 128, 32, 32, 144, 32, 144, 144, 36, 32, 144, 144, 40, 144, 40, 40, 20, + 0, 128, 128, 64, 128, 64, 64, 132, 128, 64, 64, 136, 64, 136, 136, 68, + 128, 64, 64, 144, 64, 144, 144, 68, 64, 144, 144, 72, 144, 72, 72, 20, + 128, 64, 64, 160, 64, 160, 160, 68, 64, 160, 160, 72, 160, 72, 72, 36, + 64, 160, 160, 80, 160, 80, 80, 36, 160, 80, 80, 40, 80, 40, 40, 20, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 5, + 16, 1, 2, 17, 4, 17, 18, 5, 8, 17, 18, 9, 20, 9, 10, 21, + 32, 1, 2, 33, 4, 33, 34, 5, 8, 33, 34, 9, 36, 9, 10, 37, + 16, 33, 34, 17, 36, 17, 18, 37, 40, 17, 18, 41, 20, 41, 42, 21, + 64, 1, 2, 65, 4, 65, 66, 5, 8, 65, 66, 9, 68, 9, 10, 69, + 16, 65, 66, 17, 68, 17, 18, 69, 72, 17, 18, 73, 20, 73, 74, 21, + 32, 65, 66, 33, 68, 33, 34, 69, 72, 33, 34, 73, 36, 73, 74, 37, + 80, 33, 34, 81, 36, 81, 82, 37, 40, 81, 82, 41, 84, 41, 42, 21, + 128, 1, 2, 129, 4, 129, 130, 5, 8, 129, 130, 9, 132, 9, 10, 133, + 16, 129, 130, 17, 132, 17, 18, 133, 136, 17, 18, 137, 20, 137, 138, 21, + 32, 129, 130, 33, 132, 33, 34, 133, 136, 33, 34, 137, 36, 137, 138, 37, + 144, 33, 34, 145, 36, 145, 146, 37, 40, 145, 146, 41, 148, 41, 42, 21, + 64, 129, 130, 65, 132, 65, 66, 133, 136, 65, 66, 137, 68, 137, 138, 69, + 144, 65, 66, 145, 68, 145, 146, 69, 72, 145, 146, 73, 148, 73, 74, 21, + 160, 65, 66, 161, 68, 161, 162, 69, 72, 161, 162, 73, 164, 73, 74, 37, + 80, 161, 162, 81, 164, 81, 82, 37, 168, 81, 82, 41, 84, 41, 42, 21, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 6, + 0, 16, 16, 18, 16, 20, 20, 6, 16, 24, 24, 10, 24, 12, 12, 22, + 0, 32, 32, 34, 32, 36, 36, 6, 32, 40, 40, 10, 40, 12, 12, 38, + 32, 48, 48, 18, 48, 20, 20, 38, 48, 24, 24, 42, 24, 44, 44, 22, + 0, 64, 64, 66, 64, 68, 68, 6, 64, 72, 72, 10, 72, 12, 12, 70, + 64, 80, 80, 18, 80, 20, 20, 70, 80, 24, 24, 74, 24, 76, 76, 22, + 64, 96, 96, 34, 96, 36, 36, 70, 96, 40, 40, 74, 40, 76, 76, 38, + 96, 48, 48, 82, 48, 84, 84, 38, 48, 88, 88, 42, 88, 44, 44, 22, + 0, 128, 128, 130, 128, 132, 132, 6, 128, 136, 136, 10, 136, 12, 12, 134, + 128, 144, 144, 18, 144, 20, 20, 134, 144, 24, 24, 138, 24, 140, 140, 22, + 128, 160, 160, 34, 160, 36, 36, 134, 160, 40, 40, 138, 40, 140, 140, 38, + 160, 48, 48, 146, 48, 148, 148, 38, 48, 152, 152, 42, 152, 44, 44, 22, + 128, 192, 192, 66, 192, 68, 68, 134, 192, 72, 72, 138, 72, 140, 140, 70, + 192, 80, 80, 146, 80, 148, 148, 70, 80, 152, 152, 74, 152, 76, 76, 22, + 192, 96, 96, 162, 96, 164, 164, 70, 96, 168, 168, 74, 168, 76, 76, 38, + 96, 176, 176, 82, 176, 84, 84, 38, 176, 88, 88, 42, 88, 44, 44, 22, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 7, + 16, 17, 18, 19, 20, 21, 22, 7, 24, 25, 26, 11, 28, 13, 14, 23, + 32, 33, 34, 35, 36, 37, 38, 7, 40, 41, 42, 11, 44, 13, 14, 39, + 48, 49, 50, 19, 52, 21, 22, 39, 56, 25, 26, 43, 28, 45, 46, 23, + 64, 65, 66, 67, 68, 69, 70, 7, 72, 73, 74, 11, 76, 13, 14, 71, + 80, 81, 82, 19, 84, 21, 22, 71, 88, 25, 26, 75, 28, 77, 78, 23, + 96, 97, 98, 35, 100, 37, 38, 71, 104, 41, 42, 75, 44, 77, 78, 39, + 112, 49, 50, 83, 52, 85, 86, 39, 56, 89, 90, 43, 92, 45, 46, 23, + 128, 129, 130, 131, 132, 133, 134, 7, 136, 137, 138, 11, 140, 13, 14, 135, + 144, 145, 146, 19, 148, 21, 22, 135, 152, 25, 26, 139, 28, 141, 142, 23, + 160, 161, 162, 35, 164, 37, 38, 135, 168, 41, 42, 139, 44, 141, 142, 39, + 176, 49, 50, 147, 52, 149, 150, 39, 56, 153, 154, 43, 156, 45, 46, 23, + 192, 193, 194, 67, 196, 69, 70, 135, 200, 73, 74, 139, 76, 141, 142, 71, + 208, 81, 82, 147, 84, 149, 150, 71, 88, 153, 154, 75, 156, 77, 78, 23, + 224, 97, 98, 163, 100, 165, 166, 71, 104, 169, 170, 75, 172, 77, 78, 39, + 112, 177, 178, 83, 180, 85, 86, 39, 184, 89, 90, 43, 92, 45, 46, 23, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, + 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 16, 0, 16, 16, 24, + 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 32, 0, 32, 32, 40, + 0, 0, 0, 32, 0, 32, 32, 48, 0, 32, 32, 48, 32, 48, 48, 24, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 72, + 0, 0, 0, 64, 0, 64, 64, 80, 0, 64, 64, 80, 64, 80, 80, 24, + 0, 0, 0, 64, 0, 64, 64, 96, 0, 64, 64, 96, 64, 96, 96, 40, + 0, 64, 64, 96, 64, 96, 96, 48, 64, 96, 96, 48, 96, 48, 48, 24, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 136, + 0, 0, 0, 128, 0, 128, 128, 144, 0, 128, 128, 144, 128, 144, 144, 24, + 0, 0, 0, 128, 0, 128, 128, 160, 0, 128, 128, 160, 128, 160, 160, 40, + 0, 128, 128, 160, 128, 160, 160, 48, 128, 160, 160, 48, 160, 48, 48, 24, + 0, 0, 0, 128, 0, 128, 128, 192, 0, 128, 128, 192, 128, 192, 192, 72, + 0, 128, 128, 192, 128, 192, 192, 80, 128, 192, 192, 80, 192, 80, 80, 24, + 0, 128, 128, 192, 128, 192, 192, 96, 128, 192, 192, 96, 192, 96, 96, 40, + 128, 192, 192, 96, 192, 96, 96, 48, 192, 96, 96, 48, 96, 48, 48, 24, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 9, + 16, 1, 2, 1, 4, 1, 2, 17, 8, 1, 2, 17, 4, 17, 18, 25, + 32, 1, 2, 1, 4, 1, 2, 33, 8, 1, 2, 33, 4, 33, 34, 41, + 16, 1, 2, 33, 4, 33, 34, 49, 8, 33, 34, 49, 36, 49, 50, 25, + 64, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 73, + 16, 1, 2, 65, 4, 65, 66, 81, 8, 65, 66, 81, 68, 81, 82, 25, + 32, 1, 2, 65, 4, 65, 66, 97, 8, 65, 66, 97, 68, 97, 98, 41, + 16, 65, 66, 97, 68, 97, 98, 49, 72, 97, 98, 49, 100, 49, 50, 25, + 128, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 137, + 16, 1, 2, 129, 4, 129, 130, 145, 8, 129, 130, 145, 132, 145, 146, 25, + 32, 1, 2, 129, 4, 129, 130, 161, 8, 129, 130, 161, 132, 161, 162, 41, + 16, 129, 130, 161, 132, 161, 162, 49, 136, 161, 162, 49, 164, 49, 50, 25, + 64, 1, 2, 129, 4, 129, 130, 193, 8, 129, 130, 193, 132, 193, 194, 73, + 16, 129, 130, 193, 132, 193, 194, 81, 136, 193, 194, 81, 196, 81, 82, 25, + 32, 129, 130, 193, 132, 193, 194, 97, 136, 193, 194, 97, 196, 97, 98, 41, + 144, 193, 194, 97, 196, 97, 98, 49, 200, 97, 98, 49, 100, 49, 50, 25, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 10, + 0, 16, 16, 2, 16, 4, 4, 18, 16, 8, 8, 18, 8, 20, 20, 26, + 0, 32, 32, 2, 32, 4, 4, 34, 32, 8, 8, 34, 8, 36, 36, 42, + 32, 16, 16, 34, 16, 36, 36, 50, 16, 40, 40, 50, 40, 52, 52, 26, + 0, 64, 64, 2, 64, 4, 4, 66, 64, 8, 8, 66, 8, 68, 68, 74, + 64, 16, 16, 66, 16, 68, 68, 82, 16, 72, 72, 82, 72, 84, 84, 26, + 64, 32, 32, 66, 32, 68, 68, 98, 32, 72, 72, 98, 72, 100, 100, 42, + 32, 80, 80, 98, 80, 100, 100, 50, 80, 104, 104, 50, 104, 52, 52, 26, + 0, 128, 128, 2, 128, 4, 4, 130, 128, 8, 8, 130, 8, 132, 132, 138, + 128, 16, 16, 130, 16, 132, 132, 146, 16, 136, 136, 146, 136, 148, 148, 26, + 128, 32, 32, 130, 32, 132, 132, 162, 32, 136, 136, 162, 136, 164, 164, 42, + 32, 144, 144, 162, 144, 164, 164, 50, 144, 168, 168, 50, 168, 52, 52, 26, + 128, 64, 64, 130, 64, 132, 132, 194, 64, 136, 136, 194, 136, 196, 196, 74, + 64, 144, 144, 194, 144, 196, 196, 82, 144, 200, 200, 82, 200, 84, 84, 26, + 64, 160, 160, 194, 160, 196, 196, 98, 160, 200, 200, 98, 200, 100, 100, 42, + 160, 208, 208, 98, 208, 100, 100, 50, 208, 104, 104, 50, 104, 52, 52, 26, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 11, + 16, 17, 18, 3, 20, 5, 6, 19, 24, 9, 10, 19, 12, 21, 22, 27, + 32, 33, 34, 3, 36, 5, 6, 35, 40, 9, 10, 35, 12, 37, 38, 43, + 48, 17, 18, 35, 20, 37, 38, 51, 24, 41, 42, 51, 44, 53, 54, 27, + 64, 65, 66, 3, 68, 5, 6, 67, 72, 9, 10, 67, 12, 69, 70, 75, + 80, 17, 18, 67, 20, 69, 70, 83, 24, 73, 74, 83, 76, 85, 86, 27, + 96, 33, 34, 67, 36, 69, 70, 99, 40, 73, 74, 99, 76, 101, 102, 43, + 48, 81, 82, 99, 84, 101, 102, 51, 88, 105, 106, 51, 108, 53, 54, 27, + 128, 129, 130, 3, 132, 5, 6, 131, 136, 9, 10, 131, 12, 133, 134, 139, + 144, 17, 18, 131, 20, 133, 134, 147, 24, 137, 138, 147, 140, 149, 150, 27, + 160, 33, 34, 131, 36, 133, 134, 163, 40, 137, 138, 163, 140, 165, 166, 43, + 48, 145, 146, 163, 148, 165, 166, 51, 152, 169, 170, 51, 172, 53, 54, 27, + 192, 65, 66, 131, 68, 133, 134, 195, 72, 137, 138, 195, 140, 197, 198, 75, + 80, 145, 146, 195, 148, 197, 198, 83, 152, 201, 202, 83, 204, 85, 86, 27, + 96, 161, 162, 195, 164, 197, 198, 99, 168, 201, 202, 99, 204, 101, 102, 43, + 176, 209, 210, 99, 212, 101, 102, 51, 216, 105, 106, 51, 108, 53, 54, 27, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 12, + 0, 0, 0, 16, 0, 16, 16, 20, 0, 16, 16, 24, 16, 24, 24, 28, + 0, 0, 0, 32, 0, 32, 32, 36, 0, 32, 32, 40, 32, 40, 40, 44, + 0, 32, 32, 48, 32, 48, 48, 52, 32, 48, 48, 56, 48, 56, 56, 28, + 0, 0, 0, 64, 0, 64, 64, 68, 0, 64, 64, 72, 64, 72, 72, 76, + 0, 64, 64, 80, 64, 80, 80, 84, 64, 80, 80, 88, 80, 88, 88, 28, + 0, 64, 64, 96, 64, 96, 96, 100, 64, 96, 96, 104, 96, 104, 104, 44, + 64, 96, 96, 112, 96, 112, 112, 52, 96, 112, 112, 56, 112, 56, 56, 28, + 0, 0, 0, 128, 0, 128, 128, 132, 0, 128, 128, 136, 128, 136, 136, 140, + 0, 128, 128, 144, 128, 144, 144, 148, 128, 144, 144, 152, 144, 152, 152, 28, + 0, 128, 128, 160, 128, 160, 160, 164, 128, 160, 160, 168, 160, 168, 168, 44, + 128, 160, 160, 176, 160, 176, 176, 52, 160, 176, 176, 56, 176, 56, 56, 28, + 0, 128, 128, 192, 128, 192, 192, 196, 128, 192, 192, 200, 192, 200, 200, 76, + 128, 192, 192, 208, 192, 208, 208, 84, 192, 208, 208, 88, 208, 88, 88, 28, + 128, 192, 192, 224, 192, 224, 224, 100, 192, 224, 224, 104, 224, 104, 104, 44, + 192, 224, 224, 112, 224, 112, 112, 52, 224, 112, 112, 56, 112, 56, 56, 28, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 13, + 16, 1, 2, 17, 4, 17, 18, 21, 8, 17, 18, 25, 20, 25, 26, 29, + 32, 1, 2, 33, 4, 33, 34, 37, 8, 33, 34, 41, 36, 41, 42, 45, + 16, 33, 34, 49, 36, 49, 50, 53, 40, 49, 50, 57, 52, 57, 58, 29, + 64, 1, 2, 65, 4, 65, 66, 69, 8, 65, 66, 73, 68, 73, 74, 77, + 16, 65, 66, 81, 68, 81, 82, 85, 72, 81, 82, 89, 84, 89, 90, 29, + 32, 65, 66, 97, 68, 97, 98, 101, 72, 97, 98, 105, 100, 105, 106, 45, + 80, 97, 98, 113, 100, 113, 114, 53, 104, 113, 114, 57, 116, 57, 58, 29, + 128, 1, 2, 129, 4, 129, 130, 133, 8, 129, 130, 137, 132, 137, 138, 141, + 16, 129, 130, 145, 132, 145, 146, 149, 136, 145, 146, 153, 148, 153, 154, 29, + 32, 129, 130, 161, 132, 161, 162, 165, 136, 161, 162, 169, 164, 169, 170, 45, + 144, 161, 162, 177, 164, 177, 178, 53, 168, 177, 178, 57, 180, 57, 58, 29, + 64, 129, 130, 193, 132, 193, 194, 197, 136, 193, 194, 201, 196, 201, 202, 77, + 144, 193, 194, 209, 196, 209, 210, 85, 200, 209, 210, 89, 212, 89, 90, 29, + 160, 193, 194, 225, 196, 225, 226, 101, 200, 225, 226, 105, 228, 105, 106, 45, + 208, 225, 226, 113, 228, 113, 114, 53, 232, 113, 114, 57, 116, 57, 58, 29, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 14, + 0, 16, 16, 18, 16, 20, 20, 22, 16, 24, 24, 26, 24, 28, 28, 30, + 0, 32, 32, 34, 32, 36, 36, 38, 32, 40, 40, 42, 40, 44, 44, 46, + 32, 48, 48, 50, 48, 52, 52, 54, 48, 56, 56, 58, 56, 60, 60, 30, + 0, 64, 64, 66, 64, 68, 68, 70, 64, 72, 72, 74, 72, 76, 76, 78, + 64, 80, 80, 82, 80, 84, 84, 86, 80, 88, 88, 90, 88, 92, 92, 30, + 64, 96, 96, 98, 96, 100, 100, 102, 96, 104, 104, 106, 104, 108, 108, 46, + 96, 112, 112, 114, 112, 116, 116, 54, 112, 120, 120, 58, 120, 60, 60, 30, + 0, 128, 128, 130, 128, 132, 132, 134, 128, 136, 136, 138, 136, 140, 140, 142, + 128, 144, 144, 146, 144, 148, 148, 150, 144, 152, 152, 154, 152, 156, 156, 30, + 128, 160, 160, 162, 160, 164, 164, 166, 160, 168, 168, 170, 168, 172, 172, 46, + 160, 176, 176, 178, 176, 180, 180, 54, 176, 184, 184, 58, 184, 60, 60, 30, + 128, 192, 192, 194, 192, 196, 196, 198, 192, 200, 200, 202, 200, 204, 204, 78, + 192, 208, 208, 210, 208, 212, 212, 86, 208, 216, 216, 90, 216, 92, 92, 30, + 192, 224, 224, 226, 224, 228, 228, 102, 224, 232, 232, 106, 232, 108, 108, 46, + 224, 240, 240, 114, 240, 116, 116, 54, 240, 120, 120, 58, 120, 60, 60, 30, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 31, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 31, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 47, + 112, 113, 114, 115, 116, 117, 118, 55, 120, 121, 122, 59, 124, 61, 62, 31, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 31, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 47, + 176, 177, 178, 179, 180, 181, 182, 55, 184, 185, 186, 59, 188, 61, 62, 31, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 79, + 208, 209, 210, 211, 212, 213, 214, 87, 216, 217, 218, 91, 220, 93, 94, 31, + 224, 225, 226, 227, 228, 229, 230, 103, 232, 233, 234, 107, 236, 109, 110, 47, + 240, 241, 242, 115, 244, 117, 118, 55, 248, 121, 122, 59, 124, 61, 62, 31, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 32, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 32, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 64, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 64, + 0, 0, 0, 128, 0, 128, 128, 64, 0, 128, 128, 64, 128, 64, 64, 32, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 33, + 64, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 65, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 65, + 16, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 33, + 128, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 129, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 129, + 16, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 33, + 64, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 129, + 16, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 65, + 32, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 65, + 16, 1, 2, 129, 4, 129, 130, 65, 8, 129, 130, 65, 132, 65, 66, 33, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 2, + 0, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 2, + 0, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 2, + 32, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 34, + 0, 64, 64, 2, 64, 4, 4, 2, 64, 8, 8, 2, 8, 4, 4, 2, + 64, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 66, + 64, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 66, + 32, 16, 16, 2, 16, 4, 4, 66, 16, 8, 8, 66, 8, 68, 68, 34, + 0, 128, 128, 2, 128, 4, 4, 2, 128, 8, 8, 2, 8, 4, 4, 2, + 128, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 130, + 128, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 130, + 32, 16, 16, 2, 16, 4, 4, 130, 16, 8, 8, 130, 8, 132, 132, 34, + 128, 64, 64, 2, 64, 4, 4, 2, 64, 8, 8, 2, 8, 4, 4, 130, + 64, 16, 16, 2, 16, 4, 4, 130, 16, 8, 8, 130, 8, 132, 132, 66, + 64, 32, 32, 2, 32, 4, 4, 130, 32, 8, 8, 130, 8, 132, 132, 66, + 32, 16, 16, 130, 16, 132, 132, 66, 16, 136, 136, 66, 136, 68, 68, 34, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 3, + 16, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 3, + 32, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 3, + 48, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 35, + 64, 65, 66, 3, 68, 5, 6, 3, 72, 9, 10, 3, 12, 5, 6, 3, + 80, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 67, + 96, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 67, + 48, 17, 18, 3, 20, 5, 6, 67, 24, 9, 10, 67, 12, 69, 70, 35, + 128, 129, 130, 3, 132, 5, 6, 3, 136, 9, 10, 3, 12, 5, 6, 3, + 144, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 131, + 160, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 131, + 48, 17, 18, 3, 20, 5, 6, 131, 24, 9, 10, 131, 12, 133, 134, 35, + 192, 65, 66, 3, 68, 5, 6, 3, 72, 9, 10, 3, 12, 5, 6, 131, + 80, 17, 18, 3, 20, 5, 6, 131, 24, 9, 10, 131, 12, 133, 134, 67, + 96, 33, 34, 3, 36, 5, 6, 131, 40, 9, 10, 131, 12, 133, 134, 67, + 48, 17, 18, 131, 20, 133, 134, 67, 24, 137, 138, 67, 140, 69, 70, 35, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 4, + 0, 0, 0, 16, 0, 16, 16, 4, 0, 16, 16, 8, 16, 8, 8, 4, + 0, 0, 0, 32, 0, 32, 32, 4, 0, 32, 32, 8, 32, 8, 8, 4, + 0, 32, 32, 16, 32, 16, 16, 4, 32, 16, 16, 8, 16, 8, 8, 36, + 0, 0, 0, 64, 0, 64, 64, 4, 0, 64, 64, 8, 64, 8, 8, 4, + 0, 64, 64, 16, 64, 16, 16, 4, 64, 16, 16, 8, 16, 8, 8, 68, + 0, 64, 64, 32, 64, 32, 32, 4, 64, 32, 32, 8, 32, 8, 8, 68, + 64, 32, 32, 16, 32, 16, 16, 68, 32, 16, 16, 72, 16, 72, 72, 36, + 0, 0, 0, 128, 0, 128, 128, 4, 0, 128, 128, 8, 128, 8, 8, 4, + 0, 128, 128, 16, 128, 16, 16, 4, 128, 16, 16, 8, 16, 8, 8, 132, + 0, 128, 128, 32, 128, 32, 32, 4, 128, 32, 32, 8, 32, 8, 8, 132, + 128, 32, 32, 16, 32, 16, 16, 132, 32, 16, 16, 136, 16, 136, 136, 36, + 0, 128, 128, 64, 128, 64, 64, 4, 128, 64, 64, 8, 64, 8, 8, 132, + 128, 64, 64, 16, 64, 16, 16, 132, 64, 16, 16, 136, 16, 136, 136, 68, + 128, 64, 64, 32, 64, 32, 32, 132, 64, 32, 32, 136, 32, 136, 136, 68, + 64, 32, 32, 144, 32, 144, 144, 68, 32, 144, 144, 72, 144, 72, 72, 36, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 5, + 16, 1, 2, 17, 4, 17, 18, 5, 8, 17, 18, 9, 20, 9, 10, 5, + 32, 1, 2, 33, 4, 33, 34, 5, 8, 33, 34, 9, 36, 9, 10, 5, + 16, 33, 34, 17, 36, 17, 18, 5, 40, 17, 18, 9, 20, 9, 10, 37, + 64, 1, 2, 65, 4, 65, 66, 5, 8, 65, 66, 9, 68, 9, 10, 5, + 16, 65, 66, 17, 68, 17, 18, 5, 72, 17, 18, 9, 20, 9, 10, 69, + 32, 65, 66, 33, 68, 33, 34, 5, 72, 33, 34, 9, 36, 9, 10, 69, + 80, 33, 34, 17, 36, 17, 18, 69, 40, 17, 18, 73, 20, 73, 74, 37, + 128, 1, 2, 129, 4, 129, 130, 5, 8, 129, 130, 9, 132, 9, 10, 5, + 16, 129, 130, 17, 132, 17, 18, 5, 136, 17, 18, 9, 20, 9, 10, 133, + 32, 129, 130, 33, 132, 33, 34, 5, 136, 33, 34, 9, 36, 9, 10, 133, + 144, 33, 34, 17, 36, 17, 18, 133, 40, 17, 18, 137, 20, 137, 138, 37, + 64, 129, 130, 65, 132, 65, 66, 5, 136, 65, 66, 9, 68, 9, 10, 133, + 144, 65, 66, 17, 68, 17, 18, 133, 72, 17, 18, 137, 20, 137, 138, 69, + 160, 65, 66, 33, 68, 33, 34, 133, 72, 33, 34, 137, 36, 137, 138, 69, + 80, 33, 34, 145, 36, 145, 146, 69, 40, 145, 146, 73, 148, 73, 74, 37, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 6, + 0, 16, 16, 18, 16, 20, 20, 6, 16, 24, 24, 10, 24, 12, 12, 6, + 0, 32, 32, 34, 32, 36, 36, 6, 32, 40, 40, 10, 40, 12, 12, 6, + 32, 48, 48, 18, 48, 20, 20, 6, 48, 24, 24, 10, 24, 12, 12, 38, + 0, 64, 64, 66, 64, 68, 68, 6, 64, 72, 72, 10, 72, 12, 12, 6, + 64, 80, 80, 18, 80, 20, 20, 6, 80, 24, 24, 10, 24, 12, 12, 70, + 64, 96, 96, 34, 96, 36, 36, 6, 96, 40, 40, 10, 40, 12, 12, 70, + 96, 48, 48, 18, 48, 20, 20, 70, 48, 24, 24, 74, 24, 76, 76, 38, + 0, 128, 128, 130, 128, 132, 132, 6, 128, 136, 136, 10, 136, 12, 12, 6, + 128, 144, 144, 18, 144, 20, 20, 6, 144, 24, 24, 10, 24, 12, 12, 134, + 128, 160, 160, 34, 160, 36, 36, 6, 160, 40, 40, 10, 40, 12, 12, 134, + 160, 48, 48, 18, 48, 20, 20, 134, 48, 24, 24, 138, 24, 140, 140, 38, + 128, 192, 192, 66, 192, 68, 68, 6, 192, 72, 72, 10, 72, 12, 12, 134, + 192, 80, 80, 18, 80, 20, 20, 134, 80, 24, 24, 138, 24, 140, 140, 70, + 192, 96, 96, 34, 96, 36, 36, 134, 96, 40, 40, 138, 40, 140, 140, 70, + 96, 48, 48, 146, 48, 148, 148, 70, 48, 152, 152, 74, 152, 76, 76, 38, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 7, + 16, 17, 18, 19, 20, 21, 22, 7, 24, 25, 26, 11, 28, 13, 14, 7, + 32, 33, 34, 35, 36, 37, 38, 7, 40, 41, 42, 11, 44, 13, 14, 7, + 48, 49, 50, 19, 52, 21, 22, 7, 56, 25, 26, 11, 28, 13, 14, 39, + 64, 65, 66, 67, 68, 69, 70, 7, 72, 73, 74, 11, 76, 13, 14, 7, + 80, 81, 82, 19, 84, 21, 22, 7, 88, 25, 26, 11, 28, 13, 14, 71, + 96, 97, 98, 35, 100, 37, 38, 7, 104, 41, 42, 11, 44, 13, 14, 71, + 112, 49, 50, 19, 52, 21, 22, 71, 56, 25, 26, 75, 28, 77, 78, 39, + 128, 129, 130, 131, 132, 133, 134, 7, 136, 137, 138, 11, 140, 13, 14, 7, + 144, 145, 146, 19, 148, 21, 22, 7, 152, 25, 26, 11, 28, 13, 14, 135, + 160, 161, 162, 35, 164, 37, 38, 7, 168, 41, 42, 11, 44, 13, 14, 135, + 176, 49, 50, 19, 52, 21, 22, 135, 56, 25, 26, 139, 28, 141, 142, 39, + 192, 193, 194, 67, 196, 69, 70, 7, 200, 73, 74, 11, 76, 13, 14, 135, + 208, 81, 82, 19, 84, 21, 22, 135, 88, 25, 26, 139, 28, 141, 142, 71, + 224, 97, 98, 35, 100, 37, 38, 135, 104, 41, 42, 139, 44, 141, 142, 71, + 112, 49, 50, 147, 52, 149, 150, 71, 56, 153, 154, 75, 156, 77, 78, 39, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, + 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 16, 0, 16, 16, 8, + 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 32, 0, 32, 32, 8, + 0, 0, 0, 32, 0, 32, 32, 16, 0, 32, 32, 16, 32, 16, 16, 40, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 8, + 0, 0, 0, 64, 0, 64, 64, 16, 0, 64, 64, 16, 64, 16, 16, 72, + 0, 0, 0, 64, 0, 64, 64, 32, 0, 64, 64, 32, 64, 32, 32, 72, + 0, 64, 64, 32, 64, 32, 32, 80, 64, 32, 32, 80, 32, 80, 80, 40, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 8, + 0, 0, 0, 128, 0, 128, 128, 16, 0, 128, 128, 16, 128, 16, 16, 136, + 0, 0, 0, 128, 0, 128, 128, 32, 0, 128, 128, 32, 128, 32, 32, 136, + 0, 128, 128, 32, 128, 32, 32, 144, 128, 32, 32, 144, 32, 144, 144, 40, + 0, 0, 0, 128, 0, 128, 128, 64, 0, 128, 128, 64, 128, 64, 64, 136, + 0, 128, 128, 64, 128, 64, 64, 144, 128, 64, 64, 144, 64, 144, 144, 72, + 0, 128, 128, 64, 128, 64, 64, 160, 128, 64, 64, 160, 64, 160, 160, 72, + 128, 64, 64, 160, 64, 160, 160, 80, 64, 160, 160, 80, 160, 80, 80, 40, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 9, + 16, 1, 2, 1, 4, 1, 2, 17, 8, 1, 2, 17, 4, 17, 18, 9, + 32, 1, 2, 1, 4, 1, 2, 33, 8, 1, 2, 33, 4, 33, 34, 9, + 16, 1, 2, 33, 4, 33, 34, 17, 8, 33, 34, 17, 36, 17, 18, 41, + 64, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 9, + 16, 1, 2, 65, 4, 65, 66, 17, 8, 65, 66, 17, 68, 17, 18, 73, + 32, 1, 2, 65, 4, 65, 66, 33, 8, 65, 66, 33, 68, 33, 34, 73, + 16, 65, 66, 33, 68, 33, 34, 81, 72, 33, 34, 81, 36, 81, 82, 41, + 128, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 9, + 16, 1, 2, 129, 4, 129, 130, 17, 8, 129, 130, 17, 132, 17, 18, 137, + 32, 1, 2, 129, 4, 129, 130, 33, 8, 129, 130, 33, 132, 33, 34, 137, + 16, 129, 130, 33, 132, 33, 34, 145, 136, 33, 34, 145, 36, 145, 146, 41, + 64, 1, 2, 129, 4, 129, 130, 65, 8, 129, 130, 65, 132, 65, 66, 137, + 16, 129, 130, 65, 132, 65, 66, 145, 136, 65, 66, 145, 68, 145, 146, 73, + 32, 129, 130, 65, 132, 65, 66, 161, 136, 65, 66, 161, 68, 161, 162, 73, + 144, 65, 66, 161, 68, 161, 162, 81, 72, 161, 162, 81, 164, 81, 82, 41, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 10, + 0, 16, 16, 2, 16, 4, 4, 18, 16, 8, 8, 18, 8, 20, 20, 10, + 0, 32, 32, 2, 32, 4, 4, 34, 32, 8, 8, 34, 8, 36, 36, 10, + 32, 16, 16, 34, 16, 36, 36, 18, 16, 40, 40, 18, 40, 20, 20, 42, + 0, 64, 64, 2, 64, 4, 4, 66, 64, 8, 8, 66, 8, 68, 68, 10, + 64, 16, 16, 66, 16, 68, 68, 18, 16, 72, 72, 18, 72, 20, 20, 74, + 64, 32, 32, 66, 32, 68, 68, 34, 32, 72, 72, 34, 72, 36, 36, 74, + 32, 80, 80, 34, 80, 36, 36, 82, 80, 40, 40, 82, 40, 84, 84, 42, + 0, 128, 128, 2, 128, 4, 4, 130, 128, 8, 8, 130, 8, 132, 132, 10, + 128, 16, 16, 130, 16, 132, 132, 18, 16, 136, 136, 18, 136, 20, 20, 138, + 128, 32, 32, 130, 32, 132, 132, 34, 32, 136, 136, 34, 136, 36, 36, 138, + 32, 144, 144, 34, 144, 36, 36, 146, 144, 40, 40, 146, 40, 148, 148, 42, + 128, 64, 64, 130, 64, 132, 132, 66, 64, 136, 136, 66, 136, 68, 68, 138, + 64, 144, 144, 66, 144, 68, 68, 146, 144, 72, 72, 146, 72, 148, 148, 74, + 64, 160, 160, 66, 160, 68, 68, 162, 160, 72, 72, 162, 72, 164, 164, 74, + 160, 80, 80, 162, 80, 164, 164, 82, 80, 168, 168, 82, 168, 84, 84, 42, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 11, + 16, 17, 18, 3, 20, 5, 6, 19, 24, 9, 10, 19, 12, 21, 22, 11, + 32, 33, 34, 3, 36, 5, 6, 35, 40, 9, 10, 35, 12, 37, 38, 11, + 48, 17, 18, 35, 20, 37, 38, 19, 24, 41, 42, 19, 44, 21, 22, 43, + 64, 65, 66, 3, 68, 5, 6, 67, 72, 9, 10, 67, 12, 69, 70, 11, + 80, 17, 18, 67, 20, 69, 70, 19, 24, 73, 74, 19, 76, 21, 22, 75, + 96, 33, 34, 67, 36, 69, 70, 35, 40, 73, 74, 35, 76, 37, 38, 75, + 48, 81, 82, 35, 84, 37, 38, 83, 88, 41, 42, 83, 44, 85, 86, 43, + 128, 129, 130, 3, 132, 5, 6, 131, 136, 9, 10, 131, 12, 133, 134, 11, + 144, 17, 18, 131, 20, 133, 134, 19, 24, 137, 138, 19, 140, 21, 22, 139, + 160, 33, 34, 131, 36, 133, 134, 35, 40, 137, 138, 35, 140, 37, 38, 139, + 48, 145, 146, 35, 148, 37, 38, 147, 152, 41, 42, 147, 44, 149, 150, 43, + 192, 65, 66, 131, 68, 133, 134, 67, 72, 137, 138, 67, 140, 69, 70, 139, + 80, 145, 146, 67, 148, 69, 70, 147, 152, 73, 74, 147, 76, 149, 150, 75, + 96, 161, 162, 67, 164, 69, 70, 163, 168, 73, 74, 163, 76, 165, 166, 75, + 176, 81, 82, 163, 84, 165, 166, 83, 88, 169, 170, 83, 172, 85, 86, 43, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 12, + 0, 0, 0, 16, 0, 16, 16, 20, 0, 16, 16, 24, 16, 24, 24, 12, + 0, 0, 0, 32, 0, 32, 32, 36, 0, 32, 32, 40, 32, 40, 40, 12, + 0, 32, 32, 48, 32, 48, 48, 20, 32, 48, 48, 24, 48, 24, 24, 44, + 0, 0, 0, 64, 0, 64, 64, 68, 0, 64, 64, 72, 64, 72, 72, 12, + 0, 64, 64, 80, 64, 80, 80, 20, 64, 80, 80, 24, 80, 24, 24, 76, + 0, 64, 64, 96, 64, 96, 96, 36, 64, 96, 96, 40, 96, 40, 40, 76, + 64, 96, 96, 48, 96, 48, 48, 84, 96, 48, 48, 88, 48, 88, 88, 44, + 0, 0, 0, 128, 0, 128, 128, 132, 0, 128, 128, 136, 128, 136, 136, 12, + 0, 128, 128, 144, 128, 144, 144, 20, 128, 144, 144, 24, 144, 24, 24, 140, + 0, 128, 128, 160, 128, 160, 160, 36, 128, 160, 160, 40, 160, 40, 40, 140, + 128, 160, 160, 48, 160, 48, 48, 148, 160, 48, 48, 152, 48, 152, 152, 44, + 0, 128, 128, 192, 128, 192, 192, 68, 128, 192, 192, 72, 192, 72, 72, 140, + 128, 192, 192, 80, 192, 80, 80, 148, 192, 80, 80, 152, 80, 152, 152, 76, + 128, 192, 192, 96, 192, 96, 96, 164, 192, 96, 96, 168, 96, 168, 168, 76, + 192, 96, 96, 176, 96, 176, 176, 84, 96, 176, 176, 88, 176, 88, 88, 44, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 13, + 16, 1, 2, 17, 4, 17, 18, 21, 8, 17, 18, 25, 20, 25, 26, 13, + 32, 1, 2, 33, 4, 33, 34, 37, 8, 33, 34, 41, 36, 41, 42, 13, + 16, 33, 34, 49, 36, 49, 50, 21, 40, 49, 50, 25, 52, 25, 26, 45, + 64, 1, 2, 65, 4, 65, 66, 69, 8, 65, 66, 73, 68, 73, 74, 13, + 16, 65, 66, 81, 68, 81, 82, 21, 72, 81, 82, 25, 84, 25, 26, 77, + 32, 65, 66, 97, 68, 97, 98, 37, 72, 97, 98, 41, 100, 41, 42, 77, + 80, 97, 98, 49, 100, 49, 50, 85, 104, 49, 50, 89, 52, 89, 90, 45, + 128, 1, 2, 129, 4, 129, 130, 133, 8, 129, 130, 137, 132, 137, 138, 13, + 16, 129, 130, 145, 132, 145, 146, 21, 136, 145, 146, 25, 148, 25, 26, 141, + 32, 129, 130, 161, 132, 161, 162, 37, 136, 161, 162, 41, 164, 41, 42, 141, + 144, 161, 162, 49, 164, 49, 50, 149, 168, 49, 50, 153, 52, 153, 154, 45, + 64, 129, 130, 193, 132, 193, 194, 69, 136, 193, 194, 73, 196, 73, 74, 141, + 144, 193, 194, 81, 196, 81, 82, 149, 200, 81, 82, 153, 84, 153, 154, 77, + 160, 193, 194, 97, 196, 97, 98, 165, 200, 97, 98, 169, 100, 169, 170, 77, + 208, 97, 98, 177, 100, 177, 178, 85, 104, 177, 178, 89, 180, 89, 90, 45, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 14, + 0, 16, 16, 18, 16, 20, 20, 22, 16, 24, 24, 26, 24, 28, 28, 14, + 0, 32, 32, 34, 32, 36, 36, 38, 32, 40, 40, 42, 40, 44, 44, 14, + 32, 48, 48, 50, 48, 52, 52, 22, 48, 56, 56, 26, 56, 28, 28, 46, + 0, 64, 64, 66, 64, 68, 68, 70, 64, 72, 72, 74, 72, 76, 76, 14, + 64, 80, 80, 82, 80, 84, 84, 22, 80, 88, 88, 26, 88, 28, 28, 78, + 64, 96, 96, 98, 96, 100, 100, 38, 96, 104, 104, 42, 104, 44, 44, 78, + 96, 112, 112, 50, 112, 52, 52, 86, 112, 56, 56, 90, 56, 92, 92, 46, + 0, 128, 128, 130, 128, 132, 132, 134, 128, 136, 136, 138, 136, 140, 140, 14, + 128, 144, 144, 146, 144, 148, 148, 22, 144, 152, 152, 26, 152, 28, 28, 142, + 128, 160, 160, 162, 160, 164, 164, 38, 160, 168, 168, 42, 168, 44, 44, 142, + 160, 176, 176, 50, 176, 52, 52, 150, 176, 56, 56, 154, 56, 156, 156, 46, + 128, 192, 192, 194, 192, 196, 196, 70, 192, 200, 200, 74, 200, 76, 76, 142, + 192, 208, 208, 82, 208, 84, 84, 150, 208, 88, 88, 154, 88, 156, 156, 78, + 192, 224, 224, 98, 224, 100, 100, 166, 224, 104, 104, 170, 104, 172, 172, 78, + 224, 112, 112, 178, 112, 180, 180, 86, 112, 184, 184, 90, 184, 92, 92, 46, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 15, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 15, + 48, 49, 50, 51, 52, 53, 54, 23, 56, 57, 58, 27, 60, 29, 30, 47, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 15, + 80, 81, 82, 83, 84, 85, 86, 23, 88, 89, 90, 27, 92, 29, 30, 79, + 96, 97, 98, 99, 100, 101, 102, 39, 104, 105, 106, 43, 108, 45, 46, 79, + 112, 113, 114, 51, 116, 53, 54, 87, 120, 57, 58, 91, 60, 93, 94, 47, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 15, + 144, 145, 146, 147, 148, 149, 150, 23, 152, 153, 154, 27, 156, 29, 30, 143, + 160, 161, 162, 163, 164, 165, 166, 39, 168, 169, 170, 43, 172, 45, 46, 143, + 176, 177, 178, 51, 180, 53, 54, 151, 184, 57, 58, 155, 60, 157, 158, 47, + 192, 193, 194, 195, 196, 197, 198, 71, 200, 201, 202, 75, 204, 77, 78, 143, + 208, 209, 210, 83, 212, 85, 86, 151, 216, 89, 90, 155, 92, 157, 158, 79, + 224, 225, 226, 99, 228, 101, 102, 167, 232, 105, 106, 171, 108, 173, 174, 79, + 240, 113, 114, 179, 116, 181, 182, 87, 120, 185, 186, 91, 188, 93, 94, 47, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, + 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 32, 0, 32, 32, 48, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 80, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 96, + 0, 0, 0, 64, 0, 64, 64, 96, 0, 64, 64, 96, 64, 96, 96, 48, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 144, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 160, + 0, 0, 0, 128, 0, 128, 128, 160, 0, 128, 128, 160, 128, 160, 160, 48, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 192, + 0, 0, 0, 128, 0, 128, 128, 192, 0, 128, 128, 192, 128, 192, 192, 80, + 0, 0, 0, 128, 0, 128, 128, 192, 0, 128, 128, 192, 128, 192, 192, 96, + 0, 128, 128, 192, 128, 192, 192, 96, 128, 192, 192, 96, 192, 96, 96, 48, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 17, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 33, + 16, 1, 2, 1, 4, 1, 2, 33, 8, 1, 2, 33, 4, 33, 34, 49, + 64, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 65, + 16, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 81, + 32, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 97, + 16, 1, 2, 65, 4, 65, 66, 97, 8, 65, 66, 97, 68, 97, 98, 49, + 128, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 129, + 16, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 145, + 32, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 161, + 16, 1, 2, 129, 4, 129, 130, 161, 8, 129, 130, 161, 132, 161, 162, 49, + 64, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 193, + 16, 1, 2, 129, 4, 129, 130, 193, 8, 129, 130, 193, 132, 193, 194, 81, + 32, 1, 2, 129, 4, 129, 130, 193, 8, 129, 130, 193, 132, 193, 194, 97, + 16, 129, 130, 193, 132, 193, 194, 97, 136, 193, 194, 97, 196, 97, 98, 49, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 2, + 0, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 18, + 0, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 34, + 32, 16, 16, 2, 16, 4, 4, 34, 16, 8, 8, 34, 8, 36, 36, 50, + 0, 64, 64, 2, 64, 4, 4, 2, 64, 8, 8, 2, 8, 4, 4, 66, + 64, 16, 16, 2, 16, 4, 4, 66, 16, 8, 8, 66, 8, 68, 68, 82, + 64, 32, 32, 2, 32, 4, 4, 66, 32, 8, 8, 66, 8, 68, 68, 98, + 32, 16, 16, 66, 16, 68, 68, 98, 16, 72, 72, 98, 72, 100, 100, 50, + 0, 128, 128, 2, 128, 4, 4, 2, 128, 8, 8, 2, 8, 4, 4, 130, + 128, 16, 16, 2, 16, 4, 4, 130, 16, 8, 8, 130, 8, 132, 132, 146, + 128, 32, 32, 2, 32, 4, 4, 130, 32, 8, 8, 130, 8, 132, 132, 162, + 32, 16, 16, 130, 16, 132, 132, 162, 16, 136, 136, 162, 136, 164, 164, 50, + 128, 64, 64, 2, 64, 4, 4, 130, 64, 8, 8, 130, 8, 132, 132, 194, + 64, 16, 16, 130, 16, 132, 132, 194, 16, 136, 136, 194, 136, 196, 196, 82, + 64, 32, 32, 130, 32, 132, 132, 194, 32, 136, 136, 194, 136, 196, 196, 98, + 32, 144, 144, 194, 144, 196, 196, 98, 144, 200, 200, 98, 200, 100, 100, 50, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 3, + 16, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 19, + 32, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 35, + 48, 17, 18, 3, 20, 5, 6, 35, 24, 9, 10, 35, 12, 37, 38, 51, + 64, 65, 66, 3, 68, 5, 6, 3, 72, 9, 10, 3, 12, 5, 6, 67, + 80, 17, 18, 3, 20, 5, 6, 67, 24, 9, 10, 67, 12, 69, 70, 83, + 96, 33, 34, 3, 36, 5, 6, 67, 40, 9, 10, 67, 12, 69, 70, 99, + 48, 17, 18, 67, 20, 69, 70, 99, 24, 73, 74, 99, 76, 101, 102, 51, + 128, 129, 130, 3, 132, 5, 6, 3, 136, 9, 10, 3, 12, 5, 6, 131, + 144, 17, 18, 3, 20, 5, 6, 131, 24, 9, 10, 131, 12, 133, 134, 147, + 160, 33, 34, 3, 36, 5, 6, 131, 40, 9, 10, 131, 12, 133, 134, 163, + 48, 17, 18, 131, 20, 133, 134, 163, 24, 137, 138, 163, 140, 165, 166, 51, + 192, 65, 66, 3, 68, 5, 6, 131, 72, 9, 10, 131, 12, 133, 134, 195, + 80, 17, 18, 131, 20, 133, 134, 195, 24, 137, 138, 195, 140, 197, 198, 83, + 96, 33, 34, 131, 36, 133, 134, 195, 40, 137, 138, 195, 140, 197, 198, 99, + 48, 145, 146, 195, 148, 197, 198, 99, 152, 201, 202, 99, 204, 101, 102, 51, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 4, + 0, 0, 0, 16, 0, 16, 16, 4, 0, 16, 16, 8, 16, 8, 8, 20, + 0, 0, 0, 32, 0, 32, 32, 4, 0, 32, 32, 8, 32, 8, 8, 36, + 0, 32, 32, 16, 32, 16, 16, 36, 32, 16, 16, 40, 16, 40, 40, 52, + 0, 0, 0, 64, 0, 64, 64, 4, 0, 64, 64, 8, 64, 8, 8, 68, + 0, 64, 64, 16, 64, 16, 16, 68, 64, 16, 16, 72, 16, 72, 72, 84, + 0, 64, 64, 32, 64, 32, 32, 68, 64, 32, 32, 72, 32, 72, 72, 100, + 64, 32, 32, 80, 32, 80, 80, 100, 32, 80, 80, 104, 80, 104, 104, 52, + 0, 0, 0, 128, 0, 128, 128, 4, 0, 128, 128, 8, 128, 8, 8, 132, + 0, 128, 128, 16, 128, 16, 16, 132, 128, 16, 16, 136, 16, 136, 136, 148, + 0, 128, 128, 32, 128, 32, 32, 132, 128, 32, 32, 136, 32, 136, 136, 164, + 128, 32, 32, 144, 32, 144, 144, 164, 32, 144, 144, 168, 144, 168, 168, 52, + 0, 128, 128, 64, 128, 64, 64, 132, 128, 64, 64, 136, 64, 136, 136, 196, + 128, 64, 64, 144, 64, 144, 144, 196, 64, 144, 144, 200, 144, 200, 200, 84, + 128, 64, 64, 160, 64, 160, 160, 196, 64, 160, 160, 200, 160, 200, 200, 100, + 64, 160, 160, 208, 160, 208, 208, 100, 160, 208, 208, 104, 208, 104, 104, 52, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 5, + 16, 1, 2, 17, 4, 17, 18, 5, 8, 17, 18, 9, 20, 9, 10, 21, + 32, 1, 2, 33, 4, 33, 34, 5, 8, 33, 34, 9, 36, 9, 10, 37, + 16, 33, 34, 17, 36, 17, 18, 37, 40, 17, 18, 41, 20, 41, 42, 53, + 64, 1, 2, 65, 4, 65, 66, 5, 8, 65, 66, 9, 68, 9, 10, 69, + 16, 65, 66, 17, 68, 17, 18, 69, 72, 17, 18, 73, 20, 73, 74, 85, + 32, 65, 66, 33, 68, 33, 34, 69, 72, 33, 34, 73, 36, 73, 74, 101, + 80, 33, 34, 81, 36, 81, 82, 101, 40, 81, 82, 105, 84, 105, 106, 53, + 128, 1, 2, 129, 4, 129, 130, 5, 8, 129, 130, 9, 132, 9, 10, 133, + 16, 129, 130, 17, 132, 17, 18, 133, 136, 17, 18, 137, 20, 137, 138, 149, + 32, 129, 130, 33, 132, 33, 34, 133, 136, 33, 34, 137, 36, 137, 138, 165, + 144, 33, 34, 145, 36, 145, 146, 165, 40, 145, 146, 169, 148, 169, 170, 53, + 64, 129, 130, 65, 132, 65, 66, 133, 136, 65, 66, 137, 68, 137, 138, 197, + 144, 65, 66, 145, 68, 145, 146, 197, 72, 145, 146, 201, 148, 201, 202, 85, + 160, 65, 66, 161, 68, 161, 162, 197, 72, 161, 162, 201, 164, 201, 202, 101, + 80, 161, 162, 209, 164, 209, 210, 101, 168, 209, 210, 105, 212, 105, 106, 53, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 6, + 0, 16, 16, 18, 16, 20, 20, 6, 16, 24, 24, 10, 24, 12, 12, 22, + 0, 32, 32, 34, 32, 36, 36, 6, 32, 40, 40, 10, 40, 12, 12, 38, + 32, 48, 48, 18, 48, 20, 20, 38, 48, 24, 24, 42, 24, 44, 44, 54, + 0, 64, 64, 66, 64, 68, 68, 6, 64, 72, 72, 10, 72, 12, 12, 70, + 64, 80, 80, 18, 80, 20, 20, 70, 80, 24, 24, 74, 24, 76, 76, 86, + 64, 96, 96, 34, 96, 36, 36, 70, 96, 40, 40, 74, 40, 76, 76, 102, + 96, 48, 48, 82, 48, 84, 84, 102, 48, 88, 88, 106, 88, 108, 108, 54, + 0, 128, 128, 130, 128, 132, 132, 6, 128, 136, 136, 10, 136, 12, 12, 134, + 128, 144, 144, 18, 144, 20, 20, 134, 144, 24, 24, 138, 24, 140, 140, 150, + 128, 160, 160, 34, 160, 36, 36, 134, 160, 40, 40, 138, 40, 140, 140, 166, + 160, 48, 48, 146, 48, 148, 148, 166, 48, 152, 152, 170, 152, 172, 172, 54, + 128, 192, 192, 66, 192, 68, 68, 134, 192, 72, 72, 138, 72, 140, 140, 198, + 192, 80, 80, 146, 80, 148, 148, 198, 80, 152, 152, 202, 152, 204, 204, 86, + 192, 96, 96, 162, 96, 164, 164, 198, 96, 168, 168, 202, 168, 204, 204, 102, + 96, 176, 176, 210, 176, 212, 212, 102, 176, 216, 216, 106, 216, 108, 108, 54, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 7, + 16, 17, 18, 19, 20, 21, 22, 7, 24, 25, 26, 11, 28, 13, 14, 23, + 32, 33, 34, 35, 36, 37, 38, 7, 40, 41, 42, 11, 44, 13, 14, 39, + 48, 49, 50, 19, 52, 21, 22, 39, 56, 25, 26, 43, 28, 45, 46, 55, + 64, 65, 66, 67, 68, 69, 70, 7, 72, 73, 74, 11, 76, 13, 14, 71, + 80, 81, 82, 19, 84, 21, 22, 71, 88, 25, 26, 75, 28, 77, 78, 87, + 96, 97, 98, 35, 100, 37, 38, 71, 104, 41, 42, 75, 44, 77, 78, 103, + 112, 49, 50, 83, 52, 85, 86, 103, 56, 89, 90, 107, 92, 109, 110, 55, + 128, 129, 130, 131, 132, 133, 134, 7, 136, 137, 138, 11, 140, 13, 14, 135, + 144, 145, 146, 19, 148, 21, 22, 135, 152, 25, 26, 139, 28, 141, 142, 151, + 160, 161, 162, 35, 164, 37, 38, 135, 168, 41, 42, 139, 44, 141, 142, 167, + 176, 49, 50, 147, 52, 149, 150, 167, 56, 153, 154, 171, 156, 173, 174, 55, + 192, 193, 194, 67, 196, 69, 70, 135, 200, 73, 74, 139, 76, 141, 142, 199, + 208, 81, 82, 147, 84, 149, 150, 199, 88, 153, 154, 203, 156, 205, 206, 87, + 224, 97, 98, 163, 100, 165, 166, 199, 104, 169, 170, 203, 172, 205, 206, 103, + 112, 177, 178, 211, 180, 213, 214, 103, 184, 217, 218, 107, 220, 109, 110, 55, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, + 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 16, 0, 16, 16, 24, + 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 32, 0, 32, 32, 40, + 0, 0, 0, 32, 0, 32, 32, 48, 0, 32, 32, 48, 32, 48, 48, 56, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 72, + 0, 0, 0, 64, 0, 64, 64, 80, 0, 64, 64, 80, 64, 80, 80, 88, + 0, 0, 0, 64, 0, 64, 64, 96, 0, 64, 64, 96, 64, 96, 96, 104, + 0, 64, 64, 96, 64, 96, 96, 112, 64, 96, 96, 112, 96, 112, 112, 56, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 136, + 0, 0, 0, 128, 0, 128, 128, 144, 0, 128, 128, 144, 128, 144, 144, 152, + 0, 0, 0, 128, 0, 128, 128, 160, 0, 128, 128, 160, 128, 160, 160, 168, + 0, 128, 128, 160, 128, 160, 160, 176, 128, 160, 160, 176, 160, 176, 176, 56, + 0, 0, 0, 128, 0, 128, 128, 192, 0, 128, 128, 192, 128, 192, 192, 200, + 0, 128, 128, 192, 128, 192, 192, 208, 128, 192, 192, 208, 192, 208, 208, 88, + 0, 128, 128, 192, 128, 192, 192, 224, 128, 192, 192, 224, 192, 224, 224, 104, + 128, 192, 192, 224, 192, 224, 224, 112, 192, 224, 224, 112, 224, 112, 112, 56, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 9, + 16, 1, 2, 1, 4, 1, 2, 17, 8, 1, 2, 17, 4, 17, 18, 25, + 32, 1, 2, 1, 4, 1, 2, 33, 8, 1, 2, 33, 4, 33, 34, 41, + 16, 1, 2, 33, 4, 33, 34, 49, 8, 33, 34, 49, 36, 49, 50, 57, + 64, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 73, + 16, 1, 2, 65, 4, 65, 66, 81, 8, 65, 66, 81, 68, 81, 82, 89, + 32, 1, 2, 65, 4, 65, 66, 97, 8, 65, 66, 97, 68, 97, 98, 105, + 16, 65, 66, 97, 68, 97, 98, 113, 72, 97, 98, 113, 100, 113, 114, 57, + 128, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 137, + 16, 1, 2, 129, 4, 129, 130, 145, 8, 129, 130, 145, 132, 145, 146, 153, + 32, 1, 2, 129, 4, 129, 130, 161, 8, 129, 130, 161, 132, 161, 162, 169, + 16, 129, 130, 161, 132, 161, 162, 177, 136, 161, 162, 177, 164, 177, 178, 57, + 64, 1, 2, 129, 4, 129, 130, 193, 8, 129, 130, 193, 132, 193, 194, 201, + 16, 129, 130, 193, 132, 193, 194, 209, 136, 193, 194, 209, 196, 209, 210, 89, + 32, 129, 130, 193, 132, 193, 194, 225, 136, 193, 194, 225, 196, 225, 226, 105, + 144, 193, 194, 225, 196, 225, 226, 113, 200, 225, 226, 113, 228, 113, 114, 57, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 10, + 0, 16, 16, 2, 16, 4, 4, 18, 16, 8, 8, 18, 8, 20, 20, 26, + 0, 32, 32, 2, 32, 4, 4, 34, 32, 8, 8, 34, 8, 36, 36, 42, + 32, 16, 16, 34, 16, 36, 36, 50, 16, 40, 40, 50, 40, 52, 52, 58, + 0, 64, 64, 2, 64, 4, 4, 66, 64, 8, 8, 66, 8, 68, 68, 74, + 64, 16, 16, 66, 16, 68, 68, 82, 16, 72, 72, 82, 72, 84, 84, 90, + 64, 32, 32, 66, 32, 68, 68, 98, 32, 72, 72, 98, 72, 100, 100, 106, + 32, 80, 80, 98, 80, 100, 100, 114, 80, 104, 104, 114, 104, 116, 116, 58, + 0, 128, 128, 2, 128, 4, 4, 130, 128, 8, 8, 130, 8, 132, 132, 138, + 128, 16, 16, 130, 16, 132, 132, 146, 16, 136, 136, 146, 136, 148, 148, 154, + 128, 32, 32, 130, 32, 132, 132, 162, 32, 136, 136, 162, 136, 164, 164, 170, + 32, 144, 144, 162, 144, 164, 164, 178, 144, 168, 168, 178, 168, 180, 180, 58, + 128, 64, 64, 130, 64, 132, 132, 194, 64, 136, 136, 194, 136, 196, 196, 202, + 64, 144, 144, 194, 144, 196, 196, 210, 144, 200, 200, 210, 200, 212, 212, 90, + 64, 160, 160, 194, 160, 196, 196, 226, 160, 200, 200, 226, 200, 228, 228, 106, + 160, 208, 208, 226, 208, 228, 228, 114, 208, 232, 232, 114, 232, 116, 116, 58, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 11, + 16, 17, 18, 3, 20, 5, 6, 19, 24, 9, 10, 19, 12, 21, 22, 27, + 32, 33, 34, 3, 36, 5, 6, 35, 40, 9, 10, 35, 12, 37, 38, 43, + 48, 17, 18, 35, 20, 37, 38, 51, 24, 41, 42, 51, 44, 53, 54, 59, + 64, 65, 66, 3, 68, 5, 6, 67, 72, 9, 10, 67, 12, 69, 70, 75, + 80, 17, 18, 67, 20, 69, 70, 83, 24, 73, 74, 83, 76, 85, 86, 91, + 96, 33, 34, 67, 36, 69, 70, 99, 40, 73, 74, 99, 76, 101, 102, 107, + 48, 81, 82, 99, 84, 101, 102, 115, 88, 105, 106, 115, 108, 117, 118, 59, + 128, 129, 130, 3, 132, 5, 6, 131, 136, 9, 10, 131, 12, 133, 134, 139, + 144, 17, 18, 131, 20, 133, 134, 147, 24, 137, 138, 147, 140, 149, 150, 155, + 160, 33, 34, 131, 36, 133, 134, 163, 40, 137, 138, 163, 140, 165, 166, 171, + 48, 145, 146, 163, 148, 165, 166, 179, 152, 169, 170, 179, 172, 181, 182, 59, + 192, 65, 66, 131, 68, 133, 134, 195, 72, 137, 138, 195, 140, 197, 198, 203, + 80, 145, 146, 195, 148, 197, 198, 211, 152, 201, 202, 211, 204, 213, 214, 91, + 96, 161, 162, 195, 164, 197, 198, 227, 168, 201, 202, 227, 204, 229, 230, 107, + 176, 209, 210, 227, 212, 229, 230, 115, 216, 233, 234, 115, 236, 117, 118, 59, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 12, + 0, 0, 0, 16, 0, 16, 16, 20, 0, 16, 16, 24, 16, 24, 24, 28, + 0, 0, 0, 32, 0, 32, 32, 36, 0, 32, 32, 40, 32, 40, 40, 44, + 0, 32, 32, 48, 32, 48, 48, 52, 32, 48, 48, 56, 48, 56, 56, 60, + 0, 0, 0, 64, 0, 64, 64, 68, 0, 64, 64, 72, 64, 72, 72, 76, + 0, 64, 64, 80, 64, 80, 80, 84, 64, 80, 80, 88, 80, 88, 88, 92, + 0, 64, 64, 96, 64, 96, 96, 100, 64, 96, 96, 104, 96, 104, 104, 108, + 64, 96, 96, 112, 96, 112, 112, 116, 96, 112, 112, 120, 112, 120, 120, 60, + 0, 0, 0, 128, 0, 128, 128, 132, 0, 128, 128, 136, 128, 136, 136, 140, + 0, 128, 128, 144, 128, 144, 144, 148, 128, 144, 144, 152, 144, 152, 152, 156, + 0, 128, 128, 160, 128, 160, 160, 164, 128, 160, 160, 168, 160, 168, 168, 172, + 128, 160, 160, 176, 160, 176, 176, 180, 160, 176, 176, 184, 176, 184, 184, 60, + 0, 128, 128, 192, 128, 192, 192, 196, 128, 192, 192, 200, 192, 200, 200, 204, + 128, 192, 192, 208, 192, 208, 208, 212, 192, 208, 208, 216, 208, 216, 216, 92, + 128, 192, 192, 224, 192, 224, 224, 228, 192, 224, 224, 232, 224, 232, 232, 108, + 192, 224, 224, 240, 224, 240, 240, 116, 224, 240, 240, 120, 240, 120, 120, 60, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 13, + 16, 1, 2, 17, 4, 17, 18, 21, 8, 17, 18, 25, 20, 25, 26, 29, + 32, 1, 2, 33, 4, 33, 34, 37, 8, 33, 34, 41, 36, 41, 42, 45, + 16, 33, 34, 49, 36, 49, 50, 53, 40, 49, 50, 57, 52, 57, 58, 61, + 64, 1, 2, 65, 4, 65, 66, 69, 8, 65, 66, 73, 68, 73, 74, 77, + 16, 65, 66, 81, 68, 81, 82, 85, 72, 81, 82, 89, 84, 89, 90, 93, + 32, 65, 66, 97, 68, 97, 98, 101, 72, 97, 98, 105, 100, 105, 106, 109, + 80, 97, 98, 113, 100, 113, 114, 117, 104, 113, 114, 121, 116, 121, 122, 61, + 128, 1, 2, 129, 4, 129, 130, 133, 8, 129, 130, 137, 132, 137, 138, 141, + 16, 129, 130, 145, 132, 145, 146, 149, 136, 145, 146, 153, 148, 153, 154, 157, + 32, 129, 130, 161, 132, 161, 162, 165, 136, 161, 162, 169, 164, 169, 170, 173, + 144, 161, 162, 177, 164, 177, 178, 181, 168, 177, 178, 185, 180, 185, 186, 61, + 64, 129, 130, 193, 132, 193, 194, 197, 136, 193, 194, 201, 196, 201, 202, 205, + 144, 193, 194, 209, 196, 209, 210, 213, 200, 209, 210, 217, 212, 217, 218, 93, + 160, 193, 194, 225, 196, 225, 226, 229, 200, 225, 226, 233, 228, 233, 234, 109, + 208, 225, 226, 241, 228, 241, 242, 117, 232, 241, 242, 121, 244, 121, 122, 61, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 14, + 0, 16, 16, 18, 16, 20, 20, 22, 16, 24, 24, 26, 24, 28, 28, 30, + 0, 32, 32, 34, 32, 36, 36, 38, 32, 40, 40, 42, 40, 44, 44, 46, + 32, 48, 48, 50, 48, 52, 52, 54, 48, 56, 56, 58, 56, 60, 60, 62, + 0, 64, 64, 66, 64, 68, 68, 70, 64, 72, 72, 74, 72, 76, 76, 78, + 64, 80, 80, 82, 80, 84, 84, 86, 80, 88, 88, 90, 88, 92, 92, 94, + 64, 96, 96, 98, 96, 100, 100, 102, 96, 104, 104, 106, 104, 108, 108, 110, + 96, 112, 112, 114, 112, 116, 116, 118, 112, 120, 120, 122, 120, 124, 124, 62, + 0, 128, 128, 130, 128, 132, 132, 134, 128, 136, 136, 138, 136, 140, 140, 142, + 128, 144, 144, 146, 144, 148, 148, 150, 144, 152, 152, 154, 152, 156, 156, 158, + 128, 160, 160, 162, 160, 164, 164, 166, 160, 168, 168, 170, 168, 172, 172, 174, + 160, 176, 176, 178, 176, 180, 180, 182, 176, 184, 184, 186, 184, 188, 188, 62, + 128, 192, 192, 194, 192, 196, 196, 198, 192, 200, 200, 202, 200, 204, 204, 206, + 192, 208, 208, 210, 208, 212, 212, 214, 208, 216, 216, 218, 216, 220, 220, 94, + 192, 224, 224, 226, 224, 228, 228, 230, 224, 232, 232, 234, 232, 236, 236, 110, + 224, 240, 240, 242, 240, 244, 244, 118, 240, 248, 248, 122, 248, 124, 124, 62, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 63, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 63, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 95, + 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 111, + 240, 241, 242, 243, 244, 245, 246, 119, 248, 249, 250, 123, 252, 125, 126, 63, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 64, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 64, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 65, + 128, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 129, + 64, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 129, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 129, + 16, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 65, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 2, + 0, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 2, + 0, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 2, + 32, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 2, + 0, 64, 64, 2, 64, 4, 4, 2, 64, 8, 8, 2, 8, 4, 4, 2, + 64, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 2, + 64, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 2, + 32, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 66, + 0, 128, 128, 2, 128, 4, 4, 2, 128, 8, 8, 2, 8, 4, 4, 2, + 128, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 2, + 128, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 2, + 32, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 130, + 128, 64, 64, 2, 64, 4, 4, 2, 64, 8, 8, 2, 8, 4, 4, 2, + 64, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 130, + 64, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 130, + 32, 16, 16, 2, 16, 4, 4, 130, 16, 8, 8, 130, 8, 132, 132, 66, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 3, + 16, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 3, + 32, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 3, + 48, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 3, + 64, 65, 66, 3, 68, 5, 6, 3, 72, 9, 10, 3, 12, 5, 6, 3, + 80, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 3, + 96, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 3, + 48, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 67, + 128, 129, 130, 3, 132, 5, 6, 3, 136, 9, 10, 3, 12, 5, 6, 3, + 144, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 3, + 160, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 3, + 48, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 131, + 192, 65, 66, 3, 68, 5, 6, 3, 72, 9, 10, 3, 12, 5, 6, 3, + 80, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 131, + 96, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 131, + 48, 17, 18, 3, 20, 5, 6, 131, 24, 9, 10, 131, 12, 133, 134, 67, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 4, + 0, 0, 0, 16, 0, 16, 16, 4, 0, 16, 16, 8, 16, 8, 8, 4, + 0, 0, 0, 32, 0, 32, 32, 4, 0, 32, 32, 8, 32, 8, 8, 4, + 0, 32, 32, 16, 32, 16, 16, 4, 32, 16, 16, 8, 16, 8, 8, 4, + 0, 0, 0, 64, 0, 64, 64, 4, 0, 64, 64, 8, 64, 8, 8, 4, + 0, 64, 64, 16, 64, 16, 16, 4, 64, 16, 16, 8, 16, 8, 8, 4, + 0, 64, 64, 32, 64, 32, 32, 4, 64, 32, 32, 8, 32, 8, 8, 4, + 64, 32, 32, 16, 32, 16, 16, 4, 32, 16, 16, 8, 16, 8, 8, 68, + 0, 0, 0, 128, 0, 128, 128, 4, 0, 128, 128, 8, 128, 8, 8, 4, + 0, 128, 128, 16, 128, 16, 16, 4, 128, 16, 16, 8, 16, 8, 8, 4, + 0, 128, 128, 32, 128, 32, 32, 4, 128, 32, 32, 8, 32, 8, 8, 4, + 128, 32, 32, 16, 32, 16, 16, 4, 32, 16, 16, 8, 16, 8, 8, 132, + 0, 128, 128, 64, 128, 64, 64, 4, 128, 64, 64, 8, 64, 8, 8, 4, + 128, 64, 64, 16, 64, 16, 16, 4, 64, 16, 16, 8, 16, 8, 8, 132, + 128, 64, 64, 32, 64, 32, 32, 4, 64, 32, 32, 8, 32, 8, 8, 132, + 64, 32, 32, 16, 32, 16, 16, 132, 32, 16, 16, 136, 16, 136, 136, 68, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 5, + 16, 1, 2, 17, 4, 17, 18, 5, 8, 17, 18, 9, 20, 9, 10, 5, + 32, 1, 2, 33, 4, 33, 34, 5, 8, 33, 34, 9, 36, 9, 10, 5, + 16, 33, 34, 17, 36, 17, 18, 5, 40, 17, 18, 9, 20, 9, 10, 5, + 64, 1, 2, 65, 4, 65, 66, 5, 8, 65, 66, 9, 68, 9, 10, 5, + 16, 65, 66, 17, 68, 17, 18, 5, 72, 17, 18, 9, 20, 9, 10, 5, + 32, 65, 66, 33, 68, 33, 34, 5, 72, 33, 34, 9, 36, 9, 10, 5, + 80, 33, 34, 17, 36, 17, 18, 5, 40, 17, 18, 9, 20, 9, 10, 69, + 128, 1, 2, 129, 4, 129, 130, 5, 8, 129, 130, 9, 132, 9, 10, 5, + 16, 129, 130, 17, 132, 17, 18, 5, 136, 17, 18, 9, 20, 9, 10, 5, + 32, 129, 130, 33, 132, 33, 34, 5, 136, 33, 34, 9, 36, 9, 10, 5, + 144, 33, 34, 17, 36, 17, 18, 5, 40, 17, 18, 9, 20, 9, 10, 133, + 64, 129, 130, 65, 132, 65, 66, 5, 136, 65, 66, 9, 68, 9, 10, 5, + 144, 65, 66, 17, 68, 17, 18, 5, 72, 17, 18, 9, 20, 9, 10, 133, + 160, 65, 66, 33, 68, 33, 34, 5, 72, 33, 34, 9, 36, 9, 10, 133, + 80, 33, 34, 17, 36, 17, 18, 133, 40, 17, 18, 137, 20, 137, 138, 69, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 6, + 0, 16, 16, 18, 16, 20, 20, 6, 16, 24, 24, 10, 24, 12, 12, 6, + 0, 32, 32, 34, 32, 36, 36, 6, 32, 40, 40, 10, 40, 12, 12, 6, + 32, 48, 48, 18, 48, 20, 20, 6, 48, 24, 24, 10, 24, 12, 12, 6, + 0, 64, 64, 66, 64, 68, 68, 6, 64, 72, 72, 10, 72, 12, 12, 6, + 64, 80, 80, 18, 80, 20, 20, 6, 80, 24, 24, 10, 24, 12, 12, 6, + 64, 96, 96, 34, 96, 36, 36, 6, 96, 40, 40, 10, 40, 12, 12, 6, + 96, 48, 48, 18, 48, 20, 20, 6, 48, 24, 24, 10, 24, 12, 12, 70, + 0, 128, 128, 130, 128, 132, 132, 6, 128, 136, 136, 10, 136, 12, 12, 6, + 128, 144, 144, 18, 144, 20, 20, 6, 144, 24, 24, 10, 24, 12, 12, 6, + 128, 160, 160, 34, 160, 36, 36, 6, 160, 40, 40, 10, 40, 12, 12, 6, + 160, 48, 48, 18, 48, 20, 20, 6, 48, 24, 24, 10, 24, 12, 12, 134, + 128, 192, 192, 66, 192, 68, 68, 6, 192, 72, 72, 10, 72, 12, 12, 6, + 192, 80, 80, 18, 80, 20, 20, 6, 80, 24, 24, 10, 24, 12, 12, 134, + 192, 96, 96, 34, 96, 36, 36, 6, 96, 40, 40, 10, 40, 12, 12, 134, + 96, 48, 48, 18, 48, 20, 20, 134, 48, 24, 24, 138, 24, 140, 140, 70, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 7, + 16, 17, 18, 19, 20, 21, 22, 7, 24, 25, 26, 11, 28, 13, 14, 7, + 32, 33, 34, 35, 36, 37, 38, 7, 40, 41, 42, 11, 44, 13, 14, 7, + 48, 49, 50, 19, 52, 21, 22, 7, 56, 25, 26, 11, 28, 13, 14, 7, + 64, 65, 66, 67, 68, 69, 70, 7, 72, 73, 74, 11, 76, 13, 14, 7, + 80, 81, 82, 19, 84, 21, 22, 7, 88, 25, 26, 11, 28, 13, 14, 7, + 96, 97, 98, 35, 100, 37, 38, 7, 104, 41, 42, 11, 44, 13, 14, 7, + 112, 49, 50, 19, 52, 21, 22, 7, 56, 25, 26, 11, 28, 13, 14, 71, + 128, 129, 130, 131, 132, 133, 134, 7, 136, 137, 138, 11, 140, 13, 14, 7, + 144, 145, 146, 19, 148, 21, 22, 7, 152, 25, 26, 11, 28, 13, 14, 7, + 160, 161, 162, 35, 164, 37, 38, 7, 168, 41, 42, 11, 44, 13, 14, 7, + 176, 49, 50, 19, 52, 21, 22, 7, 56, 25, 26, 11, 28, 13, 14, 135, + 192, 193, 194, 67, 196, 69, 70, 7, 200, 73, 74, 11, 76, 13, 14, 7, + 208, 81, 82, 19, 84, 21, 22, 7, 88, 25, 26, 11, 28, 13, 14, 135, + 224, 97, 98, 35, 100, 37, 38, 7, 104, 41, 42, 11, 44, 13, 14, 135, + 112, 49, 50, 19, 52, 21, 22, 135, 56, 25, 26, 139, 28, 141, 142, 71, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, + 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 16, 0, 16, 16, 8, + 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 32, 0, 32, 32, 8, + 0, 0, 0, 32, 0, 32, 32, 16, 0, 32, 32, 16, 32, 16, 16, 8, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 8, + 0, 0, 0, 64, 0, 64, 64, 16, 0, 64, 64, 16, 64, 16, 16, 8, + 0, 0, 0, 64, 0, 64, 64, 32, 0, 64, 64, 32, 64, 32, 32, 8, + 0, 64, 64, 32, 64, 32, 32, 16, 64, 32, 32, 16, 32, 16, 16, 72, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 8, + 0, 0, 0, 128, 0, 128, 128, 16, 0, 128, 128, 16, 128, 16, 16, 8, + 0, 0, 0, 128, 0, 128, 128, 32, 0, 128, 128, 32, 128, 32, 32, 8, + 0, 128, 128, 32, 128, 32, 32, 16, 128, 32, 32, 16, 32, 16, 16, 136, + 0, 0, 0, 128, 0, 128, 128, 64, 0, 128, 128, 64, 128, 64, 64, 8, + 0, 128, 128, 64, 128, 64, 64, 16, 128, 64, 64, 16, 64, 16, 16, 136, + 0, 128, 128, 64, 128, 64, 64, 32, 128, 64, 64, 32, 64, 32, 32, 136, + 128, 64, 64, 32, 64, 32, 32, 144, 64, 32, 32, 144, 32, 144, 144, 72, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 9, + 16, 1, 2, 1, 4, 1, 2, 17, 8, 1, 2, 17, 4, 17, 18, 9, + 32, 1, 2, 1, 4, 1, 2, 33, 8, 1, 2, 33, 4, 33, 34, 9, + 16, 1, 2, 33, 4, 33, 34, 17, 8, 33, 34, 17, 36, 17, 18, 9, + 64, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 9, + 16, 1, 2, 65, 4, 65, 66, 17, 8, 65, 66, 17, 68, 17, 18, 9, + 32, 1, 2, 65, 4, 65, 66, 33, 8, 65, 66, 33, 68, 33, 34, 9, + 16, 65, 66, 33, 68, 33, 34, 17, 72, 33, 34, 17, 36, 17, 18, 73, + 128, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 9, + 16, 1, 2, 129, 4, 129, 130, 17, 8, 129, 130, 17, 132, 17, 18, 9, + 32, 1, 2, 129, 4, 129, 130, 33, 8, 129, 130, 33, 132, 33, 34, 9, + 16, 129, 130, 33, 132, 33, 34, 17, 136, 33, 34, 17, 36, 17, 18, 137, + 64, 1, 2, 129, 4, 129, 130, 65, 8, 129, 130, 65, 132, 65, 66, 9, + 16, 129, 130, 65, 132, 65, 66, 17, 136, 65, 66, 17, 68, 17, 18, 137, + 32, 129, 130, 65, 132, 65, 66, 33, 136, 65, 66, 33, 68, 33, 34, 137, + 144, 65, 66, 33, 68, 33, 34, 145, 72, 33, 34, 145, 36, 145, 146, 73, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 10, + 0, 16, 16, 2, 16, 4, 4, 18, 16, 8, 8, 18, 8, 20, 20, 10, + 0, 32, 32, 2, 32, 4, 4, 34, 32, 8, 8, 34, 8, 36, 36, 10, + 32, 16, 16, 34, 16, 36, 36, 18, 16, 40, 40, 18, 40, 20, 20, 10, + 0, 64, 64, 2, 64, 4, 4, 66, 64, 8, 8, 66, 8, 68, 68, 10, + 64, 16, 16, 66, 16, 68, 68, 18, 16, 72, 72, 18, 72, 20, 20, 10, + 64, 32, 32, 66, 32, 68, 68, 34, 32, 72, 72, 34, 72, 36, 36, 10, + 32, 80, 80, 34, 80, 36, 36, 18, 80, 40, 40, 18, 40, 20, 20, 74, + 0, 128, 128, 2, 128, 4, 4, 130, 128, 8, 8, 130, 8, 132, 132, 10, + 128, 16, 16, 130, 16, 132, 132, 18, 16, 136, 136, 18, 136, 20, 20, 10, + 128, 32, 32, 130, 32, 132, 132, 34, 32, 136, 136, 34, 136, 36, 36, 10, + 32, 144, 144, 34, 144, 36, 36, 18, 144, 40, 40, 18, 40, 20, 20, 138, + 128, 64, 64, 130, 64, 132, 132, 66, 64, 136, 136, 66, 136, 68, 68, 10, + 64, 144, 144, 66, 144, 68, 68, 18, 144, 72, 72, 18, 72, 20, 20, 138, + 64, 160, 160, 66, 160, 68, 68, 34, 160, 72, 72, 34, 72, 36, 36, 138, + 160, 80, 80, 34, 80, 36, 36, 146, 80, 40, 40, 146, 40, 148, 148, 74, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 11, + 16, 17, 18, 3, 20, 5, 6, 19, 24, 9, 10, 19, 12, 21, 22, 11, + 32, 33, 34, 3, 36, 5, 6, 35, 40, 9, 10, 35, 12, 37, 38, 11, + 48, 17, 18, 35, 20, 37, 38, 19, 24, 41, 42, 19, 44, 21, 22, 11, + 64, 65, 66, 3, 68, 5, 6, 67, 72, 9, 10, 67, 12, 69, 70, 11, + 80, 17, 18, 67, 20, 69, 70, 19, 24, 73, 74, 19, 76, 21, 22, 11, + 96, 33, 34, 67, 36, 69, 70, 35, 40, 73, 74, 35, 76, 37, 38, 11, + 48, 81, 82, 35, 84, 37, 38, 19, 88, 41, 42, 19, 44, 21, 22, 75, + 128, 129, 130, 3, 132, 5, 6, 131, 136, 9, 10, 131, 12, 133, 134, 11, + 144, 17, 18, 131, 20, 133, 134, 19, 24, 137, 138, 19, 140, 21, 22, 11, + 160, 33, 34, 131, 36, 133, 134, 35, 40, 137, 138, 35, 140, 37, 38, 11, + 48, 145, 146, 35, 148, 37, 38, 19, 152, 41, 42, 19, 44, 21, 22, 139, + 192, 65, 66, 131, 68, 133, 134, 67, 72, 137, 138, 67, 140, 69, 70, 11, + 80, 145, 146, 67, 148, 69, 70, 19, 152, 73, 74, 19, 76, 21, 22, 139, + 96, 161, 162, 67, 164, 69, 70, 35, 168, 73, 74, 35, 76, 37, 38, 139, + 176, 81, 82, 35, 84, 37, 38, 147, 88, 41, 42, 147, 44, 149, 150, 75, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 12, + 0, 0, 0, 16, 0, 16, 16, 20, 0, 16, 16, 24, 16, 24, 24, 12, + 0, 0, 0, 32, 0, 32, 32, 36, 0, 32, 32, 40, 32, 40, 40, 12, + 0, 32, 32, 48, 32, 48, 48, 20, 32, 48, 48, 24, 48, 24, 24, 12, + 0, 0, 0, 64, 0, 64, 64, 68, 0, 64, 64, 72, 64, 72, 72, 12, + 0, 64, 64, 80, 64, 80, 80, 20, 64, 80, 80, 24, 80, 24, 24, 12, + 0, 64, 64, 96, 64, 96, 96, 36, 64, 96, 96, 40, 96, 40, 40, 12, + 64, 96, 96, 48, 96, 48, 48, 20, 96, 48, 48, 24, 48, 24, 24, 76, + 0, 0, 0, 128, 0, 128, 128, 132, 0, 128, 128, 136, 128, 136, 136, 12, + 0, 128, 128, 144, 128, 144, 144, 20, 128, 144, 144, 24, 144, 24, 24, 12, + 0, 128, 128, 160, 128, 160, 160, 36, 128, 160, 160, 40, 160, 40, 40, 12, + 128, 160, 160, 48, 160, 48, 48, 20, 160, 48, 48, 24, 48, 24, 24, 140, + 0, 128, 128, 192, 128, 192, 192, 68, 128, 192, 192, 72, 192, 72, 72, 12, + 128, 192, 192, 80, 192, 80, 80, 20, 192, 80, 80, 24, 80, 24, 24, 140, + 128, 192, 192, 96, 192, 96, 96, 36, 192, 96, 96, 40, 96, 40, 40, 140, + 192, 96, 96, 48, 96, 48, 48, 148, 96, 48, 48, 152, 48, 152, 152, 76, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 13, + 16, 1, 2, 17, 4, 17, 18, 21, 8, 17, 18, 25, 20, 25, 26, 13, + 32, 1, 2, 33, 4, 33, 34, 37, 8, 33, 34, 41, 36, 41, 42, 13, + 16, 33, 34, 49, 36, 49, 50, 21, 40, 49, 50, 25, 52, 25, 26, 13, + 64, 1, 2, 65, 4, 65, 66, 69, 8, 65, 66, 73, 68, 73, 74, 13, + 16, 65, 66, 81, 68, 81, 82, 21, 72, 81, 82, 25, 84, 25, 26, 13, + 32, 65, 66, 97, 68, 97, 98, 37, 72, 97, 98, 41, 100, 41, 42, 13, + 80, 97, 98, 49, 100, 49, 50, 21, 104, 49, 50, 25, 52, 25, 26, 77, + 128, 1, 2, 129, 4, 129, 130, 133, 8, 129, 130, 137, 132, 137, 138, 13, + 16, 129, 130, 145, 132, 145, 146, 21, 136, 145, 146, 25, 148, 25, 26, 13, + 32, 129, 130, 161, 132, 161, 162, 37, 136, 161, 162, 41, 164, 41, 42, 13, + 144, 161, 162, 49, 164, 49, 50, 21, 168, 49, 50, 25, 52, 25, 26, 141, + 64, 129, 130, 193, 132, 193, 194, 69, 136, 193, 194, 73, 196, 73, 74, 13, + 144, 193, 194, 81, 196, 81, 82, 21, 200, 81, 82, 25, 84, 25, 26, 141, + 160, 193, 194, 97, 196, 97, 98, 37, 200, 97, 98, 41, 100, 41, 42, 141, + 208, 97, 98, 49, 100, 49, 50, 149, 104, 49, 50, 153, 52, 153, 154, 77, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 14, + 0, 16, 16, 18, 16, 20, 20, 22, 16, 24, 24, 26, 24, 28, 28, 14, + 0, 32, 32, 34, 32, 36, 36, 38, 32, 40, 40, 42, 40, 44, 44, 14, + 32, 48, 48, 50, 48, 52, 52, 22, 48, 56, 56, 26, 56, 28, 28, 14, + 0, 64, 64, 66, 64, 68, 68, 70, 64, 72, 72, 74, 72, 76, 76, 14, + 64, 80, 80, 82, 80, 84, 84, 22, 80, 88, 88, 26, 88, 28, 28, 14, + 64, 96, 96, 98, 96, 100, 100, 38, 96, 104, 104, 42, 104, 44, 44, 14, + 96, 112, 112, 50, 112, 52, 52, 22, 112, 56, 56, 26, 56, 28, 28, 78, + 0, 128, 128, 130, 128, 132, 132, 134, 128, 136, 136, 138, 136, 140, 140, 14, + 128, 144, 144, 146, 144, 148, 148, 22, 144, 152, 152, 26, 152, 28, 28, 14, + 128, 160, 160, 162, 160, 164, 164, 38, 160, 168, 168, 42, 168, 44, 44, 14, + 160, 176, 176, 50, 176, 52, 52, 22, 176, 56, 56, 26, 56, 28, 28, 142, + 128, 192, 192, 194, 192, 196, 196, 70, 192, 200, 200, 74, 200, 76, 76, 14, + 192, 208, 208, 82, 208, 84, 84, 22, 208, 88, 88, 26, 88, 28, 28, 142, + 192, 224, 224, 98, 224, 100, 100, 38, 224, 104, 104, 42, 104, 44, 44, 142, + 224, 112, 112, 50, 112, 52, 52, 150, 112, 56, 56, 154, 56, 156, 156, 78, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 15, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 15, + 48, 49, 50, 51, 52, 53, 54, 23, 56, 57, 58, 27, 60, 29, 30, 15, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 15, + 80, 81, 82, 83, 84, 85, 86, 23, 88, 89, 90, 27, 92, 29, 30, 15, + 96, 97, 98, 99, 100, 101, 102, 39, 104, 105, 106, 43, 108, 45, 46, 15, + 112, 113, 114, 51, 116, 53, 54, 23, 120, 57, 58, 27, 60, 29, 30, 79, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 15, + 144, 145, 146, 147, 148, 149, 150, 23, 152, 153, 154, 27, 156, 29, 30, 15, + 160, 161, 162, 163, 164, 165, 166, 39, 168, 169, 170, 43, 172, 45, 46, 15, + 176, 177, 178, 51, 180, 53, 54, 23, 184, 57, 58, 27, 60, 29, 30, 143, + 192, 193, 194, 195, 196, 197, 198, 71, 200, 201, 202, 75, 204, 77, 78, 15, + 208, 209, 210, 83, 212, 85, 86, 23, 216, 89, 90, 27, 92, 29, 30, 143, + 224, 225, 226, 99, 228, 101, 102, 39, 232, 105, 106, 43, 108, 45, 46, 143, + 240, 113, 114, 51, 116, 53, 54, 151, 120, 57, 58, 155, 60, 157, 158, 79, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, + 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 32, 0, 32, 32, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 16, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 32, + 0, 0, 0, 64, 0, 64, 64, 32, 0, 64, 64, 32, 64, 32, 32, 80, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 16, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 32, + 0, 0, 0, 128, 0, 128, 128, 32, 0, 128, 128, 32, 128, 32, 32, 144, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 64, + 0, 0, 0, 128, 0, 128, 128, 64, 0, 128, 128, 64, 128, 64, 64, 144, + 0, 0, 0, 128, 0, 128, 128, 64, 0, 128, 128, 64, 128, 64, 64, 160, + 0, 128, 128, 64, 128, 64, 64, 160, 128, 64, 64, 160, 64, 160, 160, 80, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 17, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 33, + 16, 1, 2, 1, 4, 1, 2, 33, 8, 1, 2, 33, 4, 33, 34, 17, + 64, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 65, + 16, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 17, + 32, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 33, + 16, 1, 2, 65, 4, 65, 66, 33, 8, 65, 66, 33, 68, 33, 34, 81, + 128, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 129, + 16, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 17, + 32, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 33, + 16, 1, 2, 129, 4, 129, 130, 33, 8, 129, 130, 33, 132, 33, 34, 145, + 64, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 65, + 16, 1, 2, 129, 4, 129, 130, 65, 8, 129, 130, 65, 132, 65, 66, 145, + 32, 1, 2, 129, 4, 129, 130, 65, 8, 129, 130, 65, 132, 65, 66, 161, + 16, 129, 130, 65, 132, 65, 66, 161, 136, 65, 66, 161, 68, 161, 162, 81, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 2, + 0, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 18, + 0, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 34, + 32, 16, 16, 2, 16, 4, 4, 34, 16, 8, 8, 34, 8, 36, 36, 18, + 0, 64, 64, 2, 64, 4, 4, 2, 64, 8, 8, 2, 8, 4, 4, 66, + 64, 16, 16, 2, 16, 4, 4, 66, 16, 8, 8, 66, 8, 68, 68, 18, + 64, 32, 32, 2, 32, 4, 4, 66, 32, 8, 8, 66, 8, 68, 68, 34, + 32, 16, 16, 66, 16, 68, 68, 34, 16, 72, 72, 34, 72, 36, 36, 82, + 0, 128, 128, 2, 128, 4, 4, 2, 128, 8, 8, 2, 8, 4, 4, 130, + 128, 16, 16, 2, 16, 4, 4, 130, 16, 8, 8, 130, 8, 132, 132, 18, + 128, 32, 32, 2, 32, 4, 4, 130, 32, 8, 8, 130, 8, 132, 132, 34, + 32, 16, 16, 130, 16, 132, 132, 34, 16, 136, 136, 34, 136, 36, 36, 146, + 128, 64, 64, 2, 64, 4, 4, 130, 64, 8, 8, 130, 8, 132, 132, 66, + 64, 16, 16, 130, 16, 132, 132, 66, 16, 136, 136, 66, 136, 68, 68, 146, + 64, 32, 32, 130, 32, 132, 132, 66, 32, 136, 136, 66, 136, 68, 68, 162, + 32, 144, 144, 66, 144, 68, 68, 162, 144, 72, 72, 162, 72, 164, 164, 82, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 3, + 16, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 19, + 32, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 35, + 48, 17, 18, 3, 20, 5, 6, 35, 24, 9, 10, 35, 12, 37, 38, 19, + 64, 65, 66, 3, 68, 5, 6, 3, 72, 9, 10, 3, 12, 5, 6, 67, + 80, 17, 18, 3, 20, 5, 6, 67, 24, 9, 10, 67, 12, 69, 70, 19, + 96, 33, 34, 3, 36, 5, 6, 67, 40, 9, 10, 67, 12, 69, 70, 35, + 48, 17, 18, 67, 20, 69, 70, 35, 24, 73, 74, 35, 76, 37, 38, 83, + 128, 129, 130, 3, 132, 5, 6, 3, 136, 9, 10, 3, 12, 5, 6, 131, + 144, 17, 18, 3, 20, 5, 6, 131, 24, 9, 10, 131, 12, 133, 134, 19, + 160, 33, 34, 3, 36, 5, 6, 131, 40, 9, 10, 131, 12, 133, 134, 35, + 48, 17, 18, 131, 20, 133, 134, 35, 24, 137, 138, 35, 140, 37, 38, 147, + 192, 65, 66, 3, 68, 5, 6, 131, 72, 9, 10, 131, 12, 133, 134, 67, + 80, 17, 18, 131, 20, 133, 134, 67, 24, 137, 138, 67, 140, 69, 70, 147, + 96, 33, 34, 131, 36, 133, 134, 67, 40, 137, 138, 67, 140, 69, 70, 163, + 48, 145, 146, 67, 148, 69, 70, 163, 152, 73, 74, 163, 76, 165, 166, 83, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 4, + 0, 0, 0, 16, 0, 16, 16, 4, 0, 16, 16, 8, 16, 8, 8, 20, + 0, 0, 0, 32, 0, 32, 32, 4, 0, 32, 32, 8, 32, 8, 8, 36, + 0, 32, 32, 16, 32, 16, 16, 36, 32, 16, 16, 40, 16, 40, 40, 20, + 0, 0, 0, 64, 0, 64, 64, 4, 0, 64, 64, 8, 64, 8, 8, 68, + 0, 64, 64, 16, 64, 16, 16, 68, 64, 16, 16, 72, 16, 72, 72, 20, + 0, 64, 64, 32, 64, 32, 32, 68, 64, 32, 32, 72, 32, 72, 72, 36, + 64, 32, 32, 80, 32, 80, 80, 36, 32, 80, 80, 40, 80, 40, 40, 84, + 0, 0, 0, 128, 0, 128, 128, 4, 0, 128, 128, 8, 128, 8, 8, 132, + 0, 128, 128, 16, 128, 16, 16, 132, 128, 16, 16, 136, 16, 136, 136, 20, + 0, 128, 128, 32, 128, 32, 32, 132, 128, 32, 32, 136, 32, 136, 136, 36, + 128, 32, 32, 144, 32, 144, 144, 36, 32, 144, 144, 40, 144, 40, 40, 148, + 0, 128, 128, 64, 128, 64, 64, 132, 128, 64, 64, 136, 64, 136, 136, 68, + 128, 64, 64, 144, 64, 144, 144, 68, 64, 144, 144, 72, 144, 72, 72, 148, + 128, 64, 64, 160, 64, 160, 160, 68, 64, 160, 160, 72, 160, 72, 72, 164, + 64, 160, 160, 80, 160, 80, 80, 164, 160, 80, 80, 168, 80, 168, 168, 84, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 5, + 16, 1, 2, 17, 4, 17, 18, 5, 8, 17, 18, 9, 20, 9, 10, 21, + 32, 1, 2, 33, 4, 33, 34, 5, 8, 33, 34, 9, 36, 9, 10, 37, + 16, 33, 34, 17, 36, 17, 18, 37, 40, 17, 18, 41, 20, 41, 42, 21, + 64, 1, 2, 65, 4, 65, 66, 5, 8, 65, 66, 9, 68, 9, 10, 69, + 16, 65, 66, 17, 68, 17, 18, 69, 72, 17, 18, 73, 20, 73, 74, 21, + 32, 65, 66, 33, 68, 33, 34, 69, 72, 33, 34, 73, 36, 73, 74, 37, + 80, 33, 34, 81, 36, 81, 82, 37, 40, 81, 82, 41, 84, 41, 42, 85, + 128, 1, 2, 129, 4, 129, 130, 5, 8, 129, 130, 9, 132, 9, 10, 133, + 16, 129, 130, 17, 132, 17, 18, 133, 136, 17, 18, 137, 20, 137, 138, 21, + 32, 129, 130, 33, 132, 33, 34, 133, 136, 33, 34, 137, 36, 137, 138, 37, + 144, 33, 34, 145, 36, 145, 146, 37, 40, 145, 146, 41, 148, 41, 42, 149, + 64, 129, 130, 65, 132, 65, 66, 133, 136, 65, 66, 137, 68, 137, 138, 69, + 144, 65, 66, 145, 68, 145, 146, 69, 72, 145, 146, 73, 148, 73, 74, 149, + 160, 65, 66, 161, 68, 161, 162, 69, 72, 161, 162, 73, 164, 73, 74, 165, + 80, 161, 162, 81, 164, 81, 82, 165, 168, 81, 82, 169, 84, 169, 170, 85, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 6, + 0, 16, 16, 18, 16, 20, 20, 6, 16, 24, 24, 10, 24, 12, 12, 22, + 0, 32, 32, 34, 32, 36, 36, 6, 32, 40, 40, 10, 40, 12, 12, 38, + 32, 48, 48, 18, 48, 20, 20, 38, 48, 24, 24, 42, 24, 44, 44, 22, + 0, 64, 64, 66, 64, 68, 68, 6, 64, 72, 72, 10, 72, 12, 12, 70, + 64, 80, 80, 18, 80, 20, 20, 70, 80, 24, 24, 74, 24, 76, 76, 22, + 64, 96, 96, 34, 96, 36, 36, 70, 96, 40, 40, 74, 40, 76, 76, 38, + 96, 48, 48, 82, 48, 84, 84, 38, 48, 88, 88, 42, 88, 44, 44, 86, + 0, 128, 128, 130, 128, 132, 132, 6, 128, 136, 136, 10, 136, 12, 12, 134, + 128, 144, 144, 18, 144, 20, 20, 134, 144, 24, 24, 138, 24, 140, 140, 22, + 128, 160, 160, 34, 160, 36, 36, 134, 160, 40, 40, 138, 40, 140, 140, 38, + 160, 48, 48, 146, 48, 148, 148, 38, 48, 152, 152, 42, 152, 44, 44, 150, + 128, 192, 192, 66, 192, 68, 68, 134, 192, 72, 72, 138, 72, 140, 140, 70, + 192, 80, 80, 146, 80, 148, 148, 70, 80, 152, 152, 74, 152, 76, 76, 150, + 192, 96, 96, 162, 96, 164, 164, 70, 96, 168, 168, 74, 168, 76, 76, 166, + 96, 176, 176, 82, 176, 84, 84, 166, 176, 88, 88, 170, 88, 172, 172, 86, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 7, + 16, 17, 18, 19, 20, 21, 22, 7, 24, 25, 26, 11, 28, 13, 14, 23, + 32, 33, 34, 35, 36, 37, 38, 7, 40, 41, 42, 11, 44, 13, 14, 39, + 48, 49, 50, 19, 52, 21, 22, 39, 56, 25, 26, 43, 28, 45, 46, 23, + 64, 65, 66, 67, 68, 69, 70, 7, 72, 73, 74, 11, 76, 13, 14, 71, + 80, 81, 82, 19, 84, 21, 22, 71, 88, 25, 26, 75, 28, 77, 78, 23, + 96, 97, 98, 35, 100, 37, 38, 71, 104, 41, 42, 75, 44, 77, 78, 39, + 112, 49, 50, 83, 52, 85, 86, 39, 56, 89, 90, 43, 92, 45, 46, 87, + 128, 129, 130, 131, 132, 133, 134, 7, 136, 137, 138, 11, 140, 13, 14, 135, + 144, 145, 146, 19, 148, 21, 22, 135, 152, 25, 26, 139, 28, 141, 142, 23, + 160, 161, 162, 35, 164, 37, 38, 135, 168, 41, 42, 139, 44, 141, 142, 39, + 176, 49, 50, 147, 52, 149, 150, 39, 56, 153, 154, 43, 156, 45, 46, 151, + 192, 193, 194, 67, 196, 69, 70, 135, 200, 73, 74, 139, 76, 141, 142, 71, + 208, 81, 82, 147, 84, 149, 150, 71, 88, 153, 154, 75, 156, 77, 78, 151, + 224, 97, 98, 163, 100, 165, 166, 71, 104, 169, 170, 75, 172, 77, 78, 167, + 112, 177, 178, 83, 180, 85, 86, 167, 184, 89, 90, 171, 92, 173, 174, 87, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, + 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 16, 0, 16, 16, 24, + 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 32, 0, 32, 32, 40, + 0, 0, 0, 32, 0, 32, 32, 48, 0, 32, 32, 48, 32, 48, 48, 24, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 72, + 0, 0, 0, 64, 0, 64, 64, 80, 0, 64, 64, 80, 64, 80, 80, 24, + 0, 0, 0, 64, 0, 64, 64, 96, 0, 64, 64, 96, 64, 96, 96, 40, + 0, 64, 64, 96, 64, 96, 96, 48, 64, 96, 96, 48, 96, 48, 48, 88, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 136, + 0, 0, 0, 128, 0, 128, 128, 144, 0, 128, 128, 144, 128, 144, 144, 24, + 0, 0, 0, 128, 0, 128, 128, 160, 0, 128, 128, 160, 128, 160, 160, 40, + 0, 128, 128, 160, 128, 160, 160, 48, 128, 160, 160, 48, 160, 48, 48, 152, + 0, 0, 0, 128, 0, 128, 128, 192, 0, 128, 128, 192, 128, 192, 192, 72, + 0, 128, 128, 192, 128, 192, 192, 80, 128, 192, 192, 80, 192, 80, 80, 152, + 0, 128, 128, 192, 128, 192, 192, 96, 128, 192, 192, 96, 192, 96, 96, 168, + 128, 192, 192, 96, 192, 96, 96, 176, 192, 96, 96, 176, 96, 176, 176, 88, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 9, + 16, 1, 2, 1, 4, 1, 2, 17, 8, 1, 2, 17, 4, 17, 18, 25, + 32, 1, 2, 1, 4, 1, 2, 33, 8, 1, 2, 33, 4, 33, 34, 41, + 16, 1, 2, 33, 4, 33, 34, 49, 8, 33, 34, 49, 36, 49, 50, 25, + 64, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 73, + 16, 1, 2, 65, 4, 65, 66, 81, 8, 65, 66, 81, 68, 81, 82, 25, + 32, 1, 2, 65, 4, 65, 66, 97, 8, 65, 66, 97, 68, 97, 98, 41, + 16, 65, 66, 97, 68, 97, 98, 49, 72, 97, 98, 49, 100, 49, 50, 89, + 128, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 137, + 16, 1, 2, 129, 4, 129, 130, 145, 8, 129, 130, 145, 132, 145, 146, 25, + 32, 1, 2, 129, 4, 129, 130, 161, 8, 129, 130, 161, 132, 161, 162, 41, + 16, 129, 130, 161, 132, 161, 162, 49, 136, 161, 162, 49, 164, 49, 50, 153, + 64, 1, 2, 129, 4, 129, 130, 193, 8, 129, 130, 193, 132, 193, 194, 73, + 16, 129, 130, 193, 132, 193, 194, 81, 136, 193, 194, 81, 196, 81, 82, 153, + 32, 129, 130, 193, 132, 193, 194, 97, 136, 193, 194, 97, 196, 97, 98, 169, + 144, 193, 194, 97, 196, 97, 98, 177, 200, 97, 98, 177, 100, 177, 178, 89, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 10, + 0, 16, 16, 2, 16, 4, 4, 18, 16, 8, 8, 18, 8, 20, 20, 26, + 0, 32, 32, 2, 32, 4, 4, 34, 32, 8, 8, 34, 8, 36, 36, 42, + 32, 16, 16, 34, 16, 36, 36, 50, 16, 40, 40, 50, 40, 52, 52, 26, + 0, 64, 64, 2, 64, 4, 4, 66, 64, 8, 8, 66, 8, 68, 68, 74, + 64, 16, 16, 66, 16, 68, 68, 82, 16, 72, 72, 82, 72, 84, 84, 26, + 64, 32, 32, 66, 32, 68, 68, 98, 32, 72, 72, 98, 72, 100, 100, 42, + 32, 80, 80, 98, 80, 100, 100, 50, 80, 104, 104, 50, 104, 52, 52, 90, + 0, 128, 128, 2, 128, 4, 4, 130, 128, 8, 8, 130, 8, 132, 132, 138, + 128, 16, 16, 130, 16, 132, 132, 146, 16, 136, 136, 146, 136, 148, 148, 26, + 128, 32, 32, 130, 32, 132, 132, 162, 32, 136, 136, 162, 136, 164, 164, 42, + 32, 144, 144, 162, 144, 164, 164, 50, 144, 168, 168, 50, 168, 52, 52, 154, + 128, 64, 64, 130, 64, 132, 132, 194, 64, 136, 136, 194, 136, 196, 196, 74, + 64, 144, 144, 194, 144, 196, 196, 82, 144, 200, 200, 82, 200, 84, 84, 154, + 64, 160, 160, 194, 160, 196, 196, 98, 160, 200, 200, 98, 200, 100, 100, 170, + 160, 208, 208, 98, 208, 100, 100, 178, 208, 104, 104, 178, 104, 180, 180, 90, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 11, + 16, 17, 18, 3, 20, 5, 6, 19, 24, 9, 10, 19, 12, 21, 22, 27, + 32, 33, 34, 3, 36, 5, 6, 35, 40, 9, 10, 35, 12, 37, 38, 43, + 48, 17, 18, 35, 20, 37, 38, 51, 24, 41, 42, 51, 44, 53, 54, 27, + 64, 65, 66, 3, 68, 5, 6, 67, 72, 9, 10, 67, 12, 69, 70, 75, + 80, 17, 18, 67, 20, 69, 70, 83, 24, 73, 74, 83, 76, 85, 86, 27, + 96, 33, 34, 67, 36, 69, 70, 99, 40, 73, 74, 99, 76, 101, 102, 43, + 48, 81, 82, 99, 84, 101, 102, 51, 88, 105, 106, 51, 108, 53, 54, 91, + 128, 129, 130, 3, 132, 5, 6, 131, 136, 9, 10, 131, 12, 133, 134, 139, + 144, 17, 18, 131, 20, 133, 134, 147, 24, 137, 138, 147, 140, 149, 150, 27, + 160, 33, 34, 131, 36, 133, 134, 163, 40, 137, 138, 163, 140, 165, 166, 43, + 48, 145, 146, 163, 148, 165, 166, 51, 152, 169, 170, 51, 172, 53, 54, 155, + 192, 65, 66, 131, 68, 133, 134, 195, 72, 137, 138, 195, 140, 197, 198, 75, + 80, 145, 146, 195, 148, 197, 198, 83, 152, 201, 202, 83, 204, 85, 86, 155, + 96, 161, 162, 195, 164, 197, 198, 99, 168, 201, 202, 99, 204, 101, 102, 171, + 176, 209, 210, 99, 212, 101, 102, 179, 216, 105, 106, 179, 108, 181, 182, 91, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 12, + 0, 0, 0, 16, 0, 16, 16, 20, 0, 16, 16, 24, 16, 24, 24, 28, + 0, 0, 0, 32, 0, 32, 32, 36, 0, 32, 32, 40, 32, 40, 40, 44, + 0, 32, 32, 48, 32, 48, 48, 52, 32, 48, 48, 56, 48, 56, 56, 28, + 0, 0, 0, 64, 0, 64, 64, 68, 0, 64, 64, 72, 64, 72, 72, 76, + 0, 64, 64, 80, 64, 80, 80, 84, 64, 80, 80, 88, 80, 88, 88, 28, + 0, 64, 64, 96, 64, 96, 96, 100, 64, 96, 96, 104, 96, 104, 104, 44, + 64, 96, 96, 112, 96, 112, 112, 52, 96, 112, 112, 56, 112, 56, 56, 92, + 0, 0, 0, 128, 0, 128, 128, 132, 0, 128, 128, 136, 128, 136, 136, 140, + 0, 128, 128, 144, 128, 144, 144, 148, 128, 144, 144, 152, 144, 152, 152, 28, + 0, 128, 128, 160, 128, 160, 160, 164, 128, 160, 160, 168, 160, 168, 168, 44, + 128, 160, 160, 176, 160, 176, 176, 52, 160, 176, 176, 56, 176, 56, 56, 156, + 0, 128, 128, 192, 128, 192, 192, 196, 128, 192, 192, 200, 192, 200, 200, 76, + 128, 192, 192, 208, 192, 208, 208, 84, 192, 208, 208, 88, 208, 88, 88, 156, + 128, 192, 192, 224, 192, 224, 224, 100, 192, 224, 224, 104, 224, 104, 104, 172, + 192, 224, 224, 112, 224, 112, 112, 180, 224, 112, 112, 184, 112, 184, 184, 92, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 13, + 16, 1, 2, 17, 4, 17, 18, 21, 8, 17, 18, 25, 20, 25, 26, 29, + 32, 1, 2, 33, 4, 33, 34, 37, 8, 33, 34, 41, 36, 41, 42, 45, + 16, 33, 34, 49, 36, 49, 50, 53, 40, 49, 50, 57, 52, 57, 58, 29, + 64, 1, 2, 65, 4, 65, 66, 69, 8, 65, 66, 73, 68, 73, 74, 77, + 16, 65, 66, 81, 68, 81, 82, 85, 72, 81, 82, 89, 84, 89, 90, 29, + 32, 65, 66, 97, 68, 97, 98, 101, 72, 97, 98, 105, 100, 105, 106, 45, + 80, 97, 98, 113, 100, 113, 114, 53, 104, 113, 114, 57, 116, 57, 58, 93, + 128, 1, 2, 129, 4, 129, 130, 133, 8, 129, 130, 137, 132, 137, 138, 141, + 16, 129, 130, 145, 132, 145, 146, 149, 136, 145, 146, 153, 148, 153, 154, 29, + 32, 129, 130, 161, 132, 161, 162, 165, 136, 161, 162, 169, 164, 169, 170, 45, + 144, 161, 162, 177, 164, 177, 178, 53, 168, 177, 178, 57, 180, 57, 58, 157, + 64, 129, 130, 193, 132, 193, 194, 197, 136, 193, 194, 201, 196, 201, 202, 77, + 144, 193, 194, 209, 196, 209, 210, 85, 200, 209, 210, 89, 212, 89, 90, 157, + 160, 193, 194, 225, 196, 225, 226, 101, 200, 225, 226, 105, 228, 105, 106, 173, + 208, 225, 226, 113, 228, 113, 114, 181, 232, 113, 114, 185, 116, 185, 186, 93, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 14, + 0, 16, 16, 18, 16, 20, 20, 22, 16, 24, 24, 26, 24, 28, 28, 30, + 0, 32, 32, 34, 32, 36, 36, 38, 32, 40, 40, 42, 40, 44, 44, 46, + 32, 48, 48, 50, 48, 52, 52, 54, 48, 56, 56, 58, 56, 60, 60, 30, + 0, 64, 64, 66, 64, 68, 68, 70, 64, 72, 72, 74, 72, 76, 76, 78, + 64, 80, 80, 82, 80, 84, 84, 86, 80, 88, 88, 90, 88, 92, 92, 30, + 64, 96, 96, 98, 96, 100, 100, 102, 96, 104, 104, 106, 104, 108, 108, 46, + 96, 112, 112, 114, 112, 116, 116, 54, 112, 120, 120, 58, 120, 60, 60, 94, + 0, 128, 128, 130, 128, 132, 132, 134, 128, 136, 136, 138, 136, 140, 140, 142, + 128, 144, 144, 146, 144, 148, 148, 150, 144, 152, 152, 154, 152, 156, 156, 30, + 128, 160, 160, 162, 160, 164, 164, 166, 160, 168, 168, 170, 168, 172, 172, 46, + 160, 176, 176, 178, 176, 180, 180, 54, 176, 184, 184, 58, 184, 60, 60, 158, + 128, 192, 192, 194, 192, 196, 196, 198, 192, 200, 200, 202, 200, 204, 204, 78, + 192, 208, 208, 210, 208, 212, 212, 86, 208, 216, 216, 90, 216, 92, 92, 158, + 192, 224, 224, 226, 224, 228, 228, 102, 224, 232, 232, 106, 232, 108, 108, 174, + 224, 240, 240, 114, 240, 116, 116, 182, 240, 120, 120, 186, 120, 188, 188, 94, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 31, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 31, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 47, + 112, 113, 114, 115, 116, 117, 118, 55, 120, 121, 122, 59, 124, 61, 62, 95, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 31, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 47, + 176, 177, 178, 179, 180, 181, 182, 55, 184, 185, 186, 59, 188, 61, 62, 159, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 79, + 208, 209, 210, 211, 212, 213, 214, 87, 216, 217, 218, 91, 220, 93, 94, 159, + 224, 225, 226, 227, 228, 229, 230, 103, 232, 233, 234, 107, 236, 109, 110, 175, + 240, 241, 242, 115, 244, 117, 118, 183, 248, 121, 122, 187, 124, 189, 190, 95, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 96, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 160, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 192, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 192, + 0, 0, 0, 128, 0, 128, 128, 192, 0, 128, 128, 192, 128, 192, 192, 96, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 33, + 64, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 65, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 65, + 16, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 97, + 128, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 129, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 129, + 16, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 161, + 64, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 129, + 16, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 193, + 32, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 193, + 16, 1, 2, 129, 4, 129, 130, 193, 8, 129, 130, 193, 132, 193, 194, 97, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 2, + 0, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 2, + 0, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 2, + 32, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 34, + 0, 64, 64, 2, 64, 4, 4, 2, 64, 8, 8, 2, 8, 4, 4, 2, + 64, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 66, + 64, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 66, + 32, 16, 16, 2, 16, 4, 4, 66, 16, 8, 8, 66, 8, 68, 68, 98, + 0, 128, 128, 2, 128, 4, 4, 2, 128, 8, 8, 2, 8, 4, 4, 2, + 128, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 130, + 128, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 130, + 32, 16, 16, 2, 16, 4, 4, 130, 16, 8, 8, 130, 8, 132, 132, 162, + 128, 64, 64, 2, 64, 4, 4, 2, 64, 8, 8, 2, 8, 4, 4, 130, + 64, 16, 16, 2, 16, 4, 4, 130, 16, 8, 8, 130, 8, 132, 132, 194, + 64, 32, 32, 2, 32, 4, 4, 130, 32, 8, 8, 130, 8, 132, 132, 194, + 32, 16, 16, 130, 16, 132, 132, 194, 16, 136, 136, 194, 136, 196, 196, 98, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 3, + 16, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 3, + 32, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 3, + 48, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 35, + 64, 65, 66, 3, 68, 5, 6, 3, 72, 9, 10, 3, 12, 5, 6, 3, + 80, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 67, + 96, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 67, + 48, 17, 18, 3, 20, 5, 6, 67, 24, 9, 10, 67, 12, 69, 70, 99, + 128, 129, 130, 3, 132, 5, 6, 3, 136, 9, 10, 3, 12, 5, 6, 3, + 144, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 131, + 160, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 131, + 48, 17, 18, 3, 20, 5, 6, 131, 24, 9, 10, 131, 12, 133, 134, 163, + 192, 65, 66, 3, 68, 5, 6, 3, 72, 9, 10, 3, 12, 5, 6, 131, + 80, 17, 18, 3, 20, 5, 6, 131, 24, 9, 10, 131, 12, 133, 134, 195, + 96, 33, 34, 3, 36, 5, 6, 131, 40, 9, 10, 131, 12, 133, 134, 195, + 48, 17, 18, 131, 20, 133, 134, 195, 24, 137, 138, 195, 140, 197, 198, 99, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 4, + 0, 0, 0, 16, 0, 16, 16, 4, 0, 16, 16, 8, 16, 8, 8, 4, + 0, 0, 0, 32, 0, 32, 32, 4, 0, 32, 32, 8, 32, 8, 8, 4, + 0, 32, 32, 16, 32, 16, 16, 4, 32, 16, 16, 8, 16, 8, 8, 36, + 0, 0, 0, 64, 0, 64, 64, 4, 0, 64, 64, 8, 64, 8, 8, 4, + 0, 64, 64, 16, 64, 16, 16, 4, 64, 16, 16, 8, 16, 8, 8, 68, + 0, 64, 64, 32, 64, 32, 32, 4, 64, 32, 32, 8, 32, 8, 8, 68, + 64, 32, 32, 16, 32, 16, 16, 68, 32, 16, 16, 72, 16, 72, 72, 100, + 0, 0, 0, 128, 0, 128, 128, 4, 0, 128, 128, 8, 128, 8, 8, 4, + 0, 128, 128, 16, 128, 16, 16, 4, 128, 16, 16, 8, 16, 8, 8, 132, + 0, 128, 128, 32, 128, 32, 32, 4, 128, 32, 32, 8, 32, 8, 8, 132, + 128, 32, 32, 16, 32, 16, 16, 132, 32, 16, 16, 136, 16, 136, 136, 164, + 0, 128, 128, 64, 128, 64, 64, 4, 128, 64, 64, 8, 64, 8, 8, 132, + 128, 64, 64, 16, 64, 16, 16, 132, 64, 16, 16, 136, 16, 136, 136, 196, + 128, 64, 64, 32, 64, 32, 32, 132, 64, 32, 32, 136, 32, 136, 136, 196, + 64, 32, 32, 144, 32, 144, 144, 196, 32, 144, 144, 200, 144, 200, 200, 100, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 5, + 16, 1, 2, 17, 4, 17, 18, 5, 8, 17, 18, 9, 20, 9, 10, 5, + 32, 1, 2, 33, 4, 33, 34, 5, 8, 33, 34, 9, 36, 9, 10, 5, + 16, 33, 34, 17, 36, 17, 18, 5, 40, 17, 18, 9, 20, 9, 10, 37, + 64, 1, 2, 65, 4, 65, 66, 5, 8, 65, 66, 9, 68, 9, 10, 5, + 16, 65, 66, 17, 68, 17, 18, 5, 72, 17, 18, 9, 20, 9, 10, 69, + 32, 65, 66, 33, 68, 33, 34, 5, 72, 33, 34, 9, 36, 9, 10, 69, + 80, 33, 34, 17, 36, 17, 18, 69, 40, 17, 18, 73, 20, 73, 74, 101, + 128, 1, 2, 129, 4, 129, 130, 5, 8, 129, 130, 9, 132, 9, 10, 5, + 16, 129, 130, 17, 132, 17, 18, 5, 136, 17, 18, 9, 20, 9, 10, 133, + 32, 129, 130, 33, 132, 33, 34, 5, 136, 33, 34, 9, 36, 9, 10, 133, + 144, 33, 34, 17, 36, 17, 18, 133, 40, 17, 18, 137, 20, 137, 138, 165, + 64, 129, 130, 65, 132, 65, 66, 5, 136, 65, 66, 9, 68, 9, 10, 133, + 144, 65, 66, 17, 68, 17, 18, 133, 72, 17, 18, 137, 20, 137, 138, 197, + 160, 65, 66, 33, 68, 33, 34, 133, 72, 33, 34, 137, 36, 137, 138, 197, + 80, 33, 34, 145, 36, 145, 146, 197, 40, 145, 146, 201, 148, 201, 202, 101, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 6, + 0, 16, 16, 18, 16, 20, 20, 6, 16, 24, 24, 10, 24, 12, 12, 6, + 0, 32, 32, 34, 32, 36, 36, 6, 32, 40, 40, 10, 40, 12, 12, 6, + 32, 48, 48, 18, 48, 20, 20, 6, 48, 24, 24, 10, 24, 12, 12, 38, + 0, 64, 64, 66, 64, 68, 68, 6, 64, 72, 72, 10, 72, 12, 12, 6, + 64, 80, 80, 18, 80, 20, 20, 6, 80, 24, 24, 10, 24, 12, 12, 70, + 64, 96, 96, 34, 96, 36, 36, 6, 96, 40, 40, 10, 40, 12, 12, 70, + 96, 48, 48, 18, 48, 20, 20, 70, 48, 24, 24, 74, 24, 76, 76, 102, + 0, 128, 128, 130, 128, 132, 132, 6, 128, 136, 136, 10, 136, 12, 12, 6, + 128, 144, 144, 18, 144, 20, 20, 6, 144, 24, 24, 10, 24, 12, 12, 134, + 128, 160, 160, 34, 160, 36, 36, 6, 160, 40, 40, 10, 40, 12, 12, 134, + 160, 48, 48, 18, 48, 20, 20, 134, 48, 24, 24, 138, 24, 140, 140, 166, + 128, 192, 192, 66, 192, 68, 68, 6, 192, 72, 72, 10, 72, 12, 12, 134, + 192, 80, 80, 18, 80, 20, 20, 134, 80, 24, 24, 138, 24, 140, 140, 198, + 192, 96, 96, 34, 96, 36, 36, 134, 96, 40, 40, 138, 40, 140, 140, 198, + 96, 48, 48, 146, 48, 148, 148, 198, 48, 152, 152, 202, 152, 204, 204, 102, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 7, + 16, 17, 18, 19, 20, 21, 22, 7, 24, 25, 26, 11, 28, 13, 14, 7, + 32, 33, 34, 35, 36, 37, 38, 7, 40, 41, 42, 11, 44, 13, 14, 7, + 48, 49, 50, 19, 52, 21, 22, 7, 56, 25, 26, 11, 28, 13, 14, 39, + 64, 65, 66, 67, 68, 69, 70, 7, 72, 73, 74, 11, 76, 13, 14, 7, + 80, 81, 82, 19, 84, 21, 22, 7, 88, 25, 26, 11, 28, 13, 14, 71, + 96, 97, 98, 35, 100, 37, 38, 7, 104, 41, 42, 11, 44, 13, 14, 71, + 112, 49, 50, 19, 52, 21, 22, 71, 56, 25, 26, 75, 28, 77, 78, 103, + 128, 129, 130, 131, 132, 133, 134, 7, 136, 137, 138, 11, 140, 13, 14, 7, + 144, 145, 146, 19, 148, 21, 22, 7, 152, 25, 26, 11, 28, 13, 14, 135, + 160, 161, 162, 35, 164, 37, 38, 7, 168, 41, 42, 11, 44, 13, 14, 135, + 176, 49, 50, 19, 52, 21, 22, 135, 56, 25, 26, 139, 28, 141, 142, 167, + 192, 193, 194, 67, 196, 69, 70, 7, 200, 73, 74, 11, 76, 13, 14, 135, + 208, 81, 82, 19, 84, 21, 22, 135, 88, 25, 26, 139, 28, 141, 142, 199, + 224, 97, 98, 35, 100, 37, 38, 135, 104, 41, 42, 139, 44, 141, 142, 199, + 112, 49, 50, 147, 52, 149, 150, 199, 56, 153, 154, 203, 156, 205, 206, 103, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, + 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 16, 0, 16, 16, 8, + 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 32, 0, 32, 32, 8, + 0, 0, 0, 32, 0, 32, 32, 16, 0, 32, 32, 16, 32, 16, 16, 40, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 8, + 0, 0, 0, 64, 0, 64, 64, 16, 0, 64, 64, 16, 64, 16, 16, 72, + 0, 0, 0, 64, 0, 64, 64, 32, 0, 64, 64, 32, 64, 32, 32, 72, + 0, 64, 64, 32, 64, 32, 32, 80, 64, 32, 32, 80, 32, 80, 80, 104, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 8, + 0, 0, 0, 128, 0, 128, 128, 16, 0, 128, 128, 16, 128, 16, 16, 136, + 0, 0, 0, 128, 0, 128, 128, 32, 0, 128, 128, 32, 128, 32, 32, 136, + 0, 128, 128, 32, 128, 32, 32, 144, 128, 32, 32, 144, 32, 144, 144, 168, + 0, 0, 0, 128, 0, 128, 128, 64, 0, 128, 128, 64, 128, 64, 64, 136, + 0, 128, 128, 64, 128, 64, 64, 144, 128, 64, 64, 144, 64, 144, 144, 200, + 0, 128, 128, 64, 128, 64, 64, 160, 128, 64, 64, 160, 64, 160, 160, 200, + 128, 64, 64, 160, 64, 160, 160, 208, 64, 160, 160, 208, 160, 208, 208, 104, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 9, + 16, 1, 2, 1, 4, 1, 2, 17, 8, 1, 2, 17, 4, 17, 18, 9, + 32, 1, 2, 1, 4, 1, 2, 33, 8, 1, 2, 33, 4, 33, 34, 9, + 16, 1, 2, 33, 4, 33, 34, 17, 8, 33, 34, 17, 36, 17, 18, 41, + 64, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 9, + 16, 1, 2, 65, 4, 65, 66, 17, 8, 65, 66, 17, 68, 17, 18, 73, + 32, 1, 2, 65, 4, 65, 66, 33, 8, 65, 66, 33, 68, 33, 34, 73, + 16, 65, 66, 33, 68, 33, 34, 81, 72, 33, 34, 81, 36, 81, 82, 105, + 128, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 9, + 16, 1, 2, 129, 4, 129, 130, 17, 8, 129, 130, 17, 132, 17, 18, 137, + 32, 1, 2, 129, 4, 129, 130, 33, 8, 129, 130, 33, 132, 33, 34, 137, + 16, 129, 130, 33, 132, 33, 34, 145, 136, 33, 34, 145, 36, 145, 146, 169, + 64, 1, 2, 129, 4, 129, 130, 65, 8, 129, 130, 65, 132, 65, 66, 137, + 16, 129, 130, 65, 132, 65, 66, 145, 136, 65, 66, 145, 68, 145, 146, 201, + 32, 129, 130, 65, 132, 65, 66, 161, 136, 65, 66, 161, 68, 161, 162, 201, + 144, 65, 66, 161, 68, 161, 162, 209, 72, 161, 162, 209, 164, 209, 210, 105, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 10, + 0, 16, 16, 2, 16, 4, 4, 18, 16, 8, 8, 18, 8, 20, 20, 10, + 0, 32, 32, 2, 32, 4, 4, 34, 32, 8, 8, 34, 8, 36, 36, 10, + 32, 16, 16, 34, 16, 36, 36, 18, 16, 40, 40, 18, 40, 20, 20, 42, + 0, 64, 64, 2, 64, 4, 4, 66, 64, 8, 8, 66, 8, 68, 68, 10, + 64, 16, 16, 66, 16, 68, 68, 18, 16, 72, 72, 18, 72, 20, 20, 74, + 64, 32, 32, 66, 32, 68, 68, 34, 32, 72, 72, 34, 72, 36, 36, 74, + 32, 80, 80, 34, 80, 36, 36, 82, 80, 40, 40, 82, 40, 84, 84, 106, + 0, 128, 128, 2, 128, 4, 4, 130, 128, 8, 8, 130, 8, 132, 132, 10, + 128, 16, 16, 130, 16, 132, 132, 18, 16, 136, 136, 18, 136, 20, 20, 138, + 128, 32, 32, 130, 32, 132, 132, 34, 32, 136, 136, 34, 136, 36, 36, 138, + 32, 144, 144, 34, 144, 36, 36, 146, 144, 40, 40, 146, 40, 148, 148, 170, + 128, 64, 64, 130, 64, 132, 132, 66, 64, 136, 136, 66, 136, 68, 68, 138, + 64, 144, 144, 66, 144, 68, 68, 146, 144, 72, 72, 146, 72, 148, 148, 202, + 64, 160, 160, 66, 160, 68, 68, 162, 160, 72, 72, 162, 72, 164, 164, 202, + 160, 80, 80, 162, 80, 164, 164, 210, 80, 168, 168, 210, 168, 212, 212, 106, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 11, + 16, 17, 18, 3, 20, 5, 6, 19, 24, 9, 10, 19, 12, 21, 22, 11, + 32, 33, 34, 3, 36, 5, 6, 35, 40, 9, 10, 35, 12, 37, 38, 11, + 48, 17, 18, 35, 20, 37, 38, 19, 24, 41, 42, 19, 44, 21, 22, 43, + 64, 65, 66, 3, 68, 5, 6, 67, 72, 9, 10, 67, 12, 69, 70, 11, + 80, 17, 18, 67, 20, 69, 70, 19, 24, 73, 74, 19, 76, 21, 22, 75, + 96, 33, 34, 67, 36, 69, 70, 35, 40, 73, 74, 35, 76, 37, 38, 75, + 48, 81, 82, 35, 84, 37, 38, 83, 88, 41, 42, 83, 44, 85, 86, 107, + 128, 129, 130, 3, 132, 5, 6, 131, 136, 9, 10, 131, 12, 133, 134, 11, + 144, 17, 18, 131, 20, 133, 134, 19, 24, 137, 138, 19, 140, 21, 22, 139, + 160, 33, 34, 131, 36, 133, 134, 35, 40, 137, 138, 35, 140, 37, 38, 139, + 48, 145, 146, 35, 148, 37, 38, 147, 152, 41, 42, 147, 44, 149, 150, 171, + 192, 65, 66, 131, 68, 133, 134, 67, 72, 137, 138, 67, 140, 69, 70, 139, + 80, 145, 146, 67, 148, 69, 70, 147, 152, 73, 74, 147, 76, 149, 150, 203, + 96, 161, 162, 67, 164, 69, 70, 163, 168, 73, 74, 163, 76, 165, 166, 203, + 176, 81, 82, 163, 84, 165, 166, 211, 88, 169, 170, 211, 172, 213, 214, 107, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 12, + 0, 0, 0, 16, 0, 16, 16, 20, 0, 16, 16, 24, 16, 24, 24, 12, + 0, 0, 0, 32, 0, 32, 32, 36, 0, 32, 32, 40, 32, 40, 40, 12, + 0, 32, 32, 48, 32, 48, 48, 20, 32, 48, 48, 24, 48, 24, 24, 44, + 0, 0, 0, 64, 0, 64, 64, 68, 0, 64, 64, 72, 64, 72, 72, 12, + 0, 64, 64, 80, 64, 80, 80, 20, 64, 80, 80, 24, 80, 24, 24, 76, + 0, 64, 64, 96, 64, 96, 96, 36, 64, 96, 96, 40, 96, 40, 40, 76, + 64, 96, 96, 48, 96, 48, 48, 84, 96, 48, 48, 88, 48, 88, 88, 108, + 0, 0, 0, 128, 0, 128, 128, 132, 0, 128, 128, 136, 128, 136, 136, 12, + 0, 128, 128, 144, 128, 144, 144, 20, 128, 144, 144, 24, 144, 24, 24, 140, + 0, 128, 128, 160, 128, 160, 160, 36, 128, 160, 160, 40, 160, 40, 40, 140, + 128, 160, 160, 48, 160, 48, 48, 148, 160, 48, 48, 152, 48, 152, 152, 172, + 0, 128, 128, 192, 128, 192, 192, 68, 128, 192, 192, 72, 192, 72, 72, 140, + 128, 192, 192, 80, 192, 80, 80, 148, 192, 80, 80, 152, 80, 152, 152, 204, + 128, 192, 192, 96, 192, 96, 96, 164, 192, 96, 96, 168, 96, 168, 168, 204, + 192, 96, 96, 176, 96, 176, 176, 212, 96, 176, 176, 216, 176, 216, 216, 108, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 13, + 16, 1, 2, 17, 4, 17, 18, 21, 8, 17, 18, 25, 20, 25, 26, 13, + 32, 1, 2, 33, 4, 33, 34, 37, 8, 33, 34, 41, 36, 41, 42, 13, + 16, 33, 34, 49, 36, 49, 50, 21, 40, 49, 50, 25, 52, 25, 26, 45, + 64, 1, 2, 65, 4, 65, 66, 69, 8, 65, 66, 73, 68, 73, 74, 13, + 16, 65, 66, 81, 68, 81, 82, 21, 72, 81, 82, 25, 84, 25, 26, 77, + 32, 65, 66, 97, 68, 97, 98, 37, 72, 97, 98, 41, 100, 41, 42, 77, + 80, 97, 98, 49, 100, 49, 50, 85, 104, 49, 50, 89, 52, 89, 90, 109, + 128, 1, 2, 129, 4, 129, 130, 133, 8, 129, 130, 137, 132, 137, 138, 13, + 16, 129, 130, 145, 132, 145, 146, 21, 136, 145, 146, 25, 148, 25, 26, 141, + 32, 129, 130, 161, 132, 161, 162, 37, 136, 161, 162, 41, 164, 41, 42, 141, + 144, 161, 162, 49, 164, 49, 50, 149, 168, 49, 50, 153, 52, 153, 154, 173, + 64, 129, 130, 193, 132, 193, 194, 69, 136, 193, 194, 73, 196, 73, 74, 141, + 144, 193, 194, 81, 196, 81, 82, 149, 200, 81, 82, 153, 84, 153, 154, 205, + 160, 193, 194, 97, 196, 97, 98, 165, 200, 97, 98, 169, 100, 169, 170, 205, + 208, 97, 98, 177, 100, 177, 178, 213, 104, 177, 178, 217, 180, 217, 218, 109, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 14, + 0, 16, 16, 18, 16, 20, 20, 22, 16, 24, 24, 26, 24, 28, 28, 14, + 0, 32, 32, 34, 32, 36, 36, 38, 32, 40, 40, 42, 40, 44, 44, 14, + 32, 48, 48, 50, 48, 52, 52, 22, 48, 56, 56, 26, 56, 28, 28, 46, + 0, 64, 64, 66, 64, 68, 68, 70, 64, 72, 72, 74, 72, 76, 76, 14, + 64, 80, 80, 82, 80, 84, 84, 22, 80, 88, 88, 26, 88, 28, 28, 78, + 64, 96, 96, 98, 96, 100, 100, 38, 96, 104, 104, 42, 104, 44, 44, 78, + 96, 112, 112, 50, 112, 52, 52, 86, 112, 56, 56, 90, 56, 92, 92, 110, + 0, 128, 128, 130, 128, 132, 132, 134, 128, 136, 136, 138, 136, 140, 140, 14, + 128, 144, 144, 146, 144, 148, 148, 22, 144, 152, 152, 26, 152, 28, 28, 142, + 128, 160, 160, 162, 160, 164, 164, 38, 160, 168, 168, 42, 168, 44, 44, 142, + 160, 176, 176, 50, 176, 52, 52, 150, 176, 56, 56, 154, 56, 156, 156, 174, + 128, 192, 192, 194, 192, 196, 196, 70, 192, 200, 200, 74, 200, 76, 76, 142, + 192, 208, 208, 82, 208, 84, 84, 150, 208, 88, 88, 154, 88, 156, 156, 206, + 192, 224, 224, 98, 224, 100, 100, 166, 224, 104, 104, 170, 104, 172, 172, 206, + 224, 112, 112, 178, 112, 180, 180, 214, 112, 184, 184, 218, 184, 220, 220, 110, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 15, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 15, + 48, 49, 50, 51, 52, 53, 54, 23, 56, 57, 58, 27, 60, 29, 30, 47, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 15, + 80, 81, 82, 83, 84, 85, 86, 23, 88, 89, 90, 27, 92, 29, 30, 79, + 96, 97, 98, 99, 100, 101, 102, 39, 104, 105, 106, 43, 108, 45, 46, 79, + 112, 113, 114, 51, 116, 53, 54, 87, 120, 57, 58, 91, 60, 93, 94, 111, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 15, + 144, 145, 146, 147, 148, 149, 150, 23, 152, 153, 154, 27, 156, 29, 30, 143, + 160, 161, 162, 163, 164, 165, 166, 39, 168, 169, 170, 43, 172, 45, 46, 143, + 176, 177, 178, 51, 180, 53, 54, 151, 184, 57, 58, 155, 60, 157, 158, 175, + 192, 193, 194, 195, 196, 197, 198, 71, 200, 201, 202, 75, 204, 77, 78, 143, + 208, 209, 210, 83, 212, 85, 86, 151, 216, 89, 90, 155, 92, 157, 158, 207, + 224, 225, 226, 99, 228, 101, 102, 167, 232, 105, 106, 171, 108, 173, 174, 207, + 240, 113, 114, 179, 116, 181, 182, 215, 120, 185, 186, 219, 188, 221, 222, 111, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, + 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 32, 0, 32, 32, 48, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 80, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 96, + 0, 0, 0, 64, 0, 64, 64, 96, 0, 64, 64, 96, 64, 96, 96, 112, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 144, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 160, + 0, 0, 0, 128, 0, 128, 128, 160, 0, 128, 128, 160, 128, 160, 160, 176, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 192, + 0, 0, 0, 128, 0, 128, 128, 192, 0, 128, 128, 192, 128, 192, 192, 208, + 0, 0, 0, 128, 0, 128, 128, 192, 0, 128, 128, 192, 128, 192, 192, 224, + 0, 128, 128, 192, 128, 192, 192, 224, 128, 192, 192, 224, 192, 224, 224, 112, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 17, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 33, + 16, 1, 2, 1, 4, 1, 2, 33, 8, 1, 2, 33, 4, 33, 34, 49, + 64, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 65, + 16, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 81, + 32, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 97, + 16, 1, 2, 65, 4, 65, 66, 97, 8, 65, 66, 97, 68, 97, 98, 113, + 128, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 129, + 16, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 145, + 32, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 161, + 16, 1, 2, 129, 4, 129, 130, 161, 8, 129, 130, 161, 132, 161, 162, 177, + 64, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 193, + 16, 1, 2, 129, 4, 129, 130, 193, 8, 129, 130, 193, 132, 193, 194, 209, + 32, 1, 2, 129, 4, 129, 130, 193, 8, 129, 130, 193, 132, 193, 194, 225, + 16, 129, 130, 193, 132, 193, 194, 225, 136, 193, 194, 225, 196, 225, 226, 113, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 2, + 0, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 18, + 0, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 34, + 32, 16, 16, 2, 16, 4, 4, 34, 16, 8, 8, 34, 8, 36, 36, 50, + 0, 64, 64, 2, 64, 4, 4, 2, 64, 8, 8, 2, 8, 4, 4, 66, + 64, 16, 16, 2, 16, 4, 4, 66, 16, 8, 8, 66, 8, 68, 68, 82, + 64, 32, 32, 2, 32, 4, 4, 66, 32, 8, 8, 66, 8, 68, 68, 98, + 32, 16, 16, 66, 16, 68, 68, 98, 16, 72, 72, 98, 72, 100, 100, 114, + 0, 128, 128, 2, 128, 4, 4, 2, 128, 8, 8, 2, 8, 4, 4, 130, + 128, 16, 16, 2, 16, 4, 4, 130, 16, 8, 8, 130, 8, 132, 132, 146, + 128, 32, 32, 2, 32, 4, 4, 130, 32, 8, 8, 130, 8, 132, 132, 162, + 32, 16, 16, 130, 16, 132, 132, 162, 16, 136, 136, 162, 136, 164, 164, 178, + 128, 64, 64, 2, 64, 4, 4, 130, 64, 8, 8, 130, 8, 132, 132, 194, + 64, 16, 16, 130, 16, 132, 132, 194, 16, 136, 136, 194, 136, 196, 196, 210, + 64, 32, 32, 130, 32, 132, 132, 194, 32, 136, 136, 194, 136, 196, 196, 226, + 32, 144, 144, 194, 144, 196, 196, 226, 144, 200, 200, 226, 200, 228, 228, 114, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 3, + 16, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 19, + 32, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 35, + 48, 17, 18, 3, 20, 5, 6, 35, 24, 9, 10, 35, 12, 37, 38, 51, + 64, 65, 66, 3, 68, 5, 6, 3, 72, 9, 10, 3, 12, 5, 6, 67, + 80, 17, 18, 3, 20, 5, 6, 67, 24, 9, 10, 67, 12, 69, 70, 83, + 96, 33, 34, 3, 36, 5, 6, 67, 40, 9, 10, 67, 12, 69, 70, 99, + 48, 17, 18, 67, 20, 69, 70, 99, 24, 73, 74, 99, 76, 101, 102, 115, + 128, 129, 130, 3, 132, 5, 6, 3, 136, 9, 10, 3, 12, 5, 6, 131, + 144, 17, 18, 3, 20, 5, 6, 131, 24, 9, 10, 131, 12, 133, 134, 147, + 160, 33, 34, 3, 36, 5, 6, 131, 40, 9, 10, 131, 12, 133, 134, 163, + 48, 17, 18, 131, 20, 133, 134, 163, 24, 137, 138, 163, 140, 165, 166, 179, + 192, 65, 66, 3, 68, 5, 6, 131, 72, 9, 10, 131, 12, 133, 134, 195, + 80, 17, 18, 131, 20, 133, 134, 195, 24, 137, 138, 195, 140, 197, 198, 211, + 96, 33, 34, 131, 36, 133, 134, 195, 40, 137, 138, 195, 140, 197, 198, 227, + 48, 145, 146, 195, 148, 197, 198, 227, 152, 201, 202, 227, 204, 229, 230, 115, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 4, + 0, 0, 0, 16, 0, 16, 16, 4, 0, 16, 16, 8, 16, 8, 8, 20, + 0, 0, 0, 32, 0, 32, 32, 4, 0, 32, 32, 8, 32, 8, 8, 36, + 0, 32, 32, 16, 32, 16, 16, 36, 32, 16, 16, 40, 16, 40, 40, 52, + 0, 0, 0, 64, 0, 64, 64, 4, 0, 64, 64, 8, 64, 8, 8, 68, + 0, 64, 64, 16, 64, 16, 16, 68, 64, 16, 16, 72, 16, 72, 72, 84, + 0, 64, 64, 32, 64, 32, 32, 68, 64, 32, 32, 72, 32, 72, 72, 100, + 64, 32, 32, 80, 32, 80, 80, 100, 32, 80, 80, 104, 80, 104, 104, 116, + 0, 0, 0, 128, 0, 128, 128, 4, 0, 128, 128, 8, 128, 8, 8, 132, + 0, 128, 128, 16, 128, 16, 16, 132, 128, 16, 16, 136, 16, 136, 136, 148, + 0, 128, 128, 32, 128, 32, 32, 132, 128, 32, 32, 136, 32, 136, 136, 164, + 128, 32, 32, 144, 32, 144, 144, 164, 32, 144, 144, 168, 144, 168, 168, 180, + 0, 128, 128, 64, 128, 64, 64, 132, 128, 64, 64, 136, 64, 136, 136, 196, + 128, 64, 64, 144, 64, 144, 144, 196, 64, 144, 144, 200, 144, 200, 200, 212, + 128, 64, 64, 160, 64, 160, 160, 196, 64, 160, 160, 200, 160, 200, 200, 228, + 64, 160, 160, 208, 160, 208, 208, 228, 160, 208, 208, 232, 208, 232, 232, 116, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 5, + 16, 1, 2, 17, 4, 17, 18, 5, 8, 17, 18, 9, 20, 9, 10, 21, + 32, 1, 2, 33, 4, 33, 34, 5, 8, 33, 34, 9, 36, 9, 10, 37, + 16, 33, 34, 17, 36, 17, 18, 37, 40, 17, 18, 41, 20, 41, 42, 53, + 64, 1, 2, 65, 4, 65, 66, 5, 8, 65, 66, 9, 68, 9, 10, 69, + 16, 65, 66, 17, 68, 17, 18, 69, 72, 17, 18, 73, 20, 73, 74, 85, + 32, 65, 66, 33, 68, 33, 34, 69, 72, 33, 34, 73, 36, 73, 74, 101, + 80, 33, 34, 81, 36, 81, 82, 101, 40, 81, 82, 105, 84, 105, 106, 117, + 128, 1, 2, 129, 4, 129, 130, 5, 8, 129, 130, 9, 132, 9, 10, 133, + 16, 129, 130, 17, 132, 17, 18, 133, 136, 17, 18, 137, 20, 137, 138, 149, + 32, 129, 130, 33, 132, 33, 34, 133, 136, 33, 34, 137, 36, 137, 138, 165, + 144, 33, 34, 145, 36, 145, 146, 165, 40, 145, 146, 169, 148, 169, 170, 181, + 64, 129, 130, 65, 132, 65, 66, 133, 136, 65, 66, 137, 68, 137, 138, 197, + 144, 65, 66, 145, 68, 145, 146, 197, 72, 145, 146, 201, 148, 201, 202, 213, + 160, 65, 66, 161, 68, 161, 162, 197, 72, 161, 162, 201, 164, 201, 202, 229, + 80, 161, 162, 209, 164, 209, 210, 229, 168, 209, 210, 233, 212, 233, 234, 117, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 6, + 0, 16, 16, 18, 16, 20, 20, 6, 16, 24, 24, 10, 24, 12, 12, 22, + 0, 32, 32, 34, 32, 36, 36, 6, 32, 40, 40, 10, 40, 12, 12, 38, + 32, 48, 48, 18, 48, 20, 20, 38, 48, 24, 24, 42, 24, 44, 44, 54, + 0, 64, 64, 66, 64, 68, 68, 6, 64, 72, 72, 10, 72, 12, 12, 70, + 64, 80, 80, 18, 80, 20, 20, 70, 80, 24, 24, 74, 24, 76, 76, 86, + 64, 96, 96, 34, 96, 36, 36, 70, 96, 40, 40, 74, 40, 76, 76, 102, + 96, 48, 48, 82, 48, 84, 84, 102, 48, 88, 88, 106, 88, 108, 108, 118, + 0, 128, 128, 130, 128, 132, 132, 6, 128, 136, 136, 10, 136, 12, 12, 134, + 128, 144, 144, 18, 144, 20, 20, 134, 144, 24, 24, 138, 24, 140, 140, 150, + 128, 160, 160, 34, 160, 36, 36, 134, 160, 40, 40, 138, 40, 140, 140, 166, + 160, 48, 48, 146, 48, 148, 148, 166, 48, 152, 152, 170, 152, 172, 172, 182, + 128, 192, 192, 66, 192, 68, 68, 134, 192, 72, 72, 138, 72, 140, 140, 198, + 192, 80, 80, 146, 80, 148, 148, 198, 80, 152, 152, 202, 152, 204, 204, 214, + 192, 96, 96, 162, 96, 164, 164, 198, 96, 168, 168, 202, 168, 204, 204, 230, + 96, 176, 176, 210, 176, 212, 212, 230, 176, 216, 216, 234, 216, 236, 236, 118, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 7, + 16, 17, 18, 19, 20, 21, 22, 7, 24, 25, 26, 11, 28, 13, 14, 23, + 32, 33, 34, 35, 36, 37, 38, 7, 40, 41, 42, 11, 44, 13, 14, 39, + 48, 49, 50, 19, 52, 21, 22, 39, 56, 25, 26, 43, 28, 45, 46, 55, + 64, 65, 66, 67, 68, 69, 70, 7, 72, 73, 74, 11, 76, 13, 14, 71, + 80, 81, 82, 19, 84, 21, 22, 71, 88, 25, 26, 75, 28, 77, 78, 87, + 96, 97, 98, 35, 100, 37, 38, 71, 104, 41, 42, 75, 44, 77, 78, 103, + 112, 49, 50, 83, 52, 85, 86, 103, 56, 89, 90, 107, 92, 109, 110, 119, + 128, 129, 130, 131, 132, 133, 134, 7, 136, 137, 138, 11, 140, 13, 14, 135, + 144, 145, 146, 19, 148, 21, 22, 135, 152, 25, 26, 139, 28, 141, 142, 151, + 160, 161, 162, 35, 164, 37, 38, 135, 168, 41, 42, 139, 44, 141, 142, 167, + 176, 49, 50, 147, 52, 149, 150, 167, 56, 153, 154, 171, 156, 173, 174, 183, + 192, 193, 194, 67, 196, 69, 70, 135, 200, 73, 74, 139, 76, 141, 142, 199, + 208, 81, 82, 147, 84, 149, 150, 199, 88, 153, 154, 203, 156, 205, 206, 215, + 224, 97, 98, 163, 100, 165, 166, 199, 104, 169, 170, 203, 172, 205, 206, 231, + 112, 177, 178, 211, 180, 213, 214, 231, 184, 217, 218, 235, 220, 237, 238, 119, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, + 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 16, 0, 16, 16, 24, + 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 32, 0, 32, 32, 40, + 0, 0, 0, 32, 0, 32, 32, 48, 0, 32, 32, 48, 32, 48, 48, 56, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 72, + 0, 0, 0, 64, 0, 64, 64, 80, 0, 64, 64, 80, 64, 80, 80, 88, + 0, 0, 0, 64, 0, 64, 64, 96, 0, 64, 64, 96, 64, 96, 96, 104, + 0, 64, 64, 96, 64, 96, 96, 112, 64, 96, 96, 112, 96, 112, 112, 120, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 136, + 0, 0, 0, 128, 0, 128, 128, 144, 0, 128, 128, 144, 128, 144, 144, 152, + 0, 0, 0, 128, 0, 128, 128, 160, 0, 128, 128, 160, 128, 160, 160, 168, + 0, 128, 128, 160, 128, 160, 160, 176, 128, 160, 160, 176, 160, 176, 176, 184, + 0, 0, 0, 128, 0, 128, 128, 192, 0, 128, 128, 192, 128, 192, 192, 200, + 0, 128, 128, 192, 128, 192, 192, 208, 128, 192, 192, 208, 192, 208, 208, 216, + 0, 128, 128, 192, 128, 192, 192, 224, 128, 192, 192, 224, 192, 224, 224, 232, + 128, 192, 192, 224, 192, 224, 224, 240, 192, 224, 224, 240, 224, 240, 240, 120, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 9, + 16, 1, 2, 1, 4, 1, 2, 17, 8, 1, 2, 17, 4, 17, 18, 25, + 32, 1, 2, 1, 4, 1, 2, 33, 8, 1, 2, 33, 4, 33, 34, 41, + 16, 1, 2, 33, 4, 33, 34, 49, 8, 33, 34, 49, 36, 49, 50, 57, + 64, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 73, + 16, 1, 2, 65, 4, 65, 66, 81, 8, 65, 66, 81, 68, 81, 82, 89, + 32, 1, 2, 65, 4, 65, 66, 97, 8, 65, 66, 97, 68, 97, 98, 105, + 16, 65, 66, 97, 68, 97, 98, 113, 72, 97, 98, 113, 100, 113, 114, 121, + 128, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 137, + 16, 1, 2, 129, 4, 129, 130, 145, 8, 129, 130, 145, 132, 145, 146, 153, + 32, 1, 2, 129, 4, 129, 130, 161, 8, 129, 130, 161, 132, 161, 162, 169, + 16, 129, 130, 161, 132, 161, 162, 177, 136, 161, 162, 177, 164, 177, 178, 185, + 64, 1, 2, 129, 4, 129, 130, 193, 8, 129, 130, 193, 132, 193, 194, 201, + 16, 129, 130, 193, 132, 193, 194, 209, 136, 193, 194, 209, 196, 209, 210, 217, + 32, 129, 130, 193, 132, 193, 194, 225, 136, 193, 194, 225, 196, 225, 226, 233, + 144, 193, 194, 225, 196, 225, 226, 241, 200, 225, 226, 241, 228, 241, 242, 121, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 10, + 0, 16, 16, 2, 16, 4, 4, 18, 16, 8, 8, 18, 8, 20, 20, 26, + 0, 32, 32, 2, 32, 4, 4, 34, 32, 8, 8, 34, 8, 36, 36, 42, + 32, 16, 16, 34, 16, 36, 36, 50, 16, 40, 40, 50, 40, 52, 52, 58, + 0, 64, 64, 2, 64, 4, 4, 66, 64, 8, 8, 66, 8, 68, 68, 74, + 64, 16, 16, 66, 16, 68, 68, 82, 16, 72, 72, 82, 72, 84, 84, 90, + 64, 32, 32, 66, 32, 68, 68, 98, 32, 72, 72, 98, 72, 100, 100, 106, + 32, 80, 80, 98, 80, 100, 100, 114, 80, 104, 104, 114, 104, 116, 116, 122, + 0, 128, 128, 2, 128, 4, 4, 130, 128, 8, 8, 130, 8, 132, 132, 138, + 128, 16, 16, 130, 16, 132, 132, 146, 16, 136, 136, 146, 136, 148, 148, 154, + 128, 32, 32, 130, 32, 132, 132, 162, 32, 136, 136, 162, 136, 164, 164, 170, + 32, 144, 144, 162, 144, 164, 164, 178, 144, 168, 168, 178, 168, 180, 180, 186, + 128, 64, 64, 130, 64, 132, 132, 194, 64, 136, 136, 194, 136, 196, 196, 202, + 64, 144, 144, 194, 144, 196, 196, 210, 144, 200, 200, 210, 200, 212, 212, 218, + 64, 160, 160, 194, 160, 196, 196, 226, 160, 200, 200, 226, 200, 228, 228, 234, + 160, 208, 208, 226, 208, 228, 228, 242, 208, 232, 232, 242, 232, 244, 244, 122, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 11, + 16, 17, 18, 3, 20, 5, 6, 19, 24, 9, 10, 19, 12, 21, 22, 27, + 32, 33, 34, 3, 36, 5, 6, 35, 40, 9, 10, 35, 12, 37, 38, 43, + 48, 17, 18, 35, 20, 37, 38, 51, 24, 41, 42, 51, 44, 53, 54, 59, + 64, 65, 66, 3, 68, 5, 6, 67, 72, 9, 10, 67, 12, 69, 70, 75, + 80, 17, 18, 67, 20, 69, 70, 83, 24, 73, 74, 83, 76, 85, 86, 91, + 96, 33, 34, 67, 36, 69, 70, 99, 40, 73, 74, 99, 76, 101, 102, 107, + 48, 81, 82, 99, 84, 101, 102, 115, 88, 105, 106, 115, 108, 117, 118, 123, + 128, 129, 130, 3, 132, 5, 6, 131, 136, 9, 10, 131, 12, 133, 134, 139, + 144, 17, 18, 131, 20, 133, 134, 147, 24, 137, 138, 147, 140, 149, 150, 155, + 160, 33, 34, 131, 36, 133, 134, 163, 40, 137, 138, 163, 140, 165, 166, 171, + 48, 145, 146, 163, 148, 165, 166, 179, 152, 169, 170, 179, 172, 181, 182, 187, + 192, 65, 66, 131, 68, 133, 134, 195, 72, 137, 138, 195, 140, 197, 198, 203, + 80, 145, 146, 195, 148, 197, 198, 211, 152, 201, 202, 211, 204, 213, 214, 219, + 96, 161, 162, 195, 164, 197, 198, 227, 168, 201, 202, 227, 204, 229, 230, 235, + 176, 209, 210, 227, 212, 229, 230, 243, 216, 233, 234, 243, 236, 245, 246, 123, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 12, + 0, 0, 0, 16, 0, 16, 16, 20, 0, 16, 16, 24, 16, 24, 24, 28, + 0, 0, 0, 32, 0, 32, 32, 36, 0, 32, 32, 40, 32, 40, 40, 44, + 0, 32, 32, 48, 32, 48, 48, 52, 32, 48, 48, 56, 48, 56, 56, 60, + 0, 0, 0, 64, 0, 64, 64, 68, 0, 64, 64, 72, 64, 72, 72, 76, + 0, 64, 64, 80, 64, 80, 80, 84, 64, 80, 80, 88, 80, 88, 88, 92, + 0, 64, 64, 96, 64, 96, 96, 100, 64, 96, 96, 104, 96, 104, 104, 108, + 64, 96, 96, 112, 96, 112, 112, 116, 96, 112, 112, 120, 112, 120, 120, 124, + 0, 0, 0, 128, 0, 128, 128, 132, 0, 128, 128, 136, 128, 136, 136, 140, + 0, 128, 128, 144, 128, 144, 144, 148, 128, 144, 144, 152, 144, 152, 152, 156, + 0, 128, 128, 160, 128, 160, 160, 164, 128, 160, 160, 168, 160, 168, 168, 172, + 128, 160, 160, 176, 160, 176, 176, 180, 160, 176, 176, 184, 176, 184, 184, 188, + 0, 128, 128, 192, 128, 192, 192, 196, 128, 192, 192, 200, 192, 200, 200, 204, + 128, 192, 192, 208, 192, 208, 208, 212, 192, 208, 208, 216, 208, 216, 216, 220, + 128, 192, 192, 224, 192, 224, 224, 228, 192, 224, 224, 232, 224, 232, 232, 236, + 192, 224, 224, 240, 224, 240, 240, 244, 224, 240, 240, 248, 240, 248, 248, 124, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 13, + 16, 1, 2, 17, 4, 17, 18, 21, 8, 17, 18, 25, 20, 25, 26, 29, + 32, 1, 2, 33, 4, 33, 34, 37, 8, 33, 34, 41, 36, 41, 42, 45, + 16, 33, 34, 49, 36, 49, 50, 53, 40, 49, 50, 57, 52, 57, 58, 61, + 64, 1, 2, 65, 4, 65, 66, 69, 8, 65, 66, 73, 68, 73, 74, 77, + 16, 65, 66, 81, 68, 81, 82, 85, 72, 81, 82, 89, 84, 89, 90, 93, + 32, 65, 66, 97, 68, 97, 98, 101, 72, 97, 98, 105, 100, 105, 106, 109, + 80, 97, 98, 113, 100, 113, 114, 117, 104, 113, 114, 121, 116, 121, 122, 125, + 128, 1, 2, 129, 4, 129, 130, 133, 8, 129, 130, 137, 132, 137, 138, 141, + 16, 129, 130, 145, 132, 145, 146, 149, 136, 145, 146, 153, 148, 153, 154, 157, + 32, 129, 130, 161, 132, 161, 162, 165, 136, 161, 162, 169, 164, 169, 170, 173, + 144, 161, 162, 177, 164, 177, 178, 181, 168, 177, 178, 185, 180, 185, 186, 189, + 64, 129, 130, 193, 132, 193, 194, 197, 136, 193, 194, 201, 196, 201, 202, 205, + 144, 193, 194, 209, 196, 209, 210, 213, 200, 209, 210, 217, 212, 217, 218, 221, + 160, 193, 194, 225, 196, 225, 226, 229, 200, 225, 226, 233, 228, 233, 234, 237, + 208, 225, 226, 241, 228, 241, 242, 245, 232, 241, 242, 249, 244, 249, 250, 125, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 14, + 0, 16, 16, 18, 16, 20, 20, 22, 16, 24, 24, 26, 24, 28, 28, 30, + 0, 32, 32, 34, 32, 36, 36, 38, 32, 40, 40, 42, 40, 44, 44, 46, + 32, 48, 48, 50, 48, 52, 52, 54, 48, 56, 56, 58, 56, 60, 60, 62, + 0, 64, 64, 66, 64, 68, 68, 70, 64, 72, 72, 74, 72, 76, 76, 78, + 64, 80, 80, 82, 80, 84, 84, 86, 80, 88, 88, 90, 88, 92, 92, 94, + 64, 96, 96, 98, 96, 100, 100, 102, 96, 104, 104, 106, 104, 108, 108, 110, + 96, 112, 112, 114, 112, 116, 116, 118, 112, 120, 120, 122, 120, 124, 124, 126, + 0, 128, 128, 130, 128, 132, 132, 134, 128, 136, 136, 138, 136, 140, 140, 142, + 128, 144, 144, 146, 144, 148, 148, 150, 144, 152, 152, 154, 152, 156, 156, 158, + 128, 160, 160, 162, 160, 164, 164, 166, 160, 168, 168, 170, 168, 172, 172, 174, + 160, 176, 176, 178, 176, 180, 180, 182, 176, 184, 184, 186, 184, 188, 188, 190, + 128, 192, 192, 194, 192, 196, 196, 198, 192, 200, 200, 202, 200, 204, 204, 206, + 192, 208, 208, 210, 208, 212, 212, 214, 208, 216, 216, 218, 216, 220, 220, 222, + 192, 224, 224, 226, 224, 228, 228, 230, 224, 232, 232, 234, 232, 236, 236, 238, + 224, 240, 240, 242, 240, 244, 244, 246, 240, 248, 248, 250, 248, 252, 252, 126, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 127, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 64, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 128, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 64, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 129, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 2, + 0, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 2, + 0, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 2, + 32, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 2, + 0, 64, 64, 2, 64, 4, 4, 2, 64, 8, 8, 2, 8, 4, 4, 2, + 64, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 2, + 64, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 2, + 32, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 2, + 0, 128, 128, 2, 128, 4, 4, 2, 128, 8, 8, 2, 8, 4, 4, 2, + 128, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 2, + 128, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 2, + 32, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 2, + 128, 64, 64, 2, 64, 4, 4, 2, 64, 8, 8, 2, 8, 4, 4, 2, + 64, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 2, + 64, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 2, + 32, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 130, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 3, + 16, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 3, + 32, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 3, + 48, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 3, + 64, 65, 66, 3, 68, 5, 6, 3, 72, 9, 10, 3, 12, 5, 6, 3, + 80, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 3, + 96, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 3, + 48, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 3, + 128, 129, 130, 3, 132, 5, 6, 3, 136, 9, 10, 3, 12, 5, 6, 3, + 144, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 3, + 160, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 3, + 48, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 3, + 192, 65, 66, 3, 68, 5, 6, 3, 72, 9, 10, 3, 12, 5, 6, 3, + 80, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 3, + 96, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 3, + 48, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 131, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 4, + 0, 0, 0, 16, 0, 16, 16, 4, 0, 16, 16, 8, 16, 8, 8, 4, + 0, 0, 0, 32, 0, 32, 32, 4, 0, 32, 32, 8, 32, 8, 8, 4, + 0, 32, 32, 16, 32, 16, 16, 4, 32, 16, 16, 8, 16, 8, 8, 4, + 0, 0, 0, 64, 0, 64, 64, 4, 0, 64, 64, 8, 64, 8, 8, 4, + 0, 64, 64, 16, 64, 16, 16, 4, 64, 16, 16, 8, 16, 8, 8, 4, + 0, 64, 64, 32, 64, 32, 32, 4, 64, 32, 32, 8, 32, 8, 8, 4, + 64, 32, 32, 16, 32, 16, 16, 4, 32, 16, 16, 8, 16, 8, 8, 4, + 0, 0, 0, 128, 0, 128, 128, 4, 0, 128, 128, 8, 128, 8, 8, 4, + 0, 128, 128, 16, 128, 16, 16, 4, 128, 16, 16, 8, 16, 8, 8, 4, + 0, 128, 128, 32, 128, 32, 32, 4, 128, 32, 32, 8, 32, 8, 8, 4, + 128, 32, 32, 16, 32, 16, 16, 4, 32, 16, 16, 8, 16, 8, 8, 4, + 0, 128, 128, 64, 128, 64, 64, 4, 128, 64, 64, 8, 64, 8, 8, 4, + 128, 64, 64, 16, 64, 16, 16, 4, 64, 16, 16, 8, 16, 8, 8, 4, + 128, 64, 64, 32, 64, 32, 32, 4, 64, 32, 32, 8, 32, 8, 8, 4, + 64, 32, 32, 16, 32, 16, 16, 4, 32, 16, 16, 8, 16, 8, 8, 132, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 5, + 16, 1, 2, 17, 4, 17, 18, 5, 8, 17, 18, 9, 20, 9, 10, 5, + 32, 1, 2, 33, 4, 33, 34, 5, 8, 33, 34, 9, 36, 9, 10, 5, + 16, 33, 34, 17, 36, 17, 18, 5, 40, 17, 18, 9, 20, 9, 10, 5, + 64, 1, 2, 65, 4, 65, 66, 5, 8, 65, 66, 9, 68, 9, 10, 5, + 16, 65, 66, 17, 68, 17, 18, 5, 72, 17, 18, 9, 20, 9, 10, 5, + 32, 65, 66, 33, 68, 33, 34, 5, 72, 33, 34, 9, 36, 9, 10, 5, + 80, 33, 34, 17, 36, 17, 18, 5, 40, 17, 18, 9, 20, 9, 10, 5, + 128, 1, 2, 129, 4, 129, 130, 5, 8, 129, 130, 9, 132, 9, 10, 5, + 16, 129, 130, 17, 132, 17, 18, 5, 136, 17, 18, 9, 20, 9, 10, 5, + 32, 129, 130, 33, 132, 33, 34, 5, 136, 33, 34, 9, 36, 9, 10, 5, + 144, 33, 34, 17, 36, 17, 18, 5, 40, 17, 18, 9, 20, 9, 10, 5, + 64, 129, 130, 65, 132, 65, 66, 5, 136, 65, 66, 9, 68, 9, 10, 5, + 144, 65, 66, 17, 68, 17, 18, 5, 72, 17, 18, 9, 20, 9, 10, 5, + 160, 65, 66, 33, 68, 33, 34, 5, 72, 33, 34, 9, 36, 9, 10, 5, + 80, 33, 34, 17, 36, 17, 18, 5, 40, 17, 18, 9, 20, 9, 10, 133, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 6, + 0, 16, 16, 18, 16, 20, 20, 6, 16, 24, 24, 10, 24, 12, 12, 6, + 0, 32, 32, 34, 32, 36, 36, 6, 32, 40, 40, 10, 40, 12, 12, 6, + 32, 48, 48, 18, 48, 20, 20, 6, 48, 24, 24, 10, 24, 12, 12, 6, + 0, 64, 64, 66, 64, 68, 68, 6, 64, 72, 72, 10, 72, 12, 12, 6, + 64, 80, 80, 18, 80, 20, 20, 6, 80, 24, 24, 10, 24, 12, 12, 6, + 64, 96, 96, 34, 96, 36, 36, 6, 96, 40, 40, 10, 40, 12, 12, 6, + 96, 48, 48, 18, 48, 20, 20, 6, 48, 24, 24, 10, 24, 12, 12, 6, + 0, 128, 128, 130, 128, 132, 132, 6, 128, 136, 136, 10, 136, 12, 12, 6, + 128, 144, 144, 18, 144, 20, 20, 6, 144, 24, 24, 10, 24, 12, 12, 6, + 128, 160, 160, 34, 160, 36, 36, 6, 160, 40, 40, 10, 40, 12, 12, 6, + 160, 48, 48, 18, 48, 20, 20, 6, 48, 24, 24, 10, 24, 12, 12, 6, + 128, 192, 192, 66, 192, 68, 68, 6, 192, 72, 72, 10, 72, 12, 12, 6, + 192, 80, 80, 18, 80, 20, 20, 6, 80, 24, 24, 10, 24, 12, 12, 6, + 192, 96, 96, 34, 96, 36, 36, 6, 96, 40, 40, 10, 40, 12, 12, 6, + 96, 48, 48, 18, 48, 20, 20, 6, 48, 24, 24, 10, 24, 12, 12, 134, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 7, + 16, 17, 18, 19, 20, 21, 22, 7, 24, 25, 26, 11, 28, 13, 14, 7, + 32, 33, 34, 35, 36, 37, 38, 7, 40, 41, 42, 11, 44, 13, 14, 7, + 48, 49, 50, 19, 52, 21, 22, 7, 56, 25, 26, 11, 28, 13, 14, 7, + 64, 65, 66, 67, 68, 69, 70, 7, 72, 73, 74, 11, 76, 13, 14, 7, + 80, 81, 82, 19, 84, 21, 22, 7, 88, 25, 26, 11, 28, 13, 14, 7, + 96, 97, 98, 35, 100, 37, 38, 7, 104, 41, 42, 11, 44, 13, 14, 7, + 112, 49, 50, 19, 52, 21, 22, 7, 56, 25, 26, 11, 28, 13, 14, 7, + 128, 129, 130, 131, 132, 133, 134, 7, 136, 137, 138, 11, 140, 13, 14, 7, + 144, 145, 146, 19, 148, 21, 22, 7, 152, 25, 26, 11, 28, 13, 14, 7, + 160, 161, 162, 35, 164, 37, 38, 7, 168, 41, 42, 11, 44, 13, 14, 7, + 176, 49, 50, 19, 52, 21, 22, 7, 56, 25, 26, 11, 28, 13, 14, 7, + 192, 193, 194, 67, 196, 69, 70, 7, 200, 73, 74, 11, 76, 13, 14, 7, + 208, 81, 82, 19, 84, 21, 22, 7, 88, 25, 26, 11, 28, 13, 14, 7, + 224, 97, 98, 35, 100, 37, 38, 7, 104, 41, 42, 11, 44, 13, 14, 7, + 112, 49, 50, 19, 52, 21, 22, 7, 56, 25, 26, 11, 28, 13, 14, 135, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, + 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 16, 0, 16, 16, 8, + 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 32, 0, 32, 32, 8, + 0, 0, 0, 32, 0, 32, 32, 16, 0, 32, 32, 16, 32, 16, 16, 8, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 8, + 0, 0, 0, 64, 0, 64, 64, 16, 0, 64, 64, 16, 64, 16, 16, 8, + 0, 0, 0, 64, 0, 64, 64, 32, 0, 64, 64, 32, 64, 32, 32, 8, + 0, 64, 64, 32, 64, 32, 32, 16, 64, 32, 32, 16, 32, 16, 16, 8, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 8, + 0, 0, 0, 128, 0, 128, 128, 16, 0, 128, 128, 16, 128, 16, 16, 8, + 0, 0, 0, 128, 0, 128, 128, 32, 0, 128, 128, 32, 128, 32, 32, 8, + 0, 128, 128, 32, 128, 32, 32, 16, 128, 32, 32, 16, 32, 16, 16, 8, + 0, 0, 0, 128, 0, 128, 128, 64, 0, 128, 128, 64, 128, 64, 64, 8, + 0, 128, 128, 64, 128, 64, 64, 16, 128, 64, 64, 16, 64, 16, 16, 8, + 0, 128, 128, 64, 128, 64, 64, 32, 128, 64, 64, 32, 64, 32, 32, 8, + 128, 64, 64, 32, 64, 32, 32, 16, 64, 32, 32, 16, 32, 16, 16, 136, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 9, + 16, 1, 2, 1, 4, 1, 2, 17, 8, 1, 2, 17, 4, 17, 18, 9, + 32, 1, 2, 1, 4, 1, 2, 33, 8, 1, 2, 33, 4, 33, 34, 9, + 16, 1, 2, 33, 4, 33, 34, 17, 8, 33, 34, 17, 36, 17, 18, 9, + 64, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 9, + 16, 1, 2, 65, 4, 65, 66, 17, 8, 65, 66, 17, 68, 17, 18, 9, + 32, 1, 2, 65, 4, 65, 66, 33, 8, 65, 66, 33, 68, 33, 34, 9, + 16, 65, 66, 33, 68, 33, 34, 17, 72, 33, 34, 17, 36, 17, 18, 9, + 128, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 9, + 16, 1, 2, 129, 4, 129, 130, 17, 8, 129, 130, 17, 132, 17, 18, 9, + 32, 1, 2, 129, 4, 129, 130, 33, 8, 129, 130, 33, 132, 33, 34, 9, + 16, 129, 130, 33, 132, 33, 34, 17, 136, 33, 34, 17, 36, 17, 18, 9, + 64, 1, 2, 129, 4, 129, 130, 65, 8, 129, 130, 65, 132, 65, 66, 9, + 16, 129, 130, 65, 132, 65, 66, 17, 136, 65, 66, 17, 68, 17, 18, 9, + 32, 129, 130, 65, 132, 65, 66, 33, 136, 65, 66, 33, 68, 33, 34, 9, + 144, 65, 66, 33, 68, 33, 34, 17, 72, 33, 34, 17, 36, 17, 18, 137, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 10, + 0, 16, 16, 2, 16, 4, 4, 18, 16, 8, 8, 18, 8, 20, 20, 10, + 0, 32, 32, 2, 32, 4, 4, 34, 32, 8, 8, 34, 8, 36, 36, 10, + 32, 16, 16, 34, 16, 36, 36, 18, 16, 40, 40, 18, 40, 20, 20, 10, + 0, 64, 64, 2, 64, 4, 4, 66, 64, 8, 8, 66, 8, 68, 68, 10, + 64, 16, 16, 66, 16, 68, 68, 18, 16, 72, 72, 18, 72, 20, 20, 10, + 64, 32, 32, 66, 32, 68, 68, 34, 32, 72, 72, 34, 72, 36, 36, 10, + 32, 80, 80, 34, 80, 36, 36, 18, 80, 40, 40, 18, 40, 20, 20, 10, + 0, 128, 128, 2, 128, 4, 4, 130, 128, 8, 8, 130, 8, 132, 132, 10, + 128, 16, 16, 130, 16, 132, 132, 18, 16, 136, 136, 18, 136, 20, 20, 10, + 128, 32, 32, 130, 32, 132, 132, 34, 32, 136, 136, 34, 136, 36, 36, 10, + 32, 144, 144, 34, 144, 36, 36, 18, 144, 40, 40, 18, 40, 20, 20, 10, + 128, 64, 64, 130, 64, 132, 132, 66, 64, 136, 136, 66, 136, 68, 68, 10, + 64, 144, 144, 66, 144, 68, 68, 18, 144, 72, 72, 18, 72, 20, 20, 10, + 64, 160, 160, 66, 160, 68, 68, 34, 160, 72, 72, 34, 72, 36, 36, 10, + 160, 80, 80, 34, 80, 36, 36, 18, 80, 40, 40, 18, 40, 20, 20, 138, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 11, + 16, 17, 18, 3, 20, 5, 6, 19, 24, 9, 10, 19, 12, 21, 22, 11, + 32, 33, 34, 3, 36, 5, 6, 35, 40, 9, 10, 35, 12, 37, 38, 11, + 48, 17, 18, 35, 20, 37, 38, 19, 24, 41, 42, 19, 44, 21, 22, 11, + 64, 65, 66, 3, 68, 5, 6, 67, 72, 9, 10, 67, 12, 69, 70, 11, + 80, 17, 18, 67, 20, 69, 70, 19, 24, 73, 74, 19, 76, 21, 22, 11, + 96, 33, 34, 67, 36, 69, 70, 35, 40, 73, 74, 35, 76, 37, 38, 11, + 48, 81, 82, 35, 84, 37, 38, 19, 88, 41, 42, 19, 44, 21, 22, 11, + 128, 129, 130, 3, 132, 5, 6, 131, 136, 9, 10, 131, 12, 133, 134, 11, + 144, 17, 18, 131, 20, 133, 134, 19, 24, 137, 138, 19, 140, 21, 22, 11, + 160, 33, 34, 131, 36, 133, 134, 35, 40, 137, 138, 35, 140, 37, 38, 11, + 48, 145, 146, 35, 148, 37, 38, 19, 152, 41, 42, 19, 44, 21, 22, 11, + 192, 65, 66, 131, 68, 133, 134, 67, 72, 137, 138, 67, 140, 69, 70, 11, + 80, 145, 146, 67, 148, 69, 70, 19, 152, 73, 74, 19, 76, 21, 22, 11, + 96, 161, 162, 67, 164, 69, 70, 35, 168, 73, 74, 35, 76, 37, 38, 11, + 176, 81, 82, 35, 84, 37, 38, 19, 88, 41, 42, 19, 44, 21, 22, 139, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 12, + 0, 0, 0, 16, 0, 16, 16, 20, 0, 16, 16, 24, 16, 24, 24, 12, + 0, 0, 0, 32, 0, 32, 32, 36, 0, 32, 32, 40, 32, 40, 40, 12, + 0, 32, 32, 48, 32, 48, 48, 20, 32, 48, 48, 24, 48, 24, 24, 12, + 0, 0, 0, 64, 0, 64, 64, 68, 0, 64, 64, 72, 64, 72, 72, 12, + 0, 64, 64, 80, 64, 80, 80, 20, 64, 80, 80, 24, 80, 24, 24, 12, + 0, 64, 64, 96, 64, 96, 96, 36, 64, 96, 96, 40, 96, 40, 40, 12, + 64, 96, 96, 48, 96, 48, 48, 20, 96, 48, 48, 24, 48, 24, 24, 12, + 0, 0, 0, 128, 0, 128, 128, 132, 0, 128, 128, 136, 128, 136, 136, 12, + 0, 128, 128, 144, 128, 144, 144, 20, 128, 144, 144, 24, 144, 24, 24, 12, + 0, 128, 128, 160, 128, 160, 160, 36, 128, 160, 160, 40, 160, 40, 40, 12, + 128, 160, 160, 48, 160, 48, 48, 20, 160, 48, 48, 24, 48, 24, 24, 12, + 0, 128, 128, 192, 128, 192, 192, 68, 128, 192, 192, 72, 192, 72, 72, 12, + 128, 192, 192, 80, 192, 80, 80, 20, 192, 80, 80, 24, 80, 24, 24, 12, + 128, 192, 192, 96, 192, 96, 96, 36, 192, 96, 96, 40, 96, 40, 40, 12, + 192, 96, 96, 48, 96, 48, 48, 20, 96, 48, 48, 24, 48, 24, 24, 140, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 13, + 16, 1, 2, 17, 4, 17, 18, 21, 8, 17, 18, 25, 20, 25, 26, 13, + 32, 1, 2, 33, 4, 33, 34, 37, 8, 33, 34, 41, 36, 41, 42, 13, + 16, 33, 34, 49, 36, 49, 50, 21, 40, 49, 50, 25, 52, 25, 26, 13, + 64, 1, 2, 65, 4, 65, 66, 69, 8, 65, 66, 73, 68, 73, 74, 13, + 16, 65, 66, 81, 68, 81, 82, 21, 72, 81, 82, 25, 84, 25, 26, 13, + 32, 65, 66, 97, 68, 97, 98, 37, 72, 97, 98, 41, 100, 41, 42, 13, + 80, 97, 98, 49, 100, 49, 50, 21, 104, 49, 50, 25, 52, 25, 26, 13, + 128, 1, 2, 129, 4, 129, 130, 133, 8, 129, 130, 137, 132, 137, 138, 13, + 16, 129, 130, 145, 132, 145, 146, 21, 136, 145, 146, 25, 148, 25, 26, 13, + 32, 129, 130, 161, 132, 161, 162, 37, 136, 161, 162, 41, 164, 41, 42, 13, + 144, 161, 162, 49, 164, 49, 50, 21, 168, 49, 50, 25, 52, 25, 26, 13, + 64, 129, 130, 193, 132, 193, 194, 69, 136, 193, 194, 73, 196, 73, 74, 13, + 144, 193, 194, 81, 196, 81, 82, 21, 200, 81, 82, 25, 84, 25, 26, 13, + 160, 193, 194, 97, 196, 97, 98, 37, 200, 97, 98, 41, 100, 41, 42, 13, + 208, 97, 98, 49, 100, 49, 50, 21, 104, 49, 50, 25, 52, 25, 26, 141, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 14, + 0, 16, 16, 18, 16, 20, 20, 22, 16, 24, 24, 26, 24, 28, 28, 14, + 0, 32, 32, 34, 32, 36, 36, 38, 32, 40, 40, 42, 40, 44, 44, 14, + 32, 48, 48, 50, 48, 52, 52, 22, 48, 56, 56, 26, 56, 28, 28, 14, + 0, 64, 64, 66, 64, 68, 68, 70, 64, 72, 72, 74, 72, 76, 76, 14, + 64, 80, 80, 82, 80, 84, 84, 22, 80, 88, 88, 26, 88, 28, 28, 14, + 64, 96, 96, 98, 96, 100, 100, 38, 96, 104, 104, 42, 104, 44, 44, 14, + 96, 112, 112, 50, 112, 52, 52, 22, 112, 56, 56, 26, 56, 28, 28, 14, + 0, 128, 128, 130, 128, 132, 132, 134, 128, 136, 136, 138, 136, 140, 140, 14, + 128, 144, 144, 146, 144, 148, 148, 22, 144, 152, 152, 26, 152, 28, 28, 14, + 128, 160, 160, 162, 160, 164, 164, 38, 160, 168, 168, 42, 168, 44, 44, 14, + 160, 176, 176, 50, 176, 52, 52, 22, 176, 56, 56, 26, 56, 28, 28, 14, + 128, 192, 192, 194, 192, 196, 196, 70, 192, 200, 200, 74, 200, 76, 76, 14, + 192, 208, 208, 82, 208, 84, 84, 22, 208, 88, 88, 26, 88, 28, 28, 14, + 192, 224, 224, 98, 224, 100, 100, 38, 224, 104, 104, 42, 104, 44, 44, 14, + 224, 112, 112, 50, 112, 52, 52, 22, 112, 56, 56, 26, 56, 28, 28, 142, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 15, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 15, + 48, 49, 50, 51, 52, 53, 54, 23, 56, 57, 58, 27, 60, 29, 30, 15, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 15, + 80, 81, 82, 83, 84, 85, 86, 23, 88, 89, 90, 27, 92, 29, 30, 15, + 96, 97, 98, 99, 100, 101, 102, 39, 104, 105, 106, 43, 108, 45, 46, 15, + 112, 113, 114, 51, 116, 53, 54, 23, 120, 57, 58, 27, 60, 29, 30, 15, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 15, + 144, 145, 146, 147, 148, 149, 150, 23, 152, 153, 154, 27, 156, 29, 30, 15, + 160, 161, 162, 163, 164, 165, 166, 39, 168, 169, 170, 43, 172, 45, 46, 15, + 176, 177, 178, 51, 180, 53, 54, 23, 184, 57, 58, 27, 60, 29, 30, 15, + 192, 193, 194, 195, 196, 197, 198, 71, 200, 201, 202, 75, 204, 77, 78, 15, + 208, 209, 210, 83, 212, 85, 86, 23, 216, 89, 90, 27, 92, 29, 30, 15, + 224, 225, 226, 99, 228, 101, 102, 39, 232, 105, 106, 43, 108, 45, 46, 15, + 240, 113, 114, 51, 116, 53, 54, 23, 120, 57, 58, 27, 60, 29, 30, 143, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, + 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 32, 0, 32, 32, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 16, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 32, + 0, 0, 0, 64, 0, 64, 64, 32, 0, 64, 64, 32, 64, 32, 32, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 16, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 32, + 0, 0, 0, 128, 0, 128, 128, 32, 0, 128, 128, 32, 128, 32, 32, 16, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 64, + 0, 0, 0, 128, 0, 128, 128, 64, 0, 128, 128, 64, 128, 64, 64, 16, + 0, 0, 0, 128, 0, 128, 128, 64, 0, 128, 128, 64, 128, 64, 64, 32, + 0, 128, 128, 64, 128, 64, 64, 32, 128, 64, 64, 32, 64, 32, 32, 144, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 17, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 33, + 16, 1, 2, 1, 4, 1, 2, 33, 8, 1, 2, 33, 4, 33, 34, 17, + 64, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 65, + 16, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 17, + 32, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 33, + 16, 1, 2, 65, 4, 65, 66, 33, 8, 65, 66, 33, 68, 33, 34, 17, + 128, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 129, + 16, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 17, + 32, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 33, + 16, 1, 2, 129, 4, 129, 130, 33, 8, 129, 130, 33, 132, 33, 34, 17, + 64, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 65, + 16, 1, 2, 129, 4, 129, 130, 65, 8, 129, 130, 65, 132, 65, 66, 17, + 32, 1, 2, 129, 4, 129, 130, 65, 8, 129, 130, 65, 132, 65, 66, 33, + 16, 129, 130, 65, 132, 65, 66, 33, 136, 65, 66, 33, 68, 33, 34, 145, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 2, + 0, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 18, + 0, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 34, + 32, 16, 16, 2, 16, 4, 4, 34, 16, 8, 8, 34, 8, 36, 36, 18, + 0, 64, 64, 2, 64, 4, 4, 2, 64, 8, 8, 2, 8, 4, 4, 66, + 64, 16, 16, 2, 16, 4, 4, 66, 16, 8, 8, 66, 8, 68, 68, 18, + 64, 32, 32, 2, 32, 4, 4, 66, 32, 8, 8, 66, 8, 68, 68, 34, + 32, 16, 16, 66, 16, 68, 68, 34, 16, 72, 72, 34, 72, 36, 36, 18, + 0, 128, 128, 2, 128, 4, 4, 2, 128, 8, 8, 2, 8, 4, 4, 130, + 128, 16, 16, 2, 16, 4, 4, 130, 16, 8, 8, 130, 8, 132, 132, 18, + 128, 32, 32, 2, 32, 4, 4, 130, 32, 8, 8, 130, 8, 132, 132, 34, + 32, 16, 16, 130, 16, 132, 132, 34, 16, 136, 136, 34, 136, 36, 36, 18, + 128, 64, 64, 2, 64, 4, 4, 130, 64, 8, 8, 130, 8, 132, 132, 66, + 64, 16, 16, 130, 16, 132, 132, 66, 16, 136, 136, 66, 136, 68, 68, 18, + 64, 32, 32, 130, 32, 132, 132, 66, 32, 136, 136, 66, 136, 68, 68, 34, + 32, 144, 144, 66, 144, 68, 68, 34, 144, 72, 72, 34, 72, 36, 36, 146, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 3, + 16, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 19, + 32, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 35, + 48, 17, 18, 3, 20, 5, 6, 35, 24, 9, 10, 35, 12, 37, 38, 19, + 64, 65, 66, 3, 68, 5, 6, 3, 72, 9, 10, 3, 12, 5, 6, 67, + 80, 17, 18, 3, 20, 5, 6, 67, 24, 9, 10, 67, 12, 69, 70, 19, + 96, 33, 34, 3, 36, 5, 6, 67, 40, 9, 10, 67, 12, 69, 70, 35, + 48, 17, 18, 67, 20, 69, 70, 35, 24, 73, 74, 35, 76, 37, 38, 19, + 128, 129, 130, 3, 132, 5, 6, 3, 136, 9, 10, 3, 12, 5, 6, 131, + 144, 17, 18, 3, 20, 5, 6, 131, 24, 9, 10, 131, 12, 133, 134, 19, + 160, 33, 34, 3, 36, 5, 6, 131, 40, 9, 10, 131, 12, 133, 134, 35, + 48, 17, 18, 131, 20, 133, 134, 35, 24, 137, 138, 35, 140, 37, 38, 19, + 192, 65, 66, 3, 68, 5, 6, 131, 72, 9, 10, 131, 12, 133, 134, 67, + 80, 17, 18, 131, 20, 133, 134, 67, 24, 137, 138, 67, 140, 69, 70, 19, + 96, 33, 34, 131, 36, 133, 134, 67, 40, 137, 138, 67, 140, 69, 70, 35, + 48, 145, 146, 67, 148, 69, 70, 35, 152, 73, 74, 35, 76, 37, 38, 147, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 4, + 0, 0, 0, 16, 0, 16, 16, 4, 0, 16, 16, 8, 16, 8, 8, 20, + 0, 0, 0, 32, 0, 32, 32, 4, 0, 32, 32, 8, 32, 8, 8, 36, + 0, 32, 32, 16, 32, 16, 16, 36, 32, 16, 16, 40, 16, 40, 40, 20, + 0, 0, 0, 64, 0, 64, 64, 4, 0, 64, 64, 8, 64, 8, 8, 68, + 0, 64, 64, 16, 64, 16, 16, 68, 64, 16, 16, 72, 16, 72, 72, 20, + 0, 64, 64, 32, 64, 32, 32, 68, 64, 32, 32, 72, 32, 72, 72, 36, + 64, 32, 32, 80, 32, 80, 80, 36, 32, 80, 80, 40, 80, 40, 40, 20, + 0, 0, 0, 128, 0, 128, 128, 4, 0, 128, 128, 8, 128, 8, 8, 132, + 0, 128, 128, 16, 128, 16, 16, 132, 128, 16, 16, 136, 16, 136, 136, 20, + 0, 128, 128, 32, 128, 32, 32, 132, 128, 32, 32, 136, 32, 136, 136, 36, + 128, 32, 32, 144, 32, 144, 144, 36, 32, 144, 144, 40, 144, 40, 40, 20, + 0, 128, 128, 64, 128, 64, 64, 132, 128, 64, 64, 136, 64, 136, 136, 68, + 128, 64, 64, 144, 64, 144, 144, 68, 64, 144, 144, 72, 144, 72, 72, 20, + 128, 64, 64, 160, 64, 160, 160, 68, 64, 160, 160, 72, 160, 72, 72, 36, + 64, 160, 160, 80, 160, 80, 80, 36, 160, 80, 80, 40, 80, 40, 40, 148, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 5, + 16, 1, 2, 17, 4, 17, 18, 5, 8, 17, 18, 9, 20, 9, 10, 21, + 32, 1, 2, 33, 4, 33, 34, 5, 8, 33, 34, 9, 36, 9, 10, 37, + 16, 33, 34, 17, 36, 17, 18, 37, 40, 17, 18, 41, 20, 41, 42, 21, + 64, 1, 2, 65, 4, 65, 66, 5, 8, 65, 66, 9, 68, 9, 10, 69, + 16, 65, 66, 17, 68, 17, 18, 69, 72, 17, 18, 73, 20, 73, 74, 21, + 32, 65, 66, 33, 68, 33, 34, 69, 72, 33, 34, 73, 36, 73, 74, 37, + 80, 33, 34, 81, 36, 81, 82, 37, 40, 81, 82, 41, 84, 41, 42, 21, + 128, 1, 2, 129, 4, 129, 130, 5, 8, 129, 130, 9, 132, 9, 10, 133, + 16, 129, 130, 17, 132, 17, 18, 133, 136, 17, 18, 137, 20, 137, 138, 21, + 32, 129, 130, 33, 132, 33, 34, 133, 136, 33, 34, 137, 36, 137, 138, 37, + 144, 33, 34, 145, 36, 145, 146, 37, 40, 145, 146, 41, 148, 41, 42, 21, + 64, 129, 130, 65, 132, 65, 66, 133, 136, 65, 66, 137, 68, 137, 138, 69, + 144, 65, 66, 145, 68, 145, 146, 69, 72, 145, 146, 73, 148, 73, 74, 21, + 160, 65, 66, 161, 68, 161, 162, 69, 72, 161, 162, 73, 164, 73, 74, 37, + 80, 161, 162, 81, 164, 81, 82, 37, 168, 81, 82, 41, 84, 41, 42, 149, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 6, + 0, 16, 16, 18, 16, 20, 20, 6, 16, 24, 24, 10, 24, 12, 12, 22, + 0, 32, 32, 34, 32, 36, 36, 6, 32, 40, 40, 10, 40, 12, 12, 38, + 32, 48, 48, 18, 48, 20, 20, 38, 48, 24, 24, 42, 24, 44, 44, 22, + 0, 64, 64, 66, 64, 68, 68, 6, 64, 72, 72, 10, 72, 12, 12, 70, + 64, 80, 80, 18, 80, 20, 20, 70, 80, 24, 24, 74, 24, 76, 76, 22, + 64, 96, 96, 34, 96, 36, 36, 70, 96, 40, 40, 74, 40, 76, 76, 38, + 96, 48, 48, 82, 48, 84, 84, 38, 48, 88, 88, 42, 88, 44, 44, 22, + 0, 128, 128, 130, 128, 132, 132, 6, 128, 136, 136, 10, 136, 12, 12, 134, + 128, 144, 144, 18, 144, 20, 20, 134, 144, 24, 24, 138, 24, 140, 140, 22, + 128, 160, 160, 34, 160, 36, 36, 134, 160, 40, 40, 138, 40, 140, 140, 38, + 160, 48, 48, 146, 48, 148, 148, 38, 48, 152, 152, 42, 152, 44, 44, 22, + 128, 192, 192, 66, 192, 68, 68, 134, 192, 72, 72, 138, 72, 140, 140, 70, + 192, 80, 80, 146, 80, 148, 148, 70, 80, 152, 152, 74, 152, 76, 76, 22, + 192, 96, 96, 162, 96, 164, 164, 70, 96, 168, 168, 74, 168, 76, 76, 38, + 96, 176, 176, 82, 176, 84, 84, 38, 176, 88, 88, 42, 88, 44, 44, 150, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 7, + 16, 17, 18, 19, 20, 21, 22, 7, 24, 25, 26, 11, 28, 13, 14, 23, + 32, 33, 34, 35, 36, 37, 38, 7, 40, 41, 42, 11, 44, 13, 14, 39, + 48, 49, 50, 19, 52, 21, 22, 39, 56, 25, 26, 43, 28, 45, 46, 23, + 64, 65, 66, 67, 68, 69, 70, 7, 72, 73, 74, 11, 76, 13, 14, 71, + 80, 81, 82, 19, 84, 21, 22, 71, 88, 25, 26, 75, 28, 77, 78, 23, + 96, 97, 98, 35, 100, 37, 38, 71, 104, 41, 42, 75, 44, 77, 78, 39, + 112, 49, 50, 83, 52, 85, 86, 39, 56, 89, 90, 43, 92, 45, 46, 23, + 128, 129, 130, 131, 132, 133, 134, 7, 136, 137, 138, 11, 140, 13, 14, 135, + 144, 145, 146, 19, 148, 21, 22, 135, 152, 25, 26, 139, 28, 141, 142, 23, + 160, 161, 162, 35, 164, 37, 38, 135, 168, 41, 42, 139, 44, 141, 142, 39, + 176, 49, 50, 147, 52, 149, 150, 39, 56, 153, 154, 43, 156, 45, 46, 23, + 192, 193, 194, 67, 196, 69, 70, 135, 200, 73, 74, 139, 76, 141, 142, 71, + 208, 81, 82, 147, 84, 149, 150, 71, 88, 153, 154, 75, 156, 77, 78, 23, + 224, 97, 98, 163, 100, 165, 166, 71, 104, 169, 170, 75, 172, 77, 78, 39, + 112, 177, 178, 83, 180, 85, 86, 39, 184, 89, 90, 43, 92, 45, 46, 151, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, + 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 16, 0, 16, 16, 24, + 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 32, 0, 32, 32, 40, + 0, 0, 0, 32, 0, 32, 32, 48, 0, 32, 32, 48, 32, 48, 48, 24, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 72, + 0, 0, 0, 64, 0, 64, 64, 80, 0, 64, 64, 80, 64, 80, 80, 24, + 0, 0, 0, 64, 0, 64, 64, 96, 0, 64, 64, 96, 64, 96, 96, 40, + 0, 64, 64, 96, 64, 96, 96, 48, 64, 96, 96, 48, 96, 48, 48, 24, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 136, + 0, 0, 0, 128, 0, 128, 128, 144, 0, 128, 128, 144, 128, 144, 144, 24, + 0, 0, 0, 128, 0, 128, 128, 160, 0, 128, 128, 160, 128, 160, 160, 40, + 0, 128, 128, 160, 128, 160, 160, 48, 128, 160, 160, 48, 160, 48, 48, 24, + 0, 0, 0, 128, 0, 128, 128, 192, 0, 128, 128, 192, 128, 192, 192, 72, + 0, 128, 128, 192, 128, 192, 192, 80, 128, 192, 192, 80, 192, 80, 80, 24, + 0, 128, 128, 192, 128, 192, 192, 96, 128, 192, 192, 96, 192, 96, 96, 40, + 128, 192, 192, 96, 192, 96, 96, 48, 192, 96, 96, 48, 96, 48, 48, 152, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 9, + 16, 1, 2, 1, 4, 1, 2, 17, 8, 1, 2, 17, 4, 17, 18, 25, + 32, 1, 2, 1, 4, 1, 2, 33, 8, 1, 2, 33, 4, 33, 34, 41, + 16, 1, 2, 33, 4, 33, 34, 49, 8, 33, 34, 49, 36, 49, 50, 25, + 64, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 73, + 16, 1, 2, 65, 4, 65, 66, 81, 8, 65, 66, 81, 68, 81, 82, 25, + 32, 1, 2, 65, 4, 65, 66, 97, 8, 65, 66, 97, 68, 97, 98, 41, + 16, 65, 66, 97, 68, 97, 98, 49, 72, 97, 98, 49, 100, 49, 50, 25, + 128, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 137, + 16, 1, 2, 129, 4, 129, 130, 145, 8, 129, 130, 145, 132, 145, 146, 25, + 32, 1, 2, 129, 4, 129, 130, 161, 8, 129, 130, 161, 132, 161, 162, 41, + 16, 129, 130, 161, 132, 161, 162, 49, 136, 161, 162, 49, 164, 49, 50, 25, + 64, 1, 2, 129, 4, 129, 130, 193, 8, 129, 130, 193, 132, 193, 194, 73, + 16, 129, 130, 193, 132, 193, 194, 81, 136, 193, 194, 81, 196, 81, 82, 25, + 32, 129, 130, 193, 132, 193, 194, 97, 136, 193, 194, 97, 196, 97, 98, 41, + 144, 193, 194, 97, 196, 97, 98, 49, 200, 97, 98, 49, 100, 49, 50, 153, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 10, + 0, 16, 16, 2, 16, 4, 4, 18, 16, 8, 8, 18, 8, 20, 20, 26, + 0, 32, 32, 2, 32, 4, 4, 34, 32, 8, 8, 34, 8, 36, 36, 42, + 32, 16, 16, 34, 16, 36, 36, 50, 16, 40, 40, 50, 40, 52, 52, 26, + 0, 64, 64, 2, 64, 4, 4, 66, 64, 8, 8, 66, 8, 68, 68, 74, + 64, 16, 16, 66, 16, 68, 68, 82, 16, 72, 72, 82, 72, 84, 84, 26, + 64, 32, 32, 66, 32, 68, 68, 98, 32, 72, 72, 98, 72, 100, 100, 42, + 32, 80, 80, 98, 80, 100, 100, 50, 80, 104, 104, 50, 104, 52, 52, 26, + 0, 128, 128, 2, 128, 4, 4, 130, 128, 8, 8, 130, 8, 132, 132, 138, + 128, 16, 16, 130, 16, 132, 132, 146, 16, 136, 136, 146, 136, 148, 148, 26, + 128, 32, 32, 130, 32, 132, 132, 162, 32, 136, 136, 162, 136, 164, 164, 42, + 32, 144, 144, 162, 144, 164, 164, 50, 144, 168, 168, 50, 168, 52, 52, 26, + 128, 64, 64, 130, 64, 132, 132, 194, 64, 136, 136, 194, 136, 196, 196, 74, + 64, 144, 144, 194, 144, 196, 196, 82, 144, 200, 200, 82, 200, 84, 84, 26, + 64, 160, 160, 194, 160, 196, 196, 98, 160, 200, 200, 98, 200, 100, 100, 42, + 160, 208, 208, 98, 208, 100, 100, 50, 208, 104, 104, 50, 104, 52, 52, 154, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 11, + 16, 17, 18, 3, 20, 5, 6, 19, 24, 9, 10, 19, 12, 21, 22, 27, + 32, 33, 34, 3, 36, 5, 6, 35, 40, 9, 10, 35, 12, 37, 38, 43, + 48, 17, 18, 35, 20, 37, 38, 51, 24, 41, 42, 51, 44, 53, 54, 27, + 64, 65, 66, 3, 68, 5, 6, 67, 72, 9, 10, 67, 12, 69, 70, 75, + 80, 17, 18, 67, 20, 69, 70, 83, 24, 73, 74, 83, 76, 85, 86, 27, + 96, 33, 34, 67, 36, 69, 70, 99, 40, 73, 74, 99, 76, 101, 102, 43, + 48, 81, 82, 99, 84, 101, 102, 51, 88, 105, 106, 51, 108, 53, 54, 27, + 128, 129, 130, 3, 132, 5, 6, 131, 136, 9, 10, 131, 12, 133, 134, 139, + 144, 17, 18, 131, 20, 133, 134, 147, 24, 137, 138, 147, 140, 149, 150, 27, + 160, 33, 34, 131, 36, 133, 134, 163, 40, 137, 138, 163, 140, 165, 166, 43, + 48, 145, 146, 163, 148, 165, 166, 51, 152, 169, 170, 51, 172, 53, 54, 27, + 192, 65, 66, 131, 68, 133, 134, 195, 72, 137, 138, 195, 140, 197, 198, 75, + 80, 145, 146, 195, 148, 197, 198, 83, 152, 201, 202, 83, 204, 85, 86, 27, + 96, 161, 162, 195, 164, 197, 198, 99, 168, 201, 202, 99, 204, 101, 102, 43, + 176, 209, 210, 99, 212, 101, 102, 51, 216, 105, 106, 51, 108, 53, 54, 155, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 12, + 0, 0, 0, 16, 0, 16, 16, 20, 0, 16, 16, 24, 16, 24, 24, 28, + 0, 0, 0, 32, 0, 32, 32, 36, 0, 32, 32, 40, 32, 40, 40, 44, + 0, 32, 32, 48, 32, 48, 48, 52, 32, 48, 48, 56, 48, 56, 56, 28, + 0, 0, 0, 64, 0, 64, 64, 68, 0, 64, 64, 72, 64, 72, 72, 76, + 0, 64, 64, 80, 64, 80, 80, 84, 64, 80, 80, 88, 80, 88, 88, 28, + 0, 64, 64, 96, 64, 96, 96, 100, 64, 96, 96, 104, 96, 104, 104, 44, + 64, 96, 96, 112, 96, 112, 112, 52, 96, 112, 112, 56, 112, 56, 56, 28, + 0, 0, 0, 128, 0, 128, 128, 132, 0, 128, 128, 136, 128, 136, 136, 140, + 0, 128, 128, 144, 128, 144, 144, 148, 128, 144, 144, 152, 144, 152, 152, 28, + 0, 128, 128, 160, 128, 160, 160, 164, 128, 160, 160, 168, 160, 168, 168, 44, + 128, 160, 160, 176, 160, 176, 176, 52, 160, 176, 176, 56, 176, 56, 56, 28, + 0, 128, 128, 192, 128, 192, 192, 196, 128, 192, 192, 200, 192, 200, 200, 76, + 128, 192, 192, 208, 192, 208, 208, 84, 192, 208, 208, 88, 208, 88, 88, 28, + 128, 192, 192, 224, 192, 224, 224, 100, 192, 224, 224, 104, 224, 104, 104, 44, + 192, 224, 224, 112, 224, 112, 112, 52, 224, 112, 112, 56, 112, 56, 56, 156, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 13, + 16, 1, 2, 17, 4, 17, 18, 21, 8, 17, 18, 25, 20, 25, 26, 29, + 32, 1, 2, 33, 4, 33, 34, 37, 8, 33, 34, 41, 36, 41, 42, 45, + 16, 33, 34, 49, 36, 49, 50, 53, 40, 49, 50, 57, 52, 57, 58, 29, + 64, 1, 2, 65, 4, 65, 66, 69, 8, 65, 66, 73, 68, 73, 74, 77, + 16, 65, 66, 81, 68, 81, 82, 85, 72, 81, 82, 89, 84, 89, 90, 29, + 32, 65, 66, 97, 68, 97, 98, 101, 72, 97, 98, 105, 100, 105, 106, 45, + 80, 97, 98, 113, 100, 113, 114, 53, 104, 113, 114, 57, 116, 57, 58, 29, + 128, 1, 2, 129, 4, 129, 130, 133, 8, 129, 130, 137, 132, 137, 138, 141, + 16, 129, 130, 145, 132, 145, 146, 149, 136, 145, 146, 153, 148, 153, 154, 29, + 32, 129, 130, 161, 132, 161, 162, 165, 136, 161, 162, 169, 164, 169, 170, 45, + 144, 161, 162, 177, 164, 177, 178, 53, 168, 177, 178, 57, 180, 57, 58, 29, + 64, 129, 130, 193, 132, 193, 194, 197, 136, 193, 194, 201, 196, 201, 202, 77, + 144, 193, 194, 209, 196, 209, 210, 85, 200, 209, 210, 89, 212, 89, 90, 29, + 160, 193, 194, 225, 196, 225, 226, 101, 200, 225, 226, 105, 228, 105, 106, 45, + 208, 225, 226, 113, 228, 113, 114, 53, 232, 113, 114, 57, 116, 57, 58, 157, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 14, + 0, 16, 16, 18, 16, 20, 20, 22, 16, 24, 24, 26, 24, 28, 28, 30, + 0, 32, 32, 34, 32, 36, 36, 38, 32, 40, 40, 42, 40, 44, 44, 46, + 32, 48, 48, 50, 48, 52, 52, 54, 48, 56, 56, 58, 56, 60, 60, 30, + 0, 64, 64, 66, 64, 68, 68, 70, 64, 72, 72, 74, 72, 76, 76, 78, + 64, 80, 80, 82, 80, 84, 84, 86, 80, 88, 88, 90, 88, 92, 92, 30, + 64, 96, 96, 98, 96, 100, 100, 102, 96, 104, 104, 106, 104, 108, 108, 46, + 96, 112, 112, 114, 112, 116, 116, 54, 112, 120, 120, 58, 120, 60, 60, 30, + 0, 128, 128, 130, 128, 132, 132, 134, 128, 136, 136, 138, 136, 140, 140, 142, + 128, 144, 144, 146, 144, 148, 148, 150, 144, 152, 152, 154, 152, 156, 156, 30, + 128, 160, 160, 162, 160, 164, 164, 166, 160, 168, 168, 170, 168, 172, 172, 46, + 160, 176, 176, 178, 176, 180, 180, 54, 176, 184, 184, 58, 184, 60, 60, 30, + 128, 192, 192, 194, 192, 196, 196, 198, 192, 200, 200, 202, 200, 204, 204, 78, + 192, 208, 208, 210, 208, 212, 212, 86, 208, 216, 216, 90, 216, 92, 92, 30, + 192, 224, 224, 226, 224, 228, 228, 102, 224, 232, 232, 106, 232, 108, 108, 46, + 224, 240, 240, 114, 240, 116, 116, 54, 240, 120, 120, 58, 120, 60, 60, 158, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 31, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 31, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 47, + 112, 113, 114, 115, 116, 117, 118, 55, 120, 121, 122, 59, 124, 61, 62, 31, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 31, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 47, + 176, 177, 178, 179, 180, 181, 182, 55, 184, 185, 186, 59, 188, 61, 62, 31, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 79, + 208, 209, 210, 211, 212, 213, 214, 87, 216, 217, 218, 91, 220, 93, 94, 31, + 224, 225, 226, 227, 228, 229, 230, 103, 232, 233, 234, 107, 236, 109, 110, 47, + 240, 241, 242, 115, 244, 117, 118, 55, 248, 121, 122, 59, 124, 61, 62, 159, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 32, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 32, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 64, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 64, + 0, 0, 0, 128, 0, 128, 128, 64, 0, 128, 128, 64, 128, 64, 64, 160, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 33, + 64, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 65, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 65, + 16, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 33, + 128, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 129, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 129, + 16, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 33, + 64, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 129, + 16, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 65, + 32, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 65, + 16, 1, 2, 129, 4, 129, 130, 65, 8, 129, 130, 65, 132, 65, 66, 161, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 2, + 0, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 2, + 0, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 2, + 32, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 34, + 0, 64, 64, 2, 64, 4, 4, 2, 64, 8, 8, 2, 8, 4, 4, 2, + 64, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 66, + 64, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 66, + 32, 16, 16, 2, 16, 4, 4, 66, 16, 8, 8, 66, 8, 68, 68, 34, + 0, 128, 128, 2, 128, 4, 4, 2, 128, 8, 8, 2, 8, 4, 4, 2, + 128, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 130, + 128, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 130, + 32, 16, 16, 2, 16, 4, 4, 130, 16, 8, 8, 130, 8, 132, 132, 34, + 128, 64, 64, 2, 64, 4, 4, 2, 64, 8, 8, 2, 8, 4, 4, 130, + 64, 16, 16, 2, 16, 4, 4, 130, 16, 8, 8, 130, 8, 132, 132, 66, + 64, 32, 32, 2, 32, 4, 4, 130, 32, 8, 8, 130, 8, 132, 132, 66, + 32, 16, 16, 130, 16, 132, 132, 66, 16, 136, 136, 66, 136, 68, 68, 162, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 3, + 16, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 3, + 32, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 3, + 48, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 35, + 64, 65, 66, 3, 68, 5, 6, 3, 72, 9, 10, 3, 12, 5, 6, 3, + 80, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 67, + 96, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 67, + 48, 17, 18, 3, 20, 5, 6, 67, 24, 9, 10, 67, 12, 69, 70, 35, + 128, 129, 130, 3, 132, 5, 6, 3, 136, 9, 10, 3, 12, 5, 6, 3, + 144, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 131, + 160, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 131, + 48, 17, 18, 3, 20, 5, 6, 131, 24, 9, 10, 131, 12, 133, 134, 35, + 192, 65, 66, 3, 68, 5, 6, 3, 72, 9, 10, 3, 12, 5, 6, 131, + 80, 17, 18, 3, 20, 5, 6, 131, 24, 9, 10, 131, 12, 133, 134, 67, + 96, 33, 34, 3, 36, 5, 6, 131, 40, 9, 10, 131, 12, 133, 134, 67, + 48, 17, 18, 131, 20, 133, 134, 67, 24, 137, 138, 67, 140, 69, 70, 163, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 4, + 0, 0, 0, 16, 0, 16, 16, 4, 0, 16, 16, 8, 16, 8, 8, 4, + 0, 0, 0, 32, 0, 32, 32, 4, 0, 32, 32, 8, 32, 8, 8, 4, + 0, 32, 32, 16, 32, 16, 16, 4, 32, 16, 16, 8, 16, 8, 8, 36, + 0, 0, 0, 64, 0, 64, 64, 4, 0, 64, 64, 8, 64, 8, 8, 4, + 0, 64, 64, 16, 64, 16, 16, 4, 64, 16, 16, 8, 16, 8, 8, 68, + 0, 64, 64, 32, 64, 32, 32, 4, 64, 32, 32, 8, 32, 8, 8, 68, + 64, 32, 32, 16, 32, 16, 16, 68, 32, 16, 16, 72, 16, 72, 72, 36, + 0, 0, 0, 128, 0, 128, 128, 4, 0, 128, 128, 8, 128, 8, 8, 4, + 0, 128, 128, 16, 128, 16, 16, 4, 128, 16, 16, 8, 16, 8, 8, 132, + 0, 128, 128, 32, 128, 32, 32, 4, 128, 32, 32, 8, 32, 8, 8, 132, + 128, 32, 32, 16, 32, 16, 16, 132, 32, 16, 16, 136, 16, 136, 136, 36, + 0, 128, 128, 64, 128, 64, 64, 4, 128, 64, 64, 8, 64, 8, 8, 132, + 128, 64, 64, 16, 64, 16, 16, 132, 64, 16, 16, 136, 16, 136, 136, 68, + 128, 64, 64, 32, 64, 32, 32, 132, 64, 32, 32, 136, 32, 136, 136, 68, + 64, 32, 32, 144, 32, 144, 144, 68, 32, 144, 144, 72, 144, 72, 72, 164, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 5, + 16, 1, 2, 17, 4, 17, 18, 5, 8, 17, 18, 9, 20, 9, 10, 5, + 32, 1, 2, 33, 4, 33, 34, 5, 8, 33, 34, 9, 36, 9, 10, 5, + 16, 33, 34, 17, 36, 17, 18, 5, 40, 17, 18, 9, 20, 9, 10, 37, + 64, 1, 2, 65, 4, 65, 66, 5, 8, 65, 66, 9, 68, 9, 10, 5, + 16, 65, 66, 17, 68, 17, 18, 5, 72, 17, 18, 9, 20, 9, 10, 69, + 32, 65, 66, 33, 68, 33, 34, 5, 72, 33, 34, 9, 36, 9, 10, 69, + 80, 33, 34, 17, 36, 17, 18, 69, 40, 17, 18, 73, 20, 73, 74, 37, + 128, 1, 2, 129, 4, 129, 130, 5, 8, 129, 130, 9, 132, 9, 10, 5, + 16, 129, 130, 17, 132, 17, 18, 5, 136, 17, 18, 9, 20, 9, 10, 133, + 32, 129, 130, 33, 132, 33, 34, 5, 136, 33, 34, 9, 36, 9, 10, 133, + 144, 33, 34, 17, 36, 17, 18, 133, 40, 17, 18, 137, 20, 137, 138, 37, + 64, 129, 130, 65, 132, 65, 66, 5, 136, 65, 66, 9, 68, 9, 10, 133, + 144, 65, 66, 17, 68, 17, 18, 133, 72, 17, 18, 137, 20, 137, 138, 69, + 160, 65, 66, 33, 68, 33, 34, 133, 72, 33, 34, 137, 36, 137, 138, 69, + 80, 33, 34, 145, 36, 145, 146, 69, 40, 145, 146, 73, 148, 73, 74, 165, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 6, + 0, 16, 16, 18, 16, 20, 20, 6, 16, 24, 24, 10, 24, 12, 12, 6, + 0, 32, 32, 34, 32, 36, 36, 6, 32, 40, 40, 10, 40, 12, 12, 6, + 32, 48, 48, 18, 48, 20, 20, 6, 48, 24, 24, 10, 24, 12, 12, 38, + 0, 64, 64, 66, 64, 68, 68, 6, 64, 72, 72, 10, 72, 12, 12, 6, + 64, 80, 80, 18, 80, 20, 20, 6, 80, 24, 24, 10, 24, 12, 12, 70, + 64, 96, 96, 34, 96, 36, 36, 6, 96, 40, 40, 10, 40, 12, 12, 70, + 96, 48, 48, 18, 48, 20, 20, 70, 48, 24, 24, 74, 24, 76, 76, 38, + 0, 128, 128, 130, 128, 132, 132, 6, 128, 136, 136, 10, 136, 12, 12, 6, + 128, 144, 144, 18, 144, 20, 20, 6, 144, 24, 24, 10, 24, 12, 12, 134, + 128, 160, 160, 34, 160, 36, 36, 6, 160, 40, 40, 10, 40, 12, 12, 134, + 160, 48, 48, 18, 48, 20, 20, 134, 48, 24, 24, 138, 24, 140, 140, 38, + 128, 192, 192, 66, 192, 68, 68, 6, 192, 72, 72, 10, 72, 12, 12, 134, + 192, 80, 80, 18, 80, 20, 20, 134, 80, 24, 24, 138, 24, 140, 140, 70, + 192, 96, 96, 34, 96, 36, 36, 134, 96, 40, 40, 138, 40, 140, 140, 70, + 96, 48, 48, 146, 48, 148, 148, 70, 48, 152, 152, 74, 152, 76, 76, 166, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 7, + 16, 17, 18, 19, 20, 21, 22, 7, 24, 25, 26, 11, 28, 13, 14, 7, + 32, 33, 34, 35, 36, 37, 38, 7, 40, 41, 42, 11, 44, 13, 14, 7, + 48, 49, 50, 19, 52, 21, 22, 7, 56, 25, 26, 11, 28, 13, 14, 39, + 64, 65, 66, 67, 68, 69, 70, 7, 72, 73, 74, 11, 76, 13, 14, 7, + 80, 81, 82, 19, 84, 21, 22, 7, 88, 25, 26, 11, 28, 13, 14, 71, + 96, 97, 98, 35, 100, 37, 38, 7, 104, 41, 42, 11, 44, 13, 14, 71, + 112, 49, 50, 19, 52, 21, 22, 71, 56, 25, 26, 75, 28, 77, 78, 39, + 128, 129, 130, 131, 132, 133, 134, 7, 136, 137, 138, 11, 140, 13, 14, 7, + 144, 145, 146, 19, 148, 21, 22, 7, 152, 25, 26, 11, 28, 13, 14, 135, + 160, 161, 162, 35, 164, 37, 38, 7, 168, 41, 42, 11, 44, 13, 14, 135, + 176, 49, 50, 19, 52, 21, 22, 135, 56, 25, 26, 139, 28, 141, 142, 39, + 192, 193, 194, 67, 196, 69, 70, 7, 200, 73, 74, 11, 76, 13, 14, 135, + 208, 81, 82, 19, 84, 21, 22, 135, 88, 25, 26, 139, 28, 141, 142, 71, + 224, 97, 98, 35, 100, 37, 38, 135, 104, 41, 42, 139, 44, 141, 142, 71, + 112, 49, 50, 147, 52, 149, 150, 71, 56, 153, 154, 75, 156, 77, 78, 167, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, + 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 16, 0, 16, 16, 8, + 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 32, 0, 32, 32, 8, + 0, 0, 0, 32, 0, 32, 32, 16, 0, 32, 32, 16, 32, 16, 16, 40, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 8, + 0, 0, 0, 64, 0, 64, 64, 16, 0, 64, 64, 16, 64, 16, 16, 72, + 0, 0, 0, 64, 0, 64, 64, 32, 0, 64, 64, 32, 64, 32, 32, 72, + 0, 64, 64, 32, 64, 32, 32, 80, 64, 32, 32, 80, 32, 80, 80, 40, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 8, + 0, 0, 0, 128, 0, 128, 128, 16, 0, 128, 128, 16, 128, 16, 16, 136, + 0, 0, 0, 128, 0, 128, 128, 32, 0, 128, 128, 32, 128, 32, 32, 136, + 0, 128, 128, 32, 128, 32, 32, 144, 128, 32, 32, 144, 32, 144, 144, 40, + 0, 0, 0, 128, 0, 128, 128, 64, 0, 128, 128, 64, 128, 64, 64, 136, + 0, 128, 128, 64, 128, 64, 64, 144, 128, 64, 64, 144, 64, 144, 144, 72, + 0, 128, 128, 64, 128, 64, 64, 160, 128, 64, 64, 160, 64, 160, 160, 72, + 128, 64, 64, 160, 64, 160, 160, 80, 64, 160, 160, 80, 160, 80, 80, 168, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 9, + 16, 1, 2, 1, 4, 1, 2, 17, 8, 1, 2, 17, 4, 17, 18, 9, + 32, 1, 2, 1, 4, 1, 2, 33, 8, 1, 2, 33, 4, 33, 34, 9, + 16, 1, 2, 33, 4, 33, 34, 17, 8, 33, 34, 17, 36, 17, 18, 41, + 64, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 9, + 16, 1, 2, 65, 4, 65, 66, 17, 8, 65, 66, 17, 68, 17, 18, 73, + 32, 1, 2, 65, 4, 65, 66, 33, 8, 65, 66, 33, 68, 33, 34, 73, + 16, 65, 66, 33, 68, 33, 34, 81, 72, 33, 34, 81, 36, 81, 82, 41, + 128, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 9, + 16, 1, 2, 129, 4, 129, 130, 17, 8, 129, 130, 17, 132, 17, 18, 137, + 32, 1, 2, 129, 4, 129, 130, 33, 8, 129, 130, 33, 132, 33, 34, 137, + 16, 129, 130, 33, 132, 33, 34, 145, 136, 33, 34, 145, 36, 145, 146, 41, + 64, 1, 2, 129, 4, 129, 130, 65, 8, 129, 130, 65, 132, 65, 66, 137, + 16, 129, 130, 65, 132, 65, 66, 145, 136, 65, 66, 145, 68, 145, 146, 73, + 32, 129, 130, 65, 132, 65, 66, 161, 136, 65, 66, 161, 68, 161, 162, 73, + 144, 65, 66, 161, 68, 161, 162, 81, 72, 161, 162, 81, 164, 81, 82, 169, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 10, + 0, 16, 16, 2, 16, 4, 4, 18, 16, 8, 8, 18, 8, 20, 20, 10, + 0, 32, 32, 2, 32, 4, 4, 34, 32, 8, 8, 34, 8, 36, 36, 10, + 32, 16, 16, 34, 16, 36, 36, 18, 16, 40, 40, 18, 40, 20, 20, 42, + 0, 64, 64, 2, 64, 4, 4, 66, 64, 8, 8, 66, 8, 68, 68, 10, + 64, 16, 16, 66, 16, 68, 68, 18, 16, 72, 72, 18, 72, 20, 20, 74, + 64, 32, 32, 66, 32, 68, 68, 34, 32, 72, 72, 34, 72, 36, 36, 74, + 32, 80, 80, 34, 80, 36, 36, 82, 80, 40, 40, 82, 40, 84, 84, 42, + 0, 128, 128, 2, 128, 4, 4, 130, 128, 8, 8, 130, 8, 132, 132, 10, + 128, 16, 16, 130, 16, 132, 132, 18, 16, 136, 136, 18, 136, 20, 20, 138, + 128, 32, 32, 130, 32, 132, 132, 34, 32, 136, 136, 34, 136, 36, 36, 138, + 32, 144, 144, 34, 144, 36, 36, 146, 144, 40, 40, 146, 40, 148, 148, 42, + 128, 64, 64, 130, 64, 132, 132, 66, 64, 136, 136, 66, 136, 68, 68, 138, + 64, 144, 144, 66, 144, 68, 68, 146, 144, 72, 72, 146, 72, 148, 148, 74, + 64, 160, 160, 66, 160, 68, 68, 162, 160, 72, 72, 162, 72, 164, 164, 74, + 160, 80, 80, 162, 80, 164, 164, 82, 80, 168, 168, 82, 168, 84, 84, 170, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 11, + 16, 17, 18, 3, 20, 5, 6, 19, 24, 9, 10, 19, 12, 21, 22, 11, + 32, 33, 34, 3, 36, 5, 6, 35, 40, 9, 10, 35, 12, 37, 38, 11, + 48, 17, 18, 35, 20, 37, 38, 19, 24, 41, 42, 19, 44, 21, 22, 43, + 64, 65, 66, 3, 68, 5, 6, 67, 72, 9, 10, 67, 12, 69, 70, 11, + 80, 17, 18, 67, 20, 69, 70, 19, 24, 73, 74, 19, 76, 21, 22, 75, + 96, 33, 34, 67, 36, 69, 70, 35, 40, 73, 74, 35, 76, 37, 38, 75, + 48, 81, 82, 35, 84, 37, 38, 83, 88, 41, 42, 83, 44, 85, 86, 43, + 128, 129, 130, 3, 132, 5, 6, 131, 136, 9, 10, 131, 12, 133, 134, 11, + 144, 17, 18, 131, 20, 133, 134, 19, 24, 137, 138, 19, 140, 21, 22, 139, + 160, 33, 34, 131, 36, 133, 134, 35, 40, 137, 138, 35, 140, 37, 38, 139, + 48, 145, 146, 35, 148, 37, 38, 147, 152, 41, 42, 147, 44, 149, 150, 43, + 192, 65, 66, 131, 68, 133, 134, 67, 72, 137, 138, 67, 140, 69, 70, 139, + 80, 145, 146, 67, 148, 69, 70, 147, 152, 73, 74, 147, 76, 149, 150, 75, + 96, 161, 162, 67, 164, 69, 70, 163, 168, 73, 74, 163, 76, 165, 166, 75, + 176, 81, 82, 163, 84, 165, 166, 83, 88, 169, 170, 83, 172, 85, 86, 171, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 12, + 0, 0, 0, 16, 0, 16, 16, 20, 0, 16, 16, 24, 16, 24, 24, 12, + 0, 0, 0, 32, 0, 32, 32, 36, 0, 32, 32, 40, 32, 40, 40, 12, + 0, 32, 32, 48, 32, 48, 48, 20, 32, 48, 48, 24, 48, 24, 24, 44, + 0, 0, 0, 64, 0, 64, 64, 68, 0, 64, 64, 72, 64, 72, 72, 12, + 0, 64, 64, 80, 64, 80, 80, 20, 64, 80, 80, 24, 80, 24, 24, 76, + 0, 64, 64, 96, 64, 96, 96, 36, 64, 96, 96, 40, 96, 40, 40, 76, + 64, 96, 96, 48, 96, 48, 48, 84, 96, 48, 48, 88, 48, 88, 88, 44, + 0, 0, 0, 128, 0, 128, 128, 132, 0, 128, 128, 136, 128, 136, 136, 12, + 0, 128, 128, 144, 128, 144, 144, 20, 128, 144, 144, 24, 144, 24, 24, 140, + 0, 128, 128, 160, 128, 160, 160, 36, 128, 160, 160, 40, 160, 40, 40, 140, + 128, 160, 160, 48, 160, 48, 48, 148, 160, 48, 48, 152, 48, 152, 152, 44, + 0, 128, 128, 192, 128, 192, 192, 68, 128, 192, 192, 72, 192, 72, 72, 140, + 128, 192, 192, 80, 192, 80, 80, 148, 192, 80, 80, 152, 80, 152, 152, 76, + 128, 192, 192, 96, 192, 96, 96, 164, 192, 96, 96, 168, 96, 168, 168, 76, + 192, 96, 96, 176, 96, 176, 176, 84, 96, 176, 176, 88, 176, 88, 88, 172, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 13, + 16, 1, 2, 17, 4, 17, 18, 21, 8, 17, 18, 25, 20, 25, 26, 13, + 32, 1, 2, 33, 4, 33, 34, 37, 8, 33, 34, 41, 36, 41, 42, 13, + 16, 33, 34, 49, 36, 49, 50, 21, 40, 49, 50, 25, 52, 25, 26, 45, + 64, 1, 2, 65, 4, 65, 66, 69, 8, 65, 66, 73, 68, 73, 74, 13, + 16, 65, 66, 81, 68, 81, 82, 21, 72, 81, 82, 25, 84, 25, 26, 77, + 32, 65, 66, 97, 68, 97, 98, 37, 72, 97, 98, 41, 100, 41, 42, 77, + 80, 97, 98, 49, 100, 49, 50, 85, 104, 49, 50, 89, 52, 89, 90, 45, + 128, 1, 2, 129, 4, 129, 130, 133, 8, 129, 130, 137, 132, 137, 138, 13, + 16, 129, 130, 145, 132, 145, 146, 21, 136, 145, 146, 25, 148, 25, 26, 141, + 32, 129, 130, 161, 132, 161, 162, 37, 136, 161, 162, 41, 164, 41, 42, 141, + 144, 161, 162, 49, 164, 49, 50, 149, 168, 49, 50, 153, 52, 153, 154, 45, + 64, 129, 130, 193, 132, 193, 194, 69, 136, 193, 194, 73, 196, 73, 74, 141, + 144, 193, 194, 81, 196, 81, 82, 149, 200, 81, 82, 153, 84, 153, 154, 77, + 160, 193, 194, 97, 196, 97, 98, 165, 200, 97, 98, 169, 100, 169, 170, 77, + 208, 97, 98, 177, 100, 177, 178, 85, 104, 177, 178, 89, 180, 89, 90, 173, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 14, + 0, 16, 16, 18, 16, 20, 20, 22, 16, 24, 24, 26, 24, 28, 28, 14, + 0, 32, 32, 34, 32, 36, 36, 38, 32, 40, 40, 42, 40, 44, 44, 14, + 32, 48, 48, 50, 48, 52, 52, 22, 48, 56, 56, 26, 56, 28, 28, 46, + 0, 64, 64, 66, 64, 68, 68, 70, 64, 72, 72, 74, 72, 76, 76, 14, + 64, 80, 80, 82, 80, 84, 84, 22, 80, 88, 88, 26, 88, 28, 28, 78, + 64, 96, 96, 98, 96, 100, 100, 38, 96, 104, 104, 42, 104, 44, 44, 78, + 96, 112, 112, 50, 112, 52, 52, 86, 112, 56, 56, 90, 56, 92, 92, 46, + 0, 128, 128, 130, 128, 132, 132, 134, 128, 136, 136, 138, 136, 140, 140, 14, + 128, 144, 144, 146, 144, 148, 148, 22, 144, 152, 152, 26, 152, 28, 28, 142, + 128, 160, 160, 162, 160, 164, 164, 38, 160, 168, 168, 42, 168, 44, 44, 142, + 160, 176, 176, 50, 176, 52, 52, 150, 176, 56, 56, 154, 56, 156, 156, 46, + 128, 192, 192, 194, 192, 196, 196, 70, 192, 200, 200, 74, 200, 76, 76, 142, + 192, 208, 208, 82, 208, 84, 84, 150, 208, 88, 88, 154, 88, 156, 156, 78, + 192, 224, 224, 98, 224, 100, 100, 166, 224, 104, 104, 170, 104, 172, 172, 78, + 224, 112, 112, 178, 112, 180, 180, 86, 112, 184, 184, 90, 184, 92, 92, 174, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 15, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 15, + 48, 49, 50, 51, 52, 53, 54, 23, 56, 57, 58, 27, 60, 29, 30, 47, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 15, + 80, 81, 82, 83, 84, 85, 86, 23, 88, 89, 90, 27, 92, 29, 30, 79, + 96, 97, 98, 99, 100, 101, 102, 39, 104, 105, 106, 43, 108, 45, 46, 79, + 112, 113, 114, 51, 116, 53, 54, 87, 120, 57, 58, 91, 60, 93, 94, 47, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 15, + 144, 145, 146, 147, 148, 149, 150, 23, 152, 153, 154, 27, 156, 29, 30, 143, + 160, 161, 162, 163, 164, 165, 166, 39, 168, 169, 170, 43, 172, 45, 46, 143, + 176, 177, 178, 51, 180, 53, 54, 151, 184, 57, 58, 155, 60, 157, 158, 47, + 192, 193, 194, 195, 196, 197, 198, 71, 200, 201, 202, 75, 204, 77, 78, 143, + 208, 209, 210, 83, 212, 85, 86, 151, 216, 89, 90, 155, 92, 157, 158, 79, + 224, 225, 226, 99, 228, 101, 102, 167, 232, 105, 106, 171, 108, 173, 174, 79, + 240, 113, 114, 179, 116, 181, 182, 87, 120, 185, 186, 91, 188, 93, 94, 175, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, + 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 32, 0, 32, 32, 48, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 80, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 96, + 0, 0, 0, 64, 0, 64, 64, 96, 0, 64, 64, 96, 64, 96, 96, 48, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 144, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 160, + 0, 0, 0, 128, 0, 128, 128, 160, 0, 128, 128, 160, 128, 160, 160, 48, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 192, + 0, 0, 0, 128, 0, 128, 128, 192, 0, 128, 128, 192, 128, 192, 192, 80, + 0, 0, 0, 128, 0, 128, 128, 192, 0, 128, 128, 192, 128, 192, 192, 96, + 0, 128, 128, 192, 128, 192, 192, 96, 128, 192, 192, 96, 192, 96, 96, 176, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 17, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 33, + 16, 1, 2, 1, 4, 1, 2, 33, 8, 1, 2, 33, 4, 33, 34, 49, + 64, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 65, + 16, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 81, + 32, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 97, + 16, 1, 2, 65, 4, 65, 66, 97, 8, 65, 66, 97, 68, 97, 98, 49, + 128, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 129, + 16, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 145, + 32, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 161, + 16, 1, 2, 129, 4, 129, 130, 161, 8, 129, 130, 161, 132, 161, 162, 49, + 64, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 193, + 16, 1, 2, 129, 4, 129, 130, 193, 8, 129, 130, 193, 132, 193, 194, 81, + 32, 1, 2, 129, 4, 129, 130, 193, 8, 129, 130, 193, 132, 193, 194, 97, + 16, 129, 130, 193, 132, 193, 194, 97, 136, 193, 194, 97, 196, 97, 98, 177, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 2, + 0, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 18, + 0, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 34, + 32, 16, 16, 2, 16, 4, 4, 34, 16, 8, 8, 34, 8, 36, 36, 50, + 0, 64, 64, 2, 64, 4, 4, 2, 64, 8, 8, 2, 8, 4, 4, 66, + 64, 16, 16, 2, 16, 4, 4, 66, 16, 8, 8, 66, 8, 68, 68, 82, + 64, 32, 32, 2, 32, 4, 4, 66, 32, 8, 8, 66, 8, 68, 68, 98, + 32, 16, 16, 66, 16, 68, 68, 98, 16, 72, 72, 98, 72, 100, 100, 50, + 0, 128, 128, 2, 128, 4, 4, 2, 128, 8, 8, 2, 8, 4, 4, 130, + 128, 16, 16, 2, 16, 4, 4, 130, 16, 8, 8, 130, 8, 132, 132, 146, + 128, 32, 32, 2, 32, 4, 4, 130, 32, 8, 8, 130, 8, 132, 132, 162, + 32, 16, 16, 130, 16, 132, 132, 162, 16, 136, 136, 162, 136, 164, 164, 50, + 128, 64, 64, 2, 64, 4, 4, 130, 64, 8, 8, 130, 8, 132, 132, 194, + 64, 16, 16, 130, 16, 132, 132, 194, 16, 136, 136, 194, 136, 196, 196, 82, + 64, 32, 32, 130, 32, 132, 132, 194, 32, 136, 136, 194, 136, 196, 196, 98, + 32, 144, 144, 194, 144, 196, 196, 98, 144, 200, 200, 98, 200, 100, 100, 178, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 3, + 16, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 19, + 32, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 35, + 48, 17, 18, 3, 20, 5, 6, 35, 24, 9, 10, 35, 12, 37, 38, 51, + 64, 65, 66, 3, 68, 5, 6, 3, 72, 9, 10, 3, 12, 5, 6, 67, + 80, 17, 18, 3, 20, 5, 6, 67, 24, 9, 10, 67, 12, 69, 70, 83, + 96, 33, 34, 3, 36, 5, 6, 67, 40, 9, 10, 67, 12, 69, 70, 99, + 48, 17, 18, 67, 20, 69, 70, 99, 24, 73, 74, 99, 76, 101, 102, 51, + 128, 129, 130, 3, 132, 5, 6, 3, 136, 9, 10, 3, 12, 5, 6, 131, + 144, 17, 18, 3, 20, 5, 6, 131, 24, 9, 10, 131, 12, 133, 134, 147, + 160, 33, 34, 3, 36, 5, 6, 131, 40, 9, 10, 131, 12, 133, 134, 163, + 48, 17, 18, 131, 20, 133, 134, 163, 24, 137, 138, 163, 140, 165, 166, 51, + 192, 65, 66, 3, 68, 5, 6, 131, 72, 9, 10, 131, 12, 133, 134, 195, + 80, 17, 18, 131, 20, 133, 134, 195, 24, 137, 138, 195, 140, 197, 198, 83, + 96, 33, 34, 131, 36, 133, 134, 195, 40, 137, 138, 195, 140, 197, 198, 99, + 48, 145, 146, 195, 148, 197, 198, 99, 152, 201, 202, 99, 204, 101, 102, 179, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 4, + 0, 0, 0, 16, 0, 16, 16, 4, 0, 16, 16, 8, 16, 8, 8, 20, + 0, 0, 0, 32, 0, 32, 32, 4, 0, 32, 32, 8, 32, 8, 8, 36, + 0, 32, 32, 16, 32, 16, 16, 36, 32, 16, 16, 40, 16, 40, 40, 52, + 0, 0, 0, 64, 0, 64, 64, 4, 0, 64, 64, 8, 64, 8, 8, 68, + 0, 64, 64, 16, 64, 16, 16, 68, 64, 16, 16, 72, 16, 72, 72, 84, + 0, 64, 64, 32, 64, 32, 32, 68, 64, 32, 32, 72, 32, 72, 72, 100, + 64, 32, 32, 80, 32, 80, 80, 100, 32, 80, 80, 104, 80, 104, 104, 52, + 0, 0, 0, 128, 0, 128, 128, 4, 0, 128, 128, 8, 128, 8, 8, 132, + 0, 128, 128, 16, 128, 16, 16, 132, 128, 16, 16, 136, 16, 136, 136, 148, + 0, 128, 128, 32, 128, 32, 32, 132, 128, 32, 32, 136, 32, 136, 136, 164, + 128, 32, 32, 144, 32, 144, 144, 164, 32, 144, 144, 168, 144, 168, 168, 52, + 0, 128, 128, 64, 128, 64, 64, 132, 128, 64, 64, 136, 64, 136, 136, 196, + 128, 64, 64, 144, 64, 144, 144, 196, 64, 144, 144, 200, 144, 200, 200, 84, + 128, 64, 64, 160, 64, 160, 160, 196, 64, 160, 160, 200, 160, 200, 200, 100, + 64, 160, 160, 208, 160, 208, 208, 100, 160, 208, 208, 104, 208, 104, 104, 180, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 5, + 16, 1, 2, 17, 4, 17, 18, 5, 8, 17, 18, 9, 20, 9, 10, 21, + 32, 1, 2, 33, 4, 33, 34, 5, 8, 33, 34, 9, 36, 9, 10, 37, + 16, 33, 34, 17, 36, 17, 18, 37, 40, 17, 18, 41, 20, 41, 42, 53, + 64, 1, 2, 65, 4, 65, 66, 5, 8, 65, 66, 9, 68, 9, 10, 69, + 16, 65, 66, 17, 68, 17, 18, 69, 72, 17, 18, 73, 20, 73, 74, 85, + 32, 65, 66, 33, 68, 33, 34, 69, 72, 33, 34, 73, 36, 73, 74, 101, + 80, 33, 34, 81, 36, 81, 82, 101, 40, 81, 82, 105, 84, 105, 106, 53, + 128, 1, 2, 129, 4, 129, 130, 5, 8, 129, 130, 9, 132, 9, 10, 133, + 16, 129, 130, 17, 132, 17, 18, 133, 136, 17, 18, 137, 20, 137, 138, 149, + 32, 129, 130, 33, 132, 33, 34, 133, 136, 33, 34, 137, 36, 137, 138, 165, + 144, 33, 34, 145, 36, 145, 146, 165, 40, 145, 146, 169, 148, 169, 170, 53, + 64, 129, 130, 65, 132, 65, 66, 133, 136, 65, 66, 137, 68, 137, 138, 197, + 144, 65, 66, 145, 68, 145, 146, 197, 72, 145, 146, 201, 148, 201, 202, 85, + 160, 65, 66, 161, 68, 161, 162, 197, 72, 161, 162, 201, 164, 201, 202, 101, + 80, 161, 162, 209, 164, 209, 210, 101, 168, 209, 210, 105, 212, 105, 106, 181, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 6, + 0, 16, 16, 18, 16, 20, 20, 6, 16, 24, 24, 10, 24, 12, 12, 22, + 0, 32, 32, 34, 32, 36, 36, 6, 32, 40, 40, 10, 40, 12, 12, 38, + 32, 48, 48, 18, 48, 20, 20, 38, 48, 24, 24, 42, 24, 44, 44, 54, + 0, 64, 64, 66, 64, 68, 68, 6, 64, 72, 72, 10, 72, 12, 12, 70, + 64, 80, 80, 18, 80, 20, 20, 70, 80, 24, 24, 74, 24, 76, 76, 86, + 64, 96, 96, 34, 96, 36, 36, 70, 96, 40, 40, 74, 40, 76, 76, 102, + 96, 48, 48, 82, 48, 84, 84, 102, 48, 88, 88, 106, 88, 108, 108, 54, + 0, 128, 128, 130, 128, 132, 132, 6, 128, 136, 136, 10, 136, 12, 12, 134, + 128, 144, 144, 18, 144, 20, 20, 134, 144, 24, 24, 138, 24, 140, 140, 150, + 128, 160, 160, 34, 160, 36, 36, 134, 160, 40, 40, 138, 40, 140, 140, 166, + 160, 48, 48, 146, 48, 148, 148, 166, 48, 152, 152, 170, 152, 172, 172, 54, + 128, 192, 192, 66, 192, 68, 68, 134, 192, 72, 72, 138, 72, 140, 140, 198, + 192, 80, 80, 146, 80, 148, 148, 198, 80, 152, 152, 202, 152, 204, 204, 86, + 192, 96, 96, 162, 96, 164, 164, 198, 96, 168, 168, 202, 168, 204, 204, 102, + 96, 176, 176, 210, 176, 212, 212, 102, 176, 216, 216, 106, 216, 108, 108, 182, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 7, + 16, 17, 18, 19, 20, 21, 22, 7, 24, 25, 26, 11, 28, 13, 14, 23, + 32, 33, 34, 35, 36, 37, 38, 7, 40, 41, 42, 11, 44, 13, 14, 39, + 48, 49, 50, 19, 52, 21, 22, 39, 56, 25, 26, 43, 28, 45, 46, 55, + 64, 65, 66, 67, 68, 69, 70, 7, 72, 73, 74, 11, 76, 13, 14, 71, + 80, 81, 82, 19, 84, 21, 22, 71, 88, 25, 26, 75, 28, 77, 78, 87, + 96, 97, 98, 35, 100, 37, 38, 71, 104, 41, 42, 75, 44, 77, 78, 103, + 112, 49, 50, 83, 52, 85, 86, 103, 56, 89, 90, 107, 92, 109, 110, 55, + 128, 129, 130, 131, 132, 133, 134, 7, 136, 137, 138, 11, 140, 13, 14, 135, + 144, 145, 146, 19, 148, 21, 22, 135, 152, 25, 26, 139, 28, 141, 142, 151, + 160, 161, 162, 35, 164, 37, 38, 135, 168, 41, 42, 139, 44, 141, 142, 167, + 176, 49, 50, 147, 52, 149, 150, 167, 56, 153, 154, 171, 156, 173, 174, 55, + 192, 193, 194, 67, 196, 69, 70, 135, 200, 73, 74, 139, 76, 141, 142, 199, + 208, 81, 82, 147, 84, 149, 150, 199, 88, 153, 154, 203, 156, 205, 206, 87, + 224, 97, 98, 163, 100, 165, 166, 199, 104, 169, 170, 203, 172, 205, 206, 103, + 112, 177, 178, 211, 180, 213, 214, 103, 184, 217, 218, 107, 220, 109, 110, 183, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, + 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 16, 0, 16, 16, 24, + 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 32, 0, 32, 32, 40, + 0, 0, 0, 32, 0, 32, 32, 48, 0, 32, 32, 48, 32, 48, 48, 56, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 72, + 0, 0, 0, 64, 0, 64, 64, 80, 0, 64, 64, 80, 64, 80, 80, 88, + 0, 0, 0, 64, 0, 64, 64, 96, 0, 64, 64, 96, 64, 96, 96, 104, + 0, 64, 64, 96, 64, 96, 96, 112, 64, 96, 96, 112, 96, 112, 112, 56, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 136, + 0, 0, 0, 128, 0, 128, 128, 144, 0, 128, 128, 144, 128, 144, 144, 152, + 0, 0, 0, 128, 0, 128, 128, 160, 0, 128, 128, 160, 128, 160, 160, 168, + 0, 128, 128, 160, 128, 160, 160, 176, 128, 160, 160, 176, 160, 176, 176, 56, + 0, 0, 0, 128, 0, 128, 128, 192, 0, 128, 128, 192, 128, 192, 192, 200, + 0, 128, 128, 192, 128, 192, 192, 208, 128, 192, 192, 208, 192, 208, 208, 88, + 0, 128, 128, 192, 128, 192, 192, 224, 128, 192, 192, 224, 192, 224, 224, 104, + 128, 192, 192, 224, 192, 224, 224, 112, 192, 224, 224, 112, 224, 112, 112, 184, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 9, + 16, 1, 2, 1, 4, 1, 2, 17, 8, 1, 2, 17, 4, 17, 18, 25, + 32, 1, 2, 1, 4, 1, 2, 33, 8, 1, 2, 33, 4, 33, 34, 41, + 16, 1, 2, 33, 4, 33, 34, 49, 8, 33, 34, 49, 36, 49, 50, 57, + 64, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 73, + 16, 1, 2, 65, 4, 65, 66, 81, 8, 65, 66, 81, 68, 81, 82, 89, + 32, 1, 2, 65, 4, 65, 66, 97, 8, 65, 66, 97, 68, 97, 98, 105, + 16, 65, 66, 97, 68, 97, 98, 113, 72, 97, 98, 113, 100, 113, 114, 57, + 128, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 137, + 16, 1, 2, 129, 4, 129, 130, 145, 8, 129, 130, 145, 132, 145, 146, 153, + 32, 1, 2, 129, 4, 129, 130, 161, 8, 129, 130, 161, 132, 161, 162, 169, + 16, 129, 130, 161, 132, 161, 162, 177, 136, 161, 162, 177, 164, 177, 178, 57, + 64, 1, 2, 129, 4, 129, 130, 193, 8, 129, 130, 193, 132, 193, 194, 201, + 16, 129, 130, 193, 132, 193, 194, 209, 136, 193, 194, 209, 196, 209, 210, 89, + 32, 129, 130, 193, 132, 193, 194, 225, 136, 193, 194, 225, 196, 225, 226, 105, + 144, 193, 194, 225, 196, 225, 226, 113, 200, 225, 226, 113, 228, 113, 114, 185, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 10, + 0, 16, 16, 2, 16, 4, 4, 18, 16, 8, 8, 18, 8, 20, 20, 26, + 0, 32, 32, 2, 32, 4, 4, 34, 32, 8, 8, 34, 8, 36, 36, 42, + 32, 16, 16, 34, 16, 36, 36, 50, 16, 40, 40, 50, 40, 52, 52, 58, + 0, 64, 64, 2, 64, 4, 4, 66, 64, 8, 8, 66, 8, 68, 68, 74, + 64, 16, 16, 66, 16, 68, 68, 82, 16, 72, 72, 82, 72, 84, 84, 90, + 64, 32, 32, 66, 32, 68, 68, 98, 32, 72, 72, 98, 72, 100, 100, 106, + 32, 80, 80, 98, 80, 100, 100, 114, 80, 104, 104, 114, 104, 116, 116, 58, + 0, 128, 128, 2, 128, 4, 4, 130, 128, 8, 8, 130, 8, 132, 132, 138, + 128, 16, 16, 130, 16, 132, 132, 146, 16, 136, 136, 146, 136, 148, 148, 154, + 128, 32, 32, 130, 32, 132, 132, 162, 32, 136, 136, 162, 136, 164, 164, 170, + 32, 144, 144, 162, 144, 164, 164, 178, 144, 168, 168, 178, 168, 180, 180, 58, + 128, 64, 64, 130, 64, 132, 132, 194, 64, 136, 136, 194, 136, 196, 196, 202, + 64, 144, 144, 194, 144, 196, 196, 210, 144, 200, 200, 210, 200, 212, 212, 90, + 64, 160, 160, 194, 160, 196, 196, 226, 160, 200, 200, 226, 200, 228, 228, 106, + 160, 208, 208, 226, 208, 228, 228, 114, 208, 232, 232, 114, 232, 116, 116, 186, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 11, + 16, 17, 18, 3, 20, 5, 6, 19, 24, 9, 10, 19, 12, 21, 22, 27, + 32, 33, 34, 3, 36, 5, 6, 35, 40, 9, 10, 35, 12, 37, 38, 43, + 48, 17, 18, 35, 20, 37, 38, 51, 24, 41, 42, 51, 44, 53, 54, 59, + 64, 65, 66, 3, 68, 5, 6, 67, 72, 9, 10, 67, 12, 69, 70, 75, + 80, 17, 18, 67, 20, 69, 70, 83, 24, 73, 74, 83, 76, 85, 86, 91, + 96, 33, 34, 67, 36, 69, 70, 99, 40, 73, 74, 99, 76, 101, 102, 107, + 48, 81, 82, 99, 84, 101, 102, 115, 88, 105, 106, 115, 108, 117, 118, 59, + 128, 129, 130, 3, 132, 5, 6, 131, 136, 9, 10, 131, 12, 133, 134, 139, + 144, 17, 18, 131, 20, 133, 134, 147, 24, 137, 138, 147, 140, 149, 150, 155, + 160, 33, 34, 131, 36, 133, 134, 163, 40, 137, 138, 163, 140, 165, 166, 171, + 48, 145, 146, 163, 148, 165, 166, 179, 152, 169, 170, 179, 172, 181, 182, 59, + 192, 65, 66, 131, 68, 133, 134, 195, 72, 137, 138, 195, 140, 197, 198, 203, + 80, 145, 146, 195, 148, 197, 198, 211, 152, 201, 202, 211, 204, 213, 214, 91, + 96, 161, 162, 195, 164, 197, 198, 227, 168, 201, 202, 227, 204, 229, 230, 107, + 176, 209, 210, 227, 212, 229, 230, 115, 216, 233, 234, 115, 236, 117, 118, 187, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 12, + 0, 0, 0, 16, 0, 16, 16, 20, 0, 16, 16, 24, 16, 24, 24, 28, + 0, 0, 0, 32, 0, 32, 32, 36, 0, 32, 32, 40, 32, 40, 40, 44, + 0, 32, 32, 48, 32, 48, 48, 52, 32, 48, 48, 56, 48, 56, 56, 60, + 0, 0, 0, 64, 0, 64, 64, 68, 0, 64, 64, 72, 64, 72, 72, 76, + 0, 64, 64, 80, 64, 80, 80, 84, 64, 80, 80, 88, 80, 88, 88, 92, + 0, 64, 64, 96, 64, 96, 96, 100, 64, 96, 96, 104, 96, 104, 104, 108, + 64, 96, 96, 112, 96, 112, 112, 116, 96, 112, 112, 120, 112, 120, 120, 60, + 0, 0, 0, 128, 0, 128, 128, 132, 0, 128, 128, 136, 128, 136, 136, 140, + 0, 128, 128, 144, 128, 144, 144, 148, 128, 144, 144, 152, 144, 152, 152, 156, + 0, 128, 128, 160, 128, 160, 160, 164, 128, 160, 160, 168, 160, 168, 168, 172, + 128, 160, 160, 176, 160, 176, 176, 180, 160, 176, 176, 184, 176, 184, 184, 60, + 0, 128, 128, 192, 128, 192, 192, 196, 128, 192, 192, 200, 192, 200, 200, 204, + 128, 192, 192, 208, 192, 208, 208, 212, 192, 208, 208, 216, 208, 216, 216, 92, + 128, 192, 192, 224, 192, 224, 224, 228, 192, 224, 224, 232, 224, 232, 232, 108, + 192, 224, 224, 240, 224, 240, 240, 116, 224, 240, 240, 120, 240, 120, 120, 188, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 13, + 16, 1, 2, 17, 4, 17, 18, 21, 8, 17, 18, 25, 20, 25, 26, 29, + 32, 1, 2, 33, 4, 33, 34, 37, 8, 33, 34, 41, 36, 41, 42, 45, + 16, 33, 34, 49, 36, 49, 50, 53, 40, 49, 50, 57, 52, 57, 58, 61, + 64, 1, 2, 65, 4, 65, 66, 69, 8, 65, 66, 73, 68, 73, 74, 77, + 16, 65, 66, 81, 68, 81, 82, 85, 72, 81, 82, 89, 84, 89, 90, 93, + 32, 65, 66, 97, 68, 97, 98, 101, 72, 97, 98, 105, 100, 105, 106, 109, + 80, 97, 98, 113, 100, 113, 114, 117, 104, 113, 114, 121, 116, 121, 122, 61, + 128, 1, 2, 129, 4, 129, 130, 133, 8, 129, 130, 137, 132, 137, 138, 141, + 16, 129, 130, 145, 132, 145, 146, 149, 136, 145, 146, 153, 148, 153, 154, 157, + 32, 129, 130, 161, 132, 161, 162, 165, 136, 161, 162, 169, 164, 169, 170, 173, + 144, 161, 162, 177, 164, 177, 178, 181, 168, 177, 178, 185, 180, 185, 186, 61, + 64, 129, 130, 193, 132, 193, 194, 197, 136, 193, 194, 201, 196, 201, 202, 205, + 144, 193, 194, 209, 196, 209, 210, 213, 200, 209, 210, 217, 212, 217, 218, 93, + 160, 193, 194, 225, 196, 225, 226, 229, 200, 225, 226, 233, 228, 233, 234, 109, + 208, 225, 226, 241, 228, 241, 242, 117, 232, 241, 242, 121, 244, 121, 122, 189, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 14, + 0, 16, 16, 18, 16, 20, 20, 22, 16, 24, 24, 26, 24, 28, 28, 30, + 0, 32, 32, 34, 32, 36, 36, 38, 32, 40, 40, 42, 40, 44, 44, 46, + 32, 48, 48, 50, 48, 52, 52, 54, 48, 56, 56, 58, 56, 60, 60, 62, + 0, 64, 64, 66, 64, 68, 68, 70, 64, 72, 72, 74, 72, 76, 76, 78, + 64, 80, 80, 82, 80, 84, 84, 86, 80, 88, 88, 90, 88, 92, 92, 94, + 64, 96, 96, 98, 96, 100, 100, 102, 96, 104, 104, 106, 104, 108, 108, 110, + 96, 112, 112, 114, 112, 116, 116, 118, 112, 120, 120, 122, 120, 124, 124, 62, + 0, 128, 128, 130, 128, 132, 132, 134, 128, 136, 136, 138, 136, 140, 140, 142, + 128, 144, 144, 146, 144, 148, 148, 150, 144, 152, 152, 154, 152, 156, 156, 158, + 128, 160, 160, 162, 160, 164, 164, 166, 160, 168, 168, 170, 168, 172, 172, 174, + 160, 176, 176, 178, 176, 180, 180, 182, 176, 184, 184, 186, 184, 188, 188, 62, + 128, 192, 192, 194, 192, 196, 196, 198, 192, 200, 200, 202, 200, 204, 204, 206, + 192, 208, 208, 210, 208, 212, 212, 214, 208, 216, 216, 218, 216, 220, 220, 94, + 192, 224, 224, 226, 224, 228, 228, 230, 224, 232, 232, 234, 232, 236, 236, 110, + 224, 240, 240, 242, 240, 244, 244, 118, 240, 248, 248, 122, 248, 124, 124, 190, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 63, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 63, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 95, + 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 111, + 240, 241, 242, 243, 244, 245, 246, 119, 248, 249, 250, 123, 252, 125, 126, 191, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 192, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 64, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 65, + 128, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 129, + 64, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 129, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 129, + 16, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 193, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 2, + 0, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 2, + 0, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 2, + 32, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 2, + 0, 64, 64, 2, 64, 4, 4, 2, 64, 8, 8, 2, 8, 4, 4, 2, + 64, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 2, + 64, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 2, + 32, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 66, + 0, 128, 128, 2, 128, 4, 4, 2, 128, 8, 8, 2, 8, 4, 4, 2, + 128, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 2, + 128, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 2, + 32, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 130, + 128, 64, 64, 2, 64, 4, 4, 2, 64, 8, 8, 2, 8, 4, 4, 2, + 64, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 130, + 64, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 130, + 32, 16, 16, 2, 16, 4, 4, 130, 16, 8, 8, 130, 8, 132, 132, 194, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 3, + 16, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 3, + 32, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 3, + 48, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 3, + 64, 65, 66, 3, 68, 5, 6, 3, 72, 9, 10, 3, 12, 5, 6, 3, + 80, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 3, + 96, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 3, + 48, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 67, + 128, 129, 130, 3, 132, 5, 6, 3, 136, 9, 10, 3, 12, 5, 6, 3, + 144, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 3, + 160, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 3, + 48, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 131, + 192, 65, 66, 3, 68, 5, 6, 3, 72, 9, 10, 3, 12, 5, 6, 3, + 80, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 131, + 96, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 131, + 48, 17, 18, 3, 20, 5, 6, 131, 24, 9, 10, 131, 12, 133, 134, 195, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 4, + 0, 0, 0, 16, 0, 16, 16, 4, 0, 16, 16, 8, 16, 8, 8, 4, + 0, 0, 0, 32, 0, 32, 32, 4, 0, 32, 32, 8, 32, 8, 8, 4, + 0, 32, 32, 16, 32, 16, 16, 4, 32, 16, 16, 8, 16, 8, 8, 4, + 0, 0, 0, 64, 0, 64, 64, 4, 0, 64, 64, 8, 64, 8, 8, 4, + 0, 64, 64, 16, 64, 16, 16, 4, 64, 16, 16, 8, 16, 8, 8, 4, + 0, 64, 64, 32, 64, 32, 32, 4, 64, 32, 32, 8, 32, 8, 8, 4, + 64, 32, 32, 16, 32, 16, 16, 4, 32, 16, 16, 8, 16, 8, 8, 68, + 0, 0, 0, 128, 0, 128, 128, 4, 0, 128, 128, 8, 128, 8, 8, 4, + 0, 128, 128, 16, 128, 16, 16, 4, 128, 16, 16, 8, 16, 8, 8, 4, + 0, 128, 128, 32, 128, 32, 32, 4, 128, 32, 32, 8, 32, 8, 8, 4, + 128, 32, 32, 16, 32, 16, 16, 4, 32, 16, 16, 8, 16, 8, 8, 132, + 0, 128, 128, 64, 128, 64, 64, 4, 128, 64, 64, 8, 64, 8, 8, 4, + 128, 64, 64, 16, 64, 16, 16, 4, 64, 16, 16, 8, 16, 8, 8, 132, + 128, 64, 64, 32, 64, 32, 32, 4, 64, 32, 32, 8, 32, 8, 8, 132, + 64, 32, 32, 16, 32, 16, 16, 132, 32, 16, 16, 136, 16, 136, 136, 196, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 5, + 16, 1, 2, 17, 4, 17, 18, 5, 8, 17, 18, 9, 20, 9, 10, 5, + 32, 1, 2, 33, 4, 33, 34, 5, 8, 33, 34, 9, 36, 9, 10, 5, + 16, 33, 34, 17, 36, 17, 18, 5, 40, 17, 18, 9, 20, 9, 10, 5, + 64, 1, 2, 65, 4, 65, 66, 5, 8, 65, 66, 9, 68, 9, 10, 5, + 16, 65, 66, 17, 68, 17, 18, 5, 72, 17, 18, 9, 20, 9, 10, 5, + 32, 65, 66, 33, 68, 33, 34, 5, 72, 33, 34, 9, 36, 9, 10, 5, + 80, 33, 34, 17, 36, 17, 18, 5, 40, 17, 18, 9, 20, 9, 10, 69, + 128, 1, 2, 129, 4, 129, 130, 5, 8, 129, 130, 9, 132, 9, 10, 5, + 16, 129, 130, 17, 132, 17, 18, 5, 136, 17, 18, 9, 20, 9, 10, 5, + 32, 129, 130, 33, 132, 33, 34, 5, 136, 33, 34, 9, 36, 9, 10, 5, + 144, 33, 34, 17, 36, 17, 18, 5, 40, 17, 18, 9, 20, 9, 10, 133, + 64, 129, 130, 65, 132, 65, 66, 5, 136, 65, 66, 9, 68, 9, 10, 5, + 144, 65, 66, 17, 68, 17, 18, 5, 72, 17, 18, 9, 20, 9, 10, 133, + 160, 65, 66, 33, 68, 33, 34, 5, 72, 33, 34, 9, 36, 9, 10, 133, + 80, 33, 34, 17, 36, 17, 18, 133, 40, 17, 18, 137, 20, 137, 138, 197, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 6, + 0, 16, 16, 18, 16, 20, 20, 6, 16, 24, 24, 10, 24, 12, 12, 6, + 0, 32, 32, 34, 32, 36, 36, 6, 32, 40, 40, 10, 40, 12, 12, 6, + 32, 48, 48, 18, 48, 20, 20, 6, 48, 24, 24, 10, 24, 12, 12, 6, + 0, 64, 64, 66, 64, 68, 68, 6, 64, 72, 72, 10, 72, 12, 12, 6, + 64, 80, 80, 18, 80, 20, 20, 6, 80, 24, 24, 10, 24, 12, 12, 6, + 64, 96, 96, 34, 96, 36, 36, 6, 96, 40, 40, 10, 40, 12, 12, 6, + 96, 48, 48, 18, 48, 20, 20, 6, 48, 24, 24, 10, 24, 12, 12, 70, + 0, 128, 128, 130, 128, 132, 132, 6, 128, 136, 136, 10, 136, 12, 12, 6, + 128, 144, 144, 18, 144, 20, 20, 6, 144, 24, 24, 10, 24, 12, 12, 6, + 128, 160, 160, 34, 160, 36, 36, 6, 160, 40, 40, 10, 40, 12, 12, 6, + 160, 48, 48, 18, 48, 20, 20, 6, 48, 24, 24, 10, 24, 12, 12, 134, + 128, 192, 192, 66, 192, 68, 68, 6, 192, 72, 72, 10, 72, 12, 12, 6, + 192, 80, 80, 18, 80, 20, 20, 6, 80, 24, 24, 10, 24, 12, 12, 134, + 192, 96, 96, 34, 96, 36, 36, 6, 96, 40, 40, 10, 40, 12, 12, 134, + 96, 48, 48, 18, 48, 20, 20, 134, 48, 24, 24, 138, 24, 140, 140, 198, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 7, + 16, 17, 18, 19, 20, 21, 22, 7, 24, 25, 26, 11, 28, 13, 14, 7, + 32, 33, 34, 35, 36, 37, 38, 7, 40, 41, 42, 11, 44, 13, 14, 7, + 48, 49, 50, 19, 52, 21, 22, 7, 56, 25, 26, 11, 28, 13, 14, 7, + 64, 65, 66, 67, 68, 69, 70, 7, 72, 73, 74, 11, 76, 13, 14, 7, + 80, 81, 82, 19, 84, 21, 22, 7, 88, 25, 26, 11, 28, 13, 14, 7, + 96, 97, 98, 35, 100, 37, 38, 7, 104, 41, 42, 11, 44, 13, 14, 7, + 112, 49, 50, 19, 52, 21, 22, 7, 56, 25, 26, 11, 28, 13, 14, 71, + 128, 129, 130, 131, 132, 133, 134, 7, 136, 137, 138, 11, 140, 13, 14, 7, + 144, 145, 146, 19, 148, 21, 22, 7, 152, 25, 26, 11, 28, 13, 14, 7, + 160, 161, 162, 35, 164, 37, 38, 7, 168, 41, 42, 11, 44, 13, 14, 7, + 176, 49, 50, 19, 52, 21, 22, 7, 56, 25, 26, 11, 28, 13, 14, 135, + 192, 193, 194, 67, 196, 69, 70, 7, 200, 73, 74, 11, 76, 13, 14, 7, + 208, 81, 82, 19, 84, 21, 22, 7, 88, 25, 26, 11, 28, 13, 14, 135, + 224, 97, 98, 35, 100, 37, 38, 7, 104, 41, 42, 11, 44, 13, 14, 135, + 112, 49, 50, 19, 52, 21, 22, 135, 56, 25, 26, 139, 28, 141, 142, 199, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, + 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 16, 0, 16, 16, 8, + 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 32, 0, 32, 32, 8, + 0, 0, 0, 32, 0, 32, 32, 16, 0, 32, 32, 16, 32, 16, 16, 8, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 8, + 0, 0, 0, 64, 0, 64, 64, 16, 0, 64, 64, 16, 64, 16, 16, 8, + 0, 0, 0, 64, 0, 64, 64, 32, 0, 64, 64, 32, 64, 32, 32, 8, + 0, 64, 64, 32, 64, 32, 32, 16, 64, 32, 32, 16, 32, 16, 16, 72, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 8, + 0, 0, 0, 128, 0, 128, 128, 16, 0, 128, 128, 16, 128, 16, 16, 8, + 0, 0, 0, 128, 0, 128, 128, 32, 0, 128, 128, 32, 128, 32, 32, 8, + 0, 128, 128, 32, 128, 32, 32, 16, 128, 32, 32, 16, 32, 16, 16, 136, + 0, 0, 0, 128, 0, 128, 128, 64, 0, 128, 128, 64, 128, 64, 64, 8, + 0, 128, 128, 64, 128, 64, 64, 16, 128, 64, 64, 16, 64, 16, 16, 136, + 0, 128, 128, 64, 128, 64, 64, 32, 128, 64, 64, 32, 64, 32, 32, 136, + 128, 64, 64, 32, 64, 32, 32, 144, 64, 32, 32, 144, 32, 144, 144, 200, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 9, + 16, 1, 2, 1, 4, 1, 2, 17, 8, 1, 2, 17, 4, 17, 18, 9, + 32, 1, 2, 1, 4, 1, 2, 33, 8, 1, 2, 33, 4, 33, 34, 9, + 16, 1, 2, 33, 4, 33, 34, 17, 8, 33, 34, 17, 36, 17, 18, 9, + 64, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 9, + 16, 1, 2, 65, 4, 65, 66, 17, 8, 65, 66, 17, 68, 17, 18, 9, + 32, 1, 2, 65, 4, 65, 66, 33, 8, 65, 66, 33, 68, 33, 34, 9, + 16, 65, 66, 33, 68, 33, 34, 17, 72, 33, 34, 17, 36, 17, 18, 73, + 128, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 9, + 16, 1, 2, 129, 4, 129, 130, 17, 8, 129, 130, 17, 132, 17, 18, 9, + 32, 1, 2, 129, 4, 129, 130, 33, 8, 129, 130, 33, 132, 33, 34, 9, + 16, 129, 130, 33, 132, 33, 34, 17, 136, 33, 34, 17, 36, 17, 18, 137, + 64, 1, 2, 129, 4, 129, 130, 65, 8, 129, 130, 65, 132, 65, 66, 9, + 16, 129, 130, 65, 132, 65, 66, 17, 136, 65, 66, 17, 68, 17, 18, 137, + 32, 129, 130, 65, 132, 65, 66, 33, 136, 65, 66, 33, 68, 33, 34, 137, + 144, 65, 66, 33, 68, 33, 34, 145, 72, 33, 34, 145, 36, 145, 146, 201, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 10, + 0, 16, 16, 2, 16, 4, 4, 18, 16, 8, 8, 18, 8, 20, 20, 10, + 0, 32, 32, 2, 32, 4, 4, 34, 32, 8, 8, 34, 8, 36, 36, 10, + 32, 16, 16, 34, 16, 36, 36, 18, 16, 40, 40, 18, 40, 20, 20, 10, + 0, 64, 64, 2, 64, 4, 4, 66, 64, 8, 8, 66, 8, 68, 68, 10, + 64, 16, 16, 66, 16, 68, 68, 18, 16, 72, 72, 18, 72, 20, 20, 10, + 64, 32, 32, 66, 32, 68, 68, 34, 32, 72, 72, 34, 72, 36, 36, 10, + 32, 80, 80, 34, 80, 36, 36, 18, 80, 40, 40, 18, 40, 20, 20, 74, + 0, 128, 128, 2, 128, 4, 4, 130, 128, 8, 8, 130, 8, 132, 132, 10, + 128, 16, 16, 130, 16, 132, 132, 18, 16, 136, 136, 18, 136, 20, 20, 10, + 128, 32, 32, 130, 32, 132, 132, 34, 32, 136, 136, 34, 136, 36, 36, 10, + 32, 144, 144, 34, 144, 36, 36, 18, 144, 40, 40, 18, 40, 20, 20, 138, + 128, 64, 64, 130, 64, 132, 132, 66, 64, 136, 136, 66, 136, 68, 68, 10, + 64, 144, 144, 66, 144, 68, 68, 18, 144, 72, 72, 18, 72, 20, 20, 138, + 64, 160, 160, 66, 160, 68, 68, 34, 160, 72, 72, 34, 72, 36, 36, 138, + 160, 80, 80, 34, 80, 36, 36, 146, 80, 40, 40, 146, 40, 148, 148, 202, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 11, + 16, 17, 18, 3, 20, 5, 6, 19, 24, 9, 10, 19, 12, 21, 22, 11, + 32, 33, 34, 3, 36, 5, 6, 35, 40, 9, 10, 35, 12, 37, 38, 11, + 48, 17, 18, 35, 20, 37, 38, 19, 24, 41, 42, 19, 44, 21, 22, 11, + 64, 65, 66, 3, 68, 5, 6, 67, 72, 9, 10, 67, 12, 69, 70, 11, + 80, 17, 18, 67, 20, 69, 70, 19, 24, 73, 74, 19, 76, 21, 22, 11, + 96, 33, 34, 67, 36, 69, 70, 35, 40, 73, 74, 35, 76, 37, 38, 11, + 48, 81, 82, 35, 84, 37, 38, 19, 88, 41, 42, 19, 44, 21, 22, 75, + 128, 129, 130, 3, 132, 5, 6, 131, 136, 9, 10, 131, 12, 133, 134, 11, + 144, 17, 18, 131, 20, 133, 134, 19, 24, 137, 138, 19, 140, 21, 22, 11, + 160, 33, 34, 131, 36, 133, 134, 35, 40, 137, 138, 35, 140, 37, 38, 11, + 48, 145, 146, 35, 148, 37, 38, 19, 152, 41, 42, 19, 44, 21, 22, 139, + 192, 65, 66, 131, 68, 133, 134, 67, 72, 137, 138, 67, 140, 69, 70, 11, + 80, 145, 146, 67, 148, 69, 70, 19, 152, 73, 74, 19, 76, 21, 22, 139, + 96, 161, 162, 67, 164, 69, 70, 35, 168, 73, 74, 35, 76, 37, 38, 139, + 176, 81, 82, 35, 84, 37, 38, 147, 88, 41, 42, 147, 44, 149, 150, 203, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 12, + 0, 0, 0, 16, 0, 16, 16, 20, 0, 16, 16, 24, 16, 24, 24, 12, + 0, 0, 0, 32, 0, 32, 32, 36, 0, 32, 32, 40, 32, 40, 40, 12, + 0, 32, 32, 48, 32, 48, 48, 20, 32, 48, 48, 24, 48, 24, 24, 12, + 0, 0, 0, 64, 0, 64, 64, 68, 0, 64, 64, 72, 64, 72, 72, 12, + 0, 64, 64, 80, 64, 80, 80, 20, 64, 80, 80, 24, 80, 24, 24, 12, + 0, 64, 64, 96, 64, 96, 96, 36, 64, 96, 96, 40, 96, 40, 40, 12, + 64, 96, 96, 48, 96, 48, 48, 20, 96, 48, 48, 24, 48, 24, 24, 76, + 0, 0, 0, 128, 0, 128, 128, 132, 0, 128, 128, 136, 128, 136, 136, 12, + 0, 128, 128, 144, 128, 144, 144, 20, 128, 144, 144, 24, 144, 24, 24, 12, + 0, 128, 128, 160, 128, 160, 160, 36, 128, 160, 160, 40, 160, 40, 40, 12, + 128, 160, 160, 48, 160, 48, 48, 20, 160, 48, 48, 24, 48, 24, 24, 140, + 0, 128, 128, 192, 128, 192, 192, 68, 128, 192, 192, 72, 192, 72, 72, 12, + 128, 192, 192, 80, 192, 80, 80, 20, 192, 80, 80, 24, 80, 24, 24, 140, + 128, 192, 192, 96, 192, 96, 96, 36, 192, 96, 96, 40, 96, 40, 40, 140, + 192, 96, 96, 48, 96, 48, 48, 148, 96, 48, 48, 152, 48, 152, 152, 204, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 13, + 16, 1, 2, 17, 4, 17, 18, 21, 8, 17, 18, 25, 20, 25, 26, 13, + 32, 1, 2, 33, 4, 33, 34, 37, 8, 33, 34, 41, 36, 41, 42, 13, + 16, 33, 34, 49, 36, 49, 50, 21, 40, 49, 50, 25, 52, 25, 26, 13, + 64, 1, 2, 65, 4, 65, 66, 69, 8, 65, 66, 73, 68, 73, 74, 13, + 16, 65, 66, 81, 68, 81, 82, 21, 72, 81, 82, 25, 84, 25, 26, 13, + 32, 65, 66, 97, 68, 97, 98, 37, 72, 97, 98, 41, 100, 41, 42, 13, + 80, 97, 98, 49, 100, 49, 50, 21, 104, 49, 50, 25, 52, 25, 26, 77, + 128, 1, 2, 129, 4, 129, 130, 133, 8, 129, 130, 137, 132, 137, 138, 13, + 16, 129, 130, 145, 132, 145, 146, 21, 136, 145, 146, 25, 148, 25, 26, 13, + 32, 129, 130, 161, 132, 161, 162, 37, 136, 161, 162, 41, 164, 41, 42, 13, + 144, 161, 162, 49, 164, 49, 50, 21, 168, 49, 50, 25, 52, 25, 26, 141, + 64, 129, 130, 193, 132, 193, 194, 69, 136, 193, 194, 73, 196, 73, 74, 13, + 144, 193, 194, 81, 196, 81, 82, 21, 200, 81, 82, 25, 84, 25, 26, 141, + 160, 193, 194, 97, 196, 97, 98, 37, 200, 97, 98, 41, 100, 41, 42, 141, + 208, 97, 98, 49, 100, 49, 50, 149, 104, 49, 50, 153, 52, 153, 154, 205, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 14, + 0, 16, 16, 18, 16, 20, 20, 22, 16, 24, 24, 26, 24, 28, 28, 14, + 0, 32, 32, 34, 32, 36, 36, 38, 32, 40, 40, 42, 40, 44, 44, 14, + 32, 48, 48, 50, 48, 52, 52, 22, 48, 56, 56, 26, 56, 28, 28, 14, + 0, 64, 64, 66, 64, 68, 68, 70, 64, 72, 72, 74, 72, 76, 76, 14, + 64, 80, 80, 82, 80, 84, 84, 22, 80, 88, 88, 26, 88, 28, 28, 14, + 64, 96, 96, 98, 96, 100, 100, 38, 96, 104, 104, 42, 104, 44, 44, 14, + 96, 112, 112, 50, 112, 52, 52, 22, 112, 56, 56, 26, 56, 28, 28, 78, + 0, 128, 128, 130, 128, 132, 132, 134, 128, 136, 136, 138, 136, 140, 140, 14, + 128, 144, 144, 146, 144, 148, 148, 22, 144, 152, 152, 26, 152, 28, 28, 14, + 128, 160, 160, 162, 160, 164, 164, 38, 160, 168, 168, 42, 168, 44, 44, 14, + 160, 176, 176, 50, 176, 52, 52, 22, 176, 56, 56, 26, 56, 28, 28, 142, + 128, 192, 192, 194, 192, 196, 196, 70, 192, 200, 200, 74, 200, 76, 76, 14, + 192, 208, 208, 82, 208, 84, 84, 22, 208, 88, 88, 26, 88, 28, 28, 142, + 192, 224, 224, 98, 224, 100, 100, 38, 224, 104, 104, 42, 104, 44, 44, 142, + 224, 112, 112, 50, 112, 52, 52, 150, 112, 56, 56, 154, 56, 156, 156, 206, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 15, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 15, + 48, 49, 50, 51, 52, 53, 54, 23, 56, 57, 58, 27, 60, 29, 30, 15, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 15, + 80, 81, 82, 83, 84, 85, 86, 23, 88, 89, 90, 27, 92, 29, 30, 15, + 96, 97, 98, 99, 100, 101, 102, 39, 104, 105, 106, 43, 108, 45, 46, 15, + 112, 113, 114, 51, 116, 53, 54, 23, 120, 57, 58, 27, 60, 29, 30, 79, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 15, + 144, 145, 146, 147, 148, 149, 150, 23, 152, 153, 154, 27, 156, 29, 30, 15, + 160, 161, 162, 163, 164, 165, 166, 39, 168, 169, 170, 43, 172, 45, 46, 15, + 176, 177, 178, 51, 180, 53, 54, 23, 184, 57, 58, 27, 60, 29, 30, 143, + 192, 193, 194, 195, 196, 197, 198, 71, 200, 201, 202, 75, 204, 77, 78, 15, + 208, 209, 210, 83, 212, 85, 86, 23, 216, 89, 90, 27, 92, 29, 30, 143, + 224, 225, 226, 99, 228, 101, 102, 39, 232, 105, 106, 43, 108, 45, 46, 143, + 240, 113, 114, 51, 116, 53, 54, 151, 120, 57, 58, 155, 60, 157, 158, 207, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, + 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 32, 0, 32, 32, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 16, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 32, + 0, 0, 0, 64, 0, 64, 64, 32, 0, 64, 64, 32, 64, 32, 32, 80, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 16, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 32, + 0, 0, 0, 128, 0, 128, 128, 32, 0, 128, 128, 32, 128, 32, 32, 144, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 64, + 0, 0, 0, 128, 0, 128, 128, 64, 0, 128, 128, 64, 128, 64, 64, 144, + 0, 0, 0, 128, 0, 128, 128, 64, 0, 128, 128, 64, 128, 64, 64, 160, + 0, 128, 128, 64, 128, 64, 64, 160, 128, 64, 64, 160, 64, 160, 160, 208, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 17, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 33, + 16, 1, 2, 1, 4, 1, 2, 33, 8, 1, 2, 33, 4, 33, 34, 17, + 64, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 65, + 16, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 17, + 32, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 33, + 16, 1, 2, 65, 4, 65, 66, 33, 8, 65, 66, 33, 68, 33, 34, 81, + 128, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 129, + 16, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 17, + 32, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 33, + 16, 1, 2, 129, 4, 129, 130, 33, 8, 129, 130, 33, 132, 33, 34, 145, + 64, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 65, + 16, 1, 2, 129, 4, 129, 130, 65, 8, 129, 130, 65, 132, 65, 66, 145, + 32, 1, 2, 129, 4, 129, 130, 65, 8, 129, 130, 65, 132, 65, 66, 161, + 16, 129, 130, 65, 132, 65, 66, 161, 136, 65, 66, 161, 68, 161, 162, 209, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 2, + 0, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 18, + 0, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 34, + 32, 16, 16, 2, 16, 4, 4, 34, 16, 8, 8, 34, 8, 36, 36, 18, + 0, 64, 64, 2, 64, 4, 4, 2, 64, 8, 8, 2, 8, 4, 4, 66, + 64, 16, 16, 2, 16, 4, 4, 66, 16, 8, 8, 66, 8, 68, 68, 18, + 64, 32, 32, 2, 32, 4, 4, 66, 32, 8, 8, 66, 8, 68, 68, 34, + 32, 16, 16, 66, 16, 68, 68, 34, 16, 72, 72, 34, 72, 36, 36, 82, + 0, 128, 128, 2, 128, 4, 4, 2, 128, 8, 8, 2, 8, 4, 4, 130, + 128, 16, 16, 2, 16, 4, 4, 130, 16, 8, 8, 130, 8, 132, 132, 18, + 128, 32, 32, 2, 32, 4, 4, 130, 32, 8, 8, 130, 8, 132, 132, 34, + 32, 16, 16, 130, 16, 132, 132, 34, 16, 136, 136, 34, 136, 36, 36, 146, + 128, 64, 64, 2, 64, 4, 4, 130, 64, 8, 8, 130, 8, 132, 132, 66, + 64, 16, 16, 130, 16, 132, 132, 66, 16, 136, 136, 66, 136, 68, 68, 146, + 64, 32, 32, 130, 32, 132, 132, 66, 32, 136, 136, 66, 136, 68, 68, 162, + 32, 144, 144, 66, 144, 68, 68, 162, 144, 72, 72, 162, 72, 164, 164, 210, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 3, + 16, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 19, + 32, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 35, + 48, 17, 18, 3, 20, 5, 6, 35, 24, 9, 10, 35, 12, 37, 38, 19, + 64, 65, 66, 3, 68, 5, 6, 3, 72, 9, 10, 3, 12, 5, 6, 67, + 80, 17, 18, 3, 20, 5, 6, 67, 24, 9, 10, 67, 12, 69, 70, 19, + 96, 33, 34, 3, 36, 5, 6, 67, 40, 9, 10, 67, 12, 69, 70, 35, + 48, 17, 18, 67, 20, 69, 70, 35, 24, 73, 74, 35, 76, 37, 38, 83, + 128, 129, 130, 3, 132, 5, 6, 3, 136, 9, 10, 3, 12, 5, 6, 131, + 144, 17, 18, 3, 20, 5, 6, 131, 24, 9, 10, 131, 12, 133, 134, 19, + 160, 33, 34, 3, 36, 5, 6, 131, 40, 9, 10, 131, 12, 133, 134, 35, + 48, 17, 18, 131, 20, 133, 134, 35, 24, 137, 138, 35, 140, 37, 38, 147, + 192, 65, 66, 3, 68, 5, 6, 131, 72, 9, 10, 131, 12, 133, 134, 67, + 80, 17, 18, 131, 20, 133, 134, 67, 24, 137, 138, 67, 140, 69, 70, 147, + 96, 33, 34, 131, 36, 133, 134, 67, 40, 137, 138, 67, 140, 69, 70, 163, + 48, 145, 146, 67, 148, 69, 70, 163, 152, 73, 74, 163, 76, 165, 166, 211, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 4, + 0, 0, 0, 16, 0, 16, 16, 4, 0, 16, 16, 8, 16, 8, 8, 20, + 0, 0, 0, 32, 0, 32, 32, 4, 0, 32, 32, 8, 32, 8, 8, 36, + 0, 32, 32, 16, 32, 16, 16, 36, 32, 16, 16, 40, 16, 40, 40, 20, + 0, 0, 0, 64, 0, 64, 64, 4, 0, 64, 64, 8, 64, 8, 8, 68, + 0, 64, 64, 16, 64, 16, 16, 68, 64, 16, 16, 72, 16, 72, 72, 20, + 0, 64, 64, 32, 64, 32, 32, 68, 64, 32, 32, 72, 32, 72, 72, 36, + 64, 32, 32, 80, 32, 80, 80, 36, 32, 80, 80, 40, 80, 40, 40, 84, + 0, 0, 0, 128, 0, 128, 128, 4, 0, 128, 128, 8, 128, 8, 8, 132, + 0, 128, 128, 16, 128, 16, 16, 132, 128, 16, 16, 136, 16, 136, 136, 20, + 0, 128, 128, 32, 128, 32, 32, 132, 128, 32, 32, 136, 32, 136, 136, 36, + 128, 32, 32, 144, 32, 144, 144, 36, 32, 144, 144, 40, 144, 40, 40, 148, + 0, 128, 128, 64, 128, 64, 64, 132, 128, 64, 64, 136, 64, 136, 136, 68, + 128, 64, 64, 144, 64, 144, 144, 68, 64, 144, 144, 72, 144, 72, 72, 148, + 128, 64, 64, 160, 64, 160, 160, 68, 64, 160, 160, 72, 160, 72, 72, 164, + 64, 160, 160, 80, 160, 80, 80, 164, 160, 80, 80, 168, 80, 168, 168, 212, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 5, + 16, 1, 2, 17, 4, 17, 18, 5, 8, 17, 18, 9, 20, 9, 10, 21, + 32, 1, 2, 33, 4, 33, 34, 5, 8, 33, 34, 9, 36, 9, 10, 37, + 16, 33, 34, 17, 36, 17, 18, 37, 40, 17, 18, 41, 20, 41, 42, 21, + 64, 1, 2, 65, 4, 65, 66, 5, 8, 65, 66, 9, 68, 9, 10, 69, + 16, 65, 66, 17, 68, 17, 18, 69, 72, 17, 18, 73, 20, 73, 74, 21, + 32, 65, 66, 33, 68, 33, 34, 69, 72, 33, 34, 73, 36, 73, 74, 37, + 80, 33, 34, 81, 36, 81, 82, 37, 40, 81, 82, 41, 84, 41, 42, 85, + 128, 1, 2, 129, 4, 129, 130, 5, 8, 129, 130, 9, 132, 9, 10, 133, + 16, 129, 130, 17, 132, 17, 18, 133, 136, 17, 18, 137, 20, 137, 138, 21, + 32, 129, 130, 33, 132, 33, 34, 133, 136, 33, 34, 137, 36, 137, 138, 37, + 144, 33, 34, 145, 36, 145, 146, 37, 40, 145, 146, 41, 148, 41, 42, 149, + 64, 129, 130, 65, 132, 65, 66, 133, 136, 65, 66, 137, 68, 137, 138, 69, + 144, 65, 66, 145, 68, 145, 146, 69, 72, 145, 146, 73, 148, 73, 74, 149, + 160, 65, 66, 161, 68, 161, 162, 69, 72, 161, 162, 73, 164, 73, 74, 165, + 80, 161, 162, 81, 164, 81, 82, 165, 168, 81, 82, 169, 84, 169, 170, 213, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 6, + 0, 16, 16, 18, 16, 20, 20, 6, 16, 24, 24, 10, 24, 12, 12, 22, + 0, 32, 32, 34, 32, 36, 36, 6, 32, 40, 40, 10, 40, 12, 12, 38, + 32, 48, 48, 18, 48, 20, 20, 38, 48, 24, 24, 42, 24, 44, 44, 22, + 0, 64, 64, 66, 64, 68, 68, 6, 64, 72, 72, 10, 72, 12, 12, 70, + 64, 80, 80, 18, 80, 20, 20, 70, 80, 24, 24, 74, 24, 76, 76, 22, + 64, 96, 96, 34, 96, 36, 36, 70, 96, 40, 40, 74, 40, 76, 76, 38, + 96, 48, 48, 82, 48, 84, 84, 38, 48, 88, 88, 42, 88, 44, 44, 86, + 0, 128, 128, 130, 128, 132, 132, 6, 128, 136, 136, 10, 136, 12, 12, 134, + 128, 144, 144, 18, 144, 20, 20, 134, 144, 24, 24, 138, 24, 140, 140, 22, + 128, 160, 160, 34, 160, 36, 36, 134, 160, 40, 40, 138, 40, 140, 140, 38, + 160, 48, 48, 146, 48, 148, 148, 38, 48, 152, 152, 42, 152, 44, 44, 150, + 128, 192, 192, 66, 192, 68, 68, 134, 192, 72, 72, 138, 72, 140, 140, 70, + 192, 80, 80, 146, 80, 148, 148, 70, 80, 152, 152, 74, 152, 76, 76, 150, + 192, 96, 96, 162, 96, 164, 164, 70, 96, 168, 168, 74, 168, 76, 76, 166, + 96, 176, 176, 82, 176, 84, 84, 166, 176, 88, 88, 170, 88, 172, 172, 214, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 7, + 16, 17, 18, 19, 20, 21, 22, 7, 24, 25, 26, 11, 28, 13, 14, 23, + 32, 33, 34, 35, 36, 37, 38, 7, 40, 41, 42, 11, 44, 13, 14, 39, + 48, 49, 50, 19, 52, 21, 22, 39, 56, 25, 26, 43, 28, 45, 46, 23, + 64, 65, 66, 67, 68, 69, 70, 7, 72, 73, 74, 11, 76, 13, 14, 71, + 80, 81, 82, 19, 84, 21, 22, 71, 88, 25, 26, 75, 28, 77, 78, 23, + 96, 97, 98, 35, 100, 37, 38, 71, 104, 41, 42, 75, 44, 77, 78, 39, + 112, 49, 50, 83, 52, 85, 86, 39, 56, 89, 90, 43, 92, 45, 46, 87, + 128, 129, 130, 131, 132, 133, 134, 7, 136, 137, 138, 11, 140, 13, 14, 135, + 144, 145, 146, 19, 148, 21, 22, 135, 152, 25, 26, 139, 28, 141, 142, 23, + 160, 161, 162, 35, 164, 37, 38, 135, 168, 41, 42, 139, 44, 141, 142, 39, + 176, 49, 50, 147, 52, 149, 150, 39, 56, 153, 154, 43, 156, 45, 46, 151, + 192, 193, 194, 67, 196, 69, 70, 135, 200, 73, 74, 139, 76, 141, 142, 71, + 208, 81, 82, 147, 84, 149, 150, 71, 88, 153, 154, 75, 156, 77, 78, 151, + 224, 97, 98, 163, 100, 165, 166, 71, 104, 169, 170, 75, 172, 77, 78, 167, + 112, 177, 178, 83, 180, 85, 86, 167, 184, 89, 90, 171, 92, 173, 174, 215, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, + 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 16, 0, 16, 16, 24, + 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 32, 0, 32, 32, 40, + 0, 0, 0, 32, 0, 32, 32, 48, 0, 32, 32, 48, 32, 48, 48, 24, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 72, + 0, 0, 0, 64, 0, 64, 64, 80, 0, 64, 64, 80, 64, 80, 80, 24, + 0, 0, 0, 64, 0, 64, 64, 96, 0, 64, 64, 96, 64, 96, 96, 40, + 0, 64, 64, 96, 64, 96, 96, 48, 64, 96, 96, 48, 96, 48, 48, 88, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 136, + 0, 0, 0, 128, 0, 128, 128, 144, 0, 128, 128, 144, 128, 144, 144, 24, + 0, 0, 0, 128, 0, 128, 128, 160, 0, 128, 128, 160, 128, 160, 160, 40, + 0, 128, 128, 160, 128, 160, 160, 48, 128, 160, 160, 48, 160, 48, 48, 152, + 0, 0, 0, 128, 0, 128, 128, 192, 0, 128, 128, 192, 128, 192, 192, 72, + 0, 128, 128, 192, 128, 192, 192, 80, 128, 192, 192, 80, 192, 80, 80, 152, + 0, 128, 128, 192, 128, 192, 192, 96, 128, 192, 192, 96, 192, 96, 96, 168, + 128, 192, 192, 96, 192, 96, 96, 176, 192, 96, 96, 176, 96, 176, 176, 216, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 9, + 16, 1, 2, 1, 4, 1, 2, 17, 8, 1, 2, 17, 4, 17, 18, 25, + 32, 1, 2, 1, 4, 1, 2, 33, 8, 1, 2, 33, 4, 33, 34, 41, + 16, 1, 2, 33, 4, 33, 34, 49, 8, 33, 34, 49, 36, 49, 50, 25, + 64, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 73, + 16, 1, 2, 65, 4, 65, 66, 81, 8, 65, 66, 81, 68, 81, 82, 25, + 32, 1, 2, 65, 4, 65, 66, 97, 8, 65, 66, 97, 68, 97, 98, 41, + 16, 65, 66, 97, 68, 97, 98, 49, 72, 97, 98, 49, 100, 49, 50, 89, + 128, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 137, + 16, 1, 2, 129, 4, 129, 130, 145, 8, 129, 130, 145, 132, 145, 146, 25, + 32, 1, 2, 129, 4, 129, 130, 161, 8, 129, 130, 161, 132, 161, 162, 41, + 16, 129, 130, 161, 132, 161, 162, 49, 136, 161, 162, 49, 164, 49, 50, 153, + 64, 1, 2, 129, 4, 129, 130, 193, 8, 129, 130, 193, 132, 193, 194, 73, + 16, 129, 130, 193, 132, 193, 194, 81, 136, 193, 194, 81, 196, 81, 82, 153, + 32, 129, 130, 193, 132, 193, 194, 97, 136, 193, 194, 97, 196, 97, 98, 169, + 144, 193, 194, 97, 196, 97, 98, 177, 200, 97, 98, 177, 100, 177, 178, 217, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 10, + 0, 16, 16, 2, 16, 4, 4, 18, 16, 8, 8, 18, 8, 20, 20, 26, + 0, 32, 32, 2, 32, 4, 4, 34, 32, 8, 8, 34, 8, 36, 36, 42, + 32, 16, 16, 34, 16, 36, 36, 50, 16, 40, 40, 50, 40, 52, 52, 26, + 0, 64, 64, 2, 64, 4, 4, 66, 64, 8, 8, 66, 8, 68, 68, 74, + 64, 16, 16, 66, 16, 68, 68, 82, 16, 72, 72, 82, 72, 84, 84, 26, + 64, 32, 32, 66, 32, 68, 68, 98, 32, 72, 72, 98, 72, 100, 100, 42, + 32, 80, 80, 98, 80, 100, 100, 50, 80, 104, 104, 50, 104, 52, 52, 90, + 0, 128, 128, 2, 128, 4, 4, 130, 128, 8, 8, 130, 8, 132, 132, 138, + 128, 16, 16, 130, 16, 132, 132, 146, 16, 136, 136, 146, 136, 148, 148, 26, + 128, 32, 32, 130, 32, 132, 132, 162, 32, 136, 136, 162, 136, 164, 164, 42, + 32, 144, 144, 162, 144, 164, 164, 50, 144, 168, 168, 50, 168, 52, 52, 154, + 128, 64, 64, 130, 64, 132, 132, 194, 64, 136, 136, 194, 136, 196, 196, 74, + 64, 144, 144, 194, 144, 196, 196, 82, 144, 200, 200, 82, 200, 84, 84, 154, + 64, 160, 160, 194, 160, 196, 196, 98, 160, 200, 200, 98, 200, 100, 100, 170, + 160, 208, 208, 98, 208, 100, 100, 178, 208, 104, 104, 178, 104, 180, 180, 218, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 11, + 16, 17, 18, 3, 20, 5, 6, 19, 24, 9, 10, 19, 12, 21, 22, 27, + 32, 33, 34, 3, 36, 5, 6, 35, 40, 9, 10, 35, 12, 37, 38, 43, + 48, 17, 18, 35, 20, 37, 38, 51, 24, 41, 42, 51, 44, 53, 54, 27, + 64, 65, 66, 3, 68, 5, 6, 67, 72, 9, 10, 67, 12, 69, 70, 75, + 80, 17, 18, 67, 20, 69, 70, 83, 24, 73, 74, 83, 76, 85, 86, 27, + 96, 33, 34, 67, 36, 69, 70, 99, 40, 73, 74, 99, 76, 101, 102, 43, + 48, 81, 82, 99, 84, 101, 102, 51, 88, 105, 106, 51, 108, 53, 54, 91, + 128, 129, 130, 3, 132, 5, 6, 131, 136, 9, 10, 131, 12, 133, 134, 139, + 144, 17, 18, 131, 20, 133, 134, 147, 24, 137, 138, 147, 140, 149, 150, 27, + 160, 33, 34, 131, 36, 133, 134, 163, 40, 137, 138, 163, 140, 165, 166, 43, + 48, 145, 146, 163, 148, 165, 166, 51, 152, 169, 170, 51, 172, 53, 54, 155, + 192, 65, 66, 131, 68, 133, 134, 195, 72, 137, 138, 195, 140, 197, 198, 75, + 80, 145, 146, 195, 148, 197, 198, 83, 152, 201, 202, 83, 204, 85, 86, 155, + 96, 161, 162, 195, 164, 197, 198, 99, 168, 201, 202, 99, 204, 101, 102, 171, + 176, 209, 210, 99, 212, 101, 102, 179, 216, 105, 106, 179, 108, 181, 182, 219, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 12, + 0, 0, 0, 16, 0, 16, 16, 20, 0, 16, 16, 24, 16, 24, 24, 28, + 0, 0, 0, 32, 0, 32, 32, 36, 0, 32, 32, 40, 32, 40, 40, 44, + 0, 32, 32, 48, 32, 48, 48, 52, 32, 48, 48, 56, 48, 56, 56, 28, + 0, 0, 0, 64, 0, 64, 64, 68, 0, 64, 64, 72, 64, 72, 72, 76, + 0, 64, 64, 80, 64, 80, 80, 84, 64, 80, 80, 88, 80, 88, 88, 28, + 0, 64, 64, 96, 64, 96, 96, 100, 64, 96, 96, 104, 96, 104, 104, 44, + 64, 96, 96, 112, 96, 112, 112, 52, 96, 112, 112, 56, 112, 56, 56, 92, + 0, 0, 0, 128, 0, 128, 128, 132, 0, 128, 128, 136, 128, 136, 136, 140, + 0, 128, 128, 144, 128, 144, 144, 148, 128, 144, 144, 152, 144, 152, 152, 28, + 0, 128, 128, 160, 128, 160, 160, 164, 128, 160, 160, 168, 160, 168, 168, 44, + 128, 160, 160, 176, 160, 176, 176, 52, 160, 176, 176, 56, 176, 56, 56, 156, + 0, 128, 128, 192, 128, 192, 192, 196, 128, 192, 192, 200, 192, 200, 200, 76, + 128, 192, 192, 208, 192, 208, 208, 84, 192, 208, 208, 88, 208, 88, 88, 156, + 128, 192, 192, 224, 192, 224, 224, 100, 192, 224, 224, 104, 224, 104, 104, 172, + 192, 224, 224, 112, 224, 112, 112, 180, 224, 112, 112, 184, 112, 184, 184, 220, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 13, + 16, 1, 2, 17, 4, 17, 18, 21, 8, 17, 18, 25, 20, 25, 26, 29, + 32, 1, 2, 33, 4, 33, 34, 37, 8, 33, 34, 41, 36, 41, 42, 45, + 16, 33, 34, 49, 36, 49, 50, 53, 40, 49, 50, 57, 52, 57, 58, 29, + 64, 1, 2, 65, 4, 65, 66, 69, 8, 65, 66, 73, 68, 73, 74, 77, + 16, 65, 66, 81, 68, 81, 82, 85, 72, 81, 82, 89, 84, 89, 90, 29, + 32, 65, 66, 97, 68, 97, 98, 101, 72, 97, 98, 105, 100, 105, 106, 45, + 80, 97, 98, 113, 100, 113, 114, 53, 104, 113, 114, 57, 116, 57, 58, 93, + 128, 1, 2, 129, 4, 129, 130, 133, 8, 129, 130, 137, 132, 137, 138, 141, + 16, 129, 130, 145, 132, 145, 146, 149, 136, 145, 146, 153, 148, 153, 154, 29, + 32, 129, 130, 161, 132, 161, 162, 165, 136, 161, 162, 169, 164, 169, 170, 45, + 144, 161, 162, 177, 164, 177, 178, 53, 168, 177, 178, 57, 180, 57, 58, 157, + 64, 129, 130, 193, 132, 193, 194, 197, 136, 193, 194, 201, 196, 201, 202, 77, + 144, 193, 194, 209, 196, 209, 210, 85, 200, 209, 210, 89, 212, 89, 90, 157, + 160, 193, 194, 225, 196, 225, 226, 101, 200, 225, 226, 105, 228, 105, 106, 173, + 208, 225, 226, 113, 228, 113, 114, 181, 232, 113, 114, 185, 116, 185, 186, 221, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 14, + 0, 16, 16, 18, 16, 20, 20, 22, 16, 24, 24, 26, 24, 28, 28, 30, + 0, 32, 32, 34, 32, 36, 36, 38, 32, 40, 40, 42, 40, 44, 44, 46, + 32, 48, 48, 50, 48, 52, 52, 54, 48, 56, 56, 58, 56, 60, 60, 30, + 0, 64, 64, 66, 64, 68, 68, 70, 64, 72, 72, 74, 72, 76, 76, 78, + 64, 80, 80, 82, 80, 84, 84, 86, 80, 88, 88, 90, 88, 92, 92, 30, + 64, 96, 96, 98, 96, 100, 100, 102, 96, 104, 104, 106, 104, 108, 108, 46, + 96, 112, 112, 114, 112, 116, 116, 54, 112, 120, 120, 58, 120, 60, 60, 94, + 0, 128, 128, 130, 128, 132, 132, 134, 128, 136, 136, 138, 136, 140, 140, 142, + 128, 144, 144, 146, 144, 148, 148, 150, 144, 152, 152, 154, 152, 156, 156, 30, + 128, 160, 160, 162, 160, 164, 164, 166, 160, 168, 168, 170, 168, 172, 172, 46, + 160, 176, 176, 178, 176, 180, 180, 54, 176, 184, 184, 58, 184, 60, 60, 158, + 128, 192, 192, 194, 192, 196, 196, 198, 192, 200, 200, 202, 200, 204, 204, 78, + 192, 208, 208, 210, 208, 212, 212, 86, 208, 216, 216, 90, 216, 92, 92, 158, + 192, 224, 224, 226, 224, 228, 228, 102, 224, 232, 232, 106, 232, 108, 108, 174, + 224, 240, 240, 114, 240, 116, 116, 182, 240, 120, 120, 186, 120, 188, 188, 222, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 31, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 31, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 47, + 112, 113, 114, 115, 116, 117, 118, 55, 120, 121, 122, 59, 124, 61, 62, 95, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 31, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 47, + 176, 177, 178, 179, 180, 181, 182, 55, 184, 185, 186, 59, 188, 61, 62, 159, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 79, + 208, 209, 210, 211, 212, 213, 214, 87, 216, 217, 218, 91, 220, 93, 94, 159, + 224, 225, 226, 227, 228, 229, 230, 103, 232, 233, 234, 107, 236, 109, 110, 175, + 240, 241, 242, 115, 244, 117, 118, 183, 248, 121, 122, 187, 124, 189, 190, 223, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 96, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 160, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 192, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 192, + 0, 0, 0, 128, 0, 128, 128, 192, 0, 128, 128, 192, 128, 192, 192, 224, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 33, + 64, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 65, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 65, + 16, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 97, + 128, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 129, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 129, + 16, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 161, + 64, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 129, + 16, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 193, + 32, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 193, + 16, 1, 2, 129, 4, 129, 130, 193, 8, 129, 130, 193, 132, 193, 194, 225, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 2, + 0, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 2, + 0, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 2, + 32, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 34, + 0, 64, 64, 2, 64, 4, 4, 2, 64, 8, 8, 2, 8, 4, 4, 2, + 64, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 66, + 64, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 66, + 32, 16, 16, 2, 16, 4, 4, 66, 16, 8, 8, 66, 8, 68, 68, 98, + 0, 128, 128, 2, 128, 4, 4, 2, 128, 8, 8, 2, 8, 4, 4, 2, + 128, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 130, + 128, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 130, + 32, 16, 16, 2, 16, 4, 4, 130, 16, 8, 8, 130, 8, 132, 132, 162, + 128, 64, 64, 2, 64, 4, 4, 2, 64, 8, 8, 2, 8, 4, 4, 130, + 64, 16, 16, 2, 16, 4, 4, 130, 16, 8, 8, 130, 8, 132, 132, 194, + 64, 32, 32, 2, 32, 4, 4, 130, 32, 8, 8, 130, 8, 132, 132, 194, + 32, 16, 16, 130, 16, 132, 132, 194, 16, 136, 136, 194, 136, 196, 196, 226, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 3, + 16, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 3, + 32, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 3, + 48, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 35, + 64, 65, 66, 3, 68, 5, 6, 3, 72, 9, 10, 3, 12, 5, 6, 3, + 80, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 67, + 96, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 67, + 48, 17, 18, 3, 20, 5, 6, 67, 24, 9, 10, 67, 12, 69, 70, 99, + 128, 129, 130, 3, 132, 5, 6, 3, 136, 9, 10, 3, 12, 5, 6, 3, + 144, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 131, + 160, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 131, + 48, 17, 18, 3, 20, 5, 6, 131, 24, 9, 10, 131, 12, 133, 134, 163, + 192, 65, 66, 3, 68, 5, 6, 3, 72, 9, 10, 3, 12, 5, 6, 131, + 80, 17, 18, 3, 20, 5, 6, 131, 24, 9, 10, 131, 12, 133, 134, 195, + 96, 33, 34, 3, 36, 5, 6, 131, 40, 9, 10, 131, 12, 133, 134, 195, + 48, 17, 18, 131, 20, 133, 134, 195, 24, 137, 138, 195, 140, 197, 198, 227, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 4, + 0, 0, 0, 16, 0, 16, 16, 4, 0, 16, 16, 8, 16, 8, 8, 4, + 0, 0, 0, 32, 0, 32, 32, 4, 0, 32, 32, 8, 32, 8, 8, 4, + 0, 32, 32, 16, 32, 16, 16, 4, 32, 16, 16, 8, 16, 8, 8, 36, + 0, 0, 0, 64, 0, 64, 64, 4, 0, 64, 64, 8, 64, 8, 8, 4, + 0, 64, 64, 16, 64, 16, 16, 4, 64, 16, 16, 8, 16, 8, 8, 68, + 0, 64, 64, 32, 64, 32, 32, 4, 64, 32, 32, 8, 32, 8, 8, 68, + 64, 32, 32, 16, 32, 16, 16, 68, 32, 16, 16, 72, 16, 72, 72, 100, + 0, 0, 0, 128, 0, 128, 128, 4, 0, 128, 128, 8, 128, 8, 8, 4, + 0, 128, 128, 16, 128, 16, 16, 4, 128, 16, 16, 8, 16, 8, 8, 132, + 0, 128, 128, 32, 128, 32, 32, 4, 128, 32, 32, 8, 32, 8, 8, 132, + 128, 32, 32, 16, 32, 16, 16, 132, 32, 16, 16, 136, 16, 136, 136, 164, + 0, 128, 128, 64, 128, 64, 64, 4, 128, 64, 64, 8, 64, 8, 8, 132, + 128, 64, 64, 16, 64, 16, 16, 132, 64, 16, 16, 136, 16, 136, 136, 196, + 128, 64, 64, 32, 64, 32, 32, 132, 64, 32, 32, 136, 32, 136, 136, 196, + 64, 32, 32, 144, 32, 144, 144, 196, 32, 144, 144, 200, 144, 200, 200, 228, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 5, + 16, 1, 2, 17, 4, 17, 18, 5, 8, 17, 18, 9, 20, 9, 10, 5, + 32, 1, 2, 33, 4, 33, 34, 5, 8, 33, 34, 9, 36, 9, 10, 5, + 16, 33, 34, 17, 36, 17, 18, 5, 40, 17, 18, 9, 20, 9, 10, 37, + 64, 1, 2, 65, 4, 65, 66, 5, 8, 65, 66, 9, 68, 9, 10, 5, + 16, 65, 66, 17, 68, 17, 18, 5, 72, 17, 18, 9, 20, 9, 10, 69, + 32, 65, 66, 33, 68, 33, 34, 5, 72, 33, 34, 9, 36, 9, 10, 69, + 80, 33, 34, 17, 36, 17, 18, 69, 40, 17, 18, 73, 20, 73, 74, 101, + 128, 1, 2, 129, 4, 129, 130, 5, 8, 129, 130, 9, 132, 9, 10, 5, + 16, 129, 130, 17, 132, 17, 18, 5, 136, 17, 18, 9, 20, 9, 10, 133, + 32, 129, 130, 33, 132, 33, 34, 5, 136, 33, 34, 9, 36, 9, 10, 133, + 144, 33, 34, 17, 36, 17, 18, 133, 40, 17, 18, 137, 20, 137, 138, 165, + 64, 129, 130, 65, 132, 65, 66, 5, 136, 65, 66, 9, 68, 9, 10, 133, + 144, 65, 66, 17, 68, 17, 18, 133, 72, 17, 18, 137, 20, 137, 138, 197, + 160, 65, 66, 33, 68, 33, 34, 133, 72, 33, 34, 137, 36, 137, 138, 197, + 80, 33, 34, 145, 36, 145, 146, 197, 40, 145, 146, 201, 148, 201, 202, 229, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 6, + 0, 16, 16, 18, 16, 20, 20, 6, 16, 24, 24, 10, 24, 12, 12, 6, + 0, 32, 32, 34, 32, 36, 36, 6, 32, 40, 40, 10, 40, 12, 12, 6, + 32, 48, 48, 18, 48, 20, 20, 6, 48, 24, 24, 10, 24, 12, 12, 38, + 0, 64, 64, 66, 64, 68, 68, 6, 64, 72, 72, 10, 72, 12, 12, 6, + 64, 80, 80, 18, 80, 20, 20, 6, 80, 24, 24, 10, 24, 12, 12, 70, + 64, 96, 96, 34, 96, 36, 36, 6, 96, 40, 40, 10, 40, 12, 12, 70, + 96, 48, 48, 18, 48, 20, 20, 70, 48, 24, 24, 74, 24, 76, 76, 102, + 0, 128, 128, 130, 128, 132, 132, 6, 128, 136, 136, 10, 136, 12, 12, 6, + 128, 144, 144, 18, 144, 20, 20, 6, 144, 24, 24, 10, 24, 12, 12, 134, + 128, 160, 160, 34, 160, 36, 36, 6, 160, 40, 40, 10, 40, 12, 12, 134, + 160, 48, 48, 18, 48, 20, 20, 134, 48, 24, 24, 138, 24, 140, 140, 166, + 128, 192, 192, 66, 192, 68, 68, 6, 192, 72, 72, 10, 72, 12, 12, 134, + 192, 80, 80, 18, 80, 20, 20, 134, 80, 24, 24, 138, 24, 140, 140, 198, + 192, 96, 96, 34, 96, 36, 36, 134, 96, 40, 40, 138, 40, 140, 140, 198, + 96, 48, 48, 146, 48, 148, 148, 198, 48, 152, 152, 202, 152, 204, 204, 230, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 7, + 16, 17, 18, 19, 20, 21, 22, 7, 24, 25, 26, 11, 28, 13, 14, 7, + 32, 33, 34, 35, 36, 37, 38, 7, 40, 41, 42, 11, 44, 13, 14, 7, + 48, 49, 50, 19, 52, 21, 22, 7, 56, 25, 26, 11, 28, 13, 14, 39, + 64, 65, 66, 67, 68, 69, 70, 7, 72, 73, 74, 11, 76, 13, 14, 7, + 80, 81, 82, 19, 84, 21, 22, 7, 88, 25, 26, 11, 28, 13, 14, 71, + 96, 97, 98, 35, 100, 37, 38, 7, 104, 41, 42, 11, 44, 13, 14, 71, + 112, 49, 50, 19, 52, 21, 22, 71, 56, 25, 26, 75, 28, 77, 78, 103, + 128, 129, 130, 131, 132, 133, 134, 7, 136, 137, 138, 11, 140, 13, 14, 7, + 144, 145, 146, 19, 148, 21, 22, 7, 152, 25, 26, 11, 28, 13, 14, 135, + 160, 161, 162, 35, 164, 37, 38, 7, 168, 41, 42, 11, 44, 13, 14, 135, + 176, 49, 50, 19, 52, 21, 22, 135, 56, 25, 26, 139, 28, 141, 142, 167, + 192, 193, 194, 67, 196, 69, 70, 7, 200, 73, 74, 11, 76, 13, 14, 135, + 208, 81, 82, 19, 84, 21, 22, 135, 88, 25, 26, 139, 28, 141, 142, 199, + 224, 97, 98, 35, 100, 37, 38, 135, 104, 41, 42, 139, 44, 141, 142, 199, + 112, 49, 50, 147, 52, 149, 150, 199, 56, 153, 154, 203, 156, 205, 206, 231, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, + 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 16, 0, 16, 16, 8, + 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 32, 0, 32, 32, 8, + 0, 0, 0, 32, 0, 32, 32, 16, 0, 32, 32, 16, 32, 16, 16, 40, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 8, + 0, 0, 0, 64, 0, 64, 64, 16, 0, 64, 64, 16, 64, 16, 16, 72, + 0, 0, 0, 64, 0, 64, 64, 32, 0, 64, 64, 32, 64, 32, 32, 72, + 0, 64, 64, 32, 64, 32, 32, 80, 64, 32, 32, 80, 32, 80, 80, 104, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 8, + 0, 0, 0, 128, 0, 128, 128, 16, 0, 128, 128, 16, 128, 16, 16, 136, + 0, 0, 0, 128, 0, 128, 128, 32, 0, 128, 128, 32, 128, 32, 32, 136, + 0, 128, 128, 32, 128, 32, 32, 144, 128, 32, 32, 144, 32, 144, 144, 168, + 0, 0, 0, 128, 0, 128, 128, 64, 0, 128, 128, 64, 128, 64, 64, 136, + 0, 128, 128, 64, 128, 64, 64, 144, 128, 64, 64, 144, 64, 144, 144, 200, + 0, 128, 128, 64, 128, 64, 64, 160, 128, 64, 64, 160, 64, 160, 160, 200, + 128, 64, 64, 160, 64, 160, 160, 208, 64, 160, 160, 208, 160, 208, 208, 232, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 9, + 16, 1, 2, 1, 4, 1, 2, 17, 8, 1, 2, 17, 4, 17, 18, 9, + 32, 1, 2, 1, 4, 1, 2, 33, 8, 1, 2, 33, 4, 33, 34, 9, + 16, 1, 2, 33, 4, 33, 34, 17, 8, 33, 34, 17, 36, 17, 18, 41, + 64, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 9, + 16, 1, 2, 65, 4, 65, 66, 17, 8, 65, 66, 17, 68, 17, 18, 73, + 32, 1, 2, 65, 4, 65, 66, 33, 8, 65, 66, 33, 68, 33, 34, 73, + 16, 65, 66, 33, 68, 33, 34, 81, 72, 33, 34, 81, 36, 81, 82, 105, + 128, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 9, + 16, 1, 2, 129, 4, 129, 130, 17, 8, 129, 130, 17, 132, 17, 18, 137, + 32, 1, 2, 129, 4, 129, 130, 33, 8, 129, 130, 33, 132, 33, 34, 137, + 16, 129, 130, 33, 132, 33, 34, 145, 136, 33, 34, 145, 36, 145, 146, 169, + 64, 1, 2, 129, 4, 129, 130, 65, 8, 129, 130, 65, 132, 65, 66, 137, + 16, 129, 130, 65, 132, 65, 66, 145, 136, 65, 66, 145, 68, 145, 146, 201, + 32, 129, 130, 65, 132, 65, 66, 161, 136, 65, 66, 161, 68, 161, 162, 201, + 144, 65, 66, 161, 68, 161, 162, 209, 72, 161, 162, 209, 164, 209, 210, 233, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 10, + 0, 16, 16, 2, 16, 4, 4, 18, 16, 8, 8, 18, 8, 20, 20, 10, + 0, 32, 32, 2, 32, 4, 4, 34, 32, 8, 8, 34, 8, 36, 36, 10, + 32, 16, 16, 34, 16, 36, 36, 18, 16, 40, 40, 18, 40, 20, 20, 42, + 0, 64, 64, 2, 64, 4, 4, 66, 64, 8, 8, 66, 8, 68, 68, 10, + 64, 16, 16, 66, 16, 68, 68, 18, 16, 72, 72, 18, 72, 20, 20, 74, + 64, 32, 32, 66, 32, 68, 68, 34, 32, 72, 72, 34, 72, 36, 36, 74, + 32, 80, 80, 34, 80, 36, 36, 82, 80, 40, 40, 82, 40, 84, 84, 106, + 0, 128, 128, 2, 128, 4, 4, 130, 128, 8, 8, 130, 8, 132, 132, 10, + 128, 16, 16, 130, 16, 132, 132, 18, 16, 136, 136, 18, 136, 20, 20, 138, + 128, 32, 32, 130, 32, 132, 132, 34, 32, 136, 136, 34, 136, 36, 36, 138, + 32, 144, 144, 34, 144, 36, 36, 146, 144, 40, 40, 146, 40, 148, 148, 170, + 128, 64, 64, 130, 64, 132, 132, 66, 64, 136, 136, 66, 136, 68, 68, 138, + 64, 144, 144, 66, 144, 68, 68, 146, 144, 72, 72, 146, 72, 148, 148, 202, + 64, 160, 160, 66, 160, 68, 68, 162, 160, 72, 72, 162, 72, 164, 164, 202, + 160, 80, 80, 162, 80, 164, 164, 210, 80, 168, 168, 210, 168, 212, 212, 234, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 11, + 16, 17, 18, 3, 20, 5, 6, 19, 24, 9, 10, 19, 12, 21, 22, 11, + 32, 33, 34, 3, 36, 5, 6, 35, 40, 9, 10, 35, 12, 37, 38, 11, + 48, 17, 18, 35, 20, 37, 38, 19, 24, 41, 42, 19, 44, 21, 22, 43, + 64, 65, 66, 3, 68, 5, 6, 67, 72, 9, 10, 67, 12, 69, 70, 11, + 80, 17, 18, 67, 20, 69, 70, 19, 24, 73, 74, 19, 76, 21, 22, 75, + 96, 33, 34, 67, 36, 69, 70, 35, 40, 73, 74, 35, 76, 37, 38, 75, + 48, 81, 82, 35, 84, 37, 38, 83, 88, 41, 42, 83, 44, 85, 86, 107, + 128, 129, 130, 3, 132, 5, 6, 131, 136, 9, 10, 131, 12, 133, 134, 11, + 144, 17, 18, 131, 20, 133, 134, 19, 24, 137, 138, 19, 140, 21, 22, 139, + 160, 33, 34, 131, 36, 133, 134, 35, 40, 137, 138, 35, 140, 37, 38, 139, + 48, 145, 146, 35, 148, 37, 38, 147, 152, 41, 42, 147, 44, 149, 150, 171, + 192, 65, 66, 131, 68, 133, 134, 67, 72, 137, 138, 67, 140, 69, 70, 139, + 80, 145, 146, 67, 148, 69, 70, 147, 152, 73, 74, 147, 76, 149, 150, 203, + 96, 161, 162, 67, 164, 69, 70, 163, 168, 73, 74, 163, 76, 165, 166, 203, + 176, 81, 82, 163, 84, 165, 166, 211, 88, 169, 170, 211, 172, 213, 214, 235, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 12, + 0, 0, 0, 16, 0, 16, 16, 20, 0, 16, 16, 24, 16, 24, 24, 12, + 0, 0, 0, 32, 0, 32, 32, 36, 0, 32, 32, 40, 32, 40, 40, 12, + 0, 32, 32, 48, 32, 48, 48, 20, 32, 48, 48, 24, 48, 24, 24, 44, + 0, 0, 0, 64, 0, 64, 64, 68, 0, 64, 64, 72, 64, 72, 72, 12, + 0, 64, 64, 80, 64, 80, 80, 20, 64, 80, 80, 24, 80, 24, 24, 76, + 0, 64, 64, 96, 64, 96, 96, 36, 64, 96, 96, 40, 96, 40, 40, 76, + 64, 96, 96, 48, 96, 48, 48, 84, 96, 48, 48, 88, 48, 88, 88, 108, + 0, 0, 0, 128, 0, 128, 128, 132, 0, 128, 128, 136, 128, 136, 136, 12, + 0, 128, 128, 144, 128, 144, 144, 20, 128, 144, 144, 24, 144, 24, 24, 140, + 0, 128, 128, 160, 128, 160, 160, 36, 128, 160, 160, 40, 160, 40, 40, 140, + 128, 160, 160, 48, 160, 48, 48, 148, 160, 48, 48, 152, 48, 152, 152, 172, + 0, 128, 128, 192, 128, 192, 192, 68, 128, 192, 192, 72, 192, 72, 72, 140, + 128, 192, 192, 80, 192, 80, 80, 148, 192, 80, 80, 152, 80, 152, 152, 204, + 128, 192, 192, 96, 192, 96, 96, 164, 192, 96, 96, 168, 96, 168, 168, 204, + 192, 96, 96, 176, 96, 176, 176, 212, 96, 176, 176, 216, 176, 216, 216, 236, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 13, + 16, 1, 2, 17, 4, 17, 18, 21, 8, 17, 18, 25, 20, 25, 26, 13, + 32, 1, 2, 33, 4, 33, 34, 37, 8, 33, 34, 41, 36, 41, 42, 13, + 16, 33, 34, 49, 36, 49, 50, 21, 40, 49, 50, 25, 52, 25, 26, 45, + 64, 1, 2, 65, 4, 65, 66, 69, 8, 65, 66, 73, 68, 73, 74, 13, + 16, 65, 66, 81, 68, 81, 82, 21, 72, 81, 82, 25, 84, 25, 26, 77, + 32, 65, 66, 97, 68, 97, 98, 37, 72, 97, 98, 41, 100, 41, 42, 77, + 80, 97, 98, 49, 100, 49, 50, 85, 104, 49, 50, 89, 52, 89, 90, 109, + 128, 1, 2, 129, 4, 129, 130, 133, 8, 129, 130, 137, 132, 137, 138, 13, + 16, 129, 130, 145, 132, 145, 146, 21, 136, 145, 146, 25, 148, 25, 26, 141, + 32, 129, 130, 161, 132, 161, 162, 37, 136, 161, 162, 41, 164, 41, 42, 141, + 144, 161, 162, 49, 164, 49, 50, 149, 168, 49, 50, 153, 52, 153, 154, 173, + 64, 129, 130, 193, 132, 193, 194, 69, 136, 193, 194, 73, 196, 73, 74, 141, + 144, 193, 194, 81, 196, 81, 82, 149, 200, 81, 82, 153, 84, 153, 154, 205, + 160, 193, 194, 97, 196, 97, 98, 165, 200, 97, 98, 169, 100, 169, 170, 205, + 208, 97, 98, 177, 100, 177, 178, 213, 104, 177, 178, 217, 180, 217, 218, 237, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 14, + 0, 16, 16, 18, 16, 20, 20, 22, 16, 24, 24, 26, 24, 28, 28, 14, + 0, 32, 32, 34, 32, 36, 36, 38, 32, 40, 40, 42, 40, 44, 44, 14, + 32, 48, 48, 50, 48, 52, 52, 22, 48, 56, 56, 26, 56, 28, 28, 46, + 0, 64, 64, 66, 64, 68, 68, 70, 64, 72, 72, 74, 72, 76, 76, 14, + 64, 80, 80, 82, 80, 84, 84, 22, 80, 88, 88, 26, 88, 28, 28, 78, + 64, 96, 96, 98, 96, 100, 100, 38, 96, 104, 104, 42, 104, 44, 44, 78, + 96, 112, 112, 50, 112, 52, 52, 86, 112, 56, 56, 90, 56, 92, 92, 110, + 0, 128, 128, 130, 128, 132, 132, 134, 128, 136, 136, 138, 136, 140, 140, 14, + 128, 144, 144, 146, 144, 148, 148, 22, 144, 152, 152, 26, 152, 28, 28, 142, + 128, 160, 160, 162, 160, 164, 164, 38, 160, 168, 168, 42, 168, 44, 44, 142, + 160, 176, 176, 50, 176, 52, 52, 150, 176, 56, 56, 154, 56, 156, 156, 174, + 128, 192, 192, 194, 192, 196, 196, 70, 192, 200, 200, 74, 200, 76, 76, 142, + 192, 208, 208, 82, 208, 84, 84, 150, 208, 88, 88, 154, 88, 156, 156, 206, + 192, 224, 224, 98, 224, 100, 100, 166, 224, 104, 104, 170, 104, 172, 172, 206, + 224, 112, 112, 178, 112, 180, 180, 214, 112, 184, 184, 218, 184, 220, 220, 238, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 15, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 15, + 48, 49, 50, 51, 52, 53, 54, 23, 56, 57, 58, 27, 60, 29, 30, 47, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 15, + 80, 81, 82, 83, 84, 85, 86, 23, 88, 89, 90, 27, 92, 29, 30, 79, + 96, 97, 98, 99, 100, 101, 102, 39, 104, 105, 106, 43, 108, 45, 46, 79, + 112, 113, 114, 51, 116, 53, 54, 87, 120, 57, 58, 91, 60, 93, 94, 111, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 15, + 144, 145, 146, 147, 148, 149, 150, 23, 152, 153, 154, 27, 156, 29, 30, 143, + 160, 161, 162, 163, 164, 165, 166, 39, 168, 169, 170, 43, 172, 45, 46, 143, + 176, 177, 178, 51, 180, 53, 54, 151, 184, 57, 58, 155, 60, 157, 158, 175, + 192, 193, 194, 195, 196, 197, 198, 71, 200, 201, 202, 75, 204, 77, 78, 143, + 208, 209, 210, 83, 212, 85, 86, 151, 216, 89, 90, 155, 92, 157, 158, 207, + 224, 225, 226, 99, 228, 101, 102, 167, 232, 105, 106, 171, 108, 173, 174, 207, + 240, 113, 114, 179, 116, 181, 182, 215, 120, 185, 186, 219, 188, 221, 222, 239, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, + 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 32, 0, 32, 32, 48, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 80, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 96, + 0, 0, 0, 64, 0, 64, 64, 96, 0, 64, 64, 96, 64, 96, 96, 112, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 144, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 160, + 0, 0, 0, 128, 0, 128, 128, 160, 0, 128, 128, 160, 128, 160, 160, 176, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 192, + 0, 0, 0, 128, 0, 128, 128, 192, 0, 128, 128, 192, 128, 192, 192, 208, + 0, 0, 0, 128, 0, 128, 128, 192, 0, 128, 128, 192, 128, 192, 192, 224, + 0, 128, 128, 192, 128, 192, 192, 224, 128, 192, 192, 224, 192, 224, 224, 240, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, + 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 17, + 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 33, + 16, 1, 2, 1, 4, 1, 2, 33, 8, 1, 2, 33, 4, 33, 34, 49, + 64, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 65, + 16, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 81, + 32, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 97, + 16, 1, 2, 65, 4, 65, 66, 97, 8, 65, 66, 97, 68, 97, 98, 113, + 128, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 129, + 16, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 145, + 32, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 161, + 16, 1, 2, 129, 4, 129, 130, 161, 8, 129, 130, 161, 132, 161, 162, 177, + 64, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 193, + 16, 1, 2, 129, 4, 129, 130, 193, 8, 129, 130, 193, 132, 193, 194, 209, + 32, 1, 2, 129, 4, 129, 130, 193, 8, 129, 130, 193, 132, 193, 194, 225, + 16, 129, 130, 193, 132, 193, 194, 225, 136, 193, 194, 225, 196, 225, 226, 241, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 2, + 0, 16, 16, 2, 16, 4, 4, 2, 16, 8, 8, 2, 8, 4, 4, 18, + 0, 32, 32, 2, 32, 4, 4, 2, 32, 8, 8, 2, 8, 4, 4, 34, + 32, 16, 16, 2, 16, 4, 4, 34, 16, 8, 8, 34, 8, 36, 36, 50, + 0, 64, 64, 2, 64, 4, 4, 2, 64, 8, 8, 2, 8, 4, 4, 66, + 64, 16, 16, 2, 16, 4, 4, 66, 16, 8, 8, 66, 8, 68, 68, 82, + 64, 32, 32, 2, 32, 4, 4, 66, 32, 8, 8, 66, 8, 68, 68, 98, + 32, 16, 16, 66, 16, 68, 68, 98, 16, 72, 72, 98, 72, 100, 100, 114, + 0, 128, 128, 2, 128, 4, 4, 2, 128, 8, 8, 2, 8, 4, 4, 130, + 128, 16, 16, 2, 16, 4, 4, 130, 16, 8, 8, 130, 8, 132, 132, 146, + 128, 32, 32, 2, 32, 4, 4, 130, 32, 8, 8, 130, 8, 132, 132, 162, + 32, 16, 16, 130, 16, 132, 132, 162, 16, 136, 136, 162, 136, 164, 164, 178, + 128, 64, 64, 2, 64, 4, 4, 130, 64, 8, 8, 130, 8, 132, 132, 194, + 64, 16, 16, 130, 16, 132, 132, 194, 16, 136, 136, 194, 136, 196, 196, 210, + 64, 32, 32, 130, 32, 132, 132, 194, 32, 136, 136, 194, 136, 196, 196, 226, + 32, 144, 144, 194, 144, 196, 196, 226, 144, 200, 200, 226, 200, 228, 228, 242, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 3, + 16, 17, 18, 3, 20, 5, 6, 3, 24, 9, 10, 3, 12, 5, 6, 19, + 32, 33, 34, 3, 36, 5, 6, 3, 40, 9, 10, 3, 12, 5, 6, 35, + 48, 17, 18, 3, 20, 5, 6, 35, 24, 9, 10, 35, 12, 37, 38, 51, + 64, 65, 66, 3, 68, 5, 6, 3, 72, 9, 10, 3, 12, 5, 6, 67, + 80, 17, 18, 3, 20, 5, 6, 67, 24, 9, 10, 67, 12, 69, 70, 83, + 96, 33, 34, 3, 36, 5, 6, 67, 40, 9, 10, 67, 12, 69, 70, 99, + 48, 17, 18, 67, 20, 69, 70, 99, 24, 73, 74, 99, 76, 101, 102, 115, + 128, 129, 130, 3, 132, 5, 6, 3, 136, 9, 10, 3, 12, 5, 6, 131, + 144, 17, 18, 3, 20, 5, 6, 131, 24, 9, 10, 131, 12, 133, 134, 147, + 160, 33, 34, 3, 36, 5, 6, 131, 40, 9, 10, 131, 12, 133, 134, 163, + 48, 17, 18, 131, 20, 133, 134, 163, 24, 137, 138, 163, 140, 165, 166, 179, + 192, 65, 66, 3, 68, 5, 6, 131, 72, 9, 10, 131, 12, 133, 134, 195, + 80, 17, 18, 131, 20, 133, 134, 195, 24, 137, 138, 195, 140, 197, 198, 211, + 96, 33, 34, 131, 36, 133, 134, 195, 40, 137, 138, 195, 140, 197, 198, 227, + 48, 145, 146, 195, 148, 197, 198, 227, 152, 201, 202, 227, 204, 229, 230, 243, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 4, + 0, 0, 0, 16, 0, 16, 16, 4, 0, 16, 16, 8, 16, 8, 8, 20, + 0, 0, 0, 32, 0, 32, 32, 4, 0, 32, 32, 8, 32, 8, 8, 36, + 0, 32, 32, 16, 32, 16, 16, 36, 32, 16, 16, 40, 16, 40, 40, 52, + 0, 0, 0, 64, 0, 64, 64, 4, 0, 64, 64, 8, 64, 8, 8, 68, + 0, 64, 64, 16, 64, 16, 16, 68, 64, 16, 16, 72, 16, 72, 72, 84, + 0, 64, 64, 32, 64, 32, 32, 68, 64, 32, 32, 72, 32, 72, 72, 100, + 64, 32, 32, 80, 32, 80, 80, 100, 32, 80, 80, 104, 80, 104, 104, 116, + 0, 0, 0, 128, 0, 128, 128, 4, 0, 128, 128, 8, 128, 8, 8, 132, + 0, 128, 128, 16, 128, 16, 16, 132, 128, 16, 16, 136, 16, 136, 136, 148, + 0, 128, 128, 32, 128, 32, 32, 132, 128, 32, 32, 136, 32, 136, 136, 164, + 128, 32, 32, 144, 32, 144, 144, 164, 32, 144, 144, 168, 144, 168, 168, 180, + 0, 128, 128, 64, 128, 64, 64, 132, 128, 64, 64, 136, 64, 136, 136, 196, + 128, 64, 64, 144, 64, 144, 144, 196, 64, 144, 144, 200, 144, 200, 200, 212, + 128, 64, 64, 160, 64, 160, 160, 196, 64, 160, 160, 200, 160, 200, 200, 228, + 64, 160, 160, 208, 160, 208, 208, 228, 160, 208, 208, 232, 208, 232, 232, 244, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 5, + 16, 1, 2, 17, 4, 17, 18, 5, 8, 17, 18, 9, 20, 9, 10, 21, + 32, 1, 2, 33, 4, 33, 34, 5, 8, 33, 34, 9, 36, 9, 10, 37, + 16, 33, 34, 17, 36, 17, 18, 37, 40, 17, 18, 41, 20, 41, 42, 53, + 64, 1, 2, 65, 4, 65, 66, 5, 8, 65, 66, 9, 68, 9, 10, 69, + 16, 65, 66, 17, 68, 17, 18, 69, 72, 17, 18, 73, 20, 73, 74, 85, + 32, 65, 66, 33, 68, 33, 34, 69, 72, 33, 34, 73, 36, 73, 74, 101, + 80, 33, 34, 81, 36, 81, 82, 101, 40, 81, 82, 105, 84, 105, 106, 117, + 128, 1, 2, 129, 4, 129, 130, 5, 8, 129, 130, 9, 132, 9, 10, 133, + 16, 129, 130, 17, 132, 17, 18, 133, 136, 17, 18, 137, 20, 137, 138, 149, + 32, 129, 130, 33, 132, 33, 34, 133, 136, 33, 34, 137, 36, 137, 138, 165, + 144, 33, 34, 145, 36, 145, 146, 165, 40, 145, 146, 169, 148, 169, 170, 181, + 64, 129, 130, 65, 132, 65, 66, 133, 136, 65, 66, 137, 68, 137, 138, 197, + 144, 65, 66, 145, 68, 145, 146, 197, 72, 145, 146, 201, 148, 201, 202, 213, + 160, 65, 66, 161, 68, 161, 162, 197, 72, 161, 162, 201, 164, 201, 202, 229, + 80, 161, 162, 209, 164, 209, 210, 229, 168, 209, 210, 233, 212, 233, 234, 245, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 6, + 0, 16, 16, 18, 16, 20, 20, 6, 16, 24, 24, 10, 24, 12, 12, 22, + 0, 32, 32, 34, 32, 36, 36, 6, 32, 40, 40, 10, 40, 12, 12, 38, + 32, 48, 48, 18, 48, 20, 20, 38, 48, 24, 24, 42, 24, 44, 44, 54, + 0, 64, 64, 66, 64, 68, 68, 6, 64, 72, 72, 10, 72, 12, 12, 70, + 64, 80, 80, 18, 80, 20, 20, 70, 80, 24, 24, 74, 24, 76, 76, 86, + 64, 96, 96, 34, 96, 36, 36, 70, 96, 40, 40, 74, 40, 76, 76, 102, + 96, 48, 48, 82, 48, 84, 84, 102, 48, 88, 88, 106, 88, 108, 108, 118, + 0, 128, 128, 130, 128, 132, 132, 6, 128, 136, 136, 10, 136, 12, 12, 134, + 128, 144, 144, 18, 144, 20, 20, 134, 144, 24, 24, 138, 24, 140, 140, 150, + 128, 160, 160, 34, 160, 36, 36, 134, 160, 40, 40, 138, 40, 140, 140, 166, + 160, 48, 48, 146, 48, 148, 148, 166, 48, 152, 152, 170, 152, 172, 172, 182, + 128, 192, 192, 66, 192, 68, 68, 134, 192, 72, 72, 138, 72, 140, 140, 198, + 192, 80, 80, 146, 80, 148, 148, 198, 80, 152, 152, 202, 152, 204, 204, 214, + 192, 96, 96, 162, 96, 164, 164, 198, 96, 168, 168, 202, 168, 204, 204, 230, + 96, 176, 176, 210, 176, 212, 212, 230, 176, 216, 216, 234, 216, 236, 236, 246, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 7, + 16, 17, 18, 19, 20, 21, 22, 7, 24, 25, 26, 11, 28, 13, 14, 23, + 32, 33, 34, 35, 36, 37, 38, 7, 40, 41, 42, 11, 44, 13, 14, 39, + 48, 49, 50, 19, 52, 21, 22, 39, 56, 25, 26, 43, 28, 45, 46, 55, + 64, 65, 66, 67, 68, 69, 70, 7, 72, 73, 74, 11, 76, 13, 14, 71, + 80, 81, 82, 19, 84, 21, 22, 71, 88, 25, 26, 75, 28, 77, 78, 87, + 96, 97, 98, 35, 100, 37, 38, 71, 104, 41, 42, 75, 44, 77, 78, 103, + 112, 49, 50, 83, 52, 85, 86, 103, 56, 89, 90, 107, 92, 109, 110, 119, + 128, 129, 130, 131, 132, 133, 134, 7, 136, 137, 138, 11, 140, 13, 14, 135, + 144, 145, 146, 19, 148, 21, 22, 135, 152, 25, 26, 139, 28, 141, 142, 151, + 160, 161, 162, 35, 164, 37, 38, 135, 168, 41, 42, 139, 44, 141, 142, 167, + 176, 49, 50, 147, 52, 149, 150, 167, 56, 153, 154, 171, 156, 173, 174, 183, + 192, 193, 194, 67, 196, 69, 70, 135, 200, 73, 74, 139, 76, 141, 142, 199, + 208, 81, 82, 147, 84, 149, 150, 199, 88, 153, 154, 203, 156, 205, 206, 215, + 224, 97, 98, 163, 100, 165, 166, 199, 104, 169, 170, 203, 172, 205, 206, 231, + 112, 177, 178, 211, 180, 213, 214, 231, 184, 217, 218, 235, 220, 237, 238, 247, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, + 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 16, 0, 16, 16, 24, + 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 32, 0, 32, 32, 40, + 0, 0, 0, 32, 0, 32, 32, 48, 0, 32, 32, 48, 32, 48, 48, 56, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 64, 64, 72, + 0, 0, 0, 64, 0, 64, 64, 80, 0, 64, 64, 80, 64, 80, 80, 88, + 0, 0, 0, 64, 0, 64, 64, 96, 0, 64, 64, 96, 64, 96, 96, 104, + 0, 64, 64, 96, 64, 96, 96, 112, 64, 96, 96, 112, 96, 112, 112, 120, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 136, + 0, 0, 0, 128, 0, 128, 128, 144, 0, 128, 128, 144, 128, 144, 144, 152, + 0, 0, 0, 128, 0, 128, 128, 160, 0, 128, 128, 160, 128, 160, 160, 168, + 0, 128, 128, 160, 128, 160, 160, 176, 128, 160, 160, 176, 160, 176, 176, 184, + 0, 0, 0, 128, 0, 128, 128, 192, 0, 128, 128, 192, 128, 192, 192, 200, + 0, 128, 128, 192, 128, 192, 192, 208, 128, 192, 192, 208, 192, 208, 208, 216, + 0, 128, 128, 192, 128, 192, 192, 224, 128, 192, 192, 224, 192, 224, 224, 232, + 128, 192, 192, 224, 192, 224, 224, 240, 192, 224, 224, 240, 224, 240, 240, 248, + }, { + 0, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 9, + 16, 1, 2, 1, 4, 1, 2, 17, 8, 1, 2, 17, 4, 17, 18, 25, + 32, 1, 2, 1, 4, 1, 2, 33, 8, 1, 2, 33, 4, 33, 34, 41, + 16, 1, 2, 33, 4, 33, 34, 49, 8, 33, 34, 49, 36, 49, 50, 57, + 64, 1, 2, 1, 4, 1, 2, 65, 8, 1, 2, 65, 4, 65, 66, 73, + 16, 1, 2, 65, 4, 65, 66, 81, 8, 65, 66, 81, 68, 81, 82, 89, + 32, 1, 2, 65, 4, 65, 66, 97, 8, 65, 66, 97, 68, 97, 98, 105, + 16, 65, 66, 97, 68, 97, 98, 113, 72, 97, 98, 113, 100, 113, 114, 121, + 128, 1, 2, 1, 4, 1, 2, 129, 8, 1, 2, 129, 4, 129, 130, 137, + 16, 1, 2, 129, 4, 129, 130, 145, 8, 129, 130, 145, 132, 145, 146, 153, + 32, 1, 2, 129, 4, 129, 130, 161, 8, 129, 130, 161, 132, 161, 162, 169, + 16, 129, 130, 161, 132, 161, 162, 177, 136, 161, 162, 177, 164, 177, 178, 185, + 64, 1, 2, 129, 4, 129, 130, 193, 8, 129, 130, 193, 132, 193, 194, 201, + 16, 129, 130, 193, 132, 193, 194, 209, 136, 193, 194, 209, 196, 209, 210, 217, + 32, 129, 130, 193, 132, 193, 194, 225, 136, 193, 194, 225, 196, 225, 226, 233, + 144, 193, 194, 225, 196, 225, 226, 241, 200, 225, 226, 241, 228, 241, 242, 249, + }, { + 0, 0, 0, 2, 0, 4, 4, 2, 0, 8, 8, 2, 8, 4, 4, 10, + 0, 16, 16, 2, 16, 4, 4, 18, 16, 8, 8, 18, 8, 20, 20, 26, + 0, 32, 32, 2, 32, 4, 4, 34, 32, 8, 8, 34, 8, 36, 36, 42, + 32, 16, 16, 34, 16, 36, 36, 50, 16, 40, 40, 50, 40, 52, 52, 58, + 0, 64, 64, 2, 64, 4, 4, 66, 64, 8, 8, 66, 8, 68, 68, 74, + 64, 16, 16, 66, 16, 68, 68, 82, 16, 72, 72, 82, 72, 84, 84, 90, + 64, 32, 32, 66, 32, 68, 68, 98, 32, 72, 72, 98, 72, 100, 100, 106, + 32, 80, 80, 98, 80, 100, 100, 114, 80, 104, 104, 114, 104, 116, 116, 122, + 0, 128, 128, 2, 128, 4, 4, 130, 128, 8, 8, 130, 8, 132, 132, 138, + 128, 16, 16, 130, 16, 132, 132, 146, 16, 136, 136, 146, 136, 148, 148, 154, + 128, 32, 32, 130, 32, 132, 132, 162, 32, 136, 136, 162, 136, 164, 164, 170, + 32, 144, 144, 162, 144, 164, 164, 178, 144, 168, 168, 178, 168, 180, 180, 186, + 128, 64, 64, 130, 64, 132, 132, 194, 64, 136, 136, 194, 136, 196, 196, 202, + 64, 144, 144, 194, 144, 196, 196, 210, 144, 200, 200, 210, 200, 212, 212, 218, + 64, 160, 160, 194, 160, 196, 196, 226, 160, 200, 200, 226, 200, 228, 228, 234, + 160, 208, 208, 226, 208, 228, 228, 242, 208, 232, 232, 242, 232, 244, 244, 250, + }, { + 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 10, 3, 12, 5, 6, 11, + 16, 17, 18, 3, 20, 5, 6, 19, 24, 9, 10, 19, 12, 21, 22, 27, + 32, 33, 34, 3, 36, 5, 6, 35, 40, 9, 10, 35, 12, 37, 38, 43, + 48, 17, 18, 35, 20, 37, 38, 51, 24, 41, 42, 51, 44, 53, 54, 59, + 64, 65, 66, 3, 68, 5, 6, 67, 72, 9, 10, 67, 12, 69, 70, 75, + 80, 17, 18, 67, 20, 69, 70, 83, 24, 73, 74, 83, 76, 85, 86, 91, + 96, 33, 34, 67, 36, 69, 70, 99, 40, 73, 74, 99, 76, 101, 102, 107, + 48, 81, 82, 99, 84, 101, 102, 115, 88, 105, 106, 115, 108, 117, 118, 123, + 128, 129, 130, 3, 132, 5, 6, 131, 136, 9, 10, 131, 12, 133, 134, 139, + 144, 17, 18, 131, 20, 133, 134, 147, 24, 137, 138, 147, 140, 149, 150, 155, + 160, 33, 34, 131, 36, 133, 134, 163, 40, 137, 138, 163, 140, 165, 166, 171, + 48, 145, 146, 163, 148, 165, 166, 179, 152, 169, 170, 179, 172, 181, 182, 187, + 192, 65, 66, 131, 68, 133, 134, 195, 72, 137, 138, 195, 140, 197, 198, 203, + 80, 145, 146, 195, 148, 197, 198, 211, 152, 201, 202, 211, 204, 213, 214, 219, + 96, 161, 162, 195, 164, 197, 198, 227, 168, 201, 202, 227, 204, 229, 230, 235, + 176, 209, 210, 227, 212, 229, 230, 243, 216, 233, 234, 243, 236, 245, 246, 251, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 8, 8, 12, + 0, 0, 0, 16, 0, 16, 16, 20, 0, 16, 16, 24, 16, 24, 24, 28, + 0, 0, 0, 32, 0, 32, 32, 36, 0, 32, 32, 40, 32, 40, 40, 44, + 0, 32, 32, 48, 32, 48, 48, 52, 32, 48, 48, 56, 48, 56, 56, 60, + 0, 0, 0, 64, 0, 64, 64, 68, 0, 64, 64, 72, 64, 72, 72, 76, + 0, 64, 64, 80, 64, 80, 80, 84, 64, 80, 80, 88, 80, 88, 88, 92, + 0, 64, 64, 96, 64, 96, 96, 100, 64, 96, 96, 104, 96, 104, 104, 108, + 64, 96, 96, 112, 96, 112, 112, 116, 96, 112, 112, 120, 112, 120, 120, 124, + 0, 0, 0, 128, 0, 128, 128, 132, 0, 128, 128, 136, 128, 136, 136, 140, + 0, 128, 128, 144, 128, 144, 144, 148, 128, 144, 144, 152, 144, 152, 152, 156, + 0, 128, 128, 160, 128, 160, 160, 164, 128, 160, 160, 168, 160, 168, 168, 172, + 128, 160, 160, 176, 160, 176, 176, 180, 160, 176, 176, 184, 176, 184, 184, 188, + 0, 128, 128, 192, 128, 192, 192, 196, 128, 192, 192, 200, 192, 200, 200, 204, + 128, 192, 192, 208, 192, 208, 208, 212, 192, 208, 208, 216, 208, 216, 216, 220, + 128, 192, 192, 224, 192, 224, 224, 228, 192, 224, 224, 232, 224, 232, 232, 236, + 192, 224, 224, 240, 224, 240, 240, 244, 224, 240, 240, 248, 240, 248, 248, 252, + }, { + 0, 1, 2, 1, 4, 1, 2, 5, 8, 1, 2, 9, 4, 9, 10, 13, + 16, 1, 2, 17, 4, 17, 18, 21, 8, 17, 18, 25, 20, 25, 26, 29, + 32, 1, 2, 33, 4, 33, 34, 37, 8, 33, 34, 41, 36, 41, 42, 45, + 16, 33, 34, 49, 36, 49, 50, 53, 40, 49, 50, 57, 52, 57, 58, 61, + 64, 1, 2, 65, 4, 65, 66, 69, 8, 65, 66, 73, 68, 73, 74, 77, + 16, 65, 66, 81, 68, 81, 82, 85, 72, 81, 82, 89, 84, 89, 90, 93, + 32, 65, 66, 97, 68, 97, 98, 101, 72, 97, 98, 105, 100, 105, 106, 109, + 80, 97, 98, 113, 100, 113, 114, 117, 104, 113, 114, 121, 116, 121, 122, 125, + 128, 1, 2, 129, 4, 129, 130, 133, 8, 129, 130, 137, 132, 137, 138, 141, + 16, 129, 130, 145, 132, 145, 146, 149, 136, 145, 146, 153, 148, 153, 154, 157, + 32, 129, 130, 161, 132, 161, 162, 165, 136, 161, 162, 169, 164, 169, 170, 173, + 144, 161, 162, 177, 164, 177, 178, 181, 168, 177, 178, 185, 180, 185, 186, 189, + 64, 129, 130, 193, 132, 193, 194, 197, 136, 193, 194, 201, 196, 201, 202, 205, + 144, 193, 194, 209, 196, 209, 210, 213, 200, 209, 210, 217, 212, 217, 218, 221, + 160, 193, 194, 225, 196, 225, 226, 229, 200, 225, 226, 233, 228, 233, 234, 237, + 208, 225, 226, 241, 228, 241, 242, 245, 232, 241, 242, 249, 244, 249, 250, 253, + }, { + 0, 0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 14, + 0, 16, 16, 18, 16, 20, 20, 22, 16, 24, 24, 26, 24, 28, 28, 30, + 0, 32, 32, 34, 32, 36, 36, 38, 32, 40, 40, 42, 40, 44, 44, 46, + 32, 48, 48, 50, 48, 52, 52, 54, 48, 56, 56, 58, 56, 60, 60, 62, + 0, 64, 64, 66, 64, 68, 68, 70, 64, 72, 72, 74, 72, 76, 76, 78, + 64, 80, 80, 82, 80, 84, 84, 86, 80, 88, 88, 90, 88, 92, 92, 94, + 64, 96, 96, 98, 96, 100, 100, 102, 96, 104, 104, 106, 104, 108, 108, 110, + 96, 112, 112, 114, 112, 116, 116, 118, 112, 120, 120, 122, 120, 124, 124, 126, + 0, 128, 128, 130, 128, 132, 132, 134, 128, 136, 136, 138, 136, 140, 140, 142, + 128, 144, 144, 146, 144, 148, 148, 150, 144, 152, 152, 154, 152, 156, 156, 158, + 128, 160, 160, 162, 160, 164, 164, 166, 160, 168, 168, 170, 168, 172, 172, 174, + 160, 176, 176, 178, 176, 180, 180, 182, 176, 184, 184, 186, 184, 188, 188, 190, + 128, 192, 192, 194, 192, 196, 196, 198, 192, 200, 200, 202, 200, 204, 204, 206, + 192, 208, 208, 210, 208, 212, 212, 214, 208, 216, 216, 218, 216, 220, 220, 222, + 192, 224, 224, 226, 224, 228, 228, 230, 224, 232, 232, 234, 232, 236, 236, 238, + 224, 240, 240, 242, 240, 244, 244, 246, 240, 248, 248, 250, 248, 252, 252, 254, + }, { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + }, +} + +// popLUT contains pre-computed population counts +var popLUT = [256]uint8{ + 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, + 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, + 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, + 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, + 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, + 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8, +} diff --git a/vendor/github.com/bits-and-blooms/bitset/popcnt.go b/vendor/github.com/bits-and-blooms/bitset/popcnt.go index 76577a838..93492390b 100644 --- a/vendor/github.com/bits-and-blooms/bitset/popcnt.go +++ b/vendor/github.com/bits-and-blooms/bitset/popcnt.go @@ -1,53 +1,59 @@ package bitset -// bit population count, take from -// https://code.google.com/p/go/issues/detail?id=4988#c11 -// credit: https://code.google.com/u/arnehormann/ -func popcount(x uint64) (n uint64) { - x -= (x >> 1) & 0x5555555555555555 - x = (x>>2)&0x3333333333333333 + x&0x3333333333333333 - x += x >> 4 - x &= 0x0f0f0f0f0f0f0f0f - x *= 0x0101010101010101 - return x >> 56 -} +import "math/bits" -func popcntSliceGo(s []uint64) uint64 { - cnt := uint64(0) +func popcntSlice(s []uint64) uint64 { + var cnt int for _, x := range s { - cnt += popcount(x) + cnt += bits.OnesCount64(x) } - return cnt + return uint64(cnt) } -func popcntMaskSliceGo(s, m []uint64) uint64 { - cnt := uint64(0) +func popcntMaskSlice(s, m []uint64) uint64 { + var cnt int + // this explicit check eliminates a bounds check in the loop + if len(m) < len(s) { + panic("mask slice is too short") + } for i := range s { - cnt += popcount(s[i] &^ m[i]) + cnt += bits.OnesCount64(s[i] &^ m[i]) } - return cnt + return uint64(cnt) } -func popcntAndSliceGo(s, m []uint64) uint64 { - cnt := uint64(0) +func popcntAndSlice(s, m []uint64) uint64 { + var cnt int + // this explicit check eliminates a bounds check in the loop + if len(m) < len(s) { + panic("mask slice is too short") + } for i := range s { - cnt += popcount(s[i] & m[i]) + cnt += bits.OnesCount64(s[i] & m[i]) } - return cnt + return uint64(cnt) } -func popcntOrSliceGo(s, m []uint64) uint64 { - cnt := uint64(0) +func popcntOrSlice(s, m []uint64) uint64 { + var cnt int + // this explicit check eliminates a bounds check in the loop + if len(m) < len(s) { + panic("mask slice is too short") + } for i := range s { - cnt += popcount(s[i] | m[i]) + cnt += bits.OnesCount64(s[i] | m[i]) } - return cnt + return uint64(cnt) } -func popcntXorSliceGo(s, m []uint64) uint64 { - cnt := uint64(0) +func popcntXorSlice(s, m []uint64) uint64 { + var cnt int + // this explicit check eliminates a bounds check in the loop + if len(m) < len(s) { + panic("mask slice is too short") + } for i := range s { - cnt += popcount(s[i] ^ m[i]) + cnt += bits.OnesCount64(s[i] ^ m[i]) } - return cnt + return uint64(cnt) } diff --git a/vendor/github.com/bits-and-blooms/bitset/popcnt_19.go b/vendor/github.com/bits-and-blooms/bitset/popcnt_19.go deleted file mode 100644 index 7855c04b5..000000000 --- a/vendor/github.com/bits-and-blooms/bitset/popcnt_19.go +++ /dev/null @@ -1,62 +0,0 @@ -//go:build go1.9 -// +build go1.9 - -package bitset - -import "math/bits" - -func popcntSlice(s []uint64) uint64 { - var cnt int - for _, x := range s { - cnt += bits.OnesCount64(x) - } - return uint64(cnt) -} - -func popcntMaskSlice(s, m []uint64) uint64 { - var cnt int - // this explicit check eliminates a bounds check in the loop - if len(m) < len(s) { - panic("mask slice is too short") - } - for i := range s { - cnt += bits.OnesCount64(s[i] &^ m[i]) - } - return uint64(cnt) -} - -func popcntAndSlice(s, m []uint64) uint64 { - var cnt int - // this explicit check eliminates a bounds check in the loop - if len(m) < len(s) { - panic("mask slice is too short") - } - for i := range s { - cnt += bits.OnesCount64(s[i] & m[i]) - } - return uint64(cnt) -} - -func popcntOrSlice(s, m []uint64) uint64 { - var cnt int - // this explicit check eliminates a bounds check in the loop - if len(m) < len(s) { - panic("mask slice is too short") - } - for i := range s { - cnt += bits.OnesCount64(s[i] | m[i]) - } - return uint64(cnt) -} - -func popcntXorSlice(s, m []uint64) uint64 { - var cnt int - // this explicit check eliminates a bounds check in the loop - if len(m) < len(s) { - panic("mask slice is too short") - } - for i := range s { - cnt += bits.OnesCount64(s[i] ^ m[i]) - } - return uint64(cnt) -} diff --git a/vendor/github.com/bits-and-blooms/bitset/popcnt_amd64.go b/vendor/github.com/bits-and-blooms/bitset/popcnt_amd64.go deleted file mode 100644 index 116e04440..000000000 --- a/vendor/github.com/bits-and-blooms/bitset/popcnt_amd64.go +++ /dev/null @@ -1,68 +0,0 @@ -//go:build !go1.9 && amd64 && !appengine -// +build !go1.9,amd64,!appengine - -package bitset - -// *** the following functions are defined in popcnt_amd64.s - -//go:noescape - -func hasAsm() bool - -// useAsm is a flag used to select the GO or ASM implementation of the popcnt function -var useAsm = hasAsm() - -//go:noescape - -func popcntSliceAsm(s []uint64) uint64 - -//go:noescape - -func popcntMaskSliceAsm(s, m []uint64) uint64 - -//go:noescape - -func popcntAndSliceAsm(s, m []uint64) uint64 - -//go:noescape - -func popcntOrSliceAsm(s, m []uint64) uint64 - -//go:noescape - -func popcntXorSliceAsm(s, m []uint64) uint64 - -func popcntSlice(s []uint64) uint64 { - if useAsm { - return popcntSliceAsm(s) - } - return popcntSliceGo(s) -} - -func popcntMaskSlice(s, m []uint64) uint64 { - if useAsm { - return popcntMaskSliceAsm(s, m) - } - return popcntMaskSliceGo(s, m) -} - -func popcntAndSlice(s, m []uint64) uint64 { - if useAsm { - return popcntAndSliceAsm(s, m) - } - return popcntAndSliceGo(s, m) -} - -func popcntOrSlice(s, m []uint64) uint64 { - if useAsm { - return popcntOrSliceAsm(s, m) - } - return popcntOrSliceGo(s, m) -} - -func popcntXorSlice(s, m []uint64) uint64 { - if useAsm { - return popcntXorSliceAsm(s, m) - } - return popcntXorSliceGo(s, m) -} diff --git a/vendor/github.com/bits-and-blooms/bitset/popcnt_amd64.s b/vendor/github.com/bits-and-blooms/bitset/popcnt_amd64.s deleted file mode 100644 index 666c0dcc1..000000000 --- a/vendor/github.com/bits-and-blooms/bitset/popcnt_amd64.s +++ /dev/null @@ -1,104 +0,0 @@ -// +build !go1.9 -// +build amd64,!appengine - -TEXT ·hasAsm(SB),4,$0-1 -MOVQ $1, AX -CPUID -SHRQ $23, CX -ANDQ $1, CX -MOVB CX, ret+0(FP) -RET - -#define POPCNTQ_DX_DX BYTE $0xf3; BYTE $0x48; BYTE $0x0f; BYTE $0xb8; BYTE $0xd2 - -TEXT ·popcntSliceAsm(SB),4,$0-32 -XORQ AX, AX -MOVQ s+0(FP), SI -MOVQ s_len+8(FP), CX -TESTQ CX, CX -JZ popcntSliceEnd -popcntSliceLoop: -BYTE $0xf3; BYTE $0x48; BYTE $0x0f; BYTE $0xb8; BYTE $0x16 // POPCNTQ (SI), DX -ADDQ DX, AX -ADDQ $8, SI -LOOP popcntSliceLoop -popcntSliceEnd: -MOVQ AX, ret+24(FP) -RET - -TEXT ·popcntMaskSliceAsm(SB),4,$0-56 -XORQ AX, AX -MOVQ s+0(FP), SI -MOVQ s_len+8(FP), CX -TESTQ CX, CX -JZ popcntMaskSliceEnd -MOVQ m+24(FP), DI -popcntMaskSliceLoop: -MOVQ (DI), DX -NOTQ DX -ANDQ (SI), DX -POPCNTQ_DX_DX -ADDQ DX, AX -ADDQ $8, SI -ADDQ $8, DI -LOOP popcntMaskSliceLoop -popcntMaskSliceEnd: -MOVQ AX, ret+48(FP) -RET - -TEXT ·popcntAndSliceAsm(SB),4,$0-56 -XORQ AX, AX -MOVQ s+0(FP), SI -MOVQ s_len+8(FP), CX -TESTQ CX, CX -JZ popcntAndSliceEnd -MOVQ m+24(FP), DI -popcntAndSliceLoop: -MOVQ (DI), DX -ANDQ (SI), DX -POPCNTQ_DX_DX -ADDQ DX, AX -ADDQ $8, SI -ADDQ $8, DI -LOOP popcntAndSliceLoop -popcntAndSliceEnd: -MOVQ AX, ret+48(FP) -RET - -TEXT ·popcntOrSliceAsm(SB),4,$0-56 -XORQ AX, AX -MOVQ s+0(FP), SI -MOVQ s_len+8(FP), CX -TESTQ CX, CX -JZ popcntOrSliceEnd -MOVQ m+24(FP), DI -popcntOrSliceLoop: -MOVQ (DI), DX -ORQ (SI), DX -POPCNTQ_DX_DX -ADDQ DX, AX -ADDQ $8, SI -ADDQ $8, DI -LOOP popcntOrSliceLoop -popcntOrSliceEnd: -MOVQ AX, ret+48(FP) -RET - -TEXT ·popcntXorSliceAsm(SB),4,$0-56 -XORQ AX, AX -MOVQ s+0(FP), SI -MOVQ s_len+8(FP), CX -TESTQ CX, CX -JZ popcntXorSliceEnd -MOVQ m+24(FP), DI -popcntXorSliceLoop: -MOVQ (DI), DX -XORQ (SI), DX -POPCNTQ_DX_DX -ADDQ DX, AX -ADDQ $8, SI -ADDQ $8, DI -LOOP popcntXorSliceLoop -popcntXorSliceEnd: -MOVQ AX, ret+48(FP) -RET diff --git a/vendor/github.com/bits-and-blooms/bitset/popcnt_generic.go b/vendor/github.com/bits-and-blooms/bitset/popcnt_generic.go deleted file mode 100644 index 9e0ad464e..000000000 --- a/vendor/github.com/bits-and-blooms/bitset/popcnt_generic.go +++ /dev/null @@ -1,25 +0,0 @@ -//go:build !go1.9 && (!amd64 || appengine) -// +build !go1.9 -// +build !amd64 appengine - -package bitset - -func popcntSlice(s []uint64) uint64 { - return popcntSliceGo(s) -} - -func popcntMaskSlice(s, m []uint64) uint64 { - return popcntMaskSliceGo(s, m) -} - -func popcntAndSlice(s, m []uint64) uint64 { - return popcntAndSliceGo(s, m) -} - -func popcntOrSlice(s, m []uint64) uint64 { - return popcntOrSliceGo(s, m) -} - -func popcntXorSlice(s, m []uint64) uint64 { - return popcntXorSliceGo(s, m) -} diff --git a/vendor/github.com/bits-and-blooms/bitset/select.go b/vendor/github.com/bits-and-blooms/bitset/select.go index f15e74a2c..a43c6bd6a 100644 --- a/vendor/github.com/bits-and-blooms/bitset/select.go +++ b/vendor/github.com/bits-and-blooms/bitset/select.go @@ -1,10 +1,12 @@ package bitset +import "math/bits" + func select64(w uint64, j uint) uint { seen := 0 // Divide 64bit part := w & 0xFFFFFFFF - n := uint(popcount(part)) + n := uint(bits.OnesCount64(part)) if n <= j { part = w >> 32 seen += 32 @@ -15,7 +17,7 @@ func select64(w uint64, j uint) uint { // Divide 32bit part = ww & 0xFFFF - n = uint(popcount(part)) + n = uint(bits.OnesCount64(part)) if n <= j { part = ww >> 16 seen += 16 @@ -25,7 +27,7 @@ func select64(w uint64, j uint) uint { // Divide 16bit part = ww & 0xFF - n = uint(popcount(part)) + n = uint(bits.OnesCount64(part)) if n <= j { part = ww >> 8 seen += 8 diff --git a/vendor/github.com/bits-and-blooms/bitset/trailing_zeros_18.go b/vendor/github.com/bits-and-blooms/bitset/trailing_zeros_18.go deleted file mode 100644 index 12336e76a..000000000 --- a/vendor/github.com/bits-and-blooms/bitset/trailing_zeros_18.go +++ /dev/null @@ -1,15 +0,0 @@ -//go:build !go1.9 -// +build !go1.9 - -package bitset - -var deBruijn = [...]byte{ - 0, 1, 56, 2, 57, 49, 28, 3, 61, 58, 42, 50, 38, 29, 17, 4, - 62, 47, 59, 36, 45, 43, 51, 22, 53, 39, 33, 30, 24, 18, 12, 5, - 63, 55, 48, 27, 60, 41, 37, 16, 46, 35, 44, 21, 52, 32, 23, 11, - 54, 26, 40, 15, 34, 20, 31, 10, 25, 14, 19, 9, 13, 8, 7, 6, -} - -func trailingZeroes64(v uint64) uint { - return uint(deBruijn[((v&-v)*0x03f79d71b4ca8b09)>>58]) -} diff --git a/vendor/github.com/bits-and-blooms/bitset/trailing_zeros_19.go b/vendor/github.com/bits-and-blooms/bitset/trailing_zeros_19.go deleted file mode 100644 index cfb0a8409..000000000 --- a/vendor/github.com/bits-and-blooms/bitset/trailing_zeros_19.go +++ /dev/null @@ -1,10 +0,0 @@ -//go:build go1.9 -// +build go1.9 - -package bitset - -import "math/bits" - -func trailingZeroes64(v uint64) uint { - return uint(bits.TrailingZeros64(v)) -} 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/consensys/bavard/.gitignore b/vendor/github.com/consensys/bavard/.gitignore deleted file mode 100644 index 4a3d4858e..000000000 --- a/vendor/github.com/consensys/bavard/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ - -.idea/* \ No newline at end of file diff --git a/vendor/github.com/consensys/bavard/LICENSE b/vendor/github.com/consensys/bavard/LICENSE deleted file mode 100644 index f49a4e16e..000000000 --- a/vendor/github.com/consensys/bavard/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. \ No newline at end of file diff --git a/vendor/github.com/consensys/bavard/README.md b/vendor/github.com/consensys/bavard/README.md deleted file mode 100644 index a4ceab613..000000000 --- a/vendor/github.com/consensys/bavard/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# bavard - -Internal package with some code-generation helper (txt/template and asm). - -Used by: - -* [gnark](https://github.com/consensys/gnark) -* [gurvy](https://github.com/consensys/gurvy) -* [goff](https://github.com/consensys/goff) \ No newline at end of file diff --git a/vendor/github.com/consensys/bavard/bavard.go b/vendor/github.com/consensys/bavard/bavard.go deleted file mode 100644 index c9164dcf4..000000000 --- a/vendor/github.com/consensys/bavard/bavard.go +++ /dev/null @@ -1,345 +0,0 @@ -// Copyright 2020 ConsenSys Software 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 bavard contains helper functions to generate consistent code from text/template templates. -// it is used by github.com/consensys/gnark && github.com/consensys/gnark-crypto -package bavard - -import ( - "bytes" - "errors" - "fmt" - "io" - "os" - "os/exec" - "path" - "path/filepath" - "strings" - "sync" - "text/template" - - "rsc.io/tmplfunc" -) - -// Bavard root object to configure the code generation from text/template -type Bavard struct { - verbose bool - fmt bool - imports bool - docFile bool - packageName string - license string - generated string - buildTag string - funcs template.FuncMap -} - -// BatchGenerator enables more efficient and clean multiple file generation -type BatchGenerator struct { - defaultOpts []func(*Bavard) error -} - -// NewBatchGenerator returns a new BatchGenerator -func NewBatchGenerator(copyrightHolder string, copyrightYear int, generatedBy string) *BatchGenerator { - return &BatchGenerator{ - defaultOpts: []func(*Bavard) error{ - Apache2(copyrightHolder, copyrightYear), - GeneratedBy(generatedBy), - Format(false), - Import(false), - Verbose(true), - }, - } -} - -// Entry to be used in batch generation of files -type Entry struct { - File string - Templates []string - BuildTag string -} - -// GenerateFromString will concatenate templates and create output file from executing the resulting text/template -// see other package functions to add options (package name, licensing, build tags, ...) -func GenerateFromString(output string, templates []string, data interface{}, options ...func(*Bavard) error) error { - var b Bavard - - var buf bytes.Buffer - - if err := b.config(&buf, output, options...); err != nil { - return err - } - - fnHelpers := helpers() - for k, v := range b.funcs { - fnHelpers[k] = v - } - - tmpl := template.New("").Funcs(fnHelpers) - - if err := tmplfunc.Parse(tmpl, aggregate(templates)); err != nil { - return err - } - - // execute template - if err := tmpl.Execute(&buf, data); err != nil { - return err - } - - return b.create(output, &buf) -} - -// GenerateFromFiles will concatenate templates and create output file from executing the resulting text/template -// see other package functions to add options (package name, licensing, build tags, ...) -func GenerateFromFiles(output string, templateF []string, data interface{}, options ...func(*Bavard) error) error { - var b Bavard - var buf bytes.Buffer - - b.config(&buf, output, options...) - - // parse templates - fnHelpers := helpers() - for k, v := range b.funcs { - fnHelpers[k] = v - } - - if len(templateF) == 0 { - return errors.New("missing templates") - } - tName := path.Base(templateF[0]) - - tmpl := template.New(tName).Funcs(fnHelpers) - - if err := tmplfunc.ParseFiles(tmpl, templateF...); err != nil { - return err - } - - // execute template - if err := tmpl.Execute(&buf, data); err != nil { - return err - } - return b.create(output, &buf) -} - -func (b *Bavard) config(buf *bytes.Buffer, output string, options ...func(*Bavard) error) error { - // default settings - b.imports = false - b.fmt = false - b.verbose = true - b.generated = "bavard" - b.docFile = strings.HasSuffix(output, "doc.go") - - // handle options - for _, option := range options { - if err := option(b); err != nil { - return err - } - } - - if b.buildTag != "" { - if _, err := buf.WriteString("// +build " + b.buildTag + "\n"); err != nil { - return err - } - } - - if b.license != "" { - if _, err := buf.WriteString(b.license + "\n"); err != nil { - return err - } - } - if _, err := buf.WriteString(fmt.Sprintf("// Code generated by %s DO NOT EDIT\n\n", b.generated)); err != nil { - return err - } - - if !b.docFile && b.packageName != "" { - if _, err := buf.WriteString("package " + b.packageName + "\n\n"); err != nil { - return err - } - } - return nil -} - -func (b *Bavard) create(output string, buf *bytes.Buffer) error { - // create output dir if not exist - _ = os.MkdirAll(filepath.Dir(output), os.ModePerm) - - // create output file - file, err := os.Create(output) - if err != nil { - return err - } - if b.verbose { - fmt.Printf("generating %-70s\n", filepath.Clean(output)) - } - if _, err := io.Copy(file, buf); err != nil { - file.Close() - return err - } - - file.Close() - - // format generated code - if b.fmt { - cmd := exec.Command("gofmt", "-s", "-w", output) - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - if err := cmd.Run(); err != nil { - return err - } - } - - // run goimports on generated code - if b.imports { - cmd := exec.Command("goimports", "-w", output) - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - if err := cmd.Run(); err != nil { - return err - } - } - - return nil -} - -func aggregate(values []string) string { - var sb strings.Builder - for _, v := range values { - sb.WriteString(v) - } - return sb.String() -} - -// Apache2Header returns a Apache2 header string -func Apache2Header(copyrightHolder string, year int) string { - apache2 := ` - // Copyright %d %s - // - // 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. - ` - return fmt.Sprintf(apache2, year, copyrightHolder) -} - -// Apache2 returns a bavard option to be used in Generate writing an apache2 licence header in the generated file -func Apache2(copyrightHolder string, year int) func(*Bavard) error { - return func(b *Bavard) error { - b.license = Apache2Header(copyrightHolder, year) - return nil - } -} - -// GeneratedBy returns a bavard option to be used in Generate writing a standard -// "Code generated by 'label' DO NOT EDIT" -func GeneratedBy(label string) func(*Bavard) error { - return func(b *Bavard) error { - b.generated = label - return nil - } -} - -// BuildTag returns a bavard option to be used in Generate adding build tags string on top of the generated file -func BuildTag(buildTag string) func(*Bavard) error { - return func(b *Bavard) error { - b.buildTag = buildTag - return nil - } -} - -// Package returns a bavard option adding package name and optional package documentation in the generated file -func Package(name string) func(*Bavard) error { - return func(b *Bavard) error { - b.packageName = name - return nil - } -} - -// Verbose returns a bavard option to be used in Generate. If set to true, will print to stdout during code generation -func Verbose(v bool) func(*Bavard) error { - return func(b *Bavard) error { - b.verbose = v - return nil - } -} - -// Format returns a bavard option to be used in Generate. If set to true, will run gofmt on generated file. -// Or simple tab alignment on .s files -func Format(v bool) func(*Bavard) error { - return func(b *Bavard) error { - b.fmt = v - return nil - } -} - -// Import returns a bavard option to be used in Generate. If set to true, will run goimports -func Import(v bool) func(*Bavard) error { - return func(b *Bavard) error { - b.imports = v - return nil - } -} - -// Funcs returns a bavard option to be used in Generate. See text/template FuncMap for more info -func Funcs(funcs template.FuncMap) func(*Bavard) error { - return func(b *Bavard) error { - b.funcs = funcs - return nil - } -} - -// Generate an entry with generator default config -func (b *BatchGenerator) Generate(data interface{}, packageName string, baseTmplDir string, entries ...Entry) error { - return b.GenerateWithOptions(data, packageName, baseTmplDir, make([]func(*Bavard)error,0), entries...) -} - -// GenerateWithOptions allows adding extra configuration (helper functions etc.) to a batch generation -func (b *BatchGenerator) GenerateWithOptions(data interface{}, packageName string, baseTmplDir string, extraOptions []func(*Bavard) error, entries ...Entry) error { - var firstError error - var lock sync.RWMutex - var wg sync.WaitGroup - for i := 0; i < len(entries); i++ { - wg.Add(1) - go func(entry Entry) { - defer wg.Done() - opts := make([]func(*Bavard) error, len(b.defaultOpts) + len(extraOptions)) - copy(opts, b.defaultOpts) - copy(opts[len(b.defaultOpts):], extraOptions) - if entry.BuildTag != "" { - opts = append(opts, BuildTag(entry.BuildTag)) - } - opts = append(opts, Package(packageName)) - for j := 0; j < len(entry.Templates); j++ { - entry.Templates[j] = filepath.Join(baseTmplDir, entry.Templates[j]) - } - if err := GenerateFromFiles(entry.File, entry.Templates, data, opts...); err != nil { - lock.Lock() - if firstError == nil { - firstError = err - } - lock.Unlock() - } - }(entries[i]) - } - wg.Wait() - - return firstError -} \ No newline at end of file diff --git a/vendor/github.com/consensys/bavard/helpers.go b/vendor/github.com/consensys/bavard/helpers.go deleted file mode 100644 index 2e2f91f4f..000000000 --- a/vendor/github.com/consensys/bavard/helpers.go +++ /dev/null @@ -1,525 +0,0 @@ -// Copyright 2020 ConsenSys Software 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 bavard - -import ( - "bytes" - "errors" - "fmt" - "math/big" - "math/bits" - "reflect" - "strconv" - "strings" - "sync" - "text/template" -) - -// Template helpers (txt/template) -func helpers() template.FuncMap { - // functions used in template - return template.FuncMap{ - "add": add, - "bits": getBits, - "bytes": intBytes, //TODO: Do this directly - "capitalize": strings.Title, - "dict": dict, - "div": div, - "divides": divides, - "first": first, - "gt": gt, - "interval": interval, - "iterate": iterate, - "select": _select, - "last": last, - "list": makeSlice, - "log": fmt.Println, - "lt": lt, - "mod": mod, - "mul": mul, - "mul2": mul2, - "noFirst": noFirst, - "noLast": noLast, - "notNil": notNil, - "pretty": pretty, - "printList": printList, - "reverse": reverse, - "sub": sub, - "supScr": toSuperscript, - "toInt64": toInt64, - "toLower": strings.ToLower, - "toTitle": strings.Title, - "toUpper": strings.ToUpper, - "words64": bigIntToUint64SliceAsString, - } -} - -func _select(condition bool, ifNot, ifSo interface{}) interface{} { - if condition { - return ifSo - } - return ifNot -} - -func pretty(a interface{}) interface{} { - if res, err := printList(a); err == nil { - return res - } - - if s, ok := a.(big.Int); ok { - return s.String() - } - - return a -} - -func cmp(a, b interface{}, expectedCmp int) (bool, error) { - aI, err := toBigInt(a) - if err != nil { - return false, err - } - var bI big.Int - bI, err = toBigInt(b) - if err != nil { - return false, err - } - return aI.Cmp(&bI) == expectedCmp, nil -} - -func lt(a, b interface{}) (bool, error) { - return cmp(a, b, -1) -} - -func gt(a, b interface{}) (bool, error) { - return cmp(a, b, +1) -} - -func getBitsBig(a big.Int) ([]bool, error) { - l := a.BitLen() - res := make([]bool, l) - for i := 0; i < l; i ++ { - res[i] = a.Bit(i) == 1 - } - return res, nil -} - -func getBits(a interface{}) ([]bool, error) { - - if aBI, ok := a.(big.Int); ok { - return getBitsBig(aBI) - } - - var res []bool - aI, err := toInt64(a) - - if err != nil { - return res, err - } - - for aI != 0 { - res = append(res, aI%2 != 0) - aI /= 2 - } - - return res, nil -} - -func toBigInt(a interface{}) (big.Int, error) { - switch i := a.(type) { - case big.Int: - return i, nil - case *big.Int: - return *i, nil - /*case string: - var res big.Int - res.SetString(i, 0) - return res, nil*/ - default: - n, err := toInt64(i) - return *big.NewInt(n), err - } -} - -func toInt64(a interface{}) (int64, error) { - switch i := a.(type) { - case uint8: - return int64(i), nil - case int8: - return int64(i), nil - case uint16: - return int64(i), nil - case int16: - return int64(i), nil - case uint32: - return int64(i), nil - case int32: - return int64(i), nil - case uint64: - if i>>63 != 0 { - return -1, fmt.Errorf("uint64 value won't fit in int64") - } - return int64(i), nil - case int64: - return i, nil - case int: - return int64(i), nil - case big.Int: - if !i.IsInt64() { - return -1, fmt.Errorf("big.Int value won't fit in int64") - } - return i.Int64(), nil - case *big.Int: - if !i.IsInt64() { - return -1, fmt.Errorf("big.Int value won't fit in int64") - } - return i.Int64(), nil - default: - return 0, fmt.Errorf("cannot convert to int64 from type %T", i) - } -} - -func mod(a, b interface{}) (int64, error) { - - var err error - A, err := toInt64(a) - - if err != nil { - return 0, err - } - - B, err := toInt64(b) - - if err != nil { - return 0, err - } - return A % B, nil -} - -func intBytes(i big.Int) []byte { - return i.Bytes() -} - -func interval(begin, end interface{}) ([]int64, error) { - beginInt, err := toInt64(begin) - if err != nil { - return nil, err - } - endInt, err := toInt64(end) - if err != nil { - return nil, err - } - - l := endInt - beginInt - r := make([]int64, l) - for i := int64(0); i < l; i++ { - r[i] = i + beginInt - } - return r, nil -} - -// Adopted from https://stackoverflow.com/a/50487104/5116581 -func notNil(input interface{}) bool { - isNil := input == nil || (reflect.ValueOf(input).Kind() == reflect.Ptr && reflect.ValueOf(input).IsNil()) - return !isNil -} - -func AssertSlice(input interface{}) (reflect.Value, error) { - s := reflect.ValueOf(input) - if s.Kind() != reflect.Slice { - return s, fmt.Errorf("value %s is not a slice", fmt.Sprint(s)) - } - return s, nil -} - -func first(input interface{}) (interface{}, error) { - s, err := AssertSlice(input) - if err != nil { - return nil, err - } - if s.Len() == 0 { - return nil, fmt.Errorf("empty slice") - } - return s.Index(0).Interface(), nil -} - -func last(input interface{}) (interface{}, error) { - s, err := AssertSlice(input) - if err != nil { - return nil, err - } - if s.Len() == 0 { - return nil, fmt.Errorf("empty slice") - } - return s.Index(s.Len() - 1).Interface(), nil -} - -var StringBuilderPool = sync.Pool{New: func() interface{} { return &strings.Builder{} }} - -func WriteBigIntAsUint64Slice(builder *strings.Builder, input *big.Int) { - words := input.Bits() - - if len(words) == 0 { - builder.WriteString("0") - return - } - - for i := 0; i < len(words); i++ { - w := uint64(words[i]) - - if bits.UintSize == 32 && i < len(words)-1 { - i++ - w = (w << 32) | uint64(words[i]) - } - - builder.WriteString(strconv.FormatUint(w, 10)) - - if i < len(words)-1 { - builder.WriteString(", ") - } - } -} - -func bigIntToUint64SliceAsString(in interface{}) (string, error) { - - var input *big.Int - - switch i := in.(type) { - case big.Int: - input = &i - case *big.Int: - input = i - default: - return "", fmt.Errorf("unsupported type %T", in) - } - - builder := StringBuilderPool.Get().(*strings.Builder) - builder.Reset() - defer StringBuilderPool.Put(builder) - - WriteBigIntAsUint64Slice(builder, input) - - return builder.String(), nil -} - -func printList(input interface{}) (string, error) { - - s, err := AssertSlice(input) - - if err != nil || s.Len() == 0 { - return "", err - } - - builder := StringBuilderPool.Get().(*strings.Builder) - builder.Reset() - defer StringBuilderPool.Put(builder) - - builder.WriteString(fmt.Sprint(pretty(s.Index(0).Interface()))) - - for i := 1; i < s.Len(); i++ { - builder.WriteString(", ") - builder.WriteString(fmt.Sprint(pretty(s.Index(i).Interface()))) - } - - return builder.String(), nil -} - -func iterate(start, end interface{}) (r []int64, err error) { - - startI, err := toInt64(start) - if err != nil { - return nil, err - } - var endI int64 - endI, err = toInt64(end) - - if err != nil { - return nil, err - } - - for i := startI; i < endI; i++ { - r = append(r, i) - } - return -} - -func reverse(input interface{}) interface{} { - - s, err := AssertSlice(input) - if err != nil { - return err - } - l := s.Len() - toReturn := reflect.MakeSlice(s.Type(), l, l) - - l-- - for i := 0; i <= l; i++ { - toReturn.Index(l - i).Set(s.Index(i)) - } - return toReturn.Interface() -} - -func noFirst(input interface{}) interface{} { - s, err := AssertSlice(input) - if s.Len() == 0 { - return input - } - if err != nil { - return err - } - l := s.Len() - 1 - toReturn := reflect.MakeSlice(s.Type(), l, l) - for i := 0; i < l; i++ { - toReturn.Index(i).Set(s.Index(i + 1)) - } - return toReturn.Interface() -} - -func noLast(input interface{}) interface{} { - s, err := AssertSlice(input) - if s.Len() == 0 { - return input - } - if err != nil { - return err - } - l := s.Len() - 1 - toReturn := reflect.MakeSlice(s.Type(), l, l) - for i := 0; i < l; i++ { - toReturn.Index(i).Set(s.Index(i)) - } - return toReturn.Interface() -} - -func add(a, b interface{}) (int64, error) { - aI, err := toInt64(a) - if err != nil { - return 0, err - } - var bI int64 - if bI, err = toInt64(b); err != nil { - return 0, err - } - return aI + bI, nil -} -func mul(a, b interface{}) (int64, error) { - aI, err := toInt64(a) - if err != nil { - return 0, err - } - var bI int64 - if bI, err = toInt64(b); err != nil { - return 0, err - } - return aI * bI, nil -} -func sub(a, b interface{}) (int64, error) { - aI, err := toInt64(a) - if err != nil { - return 0, err - } - var bI int64 - if bI, err = toInt64(b); err != nil { - return 0, err - } - return aI - bI, nil -} -func mul2(a interface{}) (int64, error) { - aI, err := toInt64(a) - if err != nil { - return 0, err - } - - return aI * 2, nil -} -func div(a, b interface{}) (int64, error) { - aI, err := toInt64(a) - if err != nil { - return 0, err - } - var bI int64 - if bI, err = toInt64(b); err != nil { - return 0, err - } - return aI / bI, nil -} - -func makeSlice(values ...interface{}) []interface{} { - return values -} - -func dict(values ...interface{}) (map[string]interface{}, error) { - if len(values)%2 != 0 { - return nil, errors.New("invalid dict call") - } - dict := make(map[string]interface{}, len(values)/2) - for i := 0; i < len(values); i += 2 { - key, ok := values[i].(string) - if !ok { - return nil, errors.New("dict keys must be strings") - } - dict[key] = values[i+1] - } - return dict, nil -} - -// return true if c1 divides c2, that is, c2 % c1 == 0 -func divides(c1, c2 interface{}) (bool, error) { - - //try to convert to int64 - c1Int, err := toInt64(c1) - if err != nil { - return false, err - } - var c2Int int64 - c2Int, err = toInt64(c2) - if err != nil { - return false, err - } - - return c2Int%c1Int == 0, nil -} - -// Imitating supsub -var superscripts = map[rune]rune{ - '0': '⁰', - '1': '¹', - '2': '²', - '3': '³', - '4': '⁴', - '5': '⁵', - '6': '⁶', - '7': '⁷', - '8': '⁸', - '9': '⁹', -} - -// toSuperscript writes a number as a "power" -//TODO: Use https://github.com/lynn9388/supsub ? -//Copying supsub -func toSuperscript(a interface{}) (string, error) { - i, err := toInt64(a) - - if err != nil { - return "", err - } - - s := strconv.FormatInt(i, 10) - var buf bytes.Buffer - for _, r := range s { - sup := superscripts[r] - buf.WriteRune(sup) - } - return buf.String(), nil -} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/bls12-377.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/bls12-377.go index 43fbe1f6c..24e34f185 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/bls12-377.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/bls12-377.go @@ -62,13 +62,13 @@ var g1Infinity G1Jac var g2Infinity G2Jac // optimal Ate loop counter -var loopCounter [64]int8 +var LoopCounter [64]int8 // Parameters useful for the GLV scalar multiplication. The third roots define the // endomorphisms ϕ₁ and ϕ₂ for and . lambda is such that lies above // in the ring Z[ϕ]. More concretely it's the associated eigenvalue // of ϕ₁ (resp ϕ₂) restricted to (resp ) -// see https://www.cosic.esat.kuleuven.be/nessie/reports/phase2/GLV.pdf +// see https://link.springer.com/content/pdf/10.1007/3-540-36492-7_3 var thirdRootOneG1 fp.Element var thirdRootOneG2 fp.Element var lambdaGLV big.Int @@ -77,6 +77,12 @@ var lambdaGLV big.Int // in ker((u,v) → u+vλ[r]), and their determinant var glvBasis ecc.Lattice +// g1ScalarMulChoose and g2ScalarmulChoose indicate the bitlength of the scalar +// in scalar multiplication from which it is more efficient to use the GLV +// decomposition. It is computed from the GLV basis and considers the overhead +// for the GLV decomposition. It is heuristic and may change in the future. +var g1ScalarMulChoose, g2ScalarMulChoose int + // ψ o π o ψ⁻¹, where ψ:E → E' is the degree 6 iso defined over 𝔽p¹² var endo struct { u fptower.E2 @@ -129,12 +135,14 @@ func init() { lambdaGLV.SetString("91893752504881257701523279626832445440", 10) //(x₀²-1) _r := fr.Modulus() ecc.PrecomputeLattice(_r, &lambdaGLV, &glvBasis) + g1ScalarMulChoose = fr.Bits/16 + max(glvBasis.V1[0].BitLen(), glvBasis.V1[1].BitLen(), glvBasis.V2[0].BitLen(), glvBasis.V2[1].BitLen()) + g2ScalarMulChoose = fr.Bits/32 + max(glvBasis.V1[0].BitLen(), glvBasis.V1[1].BitLen(), glvBasis.V2[0].BitLen(), glvBasis.V2[1].BitLen()) endo.u.A0.SetString("80949648264912719408558363140637477264845294720710499478137287262712535938301461879813459410946") endo.v.A0.SetString("216465761340224619389371505802605247630151569547285782856803747159100223055385581585702401816380679166954762214499") // binary decomposition of x₀ little endian - loopCounter = [64]int8{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1} + LoopCounter = [64]int8{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1} // x₀ xGen.SetString("9586122913090633729", 10) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/arith.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/arith.go index 6f281563b..5c9905de8 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/arith.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/arith.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -58,16 +47,3 @@ func madd3(a, b, c, d, e uint64) (hi uint64, lo uint64) { hi, _ = bits.Add64(hi, e, carry) return } -func max(a int, b int) int { - if a > b { - return a - } - return b -} - -func min(a int, b int) int { - if a < b { - return a - } - return b -} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/asm.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/asm.go deleted file mode 100644 index 0481989ec..000000000 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/asm.go +++ /dev/null @@ -1,27 +0,0 @@ -//go:build !noadx -// +build !noadx - -// Copyright 2020 ConsenSys Software 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. - -// Code generated by consensys/gnark-crypto DO NOT EDIT - -package fp - -import "golang.org/x/sys/cpu" - -var ( - supportAdx = cpu.X86.HasADX && cpu.X86.HasBMI2 - _ = supportAdx -) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/asm_noadx.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/asm_noadx.go deleted file mode 100644 index 92f8cc0f4..000000000 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/asm_noadx.go +++ /dev/null @@ -1,28 +0,0 @@ -//go:build noadx -// +build noadx - -// Copyright 2020 ConsenSys Software 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. - -// Code generated by consensys/gnark-crypto DO NOT EDIT - -package fp - -// note: this is needed for test purposes, as dynamically changing supportAdx doesn't flag -// certain errors (like fatal error: missing stackmap) -// this ensures we test all asm path. -var ( - supportAdx = false - _ = supportAdx -) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/doc.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/doc.go index c4d87f7b0..94fc02f30 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/doc.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/doc.go @@ -1,22 +1,13 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT // Package fp contains field arithmetic operations for modulus = 0x1ae3a4...000001. // -// The API is similar to math/big (big.Int), but the operations are significantly faster (up to 20x for the modular multiplication on amd64, see also https://hackmd.io/@gnark/modular_multiplication) +// The API is similar to math/big (big.Int), but the operations are significantly faster (up to 20x). +// +// Additionally fp.Vector offers an API to manipulate []Element. // // The modulus is hardcoded in all the operations. // @@ -49,5 +40,7 @@ // // # Warning // -// This code has not been audited and is provided as-is. In particular, there is no security guarantees such as constant time implementation or side-channel attack resistance. +// There is no security guarantees such as constant time implementation or side-channel attack resistance. +// This code is provided as-is. Partially audited, see https://github.com/Consensys/gnark/tree/master/audits +// for more details. package fp diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element.go index 81a730fbd..dc5d0527b 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -54,12 +43,12 @@ const ( // Field modulus q const ( - q0 uint64 = 9586122913090633729 - q1 uint64 = 1660523435060625408 - q2 uint64 = 2230234197602682880 - q3 uint64 = 1883307231910630287 - q4 uint64 = 14284016967150029115 - q5 uint64 = 121098312706494698 + q0 = 9586122913090633729 + q1 = 1660523435060625408 + q2 = 2230234197602682880 + q3 = 1883307231910630287 + q4 = 14284016967150029115 + q5 = 121098312706494698 ) var qElement = Element{ @@ -83,7 +72,7 @@ func Modulus() *big.Int { // q + r'.r = 1, i.e., qInvNeg = - q⁻¹ mod r // used for Montgomery reduction -const qInvNeg uint64 = 9586122913090633727 +const qInvNeg = 9586122913090633727 func init() { _modulus.SetString("1ae3a4617c510eac63b05c06ca1493b1a22d9f300f5138f1ef3622fba094800170b5d44300000008508c00000000001", 16) @@ -135,7 +124,7 @@ func (z *Element) Set(x *Element) *Element { } // SetInterface converts provided interface into Element -// returns an error if provided type is not supported +// returns an error if provided type is not supported. // supported types: // // Element @@ -374,6 +363,16 @@ func (z *Element) SetRandom() (*Element, error) { } } +// MustSetRandom sets z to a uniform random value in [0, q). +// +// It panics if reading from crypto/rand.Reader errors. +func (z *Element) MustSetRandom() *Element { + if _, err := z.SetRandom(); err != nil { + panic(err) + } + return z +} + // smallerThanModulus returns true if z < q // This is not constant time func (z *Element) smallerThanModulus() bool { @@ -521,32 +520,8 @@ func (z *Element) Select(c int, x0 *Element, x1 *Element) *Element { // and is used for testing purposes. func _mulGeneric(z, x, y *Element) { - // Implements CIOS multiplication -- section 2.3.2 of Tolga Acar's thesis - // https://www.microsoft.com/en-us/research/wp-content/uploads/1998/06/97Acar.pdf - // - // The algorithm: - // - // for i=0 to N-1 - // C := 0 - // for j=0 to N-1 - // (C,t[j]) := t[j] + x[j]*y[i] + C - // (t[N+1],t[N]) := t[N] + C - // - // C := 0 - // m := t[0]*q'[0] mod D - // (C,_) := t[0] + m*q[0] - // for j=1 to N-1 - // (C,t[j-1]) := t[j] + m*q[j] + C - // - // (C,t[N-1]) := t[N] + C - // t[N] := t[N+1] + C - // - // → N is the number of machine words needed to store the modulus q - // → D is the word size. For example, on a 64-bit architecture D is 2 64 - // → x[i], y[i], q[i] is the ith word of the numbers x,y,q - // → q'[0] is the lowest word of the number -q⁻¹ mod r. This quantity is pre-computed, as it does not depend on the inputs. - // → t is a temporary array of size N+2 - // → C, S are machine words. A pair (C,S) refers to (hi-bits, lo-bits) of a two-word number + // Algorithm 2 of "Faster Montgomery Multiplication and Multi-Scalar-Multiplication for SNARKS" + // by Y. El Housni and G. Botrel https://doi.org/10.46586/tches.v2023.i3.504-521 var t [7]uint64 var D uint64 @@ -1122,7 +1097,7 @@ func (z *Element) SetBigInt(v *big.Int) *Element { // v == 0 return z } else if c != 1 && v.Cmp(&zero) != -1 { - // 0 < v < q + // 0 <= v < q return z.setBigInt(v) } @@ -1249,6 +1224,8 @@ type ByteOrder interface { String() string } +var errInvalidEncoding = errors.New("invalid fp.Element encoding") + // BigEndian is the big-endian implementation of ByteOrder and AppendByteOrder. var BigEndian bigEndian @@ -1266,7 +1243,7 @@ func (bigEndian) Element(b *[Bytes]byte) (Element, error) { z[5] = binary.BigEndian.Uint64((*b)[0:8]) if !z.smallerThanModulus() { - return Element{}, errors.New("invalid fp.Element encoding") + return Element{}, errInvalidEncoding } z.toMont() @@ -1300,7 +1277,7 @@ func (littleEndian) Element(b *[Bytes]byte) (Element, error) { z[5] = binary.LittleEndian.Uint64((*b)[40:48]) if !z.smallerThanModulus() { - return Element{}, errors.New("invalid fp.Element encoding") + return Element{}, errInvalidEncoding } z.toMont() @@ -1321,19 +1298,174 @@ func (littleEndian) String() string { return "LittleEndian" } // Legendre returns the Legendre symbol of z (either +1, -1, or 0.) func (z *Element) Legendre() int { - var l Element - // z^((q-1)/2) - l.expByLegendreExp(*z) - if l.IsZero() { - return 0 + // Adapts "Optimized Binary GCD for Modular Inversion" + // https://github.com/pornin/bingcd/blob/main/doc/bingcd.pdf + // For a faithful implementation of Pornin20 see [Inverse]. + + // We don't need to account for z being in Montgomery form. + // (xR|q) = (x|q)(R|q). R is a square (an even power of 2), so (R|q) = 1. + a := *z + b := Element{ + q0, + q1, + q2, + q3, + q4, + q5, + } // b := q + + // Update factors: we get [a; b] ← [f₀ g₀; f₁ g₁] [a; b] + // cᵢ = fᵢ + 2³¹ - 1 + 2³² * (gᵢ + 2³¹ - 1) + var c0, c1 int64 + + var s Element + + l := 1 // loop invariant: (x|q) = (a|b) . l + // This means that every time a and b are updated into a' and b', + // l is updated into l' = (x|q)(a'|b')=(x|q)(a|b)(a|b)(a'|b') = l (a|b)(a'|b') + // During the algorithm's run, there is no guarantee that b remains prime, or even positive. + // Therefore, we use the properties of the Kronecker symbol, a generalization of the Legendre symbol to all integers. + + for !a.IsZero() { + n := max(a.BitLen(), b.BitLen()) + aApprox, bApprox := approximateForLegendre(&a, n), approximateForLegendre(&b, n) + + // f₀, g₀, f₁, g₁ = 1, 0, 0, 1 + c0, c1 = updateFactorIdentityMatrixRow0, updateFactorIdentityMatrixRow1 + + const nbIterations = k - 2 + // running fewer iterations because we need access to 3 low bits from b, rather than 1 in the inversion algorithm + for range nbIterations { + + if aApprox&1 == 0 { + aApprox /= 2 + + // update the Kronecker symbol + // + // (a/2 | b) (2|b) = (a|b) + // + // b is either odd or zero, the latter case implying a non-trivial GCD and an ultimate result of 0, + // regardless of what value l holds. + // So in updating l, we may assume that b is odd. + // Since a is even, we only need to correctly compute l if b is odd. + // if b is also even, the non-trivial GCD will result in the function returning 0 anyway. + // so we may here assume b is odd. + // (2|b) = 1 if b ≡ 1 or 7 (mod 8), and -1 if b ≡ 3 or 5 (mod 8) + if bMod8 := bApprox & 7; bMod8 == 3 || bMod8 == 5 { + l = -l + } + + } else { + s, borrow := bits.Sub64(aApprox, bApprox, 0) + if borrow == 1 { + // Compute (b-a|a) + // (x-y|z) = (x|z) unless z < 0 and sign(x-y) ≠ sign(x) + // Pornin20 asserts that at least one of a and b is non-negative. + // If a is non-negative, we immediately get (b-a|a) = (b|a) + // If a is negative, b-a > b. But b is already non-negative, so the b-a and b have the same sign. + // Thus in that case also (b-a|a) = (b|a) + // Since not both a and b are negative, we get a quadratic reciprocity law + // like that of the Legendre symbol: (b|a) = (a|b), unless a, b ≡ 3 (mod 4), in which case (b|a) = -(a|b) + if bApprox&3 == 3 && aApprox&3 == 3 { + l = -l + } + + s = bApprox - aApprox + bApprox = aApprox + c0, c1 = c1, c0 + } + + aApprox = s / 2 + c0 = c0 - c1 + + // update l to reflect halving a, just like in the case where a is even + if bMod8 := bApprox & 7; bMod8 == 3 || bMod8 == 5 { + l = -l + } + } + + c1 *= 2 + } + + s = a + + var g0 int64 + // from this point on c0 aliases for f0 + c0, g0 = updateFactorsDecompose(c0) + aHi := a.linearCombNonModular(&s, c0, &b, g0) + if aHi&signBitSelector != 0 { + // if aHi < 0 + aHi = negL(&a, aHi) + // Since a is negative, b is not and hence b ≠ -1 + // So we get (-a|b)=(-1|b)(a|b) + // b is odd so we get (-1|b) = 1 if b ≡ 1 (mod 4) and -1 otherwise. + if bApprox&3 == 3 { // we still have two valid lower bits for b + l = -l + } + } + // right-shift a by k-2 bits + a[0] = (a[0] >> nbIterations) | ((a[1]) << (2*k - nbIterations)) + a[1] = (a[1] >> nbIterations) | ((a[2]) << (2*k - nbIterations)) + a[2] = (a[2] >> nbIterations) | ((a[3]) << (2*k - nbIterations)) + a[3] = (a[3] >> nbIterations) | ((a[4]) << (2*k - nbIterations)) + a[4] = (a[4] >> nbIterations) | ((a[5]) << (2*k - nbIterations)) + a[5] = (a[5] >> nbIterations) | (aHi << (2*k - nbIterations)) + + var f1 int64 + // from this point on c1 aliases for g0 + f1, c1 = updateFactorsDecompose(c1) + bHi := b.linearCombNonModular(&s, f1, &b, c1) + if bHi&signBitSelector != 0 { + // if bHi < 0 + bHi = negL(&b, bHi) + // no need to update l, since we know a ≥ 0 + // (a|-1) = 1 if a ≥ 0 + } + // right-shift b by k-2 bits + b[0] = (b[0] >> nbIterations) | ((b[1]) << (2*k - nbIterations)) + b[1] = (b[1] >> nbIterations) | ((b[2]) << (2*k - nbIterations)) + b[2] = (b[2] >> nbIterations) | ((b[3]) << (2*k - nbIterations)) + b[3] = (b[3] >> nbIterations) | ((b[4]) << (2*k - nbIterations)) + b[4] = (b[4] >> nbIterations) | ((b[5]) << (2*k - nbIterations)) + b[5] = (b[5] >> nbIterations) | (bHi << (2*k - nbIterations)) } - // if l == 1 - if l.IsOne() { - return 1 + if b[0] == 1 && (b[1]|b[2]|b[3]|b[4]|b[5]) == 0 { + return l // (0|1) = 1 + } else { + return 0 // if b ≠ 1, then (z,q) ≠ 0 ⇒ (z|q) = 0 + } +} + +// approximate a big number x into a single 64 bit word using its uppermost and lowermost bits. +// If x fits in a word as is, no approximation necessary. +// This differs from the standard approximate function in that in the Legendre symbol computation +// we need to access the 3 low bits of b, rather than just one. So lo ≥ n+2 where n is the number of inner iterations. +// The requirement on the high bits is unchanged, hi ≥ n+1. +// Thus we hit a maximum of hi = lo = k and n = k-2 as opposed to n = lo = k-1 and hi = k+1 in the standard approximate function. +// Since we are doing fewer iterations than in the inversion algorithm, all the arguments on bounds for update factors remain valid. +func approximateForLegendre(x *Element, nBits int) uint64 { + + if nBits <= 64 { + return x[0] } - return -1 + + const mask = (uint64(1) << k) - 1 // k ones + lo := mask & x[0] + + hiWordIndex := (nBits - 1) / 64 + + hiWordBitsAvailable := nBits - hiWordIndex*64 + hiWordBitsUsed := min(hiWordBitsAvailable, k) + + mask_ := uint64(^((1 << (hiWordBitsAvailable - hiWordBitsUsed)) - 1)) + hi := (x[hiWordIndex] & mask_) << (64 - hiWordBitsAvailable) + + mask_ = ^(1<<(k+hiWordBitsUsed) - 1) + mid := (mask_ & x[hiWordIndex-1]) >> hiWordBitsUsed + + return lo | mid | hi } // Sqrt z = √x (mod q) @@ -1613,7 +1745,7 @@ func approximate(x *Element, nBits int) uint64 { return x[0] } - const mask = (uint64(1) << (k - 1)) - 1 // k-1 ones + const mask = (uint64(1) << approxLowBitsN) - 1 // k-1 ones lo := mask & x[0] hiWordIndex := (nBits - 1) / 64 diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_amd64.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_amd64.go new file mode 100644 index 000000000..ff2159178 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_amd64.go @@ -0,0 +1,62 @@ +//go:build !purego + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package fp + +import ( + _ "github.com/consensys/gnark-crypto/field/asm/element_6w" + "github.com/consensys/gnark-crypto/utils/cpu" +) + +var supportAdx = cpu.SupportADX + +//go:noescape +func MulBy3(x *Element) + +//go:noescape +func MulBy5(x *Element) + +//go:noescape +func MulBy13(x *Element) + +//go:noescape +func mul(res, x, y *Element) + +//go:noescape +func fromMont(res *Element) + +//go:noescape +func reduce(res *Element) + +// Butterfly sets +// +// a = a + b (mod q) +// b = a - b (mod q) +// +//go:noescape +func Butterfly(a, b *Element) + +// Mul z = x * y (mod q) +// +// x and y must be less than q +func (z *Element) Mul(x, y *Element) *Element { + + // Algorithm 2 of "Faster Montgomery Multiplication and Multi-Scalar-Multiplication for SNARKS" + // by Y. El Housni and G. Botrel https://doi.org/10.46586/tches.v2023.i3.504-521 + + mul(z, x, y) + return z +} + +// Square z = x * x (mod q) +// +// x must be less than q +func (z *Element) Square(x *Element) *Element { + // see Mul for doc. + mul(z, x, x) + return z +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_amd64.s b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_amd64.s new file mode 100644 index 000000000..e5d5240f0 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_amd64.s @@ -0,0 +1,10 @@ +//go:build !purego + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +// We include the hash to force the Go compiler to recompile: 7475536923510290409 +#include "../../../field/asm/element_6w/element_6w_amd64.s" + diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_arm64.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_arm64.go new file mode 100644 index 000000000..a4510da8e --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_arm64.go @@ -0,0 +1,72 @@ +//go:build !purego + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package fp + +import ( + _ "github.com/consensys/gnark-crypto/field/asm/element_6w" +) + +// Butterfly sets +// +// a = a + b (mod q) +// b = a - b (mod q) +// +//go:noescape +func Butterfly(a, b *Element) + +//go:noescape +func mul(res, x, y *Element) + +// Mul z = x * y (mod q) +// +// x and y must be less than q +func (z *Element) Mul(x, y *Element) *Element { + mul(z, x, y) + return z +} + +// Square z = x * x (mod q) +// +// x must be less than q +func (z *Element) Square(x *Element) *Element { + // see Mul for doc. + mul(z, x, x) + return z +} + +// MulBy3 x *= 3 (mod q) +func MulBy3(x *Element) { + _x := *x + x.Double(x).Add(x, &_x) +} + +// MulBy5 x *= 5 (mod q) +func MulBy5(x *Element) { + _x := *x + x.Double(x).Double(x).Add(x, &_x) +} + +// MulBy13 x *= 13 (mod q) +func MulBy13(x *Element) { + var y = Element{ + 1176283927673829444, + 14130787773971430395, + 11354866436980285261, + 15740727779991009548, + 14951814113394531041, + 33013799364667434, + } + x.Mul(x, &y) +} + +func fromMont(z *Element) { + _fromMontGeneric(z) +} + +//go:noescape +func reduce(res *Element) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_arm64.s b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_arm64.s new file mode 100644 index 000000000..2defbe4c2 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_arm64.s @@ -0,0 +1,10 @@ +//go:build !purego + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +// We include the hash to force the Go compiler to recompile: 15397482240260640864 +#include "../../../field/asm/element_6w/element_6w_arm64.s" + diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_exp.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_exp.go index e3d936dfc..190a92adb 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_exp.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_exp.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -497,496 +486,3 @@ func (z *Element) expBySqrtExp(x Element) *Element { return z } - -// expByLegendreExp is equivalent to z.Exp(x, d71d230be28875631d82e03650a49d8d116cf9807a89c78f79b117dd04a4000b85aea2180000004284600000000000) -// -// uses github.com/mmcloughlin/addchain v0.4.0 to generate a shorter addition chain -func (z *Element) expByLegendreExp(x Element) *Element { - // addition chain: - // - // _10 = 2*1 - // _11 = 1 + _10 - // _100 = 1 + _11 - // _101 = 1 + _100 - // _111 = _10 + _101 - // _1001 = _10 + _111 - // _1011 = _10 + _1001 - // _1111 = _100 + _1011 - // _10001 = _10 + _1111 - // _10011 = _10 + _10001 - // _10111 = _100 + _10011 - // _11011 = _100 + _10111 - // _11101 = _10 + _11011 - // _11111 = _10 + _11101 - // _110100 = _10111 + _11101 - // _11010000 = _110100 << 2 - // _11010111 = _111 + _11010000 - // i36 = 2*((_11010111 << 8 + _11101) << 7 + _10001) - // i50 = ((1 + i36) << 9 + _10111) << 2 + _11 - // i71 = ((i50 << 6 + _101) << 4 + 1) << 9 - // i84 = ((_11101 + i71) << 5 + _1011) << 5 + _11 - // i105 = (2*(i84 << 8 + _11101) + 1) << 10 - // i125 = ((_10111 + i105) << 12 + _11011) << 5 + _101 - // i147 = ((i125 << 7 + _101) << 6 + _1001) << 7 - // i158 = ((_11101 + i147) << 5 + _10001) << 3 + _101 - // i181 = ((i158 << 8 + _10001) << 6 + _11011) << 7 - // i200 = ((_11111 + i181) << 4 + _11) << 12 + _1111 - // i219 = ((i200 << 4 + _101) << 8 + _10011) << 5 - // i232 = ((_10001 + i219) << 3 + _111) << 7 + _1111 - // i254 = ((i232 << 5 + _1111) << 7 + _11011) << 8 - // i269 = ((_10001 + i254) << 6 + _11111) << 6 + _11101 - // i304 = ((i269 << 9 + _1001) << 5 + _1001) << 19 - // i321 = ((_10111 + i304) << 8 + _1011) << 6 + _10111 - // i337 = ((i321 << 4 + _101) << 4 + 1) << 6 - // i376 = ((_11 + i337) << 29 + 1) << 7 + _101 - // return (2*(i376 << 9 + _10001) + 1) << 45 - // - // Operations: 371 squares 62 multiplies - - // Allocate Temporaries. - var ( - t0 = new(Element) - t1 = new(Element) - t2 = new(Element) - t3 = new(Element) - t4 = new(Element) - t5 = new(Element) - t6 = new(Element) - t7 = new(Element) - t8 = new(Element) - t9 = new(Element) - t10 = new(Element) - t11 = new(Element) - ) - - // var t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11 Element - // Step 1: t6 = x^0x2 - t6.Square(&x) - - // Step 2: t1 = x^0x3 - t1.Mul(&x, t6) - - // Step 3: t5 = x^0x4 - t5.Mul(&x, t1) - - // Step 4: t0 = x^0x5 - t0.Mul(&x, t5) - - // Step 5: t9 = x^0x7 - t9.Mul(t6, t0) - - // Step 6: t4 = x^0x9 - t4.Mul(t6, t9) - - // Step 7: t3 = x^0xb - t3.Mul(t6, t4) - - // Step 8: t8 = x^0xf - t8.Mul(t5, t3) - - // Step 9: z = x^0x11 - z.Mul(t6, t8) - - // Step 10: t10 = x^0x13 - t10.Mul(t6, z) - - // Step 11: t2 = x^0x17 - t2.Mul(t5, t10) - - // Step 12: t7 = x^0x1b - t7.Mul(t5, t2) - - // Step 13: t5 = x^0x1d - t5.Mul(t6, t7) - - // Step 14: t6 = x^0x1f - t6.Mul(t6, t5) - - // Step 15: t11 = x^0x34 - t11.Mul(t2, t5) - - // Step 17: t11 = x^0xd0 - for s := 0; s < 2; s++ { - t11.Square(t11) - } - - // Step 18: t11 = x^0xd7 - t11.Mul(t9, t11) - - // Step 26: t11 = x^0xd700 - for s := 0; s < 8; s++ { - t11.Square(t11) - } - - // Step 27: t11 = x^0xd71d - t11.Mul(t5, t11) - - // Step 34: t11 = x^0x6b8e80 - for s := 0; s < 7; s++ { - t11.Square(t11) - } - - // Step 35: t11 = x^0x6b8e91 - t11.Mul(z, t11) - - // Step 36: t11 = x^0xd71d22 - t11.Square(t11) - - // Step 37: t11 = x^0xd71d23 - t11.Mul(&x, t11) - - // Step 46: t11 = x^0x1ae3a4600 - for s := 0; s < 9; s++ { - t11.Square(t11) - } - - // Step 47: t11 = x^0x1ae3a4617 - t11.Mul(t2, t11) - - // Step 49: t11 = x^0x6b8e9185c - for s := 0; s < 2; s++ { - t11.Square(t11) - } - - // Step 50: t11 = x^0x6b8e9185f - t11.Mul(t1, t11) - - // Step 56: t11 = x^0x1ae3a4617c0 - for s := 0; s < 6; s++ { - t11.Square(t11) - } - - // Step 57: t11 = x^0x1ae3a4617c5 - t11.Mul(t0, t11) - - // Step 61: t11 = x^0x1ae3a4617c50 - for s := 0; s < 4; s++ { - t11.Square(t11) - } - - // Step 62: t11 = x^0x1ae3a4617c51 - t11.Mul(&x, t11) - - // Step 71: t11 = x^0x35c748c2f8a200 - for s := 0; s < 9; s++ { - t11.Square(t11) - } - - // Step 72: t11 = x^0x35c748c2f8a21d - t11.Mul(t5, t11) - - // Step 77: t11 = x^0x6b8e9185f1443a0 - for s := 0; s < 5; s++ { - t11.Square(t11) - } - - // Step 78: t11 = x^0x6b8e9185f1443ab - t11.Mul(t3, t11) - - // Step 83: t11 = x^0xd71d230be2887560 - for s := 0; s < 5; s++ { - t11.Square(t11) - } - - // Step 84: t11 = x^0xd71d230be2887563 - t11.Mul(t1, t11) - - // Step 92: t11 = x^0xd71d230be288756300 - for s := 0; s < 8; s++ { - t11.Square(t11) - } - - // Step 93: t11 = x^0xd71d230be28875631d - t11.Mul(t5, t11) - - // Step 94: t11 = x^0x1ae3a4617c510eac63a - t11.Square(t11) - - // Step 95: t11 = x^0x1ae3a4617c510eac63b - t11.Mul(&x, t11) - - // Step 105: t11 = x^0x6b8e9185f1443ab18ec00 - for s := 0; s < 10; s++ { - t11.Square(t11) - } - - // Step 106: t11 = x^0x6b8e9185f1443ab18ec17 - t11.Mul(t2, t11) - - // Step 118: t11 = x^0x6b8e9185f1443ab18ec17000 - for s := 0; s < 12; s++ { - t11.Square(t11) - } - - // Step 119: t11 = x^0x6b8e9185f1443ab18ec1701b - t11.Mul(t7, t11) - - // Step 124: t11 = x^0xd71d230be28875631d82e0360 - for s := 0; s < 5; s++ { - t11.Square(t11) - } - - // Step 125: t11 = x^0xd71d230be28875631d82e0365 - t11.Mul(t0, t11) - - // Step 132: t11 = x^0x6b8e9185f1443ab18ec1701b280 - for s := 0; s < 7; s++ { - t11.Square(t11) - } - - // Step 133: t11 = x^0x6b8e9185f1443ab18ec1701b285 - t11.Mul(t0, t11) - - // Step 139: t11 = x^0x1ae3a4617c510eac63b05c06ca140 - for s := 0; s < 6; s++ { - t11.Square(t11) - } - - // Step 140: t11 = x^0x1ae3a4617c510eac63b05c06ca149 - t11.Mul(t4, t11) - - // Step 147: t11 = x^0xd71d230be28875631d82e03650a480 - for s := 0; s < 7; s++ { - t11.Square(t11) - } - - // Step 148: t11 = x^0xd71d230be28875631d82e03650a49d - t11.Mul(t5, t11) - - // Step 153: t11 = x^0x1ae3a4617c510eac63b05c06ca1493a0 - for s := 0; s < 5; s++ { - t11.Square(t11) - } - - // Step 154: t11 = x^0x1ae3a4617c510eac63b05c06ca1493b1 - t11.Mul(z, t11) - - // Step 157: t11 = x^0xd71d230be28875631d82e03650a49d88 - for s := 0; s < 3; s++ { - t11.Square(t11) - } - - // Step 158: t11 = x^0xd71d230be28875631d82e03650a49d8d - t11.Mul(t0, t11) - - // Step 166: t11 = x^0xd71d230be28875631d82e03650a49d8d00 - for s := 0; s < 8; s++ { - t11.Square(t11) - } - - // Step 167: t11 = x^0xd71d230be28875631d82e03650a49d8d11 - t11.Mul(z, t11) - - // Step 173: t11 = x^0x35c748c2f8a21d58c760b80d942927634440 - for s := 0; s < 6; s++ { - t11.Square(t11) - } - - // Step 174: t11 = x^0x35c748c2f8a21d58c760b80d94292763445b - t11.Mul(t7, t11) - - // Step 181: t11 = x^0x1ae3a4617c510eac63b05c06ca1493b1a22d80 - for s := 0; s < 7; s++ { - t11.Square(t11) - } - - // Step 182: t11 = x^0x1ae3a4617c510eac63b05c06ca1493b1a22d9f - t11.Mul(t6, t11) - - // Step 186: t11 = x^0x1ae3a4617c510eac63b05c06ca1493b1a22d9f0 - for s := 0; s < 4; s++ { - t11.Square(t11) - } - - // Step 187: t11 = x^0x1ae3a4617c510eac63b05c06ca1493b1a22d9f3 - t11.Mul(t1, t11) - - // Step 199: t11 = x^0x1ae3a4617c510eac63b05c06ca1493b1a22d9f3000 - for s := 0; s < 12; s++ { - t11.Square(t11) - } - - // Step 200: t11 = x^0x1ae3a4617c510eac63b05c06ca1493b1a22d9f300f - t11.Mul(t8, t11) - - // Step 204: t11 = x^0x1ae3a4617c510eac63b05c06ca1493b1a22d9f300f0 - for s := 0; s < 4; s++ { - t11.Square(t11) - } - - // Step 205: t11 = x^0x1ae3a4617c510eac63b05c06ca1493b1a22d9f300f5 - t11.Mul(t0, t11) - - // Step 213: t11 = x^0x1ae3a4617c510eac63b05c06ca1493b1a22d9f300f500 - for s := 0; s < 8; s++ { - t11.Square(t11) - } - - // Step 214: t10 = x^0x1ae3a4617c510eac63b05c06ca1493b1a22d9f300f513 - t10.Mul(t10, t11) - - // Step 219: t10 = x^0x35c748c2f8a21d58c760b80d94292763445b3e601ea260 - for s := 0; s < 5; s++ { - t10.Square(t10) - } - - // Step 220: t10 = x^0x35c748c2f8a21d58c760b80d94292763445b3e601ea271 - t10.Mul(z, t10) - - // Step 223: t10 = x^0x1ae3a4617c510eac63b05c06ca1493b1a22d9f300f51388 - for s := 0; s < 3; s++ { - t10.Square(t10) - } - - // Step 224: t9 = x^0x1ae3a4617c510eac63b05c06ca1493b1a22d9f300f5138f - t9.Mul(t9, t10) - - // Step 231: t9 = x^0xd71d230be28875631d82e03650a49d8d116cf9807a89c780 - for s := 0; s < 7; s++ { - t9.Square(t9) - } - - // Step 232: t9 = x^0xd71d230be28875631d82e03650a49d8d116cf9807a89c78f - t9.Mul(t8, t9) - - // Step 237: t9 = x^0x1ae3a4617c510eac63b05c06ca1493b1a22d9f300f5138f1e0 - for s := 0; s < 5; s++ { - t9.Square(t9) - } - - // Step 238: t8 = x^0x1ae3a4617c510eac63b05c06ca1493b1a22d9f300f5138f1ef - t8.Mul(t8, t9) - - // Step 245: t8 = x^0xd71d230be28875631d82e03650a49d8d116cf9807a89c78f780 - for s := 0; s < 7; s++ { - t8.Square(t8) - } - - // Step 246: t7 = x^0xd71d230be28875631d82e03650a49d8d116cf9807a89c78f79b - t7.Mul(t7, t8) - - // Step 254: t7 = x^0xd71d230be28875631d82e03650a49d8d116cf9807a89c78f79b00 - for s := 0; s < 8; s++ { - t7.Square(t7) - } - - // Step 255: t7 = x^0xd71d230be28875631d82e03650a49d8d116cf9807a89c78f79b11 - t7.Mul(z, t7) - - // Step 261: t7 = x^0x35c748c2f8a21d58c760b80d94292763445b3e601ea271e3de6c440 - for s := 0; s < 6; s++ { - t7.Square(t7) - } - - // Step 262: t6 = x^0x35c748c2f8a21d58c760b80d94292763445b3e601ea271e3de6c45f - t6.Mul(t6, t7) - - // Step 268: t6 = x^0xd71d230be28875631d82e03650a49d8d116cf9807a89c78f79b117c0 - for s := 0; s < 6; s++ { - t6.Square(t6) - } - - // Step 269: t5 = x^0xd71d230be28875631d82e03650a49d8d116cf9807a89c78f79b117dd - t5.Mul(t5, t6) - - // Step 278: t5 = x^0x1ae3a4617c510eac63b05c06ca1493b1a22d9f300f5138f1ef3622fba00 - for s := 0; s < 9; s++ { - t5.Square(t5) - } - - // Step 279: t5 = x^0x1ae3a4617c510eac63b05c06ca1493b1a22d9f300f5138f1ef3622fba09 - t5.Mul(t4, t5) - - // Step 284: t5 = x^0x35c748c2f8a21d58c760b80d94292763445b3e601ea271e3de6c45f74120 - for s := 0; s < 5; s++ { - t5.Square(t5) - } - - // Step 285: t4 = x^0x35c748c2f8a21d58c760b80d94292763445b3e601ea271e3de6c45f74129 - t4.Mul(t4, t5) - - // Step 304: t4 = x^0x1ae3a4617c510eac63b05c06ca1493b1a22d9f300f5138f1ef3622fba09480000 - for s := 0; s < 19; s++ { - t4.Square(t4) - } - - // Step 305: t4 = x^0x1ae3a4617c510eac63b05c06ca1493b1a22d9f300f5138f1ef3622fba09480017 - t4.Mul(t2, t4) - - // Step 313: t4 = x^0x1ae3a4617c510eac63b05c06ca1493b1a22d9f300f5138f1ef3622fba0948001700 - for s := 0; s < 8; s++ { - t4.Square(t4) - } - - // Step 314: t3 = x^0x1ae3a4617c510eac63b05c06ca1493b1a22d9f300f5138f1ef3622fba094800170b - t3.Mul(t3, t4) - - // Step 320: t3 = x^0x6b8e9185f1443ab18ec1701b28524ec688b67cc03d44e3c7bcd88bee82520005c2c0 - for s := 0; s < 6; s++ { - t3.Square(t3) - } - - // Step 321: t2 = x^0x6b8e9185f1443ab18ec1701b28524ec688b67cc03d44e3c7bcd88bee82520005c2d7 - t2.Mul(t2, t3) - - // Step 325: t2 = x^0x6b8e9185f1443ab18ec1701b28524ec688b67cc03d44e3c7bcd88bee82520005c2d70 - for s := 0; s < 4; s++ { - t2.Square(t2) - } - - // Step 326: t2 = x^0x6b8e9185f1443ab18ec1701b28524ec688b67cc03d44e3c7bcd88bee82520005c2d75 - t2.Mul(t0, t2) - - // Step 330: t2 = x^0x6b8e9185f1443ab18ec1701b28524ec688b67cc03d44e3c7bcd88bee82520005c2d750 - for s := 0; s < 4; s++ { - t2.Square(t2) - } - - // Step 331: t2 = x^0x6b8e9185f1443ab18ec1701b28524ec688b67cc03d44e3c7bcd88bee82520005c2d751 - t2.Mul(&x, t2) - - // Step 337: t2 = x^0x1ae3a4617c510eac63b05c06ca1493b1a22d9f300f5138f1ef3622fba094800170b5d440 - for s := 0; s < 6; s++ { - t2.Square(t2) - } - - // Step 338: t1 = x^0x1ae3a4617c510eac63b05c06ca1493b1a22d9f300f5138f1ef3622fba094800170b5d443 - t1.Mul(t1, t2) - - // Step 367: t1 = x^0x35c748c2f8a21d58c760b80d94292763445b3e601ea271e3de6c45f741290002e16ba8860000000 - for s := 0; s < 29; s++ { - t1.Square(t1) - } - - // Step 368: t1 = x^0x35c748c2f8a21d58c760b80d94292763445b3e601ea271e3de6c45f741290002e16ba8860000001 - t1.Mul(&x, t1) - - // Step 375: t1 = x^0x1ae3a4617c510eac63b05c06ca1493b1a22d9f300f5138f1ef3622fba094800170b5d443000000080 - for s := 0; s < 7; s++ { - t1.Square(t1) - } - - // Step 376: t0 = x^0x1ae3a4617c510eac63b05c06ca1493b1a22d9f300f5138f1ef3622fba094800170b5d443000000085 - t0.Mul(t0, t1) - - // Step 385: t0 = x^0x35c748c2f8a21d58c760b80d94292763445b3e601ea271e3de6c45f741290002e16ba88600000010a00 - for s := 0; s < 9; s++ { - t0.Square(t0) - } - - // Step 386: z = x^0x35c748c2f8a21d58c760b80d94292763445b3e601ea271e3de6c45f741290002e16ba88600000010a11 - z.Mul(z, t0) - - // Step 387: z = x^0x6b8e9185f1443ab18ec1701b28524ec688b67cc03d44e3c7bcd88bee82520005c2d7510c00000021422 - z.Square(z) - - // Step 388: z = x^0x6b8e9185f1443ab18ec1701b28524ec688b67cc03d44e3c7bcd88bee82520005c2d7510c00000021423 - z.Mul(&x, z) - - // Step 433: z = x^0xd71d230be28875631d82e03650a49d8d116cf9807a89c78f79b117dd04a4000b85aea2180000004284600000000000 - for s := 0; s < 45; s++ { - z.Square(z) - } - - return z -} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_mul_amd64.s b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_mul_amd64.s deleted file mode 100644 index 3e7650e5a..000000000 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_mul_amd64.s +++ /dev/null @@ -1,857 +0,0 @@ -// +build !purego - -// Copyright 2020 ConsenSys Software 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. - -#include "textflag.h" -#include "funcdata.h" - -// modulus q -DATA q<>+0(SB)/8, $0x8508c00000000001 -DATA q<>+8(SB)/8, $0x170b5d4430000000 -DATA q<>+16(SB)/8, $0x1ef3622fba094800 -DATA q<>+24(SB)/8, $0x1a22d9f300f5138f -DATA q<>+32(SB)/8, $0xc63b05c06ca1493b -DATA q<>+40(SB)/8, $0x01ae3a4617c510ea -GLOBL q<>(SB), (RODATA+NOPTR), $48 - -// qInv0 q'[0] -DATA qInv0<>(SB)/8, $0x8508bfffffffffff -GLOBL qInv0<>(SB), (RODATA+NOPTR), $8 - -#define REDUCE(ra0, ra1, ra2, ra3, ra4, ra5, rb0, rb1, rb2, rb3, rb4, rb5) \ - MOVQ ra0, rb0; \ - SUBQ q<>(SB), ra0; \ - MOVQ ra1, rb1; \ - SBBQ q<>+8(SB), ra1; \ - MOVQ ra2, rb2; \ - SBBQ q<>+16(SB), ra2; \ - MOVQ ra3, rb3; \ - SBBQ q<>+24(SB), ra3; \ - MOVQ ra4, rb4; \ - SBBQ q<>+32(SB), ra4; \ - MOVQ ra5, rb5; \ - SBBQ q<>+40(SB), ra5; \ - CMOVQCS rb0, ra0; \ - CMOVQCS rb1, ra1; \ - CMOVQCS rb2, ra2; \ - CMOVQCS rb3, ra3; \ - CMOVQCS rb4, ra4; \ - CMOVQCS rb5, ra5; \ - -// mul(res, x, y *Element) -TEXT ·mul(SB), $24-24 - - // the algorithm is described in the Element.Mul declaration (.go) - // however, to benefit from the ADCX and ADOX carry chains - // we split the inner loops in 2: - // for i=0 to N-1 - // for j=0 to N-1 - // (A,t[j]) := t[j] + x[j]*y[i] + A - // m := t[0]*q'[0] mod W - // C,_ := t[0] + m*q[0] - // for j=1 to N-1 - // (C,t[j-1]) := t[j] + m*q[j] + C - // t[N-1] = C + A - - NO_LOCAL_POINTERS - CMPB ·supportAdx(SB), $1 - JNE l1 - MOVQ x+8(FP), R8 - - // x[0] -> R10 - // x[1] -> R11 - // x[2] -> R12 - MOVQ 0(R8), R10 - MOVQ 8(R8), R11 - MOVQ 16(R8), R12 - MOVQ y+16(FP), R13 - - // A -> BP - // t[0] -> R14 - // t[1] -> R15 - // t[2] -> CX - // t[3] -> BX - // t[4] -> SI - // t[5] -> DI - // clear the flags - XORQ AX, AX - MOVQ 0(R13), DX - - // (A,t[0]) := x[0]*y[0] + A - MULXQ R10, R14, R15 - - // (A,t[1]) := x[1]*y[0] + A - MULXQ R11, AX, CX - ADOXQ AX, R15 - - // (A,t[2]) := x[2]*y[0] + A - MULXQ R12, AX, BX - ADOXQ AX, CX - - // (A,t[3]) := x[3]*y[0] + A - MULXQ 24(R8), AX, SI - ADOXQ AX, BX - - // (A,t[4]) := x[4]*y[0] + A - MULXQ 32(R8), AX, DI - ADOXQ AX, SI - - // (A,t[5]) := x[5]*y[0] + A - MULXQ 40(R8), AX, BP - ADOXQ AX, DI - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADOXQ AX, BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, R9 - ADCXQ R14, AX - MOVQ R9, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R15, R14 - MULXQ q<>+8(SB), AX, R15 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R15 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R15 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ SI, BX - MULXQ q<>+32(SB), AX, SI - ADOXQ AX, BX - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ DI, SI - MULXQ q<>+40(SB), AX, DI - ADOXQ AX, SI - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, DI - ADOXQ BP, DI - - // clear the flags - XORQ AX, AX - MOVQ 8(R13), DX - - // (A,t[0]) := t[0] + x[0]*y[1] + A - MULXQ R10, AX, BP - ADOXQ AX, R14 - - // (A,t[1]) := t[1] + x[1]*y[1] + A - ADCXQ BP, R15 - MULXQ R11, AX, BP - ADOXQ AX, R15 - - // (A,t[2]) := t[2] + x[2]*y[1] + A - ADCXQ BP, CX - MULXQ R12, AX, BP - ADOXQ AX, CX - - // (A,t[3]) := t[3] + x[3]*y[1] + A - ADCXQ BP, BX - MULXQ 24(R8), AX, BP - ADOXQ AX, BX - - // (A,t[4]) := t[4] + x[4]*y[1] + A - ADCXQ BP, SI - MULXQ 32(R8), AX, BP - ADOXQ AX, SI - - // (A,t[5]) := t[5] + x[5]*y[1] + A - ADCXQ BP, DI - MULXQ 40(R8), AX, BP - ADOXQ AX, DI - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, R9 - ADCXQ R14, AX - MOVQ R9, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R15, R14 - MULXQ q<>+8(SB), AX, R15 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R15 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R15 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ SI, BX - MULXQ q<>+32(SB), AX, SI - ADOXQ AX, BX - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ DI, SI - MULXQ q<>+40(SB), AX, DI - ADOXQ AX, SI - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, DI - ADOXQ BP, DI - - // clear the flags - XORQ AX, AX - MOVQ 16(R13), DX - - // (A,t[0]) := t[0] + x[0]*y[2] + A - MULXQ R10, AX, BP - ADOXQ AX, R14 - - // (A,t[1]) := t[1] + x[1]*y[2] + A - ADCXQ BP, R15 - MULXQ R11, AX, BP - ADOXQ AX, R15 - - // (A,t[2]) := t[2] + x[2]*y[2] + A - ADCXQ BP, CX - MULXQ R12, AX, BP - ADOXQ AX, CX - - // (A,t[3]) := t[3] + x[3]*y[2] + A - ADCXQ BP, BX - MULXQ 24(R8), AX, BP - ADOXQ AX, BX - - // (A,t[4]) := t[4] + x[4]*y[2] + A - ADCXQ BP, SI - MULXQ 32(R8), AX, BP - ADOXQ AX, SI - - // (A,t[5]) := t[5] + x[5]*y[2] + A - ADCXQ BP, DI - MULXQ 40(R8), AX, BP - ADOXQ AX, DI - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, R9 - ADCXQ R14, AX - MOVQ R9, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R15, R14 - MULXQ q<>+8(SB), AX, R15 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R15 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R15 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ SI, BX - MULXQ q<>+32(SB), AX, SI - ADOXQ AX, BX - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ DI, SI - MULXQ q<>+40(SB), AX, DI - ADOXQ AX, SI - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, DI - ADOXQ BP, DI - - // clear the flags - XORQ AX, AX - MOVQ 24(R13), DX - - // (A,t[0]) := t[0] + x[0]*y[3] + A - MULXQ R10, AX, BP - ADOXQ AX, R14 - - // (A,t[1]) := t[1] + x[1]*y[3] + A - ADCXQ BP, R15 - MULXQ R11, AX, BP - ADOXQ AX, R15 - - // (A,t[2]) := t[2] + x[2]*y[3] + A - ADCXQ BP, CX - MULXQ R12, AX, BP - ADOXQ AX, CX - - // (A,t[3]) := t[3] + x[3]*y[3] + A - ADCXQ BP, BX - MULXQ 24(R8), AX, BP - ADOXQ AX, BX - - // (A,t[4]) := t[4] + x[4]*y[3] + A - ADCXQ BP, SI - MULXQ 32(R8), AX, BP - ADOXQ AX, SI - - // (A,t[5]) := t[5] + x[5]*y[3] + A - ADCXQ BP, DI - MULXQ 40(R8), AX, BP - ADOXQ AX, DI - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, R9 - ADCXQ R14, AX - MOVQ R9, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R15, R14 - MULXQ q<>+8(SB), AX, R15 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R15 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R15 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ SI, BX - MULXQ q<>+32(SB), AX, SI - ADOXQ AX, BX - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ DI, SI - MULXQ q<>+40(SB), AX, DI - ADOXQ AX, SI - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, DI - ADOXQ BP, DI - - // clear the flags - XORQ AX, AX - MOVQ 32(R13), DX - - // (A,t[0]) := t[0] + x[0]*y[4] + A - MULXQ R10, AX, BP - ADOXQ AX, R14 - - // (A,t[1]) := t[1] + x[1]*y[4] + A - ADCXQ BP, R15 - MULXQ R11, AX, BP - ADOXQ AX, R15 - - // (A,t[2]) := t[2] + x[2]*y[4] + A - ADCXQ BP, CX - MULXQ R12, AX, BP - ADOXQ AX, CX - - // (A,t[3]) := t[3] + x[3]*y[4] + A - ADCXQ BP, BX - MULXQ 24(R8), AX, BP - ADOXQ AX, BX - - // (A,t[4]) := t[4] + x[4]*y[4] + A - ADCXQ BP, SI - MULXQ 32(R8), AX, BP - ADOXQ AX, SI - - // (A,t[5]) := t[5] + x[5]*y[4] + A - ADCXQ BP, DI - MULXQ 40(R8), AX, BP - ADOXQ AX, DI - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, R9 - ADCXQ R14, AX - MOVQ R9, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R15, R14 - MULXQ q<>+8(SB), AX, R15 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R15 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R15 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ SI, BX - MULXQ q<>+32(SB), AX, SI - ADOXQ AX, BX - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ DI, SI - MULXQ q<>+40(SB), AX, DI - ADOXQ AX, SI - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, DI - ADOXQ BP, DI - - // clear the flags - XORQ AX, AX - MOVQ 40(R13), DX - - // (A,t[0]) := t[0] + x[0]*y[5] + A - MULXQ R10, AX, BP - ADOXQ AX, R14 - - // (A,t[1]) := t[1] + x[1]*y[5] + A - ADCXQ BP, R15 - MULXQ R11, AX, BP - ADOXQ AX, R15 - - // (A,t[2]) := t[2] + x[2]*y[5] + A - ADCXQ BP, CX - MULXQ R12, AX, BP - ADOXQ AX, CX - - // (A,t[3]) := t[3] + x[3]*y[5] + A - ADCXQ BP, BX - MULXQ 24(R8), AX, BP - ADOXQ AX, BX - - // (A,t[4]) := t[4] + x[4]*y[5] + A - ADCXQ BP, SI - MULXQ 32(R8), AX, BP - ADOXQ AX, SI - - // (A,t[5]) := t[5] + x[5]*y[5] + A - ADCXQ BP, DI - MULXQ 40(R8), AX, BP - ADOXQ AX, DI - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, R9 - ADCXQ R14, AX - MOVQ R9, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R15, R14 - MULXQ q<>+8(SB), AX, R15 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R15 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R15 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ SI, BX - MULXQ q<>+32(SB), AX, SI - ADOXQ AX, BX - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ DI, SI - MULXQ q<>+40(SB), AX, DI - ADOXQ AX, SI - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, DI - ADOXQ BP, DI - - // reduce element(R14,R15,CX,BX,SI,DI) using temp registers (R9,R8,R13,R10,R11,R12) - REDUCE(R14,R15,CX,BX,SI,DI,R9,R8,R13,R10,R11,R12) - - MOVQ res+0(FP), AX - MOVQ R14, 0(AX) - MOVQ R15, 8(AX) - MOVQ CX, 16(AX) - MOVQ BX, 24(AX) - MOVQ SI, 32(AX) - MOVQ DI, 40(AX) - RET - -l1: - MOVQ res+0(FP), AX - MOVQ AX, (SP) - MOVQ x+8(FP), AX - MOVQ AX, 8(SP) - MOVQ y+16(FP), AX - MOVQ AX, 16(SP) - CALL ·_mulGeneric(SB) - RET - -TEXT ·fromMont(SB), $8-8 - NO_LOCAL_POINTERS - - // the algorithm is described here - // https://hackmd.io/@gnark/modular_multiplication - // when y = 1 we have: - // for i=0 to N-1 - // t[i] = x[i] - // for i=0 to N-1 - // m := t[0]*q'[0] mod W - // C,_ := t[0] + m*q[0] - // for j=1 to N-1 - // (C,t[j-1]) := t[j] + m*q[j] + C - // t[N-1] = C - CMPB ·supportAdx(SB), $1 - JNE l2 - MOVQ res+0(FP), DX - MOVQ 0(DX), R14 - MOVQ 8(DX), R15 - MOVQ 16(DX), CX - MOVQ 24(DX), BX - MOVQ 32(DX), SI - MOVQ 40(DX), DI - XORQ DX, DX - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R14, AX - MOVQ BP, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R15, R14 - MULXQ q<>+8(SB), AX, R15 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R15 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R15 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ SI, BX - MULXQ q<>+32(SB), AX, SI - ADOXQ AX, BX - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ DI, SI - MULXQ q<>+40(SB), AX, DI - ADOXQ AX, SI - MOVQ $0, AX - ADCXQ AX, DI - ADOXQ AX, DI - XORQ DX, DX - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R14, AX - MOVQ BP, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R15, R14 - MULXQ q<>+8(SB), AX, R15 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R15 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R15 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ SI, BX - MULXQ q<>+32(SB), AX, SI - ADOXQ AX, BX - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ DI, SI - MULXQ q<>+40(SB), AX, DI - ADOXQ AX, SI - MOVQ $0, AX - ADCXQ AX, DI - ADOXQ AX, DI - XORQ DX, DX - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R14, AX - MOVQ BP, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R15, R14 - MULXQ q<>+8(SB), AX, R15 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R15 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R15 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ SI, BX - MULXQ q<>+32(SB), AX, SI - ADOXQ AX, BX - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ DI, SI - MULXQ q<>+40(SB), AX, DI - ADOXQ AX, SI - MOVQ $0, AX - ADCXQ AX, DI - ADOXQ AX, DI - XORQ DX, DX - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R14, AX - MOVQ BP, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R15, R14 - MULXQ q<>+8(SB), AX, R15 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R15 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R15 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ SI, BX - MULXQ q<>+32(SB), AX, SI - ADOXQ AX, BX - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ DI, SI - MULXQ q<>+40(SB), AX, DI - ADOXQ AX, SI - MOVQ $0, AX - ADCXQ AX, DI - ADOXQ AX, DI - XORQ DX, DX - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R14, AX - MOVQ BP, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R15, R14 - MULXQ q<>+8(SB), AX, R15 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R15 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R15 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ SI, BX - MULXQ q<>+32(SB), AX, SI - ADOXQ AX, BX - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ DI, SI - MULXQ q<>+40(SB), AX, DI - ADOXQ AX, SI - MOVQ $0, AX - ADCXQ AX, DI - ADOXQ AX, DI - XORQ DX, DX - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R14, AX - MOVQ BP, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R15, R14 - MULXQ q<>+8(SB), AX, R15 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R15 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R15 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ SI, BX - MULXQ q<>+32(SB), AX, SI - ADOXQ AX, BX - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ DI, SI - MULXQ q<>+40(SB), AX, DI - ADOXQ AX, SI - MOVQ $0, AX - ADCXQ AX, DI - ADOXQ AX, DI - - // reduce element(R14,R15,CX,BX,SI,DI) using temp registers (R8,R9,R10,R11,R12,R13) - REDUCE(R14,R15,CX,BX,SI,DI,R8,R9,R10,R11,R12,R13) - - MOVQ res+0(FP), AX - MOVQ R14, 0(AX) - MOVQ R15, 8(AX) - MOVQ CX, 16(AX) - MOVQ BX, 24(AX) - MOVQ SI, 32(AX) - MOVQ DI, 40(AX) - RET - -l2: - MOVQ res+0(FP), AX - MOVQ AX, (SP) - CALL ·_fromMontGeneric(SB) - RET diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_ops_amd64.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_ops_amd64.go deleted file mode 100644 index 83bba45ae..000000000 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_ops_amd64.go +++ /dev/null @@ -1,107 +0,0 @@ -//go:build !purego -// +build !purego - -// Copyright 2020 ConsenSys Software 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. - -// Code generated by consensys/gnark-crypto DO NOT EDIT - -package fp - -//go:noescape -func MulBy3(x *Element) - -//go:noescape -func MulBy5(x *Element) - -//go:noescape -func MulBy13(x *Element) - -//go:noescape -func mul(res, x, y *Element) - -//go:noescape -func fromMont(res *Element) - -//go:noescape -func reduce(res *Element) - -// Butterfly sets -// -// a = a + b (mod q) -// b = a - b (mod q) -// -//go:noescape -func Butterfly(a, b *Element) - -// Mul z = x * y (mod q) -// -// x and y must be less than q -func (z *Element) Mul(x, y *Element) *Element { - - // Implements CIOS multiplication -- section 2.3.2 of Tolga Acar's thesis - // https://www.microsoft.com/en-us/research/wp-content/uploads/1998/06/97Acar.pdf - // - // The algorithm: - // - // for i=0 to N-1 - // C := 0 - // for j=0 to N-1 - // (C,t[j]) := t[j] + x[j]*y[i] + C - // (t[N+1],t[N]) := t[N] + C - // - // C := 0 - // m := t[0]*q'[0] mod D - // (C,_) := t[0] + m*q[0] - // for j=1 to N-1 - // (C,t[j-1]) := t[j] + m*q[j] + C - // - // (C,t[N-1]) := t[N] + C - // t[N] := t[N+1] + C - // - // → N is the number of machine words needed to store the modulus q - // → D is the word size. For example, on a 64-bit architecture D is 2 64 - // → x[i], y[i], q[i] is the ith word of the numbers x,y,q - // → q'[0] is the lowest word of the number -q⁻¹ mod r. This quantity is pre-computed, as it does not depend on the inputs. - // → t is a temporary array of size N+2 - // → C, S are machine words. A pair (C,S) refers to (hi-bits, lo-bits) of a two-word number - // - // As described here https://hackmd.io/@gnark/modular_multiplication we can get rid of one carry chain and simplify: - // (also described in https://eprint.iacr.org/2022/1400.pdf annex) - // - // for i=0 to N-1 - // (A,t[0]) := t[0] + x[0]*y[i] - // m := t[0]*q'[0] mod W - // C,_ := t[0] + m*q[0] - // for j=1 to N-1 - // (A,t[j]) := t[j] + x[j]*y[i] + A - // (C,t[j-1]) := t[j] + m*q[j] + C - // - // t[N-1] = C + A - // - // This optimization saves 5N + 2 additions in the algorithm, and can be used whenever the highest bit - // of the modulus is zero (and not all of the remaining bits are set). - - mul(z, x, y) - return z -} - -// Square z = x * x (mod q) -// -// x must be less than q -func (z *Element) Square(x *Element) *Element { - // see Mul for doc. - mul(z, x, x) - return z -} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_ops_amd64.s b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_ops_amd64.s deleted file mode 100644 index 7242622a4..000000000 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_ops_amd64.s +++ /dev/null @@ -1,306 +0,0 @@ -// +build !purego - -// Copyright 2020 ConsenSys Software 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. - -#include "textflag.h" -#include "funcdata.h" - -// modulus q -DATA q<>+0(SB)/8, $0x8508c00000000001 -DATA q<>+8(SB)/8, $0x170b5d4430000000 -DATA q<>+16(SB)/8, $0x1ef3622fba094800 -DATA q<>+24(SB)/8, $0x1a22d9f300f5138f -DATA q<>+32(SB)/8, $0xc63b05c06ca1493b -DATA q<>+40(SB)/8, $0x01ae3a4617c510ea -GLOBL q<>(SB), (RODATA+NOPTR), $48 - -// qInv0 q'[0] -DATA qInv0<>(SB)/8, $0x8508bfffffffffff -GLOBL qInv0<>(SB), (RODATA+NOPTR), $8 - -#define REDUCE(ra0, ra1, ra2, ra3, ra4, ra5, rb0, rb1, rb2, rb3, rb4, rb5) \ - MOVQ ra0, rb0; \ - SUBQ q<>(SB), ra0; \ - MOVQ ra1, rb1; \ - SBBQ q<>+8(SB), ra1; \ - MOVQ ra2, rb2; \ - SBBQ q<>+16(SB), ra2; \ - MOVQ ra3, rb3; \ - SBBQ q<>+24(SB), ra3; \ - MOVQ ra4, rb4; \ - SBBQ q<>+32(SB), ra4; \ - MOVQ ra5, rb5; \ - SBBQ q<>+40(SB), ra5; \ - CMOVQCS rb0, ra0; \ - CMOVQCS rb1, ra1; \ - CMOVQCS rb2, ra2; \ - CMOVQCS rb3, ra3; \ - CMOVQCS rb4, ra4; \ - CMOVQCS rb5, ra5; \ - -TEXT ·reduce(SB), NOSPLIT, $0-8 - MOVQ res+0(FP), AX - MOVQ 0(AX), DX - MOVQ 8(AX), CX - MOVQ 16(AX), BX - MOVQ 24(AX), SI - MOVQ 32(AX), DI - MOVQ 40(AX), R8 - - // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R9,R10,R11,R12,R13,R14) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14) - - MOVQ DX, 0(AX) - MOVQ CX, 8(AX) - MOVQ BX, 16(AX) - MOVQ SI, 24(AX) - MOVQ DI, 32(AX) - MOVQ R8, 40(AX) - RET - -// MulBy3(x *Element) -TEXT ·MulBy3(SB), NOSPLIT, $0-8 - MOVQ x+0(FP), AX - MOVQ 0(AX), DX - MOVQ 8(AX), CX - MOVQ 16(AX), BX - MOVQ 24(AX), SI - MOVQ 32(AX), DI - MOVQ 40(AX), R8 - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - ADCQ DI, DI - ADCQ R8, R8 - - // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R9,R10,R11,R12,R13,R14) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14) - - ADDQ 0(AX), DX - ADCQ 8(AX), CX - ADCQ 16(AX), BX - ADCQ 24(AX), SI - ADCQ 32(AX), DI - ADCQ 40(AX), R8 - - // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R15,R9,R10,R11,R12,R13) - REDUCE(DX,CX,BX,SI,DI,R8,R15,R9,R10,R11,R12,R13) - - MOVQ DX, 0(AX) - MOVQ CX, 8(AX) - MOVQ BX, 16(AX) - MOVQ SI, 24(AX) - MOVQ DI, 32(AX) - MOVQ R8, 40(AX) - RET - -// MulBy5(x *Element) -TEXT ·MulBy5(SB), NOSPLIT, $0-8 - MOVQ x+0(FP), AX - MOVQ 0(AX), DX - MOVQ 8(AX), CX - MOVQ 16(AX), BX - MOVQ 24(AX), SI - MOVQ 32(AX), DI - MOVQ 40(AX), R8 - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - ADCQ DI, DI - ADCQ R8, R8 - - // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R9,R10,R11,R12,R13,R14) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14) - - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - ADCQ DI, DI - ADCQ R8, R8 - - // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R15,R9,R10,R11,R12,R13) - REDUCE(DX,CX,BX,SI,DI,R8,R15,R9,R10,R11,R12,R13) - - ADDQ 0(AX), DX - ADCQ 8(AX), CX - ADCQ 16(AX), BX - ADCQ 24(AX), SI - ADCQ 32(AX), DI - ADCQ 40(AX), R8 - - // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R14,R15,R9,R10,R11,R12) - REDUCE(DX,CX,BX,SI,DI,R8,R14,R15,R9,R10,R11,R12) - - MOVQ DX, 0(AX) - MOVQ CX, 8(AX) - MOVQ BX, 16(AX) - MOVQ SI, 24(AX) - MOVQ DI, 32(AX) - MOVQ R8, 40(AX) - RET - -// MulBy13(x *Element) -TEXT ·MulBy13(SB), $40-8 - MOVQ x+0(FP), AX - MOVQ 0(AX), DX - MOVQ 8(AX), CX - MOVQ 16(AX), BX - MOVQ 24(AX), SI - MOVQ 32(AX), DI - MOVQ 40(AX), R8 - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - ADCQ DI, DI - ADCQ R8, R8 - - // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R9,R10,R11,R12,R13,R14) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14) - - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - ADCQ DI, DI - ADCQ R8, R8 - - // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R15,s0-8(SP),s1-16(SP),s2-24(SP),s3-32(SP),s4-40(SP)) - REDUCE(DX,CX,BX,SI,DI,R8,R15,s0-8(SP),s1-16(SP),s2-24(SP),s3-32(SP),s4-40(SP)) - - MOVQ DX, R15 - MOVQ CX, s0-8(SP) - MOVQ BX, s1-16(SP) - MOVQ SI, s2-24(SP) - MOVQ DI, s3-32(SP) - MOVQ R8, s4-40(SP) - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - ADCQ DI, DI - ADCQ R8, R8 - - // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R9,R10,R11,R12,R13,R14) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14) - - ADDQ R15, DX - ADCQ s0-8(SP), CX - ADCQ s1-16(SP), BX - ADCQ s2-24(SP), SI - ADCQ s3-32(SP), DI - ADCQ s4-40(SP), R8 - - // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R9,R10,R11,R12,R13,R14) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14) - - ADDQ 0(AX), DX - ADCQ 8(AX), CX - ADCQ 16(AX), BX - ADCQ 24(AX), SI - ADCQ 32(AX), DI - ADCQ 40(AX), R8 - - // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R9,R10,R11,R12,R13,R14) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14) - - MOVQ DX, 0(AX) - MOVQ CX, 8(AX) - MOVQ BX, 16(AX) - MOVQ SI, 24(AX) - MOVQ DI, 32(AX) - MOVQ R8, 40(AX) - RET - -// Butterfly(a, b *Element) sets a = a + b; b = a - b -TEXT ·Butterfly(SB), $48-16 - MOVQ a+0(FP), AX - MOVQ 0(AX), CX - MOVQ 8(AX), BX - MOVQ 16(AX), SI - MOVQ 24(AX), DI - MOVQ 32(AX), R8 - MOVQ 40(AX), R9 - MOVQ CX, R10 - MOVQ BX, R11 - MOVQ SI, R12 - MOVQ DI, R13 - MOVQ R8, R14 - MOVQ R9, R15 - XORQ AX, AX - MOVQ b+8(FP), DX - ADDQ 0(DX), CX - ADCQ 8(DX), BX - ADCQ 16(DX), SI - ADCQ 24(DX), DI - ADCQ 32(DX), R8 - ADCQ 40(DX), R9 - SUBQ 0(DX), R10 - SBBQ 8(DX), R11 - SBBQ 16(DX), R12 - SBBQ 24(DX), R13 - SBBQ 32(DX), R14 - SBBQ 40(DX), R15 - MOVQ CX, s0-8(SP) - MOVQ BX, s1-16(SP) - MOVQ SI, s2-24(SP) - MOVQ DI, s3-32(SP) - MOVQ R8, s4-40(SP) - MOVQ R9, s5-48(SP) - MOVQ $0x8508c00000000001, CX - MOVQ $0x170b5d4430000000, BX - MOVQ $0x1ef3622fba094800, SI - MOVQ $0x1a22d9f300f5138f, DI - MOVQ $0xc63b05c06ca1493b, R8 - MOVQ $0x01ae3a4617c510ea, R9 - CMOVQCC AX, CX - CMOVQCC AX, BX - CMOVQCC AX, SI - CMOVQCC AX, DI - CMOVQCC AX, R8 - CMOVQCC AX, R9 - ADDQ CX, R10 - ADCQ BX, R11 - ADCQ SI, R12 - ADCQ DI, R13 - ADCQ R8, R14 - ADCQ R9, R15 - MOVQ s0-8(SP), CX - MOVQ s1-16(SP), BX - MOVQ s2-24(SP), SI - MOVQ s3-32(SP), DI - MOVQ s4-40(SP), R8 - MOVQ s5-48(SP), R9 - MOVQ R10, 0(DX) - MOVQ R11, 8(DX) - MOVQ R12, 16(DX) - MOVQ R13, 24(DX) - MOVQ R14, 32(DX) - MOVQ R15, 40(DX) - - // reduce element(CX,BX,SI,DI,R8,R9) using temp registers (R10,R11,R12,R13,R14,R15) - REDUCE(CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14,R15) - - MOVQ a+0(FP), AX - MOVQ CX, 0(AX) - MOVQ BX, 8(AX) - MOVQ SI, 16(AX) - MOVQ DI, 24(AX) - MOVQ R8, 32(AX) - MOVQ R9, 40(AX) - RET diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_ops_purego.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_purego.go similarity index 88% rename from vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_ops_purego.go rename to vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_purego.go index a4c3796b9..8a2e93e99 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_ops_purego.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_purego.go @@ -1,19 +1,7 @@ -//go:build !amd64 || purego -// +build !amd64 purego +//go:build purego || (!amd64 && !arm64) -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -46,14 +34,6 @@ func MulBy13(x *Element) { x.Mul(x, &y) } -// Butterfly sets -// -// a = a + b (mod q) -// b = a - b (mod q) -func Butterfly(a, b *Element) { - _butterflyGeneric(a, b) -} - func fromMont(z *Element) { _fromMontGeneric(z) } @@ -67,48 +47,8 @@ func reduce(z *Element) { // x and y must be less than q func (z *Element) Mul(x, y *Element) *Element { - // Implements CIOS multiplication -- section 2.3.2 of Tolga Acar's thesis - // https://www.microsoft.com/en-us/research/wp-content/uploads/1998/06/97Acar.pdf - // - // The algorithm: - // - // for i=0 to N-1 - // C := 0 - // for j=0 to N-1 - // (C,t[j]) := t[j] + x[j]*y[i] + C - // (t[N+1],t[N]) := t[N] + C - // - // C := 0 - // m := t[0]*q'[0] mod D - // (C,_) := t[0] + m*q[0] - // for j=1 to N-1 - // (C,t[j-1]) := t[j] + m*q[j] + C - // - // (C,t[N-1]) := t[N] + C - // t[N] := t[N+1] + C - // - // → N is the number of machine words needed to store the modulus q - // → D is the word size. For example, on a 64-bit architecture D is 2 64 - // → x[i], y[i], q[i] is the ith word of the numbers x,y,q - // → q'[0] is the lowest word of the number -q⁻¹ mod r. This quantity is pre-computed, as it does not depend on the inputs. - // → t is a temporary array of size N+2 - // → C, S are machine words. A pair (C,S) refers to (hi-bits, lo-bits) of a two-word number - // - // As described here https://hackmd.io/@gnark/modular_multiplication we can get rid of one carry chain and simplify: - // (also described in https://eprint.iacr.org/2022/1400.pdf annex) - // - // for i=0 to N-1 - // (A,t[0]) := t[0] + x[0]*y[i] - // m := t[0]*q'[0] mod W - // C,_ := t[0] + m*q[0] - // for j=1 to N-1 - // (A,t[j]) := t[j] + x[j]*y[i] + A - // (C,t[j-1]) := t[j] + m*q[j] + C - // - // t[N-1] = C + A - // - // This optimization saves 5N + 2 additions in the algorithm, and can be used whenever the highest bit - // of the modulus is zero (and not all of the remaining bits are set). + // Algorithm 2 of "Faster Montgomery Multiplication and Multi-Scalar-Multiplication for SNARKS" + // by Y. El Housni and G. Botrel https://doi.org/10.46586/tches.v2023.i3.504-521 var t0, t1, t2, t3, t4, t5 uint64 var u0, u1, u2, u3, u4, u5 uint64 @@ -743,3 +683,11 @@ func (z *Element) Square(x *Element) *Element { } return z } + +// Butterfly sets +// +// a = a + b (mod q) +// b = a - b (mod q) +func Butterfly(a, b *Element) { + _butterflyGeneric(a, b) +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_utils.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_utils.go index 6da4e95fd..b65d73036 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_utils.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/element_utils.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. package fp diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/vector.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/vector.go index 3fe113710..798d21214 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/vector.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/vector.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -19,9 +8,12 @@ package fp import ( "bytes" "encoding/binary" + "errors" "fmt" "io" + "math/bits" "runtime" + "slices" "strings" "sync" "sync/atomic" @@ -78,40 +70,84 @@ func (vector *Vector) WriteTo(w io.Writer) (int64, error) { return n, nil } -// AsyncReadFrom reads a vector of big endian encoded Element. -// Length of the vector must be encoded as a uint32 on the first 4 bytes. -// It consumes the needed bytes from the reader and returns the number of bytes read and an error if any. -// It also returns a channel that will be closed when the validation is done. -// The validation consist of checking that the elements are smaller than the modulus, and -// converting them to montgomery form. -func (vector *Vector) AsyncReadFrom(r io.Reader) (int64, error, chan error) { +// AsyncReadFrom implements an asynchronous version of [Vector.ReadFrom]. It +// reads the reader r in full and then performs the validation and conversion to +// Montgomery form separately in a goroutine. Any error encountered during +// reading is returned directly, while errors encountered during +// validation/conversion are sent on the returned channel. Thus the caller must +// wait on the channel to ensure the vector is ready to use. The method +// additionally returns the number of bytes read from r. +// +// The errors during reading can be: +// - an error while reading from r; +// - not enough bytes in r to read the full vector indicated by header. +// +// The reader can contain more bytes than needed to decode the vector, in which +// case the extra bytes are ignored. In that case the reader is not seeked nor +// read further. +// +// The method allocates sufficiently large slice to store the vector. If the +// current slice fits the vector, it is reused, otherwise the slice is grown to +// fit the vector. +// +// The serialized encoding is as follows: +// - first 4 bytes: length of the vector as a big-endian uint32 +// - for each element of the vector, [Bytes] bytes representing the element in +// big-endian encoding. +func (vector *Vector) AsyncReadFrom(r io.Reader) (int64, error, chan error) { // nolint ST1008 chErr := make(chan error, 1) var buf [Bytes]byte if read, err := io.ReadFull(r, buf[:4]); err != nil { close(chErr) return int64(read), err, chErr } - sliceLen := binary.BigEndian.Uint32(buf[:4]) - - n := int64(4) - (*vector) = make(Vector, sliceLen) - if sliceLen == 0 { + headerSliceLen := uint64(binary.BigEndian.Uint32(buf[:4])) + + // to avoid allocating too large slice when the header is tampered, we limit + // the maximum allocation. We set the target to 4GB. This incurs a performance + // hit when reading very large slices, but protects against OOM. + targetSize := uint64(1 << 32) // 4GB + if bits.UintSize == 32 { + // reduce target size to 1GB on 32 bits architectures + targetSize = uint64(1 << 30) // 1GB + } + maxAllocateSliceLength := targetSize / uint64(Bytes) + + totalRead := int64(4) + *vector = (*vector)[:0] + if headerSliceLen == 0 { + // if the vector was nil previously even by reslicing we have a nil vector. + // but we want to have an empty slice to indicate that the vector has zero length. + if *vector == nil { + *vector = []Element{} + } + // we return already here to avoid launching a goroutine doing nothing below close(chErr) - return n, nil, chErr + return totalRead, nil, chErr } - bSlice := unsafe.Slice((*byte)(unsafe.Pointer(&(*vector)[0])), sliceLen*Bytes) - read, err := io.ReadFull(r, bSlice) - n += int64(read) - if err != nil { - close(chErr) - return n, err, chErr + for i := uint64(0); i < headerSliceLen; i += maxAllocateSliceLength { + if len(*vector) <= int(i) { + (*vector) = append(*vector, make([]Element, int(min(headerSliceLen-i, maxAllocateSliceLength)))...) + } + bSlice := unsafe.Slice((*byte)(unsafe.Pointer(&(*vector)[i])), int(min(headerSliceLen-i, maxAllocateSliceLength))*Bytes) + read, err := io.ReadFull(r, bSlice) + totalRead += int64(read) + if errors.Is(err, io.ErrUnexpectedEOF) { + close(chErr) + return totalRead, fmt.Errorf("less data than expected: read %d elements, expected %d", i+uint64(read)/Bytes, headerSliceLen), chErr + } + if err != nil { + close(chErr) + return totalRead, err, chErr + } } + bSlice := unsafe.Slice((*byte)(unsafe.Pointer(&(*vector)[0])), int(headerSliceLen)*Bytes) go func() { var cptErrors uint64 // process the elements in parallel - execute(int(sliceLen), func(start, end int) { + execute(int(headerSliceLen), func(start, end int) { var z Element for i := start; i < end; i++ { @@ -140,35 +176,72 @@ func (vector *Vector) AsyncReadFrom(r io.Reader) (int64, error, chan error) { } close(chErr) }() - return n, nil, chErr + return totalRead, nil, chErr } -// ReadFrom implements io.ReaderFrom and reads a vector of big endian encoded Element. -// Length of the vector must be encoded as a uint32 on the first 4 bytes. +// ReadFrom reads the vector from the reader r. It returns the number of bytes +// read and an error, if any. The errors can be: +// - an error while reading from r; +// - not enough bytes in r to read the full vector indicated by header; +// - when decoding the bytes into elements. +// +// The reader can contain more bytes than needed to decode the vector, in which case +// the extra bytes are ignored. In that case the reader is not seeked nor read further. +// +// The method allocates sufficiently large slice to store the vector. If the current slice fits +// the vector, it is reused, otherwise the slice is grown to fit the vector. +// +// The serialized encoding is as follows: +// - first 4 bytes: length of the vector as a big-endian uint32 +// - for each element of the vector, [Bytes] bytes representing the element in big-endian encoding. +// +// The method implements [io.ReaderFrom] interface. func (vector *Vector) ReadFrom(r io.Reader) (int64, error) { - var buf [Bytes]byte if read, err := io.ReadFull(r, buf[:4]); err != nil { return int64(read), err } - sliceLen := binary.BigEndian.Uint32(buf[:4]) - - n := int64(4) - (*vector) = make(Vector, sliceLen) + headerSliceLen := uint64(binary.BigEndian.Uint32(buf[:4])) + + // to avoid allocating too large slice when the header is tampered, we limit + // the maximum allocation. We set the target to 4GB. This incurs a performance + // hit when reading very large slices, but protects against OOM. + targetSize := uint64(1 << 32) // 4GB + if bits.UintSize == 32 { + // reduce target size to 1GB on 32 bits architectures + targetSize = uint64(1 << 30) // 1GB + } + maxAllocateSliceLength := targetSize / uint64(Bytes) + + totalRead := int64(4) // include already the header length + *vector = (*vector)[:0] + // if the vector was nil previously even by reslicing we have a nil vector. But we want + // to have an empty slice to indicate that the vector has zero length. When headerSliceLen == 0 + // we handle this edge case after reading the header as the loop body below is skipped. + if headerSliceLen == 0 && *vector == nil { + *vector = []Element{} + } - for i := 0; i < int(sliceLen); i++ { + for i := uint64(0); i < headerSliceLen; i++ { read, err := io.ReadFull(r, buf[:]) - n += int64(read) + totalRead += int64(read) + if errors.Is(err, io.ErrUnexpectedEOF) { + return totalRead, fmt.Errorf("less data than expected: read %d elements, expected %d", i, headerSliceLen) + } if err != nil { - return n, err + return totalRead, fmt.Errorf("error reading element %d: %w", i, err) } - (*vector)[i], err = BigEndian.Element(&buf) + if uint64(cap(*vector)) <= i { + (*vector) = slices.Grow(*vector, int(min(headerSliceLen-i, maxAllocateSliceLength))) + } + el, err := BigEndian.Element(&buf) if err != nil { - return n, err + return totalRead, fmt.Errorf("error decoding element %d: %w", i, err) } + *vector = append(*vector, el) } - return n, nil + return totalRead, nil } // String implements fmt.Stringer interface @@ -201,6 +274,88 @@ func (vector Vector) Swap(i, j int) { vector[i], vector[j] = vector[j], vector[i] } +// SetRandom sets the elements in vector to independent uniform random values in [0, q). +// +// This might error only if reading from crypto/rand.Reader errors, +// in which case the values in vector are undefined. +func (vector Vector) SetRandom() error { + for i := range vector { + if _, err := vector[i].SetRandom(); err != nil { + return err + } + } + return nil +} + +// MustSetRandom sets the elements in vector to independent uniform random values in [0, q). +// +// It panics if reading from crypto/rand.Reader errors. +func (vector Vector) MustSetRandom() { + for i := range vector { + if _, err := vector[i].SetRandom(); err != nil { + panic(err) + } + } +} + +// Equal returns true if vector and other have the same length and same elements. +func (vector Vector) Equal(other Vector) bool { + return slices.Equal(vector, other) +} + +func addVecGeneric(res, a, b Vector) { + if len(a) != len(b) || len(a) != len(res) { + panic("vector.Add: vectors don't have the same length") + } + for i := 0; i < len(a); i++ { + res[i].Add(&a[i], &b[i]) + } +} + +func subVecGeneric(res, a, b Vector) { + if len(a) != len(b) || len(a) != len(res) { + panic("vector.Sub: vectors don't have the same length") + } + for i := 0; i < len(a); i++ { + res[i].Sub(&a[i], &b[i]) + } +} + +func scalarMulVecGeneric(res, a Vector, b *Element) { + if len(a) != len(res) { + panic("vector.ScalarMul: vectors don't have the same length") + } + for i := 0; i < len(a); i++ { + res[i].Mul(&a[i], b) + } +} + +func sumVecGeneric(res *Element, a Vector) { + for i := 0; i < len(a); i++ { + res.Add(res, &a[i]) + } +} + +func innerProductVecGeneric(res *Element, a, b Vector) { + if len(a) != len(b) { + panic("vector.InnerProduct: vectors don't have the same length") + } + var tmp Element + for i := 0; i < len(a); i++ { + tmp.Mul(&a[i], &b[i]) + res.Add(res, &tmp) + } +} + +func mulVecGeneric(res, a, b Vector) { + if len(a) != len(b) || len(a) != len(res) { + panic("vector.Mul: vectors don't have the same length") + } + for i := 0; i < len(a); i++ { + res[i].Mul(&a[i], &b[i]) + } +} + // TODO @gbotrel make a public package out of that. // execute executes the work function in parallel. // this is copy paste from internal/parallel/parallel.go diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/vector_purego.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/vector_purego.go new file mode 100644 index 000000000..85670501d --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fp/vector_purego.go @@ -0,0 +1,43 @@ +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package fp + +// Add adds two vectors element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) Add(a, b Vector) { + addVecGeneric(*vector, a, b) +} + +// Sub subtracts two vectors element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) Sub(a, b Vector) { + subVecGeneric(*vector, a, b) +} + +// ScalarMul multiplies a vector by a scalar element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) ScalarMul(a Vector, b *Element) { + scalarMulVecGeneric(*vector, a, b) +} + +// Sum computes the sum of all elements in the vector. +func (vector *Vector) Sum() (res Element) { + sumVecGeneric(&res, *vector) + return +} + +// InnerProduct computes the inner product of two vectors. +// It panics if the vectors don't have the same length. +func (vector *Vector) InnerProduct(other Vector) (res Element) { + innerProductVecGeneric(&res, *vector, other) + return +} + +// Mul multiplies two vectors element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) Mul(a, b Vector) { + mulVecGeneric(*vector, a, b) +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/arith.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/arith.go index 7cfd55da1..8dbae56e3 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/arith.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/arith.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -58,16 +47,3 @@ func madd3(a, b, c, d, e uint64) (hi uint64, lo uint64) { hi, _ = bits.Add64(hi, e, carry) return } -func max(a int, b int) int { - if a > b { - return a - } - return b -} - -func min(a int, b int) int { - if a < b { - return a - } - return b -} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/asm.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/asm.go deleted file mode 100644 index da061913b..000000000 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/asm.go +++ /dev/null @@ -1,27 +0,0 @@ -//go:build !noadx -// +build !noadx - -// Copyright 2020 ConsenSys Software 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. - -// Code generated by consensys/gnark-crypto DO NOT EDIT - -package fr - -import "golang.org/x/sys/cpu" - -var ( - supportAdx = cpu.X86.HasADX && cpu.X86.HasBMI2 - _ = supportAdx -) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/asm_noadx.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/asm_noadx.go deleted file mode 100644 index 7f52ffa19..000000000 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/asm_noadx.go +++ /dev/null @@ -1,28 +0,0 @@ -//go:build noadx -// +build noadx - -// Copyright 2020 ConsenSys Software 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. - -// Code generated by consensys/gnark-crypto DO NOT EDIT - -package fr - -// note: this is needed for test purposes, as dynamically changing supportAdx doesn't flag -// certain errors (like fatal error: missing stackmap) -// this ensures we test all asm path. -var ( - supportAdx = false - _ = supportAdx -) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/doc.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/doc.go index 08f1a0ba2..50e4ef635 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/doc.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/doc.go @@ -1,22 +1,13 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT // Package fr contains field arithmetic operations for modulus = 0x12ab65...000001. // -// The API is similar to math/big (big.Int), but the operations are significantly faster (up to 20x for the modular multiplication on amd64, see also https://hackmd.io/@gnark/modular_multiplication) +// The API is similar to math/big (big.Int), but the operations are significantly faster (up to 20x). +// +// Additionally fr.Vector offers an API to manipulate []Element using AVX512 instructions if available. // // The modulus is hardcoded in all the operations. // @@ -49,5 +40,7 @@ // // # Warning // -// This code has not been audited and is provided as-is. In particular, there is no security guarantees such as constant time implementation or side-channel attack resistance. +// There is no security guarantees such as constant time implementation or side-channel attack resistance. +// This code is provided as-is. Partially audited, see https://github.com/Consensys/gnark/tree/master/audits +// for more details. package fr diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element.go index 07be74489..76f7f2f08 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -54,10 +43,10 @@ const ( // Field modulus q const ( - q0 uint64 = 725501752471715841 - q1 uint64 = 6461107452199829505 - q2 uint64 = 6968279316240510977 - q3 uint64 = 1345280370688173398 + q0 = 725501752471715841 + q1 = 6461107452199829505 + q2 = 6968279316240510977 + q3 = 1345280370688173398 ) var qElement = Element{ @@ -79,7 +68,10 @@ func Modulus() *big.Int { // q + r'.r = 1, i.e., qInvNeg = - q⁻¹ mod r // used for Montgomery reduction -const qInvNeg uint64 = 725501752471715839 +const qInvNeg = 725501752471715839 + +// mu = 2^288 / q needed for partial Barrett reduction +const mu uint64 = 58893420465 func init() { _modulus.SetString("12ab655e9a2ca55660b44d1e5c37b00159aa76fed00000010a11800000000001", 16) @@ -129,7 +121,7 @@ func (z *Element) Set(x *Element) *Element { } // SetInterface converts provided interface into Element -// returns an error if provided type is not supported +// returns an error if provided type is not supported. // supported types: // // Element @@ -350,6 +342,16 @@ func (z *Element) SetRandom() (*Element, error) { } } +// MustSetRandom sets z to a uniform random value in [0, q). +// +// It panics if reading from crypto/rand.Reader errors. +func (z *Element) MustSetRandom() *Element { + if _, err := z.SetRandom(); err != nil { + panic(err) + } + return z +} + // smallerThanModulus returns true if z < q // This is not constant time func (z *Element) smallerThanModulus() bool { @@ -477,32 +479,8 @@ func (z *Element) Select(c int, x0 *Element, x1 *Element) *Element { // and is used for testing purposes. func _mulGeneric(z, x, y *Element) { - // Implements CIOS multiplication -- section 2.3.2 of Tolga Acar's thesis - // https://www.microsoft.com/en-us/research/wp-content/uploads/1998/06/97Acar.pdf - // - // The algorithm: - // - // for i=0 to N-1 - // C := 0 - // for j=0 to N-1 - // (C,t[j]) := t[j] + x[j]*y[i] + C - // (t[N+1],t[N]) := t[N] + C - // - // C := 0 - // m := t[0]*q'[0] mod D - // (C,_) := t[0] + m*q[0] - // for j=1 to N-1 - // (C,t[j-1]) := t[j] + m*q[j] + C - // - // (C,t[N-1]) := t[N] + C - // t[N] := t[N+1] + C - // - // → N is the number of machine words needed to store the modulus q - // → D is the word size. For example, on a 64-bit architecture D is 2 64 - // → x[i], y[i], q[i] is the ith word of the numbers x,y,q - // → q'[0] is the lowest word of the number -q⁻¹ mod r. This quantity is pre-computed, as it does not depend on the inputs. - // → t is a temporary array of size N+2 - // → C, S are machine words. A pair (C,S) refers to (hi-bits, lo-bits) of a two-word number + // Algorithm 2 of "Faster Montgomery Multiplication and Multi-Scalar-Multiplication for SNARKS" + // by Y. El Housni and G. Botrel https://doi.org/10.46586/tches.v2023.i3.504-521 var t [5]uint64 var D uint64 @@ -960,7 +938,7 @@ func (z *Element) SetBigInt(v *big.Int) *Element { // v == 0 return z } else if c != 1 && v.Cmp(&zero) != -1 { - // 0 < v < q + // 0 <= v < q return z.setBigInt(v) } @@ -1087,6 +1065,8 @@ type ByteOrder interface { String() string } +var errInvalidEncoding = errors.New("invalid fr.Element encoding") + // BigEndian is the big-endian implementation of ByteOrder and AppendByteOrder. var BigEndian bigEndian @@ -1102,7 +1082,7 @@ func (bigEndian) Element(b *[Bytes]byte) (Element, error) { z[3] = binary.BigEndian.Uint64((*b)[0:8]) if !z.smallerThanModulus() { - return Element{}, errors.New("invalid fr.Element encoding") + return Element{}, errInvalidEncoding } z.toMont() @@ -1132,7 +1112,7 @@ func (littleEndian) Element(b *[Bytes]byte) (Element, error) { z[3] = binary.LittleEndian.Uint64((*b)[24:32]) if !z.smallerThanModulus() { - return Element{}, errors.New("invalid fr.Element encoding") + return Element{}, errInvalidEncoding } z.toMont() @@ -1151,19 +1131,168 @@ func (littleEndian) String() string { return "LittleEndian" } // Legendre returns the Legendre symbol of z (either +1, -1, or 0.) func (z *Element) Legendre() int { - var l Element - // z^((q-1)/2) - l.expByLegendreExp(*z) - if l.IsZero() { - return 0 + // Adapts "Optimized Binary GCD for Modular Inversion" + // https://github.com/pornin/bingcd/blob/main/doc/bingcd.pdf + // For a faithful implementation of Pornin20 see [Inverse]. + + // We don't need to account for z being in Montgomery form. + // (xR|q) = (x|q)(R|q). R is a square (an even power of 2), so (R|q) = 1. + a := *z + b := Element{ + q0, + q1, + q2, + q3, + } // b := q + + // Update factors: we get [a; b] ← [f₀ g₀; f₁ g₁] [a; b] + // cᵢ = fᵢ + 2³¹ - 1 + 2³² * (gᵢ + 2³¹ - 1) + var c0, c1 int64 + + var s Element + + l := 1 // loop invariant: (x|q) = (a|b) . l + // This means that every time a and b are updated into a' and b', + // l is updated into l' = (x|q)(a'|b')=(x|q)(a|b)(a|b)(a'|b') = l (a|b)(a'|b') + // During the algorithm's run, there is no guarantee that b remains prime, or even positive. + // Therefore, we use the properties of the Kronecker symbol, a generalization of the Legendre symbol to all integers. + + for !a.IsZero() { + n := max(a.BitLen(), b.BitLen()) + aApprox, bApprox := approximateForLegendre(&a, n), approximateForLegendre(&b, n) + + // f₀, g₀, f₁, g₁ = 1, 0, 0, 1 + c0, c1 = updateFactorIdentityMatrixRow0, updateFactorIdentityMatrixRow1 + + const nbIterations = k - 2 + // running fewer iterations because we need access to 3 low bits from b, rather than 1 in the inversion algorithm + for range nbIterations { + + if aApprox&1 == 0 { + aApprox /= 2 + + // update the Kronecker symbol + // + // (a/2 | b) (2|b) = (a|b) + // + // b is either odd or zero, the latter case implying a non-trivial GCD and an ultimate result of 0, + // regardless of what value l holds. + // So in updating l, we may assume that b is odd. + // Since a is even, we only need to correctly compute l if b is odd. + // if b is also even, the non-trivial GCD will result in the function returning 0 anyway. + // so we may here assume b is odd. + // (2|b) = 1 if b ≡ 1 or 7 (mod 8), and -1 if b ≡ 3 or 5 (mod 8) + if bMod8 := bApprox & 7; bMod8 == 3 || bMod8 == 5 { + l = -l + } + + } else { + s, borrow := bits.Sub64(aApprox, bApprox, 0) + if borrow == 1 { + // Compute (b-a|a) + // (x-y|z) = (x|z) unless z < 0 and sign(x-y) ≠ sign(x) + // Pornin20 asserts that at least one of a and b is non-negative. + // If a is non-negative, we immediately get (b-a|a) = (b|a) + // If a is negative, b-a > b. But b is already non-negative, so the b-a and b have the same sign. + // Thus in that case also (b-a|a) = (b|a) + // Since not both a and b are negative, we get a quadratic reciprocity law + // like that of the Legendre symbol: (b|a) = (a|b), unless a, b ≡ 3 (mod 4), in which case (b|a) = -(a|b) + if bApprox&3 == 3 && aApprox&3 == 3 { + l = -l + } + + s = bApprox - aApprox + bApprox = aApprox + c0, c1 = c1, c0 + } + + aApprox = s / 2 + c0 = c0 - c1 + + // update l to reflect halving a, just like in the case where a is even + if bMod8 := bApprox & 7; bMod8 == 3 || bMod8 == 5 { + l = -l + } + } + + c1 *= 2 + } + + s = a + + var g0 int64 + // from this point on c0 aliases for f0 + c0, g0 = updateFactorsDecompose(c0) + aHi := a.linearCombNonModular(&s, c0, &b, g0) + if aHi&signBitSelector != 0 { + // if aHi < 0 + aHi = negL(&a, aHi) + // Since a is negative, b is not and hence b ≠ -1 + // So we get (-a|b)=(-1|b)(a|b) + // b is odd so we get (-1|b) = 1 if b ≡ 1 (mod 4) and -1 otherwise. + if bApprox&3 == 3 { // we still have two valid lower bits for b + l = -l + } + } + // right-shift a by k-2 bits + a[0] = (a[0] >> nbIterations) | ((a[1]) << (2*k - nbIterations)) + a[1] = (a[1] >> nbIterations) | ((a[2]) << (2*k - nbIterations)) + a[2] = (a[2] >> nbIterations) | ((a[3]) << (2*k - nbIterations)) + a[3] = (a[3] >> nbIterations) | (aHi << (2*k - nbIterations)) + + var f1 int64 + // from this point on c1 aliases for g0 + f1, c1 = updateFactorsDecompose(c1) + bHi := b.linearCombNonModular(&s, f1, &b, c1) + if bHi&signBitSelector != 0 { + // if bHi < 0 + bHi = negL(&b, bHi) + // no need to update l, since we know a ≥ 0 + // (a|-1) = 1 if a ≥ 0 + } + // right-shift b by k-2 bits + b[0] = (b[0] >> nbIterations) | ((b[1]) << (2*k - nbIterations)) + b[1] = (b[1] >> nbIterations) | ((b[2]) << (2*k - nbIterations)) + b[2] = (b[2] >> nbIterations) | ((b[3]) << (2*k - nbIterations)) + b[3] = (b[3] >> nbIterations) | (bHi << (2*k - nbIterations)) } - // if l == 1 - if l.IsOne() { - return 1 + if b[0] == 1 && (b[1]|b[2]|b[3]) == 0 { + return l // (0|1) = 1 + } else { + return 0 // if b ≠ 1, then (z,q) ≠ 0 ⇒ (z|q) = 0 + } +} + +// approximate a big number x into a single 64 bit word using its uppermost and lowermost bits. +// If x fits in a word as is, no approximation necessary. +// This differs from the standard approximate function in that in the Legendre symbol computation +// we need to access the 3 low bits of b, rather than just one. So lo ≥ n+2 where n is the number of inner iterations. +// The requirement on the high bits is unchanged, hi ≥ n+1. +// Thus we hit a maximum of hi = lo = k and n = k-2 as opposed to n = lo = k-1 and hi = k+1 in the standard approximate function. +// Since we are doing fewer iterations than in the inversion algorithm, all the arguments on bounds for update factors remain valid. +func approximateForLegendre(x *Element, nBits int) uint64 { + + if nBits <= 64 { + return x[0] } - return -1 + + const mask = (uint64(1) << k) - 1 // k ones + lo := mask & x[0] + + hiWordIndex := (nBits - 1) / 64 + + hiWordBitsAvailable := nBits - hiWordIndex*64 + hiWordBitsUsed := min(hiWordBitsAvailable, k) + + mask_ := uint64(^((1 << (hiWordBitsAvailable - hiWordBitsUsed)) - 1)) + hi := (x[hiWordIndex] & mask_) << (64 - hiWordBitsAvailable) + + mask_ = ^(1<<(k+hiWordBitsUsed) - 1) + mid := (mask_ & x[hiWordIndex-1]) >> hiWordBitsUsed + + return lo | mid | hi } // Sqrt z = √x (mod q) @@ -1431,7 +1560,7 @@ func approximate(x *Element, nBits int) uint64 { return x[0] } - const mask = (uint64(1) << (k - 1)) - 1 // k-1 ones + const mask = (uint64(1) << approxLowBitsN) - 1 // k-1 ones lo := mask & x[0] hiWordIndex := (nBits - 1) / 64 diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_amd64.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_amd64.go new file mode 100644 index 000000000..c282ebc9f --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_amd64.go @@ -0,0 +1,62 @@ +//go:build !purego + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package fr + +import ( + _ "github.com/consensys/gnark-crypto/field/asm/element_4w" + "github.com/consensys/gnark-crypto/utils/cpu" +) + +var supportAdx = cpu.SupportADX + +//go:noescape +func MulBy3(x *Element) + +//go:noescape +func MulBy5(x *Element) + +//go:noescape +func MulBy13(x *Element) + +//go:noescape +func mul(res, x, y *Element) + +//go:noescape +func fromMont(res *Element) + +//go:noescape +func reduce(res *Element) + +// Butterfly sets +// +// a = a + b (mod q) +// b = a - b (mod q) +// +//go:noescape +func Butterfly(a, b *Element) + +// Mul z = x * y (mod q) +// +// x and y must be less than q +func (z *Element) Mul(x, y *Element) *Element { + + // Algorithm 2 of "Faster Montgomery Multiplication and Multi-Scalar-Multiplication for SNARKS" + // by Y. El Housni and G. Botrel https://doi.org/10.46586/tches.v2023.i3.504-521 + + mul(z, x, y) + return z +} + +// Square z = x * x (mod q) +// +// x must be less than q +func (z *Element) Square(x *Element) *Element { + // see Mul for doc. + mul(z, x, x) + return z +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_amd64.s b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_amd64.s new file mode 100644 index 000000000..512d87236 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_amd64.s @@ -0,0 +1,10 @@ +//go:build !purego + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +// We include the hash to force the Go compiler to recompile: 6029369087367900835 +#include "../../../field/asm/element_4w/element_4w_amd64.s" + diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_arm64.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_arm64.go new file mode 100644 index 000000000..fc8002317 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_arm64.go @@ -0,0 +1,70 @@ +//go:build !purego + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package fr + +import ( + _ "github.com/consensys/gnark-crypto/field/asm/element_4w" +) + +// Butterfly sets +// +// a = a + b (mod q) +// b = a - b (mod q) +// +//go:noescape +func Butterfly(a, b *Element) + +//go:noescape +func mul(res, x, y *Element) + +// Mul z = x * y (mod q) +// +// x and y must be less than q +func (z *Element) Mul(x, y *Element) *Element { + mul(z, x, y) + return z +} + +// Square z = x * x (mod q) +// +// x must be less than q +func (z *Element) Square(x *Element) *Element { + // see Mul for doc. + mul(z, x, x) + return z +} + +// MulBy3 x *= 3 (mod q) +func MulBy3(x *Element) { + _x := *x + x.Double(x).Add(x, &_x) +} + +// MulBy5 x *= 5 (mod q) +func MulBy5(x *Element) { + _x := *x + x.Double(x).Double(x).Add(x, &_x) +} + +// MulBy13 x *= 13 (mod q) +func MulBy13(x *Element) { + var y = Element{ + 18434640649710993230, + 12067750152132099910, + 14024878721438555919, + 347766975729306096, + } + x.Mul(x, &y) +} + +func fromMont(z *Element) { + _fromMontGeneric(z) +} + +//go:noescape +func reduce(res *Element) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_arm64.s b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_arm64.s new file mode 100644 index 000000000..c8df07e34 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_arm64.s @@ -0,0 +1,10 @@ +//go:build !purego + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +// We include the hash to force the Go compiler to recompile: 1501560133179981797 +#include "../../../field/asm/element_4w/element_4w_arm64.s" + diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_exp.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_exp.go index 654ea55fa..45cce700a 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_exp.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_exp.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -315,309 +304,3 @@ func (z *Element) expBySqrtExp(x Element) *Element { return z } - -// expByLegendreExp is equivalent to z.Exp(x, 955b2af4d1652ab305a268f2e1bd800acd53b7f680000008508c00000000000) -// -// uses github.com/mmcloughlin/addchain v0.4.0 to generate a shorter addition chain -func (z *Element) expByLegendreExp(x Element) *Element { - // addition chain: - // - // _10 = 2*1 - // _11 = 1 + _10 - // _101 = _10 + _11 - // _110 = 1 + _101 - // _1000 = _10 + _110 - // _10000 = 2*_1000 - // _10110 = _110 + _10000 - // _100000 = 2*_10000 - // _100011 = _11 + _100000 - // _101011 = _1000 + _100011 - // _101101 = _10 + _101011 - // _1011010 = 2*_101101 - // _1011011 = 1 + _1011010 - // _1111011 = _100000 + _1011011 - // _10000101 = _101011 + _1011010 - // _10001011 = _110 + _10000101 - // _10100101 = _100000 + _10000101 - // _10101011 = _110 + _10100101 - // _11000001 = _10110 + _10101011 - // _11000011 = _10 + _11000001 - // _11010001 = _10000 + _11000001 - // _11010011 = _10 + _11010001 - // _11010101 = _10 + _11010011 - // _11100101 = _10000 + _11010101 - // _11101101 = _1000 + _11100101 - // i45 = ((_10000101 + _10100101) << 7 + _1011011) << 10 + _10101011 - // i74 = ((i45 << 8 + _11010011) << 9 + _10001011) << 10 - // i94 = ((_10100101 + i74) << 7 + _101011) << 10 + _11000001 - // i123 = ((i94 << 9 + _11010001) << 10 + _11010001) << 8 - // i142 = ((_11100101 + i123) << 8 + _11000011) << 8 + _1111011 - // i181 = ((i142 << 17 + _101011) << 10 + _11010101) << 10 - // i195 = ((_11101101 + i181) << 8 + _11101101 + _10000) << 3 - // i243 = ((_101 + i195) << 35 + _10000101) << 10 + _100011 - // return i243 << 46 - // - // Operations: 247 squares 42 multiplies - - // Allocate Temporaries. - var ( - t0 = new(Element) - t1 = new(Element) - t2 = new(Element) - t3 = new(Element) - t4 = new(Element) - t5 = new(Element) - t6 = new(Element) - t7 = new(Element) - t8 = new(Element) - t9 = new(Element) - t10 = new(Element) - t11 = new(Element) - t12 = new(Element) - t13 = new(Element) - t14 = new(Element) - t15 = new(Element) - t16 = new(Element) - ) - - // var t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16 Element - // Step 1: t4 = x^0x2 - t4.Square(&x) - - // Step 2: z = x^0x3 - z.Mul(&x, t4) - - // Step 3: t1 = x^0x5 - t1.Mul(t4, z) - - // Step 4: t8 = x^0x6 - t8.Mul(&x, t1) - - // Step 5: t3 = x^0x8 - t3.Mul(t4, t8) - - // Step 6: t2 = x^0x10 - t2.Square(t3) - - // Step 7: t7 = x^0x16 - t7.Mul(t8, t2) - - // Step 8: t9 = x^0x20 - t9.Square(t2) - - // Step 9: z = x^0x23 - z.Mul(z, t9) - - // Step 10: t5 = x^0x2b - t5.Mul(t3, z) - - // Step 11: t0 = x^0x2d - t0.Mul(t4, t5) - - // Step 12: t0 = x^0x5a - t0.Square(t0) - - // Step 13: t15 = x^0x5b - t15.Mul(&x, t0) - - // Step 14: t6 = x^0x7b - t6.Mul(t9, t15) - - // Step 15: t0 = x^0x85 - t0.Mul(t5, t0) - - // Step 16: t12 = x^0x8b - t12.Mul(t8, t0) - - // Step 17: t11 = x^0xa5 - t11.Mul(t9, t0) - - // Step 18: t14 = x^0xab - t14.Mul(t8, t11) - - // Step 19: t10 = x^0xc1 - t10.Mul(t7, t14) - - // Step 20: t7 = x^0xc3 - t7.Mul(t4, t10) - - // Step 21: t9 = x^0xd1 - t9.Mul(t2, t10) - - // Step 22: t13 = x^0xd3 - t13.Mul(t4, t9) - - // Step 23: t4 = x^0xd5 - t4.Mul(t4, t13) - - // Step 24: t8 = x^0xe5 - t8.Mul(t2, t4) - - // Step 25: t3 = x^0xed - t3.Mul(t3, t8) - - // Step 26: t16 = x^0x12a - t16.Mul(t0, t11) - - // Step 33: t16 = x^0x9500 - for s := 0; s < 7; s++ { - t16.Square(t16) - } - - // Step 34: t15 = x^0x955b - t15.Mul(t15, t16) - - // Step 44: t15 = x^0x2556c00 - for s := 0; s < 10; s++ { - t15.Square(t15) - } - - // Step 45: t14 = x^0x2556cab - t14.Mul(t14, t15) - - // Step 53: t14 = x^0x2556cab00 - for s := 0; s < 8; s++ { - t14.Square(t14) - } - - // Step 54: t13 = x^0x2556cabd3 - t13.Mul(t13, t14) - - // Step 63: t13 = x^0x4aad957a600 - for s := 0; s < 9; s++ { - t13.Square(t13) - } - - // Step 64: t12 = x^0x4aad957a68b - t12.Mul(t12, t13) - - // Step 74: t12 = x^0x12ab655e9a2c00 - for s := 0; s < 10; s++ { - t12.Square(t12) - } - - // Step 75: t11 = x^0x12ab655e9a2ca5 - t11.Mul(t11, t12) - - // Step 82: t11 = x^0x955b2af4d165280 - for s := 0; s < 7; s++ { - t11.Square(t11) - } - - // Step 83: t11 = x^0x955b2af4d1652ab - t11.Mul(t5, t11) - - // Step 93: t11 = x^0x2556cabd34594aac00 - for s := 0; s < 10; s++ { - t11.Square(t11) - } - - // Step 94: t10 = x^0x2556cabd34594aacc1 - t10.Mul(t10, t11) - - // Step 103: t10 = x^0x4aad957a68b295598200 - for s := 0; s < 9; s++ { - t10.Square(t10) - } - - // Step 104: t10 = x^0x4aad957a68b2955982d1 - t10.Mul(t9, t10) - - // Step 114: t10 = x^0x12ab655e9a2ca55660b4400 - for s := 0; s < 10; s++ { - t10.Square(t10) - } - - // Step 115: t9 = x^0x12ab655e9a2ca55660b44d1 - t9.Mul(t9, t10) - - // Step 123: t9 = x^0x12ab655e9a2ca55660b44d100 - for s := 0; s < 8; s++ { - t9.Square(t9) - } - - // Step 124: t8 = x^0x12ab655e9a2ca55660b44d1e5 - t8.Mul(t8, t9) - - // Step 132: t8 = x^0x12ab655e9a2ca55660b44d1e500 - for s := 0; s < 8; s++ { - t8.Square(t8) - } - - // Step 133: t7 = x^0x12ab655e9a2ca55660b44d1e5c3 - t7.Mul(t7, t8) - - // Step 141: t7 = x^0x12ab655e9a2ca55660b44d1e5c300 - for s := 0; s < 8; s++ { - t7.Square(t7) - } - - // Step 142: t6 = x^0x12ab655e9a2ca55660b44d1e5c37b - t6.Mul(t6, t7) - - // Step 159: t6 = x^0x2556cabd34594aacc1689a3cb86f60000 - for s := 0; s < 17; s++ { - t6.Square(t6) - } - - // Step 160: t5 = x^0x2556cabd34594aacc1689a3cb86f6002b - t5.Mul(t5, t6) - - // Step 170: t5 = x^0x955b2af4d1652ab305a268f2e1bd800ac00 - for s := 0; s < 10; s++ { - t5.Square(t5) - } - - // Step 171: t4 = x^0x955b2af4d1652ab305a268f2e1bd800acd5 - t4.Mul(t4, t5) - - // Step 181: t4 = x^0x2556cabd34594aacc1689a3cb86f6002b35400 - for s := 0; s < 10; s++ { - t4.Square(t4) - } - - // Step 182: t4 = x^0x2556cabd34594aacc1689a3cb86f6002b354ed - t4.Mul(t3, t4) - - // Step 190: t4 = x^0x2556cabd34594aacc1689a3cb86f6002b354ed00 - for s := 0; s < 8; s++ { - t4.Square(t4) - } - - // Step 191: t3 = x^0x2556cabd34594aacc1689a3cb86f6002b354eded - t3.Mul(t3, t4) - - // Step 192: t2 = x^0x2556cabd34594aacc1689a3cb86f6002b354edfd - t2.Mul(t2, t3) - - // Step 195: t2 = x^0x12ab655e9a2ca55660b44d1e5c37b00159aa76fe8 - for s := 0; s < 3; s++ { - t2.Square(t2) - } - - // Step 196: t1 = x^0x12ab655e9a2ca55660b44d1e5c37b00159aa76fed - t1.Mul(t1, t2) - - // Step 231: t1 = x^0x955b2af4d1652ab305a268f2e1bd800acd53b7f6800000000 - for s := 0; s < 35; s++ { - t1.Square(t1) - } - - // Step 232: t0 = x^0x955b2af4d1652ab305a268f2e1bd800acd53b7f6800000085 - t0.Mul(t0, t1) - - // Step 242: t0 = x^0x2556cabd34594aacc1689a3cb86f6002b354edfda00000021400 - for s := 0; s < 10; s++ { - t0.Square(t0) - } - - // Step 243: z = x^0x2556cabd34594aacc1689a3cb86f6002b354edfda00000021423 - z.Mul(z, t0) - - // Step 289: z = x^0x955b2af4d1652ab305a268f2e1bd800acd53b7f680000008508c00000000000 - for s := 0; s < 46; s++ { - z.Square(z) - } - - return z -} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_mul_amd64.s b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_mul_amd64.s deleted file mode 100644 index dc601e91e..000000000 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_mul_amd64.s +++ /dev/null @@ -1,487 +0,0 @@ -// +build !purego - -// Copyright 2020 ConsenSys Software 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. - -#include "textflag.h" -#include "funcdata.h" - -// modulus q -DATA q<>+0(SB)/8, $0x0a11800000000001 -DATA q<>+8(SB)/8, $0x59aa76fed0000001 -DATA q<>+16(SB)/8, $0x60b44d1e5c37b001 -DATA q<>+24(SB)/8, $0x12ab655e9a2ca556 -GLOBL q<>(SB), (RODATA+NOPTR), $32 - -// qInv0 q'[0] -DATA qInv0<>(SB)/8, $0x0a117fffffffffff -GLOBL qInv0<>(SB), (RODATA+NOPTR), $8 - -#define REDUCE(ra0, ra1, ra2, ra3, rb0, rb1, rb2, rb3) \ - MOVQ ra0, rb0; \ - SUBQ q<>(SB), ra0; \ - MOVQ ra1, rb1; \ - SBBQ q<>+8(SB), ra1; \ - MOVQ ra2, rb2; \ - SBBQ q<>+16(SB), ra2; \ - MOVQ ra3, rb3; \ - SBBQ q<>+24(SB), ra3; \ - CMOVQCS rb0, ra0; \ - CMOVQCS rb1, ra1; \ - CMOVQCS rb2, ra2; \ - CMOVQCS rb3, ra3; \ - -// mul(res, x, y *Element) -TEXT ·mul(SB), $24-24 - - // the algorithm is described in the Element.Mul declaration (.go) - // however, to benefit from the ADCX and ADOX carry chains - // we split the inner loops in 2: - // for i=0 to N-1 - // for j=0 to N-1 - // (A,t[j]) := t[j] + x[j]*y[i] + A - // m := t[0]*q'[0] mod W - // C,_ := t[0] + m*q[0] - // for j=1 to N-1 - // (C,t[j-1]) := t[j] + m*q[j] + C - // t[N-1] = C + A - - NO_LOCAL_POINTERS - CMPB ·supportAdx(SB), $1 - JNE l1 - MOVQ x+8(FP), SI - - // x[0] -> DI - // x[1] -> R8 - // x[2] -> R9 - // x[3] -> R10 - MOVQ 0(SI), DI - MOVQ 8(SI), R8 - MOVQ 16(SI), R9 - MOVQ 24(SI), R10 - MOVQ y+16(FP), R11 - - // A -> BP - // t[0] -> R14 - // t[1] -> R13 - // t[2] -> CX - // t[3] -> BX - // clear the flags - XORQ AX, AX - MOVQ 0(R11), DX - - // (A,t[0]) := x[0]*y[0] + A - MULXQ DI, R14, R13 - - // (A,t[1]) := x[1]*y[0] + A - MULXQ R8, AX, CX - ADOXQ AX, R13 - - // (A,t[2]) := x[2]*y[0] + A - MULXQ R9, AX, BX - ADOXQ AX, CX - - // (A,t[3]) := x[3]*y[0] + A - MULXQ R10, AX, BP - ADOXQ AX, BX - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADOXQ AX, BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, R12 - ADCXQ R14, AX - MOVQ R12, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // t[3] = C + A - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ BP, BX - - // clear the flags - XORQ AX, AX - MOVQ 8(R11), DX - - // (A,t[0]) := t[0] + x[0]*y[1] + A - MULXQ DI, AX, BP - ADOXQ AX, R14 - - // (A,t[1]) := t[1] + x[1]*y[1] + A - ADCXQ BP, R13 - MULXQ R8, AX, BP - ADOXQ AX, R13 - - // (A,t[2]) := t[2] + x[2]*y[1] + A - ADCXQ BP, CX - MULXQ R9, AX, BP - ADOXQ AX, CX - - // (A,t[3]) := t[3] + x[3]*y[1] + A - ADCXQ BP, BX - MULXQ R10, AX, BP - ADOXQ AX, BX - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, R12 - ADCXQ R14, AX - MOVQ R12, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // t[3] = C + A - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ BP, BX - - // clear the flags - XORQ AX, AX - MOVQ 16(R11), DX - - // (A,t[0]) := t[0] + x[0]*y[2] + A - MULXQ DI, AX, BP - ADOXQ AX, R14 - - // (A,t[1]) := t[1] + x[1]*y[2] + A - ADCXQ BP, R13 - MULXQ R8, AX, BP - ADOXQ AX, R13 - - // (A,t[2]) := t[2] + x[2]*y[2] + A - ADCXQ BP, CX - MULXQ R9, AX, BP - ADOXQ AX, CX - - // (A,t[3]) := t[3] + x[3]*y[2] + A - ADCXQ BP, BX - MULXQ R10, AX, BP - ADOXQ AX, BX - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, R12 - ADCXQ R14, AX - MOVQ R12, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // t[3] = C + A - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ BP, BX - - // clear the flags - XORQ AX, AX - MOVQ 24(R11), DX - - // (A,t[0]) := t[0] + x[0]*y[3] + A - MULXQ DI, AX, BP - ADOXQ AX, R14 - - // (A,t[1]) := t[1] + x[1]*y[3] + A - ADCXQ BP, R13 - MULXQ R8, AX, BP - ADOXQ AX, R13 - - // (A,t[2]) := t[2] + x[2]*y[3] + A - ADCXQ BP, CX - MULXQ R9, AX, BP - ADOXQ AX, CX - - // (A,t[3]) := t[3] + x[3]*y[3] + A - ADCXQ BP, BX - MULXQ R10, AX, BP - ADOXQ AX, BX - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, R12 - ADCXQ R14, AX - MOVQ R12, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // t[3] = C + A - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ BP, BX - - // reduce element(R14,R13,CX,BX) using temp registers (SI,R12,R11,DI) - REDUCE(R14,R13,CX,BX,SI,R12,R11,DI) - - MOVQ res+0(FP), AX - MOVQ R14, 0(AX) - MOVQ R13, 8(AX) - MOVQ CX, 16(AX) - MOVQ BX, 24(AX) - RET - -l1: - MOVQ res+0(FP), AX - MOVQ AX, (SP) - MOVQ x+8(FP), AX - MOVQ AX, 8(SP) - MOVQ y+16(FP), AX - MOVQ AX, 16(SP) - CALL ·_mulGeneric(SB) - RET - -TEXT ·fromMont(SB), $8-8 - NO_LOCAL_POINTERS - - // the algorithm is described here - // https://hackmd.io/@gnark/modular_multiplication - // when y = 1 we have: - // for i=0 to N-1 - // t[i] = x[i] - // for i=0 to N-1 - // m := t[0]*q'[0] mod W - // C,_ := t[0] + m*q[0] - // for j=1 to N-1 - // (C,t[j-1]) := t[j] + m*q[j] + C - // t[N-1] = C - CMPB ·supportAdx(SB), $1 - JNE l2 - MOVQ res+0(FP), DX - MOVQ 0(DX), R14 - MOVQ 8(DX), R13 - MOVQ 16(DX), CX - MOVQ 24(DX), BX - XORQ DX, DX - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R14, AX - MOVQ BP, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ AX, BX - XORQ DX, DX - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R14, AX - MOVQ BP, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ AX, BX - XORQ DX, DX - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R14, AX - MOVQ BP, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ AX, BX - XORQ DX, DX - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R14, AX - MOVQ BP, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ AX, BX - - // reduce element(R14,R13,CX,BX) using temp registers (SI,DI,R8,R9) - REDUCE(R14,R13,CX,BX,SI,DI,R8,R9) - - MOVQ res+0(FP), AX - MOVQ R14, 0(AX) - MOVQ R13, 8(AX) - MOVQ CX, 16(AX) - MOVQ BX, 24(AX) - RET - -l2: - MOVQ res+0(FP), AX - MOVQ AX, (SP) - CALL ·_fromMontGeneric(SB) - RET diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_ops_amd64.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_ops_amd64.go deleted file mode 100644 index e40a9caed..000000000 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_ops_amd64.go +++ /dev/null @@ -1,107 +0,0 @@ -//go:build !purego -// +build !purego - -// Copyright 2020 ConsenSys Software 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. - -// Code generated by consensys/gnark-crypto DO NOT EDIT - -package fr - -//go:noescape -func MulBy3(x *Element) - -//go:noescape -func MulBy5(x *Element) - -//go:noescape -func MulBy13(x *Element) - -//go:noescape -func mul(res, x, y *Element) - -//go:noescape -func fromMont(res *Element) - -//go:noescape -func reduce(res *Element) - -// Butterfly sets -// -// a = a + b (mod q) -// b = a - b (mod q) -// -//go:noescape -func Butterfly(a, b *Element) - -// Mul z = x * y (mod q) -// -// x and y must be less than q -func (z *Element) Mul(x, y *Element) *Element { - - // Implements CIOS multiplication -- section 2.3.2 of Tolga Acar's thesis - // https://www.microsoft.com/en-us/research/wp-content/uploads/1998/06/97Acar.pdf - // - // The algorithm: - // - // for i=0 to N-1 - // C := 0 - // for j=0 to N-1 - // (C,t[j]) := t[j] + x[j]*y[i] + C - // (t[N+1],t[N]) := t[N] + C - // - // C := 0 - // m := t[0]*q'[0] mod D - // (C,_) := t[0] + m*q[0] - // for j=1 to N-1 - // (C,t[j-1]) := t[j] + m*q[j] + C - // - // (C,t[N-1]) := t[N] + C - // t[N] := t[N+1] + C - // - // → N is the number of machine words needed to store the modulus q - // → D is the word size. For example, on a 64-bit architecture D is 2 64 - // → x[i], y[i], q[i] is the ith word of the numbers x,y,q - // → q'[0] is the lowest word of the number -q⁻¹ mod r. This quantity is pre-computed, as it does not depend on the inputs. - // → t is a temporary array of size N+2 - // → C, S are machine words. A pair (C,S) refers to (hi-bits, lo-bits) of a two-word number - // - // As described here https://hackmd.io/@gnark/modular_multiplication we can get rid of one carry chain and simplify: - // (also described in https://eprint.iacr.org/2022/1400.pdf annex) - // - // for i=0 to N-1 - // (A,t[0]) := t[0] + x[0]*y[i] - // m := t[0]*q'[0] mod W - // C,_ := t[0] + m*q[0] - // for j=1 to N-1 - // (A,t[j]) := t[j] + x[j]*y[i] + A - // (C,t[j-1]) := t[j] + m*q[j] + C - // - // t[N-1] = C + A - // - // This optimization saves 5N + 2 additions in the algorithm, and can be used whenever the highest bit - // of the modulus is zero (and not all of the remaining bits are set). - - mul(z, x, y) - return z -} - -// Square z = x * x (mod q) -// -// x must be less than q -func (z *Element) Square(x *Element) *Element { - // see Mul for doc. - mul(z, x, x) - return z -} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_ops_amd64.s b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_ops_amd64.s deleted file mode 100644 index afe75ff25..000000000 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_ops_amd64.s +++ /dev/null @@ -1,230 +0,0 @@ -// +build !purego - -// Copyright 2020 ConsenSys Software 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. - -#include "textflag.h" -#include "funcdata.h" - -// modulus q -DATA q<>+0(SB)/8, $0x0a11800000000001 -DATA q<>+8(SB)/8, $0x59aa76fed0000001 -DATA q<>+16(SB)/8, $0x60b44d1e5c37b001 -DATA q<>+24(SB)/8, $0x12ab655e9a2ca556 -GLOBL q<>(SB), (RODATA+NOPTR), $32 - -// qInv0 q'[0] -DATA qInv0<>(SB)/8, $0x0a117fffffffffff -GLOBL qInv0<>(SB), (RODATA+NOPTR), $8 - -#define REDUCE(ra0, ra1, ra2, ra3, rb0, rb1, rb2, rb3) \ - MOVQ ra0, rb0; \ - SUBQ q<>(SB), ra0; \ - MOVQ ra1, rb1; \ - SBBQ q<>+8(SB), ra1; \ - MOVQ ra2, rb2; \ - SBBQ q<>+16(SB), ra2; \ - MOVQ ra3, rb3; \ - SBBQ q<>+24(SB), ra3; \ - CMOVQCS rb0, ra0; \ - CMOVQCS rb1, ra1; \ - CMOVQCS rb2, ra2; \ - CMOVQCS rb3, ra3; \ - -TEXT ·reduce(SB), NOSPLIT, $0-8 - MOVQ res+0(FP), AX - MOVQ 0(AX), DX - MOVQ 8(AX), CX - MOVQ 16(AX), BX - MOVQ 24(AX), SI - - // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10) - - MOVQ DX, 0(AX) - MOVQ CX, 8(AX) - MOVQ BX, 16(AX) - MOVQ SI, 24(AX) - RET - -// MulBy3(x *Element) -TEXT ·MulBy3(SB), NOSPLIT, $0-8 - MOVQ x+0(FP), AX - MOVQ 0(AX), DX - MOVQ 8(AX), CX - MOVQ 16(AX), BX - MOVQ 24(AX), SI - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - - // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10) - - ADDQ 0(AX), DX - ADCQ 8(AX), CX - ADCQ 16(AX), BX - ADCQ 24(AX), SI - - // reduce element(DX,CX,BX,SI) using temp registers (R11,R12,R13,R14) - REDUCE(DX,CX,BX,SI,R11,R12,R13,R14) - - MOVQ DX, 0(AX) - MOVQ CX, 8(AX) - MOVQ BX, 16(AX) - MOVQ SI, 24(AX) - RET - -// MulBy5(x *Element) -TEXT ·MulBy5(SB), NOSPLIT, $0-8 - MOVQ x+0(FP), AX - MOVQ 0(AX), DX - MOVQ 8(AX), CX - MOVQ 16(AX), BX - MOVQ 24(AX), SI - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - - // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10) - - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - - // reduce element(DX,CX,BX,SI) using temp registers (R11,R12,R13,R14) - REDUCE(DX,CX,BX,SI,R11,R12,R13,R14) - - ADDQ 0(AX), DX - ADCQ 8(AX), CX - ADCQ 16(AX), BX - ADCQ 24(AX), SI - - // reduce element(DX,CX,BX,SI) using temp registers (R15,DI,R8,R9) - REDUCE(DX,CX,BX,SI,R15,DI,R8,R9) - - MOVQ DX, 0(AX) - MOVQ CX, 8(AX) - MOVQ BX, 16(AX) - MOVQ SI, 24(AX) - RET - -// MulBy13(x *Element) -TEXT ·MulBy13(SB), NOSPLIT, $0-8 - MOVQ x+0(FP), AX - MOVQ 0(AX), DX - MOVQ 8(AX), CX - MOVQ 16(AX), BX - MOVQ 24(AX), SI - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - - // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10) - - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - - // reduce element(DX,CX,BX,SI) using temp registers (R11,R12,R13,R14) - REDUCE(DX,CX,BX,SI,R11,R12,R13,R14) - - MOVQ DX, R11 - MOVQ CX, R12 - MOVQ BX, R13 - MOVQ SI, R14 - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - - // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10) - - ADDQ R11, DX - ADCQ R12, CX - ADCQ R13, BX - ADCQ R14, SI - - // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10) - - ADDQ 0(AX), DX - ADCQ 8(AX), CX - ADCQ 16(AX), BX - ADCQ 24(AX), SI - - // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10) - - MOVQ DX, 0(AX) - MOVQ CX, 8(AX) - MOVQ BX, 16(AX) - MOVQ SI, 24(AX) - RET - -// Butterfly(a, b *Element) sets a = a + b; b = a - b -TEXT ·Butterfly(SB), NOSPLIT, $0-16 - MOVQ a+0(FP), AX - MOVQ 0(AX), CX - MOVQ 8(AX), BX - MOVQ 16(AX), SI - MOVQ 24(AX), DI - MOVQ CX, R8 - MOVQ BX, R9 - MOVQ SI, R10 - MOVQ DI, R11 - XORQ AX, AX - MOVQ b+8(FP), DX - ADDQ 0(DX), CX - ADCQ 8(DX), BX - ADCQ 16(DX), SI - ADCQ 24(DX), DI - SUBQ 0(DX), R8 - SBBQ 8(DX), R9 - SBBQ 16(DX), R10 - SBBQ 24(DX), R11 - MOVQ $0x0a11800000000001, R12 - MOVQ $0x59aa76fed0000001, R13 - MOVQ $0x60b44d1e5c37b001, R14 - MOVQ $0x12ab655e9a2ca556, R15 - CMOVQCC AX, R12 - CMOVQCC AX, R13 - CMOVQCC AX, R14 - CMOVQCC AX, R15 - ADDQ R12, R8 - ADCQ R13, R9 - ADCQ R14, R10 - ADCQ R15, R11 - MOVQ R8, 0(DX) - MOVQ R9, 8(DX) - MOVQ R10, 16(DX) - MOVQ R11, 24(DX) - - // reduce element(CX,BX,SI,DI) using temp registers (R8,R9,R10,R11) - REDUCE(CX,BX,SI,DI,R8,R9,R10,R11) - - MOVQ a+0(FP), AX - MOVQ CX, 0(AX) - MOVQ BX, 8(AX) - MOVQ SI, 16(AX) - MOVQ DI, 24(AX) - RET diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_ops_purego.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_purego.go similarity index 80% rename from vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_ops_purego.go rename to vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_purego.go index fe434ed61..537648f3d 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_ops_purego.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/element_purego.go @@ -1,19 +1,7 @@ -//go:build !amd64 || purego -// +build !amd64 purego +//go:build purego || (!amd64 && !arm64) -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -44,14 +32,6 @@ func MulBy13(x *Element) { x.Mul(x, &y) } -// Butterfly sets -// -// a = a + b (mod q) -// b = a - b (mod q) -func Butterfly(a, b *Element) { - _butterflyGeneric(a, b) -} - func fromMont(z *Element) { _fromMontGeneric(z) } @@ -65,48 +45,8 @@ func reduce(z *Element) { // x and y must be less than q func (z *Element) Mul(x, y *Element) *Element { - // Implements CIOS multiplication -- section 2.3.2 of Tolga Acar's thesis - // https://www.microsoft.com/en-us/research/wp-content/uploads/1998/06/97Acar.pdf - // - // The algorithm: - // - // for i=0 to N-1 - // C := 0 - // for j=0 to N-1 - // (C,t[j]) := t[j] + x[j]*y[i] + C - // (t[N+1],t[N]) := t[N] + C - // - // C := 0 - // m := t[0]*q'[0] mod D - // (C,_) := t[0] + m*q[0] - // for j=1 to N-1 - // (C,t[j-1]) := t[j] + m*q[j] + C - // - // (C,t[N-1]) := t[N] + C - // t[N] := t[N+1] + C - // - // → N is the number of machine words needed to store the modulus q - // → D is the word size. For example, on a 64-bit architecture D is 2 64 - // → x[i], y[i], q[i] is the ith word of the numbers x,y,q - // → q'[0] is the lowest word of the number -q⁻¹ mod r. This quantity is pre-computed, as it does not depend on the inputs. - // → t is a temporary array of size N+2 - // → C, S are machine words. A pair (C,S) refers to (hi-bits, lo-bits) of a two-word number - // - // As described here https://hackmd.io/@gnark/modular_multiplication we can get rid of one carry chain and simplify: - // (also described in https://eprint.iacr.org/2022/1400.pdf annex) - // - // for i=0 to N-1 - // (A,t[0]) := t[0] + x[0]*y[i] - // m := t[0]*q'[0] mod W - // C,_ := t[0] + m*q[0] - // for j=1 to N-1 - // (A,t[j]) := t[j] + x[j]*y[i] + A - // (C,t[j-1]) := t[j] + m*q[j] + C - // - // t[N-1] = C + A - // - // This optimization saves 5N + 2 additions in the algorithm, and can be used whenever the highest bit - // of the modulus is zero (and not all of the remaining bits are set). + // Algorithm 2 of "Faster Montgomery Multiplication and Multi-Scalar-Multiplication for SNARKS" + // by Y. El Housni and G. Botrel https://doi.org/10.46586/tches.v2023.i3.504-521 var t0, t1, t2, t3 uint64 var u0, u1, u2, u3 uint64 @@ -441,3 +381,11 @@ func (z *Element) Square(x *Element) *Element { } return z } + +// Butterfly sets +// +// a = a + b (mod q) +// b = a - b (mod q) +func Butterfly(a, b *Element) { + _butterflyGeneric(a, b) +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/generator.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/generator.go new file mode 100644 index 000000000..7ca9c27bb --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/generator.go @@ -0,0 +1,36 @@ +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package fr + +import ( + "fmt" + "math/big" + "math/bits" + + "github.com/consensys/gnark-crypto/ecc" +) + +// Generator returns a generator for Z/2^(log(m))Z +// or an error if m is too big (required root of unity doesn't exist) +func Generator(m uint64) (Element, error) { + x := ecc.NextPowerOfTwo(m) + + var rootOfUnity Element + + rootOfUnity.SetString("8065159656716812877374967518403273466521432693661810619979959746626482506078") + const maxOrderRoot uint64 = 47 + + // find generator for Z/2^(log(m))Z + logx := uint64(bits.TrailingZeros64(x)) + if logx > maxOrderRoot { + return Element{}, fmt.Errorf("m (%d) is too big: the required root of unity does not exist", m) + } + + expo := uint64(1 << (maxOrderRoot - logx)) + var generator Element + generator.Exp(rootOfUnity, big.NewInt(int64(expo))) // order x + return generator, nil +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/vector.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/vector.go index 00ad8a898..eee2062de 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/vector.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/vector.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -19,9 +8,12 @@ package fr import ( "bytes" "encoding/binary" + "errors" "fmt" "io" + "math/bits" "runtime" + "slices" "strings" "sync" "sync/atomic" @@ -78,40 +70,84 @@ func (vector *Vector) WriteTo(w io.Writer) (int64, error) { return n, nil } -// AsyncReadFrom reads a vector of big endian encoded Element. -// Length of the vector must be encoded as a uint32 on the first 4 bytes. -// It consumes the needed bytes from the reader and returns the number of bytes read and an error if any. -// It also returns a channel that will be closed when the validation is done. -// The validation consist of checking that the elements are smaller than the modulus, and -// converting them to montgomery form. -func (vector *Vector) AsyncReadFrom(r io.Reader) (int64, error, chan error) { +// AsyncReadFrom implements an asynchronous version of [Vector.ReadFrom]. It +// reads the reader r in full and then performs the validation and conversion to +// Montgomery form separately in a goroutine. Any error encountered during +// reading is returned directly, while errors encountered during +// validation/conversion are sent on the returned channel. Thus the caller must +// wait on the channel to ensure the vector is ready to use. The method +// additionally returns the number of bytes read from r. +// +// The errors during reading can be: +// - an error while reading from r; +// - not enough bytes in r to read the full vector indicated by header. +// +// The reader can contain more bytes than needed to decode the vector, in which +// case the extra bytes are ignored. In that case the reader is not seeked nor +// read further. +// +// The method allocates sufficiently large slice to store the vector. If the +// current slice fits the vector, it is reused, otherwise the slice is grown to +// fit the vector. +// +// The serialized encoding is as follows: +// - first 4 bytes: length of the vector as a big-endian uint32 +// - for each element of the vector, [Bytes] bytes representing the element in +// big-endian encoding. +func (vector *Vector) AsyncReadFrom(r io.Reader) (int64, error, chan error) { // nolint ST1008 chErr := make(chan error, 1) var buf [Bytes]byte if read, err := io.ReadFull(r, buf[:4]); err != nil { close(chErr) return int64(read), err, chErr } - sliceLen := binary.BigEndian.Uint32(buf[:4]) - - n := int64(4) - (*vector) = make(Vector, sliceLen) - if sliceLen == 0 { + headerSliceLen := uint64(binary.BigEndian.Uint32(buf[:4])) + + // to avoid allocating too large slice when the header is tampered, we limit + // the maximum allocation. We set the target to 4GB. This incurs a performance + // hit when reading very large slices, but protects against OOM. + targetSize := uint64(1 << 32) // 4GB + if bits.UintSize == 32 { + // reduce target size to 1GB on 32 bits architectures + targetSize = uint64(1 << 30) // 1GB + } + maxAllocateSliceLength := targetSize / uint64(Bytes) + + totalRead := int64(4) + *vector = (*vector)[:0] + if headerSliceLen == 0 { + // if the vector was nil previously even by reslicing we have a nil vector. + // but we want to have an empty slice to indicate that the vector has zero length. + if *vector == nil { + *vector = []Element{} + } + // we return already here to avoid launching a goroutine doing nothing below close(chErr) - return n, nil, chErr + return totalRead, nil, chErr } - bSlice := unsafe.Slice((*byte)(unsafe.Pointer(&(*vector)[0])), sliceLen*Bytes) - read, err := io.ReadFull(r, bSlice) - n += int64(read) - if err != nil { - close(chErr) - return n, err, chErr + for i := uint64(0); i < headerSliceLen; i += maxAllocateSliceLength { + if len(*vector) <= int(i) { + (*vector) = append(*vector, make([]Element, int(min(headerSliceLen-i, maxAllocateSliceLength)))...) + } + bSlice := unsafe.Slice((*byte)(unsafe.Pointer(&(*vector)[i])), int(min(headerSliceLen-i, maxAllocateSliceLength))*Bytes) + read, err := io.ReadFull(r, bSlice) + totalRead += int64(read) + if errors.Is(err, io.ErrUnexpectedEOF) { + close(chErr) + return totalRead, fmt.Errorf("less data than expected: read %d elements, expected %d", i+uint64(read)/Bytes, headerSliceLen), chErr + } + if err != nil { + close(chErr) + return totalRead, err, chErr + } } + bSlice := unsafe.Slice((*byte)(unsafe.Pointer(&(*vector)[0])), int(headerSliceLen)*Bytes) go func() { var cptErrors uint64 // process the elements in parallel - execute(int(sliceLen), func(start, end int) { + execute(int(headerSliceLen), func(start, end int) { var z Element for i := start; i < end; i++ { @@ -138,35 +174,72 @@ func (vector *Vector) AsyncReadFrom(r io.Reader) (int64, error, chan error) { } close(chErr) }() - return n, nil, chErr + return totalRead, nil, chErr } -// ReadFrom implements io.ReaderFrom and reads a vector of big endian encoded Element. -// Length of the vector must be encoded as a uint32 on the first 4 bytes. +// ReadFrom reads the vector from the reader r. It returns the number of bytes +// read and an error, if any. The errors can be: +// - an error while reading from r; +// - not enough bytes in r to read the full vector indicated by header; +// - when decoding the bytes into elements. +// +// The reader can contain more bytes than needed to decode the vector, in which case +// the extra bytes are ignored. In that case the reader is not seeked nor read further. +// +// The method allocates sufficiently large slice to store the vector. If the current slice fits +// the vector, it is reused, otherwise the slice is grown to fit the vector. +// +// The serialized encoding is as follows: +// - first 4 bytes: length of the vector as a big-endian uint32 +// - for each element of the vector, [Bytes] bytes representing the element in big-endian encoding. +// +// The method implements [io.ReaderFrom] interface. func (vector *Vector) ReadFrom(r io.Reader) (int64, error) { - var buf [Bytes]byte if read, err := io.ReadFull(r, buf[:4]); err != nil { return int64(read), err } - sliceLen := binary.BigEndian.Uint32(buf[:4]) - - n := int64(4) - (*vector) = make(Vector, sliceLen) + headerSliceLen := uint64(binary.BigEndian.Uint32(buf[:4])) + + // to avoid allocating too large slice when the header is tampered, we limit + // the maximum allocation. We set the target to 4GB. This incurs a performance + // hit when reading very large slices, but protects against OOM. + targetSize := uint64(1 << 32) // 4GB + if bits.UintSize == 32 { + // reduce target size to 1GB on 32 bits architectures + targetSize = uint64(1 << 30) // 1GB + } + maxAllocateSliceLength := targetSize / uint64(Bytes) + + totalRead := int64(4) // include already the header length + *vector = (*vector)[:0] + // if the vector was nil previously even by reslicing we have a nil vector. But we want + // to have an empty slice to indicate that the vector has zero length. When headerSliceLen == 0 + // we handle this edge case after reading the header as the loop body below is skipped. + if headerSliceLen == 0 && *vector == nil { + *vector = []Element{} + } - for i := 0; i < int(sliceLen); i++ { + for i := uint64(0); i < headerSliceLen; i++ { read, err := io.ReadFull(r, buf[:]) - n += int64(read) + totalRead += int64(read) + if errors.Is(err, io.ErrUnexpectedEOF) { + return totalRead, fmt.Errorf("less data than expected: read %d elements, expected %d", i, headerSliceLen) + } if err != nil { - return n, err + return totalRead, fmt.Errorf("error reading element %d: %w", i, err) } - (*vector)[i], err = BigEndian.Element(&buf) + if uint64(cap(*vector)) <= i { + (*vector) = slices.Grow(*vector, int(min(headerSliceLen-i, maxAllocateSliceLength))) + } + el, err := BigEndian.Element(&buf) if err != nil { - return n, err + return totalRead, fmt.Errorf("error decoding element %d: %w", i, err) } + *vector = append(*vector, el) } - return n, nil + return totalRead, nil } // String implements fmt.Stringer interface @@ -199,6 +272,88 @@ func (vector Vector) Swap(i, j int) { vector[i], vector[j] = vector[j], vector[i] } +// SetRandom sets the elements in vector to independent uniform random values in [0, q). +// +// This might error only if reading from crypto/rand.Reader errors, +// in which case the values in vector are undefined. +func (vector Vector) SetRandom() error { + for i := range vector { + if _, err := vector[i].SetRandom(); err != nil { + return err + } + } + return nil +} + +// MustSetRandom sets the elements in vector to independent uniform random values in [0, q). +// +// It panics if reading from crypto/rand.Reader errors. +func (vector Vector) MustSetRandom() { + for i := range vector { + if _, err := vector[i].SetRandom(); err != nil { + panic(err) + } + } +} + +// Equal returns true if vector and other have the same length and same elements. +func (vector Vector) Equal(other Vector) bool { + return slices.Equal(vector, other) +} + +func addVecGeneric(res, a, b Vector) { + if len(a) != len(b) || len(a) != len(res) { + panic("vector.Add: vectors don't have the same length") + } + for i := 0; i < len(a); i++ { + res[i].Add(&a[i], &b[i]) + } +} + +func subVecGeneric(res, a, b Vector) { + if len(a) != len(b) || len(a) != len(res) { + panic("vector.Sub: vectors don't have the same length") + } + for i := 0; i < len(a); i++ { + res[i].Sub(&a[i], &b[i]) + } +} + +func scalarMulVecGeneric(res, a Vector, b *Element) { + if len(a) != len(res) { + panic("vector.ScalarMul: vectors don't have the same length") + } + for i := 0; i < len(a); i++ { + res[i].Mul(&a[i], b) + } +} + +func sumVecGeneric(res *Element, a Vector) { + for i := 0; i < len(a); i++ { + res.Add(res, &a[i]) + } +} + +func innerProductVecGeneric(res *Element, a, b Vector) { + if len(a) != len(b) { + panic("vector.InnerProduct: vectors don't have the same length") + } + var tmp Element + for i := 0; i < len(a); i++ { + tmp.Mul(&a[i], &b[i]) + res.Add(res, &tmp) + } +} + +func mulVecGeneric(res, a, b Vector) { + if len(a) != len(b) || len(a) != len(res) { + panic("vector.Mul: vectors don't have the same length") + } + for i := 0; i < len(a); i++ { + res[i].Mul(&a[i], &b[i]) + } +} + // TODO @gbotrel make a public package out of that. // execute executes the work function in parallel. // this is copy paste from internal/parallel/parallel.go diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/vector_amd64.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/vector_amd64.go new file mode 100644 index 000000000..d7d56cd46 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/vector_amd64.go @@ -0,0 +1,154 @@ +//go:build !purego + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package fr + +import ( + _ "github.com/consensys/gnark-crypto/field/asm/element_4w" + "github.com/consensys/gnark-crypto/utils/cpu" +) + +// Add adds two vectors element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) Add(a, b Vector) { + if len(a) != len(b) || len(a) != len(*vector) { + panic("vector.Add: vectors don't have the same length") + } + n := uint64(len(a)) + addVec(&(*vector)[0], &a[0], &b[0], n) +} + +//go:noescape +func addVec(res, a, b *Element, n uint64) + +// Sub subtracts two vectors element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) Sub(a, b Vector) { + if len(a) != len(b) || len(a) != len(*vector) { + panic("vector.Sub: vectors don't have the same length") + } + subVec(&(*vector)[0], &a[0], &b[0], uint64(len(a))) +} + +//go:noescape +func subVec(res, a, b *Element, n uint64) + +// ScalarMul multiplies a vector by a scalar element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) ScalarMul(a Vector, b *Element) { + if len(a) != len(*vector) { + panic("vector.ScalarMul: vectors don't have the same length") + } + const maxN = (1 << 32) - 1 + if !cpu.SupportAVX512 || uint64(len(a)) >= maxN { + // call scalarMulVecGeneric + scalarMulVecGeneric(*vector, a, b) + return + } + n := uint64(len(a)) + if n == 0 { + return + } + // the code for scalarMul is identical to mulVec; and it expects at least + // 2 elements in the vector to fill the Z registers + var bb [2]Element + bb[0] = *b + bb[1] = *b + const blockSize = 16 + scalarMulVec(&(*vector)[0], &a[0], &bb[0], n/blockSize, qInvNeg, &patterns[0]) + if n%blockSize != 0 { + // call scalarMulVecGeneric on the rest + start := n - n%blockSize + scalarMulVecGeneric((*vector)[start:], a[start:], b) + } +} + +//go:noescape +func scalarMulVec(res, a, b *Element, n uint64, qInvNeg uint64, patterns *uint64) + +// Sum computes the sum of all elements in the vector. +func (vector *Vector) Sum() (res Element) { + n := uint64(len(*vector)) + if n == 0 { + return + } + const minN = 16 * 7 // AVX512 slower than generic for small n + const maxN = (1 << 32) - 1 + if !cpu.SupportAVX512 || n <= minN || n >= maxN { + // call sumVecGeneric + sumVecGeneric(&res, *vector) + return + } + sumVec(&res, &(*vector)[0], uint64(len(*vector))) + return +} + +//go:noescape +func sumVec(res *Element, a *Element, n uint64) + +// InnerProduct computes the inner product of two vectors. +// It panics if the vectors don't have the same length. +func (vector *Vector) InnerProduct(other Vector) (res Element) { + n := uint64(len(*vector)) + if n == 0 { + return + } + if n != uint64(len(other)) { + panic("vector.InnerProduct: vectors don't have the same length") + } + const maxN = (1 << 32) - 1 + if !cpu.SupportAVX512 || n >= maxN { + // call innerProductVecGeneric + // note; we could split the vector into smaller chunks and call innerProductVec + innerProductVecGeneric(&res, *vector, other) + return + } + innerProdVec(&res[0], &(*vector)[0], &other[0], uint64(len(*vector))) + + return +} + +//go:noescape +func innerProdVec(res *uint64, a, b *Element, n uint64) + +// Mul multiplies two vectors element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) Mul(a, b Vector) { + if len(a) != len(b) || len(a) != len(*vector) { + panic("vector.Mul: vectors don't have the same length") + } + n := uint64(len(a)) + if n == 0 { + return + } + const maxN = (1 << 32) - 1 + if !cpu.SupportAVX512 || n >= maxN { + // call mulVecGeneric + mulVecGeneric(*vector, a, b) + return + } + + const blockSize = 16 + mulVec(&(*vector)[0], &a[0], &b[0], n/blockSize, qInvNeg, &patterns[0]) + if n%blockSize != 0 { + // call mulVecGeneric on the rest + start := n - n%blockSize + mulVecGeneric((*vector)[start:], a[start:], b[start:]) + } + +} + +// Patterns use for transposing the vectors in mulVec +var ( + patterns = [8 * 4]uint64{0, 8, 1, 9, 2, 10, 3, 11, + 12, 4, 13, 5, 14, 6, 15, 7, + 0, 1, 8, 9, 2, 3, 10, 11, + 12, 13, 4, 5, 14, 15, 6, 7} +) + +//go:noescape +func mulVec(res, a, b *Element, n uint64, qInvNeg uint64, patterns *uint64) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/vector_purego.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/vector_purego.go new file mode 100644 index 000000000..6608e394c --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/fr/vector_purego.go @@ -0,0 +1,45 @@ +//go:build purego || !amd64 + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package fr + +// Add adds two vectors element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) Add(a, b Vector) { + addVecGeneric(*vector, a, b) +} + +// Sub subtracts two vectors element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) Sub(a, b Vector) { + subVecGeneric(*vector, a, b) +} + +// ScalarMul multiplies a vector by a scalar element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) ScalarMul(a Vector, b *Element) { + scalarMulVecGeneric(*vector, a, b) +} + +// Sum computes the sum of all elements in the vector. +func (vector *Vector) Sum() (res Element) { + sumVecGeneric(&res, *vector) + return +} + +// InnerProduct computes the inner product of two vectors. +// It panics if the vectors don't have the same length. +func (vector *Vector) InnerProduct(other Vector) (res Element) { + innerProductVecGeneric(&res, *vector, other) + return +} + +// Mul multiplies two vectors element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) Mul(a, b Vector) { + mulVecGeneric(*vector, a, b) +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/g1.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/g1.go index e1bc1809f..a5c6ae1d6 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/g1.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/g1.go @@ -1,16 +1,5 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -25,107 +14,149 @@ import ( "runtime" ) -// G1Affine point in affine coordinates +// G1Affine is a point in affine coordinates (x,y) type G1Affine struct { X, Y fp.Element } -// G1Jac is a point with fp.Element coordinates +// G1Jac is a point in Jacobian coordinates (x=X/Z², y=Y/Z³) type G1Jac struct { X, Y, Z fp.Element } -// g1JacExtended parameterized Jacobian coordinates (x=X/ZZ, y=Y/ZZZ, ZZ³=ZZZ²) +// g1JacExtended is a point in extended Jacobian coordinates (x=X/ZZ, y=Y/ZZZ, ZZ³=ZZZ²) type g1JacExtended struct { X, Y, ZZ, ZZZ fp.Element } // ------------------------------------------------------------------------------------------------- -// Affine +// Affine coordinates -// Set sets p to the provided point +// Set sets p to a in affine coordinates. func (p *G1Affine) Set(a *G1Affine) *G1Affine { p.X, p.Y = a.X, a.Y return p } -// setInfinity sets p to O -func (p *G1Affine) setInfinity() *G1Affine { +// SetInfinity sets p to the infinity point, which is encoded as (0,0). +// N.B.: (0,0) is never on the curve for j=0 curves (Y²=X³+B). +func (p *G1Affine) SetInfinity() *G1Affine { p.X.SetZero() p.Y.SetZero() return p } -// ScalarMultiplication computes and returns p = a ⋅ s +// ScalarMultiplication computes and returns p = [s]a +// where p and a are affine points. func (p *G1Affine) ScalarMultiplication(a *G1Affine, s *big.Int) *G1Affine { var _p G1Jac _p.FromAffine(a) - _p.mulGLV(&_p, s) + if s.BitLen() >= g1ScalarMulChoose { + _p.mulGLV(&_p, s) + } else { + _p.mulWindowed(&_p, s) + } p.FromJacobian(&_p) return p } -// ScalarMultiplicationAffine computes and returns p = a ⋅ s -// Takes an affine point and returns a Jacobian point (useful for KZG) -func (p *G1Jac) ScalarMultiplicationAffine(a *G1Affine, s *big.Int) *G1Jac { - p.FromAffine(a) - p.mulGLV(p, s) - return p -} - -// ScalarMultiplicationBase computes and returns p = g ⋅ s where g is the prime subgroup generator +// ScalarMultiplicationBase computes and returns p = [s]g +// where g is the affine point generating the prime subgroup. func (p *G1Affine) ScalarMultiplicationBase(s *big.Int) *G1Affine { var _p G1Jac - _p.mulGLV(&g1Gen, s) + if s.BitLen() >= g1ScalarMulChoose { + _p.mulGLV(&g1Gen, s) + } else { + _p.mulWindowed(&g1Gen, s) + } p.FromJacobian(&_p) return p } -// Add adds two point in affine coordinates. -// This should rarely be used as it is very inefficient compared to Jacobian +// Add adds two points in affine coordinates. +// It uses the Jacobian addition with a.Z=b.Z=1 and converts the result to affine coordinates. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-mmadd-2007-bl +// ~Cost: 4M + 2S func (p *G1Affine) Add(a, b *G1Affine) *G1Affine { - var p1, p2 G1Jac - p1.FromAffine(a) - p2.FromAffine(b) - p1.AddAssign(&p2) - p.FromJacobian(&p1) - return p + var q G1Jac + // a is infinity, return b + if a.IsInfinity() { + p.Set(b) + return p + } + // b is infinity, return a + if b.IsInfinity() { + p.Set(a) + return p + } + if a.X.Equal(&b.X) { + // if b == a, we double instead + if a.Y.Equal(&b.Y) { + q.DoubleMixed(a) + return p.FromJacobian(&q) + } else { + // if b == -a, we return 0 + return p.SetInfinity() + } + } + var H, HH, I, J, r, V fp.Element + H.Sub(&b.X, &a.X) + HH.Square(&H) + I.Double(&HH).Double(&I) + J.Mul(&H, &I) + r.Sub(&b.Y, &a.Y) + r.Double(&r) + V.Mul(&a.X, &I) + q.X.Square(&r). + Sub(&q.X, &J). + Sub(&q.X, &V). + Sub(&q.X, &V) + q.Y.Sub(&V, &q.X). + Mul(&q.Y, &r) + J.Mul(&a.Y, &J).Double(&J) + q.Y.Sub(&q.Y, &J) + q.Z.Double(&H) + + return p.FromJacobian(&q) } // Double doubles a point in affine coordinates. -// This should rarely be used as it is very inefficient compared to Jacobian +// It converts the point to Jacobian coordinates, doubles it using Jacobian +// addition with a.Z=1, and converts it back to affine coordinates. +// +// http://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-mdbl-2007-bl +// ~Cost: 1M + 5S func (p *G1Affine) Double(a *G1Affine) *G1Affine { - var p1 G1Jac - p1.FromAffine(a) - p1.Double(&p1) - p.FromJacobian(&p1) + var q G1Jac + q.FromAffine(a) + q.DoubleMixed(a) + p.FromJacobian(&q) return p } -// Sub subs two point in affine coordinates. -// This should rarely be used as it is very inefficient compared to Jacobian +// Sub subtracts two points in affine coordinates. +// It uses a similar approach to Add, but negates the second point before adding. func (p *G1Affine) Sub(a, b *G1Affine) *G1Affine { - var p1, p2 G1Jac - p1.FromAffine(a) - p2.FromAffine(b) - p1.SubAssign(&p2) - p.FromJacobian(&p1) + var bneg G1Affine + bneg.Neg(b) + p.Add(a, &bneg) return p } -// Equal tests if two points (in Affine coordinates) are equal +// Equal tests if two points in affine coordinates are equal. func (p *G1Affine) Equal(a *G1Affine) bool { return p.X.Equal(&a.X) && p.Y.Equal(&a.Y) } -// Neg computes -G +// Neg sets p to the affine negative point -a = (a.X, -a.Y). func (p *G1Affine) Neg(a *G1Affine) *G1Affine { p.X = a.X p.Y.Neg(&a.Y) return p } -// FromJacobian rescales a point in Jacobian coord in z=1 plane +// FromJacobian converts a point p1 from Jacobian to affine coordinates. func (p *G1Affine) FromJacobian(p1 *G1Jac) *G1Affine { var a, b fp.Element @@ -144,7 +175,7 @@ func (p *G1Affine) FromJacobian(p1 *G1Jac) *G1Affine { return p } -// String returns the string representation of the point or "O" if it is infinity +// String returns the string representation E(x,y) of the affine point p or "O" if it is infinity. func (p *G1Affine) String() string { if p.IsInfinity() { return "O" @@ -152,21 +183,25 @@ func (p *G1Affine) String() string { return "E([" + p.X.String() + "," + p.Y.String() + "])" } -// IsInfinity checks if the point is infinity -// in affine, it's encoded as (0,0) -// (0,0) is never on the curve for j=0 curves +// IsInfinity checks if the affine point p is infinity, which is encoded as (0,0). +// N.B.: (0,0) is never on the curve for j=0 curves (Y²=X³+B). func (p *G1Affine) IsInfinity() bool { return p.X.IsZero() && p.Y.IsZero() } -// IsOnCurve returns true if p in on the curve +// IsOnCurve returns true if the affine point p in on the curve. func (p *G1Affine) IsOnCurve() bool { - var point G1Jac - point.FromAffine(p) - return point.IsOnCurve() // call this function to handle infinity point + if p.IsInfinity() { + return true + } + var left, right fp.Element + left.Square(&p.Y) + right.Square(&p.X).Mul(&right, &p.X) + right.Add(&right, &bCurveCoeff) + return left.Equal(&right) } -// IsInSubGroup returns true if p is in the correct subgroup, false otherwise +// IsInSubGroup returns true if the affine point p is in the correct subgroup, false otherwise. func (p *G1Affine) IsInSubGroup() bool { var _p G1Jac _p.FromAffine(p) @@ -174,84 +209,77 @@ func (p *G1Affine) IsInSubGroup() bool { } // ------------------------------------------------------------------------------------------------- -// Jacobian +// Jacobian coordinates -// Set sets p to the provided point -func (p *G1Jac) Set(a *G1Jac) *G1Jac { - p.X, p.Y, p.Z = a.X, a.Y, a.Z +// Set sets p to a in Jacobian coordinates. +func (p *G1Jac) Set(q *G1Jac) *G1Jac { + p.X, p.Y, p.Z = q.X, q.Y, q.Z return p } -// Equal tests if two points (in Jacobian coordinates) are equal -func (p *G1Jac) Equal(a *G1Jac) bool { +// Equal tests if two points in Jacobian coordinates are equal. +func (p *G1Jac) Equal(q *G1Jac) bool { // If one point is infinity, the other must also be infinity. if p.Z.IsZero() { - return a.Z.IsZero() + return q.Z.IsZero() } // If the other point is infinity, return false since we can't // the following checks would be incorrect. - if a.Z.IsZero() { + if q.Z.IsZero() { return false } var pZSquare, aZSquare fp.Element pZSquare.Square(&p.Z) - aZSquare.Square(&a.Z) + aZSquare.Square(&q.Z) var lhs, rhs fp.Element lhs.Mul(&p.X, &aZSquare) - rhs.Mul(&a.X, &pZSquare) + rhs.Mul(&q.X, &pZSquare) if !lhs.Equal(&rhs) { return false } - lhs.Mul(&p.Y, &aZSquare).Mul(&lhs, &a.Z) - rhs.Mul(&a.Y, &pZSquare).Mul(&rhs, &p.Z) + lhs.Mul(&p.Y, &aZSquare).Mul(&lhs, &q.Z) + rhs.Mul(&q.Y, &pZSquare).Mul(&rhs, &p.Z) return lhs.Equal(&rhs) } -// Neg computes -G -func (p *G1Jac) Neg(a *G1Jac) *G1Jac { - *p = *a - p.Y.Neg(&a.Y) - return p -} - -// SubAssign subtracts two points on the curve -func (p *G1Jac) SubAssign(a *G1Jac) *G1Jac { - var tmp G1Jac - tmp.Set(a) - tmp.Y.Neg(&tmp.Y) - p.AddAssign(&tmp) +// Neg sets p to the Jacobian negative point -q = (q.X, -q.Y, q.Z). +func (p *G1Jac) Neg(q *G1Jac) *G1Jac { + *p = *q + p.Y.Neg(&q.Y) return p } -// AddAssign point addition in montgomery form -// https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#addition-add-2007-bl -func (p *G1Jac) AddAssign(a *G1Jac) *G1Jac { +// AddAssign sets p to p+a in Jacobian coordinates. +// +// https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-add-2007-bl +// ~Cost: 11M + 5S +func (p *G1Jac) AddAssign(q *G1Jac) *G1Jac { - // p is infinity, return a + // p is infinity, return q if p.Z.IsZero() { - p.Set(a) + p.Set(q) return p } - // a is infinity, return p - if a.Z.IsZero() { + // q is infinity, return p + if q.Z.IsZero() { return p } var Z1Z1, Z2Z2, U1, U2, S1, S2, H, I, J, r, V fp.Element - Z1Z1.Square(&a.Z) + Z1Z1.Square(&q.Z) Z2Z2.Square(&p.Z) - U1.Mul(&a.X, &Z2Z2) + U1.Mul(&q.X, &Z2Z2) U2.Mul(&p.X, &Z1Z1) - S1.Mul(&a.Y, &p.Z). + S1.Mul(&q.Y, &p.Z). Mul(&S1, &Z2Z2) - S2.Mul(&p.Y, &a.Z). + S2.Mul(&p.Y, &q.Z). Mul(&S2, &Z1Z1) - // if p == a, we double instead + // if p == q, we double instead if U1.Equal(&U2) && S1.Equal(&S2) { return p.DoubleAssign() } @@ -270,7 +298,7 @@ func (p *G1Jac) AddAssign(a *G1Jac) *G1Jac { Mul(&p.Y, &r) S1.Mul(&S1, &J).Double(&S1) p.Y.Sub(&p.Y, &S1) - p.Z.Add(&p.Z, &a.Z) + p.Z.Add(&p.Z, &q.Z) p.Z.Square(&p.Z). Sub(&p.Z, &Z1Z1). Sub(&p.Z, &Z2Z2). @@ -279,8 +307,51 @@ func (p *G1Jac) AddAssign(a *G1Jac) *G1Jac { return p } -// AddMixed point addition +// SubAssign sets p to p-a in Jacobian coordinates. +// It uses a similar approach to AddAssign, but negates the point a before adding. +func (p *G1Jac) SubAssign(q *G1Jac) *G1Jac { + var tmp G1Jac + tmp.Set(q) + tmp.Y.Neg(&tmp.Y) + p.AddAssign(&tmp) + return p +} + +// Double sets p to [2]q in Jacobian coordinates. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-mdbl-2007-bl +// ~Cost: 1M + 5S +func (p *G1Jac) DoubleMixed(a *G1Affine) *G1Jac { + var XX, YY, YYYY, S, M, T fp.Element + XX.Square(&a.X) + YY.Square(&a.Y) + YYYY.Square(&YY) + S.Add(&a.X, &YY). + Square(&S). + Sub(&S, &XX). + Sub(&S, &YYYY). + Double(&S) + M.Double(&XX). + Add(&M, &XX) // -> + A, but A=0 here + T.Square(&M). + Sub(&T, &S). + Sub(&T, &S) + p.X.Set(&T) + p.Y.Sub(&S, &T). + Mul(&p.Y, &M) + YYYY.Double(&YYYY). + Double(&YYYY). + Double(&YYYY) + p.Y.Sub(&p.Y, &YYYY) + p.Z.Double(&a.Y) + + return p +} + +// AddMixed sets p to p+a in Jacobian coordinates, where a.Z = 1. +// // http://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-madd-2007-bl +// ~Cost: 7M + 4S func (p *G1Jac) AddMixed(a *G1Affine) *G1Jac { //if a is infinity return p @@ -303,7 +374,7 @@ func (p *G1Jac) AddMixed(a *G1Affine) *G1Jac { // if p == a, we double instead if U2.Equal(&p.X) && S2.Equal(&p.Y) { - return p.DoubleAssign() + return p.DoubleMixed(a) } H.Sub(&U2, &p.X) @@ -328,83 +399,99 @@ func (p *G1Jac) AddMixed(a *G1Affine) *G1Jac { return p } -// Double doubles a point in Jacobian coordinates -// https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2007-bl +// Double sets p to [2]q in Jacobian coordinates. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l +// ~Cost: 2M + 5S func (p *G1Jac) Double(q *G1Jac) *G1Jac { p.Set(q) p.DoubleAssign() return p } -// DoubleAssign doubles a point in Jacobian coordinates -// https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2007-bl +// DoubleAssign doubles p in Jacobian coordinates. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l +// ~Cost: 2M + 5S func (p *G1Jac) DoubleAssign() *G1Jac { - - var XX, YY, YYYY, ZZ, S, M, T fp.Element - - XX.Square(&p.X) - YY.Square(&p.Y) - YYYY.Square(&YY) - ZZ.Square(&p.Z) - S.Add(&p.X, &YY) - S.Square(&S). - Sub(&S, &XX). - Sub(&S, &YYYY). - Double(&S) - M.Double(&XX).Add(&M, &XX) - p.Z.Add(&p.Z, &p.Y). - Square(&p.Z). - Sub(&p.Z, &YY). - Sub(&p.Z, &ZZ) - T.Square(&M) - p.X = T - T.Double(&S) - p.X.Sub(&p.X, &T) - p.Y.Sub(&S, &p.X). - Mul(&p.Y, &M) - YYYY.Double(&YYYY).Double(&YYYY).Double(&YYYY) - p.Y.Sub(&p.Y, &YYYY) + var A, B, C, D, E, F, t fp.Element + A.Square(&p.X) + B.Square(&p.Y) + C.Square(&B) + D.Add(&p.X, &B). + Square(&D). + Sub(&D, &A). + Sub(&D, &C). + Double(&D) + E.Double(&A). + Add(&E, &A) + F.Square(&E) + t.Double(&D) + p.Z.Mul(&p.Y, &p.Z). + Double(&p.Z) + p.X.Sub(&F, &t) + p.Y.Sub(&D, &p.X). + Mul(&p.Y, &E) + t.Double(&C). + Double(&t). + Double(&t) + p.Y.Sub(&p.Y, &t) return p } -// ScalarMultiplication computes and returns p = a ⋅ s +// ScalarMultiplication computes and returns p = [s]a +// where p and a are Jacobian points. +// using the GLV technique. // see https://www.iacr.org/archive/crypto2001/21390189.pdf -func (p *G1Jac) ScalarMultiplication(a *G1Jac, s *big.Int) *G1Jac { - return p.mulGLV(a, s) +func (p *G1Jac) ScalarMultiplication(q *G1Jac, s *big.Int) *G1Jac { + if s.BitLen() >= g1ScalarMulChoose { + return p.mulGLV(q, s) + } else { + return p.mulWindowed(q, s) + } +} + +// ScalarMultiplicationBase computes and returns p = [s]g +// where g is the prime subgroup generator. +func (p *G1Jac) ScalarMultiplicationBase(s *big.Int) *G1Jac { + if s.BitLen() >= g1ScalarMulChoose { + return p.mulGLV(&g1Gen, s) + } else { + return p.mulWindowed(&g1Gen, s) + } + } -// String returns canonical representation of the point in affine coordinates +// String converts p to affine coordinates and returns its string representation E(x,y) or "O" if it is infinity. func (p *G1Jac) String() string { _p := G1Affine{} _p.FromJacobian(p) return _p.String() } -// FromAffine sets p = Q, p in Jacobian, Q in affine -func (p *G1Jac) FromAffine(Q *G1Affine) *G1Jac { - if Q.IsInfinity() { +// FromAffine converts a point a from affine to Jacobian coordinates. +func (p *G1Jac) FromAffine(a *G1Affine) *G1Jac { + if a.IsInfinity() { p.Z.SetZero() p.X.SetOne() p.Y.SetOne() return p } p.Z.SetOne() - p.X.Set(&Q.X) - p.Y.Set(&Q.Y) + p.X.Set(&a.X) + p.Y.Set(&a.Y) return p } -// IsOnCurve returns true if p in on the curve +// IsOnCurve returns true if the Jacobian point p in on the curve. func (p *G1Jac) IsOnCurve() bool { - var left, right, tmp fp.Element + var left, right, tmp, ZZ fp.Element left.Square(&p.Y) right.Square(&p.X).Mul(&right, &p.X) - tmp.Square(&p.Z). - Square(&tmp). - Mul(&tmp, &p.Z). - Mul(&tmp, &p.Z). - Mul(&tmp, &bCurveCoeff) + ZZ.Square(&p.Z) + tmp.Square(&ZZ).Mul(&tmp, &ZZ) + // Mul tmp by bCurveCoeff=1 (nothing to do) right.Add(&right, &tmp) return left.Equal(&right) } @@ -416,25 +503,28 @@ func (p *G1Jac) IsOnCurve() bool { // 1, x². So we check that p+x²ϕ(p) // is the infinity. func (p *G1Jac) IsInSubGroup() bool { - + if !p.IsOnCurve() { + return false + } var res G1Jac res.phi(p). - ScalarMultiplication(&res, &xGen). - ScalarMultiplication(&res, &xGen). - AddAssign(p) + mulBySeed(&res). + mulBySeed(&res). + Neg(&res) - return res.IsOnCurve() && res.Z.IsZero() + return res.Equal(p) } -// mulWindowed computes a 2-bits windowed scalar multiplication -func (p *G1Jac) mulWindowed(a *G1Jac, s *big.Int) *G1Jac { +// mulWindowed computes the 2-bits windowed double-and-add scalar +// multiplication p=[s]q in Jacobian coordinates. +func (p *G1Jac) mulWindowed(q *G1Jac, s *big.Int) *G1Jac { var res G1Jac var ops [3]G1Jac - ops[0].Set(a) + ops[0].Set(q) if s.Sign() == -1 { ops[0].Neg(&ops[0]) } @@ -461,17 +551,50 @@ func (p *G1Jac) mulWindowed(a *G1Jac, s *big.Int) *G1Jac { } -// ϕ assigns p to ϕ(a) where ϕ: (x,y) → (w x,y), and returns p -// where w is a third root of unity in 𝔽p -func (p *G1Jac) phi(a *G1Jac) *G1Jac { - p.Set(a) +// mulBySeed multiplies the point q by the seed xGen in Jacobian coordinates +// using an optimized addition chain. +func (p *G1Jac) mulBySeed(q *G1Jac) *G1Jac { + // Generated by github.com/mmcloughlin/addchain v0.4.0. + // Operations: 61 doublings 7 additions + + // Allocate Temporaries. + var res, t0, t1 G1Jac + res.Double(q) + res.AddAssign(q) + res.Double(&res) + res.AddAssign(q) + t0.Double(&res) + for i := 1; i < 2; i++ { + t0.Double(&t0) + } + res.AddAssign(&t0) + t1.Double(&res) + t1.AddAssign(&res) + t0.AddAssign(&t1) + for i := 0; i < 10; i++ { + t0.Double(&t0) + } + res.AddAssign(&t0) + for i := 0; i < 46; i++ { + res.Double(&res) + } + res.AddAssign(q) + p.Set(&res) + return p +} + +// phi sets p to ϕ(a) where ϕ: (x,y) → (w x,y), +// where w is a third root of unity. +func (p *G1Jac) phi(q *G1Jac) *G1Jac { + p.Set(q) p.X.Mul(&p.X, &thirdRootOneG1) return p } // mulGLV computes the scalar multiplication using a windowed-GLV method +// // see https://www.iacr.org/archive/crypto2001/21390189.pdf -func (p *G1Jac) mulGLV(a *G1Jac, s *big.Int) *G1Jac { +func (p *G1Jac) mulGLV(q *G1Jac, s *big.Int) *G1Jac { var table [15]G1Jac var res G1Jac @@ -479,11 +602,11 @@ func (p *G1Jac) mulGLV(a *G1Jac, s *big.Int) *G1Jac { res.Set(&g1Infinity) - // table[b3b2b1b0-1] = b3b2 ⋅ ϕ(a) + b1b0*a - table[0].Set(a) - table[3].phi(a) + // table[b3b2b1b0-1] = b3b2 ⋅ ϕ(q) + b1b0*q + table[0].Set(q) + table[3].phi(q) - // split the scalar, modifies ±a, ϕ(a) accordingly + // split the scalar, modifies ±q, ϕ(q) accordingly k := ecc.SplitScalar(s, &glvBasis) if k[0].Sign() == -1 { @@ -496,7 +619,7 @@ func (p *G1Jac) mulGLV(a *G1Jac, s *big.Int) *G1Jac { } // precompute table (2 bits sliding window) - // table[b3b2b1b0-1] = b3b2 ⋅ ϕ(a) + b1b0 ⋅ a if b3b2b1b0 != 0 + // table[b3b2b1b0-1] = b3b2 ⋅ ϕ(q) + b1b0 ⋅ q if b3b2b1b0 != 0 table[1].Double(&table[0]) table[2].Set(&table[1]).AddAssign(&table[0]) table[4].Set(&table[3]).AddAssign(&table[0]) @@ -552,23 +675,23 @@ func (p *G1Affine) ClearCofactor(a *G1Affine) *G1Affine { } // ClearCofactor maps a point in E(Fp) to E(Fp)[r] -func (p *G1Jac) ClearCofactor(a *G1Jac) *G1Jac { +func (p *G1Jac) ClearCofactor(q *G1Jac) *G1Jac { // cf https://eprint.iacr.org/2019/403.pdf, 5 var res G1Jac - res.ScalarMultiplication(a, &xGen).Neg(&res).AddAssign(a) + res.mulBySeed(q).Neg(&res).AddAssign(q) p.Set(&res) return p } -// JointScalarMultiplicationBase computes [s1]g+[s2]a using Straus-Shamir technique -// where g is the prime subgroup generator -func (p *G1Jac) JointScalarMultiplicationBase(a *G1Affine, s1, s2 *big.Int) *G1Jac { +// JointScalarMultiplication computes [s1]a1+[s2]a2 using Strauss-Shamir technique +// where a1 and a2 are affine points. +func (p *G1Jac) JointScalarMultiplication(a1, a2 *G1Affine, s1, s2 *big.Int) *G1Jac { var res, p1, p2 G1Jac res.Set(&g1Infinity) - p1.Set(&g1Gen) - p2.FromAffine(a) + p1.FromAffine(a1) + p2.FromAffine(a2) var table [15]G1Jac @@ -632,17 +755,24 @@ func (p *G1Jac) JointScalarMultiplicationBase(a *G1Affine, s1, s2 *big.Int) *G1J } +// JointScalarMultiplicationBase computes [s1]g+[s2]a using Straus-Shamir technique +// where g is the prime subgroup generator. +func (p *G1Jac) JointScalarMultiplicationBase(a *G1Affine, s1, s2 *big.Int) *G1Jac { + return p.JointScalarMultiplication(&g1GenAff, a, s1, s2) + +} + // ------------------------------------------------------------------------------------------------- -// Jacobian extended +// extended Jacobian coordinates -// Set sets p to the provided point -func (p *g1JacExtended) Set(a *g1JacExtended) *g1JacExtended { - p.X, p.Y, p.ZZ, p.ZZZ = a.X, a.Y, a.ZZ, a.ZZZ +// Set sets p to a in extended Jacobian coordinates. +func (p *g1JacExtended) Set(q *g1JacExtended) *g1JacExtended { + p.X, p.Y, p.ZZ, p.ZZZ = q.X, q.Y, q.ZZ, q.ZZZ return p } -// setInfinity sets p to O -func (p *g1JacExtended) setInfinity() *g1JacExtended { +// SetInfinity sets p to the infinity point (1,1,0,0). +func (p *g1JacExtended) SetInfinity() *g1JacExtended { p.X.SetOne() p.Y.SetOne() p.ZZ = fp.Element{} @@ -650,44 +780,47 @@ func (p *g1JacExtended) setInfinity() *g1JacExtended { return p } -func (p *g1JacExtended) IsZero() bool { +// IsInfinity checks if the p is infinity, i.e. p.ZZ=0. +func (p *g1JacExtended) IsInfinity() bool { return p.ZZ.IsZero() } -// fromJacExtended sets Q in affine coordinates -func (p *G1Affine) fromJacExtended(Q *g1JacExtended) *G1Affine { - if Q.ZZ.IsZero() { +// fromJacExtended converts an extended Jacobian point to an affine point. +func (p *G1Affine) fromJacExtended(q *g1JacExtended) *G1Affine { + if q.ZZ.IsZero() { p.X = fp.Element{} p.Y = fp.Element{} return p } - p.X.Inverse(&Q.ZZ).Mul(&p.X, &Q.X) - p.Y.Inverse(&Q.ZZZ).Mul(&p.Y, &Q.Y) + p.X.Inverse(&q.ZZ).Mul(&p.X, &q.X) + p.Y.Inverse(&q.ZZZ).Mul(&p.Y, &q.Y) return p } -// fromJacExtended sets Q in Jacobian coordinates -func (p *G1Jac) fromJacExtended(Q *g1JacExtended) *G1Jac { - if Q.ZZ.IsZero() { +// fromJacExtended converts an extended Jacobian point to a Jacobian point. +func (p *G1Jac) fromJacExtended(q *g1JacExtended) *G1Jac { + if q.ZZ.IsZero() { p.Set(&g1Infinity) return p } - p.X.Mul(&Q.ZZ, &Q.X).Mul(&p.X, &Q.ZZ) - p.Y.Mul(&Q.ZZZ, &Q.Y).Mul(&p.Y, &Q.ZZZ) - p.Z.Set(&Q.ZZZ) + p.X.Mul(&q.ZZ, &q.X).Mul(&p.X, &q.ZZ) + p.Y.Mul(&q.ZZZ, &q.Y).Mul(&p.Y, &q.ZZZ) + p.Z.Set(&q.ZZZ) return p } -// unsafeFromJacExtended sets p in Jacobian coordinates, but don't check for infinity -func (p *G1Jac) unsafeFromJacExtended(Q *g1JacExtended) *G1Jac { - p.X.Square(&Q.ZZ).Mul(&p.X, &Q.X) - p.Y.Square(&Q.ZZZ).Mul(&p.Y, &Q.Y) - p.Z = Q.ZZZ +// unsafeFromJacExtended converts an extended Jacobian point, distinct from Infinity, to a Jacobian point. +func (p *G1Jac) unsafeFromJacExtended(q *g1JacExtended) *G1Jac { + p.X.Square(&q.ZZ).Mul(&p.X, &q.X) + p.Y.Square(&q.ZZZ).Mul(&p.Y, &q.Y) + p.Z = q.ZZZ return p } -// add point in Jacobian extended coordinates +// add sets p to p+q in extended Jacobian coordinates. +// // https://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#addition-add-2008-s +// ~Cost: 12M + 2S func (p *g1JacExtended) add(q *g1JacExtended) *g1JacExtended { //if q is infinity return p if q.ZZ.IsZero() { @@ -742,10 +875,13 @@ func (p *g1JacExtended) add(q *g1JacExtended) *g1JacExtended { return p } -// double point in Jacobian extended coordinates +// double sets p to [2]q in Jacobian extended coordinates. +// // http://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#doubling-dbl-2008-s-1 -// since we consider any point on Z=0 as the point at infinity -// this doubling formula works for infinity points as well +// ~Cost: 6M + 3S +// +// N.B.: since we consider any point on Z=0 as the point at infinity +// this doubling formula works for infinity points as well. func (p *g1JacExtended) double(q *g1JacExtended) *g1JacExtended { var U, V, W, S, XX, M fp.Element @@ -755,7 +891,7 @@ func (p *g1JacExtended) double(q *g1JacExtended) *g1JacExtended { S.Mul(&q.X, &V) XX.Square(&q.X) M.Double(&XX). - Add(&M, &XX) // -> + a, but a=0 here + Add(&M, &XX) // -> + A, but A=0 here U.Mul(&W, &q.Y) p.X.Square(&M). @@ -770,9 +906,11 @@ func (p *g1JacExtended) double(q *g1JacExtended) *g1JacExtended { return p } -// subMixed same as addMixed, but will negate a.Y +// addMixed sets p to p+q in extended Jacobian coordinates, where a.ZZ=1. +// // http://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#addition-madd-2008-s -func (p *g1JacExtended) subMixed(a *G1Affine) *g1JacExtended { +// ~Cost: 8M + 2S +func (p *g1JacExtended) addMixed(a *G1Affine) *g1JacExtended { //if a is infinity return p if a.IsInfinity() { @@ -781,7 +919,7 @@ func (p *g1JacExtended) subMixed(a *G1Affine) *g1JacExtended { // p is infinity, return a if p.ZZ.IsZero() { p.X = a.X - p.Y.Neg(&a.Y) + p.Y = a.Y p.ZZ.SetOne() p.ZZZ.SetOne() return p @@ -794,12 +932,11 @@ func (p *g1JacExtended) subMixed(a *G1Affine) *g1JacExtended { P.Sub(&P, &p.X) R.Mul(&a.Y, &p.ZZZ) - R.Neg(&R) R.Sub(&R, &p.Y) if P.IsZero() { if R.IsZero() { - return p.doubleNegMixed(a) + return p.doubleMixed(a) } p.ZZ = fp.Element{} @@ -826,9 +963,11 @@ func (p *g1JacExtended) subMixed(a *G1Affine) *g1JacExtended { } -// addMixed +// subMixed works the same as addMixed, but negates a.Y. +// // http://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#addition-madd-2008-s -func (p *g1JacExtended) addMixed(a *G1Affine) *g1JacExtended { +// ~Cost: 8M + 2S +func (p *g1JacExtended) subMixed(a *G1Affine) *g1JacExtended { //if a is infinity return p if a.IsInfinity() { @@ -837,7 +976,7 @@ func (p *g1JacExtended) addMixed(a *G1Affine) *g1JacExtended { // p is infinity, return a if p.ZZ.IsZero() { p.X = a.X - p.Y = a.Y + p.Y.Neg(&a.Y) p.ZZ.SetOne() p.ZZZ.SetOne() return p @@ -850,11 +989,12 @@ func (p *g1JacExtended) addMixed(a *G1Affine) *g1JacExtended { P.Sub(&P, &p.X) R.Mul(&a.Y, &p.ZZZ) + R.Neg(&R) R.Sub(&R, &p.Y) if P.IsZero() { if R.IsZero() { - return p.doubleMixed(a) + return p.doubleNegMixed(a) } p.ZZ = fp.Element{} @@ -881,54 +1021,57 @@ func (p *g1JacExtended) addMixed(a *G1Affine) *g1JacExtended { } -// doubleNegMixed same as double, but will negate q.Y -func (p *g1JacExtended) doubleNegMixed(q *G1Affine) *g1JacExtended { +// doubleNegMixed works the same as doubleMixed, but negates q.Y. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#doubling-mdbl-2008-s-1 +// ~Cost: 4M + 3S +func (p *g1JacExtended) doubleNegMixed(a *G1Affine) *g1JacExtended { - var U, V, W, S, XX, M, S2, L fp.Element + var U, V, W, S, M, t fp.Element - U.Double(&q.Y) + U.Double(&a.Y) U.Neg(&U) V.Square(&U) W.Mul(&U, &V) - S.Mul(&q.X, &V) - XX.Square(&q.X) - M.Double(&XX). - Add(&M, &XX) // -> + a, but a=0 here - S2.Double(&S) - L.Mul(&W, &q.Y) - - p.X.Square(&M). - Sub(&p.X, &S2) + S.Mul(&a.X, &V) + t.Square(&a.X) + M.Double(&t). + Add(&M, &t) // -> + A, but A=0 here + p.X.Square(&M) + t.Double(&S) + p.X.Sub(&p.X, &t) + t.Mul(&W, &a.Y) p.Y.Sub(&S, &p.X). Mul(&p.Y, &M). - Add(&p.Y, &L) + Add(&p.Y, &t) p.ZZ.Set(&V) p.ZZZ.Set(&W) return p } -// doubleMixed point in Jacobian extended coordinates -// http://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#doubling-dbl-2008-s-1 -func (p *g1JacExtended) doubleMixed(q *G1Affine) *g1JacExtended { +// doubleMixed sets p to [2]a in Jacobian extended coordinates, where a.ZZ=1. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#doubling-mdbl-2008-s-1 +// ~Cost: 4M + 3S +func (p *g1JacExtended) doubleMixed(a *G1Affine) *g1JacExtended { - var U, V, W, S, XX, M, S2, L fp.Element + var U, V, W, S, M, t fp.Element - U.Double(&q.Y) + U.Double(&a.Y) V.Square(&U) W.Mul(&U, &V) - S.Mul(&q.X, &V) - XX.Square(&q.X) - M.Double(&XX). - Add(&M, &XX) // -> + a, but a=0 here - S2.Double(&S) - L.Mul(&W, &q.Y) - - p.X.Square(&M). - Sub(&p.X, &S2) + S.Mul(&a.X, &V) + t.Square(&a.X) + M.Double(&t). + Add(&M, &t) // -> + A, but A=0 here + p.X.Square(&M) + t.Double(&S) + p.X.Sub(&p.X, &t) + t.Mul(&W, &a.Y) p.Y.Sub(&S, &p.X). Mul(&p.Y, &M). - Sub(&p.Y, &L) + Sub(&p.Y, &t) p.ZZ.Set(&V) p.ZZZ.Set(&W) @@ -936,7 +1079,7 @@ func (p *g1JacExtended) doubleMixed(q *G1Affine) *g1JacExtended { } // BatchJacobianToAffineG1 converts points in Jacobian coordinates to Affine coordinates -// performing a single field inversion (Montgomery batch inversion trick). +// performing a single field inversion using the Montgomery batch inversion trick. func BatchJacobianToAffineG1(points []G1Jac) []G1Affine { result := make([]G1Affine, len(points)) zeroes := make([]bool, len(points)) @@ -986,7 +1129,7 @@ func BatchJacobianToAffineG1(points []G1Jac) []G1Affine { // BatchScalarMultiplicationG1 multiplies the same base by all scalars // and return resulting points in affine coordinates -// uses a simple windowed-NAF like exponentiation algorithm +// uses a simple windowed-NAF-like multiplication algorithm. func BatchScalarMultiplicationG1(base *G1Affine, scalars []fr.Element) []G1Affine { // approximate cost in group ops is // cost = 2^{c-1} + n(scalar.nbBits+nbChunks) @@ -1068,18 +1211,29 @@ func BatchScalarMultiplicationG1(base *G1Affine, scalars []fr.Element) []G1Affin return toReturnAff } -// batch add affine coordinates -// using batch inversion -// special cases (doubling, infinity) must be filtered out before this call +// batchAddG1Affine adds affine points using the Montgomery batch inversion trick. +// Special cases (doubling, infinity) must be filtered out before this call. func batchAddG1Affine[TP pG1Affine, TPP ppG1Affine, TC cG1Affine](R *TPP, P *TP, batchSize int) { var lambda, lambdain TC - // add part + // from https://docs.zkproof.org/pages/standards/accepted-workshop3/proposal-turbo_plonk.pdf + // affine point addition formula + // R(X1, Y1) + P(X2, Y2) = Q(X3, Y3) + // λ = (Y2 - Y1) / (X2 - X1) + // X3 = λ² - (X1 + X2) + // Y3 = λ * (X1 - X3) - Y1 + + // first we compute the 1 / (X2 - X1) for all points using Montgomery batch inversion trick + + // X2 - X1 for j := 0; j < batchSize; j++ { lambdain[j].Sub(&(*P)[j].X, &(*R)[j].X) } - // invert denominator using montgomery batch invert technique + // montgomery batch inversion; + // lambda[0] = 1 / (P[0].X - R[0].X) + // lambda[1] = 1 / (P[1].X - R[1].X) + // ... { var accumulator fp.Element lambda[0].SetOne() @@ -1099,22 +1253,24 @@ func batchAddG1Affine[TP pG1Affine, TPP ppG1Affine, TC cG1Affine](R *TPP, P *TP, lambda[0].Set(&accumulator) } - var d fp.Element - var rr G1Affine + var t fp.Element + var Q G1Affine - // add part for j := 0; j < batchSize; j++ { - // computa lambda - d.Sub(&(*P)[j].Y, &(*R)[j].Y) - lambda[j].Mul(&lambda[j], &d) - - // compute X, Y - rr.X.Square(&lambda[j]) - rr.X.Sub(&rr.X, &(*R)[j].X) - rr.X.Sub(&rr.X, &(*P)[j].X) - d.Sub(&(*R)[j].X, &rr.X) - rr.Y.Mul(&lambda[j], &d) - rr.Y.Sub(&rr.Y, &(*R)[j].Y) - (*R)[j].Set(&rr) + // λ = (Y2 - Y1) / (X2 - X1) + t.Sub(&(*P)[j].Y, &(*R)[j].Y) + lambda[j].Mul(&lambda[j], &t) + + // X3 = λ² - (X1 + X2) + Q.X.Square(&lambda[j]) + Q.X.Sub(&Q.X, &(*R)[j].X) + Q.X.Sub(&Q.X, &(*P)[j].X) + + // Y3 = λ * (X1 - X3) - Y1 + t.Sub(&(*R)[j].X, &Q.X) + Q.Y.Mul(&lambda[j], &t) + Q.Y.Sub(&Q.Y, &(*R)[j].Y) + + (*R)[j].Set(&Q) } } diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/g2.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/g2.go index c256d8210..86424ee1e 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/g2.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/g2.go @@ -1,22 +1,12 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT package bls12377 import ( + "crypto/rand" "github.com/consensys/gnark-crypto/ecc" "github.com/consensys/gnark-crypto/ecc/bls12-377/fr" "github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower" @@ -25,17 +15,17 @@ import ( "runtime" ) -// G2Affine point in affine coordinates +// G2Affine is a point in affine coordinates (x,y) type G2Affine struct { X, Y fptower.E2 } -// G2Jac is a point with fptower.E2 coordinates +// G2Jac is a point in Jacobian coordinates (x=X/Z², y=Y/Z³) type G2Jac struct { X, Y, Z fptower.E2 } -// g2JacExtended parameterized Jacobian coordinates (x=X/ZZ, y=Y/ZZZ, ZZ³=ZZZ²) +// g2JacExtended is a point in extended Jacobian coordinates (x=X/ZZ, y=Y/ZZZ, ZZ³=ZZZ²) type g2JacExtended struct { X, Y, ZZ, ZZZ fptower.E2 } @@ -46,75 +36,133 @@ type g2Proj struct { } // ------------------------------------------------------------------------------------------------- -// Affine +// Affine coordinates -// Set sets p to the provided point +// Set sets p to a in affine coordinates. func (p *G2Affine) Set(a *G2Affine) *G2Affine { p.X, p.Y = a.X, a.Y return p } -// setInfinity sets p to O -func (p *G2Affine) setInfinity() *G2Affine { +// SetInfinity sets p to the infinity point, which is encoded as (0,0). +// N.B.: (0,0) is never on the curve for j=0 curves (Y²=X³+B). +func (p *G2Affine) SetInfinity() *G2Affine { p.X.SetZero() p.Y.SetZero() return p } -// ScalarMultiplication computes and returns p = a ⋅ s +// ScalarMultiplication computes and returns p = [s]a +// where p and a are affine points. func (p *G2Affine) ScalarMultiplication(a *G2Affine, s *big.Int) *G2Affine { var _p G2Jac _p.FromAffine(a) - _p.mulGLV(&_p, s) + if s.BitLen() >= g2ScalarMulChoose { + _p.mulGLV(&_p, s) + } else { + _p.mulWindowed(&_p, s) + } p.FromJacobian(&_p) return p } -// Add adds two point in affine coordinates. -// This should rarely be used as it is very inefficient compared to Jacobian -func (p *G2Affine) Add(a, b *G2Affine) *G2Affine { - var p1, p2 G2Jac - p1.FromAffine(a) - p2.FromAffine(b) - p1.AddAssign(&p2) - p.FromJacobian(&p1) +// ScalarMultiplicationBase computes and returns p = [s]g +// where g is the affine point generating the prime subgroup. +func (p *G2Affine) ScalarMultiplicationBase(s *big.Int) *G2Affine { + var _p G2Jac + if s.BitLen() >= g2ScalarMulChoose { + _p.mulGLV(&g2Gen, s) + } else { + _p.mulWindowed(&g2Gen, s) + } + p.FromJacobian(&_p) return p } +// Add adds two points in affine coordinates. +// It uses the Jacobian addition with a.Z=b.Z=1 and converts the result to affine coordinates. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-mmadd-2007-bl +// ~Cost: 4M + 2S +func (p *G2Affine) Add(a, b *G2Affine) *G2Affine { + var q G2Jac + // a is infinity, return b + if a.IsInfinity() { + p.Set(b) + return p + } + // b is infinity, return a + if b.IsInfinity() { + p.Set(a) + return p + } + if a.X.Equal(&b.X) { + // if b == a, we double instead + if a.Y.Equal(&b.Y) { + q.DoubleMixed(a) + return p.FromJacobian(&q) + } else { + // if b == -a, we return 0 + return p.SetInfinity() + } + } + var H, HH, I, J, r, V fptower.E2 + H.Sub(&b.X, &a.X) + HH.Square(&H) + I.Double(&HH).Double(&I) + J.Mul(&H, &I) + r.Sub(&b.Y, &a.Y) + r.Double(&r) + V.Mul(&a.X, &I) + q.X.Square(&r). + Sub(&q.X, &J). + Sub(&q.X, &V). + Sub(&q.X, &V) + q.Y.Sub(&V, &q.X). + Mul(&q.Y, &r) + J.Mul(&a.Y, &J).Double(&J) + q.Y.Sub(&q.Y, &J) + q.Z.Double(&H) + + return p.FromJacobian(&q) +} + // Double doubles a point in affine coordinates. -// This should rarely be used as it is very inefficient compared to Jacobian +// It converts the point to Jacobian coordinates, doubles it using Jacobian +// addition with a.Z=1, and converts it back to affine coordinates. +// +// http://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-mdbl-2007-bl +// ~Cost: 1M + 5S func (p *G2Affine) Double(a *G2Affine) *G2Affine { - var p1 G2Jac - p1.FromAffine(a) - p1.Double(&p1) - p.FromJacobian(&p1) + var q G2Jac + q.FromAffine(a) + q.DoubleMixed(a) + p.FromJacobian(&q) return p } -// Sub subs two point in affine coordinates. -// This should rarely be used as it is very inefficient compared to Jacobian +// Sub subtracts two points in affine coordinates. +// It uses a similar approach to Add, but negates the second point before adding. func (p *G2Affine) Sub(a, b *G2Affine) *G2Affine { - var p1, p2 G2Jac - p1.FromAffine(a) - p2.FromAffine(b) - p1.SubAssign(&p2) - p.FromJacobian(&p1) + var bneg G2Affine + bneg.Neg(b) + p.Add(a, &bneg) return p } -// Equal tests if two points (in Affine coordinates) are equal +// Equal tests if two points in affine coordinates are equal. func (p *G2Affine) Equal(a *G2Affine) bool { return p.X.Equal(&a.X) && p.Y.Equal(&a.Y) } -// Neg computes -G +// Neg sets p to the affine negative point -a = (a.X, -a.Y). func (p *G2Affine) Neg(a *G2Affine) *G2Affine { p.X = a.X p.Y.Neg(&a.Y) return p } -// FromJacobian rescales a point in Jacobian coord in z=1 plane +// FromJacobian converts a point p1 from Jacobian to affine coordinates. func (p *G2Affine) FromJacobian(p1 *G2Jac) *G2Affine { var a, b fptower.E2 @@ -133,7 +181,7 @@ func (p *G2Affine) FromJacobian(p1 *G2Jac) *G2Affine { return p } -// String returns the string representation of the point or "O" if it is infinity +// String returns the string representation E(x,y) of the affine point p or "O" if it is infinity. func (p *G2Affine) String() string { if p.IsInfinity() { return "O" @@ -141,21 +189,25 @@ func (p *G2Affine) String() string { return "E([" + p.X.String() + "," + p.Y.String() + "])" } -// IsInfinity checks if the point is infinity -// in affine, it's encoded as (0,0) -// (0,0) is never on the curve for j=0 curves +// IsInfinity checks if the affine point p is infinity, which is encoded as (0,0). +// N.B.: (0,0) is never on the curve for j=0 curves (Y²=X³+B). func (p *G2Affine) IsInfinity() bool { return p.X.IsZero() && p.Y.IsZero() } -// IsOnCurve returns true if p in on the curve +// IsOnCurve returns true if the affine point p in on the curve. func (p *G2Affine) IsOnCurve() bool { - var point G2Jac - point.FromAffine(p) - return point.IsOnCurve() // call this function to handle infinity point + if p.IsInfinity() { + return true + } + var left, right fptower.E2 + left.Square(&p.Y) + right.Square(&p.X).Mul(&right, &p.X) + right.Add(&right, &bTwistCurveCoeff) + return left.Equal(&right) } -// IsInSubGroup returns true if p is in the correct subgroup, false otherwise +// IsInSubGroup returns true if the affine point p is in the correct subgroup, false otherwise. func (p *G2Affine) IsInSubGroup() bool { var _p G2Jac _p.FromAffine(p) @@ -163,84 +215,77 @@ func (p *G2Affine) IsInSubGroup() bool { } // ------------------------------------------------------------------------------------------------- -// Jacobian +// Jacobian coordinates -// Set sets p to the provided point -func (p *G2Jac) Set(a *G2Jac) *G2Jac { - p.X, p.Y, p.Z = a.X, a.Y, a.Z +// Set sets p to a in Jacobian coordinates. +func (p *G2Jac) Set(q *G2Jac) *G2Jac { + p.X, p.Y, p.Z = q.X, q.Y, q.Z return p } -// Equal tests if two points (in Jacobian coordinates) are equal -func (p *G2Jac) Equal(a *G2Jac) bool { +// Equal tests if two points in Jacobian coordinates are equal. +func (p *G2Jac) Equal(q *G2Jac) bool { // If one point is infinity, the other must also be infinity. if p.Z.IsZero() { - return a.Z.IsZero() + return q.Z.IsZero() } // If the other point is infinity, return false since we can't // the following checks would be incorrect. - if a.Z.IsZero() { + if q.Z.IsZero() { return false } var pZSquare, aZSquare fptower.E2 pZSquare.Square(&p.Z) - aZSquare.Square(&a.Z) + aZSquare.Square(&q.Z) var lhs, rhs fptower.E2 lhs.Mul(&p.X, &aZSquare) - rhs.Mul(&a.X, &pZSquare) + rhs.Mul(&q.X, &pZSquare) if !lhs.Equal(&rhs) { return false } - lhs.Mul(&p.Y, &aZSquare).Mul(&lhs, &a.Z) - rhs.Mul(&a.Y, &pZSquare).Mul(&rhs, &p.Z) + lhs.Mul(&p.Y, &aZSquare).Mul(&lhs, &q.Z) + rhs.Mul(&q.Y, &pZSquare).Mul(&rhs, &p.Z) return lhs.Equal(&rhs) } -// Neg computes -G -func (p *G2Jac) Neg(a *G2Jac) *G2Jac { - *p = *a - p.Y.Neg(&a.Y) - return p -} - -// SubAssign subtracts two points on the curve -func (p *G2Jac) SubAssign(a *G2Jac) *G2Jac { - var tmp G2Jac - tmp.Set(a) - tmp.Y.Neg(&tmp.Y) - p.AddAssign(&tmp) +// Neg sets p to the Jacobian negative point -q = (q.X, -q.Y, q.Z). +func (p *G2Jac) Neg(q *G2Jac) *G2Jac { + *p = *q + p.Y.Neg(&q.Y) return p } -// AddAssign point addition in montgomery form -// https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#addition-add-2007-bl -func (p *G2Jac) AddAssign(a *G2Jac) *G2Jac { +// AddAssign sets p to p+a in Jacobian coordinates. +// +// https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-add-2007-bl +// ~Cost: 11M + 5S +func (p *G2Jac) AddAssign(q *G2Jac) *G2Jac { - // p is infinity, return a + // p is infinity, return q if p.Z.IsZero() { - p.Set(a) + p.Set(q) return p } - // a is infinity, return p - if a.Z.IsZero() { + // q is infinity, return p + if q.Z.IsZero() { return p } var Z1Z1, Z2Z2, U1, U2, S1, S2, H, I, J, r, V fptower.E2 - Z1Z1.Square(&a.Z) + Z1Z1.Square(&q.Z) Z2Z2.Square(&p.Z) - U1.Mul(&a.X, &Z2Z2) + U1.Mul(&q.X, &Z2Z2) U2.Mul(&p.X, &Z1Z1) - S1.Mul(&a.Y, &p.Z). + S1.Mul(&q.Y, &p.Z). Mul(&S1, &Z2Z2) - S2.Mul(&p.Y, &a.Z). + S2.Mul(&p.Y, &q.Z). Mul(&S2, &Z1Z1) - // if p == a, we double instead + // if p == q, we double instead if U1.Equal(&U2) && S1.Equal(&S2) { return p.DoubleAssign() } @@ -259,7 +304,7 @@ func (p *G2Jac) AddAssign(a *G2Jac) *G2Jac { Mul(&p.Y, &r) S1.Mul(&S1, &J).Double(&S1) p.Y.Sub(&p.Y, &S1) - p.Z.Add(&p.Z, &a.Z) + p.Z.Add(&p.Z, &q.Z) p.Z.Square(&p.Z). Sub(&p.Z, &Z1Z1). Sub(&p.Z, &Z2Z2). @@ -268,8 +313,51 @@ func (p *G2Jac) AddAssign(a *G2Jac) *G2Jac { return p } -// AddMixed point addition +// SubAssign sets p to p-a in Jacobian coordinates. +// It uses a similar approach to AddAssign, but negates the point a before adding. +func (p *G2Jac) SubAssign(q *G2Jac) *G2Jac { + var tmp G2Jac + tmp.Set(q) + tmp.Y.Neg(&tmp.Y) + p.AddAssign(&tmp) + return p +} + +// Double sets p to [2]q in Jacobian coordinates. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-mdbl-2007-bl +// ~Cost: 1M + 5S +func (p *G2Jac) DoubleMixed(a *G2Affine) *G2Jac { + var XX, YY, YYYY, S, M, T fptower.E2 + XX.Square(&a.X) + YY.Square(&a.Y) + YYYY.Square(&YY) + S.Add(&a.X, &YY). + Square(&S). + Sub(&S, &XX). + Sub(&S, &YYYY). + Double(&S) + M.Double(&XX). + Add(&M, &XX) // -> + A, but A=0 here + T.Square(&M). + Sub(&T, &S). + Sub(&T, &S) + p.X.Set(&T) + p.Y.Sub(&S, &T). + Mul(&p.Y, &M) + YYYY.Double(&YYYY). + Double(&YYYY). + Double(&YYYY) + p.Y.Sub(&p.Y, &YYYY) + p.Z.Double(&a.Y) + + return p +} + +// AddMixed sets p to p+a in Jacobian coordinates, where a.Z = 1. +// // http://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-madd-2007-bl +// ~Cost: 7M + 4S func (p *G2Jac) AddMixed(a *G2Affine) *G2Jac { //if a is infinity return p @@ -292,7 +380,7 @@ func (p *G2Jac) AddMixed(a *G2Affine) *G2Jac { // if p == a, we double instead if U2.Equal(&p.X) && S2.Equal(&p.Y) { - return p.DoubleAssign() + return p.DoubleMixed(a) } H.Sub(&U2, &p.X) @@ -317,83 +405,99 @@ func (p *G2Jac) AddMixed(a *G2Affine) *G2Jac { return p } -// Double doubles a point in Jacobian coordinates -// https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2007-bl +// Double sets p to [2]q in Jacobian coordinates. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l +// ~Cost: 2M + 5S func (p *G2Jac) Double(q *G2Jac) *G2Jac { p.Set(q) p.DoubleAssign() return p } -// DoubleAssign doubles a point in Jacobian coordinates -// https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2007-bl +// DoubleAssign doubles p in Jacobian coordinates. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l +// ~Cost: 2M + 5S func (p *G2Jac) DoubleAssign() *G2Jac { - - var XX, YY, YYYY, ZZ, S, M, T fptower.E2 - - XX.Square(&p.X) - YY.Square(&p.Y) - YYYY.Square(&YY) - ZZ.Square(&p.Z) - S.Add(&p.X, &YY) - S.Square(&S). - Sub(&S, &XX). - Sub(&S, &YYYY). - Double(&S) - M.Double(&XX).Add(&M, &XX) - p.Z.Add(&p.Z, &p.Y). - Square(&p.Z). - Sub(&p.Z, &YY). - Sub(&p.Z, &ZZ) - T.Square(&M) - p.X = T - T.Double(&S) - p.X.Sub(&p.X, &T) - p.Y.Sub(&S, &p.X). - Mul(&p.Y, &M) - YYYY.Double(&YYYY).Double(&YYYY).Double(&YYYY) - p.Y.Sub(&p.Y, &YYYY) + var A, B, C, D, E, F, t fptower.E2 + A.Square(&p.X) + B.Square(&p.Y) + C.Square(&B) + D.Add(&p.X, &B). + Square(&D). + Sub(&D, &A). + Sub(&D, &C). + Double(&D) + E.Double(&A). + Add(&E, &A) + F.Square(&E) + t.Double(&D) + p.Z.Mul(&p.Y, &p.Z). + Double(&p.Z) + p.X.Sub(&F, &t) + p.Y.Sub(&D, &p.X). + Mul(&p.Y, &E) + t.Double(&C). + Double(&t). + Double(&t) + p.Y.Sub(&p.Y, &t) return p } -// ScalarMultiplication computes and returns p = a ⋅ s +// ScalarMultiplication computes and returns p = [s]a +// where p and a are Jacobian points. +// using the GLV technique. // see https://www.iacr.org/archive/crypto2001/21390189.pdf -func (p *G2Jac) ScalarMultiplication(a *G2Jac, s *big.Int) *G2Jac { - return p.mulGLV(a, s) +func (p *G2Jac) ScalarMultiplication(q *G2Jac, s *big.Int) *G2Jac { + if s.BitLen() >= g2ScalarMulChoose { + return p.mulGLV(q, s) + } else { + return p.mulWindowed(q, s) + } +} + +// ScalarMultiplicationBase computes and returns p = [s]g +// where g is the prime subgroup generator. +func (p *G2Jac) ScalarMultiplicationBase(s *big.Int) *G2Jac { + if s.BitLen() >= g2ScalarMulChoose { + return p.mulGLV(&g2Gen, s) + } else { + return p.mulWindowed(&g2Gen, s) + } + } -// String returns canonical representation of the point in affine coordinates +// String converts p to affine coordinates and returns its string representation E(x,y) or "O" if it is infinity. func (p *G2Jac) String() string { _p := G2Affine{} _p.FromJacobian(p) return _p.String() } -// FromAffine sets p = Q, p in Jacobian, Q in affine -func (p *G2Jac) FromAffine(Q *G2Affine) *G2Jac { - if Q.IsInfinity() { +// FromAffine converts a point a from affine to Jacobian coordinates. +func (p *G2Jac) FromAffine(a *G2Affine) *G2Jac { + if a.IsInfinity() { p.Z.SetZero() p.X.SetOne() p.Y.SetOne() return p } p.Z.SetOne() - p.X.Set(&Q.X) - p.Y.Set(&Q.Y) + p.X.Set(&a.X) + p.Y.Set(&a.Y) return p } -// IsOnCurve returns true if p in on the curve +// IsOnCurve returns true if the Jacobian point p in on the curve. func (p *G2Jac) IsOnCurve() bool { - var left, right, tmp fptower.E2 + var left, right, tmp, ZZ fptower.E2 left.Square(&p.Y) right.Square(&p.X).Mul(&right, &p.X) - tmp.Square(&p.Z). - Square(&tmp). - Mul(&tmp, &p.Z). - Mul(&tmp, &p.Z). - Mul(&tmp, &bTwistCurveCoeff) + ZZ.Square(&p.Z) + tmp.Square(&ZZ).Mul(&tmp, &ZZ) + tmp.MulBybTwistCurveCoeff(&tmp) right.Add(&right, &tmp) return left.Equal(&right) } @@ -402,21 +506,24 @@ func (p *G2Jac) IsOnCurve() bool { // and https://eprint.iacr.org/2022/352.pdf, sec. 4.2 // ψ(p) = [x₀]P func (p *G2Jac) IsInSubGroup() bool { - var res, tmp G2Jac - tmp.psi(p) - res.ScalarMultiplication(p, &xGen). - SubAssign(&tmp) + if !p.IsOnCurve() { + return false + } + var res, img G2Jac + img.psi(p) + res.mulBySeed(p) - return res.IsOnCurve() && res.Z.IsZero() + return res.Equal(&img) } -// mulWindowed computes a 2-bits windowed scalar multiplication -func (p *G2Jac) mulWindowed(a *G2Jac, s *big.Int) *G2Jac { +// mulWindowed computes the 2-bits windowed double-and-add scalar +// multiplication p=[s]q in Jacobian coordinates. +func (p *G2Jac) mulWindowed(q *G2Jac, s *big.Int) *G2Jac { var res G2Jac var ops [3]G2Jac - ops[0].Set(a) + ops[0].Set(q) if s.Sign() == -1 { ops[0].Neg(&ops[0]) } @@ -443,26 +550,59 @@ func (p *G2Jac) mulWindowed(a *G2Jac, s *big.Int) *G2Jac { } -// ψ(p) = u o π o u⁻¹ where u:E'→E iso from the twist to E -func (p *G2Jac) psi(a *G2Jac) *G2Jac { - p.Set(a) +// mulBySeed multiplies the point q by the seed xGen in Jacobian coordinates +// using an optimized addition chain. +func (p *G2Jac) mulBySeed(q *G2Jac) *G2Jac { + // Generated by github.com/mmcloughlin/addchain v0.4.0. + // Operations: 61 doublings 7 additions + + // Allocate Temporaries. + var res, t0, t1 G2Jac + res.Double(q) + res.AddAssign(q) + res.Double(&res) + res.AddAssign(q) + t0.Double(&res) + for i := 1; i < 2; i++ { + t0.Double(&t0) + } + res.AddAssign(&t0) + t1.Double(&res) + t1.AddAssign(&res) + t0.AddAssign(&t1) + for i := 0; i < 10; i++ { + t0.Double(&t0) + } + res.AddAssign(&t0) + for i := 0; i < 46; i++ { + res.Double(&res) + } + res.AddAssign(q) + p.Set(&res) + return p +} + +// psi sets p to ψ(q) = u o π o u⁻¹ where u:E'→E is the isomorphism from the twist to the curve E and π is the Frobenius map. +func (p *G2Jac) psi(q *G2Jac) *G2Jac { + p.Set(q) p.X.Conjugate(&p.X).Mul(&p.X, &endo.u) p.Y.Conjugate(&p.Y).Mul(&p.Y, &endo.v) p.Z.Conjugate(&p.Z) return p } -// ϕ assigns p to ϕ(a) where ϕ: (x,y) → (w x,y), and returns p -// where w is a third root of unity in 𝔽p -func (p *G2Jac) phi(a *G2Jac) *G2Jac { - p.Set(a) +// phi sets p to ϕ(a) where ϕ: (x,y) → (w x,y), +// where w is a third root of unity. +func (p *G2Jac) phi(q *G2Jac) *G2Jac { + p.Set(q) p.X.MulByElement(&p.X, &thirdRootOneG2) return p } // mulGLV computes the scalar multiplication using a windowed-GLV method +// // see https://www.iacr.org/archive/crypto2001/21390189.pdf -func (p *G2Jac) mulGLV(a *G2Jac, s *big.Int) *G2Jac { +func (p *G2Jac) mulGLV(q *G2Jac, s *big.Int) *G2Jac { var table [15]G2Jac var res G2Jac @@ -470,11 +610,11 @@ func (p *G2Jac) mulGLV(a *G2Jac, s *big.Int) *G2Jac { res.Set(&g2Infinity) - // table[b3b2b1b0-1] = b3b2 ⋅ ϕ(a) + b1b0*a - table[0].Set(a) - table[3].phi(a) + // table[b3b2b1b0-1] = b3b2 ⋅ ϕ(q) + b1b0*q + table[0].Set(q) + table[3].phi(q) - // split the scalar, modifies ±a, ϕ(a) accordingly + // split the scalar, modifies ±q, ϕ(q) accordingly k := ecc.SplitScalar(s, &glvBasis) if k[0].Sign() == -1 { @@ -487,7 +627,7 @@ func (p *G2Jac) mulGLV(a *G2Jac, s *big.Int) *G2Jac { } // precompute table (2 bits sliding window) - // table[b3b2b1b0-1] = b3b2 ⋅ ϕ(a) + b1b0 ⋅ a if b3b2b1b0 != 0 + // table[b3b2b1b0-1] = b3b2 ⋅ ϕ(q) + b1b0 ⋅ q if b3b2b1b0 != 0 table[1].Double(&table[0]) table[2].Set(&table[1]).AddAssign(&table[0]) table[4].Set(&table[3]).AddAssign(&table[0]) @@ -543,23 +683,23 @@ func (p *G2Affine) ClearCofactor(a *G2Affine) *G2Affine { } // ClearCofactor maps a point in curve to r-torsion -func (p *G2Jac) ClearCofactor(a *G2Jac) *G2Jac { +func (p *G2Jac) ClearCofactor(q *G2Jac) *G2Jac { // https://eprint.iacr.org/2017/419.pdf, 4.1 var xg, xxg, res, t G2Jac - xg.ScalarMultiplication(a, &xGen) - xxg.ScalarMultiplication(&xg, &xGen) + xg.mulBySeed(q) + xxg.mulBySeed(&xg) res.Set(&xxg). SubAssign(&xg). - SubAssign(a) + SubAssign(q) t.Set(&xg). - SubAssign(a). + SubAssign(q). psi(&t) res.AddAssign(&t) - t.Double(a) + t.Double(q) t.X.MulByElement(&t.X, &thirdRootOneG1) res.SubAssign(&t) @@ -571,16 +711,16 @@ func (p *G2Jac) ClearCofactor(a *G2Jac) *G2Jac { } // ------------------------------------------------------------------------------------------------- -// Jacobian extended +// extended Jacobian coordinates -// Set sets p to the provided point -func (p *g2JacExtended) Set(a *g2JacExtended) *g2JacExtended { - p.X, p.Y, p.ZZ, p.ZZZ = a.X, a.Y, a.ZZ, a.ZZZ +// Set sets p to a in extended Jacobian coordinates. +func (p *g2JacExtended) Set(q *g2JacExtended) *g2JacExtended { + p.X, p.Y, p.ZZ, p.ZZZ = q.X, q.Y, q.ZZ, q.ZZZ return p } -// setInfinity sets p to O -func (p *g2JacExtended) setInfinity() *g2JacExtended { +// SetInfinity sets p to the infinity point (1,1,0,0). +func (p *g2JacExtended) SetInfinity() *g2JacExtended { p.X.SetOne() p.Y.SetOne() p.ZZ = fptower.E2{} @@ -588,44 +728,47 @@ func (p *g2JacExtended) setInfinity() *g2JacExtended { return p } -func (p *g2JacExtended) IsZero() bool { +// IsInfinity checks if the p is infinity, i.e. p.ZZ=0. +func (p *g2JacExtended) IsInfinity() bool { return p.ZZ.IsZero() } -// fromJacExtended sets Q in affine coordinates -func (p *G2Affine) fromJacExtended(Q *g2JacExtended) *G2Affine { - if Q.ZZ.IsZero() { +// fromJacExtended converts an extended Jacobian point to an affine point. +func (p *G2Affine) fromJacExtended(q *g2JacExtended) *G2Affine { + if q.ZZ.IsZero() { p.X = fptower.E2{} p.Y = fptower.E2{} return p } - p.X.Inverse(&Q.ZZ).Mul(&p.X, &Q.X) - p.Y.Inverse(&Q.ZZZ).Mul(&p.Y, &Q.Y) + p.X.Inverse(&q.ZZ).Mul(&p.X, &q.X) + p.Y.Inverse(&q.ZZZ).Mul(&p.Y, &q.Y) return p } -// fromJacExtended sets Q in Jacobian coordinates -func (p *G2Jac) fromJacExtended(Q *g2JacExtended) *G2Jac { - if Q.ZZ.IsZero() { +// fromJacExtended converts an extended Jacobian point to a Jacobian point. +func (p *G2Jac) fromJacExtended(q *g2JacExtended) *G2Jac { + if q.ZZ.IsZero() { p.Set(&g2Infinity) return p } - p.X.Mul(&Q.ZZ, &Q.X).Mul(&p.X, &Q.ZZ) - p.Y.Mul(&Q.ZZZ, &Q.Y).Mul(&p.Y, &Q.ZZZ) - p.Z.Set(&Q.ZZZ) + p.X.Mul(&q.ZZ, &q.X).Mul(&p.X, &q.ZZ) + p.Y.Mul(&q.ZZZ, &q.Y).Mul(&p.Y, &q.ZZZ) + p.Z.Set(&q.ZZZ) return p } -// unsafeFromJacExtended sets p in Jacobian coordinates, but don't check for infinity -func (p *G2Jac) unsafeFromJacExtended(Q *g2JacExtended) *G2Jac { - p.X.Square(&Q.ZZ).Mul(&p.X, &Q.X) - p.Y.Square(&Q.ZZZ).Mul(&p.Y, &Q.Y) - p.Z = Q.ZZZ +// unsafeFromJacExtended converts an extended Jacobian point, distinct from Infinity, to a Jacobian point. +func (p *G2Jac) unsafeFromJacExtended(q *g2JacExtended) *G2Jac { + p.X.Square(&q.ZZ).Mul(&p.X, &q.X) + p.Y.Square(&q.ZZZ).Mul(&p.Y, &q.Y) + p.Z = q.ZZZ return p } -// add point in Jacobian extended coordinates +// add sets p to p+q in extended Jacobian coordinates. +// // https://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#addition-add-2008-s +// ~Cost: 12M + 2S func (p *g2JacExtended) add(q *g2JacExtended) *g2JacExtended { //if q is infinity return p if q.ZZ.IsZero() { @@ -680,10 +823,13 @@ func (p *g2JacExtended) add(q *g2JacExtended) *g2JacExtended { return p } -// double point in Jacobian extended coordinates +// double sets p to [2]q in Jacobian extended coordinates. +// // http://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#doubling-dbl-2008-s-1 -// since we consider any point on Z=0 as the point at infinity -// this doubling formula works for infinity points as well +// ~Cost: 6M + 3S +// +// N.B.: since we consider any point on Z=0 as the point at infinity +// this doubling formula works for infinity points as well. func (p *g2JacExtended) double(q *g2JacExtended) *g2JacExtended { var U, V, W, S, XX, M fptower.E2 @@ -693,7 +839,7 @@ func (p *g2JacExtended) double(q *g2JacExtended) *g2JacExtended { S.Mul(&q.X, &V) XX.Square(&q.X) M.Double(&XX). - Add(&M, &XX) // -> + a, but a=0 here + Add(&M, &XX) // -> + A, but A=0 here U.Mul(&W, &q.Y) p.X.Square(&M). @@ -708,9 +854,11 @@ func (p *g2JacExtended) double(q *g2JacExtended) *g2JacExtended { return p } -// subMixed same as addMixed, but will negate a.Y +// addMixed sets p to p+q in extended Jacobian coordinates, where a.ZZ=1. +// // http://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#addition-madd-2008-s -func (p *g2JacExtended) subMixed(a *G2Affine) *g2JacExtended { +// ~Cost: 8M + 2S +func (p *g2JacExtended) addMixed(a *G2Affine) *g2JacExtended { //if a is infinity return p if a.IsInfinity() { @@ -719,7 +867,7 @@ func (p *g2JacExtended) subMixed(a *G2Affine) *g2JacExtended { // p is infinity, return a if p.ZZ.IsZero() { p.X = a.X - p.Y.Neg(&a.Y) + p.Y = a.Y p.ZZ.SetOne() p.ZZZ.SetOne() return p @@ -732,12 +880,11 @@ func (p *g2JacExtended) subMixed(a *G2Affine) *g2JacExtended { P.Sub(&P, &p.X) R.Mul(&a.Y, &p.ZZZ) - R.Neg(&R) R.Sub(&R, &p.Y) if P.IsZero() { if R.IsZero() { - return p.doubleNegMixed(a) + return p.doubleMixed(a) } p.ZZ = fptower.E2{} @@ -764,9 +911,11 @@ func (p *g2JacExtended) subMixed(a *G2Affine) *g2JacExtended { } -// addMixed +// subMixed works the same as addMixed, but negates a.Y. +// // http://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#addition-madd-2008-s -func (p *g2JacExtended) addMixed(a *G2Affine) *g2JacExtended { +// ~Cost: 8M + 2S +func (p *g2JacExtended) subMixed(a *G2Affine) *g2JacExtended { //if a is infinity return p if a.IsInfinity() { @@ -775,7 +924,7 @@ func (p *g2JacExtended) addMixed(a *G2Affine) *g2JacExtended { // p is infinity, return a if p.ZZ.IsZero() { p.X = a.X - p.Y = a.Y + p.Y.Neg(&a.Y) p.ZZ.SetOne() p.ZZZ.SetOne() return p @@ -788,11 +937,12 @@ func (p *g2JacExtended) addMixed(a *G2Affine) *g2JacExtended { P.Sub(&P, &p.X) R.Mul(&a.Y, &p.ZZZ) + R.Neg(&R) R.Sub(&R, &p.Y) if P.IsZero() { if R.IsZero() { - return p.doubleMixed(a) + return p.doubleNegMixed(a) } p.ZZ = fptower.E2{} @@ -819,54 +969,57 @@ func (p *g2JacExtended) addMixed(a *G2Affine) *g2JacExtended { } -// doubleNegMixed same as double, but will negate q.Y -func (p *g2JacExtended) doubleNegMixed(q *G2Affine) *g2JacExtended { +// doubleNegMixed works the same as doubleMixed, but negates q.Y. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#doubling-mdbl-2008-s-1 +// ~Cost: 4M + 3S +func (p *g2JacExtended) doubleNegMixed(a *G2Affine) *g2JacExtended { - var U, V, W, S, XX, M, S2, L fptower.E2 + var U, V, W, S, M, t fptower.E2 - U.Double(&q.Y) + U.Double(&a.Y) U.Neg(&U) V.Square(&U) W.Mul(&U, &V) - S.Mul(&q.X, &V) - XX.Square(&q.X) - M.Double(&XX). - Add(&M, &XX) // -> + a, but a=0 here - S2.Double(&S) - L.Mul(&W, &q.Y) - - p.X.Square(&M). - Sub(&p.X, &S2) + S.Mul(&a.X, &V) + t.Square(&a.X) + M.Double(&t). + Add(&M, &t) // -> + A, but A=0 here + p.X.Square(&M) + t.Double(&S) + p.X.Sub(&p.X, &t) + t.Mul(&W, &a.Y) p.Y.Sub(&S, &p.X). Mul(&p.Y, &M). - Add(&p.Y, &L) + Add(&p.Y, &t) p.ZZ.Set(&V) p.ZZZ.Set(&W) return p } -// doubleMixed point in Jacobian extended coordinates -// http://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#doubling-dbl-2008-s-1 -func (p *g2JacExtended) doubleMixed(q *G2Affine) *g2JacExtended { +// doubleMixed sets p to [2]a in Jacobian extended coordinates, where a.ZZ=1. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#doubling-mdbl-2008-s-1 +// ~Cost: 4M + 3S +func (p *g2JacExtended) doubleMixed(a *G2Affine) *g2JacExtended { - var U, V, W, S, XX, M, S2, L fptower.E2 + var U, V, W, S, M, t fptower.E2 - U.Double(&q.Y) + U.Double(&a.Y) V.Square(&U) W.Mul(&U, &V) - S.Mul(&q.X, &V) - XX.Square(&q.X) - M.Double(&XX). - Add(&M, &XX) // -> + a, but a=0 here - S2.Double(&S) - L.Mul(&W, &q.Y) - - p.X.Square(&M). - Sub(&p.X, &S2) + S.Mul(&a.X, &V) + t.Square(&a.X) + M.Double(&t). + Add(&M, &t) // -> + A, but A=0 here + p.X.Square(&M) + t.Double(&S) + p.X.Sub(&p.X, &t) + t.Mul(&W, &a.Y) p.Y.Sub(&S, &p.X). Mul(&p.Y, &M). - Sub(&p.Y, &L) + Sub(&p.Y, &t) p.ZZ.Set(&V) p.ZZZ.Set(&W) @@ -874,38 +1027,38 @@ func (p *g2JacExtended) doubleMixed(q *G2Affine) *g2JacExtended { } // ------------------------------------------------------------------------------------------------- -// Homogenous projective +// Homogenous projective coordinates -// Set sets p to the provided point -func (p *g2Proj) Set(a *g2Proj) *g2Proj { - p.x, p.y, p.z = a.x, a.y, a.z +// Set sets p to a in projective coordinates. +func (p *g2Proj) Set(q *g2Proj) *g2Proj { + p.x, p.y, p.z = q.x, q.y, q.z return p } -// Neg computes -G -func (p *g2Proj) Neg(a *g2Proj) *g2Proj { - *p = *a - p.y.Neg(&a.y) +// Neg sets p to the projective negative point -q = (q.X, -q.Y). +func (p *g2Proj) Neg(q *g2Proj) *g2Proj { + *p = *q + p.y.Neg(&q.y) return p } -// FromAffine sets p = Q, p in homogenous projective, Q in affine -func (p *g2Proj) FromAffine(Q *G2Affine) *g2Proj { - if Q.X.IsZero() && Q.Y.IsZero() { +// FromAffine converts q in affine to p in projective coordinates. +func (p *g2Proj) FromAffine(a *G2Affine) *g2Proj { + if a.X.IsZero() && a.Y.IsZero() { p.z.SetZero() p.x.SetOne() p.y.SetOne() return p } p.z.SetOne() - p.x.Set(&Q.X) - p.y.Set(&Q.Y) + p.x.Set(&a.X) + p.y.Set(&a.Y) return p } // BatchScalarMultiplicationG2 multiplies the same base by all scalars // and return resulting points in affine coordinates -// uses a simple windowed-NAF like exponentiation algorithm +// uses a simple windowed-NAF-like multiplication algorithm. func BatchScalarMultiplicationG2(base *G2Affine, scalars []fr.Element) []G2Affine { // approximate cost in group ops is // cost = 2^{c-1} + n(scalar.nbBits+nbChunks) @@ -984,18 +1137,29 @@ func BatchScalarMultiplicationG2(base *G2Affine, scalars []fr.Element) []G2Affin return toReturn } -// batch add affine coordinates -// using batch inversion -// special cases (doubling, infinity) must be filtered out before this call +// batchAddG2Affine adds affine points using the Montgomery batch inversion trick. +// Special cases (doubling, infinity) must be filtered out before this call. func batchAddG2Affine[TP pG2Affine, TPP ppG2Affine, TC cG2Affine](R *TPP, P *TP, batchSize int) { var lambda, lambdain TC - // add part + // from https://docs.zkproof.org/pages/standards/accepted-workshop3/proposal-turbo_plonk.pdf + // affine point addition formula + // R(X1, Y1) + P(X2, Y2) = Q(X3, Y3) + // λ = (Y2 - Y1) / (X2 - X1) + // X3 = λ² - (X1 + X2) + // Y3 = λ * (X1 - X3) - Y1 + + // first we compute the 1 / (X2 - X1) for all points using Montgomery batch inversion trick + + // X2 - X1 for j := 0; j < batchSize; j++ { lambdain[j].Sub(&(*P)[j].X, &(*R)[j].X) } - // invert denominator using montgomery batch invert technique + // montgomery batch inversion; + // lambda[0] = 1 / (P[0].X - R[0].X) + // lambda[1] = 1 / (P[1].X - R[1].X) + // ... { var accumulator fptower.E2 lambda[0].SetOne() @@ -1015,22 +1179,41 @@ func batchAddG2Affine[TP pG2Affine, TPP ppG2Affine, TC cG2Affine](R *TPP, P *TP, lambda[0].Set(&accumulator) } - var d fptower.E2 - var rr G2Affine + var t fptower.E2 + var Q G2Affine - // add part for j := 0; j < batchSize; j++ { - // computa lambda - d.Sub(&(*P)[j].Y, &(*R)[j].Y) - lambda[j].Mul(&lambda[j], &d) - - // compute X, Y - rr.X.Square(&lambda[j]) - rr.X.Sub(&rr.X, &(*R)[j].X) - rr.X.Sub(&rr.X, &(*P)[j].X) - d.Sub(&(*R)[j].X, &rr.X) - rr.Y.Mul(&lambda[j], &d) - rr.Y.Sub(&rr.Y, &(*R)[j].Y) - (*R)[j].Set(&rr) + // λ = (Y2 - Y1) / (X2 - X1) + t.Sub(&(*P)[j].Y, &(*R)[j].Y) + lambda[j].Mul(&lambda[j], &t) + + // X3 = λ² - (X1 + X2) + Q.X.Square(&lambda[j]) + Q.X.Sub(&Q.X, &(*R)[j].X) + Q.X.Sub(&Q.X, &(*P)[j].X) + + // Y3 = λ * (X1 - X3) - Y1 + t.Sub(&(*R)[j].X, &Q.X) + Q.Y.Mul(&lambda[j], &t) + Q.Y.Sub(&Q.Y, &(*R)[j].Y) + + (*R)[j].Set(&Q) + } +} + +// RandomOnG2 produces a random point in G2 +// using standard map-to-curve methods, which means the relative discrete log +// of the generated point with respect to the canonical generator is not known. +func RandomOnG2() (G2Affine, error) { + if gBytes, err := randomFrSizedBytes(); err != nil { + return G2Affine{}, err + } else { + return HashToG2(gBytes, []byte("random on g2")) } } + +func randomFrSizedBytes() ([]byte, error) { + res := make([]byte, fr.Bytes) + _, err := rand.Read(res) + return res, err +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/hash_to_curve/g1.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/hash_to_curve/g1.go new file mode 100644 index 000000000..2b9ae3ecf --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/hash_to_curve/g1.go @@ -0,0 +1,219 @@ +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package hash_to_curve + +import ( + "math/big" + + "github.com/consensys/gnark-crypto/ecc/bls12-377/fp" +) + +// Note: This only works for simple extensions + +var ( + g1sswuCurveACoeff = fp.Element{17252667382019449424, 8408110001211059699, 18415587021986261264, 10797086888535946954, 9462758283094809199, 54995354010328751} + g1sswuCurveBCoeff = fp.Element{11130294635325289193, 6502679372128844082, 15863297759487624914, 16270683149854112145, 3560014356538878812, 27923742146399959} +) + +var g1sswuCurveZ = fp.Element{9871116327010172167, 9167007004823125620, 18338974479346628539, 5649234265355377548, 13442091487463296847, 77904398905292312} + +// G1SSWUCurveCoefficients returns the coefficients of the SSWU curve. +func G1SSWUIsogenyCurveCoefficients() (A fp.Element, B fp.Element) { + return g1sswuCurveACoeff, g1sswuCurveBCoeff +} + +// G1SSWUIsogenyZ returns the recommended Z value of the SSWU curve. +// +// See https://www.rfc-editor.org/rfc/rfc9380.html#weierstrass +func G1SSWUIsogenyZ() fp.Element { + return g1sswuCurveZ +} + +var ( + g1IsogenyXNumeratorMap = []fp.Element{ + {9381318728011785451, 8795417190580748876, 15171640721257608922, 11815547924113428908, 15499908520243100994, 75408755324413256}, + {12414498063752772717, 9915153185132073893, 5598625970987438951, 3342254783599619135, 3349592178919125510, 9993871847068096}, + {4662210776746950618, 10687085762534440940, 7484820859645808636, 2221301482234255553, 10609677459585442106, 9950135580589350}, + } + g1IsogenyXDenominatorMap = []fp.Element{ + {12764504107591987636, 2767124593109192342, 3947759810240204190, 13369019134398476541, 13398368715676502040, 39975487388272384}, + } + g1IsogenyYNumeratorMap = []fp.Element{ + {13844135623281082635, 637899392157745290, 5176720401210677272, 4780940929980393029, 13803251044890140836, 51447363642369244}, + {512010462697120695, 609509684909242946, 13763343875136563934, 2839514380057330869, 15407015190976871917, 114223893455203604}, + {14191436515319700132, 6479619458373647736, 9513056055282499867, 15178407828209519654, 12166396751953702822, 75539964123849493}, + {2331105388373475309, 5343542881267220470, 12965782466677680126, 1110650741117127776, 5304838729792721053, 4975067790294675}, + } + g1IsogenyYDenominatorMap = []fp.Element{ + {8694832399336342723, 13482963304561246841, 6984108042366343277, 8355250559073919616, 16937021447778317421, 44890599540624877}, + {1100361703846424922, 5005767817281133373, 917019320419705433, 14251746270386956490, 5522097789867984932, 4443041874334878}, + {1400024175356859676, 8301373779327577028, 11843279430720612570, 3213569255776326391, 3301617999610402890, 119926462164817154}, + } +) + +// G1IsogenyMap returns the isogeny map for the curve. +// The isogeny map is a list of polynomial coefficients for the x and y coordinate computation. +// The order of the coefficients is as follows: +// - x numerator, x denominator, y numerator, y denominator. +func G1IsogenyMap() [4][]fp.Element { + return [4][]fp.Element{ + g1IsogenyXNumeratorMap, + g1IsogenyXDenominatorMap, + g1IsogenyYNumeratorMap, + g1IsogenyYDenominatorMap, + } +} + +func g1IsogenyXNumerator(dst *fp.Element, x *fp.Element) { + g1EvalPolynomial(dst, false, g1IsogenyXNumeratorMap, x) +} + +func g1IsogenyXDenominator(dst *fp.Element, x *fp.Element) { + g1EvalPolynomial(dst, true, g1IsogenyXDenominatorMap, x) +} + +func g1IsogenyYNumerator(dst *fp.Element, x *fp.Element, y *fp.Element) { + var _dst fp.Element + g1EvalPolynomial(&_dst, false, g1IsogenyYNumeratorMap, x) + dst.Mul(&_dst, y) +} + +func g1IsogenyYDenominator(dst *fp.Element, x *fp.Element) { + g1EvalPolynomial(dst, true, g1IsogenyYDenominatorMap, x) +} + +// G1 computes the isogeny map of the curve element, given by its coordinates pX and pY. +// It mutates the coordinates pX and pY to the new coordinates of the isogeny map. +func G1Isogeny(pX, pY *fp.Element) { + + den := make([]fp.Element, 2) + + g1IsogenyYDenominator(&den[1], pX) + g1IsogenyXDenominator(&den[0], pX) + + g1IsogenyYNumerator(pY, pX, pY) + g1IsogenyXNumerator(pX, pX) + + den = fp.BatchInvert(den) + + pX.Mul(pX, &den[0]) + pY.Mul(pY, &den[1]) +} + +// G1SqrtRatio computes the square root of u/v and returns 0 iff u/v was indeed a quadratic residue. +// If not, we get sqrt(Z * u / v). Recall that Z is non-residue. +// If v = 0, u/v is meaningless and the output is unspecified, without raising an error. +// The main idea is that since the computation of the square root involves taking large powers of u/v, the inversion of v can be avoided +func G1SqrtRatio(z *fp.Element, u *fp.Element, v *fp.Element) uint64 { + + // https://www.rfc-editor.org/rfc/rfc9380.html#name-sqrt_ratio-for-any-field + + tv1 := fp.Element{7563926049028936178, 2688164645460651601, 12112688591437172399, 3177973240564633687, 14764383749841851163, 52487407124055189} //tv1 = c6 + + var tv2, tv3, tv4, tv5 fp.Element + var exp big.Int + // c4 = 70368744177663 = 2⁴⁶ - 1 + // q is odd so c1 is at least 1. + exp.SetBytes([]byte{63, 255, 255, 255, 255, 255}) + + tv2.Exp(*v, &exp) // 2. tv2 = vᶜ⁴ + tv3.Square(&tv2) // 3. tv3 = tv2² + tv3.Mul(&tv3, v) // 4. tv3 = tv3 * v + tv5.Mul(u, &tv3) // 5. tv5 = u * tv3 + + // c3 = 1837921289030710838195067919506396475074392872918698035817074744121558668640693829665401097909504529 + exp.SetBytes([]byte{3, 92, 116, 140, 47, 138, 33, 213, 140, 118, 11, 128, 217, 66, 146, 118, 52, 69, 179, 230, 1, 234, 39, 30, 61, 230, 196, 95, 116, 18, 144, 0, 46, 22, 186, 136, 96, 0, 0, 1, 10, 17}) + + tv5.Exp(tv5, &exp) // 6. tv5 = tv5ᶜ³ + tv5.Mul(&tv5, &tv2) // 7. tv5 = tv5 * tv2 + tv2.Mul(&tv5, v) // 8. tv2 = tv5 * v + tv3.Mul(&tv5, u) // 9. tv3 = tv5 * u + tv4.Mul(&tv3, &tv2) // 10. tv4 = tv3 * tv2 + + // c5 = 35184372088832 + exp.SetBytes([]byte{32, 0, 0, 0, 0, 0}) + tv5.Exp(tv4, &exp) // 11. tv5 = tv4ᶜ⁵ + isQNr := g1NotOne(&tv5) // 12. isQR = tv5 == 1 + c7 := fp.Element{13262060633605929793, 16269117706405780335, 1787999441809606207, 11078968899094441280, 17534011895423012165, 96686002316065324} + tv2.Mul(&tv3, &c7) // 13. tv2 = tv3 * c7 + tv5.Mul(&tv4, &tv1) // 14. tv5 = tv4 * tv1 + tv3.Select(int(isQNr), &tv3, &tv2) // 15. tv3 = CMOV(tv2, tv3, isQR) + tv4.Select(int(isQNr), &tv4, &tv5) // 16. tv4 = CMOV(tv5, tv4, isQR) + exp.Lsh(big.NewInt(1), 46-2) // 18, 19: tv5 = 2ⁱ⁻² for i = c1 + + for i := 46; i >= 2; i-- { // 17. for i in (c1, c1 - 1, ..., 2): + + tv5.Exp(tv4, &exp) // 20. tv5 = tv4ᵗᵛ⁵ + nE1 := g1NotOne(&tv5) // 21. e1 = tv5 == 1 + tv2.Mul(&tv3, &tv1) // 22. tv2 = tv3 * tv1 + tv1.Mul(&tv1, &tv1) // 23. tv1 = tv1 * tv1 Why not write square? + tv5.Mul(&tv4, &tv1) // 24. tv5 = tv4 * tv1 + tv3.Select(int(nE1), &tv3, &tv2) // 25. tv3 = CMOV(tv2, tv3, e1) + tv4.Select(int(nE1), &tv4, &tv5) // 26. tv4 = CMOV(tv5, tv4, e1) + + if i > 2 { + exp.Rsh(&exp, 1) // 18, 19. tv5 = 2ⁱ⁻² + } + } + + *z = tv3 + return isQNr +} + +func g1NotOne(x *fp.Element) uint64 { + + var one fp.Element + return one.SetOne().NotEqual(x) + +} + +// G1MulByZ multiplies x by [5] and stores the result in z +func G1MulByZ(z *fp.Element, x *fp.Element) { + + res := *x + + res.Double(&res) + res.Double(&res) + res.Add(&res, x) + + *z = res +} + +func g1EvalPolynomial(z *fp.Element, monic bool, coefficients []fp.Element, x *fp.Element) { + dst := coefficients[len(coefficients)-1] + + if monic { + dst.Add(&dst, x) + } + + for i := len(coefficients) - 2; i >= 0; i-- { + dst.Mul(&dst, x) + dst.Add(&dst, &coefficients[i]) + } + + z.Set(&dst) +} + +// G1Sgn0 is an algebraic substitute for the notion of sign in ordered fields. +// Namely, every non-zero quadratic residue in a finite field of characteristic =/= 2 has exactly two square roots, one of each sign. +// +// See: https://www.rfc-editor.org/rfc/rfc9380.html#name-the-sgn0-function +// +// The sign of an element is not obviously related to that of its Montgomery form +func G1Sgn0(z *fp.Element) uint64 { + + nonMont := z.Bits() + + // m == 1 + return nonMont[0] % 2 + +} + +func G1NotZero(x *fp.Element) uint64 { + + return x[0] | x[1] | x[2] | x[3] | x[4] | x[5] + +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/hash_to_curve/g2.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/hash_to_curve/g2.go new file mode 100644 index 000000000..23c1dd5fb --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/hash_to_curve/g2.go @@ -0,0 +1,690 @@ +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package hash_to_curve + +import ( + "math/big" + + "github.com/consensys/gnark-crypto/ecc/bls12-377/fp" + "github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower" +) + +// Note: This only works for simple extensions + +var ( + g2sswuCurveACoeff = fptower.E2{ + A0: fp.Element{4274545572028848265, 14157081418478689358, 13123833976752631407, 4466041663276938746, 9062541850312583986, 90030181981586611}, + A1: fp.Element{4627353644986202063, 14941155654691983603, 14266958733709189881, 10264689865410103271, 10052798319587953375, 111844286035220969}, + } + g2sswuCurveBCoeff = fptower.E2{ + A0: fp.Element{10237434857876739089, 8476639787604822147, 6641637803208190023, 1721529389316620686, 8656544759275761743, 38999476160258021}, + A1: fp.Element{2360755569119276357, 10390833517265838837, 12467133771585386911, 8219721226907645480, 3130947551623757939, 83517800164149569}, + } +) + +var g2sswuCurveZ = fptower.E2{ + A0: fp.Element{10560307807486212317, 9936456306313395274, 2092561269709285211, 8738829082964617622, 5243865315912343348, 114311569748804731}, + A1: fp.Element{202099033278250856, 5854854902718660529, 11492539364873682930, 8885205928937022213, 5545221690922665192, 39800542322357402}, +} + +// G2SSWUCurveCoefficients returns the coefficients of the SSWU curve. +func G2SSWUIsogenyCurveCoefficients() (A fptower.E2, B fptower.E2) { + return g2sswuCurveACoeff, g2sswuCurveBCoeff +} + +// G2SSWUIsogenyZ returns the recommended Z value of the SSWU curve. +// +// See https://www.rfc-editor.org/rfc/rfc9380.html#weierstrass +func G2SSWUIsogenyZ() fptower.E2 { + return g2sswuCurveZ +} + +var ( + g2IsogenyXNumeratorMap = []fptower.E2{ + { + A0: fp.Element{3551783286045471771, 15672698349814166255, 7201714524012399751, 9685135133462022557, 11459791422433132438, 34279211894444158}, + A1: fp.Element{6733784119909728882, 8027365598504339614, 9826395261252013434, 17766961605401961078, 16718790361550578585, 8827310132881948}, + }, + { + A0: fp.Element{10039326048219096853, 8025585753053690704, 15692757884719051200, 14081267914923412694, 12483400733579637594, 41501995942887693}, + A1: fp.Element{3285050121746765179, 16424976010740556635, 13525960835401060630, 8230390587856081588, 332312595686915068, 58693565636984574}, + }, + { + A0: fp.Element{17569899329826403508, 9637548884483664645, 11559603533194429416, 509473447889017775, 16843450937194425803, 11820413515158522}, + A1: fp.Element{18082143759519379917, 7350976797508953919, 8718515184478260262, 11424641547646470649, 12610734036362352161, 109931236078585740}, + }, + { + A0: fp.Element{14344095877598929896, 14770204065590636976, 13870643972022067464, 14327299415926938990, 2100218127689809229, 111985606372347998}, + A1: fp.Element{18166912950538149334, 7903342274102247275, 11235613814926762637, 6048582781848067329, 9865957781737849443, 72257053590751229}, + }, + { + A0: fp.Element{9289693438943775070, 611273684478921638, 3161020385710416475, 2286858861996231773, 14631078872284738786, 101751379483637100}, + A1: fp.Element{218371821390517888, 3239557307852648611, 7956123978234311251, 4433191957359481551, 7602230667186897987, 36183482319693410}, + }, + { + A0: fp.Element{7524026848147356443, 15899508093607509001, 9269755160329214834, 12526651159477248728, 3756002781809695765, 101164747683440023}, + A1: fp.Element{6220885675233469595, 1070578225745722143, 9028649589122227273, 241265531361573072, 17722097355684345537, 59426317598728635}, + }, + { + A0: fp.Element{1147337684740884862, 11995598217907408439, 6334092051568104396, 4490620767408292574, 16484486820571077628, 32056264099725884}, + A1: fp.Element{1626504798254052117, 15843967556282260399, 3222912561813979091, 1092398256542226755, 15613117580878270463, 35759440311789519}, + }, + { + A0: fp.Element{9456818710433496904, 8738575976265225627, 17481785322204872502, 10252666647792359788, 13007033241788380867, 54062177864773120}, + A1: fp.Element{7857657292788377886, 18159261954362575139, 6957043223229770024, 101887390030524213, 7411469664095682342, 17462521019270966}, + }, + { + A0: fp.Element{5935437080311313022, 4869272223104979307, 14892623520420170949, 6274040211921387638, 190450687675494048, 100326942952217018}, + A1: fp.Element{4080141112519796596, 14389619698824585061, 15572076811388758383, 5573262239497616930, 5714216936392065098, 10910945353280475}, + }, + { + A0: fp.Element{12050383421129197508, 7679000367015579641, 4181895471589351098, 4488864303009131705, 1755297417051974713, 33780283701258651}, + A1: fp.Element{11393221592097145268, 10835918896706663346, 4746287363995169177, 6169630568067228482, 11259555703140136465, 52771734216395635}, + }, + { + A0: fp.Element{4577617767559140265, 568504000295320317, 4739467389388831592, 9537638546299567945, 11669151734363428413, 119097732794758712}, + A1: fp.Element{5691235310984308451, 13601281267571106288, 7819292534586961743, 11652278682059157182, 2231701566242469994, 110966193728844398}, + }, + { + A0: fp.Element{8957158313166077105, 5669155713645675267, 17333896861619738764, 4892240835897020648, 8492829473755858526, 70767002641220602}, + A1: fp.Element{8355305174234995113, 16726408794609999189, 6819868380250046496, 9302398329327482182, 3371252083110614225, 32903157732774708}, + }, + { + A0: fp.Element{3562726361589542410, 15642076536163677636, 3828009540728039550, 5513538145598570884, 1202255355797680138, 19209968154720986}, + A1: fp.Element{2433342667414904247, 14430646666116795259, 7881503288178112304, 10086912537277758921, 14321155618236575013, 84224128485096326}, + }, + { + A0: fp.Element{7543845460144717594, 14101022520017632284, 6419288061290617259, 11326768478076341964, 18432026940412127132, 85359846879027793}, + A1: fp.Element{17142157839755119212, 5159976764710014065, 6393633352893279233, 8672509349035392886, 7859431465567482570, 62163334379266093}, + }, + { + A0: fp.Element{2954881934412060022, 10898916794193723070, 10915833338735408379, 703491535562714344, 14589964434689495439, 90051679935520087}, + A1: fp.Element{18417998714611085978, 11039054240270137506, 9972891257774348246, 13263552626589315210, 4522668809484918556, 63885995997825101}, + }, + { + A0: fp.Element{9864134077459603571, 12525567282624341376, 5205345924937688700, 12649124091757575439, 14636003906379491067, 96025183135833306}, + A1: fp.Element{10316403063861314867, 10750711173072110600, 4513675589861596212, 2635673197095740125, 16720951430549947037, 31390298180493148}, + }, + { + A0: fp.Element{3003952238586646516, 3250841642932517220, 7061834734009117554, 16259415476002355236, 1626926148029432162, 77189086665928784}, + A1: fp.Element{14450051585993059472, 11823315281584113748, 6929304997500454604, 15344892292748160673, 15787768514545706202, 69813057053620435}, + }, + { + A0: fp.Element{4228110392233474072, 18010581486575392207, 13699345898545483049, 17704744337446085874, 5487913134051621310, 112205105149111207}, + A1: fp.Element{14824585485470590037, 7637124239293942071, 1041102438278370701, 4207950142422409777, 9639439542389544094, 106832755917361143}, + }, + { + A0: fp.Element{10744145886747796703, 8741979218876153119, 4537642647264646058, 9645243825719833866, 16643801652280184094, 57528843479739428}, + A1: fp.Element{5785935421797206370, 847985697064985249, 11478142027129258160, 12741057482356268413, 10148591557028647803, 106797667835022069}, + }, + { + A0: fp.Element{6454832842704992412, 9977685523482313420, 413111938383295655, 13594952949000658414, 17807487788385728582, 108984464456649540}, + A1: fp.Element{17048359867690489456, 2859252502285541521, 10818623701995947153, 7550564651763690537, 459333235977057482, 37663478480017988}, + }, + { + A0: fp.Element{8658783637463168087, 13532094408327228336, 12875492560745818922, 6809856611120372218, 2853890452345629690, 87034840621524077}, + A1: fp.Element{16301307707120111515, 9104654412985804807, 12475785366789695268, 4024450921325678435, 5626908908910088752, 56687303925216568}, + }, + { + A0: fp.Element{9729408098285946449, 14379177692720606450, 15077053755146607368, 1299576162980711320, 13990524355831736308, 88070216003513722}, + A1: fp.Element{5766436769337206504, 1093294963802231624, 1118315683159380206, 16238633443172785277, 5463682062430385614, 116508026946667814}, + }, + { + A0: fp.Element{16584249698770136319, 8326278446225484560, 3131917383401484830, 4756633391835977312, 7642636045510739113, 6547192373501023}, + A1: fp.Element{10803045440816594384, 6133821182275761752, 7762705812675926549, 15035799326051880159, 10201360843527298396, 76693252438359195}, + }, + { + A0: fp.Element{3621702609341817994, 1179514540952803843, 9695126383219869545, 4861853798003230532, 15648444733987506481, 103088924877589738}, + A1: fp.Element{0}, + }, + } + g2IsogenyXDenominatorMap = []fptower.E2{ + { + A0: fp.Element{1063048776114699222, 13419136991291290443, 17670140655952814712, 17007170270485437006, 2714055472280753035, 14919040757258909}, + A1: fp.Element{16666868668043867029, 10413023948165423527, 2513282340300795191, 5135056029366772344, 18074639060500180041, 66260525510488187}, + }, + { + A0: fp.Element{10940415603117103310, 2845175453419864190, 16971099885047235913, 4517542951822462583, 12015180195047358700, 101962474939260879}, + A1: fp.Element{1812172074217037271, 9040376510937171745, 1548369375982775200, 5323713323104515663, 11625954855074087334, 4220230277540083}, + }, + { + A0: fp.Element{8797262280793960976, 17802450974932240081, 10157003283304584770, 593225980605733121, 14184353532500093055, 108979035901112461}, + A1: fp.Element{15554837140147424903, 1512405638789788986, 3262333938884419786, 4638305243452530609, 139542405126620667, 54024907639584882}, + }, + { + A0: fp.Element{11424716963860540790, 13456329776215064369, 1929697779149270213, 6306593112502705131, 13859057472975507250, 41785102954052035}, + A1: fp.Element{7602541488494927932, 4897344463908346766, 17005994653424089316, 17216735712046963938, 3756018940504096168, 5402674048264985}, + }, + { + A0: fp.Element{2416535722849524790, 4831233808757576698, 17297774284520319797, 6772473332127607735, 18174962172090050489, 58994994344686536}, + A1: fp.Element{15610410799617712282, 9543692017702705957, 8970286522052539731, 12714219237879632746, 2449975609997710437, 10121059733973512}, + }, + { + A0: fp.Element{15388608950644940213, 15178518612850901922, 4663566445208062329, 3999751164791233677, 7358895960008222342, 33044898311505685}, + A1: fp.Element{2356569524239497521, 4634121806982763800, 13294827248503187097, 18379906191200424608, 13949207972645393879, 37350653623873291}, + }, + { + A0: fp.Element{4970487283568561993, 8451944303783250587, 10744185545939488302, 297910826254460501, 5663064319185246782, 55864728573479562}, + A1: fp.Element{13676619861655804765, 9740179349809417716, 1447466405783296044, 7262347140551810932, 4460517809397706328, 48696693541469882}, + }, + { + A0: fp.Element{4218670501850515232, 1300837062036343562, 6322288902222626865, 2517640049285419442, 15933997662514683752, 35742655751559900}, + A1: fp.Element{8671399843829082486, 10727571055999201132, 18066412728811459184, 2077243532292929295, 18402906919639961112, 11053564656556137}, + }, + { + A0: fp.Element{13549293427847064273, 13454861990004702789, 12625716182603551974, 16289223817658875114, 709786698748164395, 79373748066056979}, + A1: fp.Element{9755261456181601166, 8062867867952015070, 11667298511884909423, 12783693965971962594, 5335701901003645771, 118924945769569072}, + }, + { + A0: fp.Element{5024330816113629597, 9162185537450801251, 14637535063833510048, 5042964231794706299, 10987285991634226322, 46336617111585333}, + A1: fp.Element{17451698037621354790, 10238258568486351103, 10306732172443683782, 16783673474705190959, 2366024509224094980, 27102949281362657}, + }, + { + A0: fp.Element{1779719694787807439, 13682444363499832102, 319805876265464201, 10878143779945294209, 5260570358490406259, 111384964548942529}, + A1: fp.Element{10364815279125342799, 5955681787042171859, 16259776976357711022, 698420282628335564, 14458917752432688041, 9951241155641633}, + }, + { + A0: fp.Element{9860169129499874274, 4710132861939245083, 16729683163954203081, 1163919786098698325, 16999533791398931846, 45007426249965870}, + A1: fp.Element{1554156753268998897, 13001788039766734041, 13083055690099472212, 15457335577166095794, 9225717367159961098, 40091861438122274}, + }, + { + A0: fp.Element{15170394446649694794, 515688257282406708, 7546053921359572147, 2040402108618036352, 14910633907967741865, 51620635462170312}, + A1: fp.Element{14097816726424606264, 12505549891408832791, 13993079436736795338, 10172463092702817360, 608991345474995671, 70034669163571313}, + }, + { + A0: fp.Element{4643108199199003526, 15736620484932148216, 15681664113334307244, 17299685843716562967, 13906356132799386736, 93346316071232156}, + A1: fp.Element{4605618257264761423, 18021103018327472901, 16108946406338519358, 9045268489748282166, 5059321869053749600, 110536556169650965}, + }, + { + A0: fp.Element{11517108407780568371, 7978619811691229504, 9264608640258152436, 8451802924690124465, 4675285626878377699, 109463398958344863}, + A1: fp.Element{3597960821476001565, 3759680844169152876, 14302414818654496990, 17433096654117785124, 17967041042193057544, 85366167313641495}, + }, + { + A0: fp.Element{9939822412604413185, 13452127979624463736, 5130248585009642508, 3885932386715663181, 5051687816649505884, 77901780572240613}, + A1: fp.Element{519763984047258436, 9600915485628319569, 15140529797299450996, 9971542775239334883, 8807015558507490608, 948222705021672}, + }, + { + A0: fp.Element{2827339587428175511, 6895834130469522434, 13331059522798479027, 13955187059915735579, 14378880524037078149, 37849146151734053}, + A1: fp.Element{5659129353366385472, 1315670479643534676, 5263307416551198333, 6925817959331280727, 2077163856293267360, 78059303625906606}, + }, + { + A0: fp.Element{12063007979636530410, 11856928215255593909, 11875394835884852884, 7779285203935234969, 6621016507099994054, 58081312732574672}, + A1: fp.Element{16883486087598545310, 13020319043706888256, 13790070886127375971, 1584348143126996741, 14269751476430075034, 39520851290632316}, + }, + { + A0: fp.Element{10496651096160116529, 17447330314090714314, 7901980568892205616, 12523643767284114259, 14047697587913173436, 75967257029771325}, + A1: fp.Element{928850053641029162, 14269106311960337185, 16222409674828338261, 5805191570224440459, 18405225593952050465, 81611267238126250}, + }, + { + A0: fp.Element{11963245856892367752, 10425756598646938656, 18335238837348744770, 15086772981218061512, 16514870314421827966, 31505685309500160}, + A1: fp.Element{12503518650914401765, 9253053408485518576, 7574198415595259890, 9578781703355827570, 4997060354564847196, 4129967821132897}, + }, + { + A0: fp.Element{2031421031641935199, 11357963626711833272, 3216176135850906142, 18356175605205399499, 14930266308542898024, 45166487627178747}, + A1: fp.Element{4224679465464892278, 5162816687557914011, 9625001313214472999, 9646089844316603379, 3042432097393437616, 116654205222221531}, + }, + { + A0: fp.Element{707631102761073363, 4675040476129639901, 7917747947488915690, 10109499984363985170, 8993410474198507338, 72712009800189820}, + A1: fp.Element{13149412355826661761, 13738163990683470943, 2035497293527985654, 18119267602401018212, 2631647798265895027, 2795783216290358}, + }, + } + g2IsogenyYNumeratorMap = []fptower.E2{ + { + A0: fp.Element{17926225976816550695, 14023720841551579195, 6357178813752170559, 1429363592569423041, 10398153225153858948, 33711798988254397}, + A1: fp.Element{2451854115792992988, 8983506616720050336, 2910564589437158732, 14075622914381394491, 9210830493684175792, 3356683084380210}, + }, + { + A0: fp.Element{5363401642911389912, 1675875184098052872, 15320530934239994732, 16287584047609698426, 10234580471621189795, 40152057551620421}, + A1: fp.Element{2205557896318444105, 4065007897235623968, 4049591920488634456, 16004168804099107709, 13290522222905374988, 70089339901218536}, + }, + { + A0: fp.Element{1887285394871164447, 7142690945990485012, 11190732658400833066, 6881717282640585612, 12116088968278807379, 103071704289665226}, + A1: fp.Element{15968649428224979513, 622837296484333259, 15527184444320989860, 2221190225062639140, 16647213690505955661, 110449865605275384}, + }, + { + A0: fp.Element{8732294600695513394, 7924365878303510912, 12588020556237861366, 10068029016225118132, 785053188876688927, 120347068207419939}, + A1: fp.Element{14514622768737464893, 5553264648606662629, 12707457796658055665, 6066303778837734141, 8279024849745683367, 3564406469625657}, + }, + { + A0: fp.Element{10035254538193759291, 9758866910217654439, 2724217928072676653, 3087232989313988901, 14980280964270815877, 34590022796322467}, + A1: fp.Element{15702474365778911803, 7256912742043165018, 1566344877835261304, 4035729625101537726, 16346625826270990512, 84087754076446931}, + }, + { + A0: fp.Element{8353555275402615800, 6017666668033757053, 13076202439893933084, 1913164921831891521, 13296563472388407395, 43485447354470561}, + A1: fp.Element{12571296156797641372, 13988198528186614994, 5672291450663514913, 7033607850615758657, 16846880911077910300, 44471894806759326}, + }, + { + A0: fp.Element{1319289899879823718, 1591088360172441240, 7805677496653365276, 5569897284498525554, 5635591756513279404, 74901024143303203}, + A1: fp.Element{10251017843654697682, 10395107644570958416, 3071938417266745181, 16127666859700570668, 5111665418914357408, 2168588371926498}, + }, + { + A0: fp.Element{7692831217085618076, 6702179445852008930, 11308520252707392151, 12038365346701529390, 7201289518723110646, 24757234241788495}, + A1: fp.Element{17948859968330001914, 10144279887227452625, 5167544611537672341, 4094514978127885079, 17912079766649616973, 45691468580901020}, + }, + { + A0: fp.Element{3911440855998194160, 13198838254872822648, 13301641437413064797, 11598620320741753383, 6260523097595092689, 78284230929812985}, + A1: fp.Element{7876366075466990529, 13523468790275433139, 982512625724968021, 2122595334378906057, 14803785928219626498, 71415583741911053}, + }, + { + A0: fp.Element{14923926944529083273, 3172840012894527710, 8293434476071337387, 16713256045335958267, 14057165773167995662, 57626475506313562}, + A1: fp.Element{1362417042314121750, 3304417561071796103, 17626406775105189491, 11748219015558348173, 14151421547261463616, 82460535821434588}, + }, + { + A0: fp.Element{3641967463568066103, 8959416625663108732, 5147508997828480363, 16811352377666989046, 1441182181356889676, 52012247235371457}, + A1: fp.Element{17686146190561162997, 11457769513035421935, 11629039572857129752, 16013548565551254584, 3489389447040062088, 108111902919606578}, + }, + { + A0: fp.Element{3810472718885394006, 2981020169366520013, 2816385682378197235, 153866317221550159, 11847618666936524337, 45551005605881971}, + A1: fp.Element{3468095351662354134, 4642197759139584052, 4233923780028877603, 17495173774535575422, 6042084483130094534, 67695926977382460}, + }, + { + A0: fp.Element{1324953063484934482, 15924484690572898301, 11397027945012096698, 2650928770069584769, 15779309286157100138, 107280353846472153}, + A1: fp.Element{7825813464319090460, 9031312139767459777, 142189155675192148, 6582610291000324889, 17102396003811978688, 22084094988625284}, + }, + { + A0: fp.Element{5210064249141309135, 1705543797894948713, 2628665872375881350, 13536211673960271710, 18420806283098729881, 115824256193502087}, + A1: fp.Element{15082907751180860242, 6568697878451242210, 16244491021091296231, 17790448340613041754, 7733097786923840729, 14504831353209381}, + }, + { + A0: fp.Element{1708526764431582271, 13958279355051552323, 14990211071762970223, 7884242526085975541, 16332397605884981291, 80533848446738849}, + A1: fp.Element{14979957683309612745, 6077136825354362762, 8344075647158254715, 10162044015152162839, 5892600246835629906, 87516868768986919}, + }, + { + A0: fp.Element{13823384149985104375, 400062563487168190, 14946453239900597346, 3063239780002983931, 12307299790663558215, 82575345472847758}, + A1: fp.Element{4955387593349539956, 11580263215419679285, 13810204272372323220, 15118104627613044122, 5709821153764726112, 97792497530186865}, + }, + { + A0: fp.Element{8029106480647627463, 9339835209992361362, 2257747803917390435, 13841766612482081060, 11846105036367819521, 10985089103756089}, + A1: fp.Element{12896564185217823813, 11446288085903243988, 7990576940036837900, 3323202217483830000, 8230734762253073878, 36590510406546600}, + }, + { + A0: fp.Element{9258620980666570289, 14799769271847025124, 3337623733744503313, 7847288847664005088, 4443979768963902018, 60018570132140318}, + A1: fp.Element{2675246192261018596, 15150250319428322656, 8044595947793549351, 17819017498503740634, 8168003399719773701, 50802205070212383}, + }, + { + A0: fp.Element{6416675551757596528, 11137110755893373387, 12196234615749865580, 10261229930898283794, 16443034629854739148, 92762661836396101}, + A1: fp.Element{2617757450501858457, 13481841765161333192, 14399351126797435540, 14845648777279341476, 16479218442290092360, 58694504406226241}, + }, + { + A0: fp.Element{2498292483400110656, 17577335584861186499, 17782334663901894811, 2829649086165738601, 1498570879458573752, 54126946483698861}, + A1: fp.Element{13664305368410221366, 15519373467383236285, 6930373704919785768, 5035259077705758702, 15118622066815350587, 76218461077450180}, + }, + { + A0: fp.Element{2359464294290896887, 15126005627433822176, 8745471049496239338, 16249169944251666409, 5887779353961924474, 9756279022859315}, + A1: fp.Element{4564346538121733135, 7083224900235365477, 12708889282498498077, 7850548098138279688, 14178174888234998222, 79663491154927524}, + }, + { + A0: fp.Element{2363371748841007386, 8201543480932182326, 3606722496785934427, 11335897361905574349, 7238564335142183540, 28370763379089425}, + A1: fp.Element{17773120842166679454, 6968817275085296949, 589078002303466881, 11901496965136831973, 17508389603594408067, 105726710734816064}, + }, + { + A0: fp.Element{7295712044514929446, 1419749005841863626, 15921158613862149232, 9464988326326595083, 4254037448365833139, 69144288462579473}, + A1: fp.Element{2330521880128496868, 6942731841460529291, 16753201799444057524, 5125438220420299042, 743707329901356982, 86418732453789215}, + }, + { + A0: fp.Element{10073672469351267894, 7530218602938011234, 12150950127635720924, 14699101300080070173, 3657462378365608060, 50677269975209252}, + A1: fp.Element{16217326474471800173, 12182932688121705224, 9523557196391803719, 13559107473982584173, 14264388955497449506, 89155196038187526}, + }, + { + A0: fp.Element{8500524953883552338, 13471246252006481381, 399342016929624192, 15321780621361720165, 1735807610194144505, 81584295376527434}, + A1: fp.Element{3028140852425956403, 9738549527114127103, 13145547273810927, 15439064114192138046, 15332022320720552951, 84308032823666865}, + }, + { + A0: fp.Element{8795699974103596314, 642987394252844125, 12559698238980671421, 15439596853334509309, 8192837603484177265, 86858193154220713}, + A1: fp.Element{13665577425741482529, 6924526015867702055, 8773433633434605845, 4385776193759960181, 14751123844375383386, 84259094466106596}, + }, + { + A0: fp.Element{6308743764871173820, 14529376135552483358, 3992864522868188832, 16018150786687814926, 14942376479240309869, 30721880050281254}, + A1: fp.Element{8640235552523037016, 9835096537876469025, 789797926152341591, 17554386444425767744, 2184317346571194421, 105569965705365467}, + }, + { + A0: fp.Element{10895141504918788686, 5671269070898752172, 9721970862384110947, 6958416614840799556, 18087813302866953828, 120526621462965167}, + A1: fp.Element{4966785024859028542, 18182687130036955400, 10092534947477547130, 11367367723010839926, 7417818378683193783, 94369912047147779}, + }, + { + A0: fp.Element{5709922971951703245, 10382852257937442526, 3453842328747730539, 16133368957829378910, 8271517063962590774, 9539719803485949}, + A1: fp.Element{1704900793320796784, 8995901783485359023, 9994857694012530400, 7408202244508772902, 18055801701001909838, 109149704128086904}, + }, + { + A0: fp.Element{8357460663115985094, 5765296628618444602, 6421674075164890879, 1651079036919805888, 1287520506307076832, 98975482931648514}, + A1: fp.Element{8078944849704442787, 4038716179863104913, 8864619430523621449, 11983583689047803099, 2541042365160408900, 28281336919305267}, + }, + { + A0: fp.Element{13472601104608613638, 521231156844377864, 4649313698209759510, 5796371833735044995, 8684999192663632207, 51033152603009675}, + A1: fp.Element{3409558318672010377, 10145443448574304058, 3995874611835909177, 15021984820089990008, 15242143999191686238, 73656911605031936}, + }, + { + A0: fp.Element{9770462122700591808, 17547477902406858790, 14010124614813851222, 4165622522809648336, 16982670942141592785, 28856170353703120}, + A1: fp.Element{15290128055618535720, 17454664547186830394, 2442682438806360163, 18129275600450347134, 4187898517238597724, 22281223126461925}, + }, + { + A0: fp.Element{12998303454550796060, 5752293956714303316, 6752814987597331313, 3166668351495264669, 9929418606104908953, 29385282975911842}, + A1: fp.Element{8756413506556179286, 143408982899135549, 2705277708630136288, 5154523209628123430, 6318572504564936509, 15532021916109921}, + }, + { + A0: fp.Element{18250508560718013179, 7486164413457419330, 8732750857092323232, 457033717118918321, 12167888022606617966, 20277559260742340}, + A1: fp.Element{0}, + }, + } + g2IsogenyYDenominatorMap = []fptower.E2{ + { + A0: fp.Element{2775408832476871526, 9008699192344519496, 1102884431771657931, 11532306452895462867, 5856674524343862704, 99430919144638985}, + A1: fp.Element{15551301223123894338, 11614654532478001117, 17328204268627498271, 15544698294678786409, 1484472732893154418, 94605104690421825}, + }, + { + A0: fp.Element{15538486723908094425, 10978766348102143722, 15056964343960721360, 8732109610906448146, 8620899699042055528, 1351681984895437}, + A1: fp.Element{3175104032835843731, 9314571151837830613, 14059118678096680542, 2500500275627160283, 18190796245603721369, 49058560079762280}, + }, + { + A0: fp.Element{2177050294381443304, 18124514285214412099, 9381797198372716589, 8046190315005422985, 9931273159159670369, 8036418831901820}, + A1: fp.Element{1549742439238596983, 15619417821567290543, 9431498181016104480, 2850048082163302555, 17545915875775834651, 72687252788290726}, + }, + { + A0: fp.Element{16572119218800158686, 13113809656757589233, 12872678318679566545, 3255385198038960565, 17070551903094984362, 19742086936927308}, + A1: fp.Element{12635717383520653743, 12204869003999147728, 8256611698395114158, 12382254302890131233, 603685913325391887, 60927550204070150}, + }, + { + A0: fp.Element{15497795759006280655, 16847324196958114585, 8218328297664216257, 15353718428023978640, 6357440186573265200, 109435672289072692}, + A1: fp.Element{17126430308003109280, 8510055147921463837, 2424009275722614739, 9284383313721206596, 12867548350984534889, 46750493171897961}, + }, + { + A0: fp.Element{6993808529266055670, 10024278910497662817, 6638820395273369627, 17550512930522052164, 11971278025880956390, 4218694435301565}, + A1: fp.Element{4117072311900938869, 8052759146924035127, 1883914237959498468, 843437547616490150, 1332392274725871932, 100467415201018114}, + }, + { + A0: fp.Element{10031273074038578964, 6635740043384123318, 2357760728051263554, 12405057037224522557, 2967360385882286162, 53130165628915609}, + A1: fp.Element{9340276074750471546, 8779557686584984578, 12118682911992514942, 8792287004994786286, 11729922744948342197, 97115621599174349}, + }, + { + A0: fp.Element{8243258075199662251, 789646305137795307, 9501755430432007632, 15339245131080115010, 3036491630055907252, 4720358405852701}, + A1: fp.Element{6272873484523042114, 18180794113363272037, 10135093694274252446, 13006427779172872075, 12612518697452888675, 4088970499189038}, + }, + { + A0: fp.Element{12559327402496405011, 13162954855686166920, 2622361684062280170, 16985128559432625018, 10671934355632922492, 22106668982430516}, + A1: fp.Element{10342048742210368049, 4070662490021521195, 9050590024293164750, 6778744574336170333, 16385669267342466637, 110676722503289309}, + }, + { + A0: fp.Element{8257142434361782318, 11625188549524762434, 4162174183904813140, 15534648919830235837, 15345786270187761745, 49274740272907617}, + A1: fp.Element{17452699565973497082, 1589725784862892127, 17590303103109791779, 8233530623701537904, 717929863606521126, 42679722481449639}, + }, + { + A0: fp.Element{17135289411523873787, 11725292909156152853, 16347014946116696110, 13323937426977246609, 8703182288833044255, 99079409785168386}, + A1: fp.Element{9130446173903866415, 12010725389601806440, 9146179391205715125, 12338366065383252573, 9136251064810045627, 19315728226188373}, + }, + { + A0: fp.Element{13754907156191096138, 22846764546901886, 362622052532339515, 17013010775786408901, 13860043181928645305, 41171875858186406}, + A1: fp.Element{16141340011263075417, 18360728019638818576, 16264128300543356196, 12473458415555386384, 18336837302801391285, 63727493440743041}, + }, + { + A0: fp.Element{3658804449581456923, 1347747705877184398, 3978302900333357541, 5081865331785059868, 1329643100050532471, 64102076251113639}, + A1: fp.Element{6980160750786278877, 11782099681251246419, 5400025369843657828, 9848695260591786723, 7987487093370334558, 27115517650078156}, + }, + { + A0: fp.Element{408044901411159465, 18068234941175928745, 2992890619264445487, 8810813216534328625, 4005157550725594837, 26065038549738560}, + A1: fp.Element{10975300981822504330, 15715038812214651197, 7602692888794350386, 12917547374269268270, 422938878523833779, 36305463980543648}, + }, + { + A0: fp.Element{10382180122959422967, 15807168734599653808, 18372044240449882372, 17642941170379477011, 10340644338271517361, 36063527972088465}, + A1: fp.Element{17969075460977832752, 9177853432360197657, 2917850475625504299, 7079850467696515295, 787036529903063845, 107077168732108508}, + }, + { + A0: fp.Element{6502963492633373835, 9890663567118850708, 12445720805224431135, 6172862156806685987, 16576315346783950860, 5856337016358393}, + A1: fp.Element{4476660199518722374, 3771101137683024451, 489075951782192448, 6489873046594013732, 280944977367484653, 69709094171715534}, + }, + { + A0: fp.Element{5629815848909521275, 5316587566230943622, 7982019375390215350, 15543803108203970386, 5941855484214597918, 5142365312974746}, + A1: fp.Element{3442509802156923890, 6170315030905476396, 2122926024914179804, 17368567939581660282, 12200117156652989113, 7492215668086454}, + }, + { + A0: fp.Element{15017092692882720799, 2306085001940265068, 6863750251390498522, 772425548835188093, 7866794496176459304, 119478713276832042}, + A1: fp.Element{539473290914229032, 10680532665300974652, 2401493774971219183, 771791041055281045, 17266300769954562072, 46203199265737132}, + }, + { + A0: fp.Element{12080185159744170157, 6121786867780957883, 13378966825252880343, 16978399570563241468, 13189121794372052505, 31306179382417939}, + A1: fp.Element{6033582013845463960, 10201637616554513673, 3729832524646428556, 2564427389283182369, 662893124657004215, 101996692818942248}, + }, + { + A0: fp.Element{14864583376459179927, 16267452113314442715, 14135040057928255187, 712462212063179204, 12089188474131830930, 36841165809084721}, + A1: fp.Element{13089068048776542239, 1568107234484844315, 4262841373517201534, 572974140393742986, 13114372614372436015, 221271375458892}, + }, + { + A0: fp.Element{15352358256255559128, 14776149476170502093, 13834021062045579807, 16108249515581661111, 7563707564996631205, 86582638494403858}, + A1: fp.Element{16813570010660423536, 3065722476932153407, 8938713923763210470, 2255995557158728394, 8016474455897300271, 84052925693202818}, + }, + { + A0: fp.Element{15615825726181497195, 5658715128964929728, 13877560309241249627, 15409847795806183219, 382506108092986341, 33112756833083889}, + A1: fp.Element{4921115267284233431, 2093038862301396370, 11859221373400371788, 14840702906540650688, 3187022540654844811, 12940014803022939}, + }, + { + A0: fp.Element{10653597201928750109, 13006094245282229535, 13295987796930539448, 16777781019019743602, 516306931828031556, 114717773318043797}, + A1: fp.Element{235309942988776203, 14860563794932685398, 4559874204394395321, 16639699308077583607, 9227151754747780541, 15908917446924874}, + }, + { + A0: fp.Element{17337820088369903748, 8586614709689721762, 1507576901396006569, 12700849903501888588, 17971589925911161601, 108264042385722694}, + A1: fp.Element{16945398252920060844, 12661842631743740793, 3757011696927843364, 15267617233875676717, 4747339870779259550, 34661428542359791}, + }, + { + A0: fp.Element{16466466374773138846, 14279763770124955377, 2253148650834359538, 7990858085823320889, 7124676177871440280, 94151727797031734}, + A1: fp.Element{15321139925728056718, 15122461222407649886, 17533799169860262777, 16804941505997951982, 1600681788854461369, 44486672743339990}, + }, + { + A0: fp.Element{8867142699562737491, 18199028041645162481, 3517239929170429351, 775467166380995197, 5868381756625215392, 6197719424154602}, + A1: fp.Element{9737125075096738524, 9629792455358261596, 11564279494282885105, 5089237230157463720, 17189088638807565425, 106712839297101083}, + }, + { + A0: fp.Element{10270843696704620770, 13223598872017291793, 9010388952516938805, 15912131807459901749, 6846913031975448418, 86431140578472953}, + A1: fp.Element{15439335117817990542, 18208862128889198852, 1680174721576182500, 13180416124629130962, 7418066627384568449, 3653571306187636}, + }, + { + A0: fp.Element{1131060365675191416, 10374247235014096023, 5274169106847399340, 9643591707517384578, 8354961201546942085, 16860653124975415}, + A1: fp.Element{7591061314547569259, 3687653994280978709, 14906524746128876973, 7376139658567228596, 3304769414542873433, 39389809689964413}, + }, + { + A0: fp.Element{15061500520004024506, 13781868913987378153, 1311923405823490306, 13614698003779137726, 2734567429318555742, 41565578486180068}, + A1: fp.Element{2264606496492496938, 7463181801259856780, 4974231603582406689, 12631973597673125932, 13768142234619696863, 69859376569568629}, + }, + { + A0: fp.Element{12977806950220507699, 9598682745345891240, 12727041082031765282, 13876739454320532788, 16731345162096153922, 52377912619410421}, + A1: fp.Element{9749487977108607359, 9452745135768007871, 17734899000824388188, 6032906020241168466, 3891046964558379200, 42965172988847872}, + }, + { + A0: fp.Element{15134142718037669741, 2650609953202022541, 18444582952265559358, 10072051383647105272, 1614233522361858494, 6353896085976033}, + A1: fp.Element{1244819074686382314, 16827930012669440062, 7409202602064068605, 7833164804348414003, 14093967246945573989, 91886691830462491}, + }, + { + A0: fp.Element{3481568382353274479, 1454015438048276221, 18321294391133087854, 11721714833000613979, 10732204074831352562, 71241856315356756}, + A1: fp.Element{2091942538387325776, 9875355486415603002, 12623384858601965052, 7559030465493899268, 7674739998354242578, 75767137192853634}, + }, + { + A0: fp.Element{5491757234451068988, 6182298996664147147, 1538132785577256287, 4999224323735886804, 6348107227722746450, 48518858347037381}, + A1: fp.Element{15293807953430533698, 2990763629845967503, 13391735075948095730, 9673810945847290845, 11089480180973857099, 64742831177682886}, + }, + } +) + +// G2IsogenyMap returns the isogeny map for the curve. +// The isogeny map is a list of polynomial coefficients for the x and y coordinate computation. +// The order of the coefficients is as follows: +// - x numerator, x denominator, y numerator, y denominator. +func G2IsogenyMap() [4][]fptower.E2 { + return [4][]fptower.E2{ + g2IsogenyXNumeratorMap, + g2IsogenyXDenominatorMap, + g2IsogenyYNumeratorMap, + g2IsogenyYDenominatorMap, + } +} + +func g2IsogenyXNumerator(dst *fptower.E2, x *fptower.E2) { + g2EvalPolynomial(dst, false, g2IsogenyXNumeratorMap, x) +} + +func g2IsogenyXDenominator(dst *fptower.E2, x *fptower.E2) { + g2EvalPolynomial(dst, true, g2IsogenyXDenominatorMap, x) +} + +func g2IsogenyYNumerator(dst *fptower.E2, x *fptower.E2, y *fptower.E2) { + var _dst fptower.E2 + g2EvalPolynomial(&_dst, false, g2IsogenyYNumeratorMap, x) + dst.Mul(&_dst, y) +} + +func g2IsogenyYDenominator(dst *fptower.E2, x *fptower.E2) { + g2EvalPolynomial(dst, true, g2IsogenyYDenominatorMap, x) +} + +// G2 computes the isogeny map of the curve element, given by its coordinates pX and pY. +// It mutates the coordinates pX and pY to the new coordinates of the isogeny map. +func G2Isogeny(pX, pY *fptower.E2) { + + den := make([]fptower.E2, 2) + + g2IsogenyYDenominator(&den[1], pX) + g2IsogenyXDenominator(&den[0], pX) + + g2IsogenyYNumerator(pY, pX, pY) + g2IsogenyXNumerator(pX, pX) + + den = fptower.BatchInvertE2(den) + + pX.Mul(pX, &den[0]) + pY.Mul(pY, &den[1]) +} + +// G2SqrtRatio computes the square root of u/v and returns 0 iff u/v was indeed a quadratic residue. +// If not, we get sqrt(Z * u / v). Recall that Z is non-residue. +// If v = 0, u/v is meaningless and the output is unspecified, without raising an error. +// The main idea is that since the computation of the square root involves taking large powers of u/v, the inversion of v can be avoided +func G2SqrtRatio(z *fptower.E2, u *fptower.E2, v *fptower.E2) uint64 { + + // https://www.rfc-editor.org/rfc/rfc9380.html#name-sqrt_ratio-for-any-field + + tv1 := fptower.E2{ + A0: fp.Element{0}, + A1: fp.Element{9669507733633691314, 13074846433352412541, 11948543988290594071, 11104573675215509690, 878729975203857826, 120237394476367878}, + } //tv1 = c6 + + var tv2, tv3, tv4, tv5 fptower.E2 + var exp big.Int + // c4 = 140737488355327 = 2⁴⁷ - 1 + // q is odd so c1 is at least 1. + exp.SetBytes([]byte{127, 255, 255, 255, 255, 255}) + + tv2.Exp(*v, &exp) // 2. tv2 = vᶜ⁴ + tv3.Square(&tv2) // 3. tv3 = tv2² + tv3.Mul(&tv3, v) // 4. tv3 = tv3 * v + tv5.Mul(u, &tv3) // 5. tv5 = u * tv3 + + // c3 = 237702427642072544657662731610863241996908072983433720914596829155825880635712864411696995402952020023758239370111403151139377997388748144480691770738487127695940799749981367718443673617185911789718419957467908625 + exp.SetBytes([]byte{2, 211, 7, 208, 187, 175, 251, 34, 86, 145, 59, 179, 97, 38, 60, 75, 184, 184, 125, 164, 174, 233, 63, 31, 94, 113, 65, 61, 218, 77, 92, 9, 208, 24, 175, 185, 6, 96, 205, 192, 20, 231, 18, 80, 42, 77, 108, 70, 10, 170, 170, 139, 183, 10, 224, 49, 131, 36, 185, 88, 99, 140, 157, 107, 203, 251, 210, 53, 241, 192, 154, 74, 218, 38, 143, 46, 27, 216, 0, 115, 56, 210, 84, 240, 0, 0, 1, 10, 17}) + + tv5.Exp(tv5, &exp) // 6. tv5 = tv5ᶜ³ + tv5.Mul(&tv5, &tv2) // 7. tv5 = tv5 * tv2 + tv2.Mul(&tv5, v) // 8. tv2 = tv5 * v + tv3.Mul(&tv5, u) // 9. tv3 = tv5 * u + tv4.Mul(&tv3, &tv2) // 10. tv4 = tv3 * tv2 + + // c5 = 70368744177664 + exp.SetBytes([]byte{64, 0, 0, 0, 0, 0}) + tv5.Exp(tv4, &exp) // 11. tv5 = tv4ᶜ⁵ + isQNr := g2NotOne(&tv5) // 12. isQR = tv5 == 1 + c7 := fptower.E2{ + A0: fp.Element{1479358275892676257, 2814264704614556731, 13691179386454739330, 7530671302001941842, 60362263363904715, 37906327945374822}, + A1: fp.Element{5350190547200862053, 10822704806123199611, 5122684409451163826, 10616884767534481491, 1436196917100294910, 20226740120672211}, + } + tv2.Mul(&tv3, &c7) // 13. tv2 = tv3 * c7 + tv5.Mul(&tv4, &tv1) // 14. tv5 = tv4 * tv1 + tv3.Select(int(isQNr), &tv3, &tv2) // 15. tv3 = CMOV(tv2, tv3, isQR) + tv4.Select(int(isQNr), &tv4, &tv5) // 16. tv4 = CMOV(tv5, tv4, isQR) + exp.Lsh(big.NewInt(1), 47-2) // 18, 19: tv5 = 2ⁱ⁻² for i = c1 + + for i := 47; i >= 2; i-- { // 17. for i in (c1, c1 - 1, ..., 2): + + tv5.Exp(tv4, &exp) // 20. tv5 = tv4ᵗᵛ⁵ + nE1 := g2NotOne(&tv5) // 21. e1 = tv5 == 1 + tv2.Mul(&tv3, &tv1) // 22. tv2 = tv3 * tv1 + tv1.Mul(&tv1, &tv1) // 23. tv1 = tv1 * tv1 Why not write square? + tv5.Mul(&tv4, &tv1) // 24. tv5 = tv4 * tv1 + tv3.Select(int(nE1), &tv3, &tv2) // 25. tv3 = CMOV(tv2, tv3, e1) + tv4.Select(int(nE1), &tv4, &tv5) // 26. tv4 = CMOV(tv5, tv4, e1) + + if i > 2 { + exp.Rsh(&exp, 1) // 18, 19. tv5 = 2ⁱ⁻² + } + } + + *z = tv3 + return isQNr +} + +func g2NotOne(x *fptower.E2) uint64 { + + //Assuming hash is implemented for G1 and that the curve is over Fp + var one fp.Element + return one.SetOne().NotEqual(&x.A0) | G1NotZero(&x.A1) + +} + +// G2MulByZ multiplies x by [12, 1] and stores the result in z +func G2MulByZ(z *fptower.E2, x *fptower.E2) { + + z.Mul(x, &fptower.E2{ + A0: fp.Element{10560307807486212317, 9936456306313395274, 2092561269709285211, 8738829082964617622, 5243865315912343348, 114311569748804731}, + A1: fp.Element{202099033278250856, 5854854902718660529, 11492539364873682930, 8885205928937022213, 5545221690922665192, 39800542322357402}, + }) + +} + +func g2EvalPolynomial(z *fptower.E2, monic bool, coefficients []fptower.E2, x *fptower.E2) { + dst := coefficients[len(coefficients)-1] + + if monic { + dst.Add(&dst, x) + } + + for i := len(coefficients) - 2; i >= 0; i-- { + dst.Mul(&dst, x) + dst.Add(&dst, &coefficients[i]) + } + + z.Set(&dst) +} + +// G2Sgn0 is an algebraic substitute for the notion of sign in ordered fields. +// Namely, every non-zero quadratic residue in a finite field of characteristic =/= 2 has exactly two square roots, one of each sign. +// +// See: https://www.rfc-editor.org/rfc/rfc9380.html#name-the-sgn0-function +// +// The sign of an element is not obviously related to that of its Montgomery form +func G2Sgn0(z *fptower.E2) uint64 { + + nonMont := z.Bits() + + sign := uint64(0) // 1. sign = 0 + zero := uint64(1) // 2. zero = 1 + var signI uint64 + var zeroI uint64 + + // 3. i = 1 + signI = nonMont.A0[0] % 2 // 4. sign_i = x_i mod 2 + zeroI = G1NotZero(&nonMont.A0) + zeroI = 1 ^ (zeroI|-zeroI)>>63 // 5. zero_i = x_i == 0 + sign = sign | (zero & signI) // 6. sign = sign OR (zero AND sign_i) # Avoid short-circuit logic ops + zero = zero & zeroI // 7. zero = zero AND zero_i + // 3. i = 2 + signI = nonMont.A1[0] % 2 // 4. sign_i = x_i mod 2 + // 5. zero_i = x_i == 0 + sign = sign | (zero & signI) // 6. sign = sign OR (zero AND sign_i) # Avoid short-circuit logic ops + // 7. zero = zero AND zero_i + return sign + +} + +func G2NotZero(x *fptower.E2) uint64 { + //Assuming G1 is over Fp and that if hashing is available for G2, it also is for G1 + return G1NotZero(&x.A0) | G1NotZero(&x.A1) + +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/hash_to_g1.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/hash_to_g1.go index 20306ba87..916ce2862 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/hash_to_g1.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/hash_to_g1.go @@ -1,16 +1,5 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -18,166 +7,78 @@ package bls12377 import ( "github.com/consensys/gnark-crypto/ecc/bls12-377/fp" - - "math/big" + "github.com/consensys/gnark-crypto/ecc/bls12-377/hash_to_curve" ) -//Note: This only works for simple extensions - -func g1IsogenyXNumerator(dst *fp.Element, x *fp.Element) { - g1EvalPolynomial(dst, - false, - []fp.Element{ - {9381318728011785451, 8795417190580748876, 15171640721257608922, 11815547924113428908, 15499908520243100994, 75408755324413256}, - {12414498063752772717, 9915153185132073893, 5598625970987438951, 3342254783599619135, 3349592178919125510, 9993871847068096}, - {4662210776746950618, 10687085762534440940, 7484820859645808636, 2221301482234255553, 10609677459585442106, 9950135580589350}, - }, - x) -} - -func g1IsogenyXDenominator(dst *fp.Element, x *fp.Element) { - g1EvalPolynomial(dst, - true, - []fp.Element{ - {12764504107591987636, 2767124593109192342, 3947759810240204190, 13369019134398476541, 13398368715676502040, 39975487388272384}, - }, - x) -} - -func g1IsogenyYNumerator(dst *fp.Element, x *fp.Element, y *fp.Element) { - var _dst fp.Element - g1EvalPolynomial(&_dst, - false, - []fp.Element{ - {13844135623281082635, 637899392157745290, 5176720401210677272, 4780940929980393029, 13803251044890140836, 51447363642369244}, - {512010462697120695, 609509684909242946, 13763343875136563934, 2839514380057330869, 15407015190976871917, 114223893455203604}, - {14191436515319700132, 6479619458373647736, 9513056055282499867, 15178407828209519654, 12166396751953702822, 75539964123849493}, - {2331105388373475309, 5343542881267220470, 12965782466677680126, 1110650741117127776, 5304838729792721053, 4975067790294675}, - }, - x) - - dst.Mul(&_dst, y) -} - -func g1IsogenyYDenominator(dst *fp.Element, x *fp.Element) { - g1EvalPolynomial(dst, - true, - []fp.Element{ - {8694832399336342723, 13482963304561246841, 6984108042366343277, 8355250559073919616, 16937021447778317421, 44890599540624877}, - {1100361703846424922, 5005767817281133373, 917019320419705433, 14251746270386956490, 5522097789867984932, 4443041874334878}, - {1400024175356859676, 8301373779327577028, 11843279430720612570, 3213569255776326391, 3301617999610402890, 119926462164817154}, - }, - x) +// MapToG1 invokes the SSWU map, and guarantees that the result is in G1. +func MapToG1(u fp.Element) G1Affine { + res := MapToCurve1(&u) + //this is in an isogenous curve + hash_to_curve.G1Isogeny(&res.X, &res.Y) + res.ClearCofactor(&res) + return res } -func g1Isogeny(p *G1Affine) { - - den := make([]fp.Element, 2) - - g1IsogenyYDenominator(&den[1], &p.X) - g1IsogenyXDenominator(&den[0], &p.X) +// EncodeToG1 hashes a message to a point on the G1 curve using the SSWU map. +// It is faster than [HashToG1], but the result is not uniformly distributed. Unsuitable as a random oracle. +// dst stands for "domain separation tag", a string unique to the construction using the hash function +// +// See: https://www.rfc-editor.org/rfc/rfc9380.html#roadmap +func EncodeToG1(msg, dst []byte) (G1Affine, error) { - g1IsogenyYNumerator(&p.Y, &p.X, &p.Y) - g1IsogenyXNumerator(&p.X, &p.X) + var res G1Affine + u, err := fp.Hash(msg, dst, 1) + if err != nil { + return res, err + } - den = fp.BatchInvert(den) + res = MapToCurve1(&u[0]) - p.X.Mul(&p.X, &den[0]) - p.Y.Mul(&p.Y, &den[1]) + //this is in an isogenous curve + hash_to_curve.G1Isogeny(&res.X, &res.Y) + res.ClearCofactor(&res) + return res, nil } -// g1SqrtRatio computes the square root of u/v and returns 0 iff u/v was indeed a quadratic residue -// if not, we get sqrt(Z * u / v). Recall that Z is non-residue -// If v = 0, u/v is meaningless and the output is unspecified, without raising an error. -// The main idea is that since the computation of the square root involves taking large powers of u/v, the inversion of v can be avoided -func g1SqrtRatio(z *fp.Element, u *fp.Element, v *fp.Element) uint64 { - - // https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html#name-sqrt_ratio-for-any-field - - tv1 := fp.Element{7563926049028936178, 2688164645460651601, 12112688591437172399, 3177973240564633687, 14764383749841851163, 52487407124055189} //tv1 = c6 - - var tv2, tv3, tv4, tv5 fp.Element - var exp big.Int - // c4 = 70368744177663 = 2⁴⁶ - 1 - // q is odd so c1 is at least 1. - exp.SetBytes([]byte{63, 255, 255, 255, 255, 255}) - - tv2.Exp(*v, &exp) // 2. tv2 = vᶜ⁴ - tv3.Square(&tv2) // 3. tv3 = tv2² - tv3.Mul(&tv3, v) // 4. tv3 = tv3 * v - tv5.Mul(u, &tv3) // 5. tv5 = u * tv3 - - // c3 = 1837921289030710838195067919506396475074392872918698035817074744121558668640693829665401097909504529 - exp.SetBytes([]byte{3, 92, 116, 140, 47, 138, 33, 213, 140, 118, 11, 128, 217, 66, 146, 118, 52, 69, 179, 230, 1, 234, 39, 30, 61, 230, 196, 95, 116, 18, 144, 0, 46, 22, 186, 136, 96, 0, 0, 1, 10, 17}) - - tv5.Exp(tv5, &exp) // 6. tv5 = tv5ᶜ³ - tv5.Mul(&tv5, &tv2) // 7. tv5 = tv5 * tv2 - tv2.Mul(&tv5, v) // 8. tv2 = tv5 * v - tv3.Mul(&tv5, u) // 9. tv3 = tv5 * u - tv4.Mul(&tv3, &tv2) // 10. tv4 = tv3 * tv2 - - // c5 = 35184372088832 - exp.SetBytes([]byte{32, 0, 0, 0, 0, 0}) - tv5.Exp(tv4, &exp) // 11. tv5 = tv4ᶜ⁵ - isQNr := g1NotOne(&tv5) // 12. isQR = tv5 == 1 - c7 := fp.Element{13262060633605929793, 16269117706405780335, 1787999441809606207, 11078968899094441280, 17534011895423012165, 96686002316065324} - tv2.Mul(&tv3, &c7) // 13. tv2 = tv3 * c7 - tv5.Mul(&tv4, &tv1) // 14. tv5 = tv4 * tv1 - tv3.Select(int(isQNr), &tv3, &tv2) // 15. tv3 = CMOV(tv2, tv3, isQR) - tv4.Select(int(isQNr), &tv4, &tv5) // 16. tv4 = CMOV(tv5, tv4, isQR) - exp.Lsh(big.NewInt(1), 46-2) // 18, 19: tv5 = 2ⁱ⁻² for i = c1 - - for i := 46; i >= 2; i-- { // 17. for i in (c1, c1 - 1, ..., 2): - - tv5.Exp(tv4, &exp) // 20. tv5 = tv4ᵗᵛ⁵ - nE1 := g1NotOne(&tv5) // 21. e1 = tv5 == 1 - tv2.Mul(&tv3, &tv1) // 22. tv2 = tv3 * tv1 - tv1.Mul(&tv1, &tv1) // 23. tv1 = tv1 * tv1 Why not write square? - tv5.Mul(&tv4, &tv1) // 24. tv5 = tv4 * tv1 - tv3.Select(int(nE1), &tv3, &tv2) // 25. tv3 = CMOV(tv2, tv3, e1) - tv4.Select(int(nE1), &tv4, &tv5) // 26. tv4 = CMOV(tv5, tv4, e1) - - if i > 2 { - exp.Rsh(&exp, 1) // 18, 19. tv5 = 2ⁱ⁻² - } +// HashToG1 hashes a message to a point on the G1 curve using the SSWU map. +// Slower than [EncodeToG1], but usable as a random oracle. +// dst stands for "domain separation tag", a string unique to the construction using the hash function. +// +// See https://www.rfc-editor.org/rfc/rfc9380.html#roadmap +func HashToG1(msg, dst []byte) (G1Affine, error) { + u, err := fp.Hash(msg, dst, 2*1) + if err != nil { + return G1Affine{}, err } - *z = tv3 - return isQNr -} - -func g1NotOne(x *fp.Element) uint64 { - - var one fp.Element - return one.SetOne().NotEqual(x) - -} + Q0 := MapToCurve1(&u[0]) + Q1 := MapToCurve1(&u[1]) -// g1MulByZ multiplies x by [5] and stores the result in z -func g1MulByZ(z *fp.Element, x *fp.Element) { + //TODO (perf): Add in E' first, then apply isogeny + hash_to_curve.G1Isogeny(&Q0.X, &Q0.Y) + hash_to_curve.G1Isogeny(&Q1.X, &Q1.Y) - res := *x + var _Q0, _Q1 G1Jac + _Q0.FromAffine(&Q0) + _Q1.FromAffine(&Q1).AddAssign(&_Q0) - res.Double(&res) - res.Double(&res) - res.Add(&res, x) + _Q1.ClearCofactor(&_Q1) - *z = res + Q1.FromJacobian(&_Q1) + return Q1, nil } -// https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html#name-simplified-swu-method -// MapToCurve1 implements the SSWU map -// No cofactor clearing or isogeny +// MapToCurve1 implements the SSWU map. It does not perform cofactor clearing nor isogeny. For map to group, use [MapToG1]. +// +// See: https://www.rfc-editor.org/rfc/rfc9380.html#name-simplified-swu-method func MapToCurve1(u *fp.Element) G1Affine { - - var sswuIsoCurveCoeffA = fp.Element{17252667382019449424, 8408110001211059699, 18415587021986261264, 10797086888535946954, 9462758283094809199, 54995354010328751} - var sswuIsoCurveCoeffB = fp.Element{11130294635325289193, 6502679372128844082, 15863297759487624914, 16270683149854112145, 3560014356538878812, 27923742146399959} + sswuIsoCurveCoeffA, sswuIsoCurveCoeffB := hash_to_curve.G1SSWUIsogenyCurveCoefficients() var tv1 fp.Element tv1.Square(u) // 1. tv1 = u² //mul tv1 by Z - g1MulByZ(&tv1, &tv1) // 2. tv1 = Z * tv1 + hash_to_curve.G1MulByZ(&tv1, &tv1) // 2. tv1 = Z * tv1 var tv2 fp.Element tv2.Square(&tv1) // 3. tv2 = tv1² @@ -189,10 +90,10 @@ func MapToCurve1(u *fp.Element) G1Affine { tv3.Add(&tv2, &tv4) // 5. tv3 = tv2 + 1 tv3.Mul(&tv3, &sswuIsoCurveCoeffB) // 6. tv3 = B * tv3 - tv2NZero := g1NotZero(&tv2) + tv2NZero := hash_to_curve.G1NotZero(&tv2) // tv4 = Z - tv4 = fp.Element{9871116327010172167, 9167007004823125620, 18338974479346628539, 5649234265355377548, 13442091487463296847, 77904398905292312} + tv4 = hash_to_curve.G1SSWUIsogenyZ() tv2.Neg(&tv2) tv4.Select(int(tv2NZero), &tv4, &tv2) // 7. tv4 = CMOV(Z, -tv2, tv2 != 0) @@ -217,7 +118,7 @@ func MapToCurve1(u *fp.Element) G1Affine { x.Mul(&tv1, &tv3) // 17. x = tv1 * tv3 var y1 fp.Element - gx1NSquare := g1SqrtRatio(&y1, &tv2, &tv6) // 18. (is_gx1_square, y1) = sqrt_ratio(tv2, tv6) + gx1NSquare := hash_to_curve.G1SqrtRatio(&y1, &tv2, &tv6) // 18. (is_gx1_square, y1) = sqrt_ratio(tv2, tv6) var y fp.Element y.Mul(&tv1, u) // 19. y = tv1 * u @@ -228,7 +129,7 @@ func MapToCurve1(u *fp.Element) G1Affine { y.Select(int(gx1NSquare), &y1, &y) // 22. y = CMOV(y, y1, is_gx1_square) y1.Neg(&y) - y.Select(int(g1Sgn0(u)^g1Sgn0(&y)), &y, &y1) + y.Select(int(hash_to_curve.G1Sgn0(u)^hash_to_curve.G1Sgn0(&y)), &y, &y1) // 23. e1 = sgn0(u) == sgn0(y) // 24. y = CMOV(-y, y, e1) @@ -237,93 +138,3 @@ func MapToCurve1(u *fp.Element) G1Affine { return G1Affine{x, y} } - -func g1EvalPolynomial(z *fp.Element, monic bool, coefficients []fp.Element, x *fp.Element) { - dst := coefficients[len(coefficients)-1] - - if monic { - dst.Add(&dst, x) - } - - for i := len(coefficients) - 2; i >= 0; i-- { - dst.Mul(&dst, x) - dst.Add(&dst, &coefficients[i]) - } - - z.Set(&dst) -} - -// g1Sgn0 is an algebraic substitute for the notion of sign in ordered fields -// Namely, every non-zero quadratic residue in a finite field of characteristic =/= 2 has exactly two square roots, one of each sign -// https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html#name-the-sgn0-function -// The sign of an element is not obviously related to that of its Montgomery form -func g1Sgn0(z *fp.Element) uint64 { - - nonMont := z.Bits() - - // m == 1 - return nonMont[0] % 2 - -} - -// MapToG1 invokes the SSWU map, and guarantees that the result is in g1 -func MapToG1(u fp.Element) G1Affine { - res := MapToCurve1(&u) - //this is in an isogenous curve - g1Isogeny(&res) - res.ClearCofactor(&res) - return res -} - -// EncodeToG1 hashes a message to a point on the G1 curve using the SSWU map. -// It is faster than HashToG1, but the result is not uniformly distributed. Unsuitable as a random oracle. -// dst stands for "domain separation tag", a string unique to the construction using the hash function -// https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html#roadmap -func EncodeToG1(msg, dst []byte) (G1Affine, error) { - - var res G1Affine - u, err := fp.Hash(msg, dst, 1) - if err != nil { - return res, err - } - - res = MapToCurve1(&u[0]) - - //this is in an isogenous curve - g1Isogeny(&res) - res.ClearCofactor(&res) - return res, nil -} - -// HashToG1 hashes a message to a point on the G1 curve using the SSWU map. -// Slower than EncodeToG1, but usable as a random oracle. -// dst stands for "domain separation tag", a string unique to the construction using the hash function -// https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html#roadmap -func HashToG1(msg, dst []byte) (G1Affine, error) { - u, err := fp.Hash(msg, dst, 2*1) - if err != nil { - return G1Affine{}, err - } - - Q0 := MapToCurve1(&u[0]) - Q1 := MapToCurve1(&u[1]) - - //TODO (perf): Add in E' first, then apply isogeny - g1Isogeny(&Q0) - g1Isogeny(&Q1) - - var _Q0, _Q1 G1Jac - _Q0.FromAffine(&Q0) - _Q1.FromAffine(&Q1).AddAssign(&_Q0) - - _Q1.ClearCofactor(&_Q1) - - Q1.FromJacobian(&_Q1) - return Q1, nil -} - -func g1NotZero(x *fp.Element) uint64 { - - return x[0] | x[1] | x[2] | x[3] | x[4] | x[5] - -} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/hash_to_g2.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/hash_to_g2.go index 66aae9fcc..e88359984 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/hash_to_g2.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/hash_to_g2.go @@ -1,16 +1,5 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -18,619 +7,88 @@ package bls12377 import ( "github.com/consensys/gnark-crypto/ecc/bls12-377/fp" + "github.com/consensys/gnark-crypto/ecc/bls12-377/hash_to_curve" "github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower" - - "math/big" ) -//Note: This only works for simple extensions - -func g2IsogenyXNumerator(dst *fptower.E2, x *fptower.E2) { - g2EvalPolynomial(dst, - false, - []fptower.E2{ - { - A0: fp.Element{3551783286045471771, 15672698349814166255, 7201714524012399751, 9685135133462022557, 11459791422433132438, 34279211894444158}, - A1: fp.Element{6733784119909728882, 8027365598504339614, 9826395261252013434, 17766961605401961078, 16718790361550578585, 8827310132881948}, - }, - { - A0: fp.Element{10039326048219096853, 8025585753053690704, 15692757884719051200, 14081267914923412694, 12483400733579637594, 41501995942887693}, - A1: fp.Element{3285050121746765179, 16424976010740556635, 13525960835401060630, 8230390587856081588, 332312595686915068, 58693565636984574}, - }, - { - A0: fp.Element{17569899329826403508, 9637548884483664645, 11559603533194429416, 509473447889017775, 16843450937194425803, 11820413515158522}, - A1: fp.Element{18082143759519379917, 7350976797508953919, 8718515184478260262, 11424641547646470649, 12610734036362352161, 109931236078585740}, - }, - { - A0: fp.Element{14344095877598929896, 14770204065590636976, 13870643972022067464, 14327299415926938990, 2100218127689809229, 111985606372347998}, - A1: fp.Element{18166912950538149334, 7903342274102247275, 11235613814926762637, 6048582781848067329, 9865957781737849443, 72257053590751229}, - }, - { - A0: fp.Element{9289693438943775070, 611273684478921638, 3161020385710416475, 2286858861996231773, 14631078872284738786, 101751379483637100}, - A1: fp.Element{218371821390517888, 3239557307852648611, 7956123978234311251, 4433191957359481551, 7602230667186897987, 36183482319693410}, - }, - { - A0: fp.Element{7524026848147356443, 15899508093607509001, 9269755160329214834, 12526651159477248728, 3756002781809695765, 101164747683440023}, - A1: fp.Element{6220885675233469595, 1070578225745722143, 9028649589122227273, 241265531361573072, 17722097355684345537, 59426317598728635}, - }, - { - A0: fp.Element{1147337684740884862, 11995598217907408439, 6334092051568104396, 4490620767408292574, 16484486820571077628, 32056264099725884}, - A1: fp.Element{1626504798254052117, 15843967556282260399, 3222912561813979091, 1092398256542226755, 15613117580878270463, 35759440311789519}, - }, - { - A0: fp.Element{9456818710433496904, 8738575976265225627, 17481785322204872502, 10252666647792359788, 13007033241788380867, 54062177864773120}, - A1: fp.Element{7857657292788377886, 18159261954362575139, 6957043223229770024, 101887390030524213, 7411469664095682342, 17462521019270966}, - }, - { - A0: fp.Element{5935437080311313022, 4869272223104979307, 14892623520420170949, 6274040211921387638, 190450687675494048, 100326942952217018}, - A1: fp.Element{4080141112519796596, 14389619698824585061, 15572076811388758383, 5573262239497616930, 5714216936392065098, 10910945353280475}, - }, - { - A0: fp.Element{12050383421129197508, 7679000367015579641, 4181895471589351098, 4488864303009131705, 1755297417051974713, 33780283701258651}, - A1: fp.Element{11393221592097145268, 10835918896706663346, 4746287363995169177, 6169630568067228482, 11259555703140136465, 52771734216395635}, - }, - { - A0: fp.Element{4577617767559140265, 568504000295320317, 4739467389388831592, 9537638546299567945, 11669151734363428413, 119097732794758712}, - A1: fp.Element{5691235310984308451, 13601281267571106288, 7819292534586961743, 11652278682059157182, 2231701566242469994, 110966193728844398}, - }, - { - A0: fp.Element{8957158313166077105, 5669155713645675267, 17333896861619738764, 4892240835897020648, 8492829473755858526, 70767002641220602}, - A1: fp.Element{8355305174234995113, 16726408794609999189, 6819868380250046496, 9302398329327482182, 3371252083110614225, 32903157732774708}, - }, - { - A0: fp.Element{3562726361589542410, 15642076536163677636, 3828009540728039550, 5513538145598570884, 1202255355797680138, 19209968154720986}, - A1: fp.Element{2433342667414904247, 14430646666116795259, 7881503288178112304, 10086912537277758921, 14321155618236575013, 84224128485096326}, - }, - { - A0: fp.Element{7543845460144717594, 14101022520017632284, 6419288061290617259, 11326768478076341964, 18432026940412127132, 85359846879027793}, - A1: fp.Element{17142157839755119212, 5159976764710014065, 6393633352893279233, 8672509349035392886, 7859431465567482570, 62163334379266093}, - }, - { - A0: fp.Element{2954881934412060022, 10898916794193723070, 10915833338735408379, 703491535562714344, 14589964434689495439, 90051679935520087}, - A1: fp.Element{18417998714611085978, 11039054240270137506, 9972891257774348246, 13263552626589315210, 4522668809484918556, 63885995997825101}, - }, - { - A0: fp.Element{9864134077459603571, 12525567282624341376, 5205345924937688700, 12649124091757575439, 14636003906379491067, 96025183135833306}, - A1: fp.Element{10316403063861314867, 10750711173072110600, 4513675589861596212, 2635673197095740125, 16720951430549947037, 31390298180493148}, - }, - { - A0: fp.Element{3003952238586646516, 3250841642932517220, 7061834734009117554, 16259415476002355236, 1626926148029432162, 77189086665928784}, - A1: fp.Element{14450051585993059472, 11823315281584113748, 6929304997500454604, 15344892292748160673, 15787768514545706202, 69813057053620435}, - }, - { - A0: fp.Element{4228110392233474072, 18010581486575392207, 13699345898545483049, 17704744337446085874, 5487913134051621310, 112205105149111207}, - A1: fp.Element{14824585485470590037, 7637124239293942071, 1041102438278370701, 4207950142422409777, 9639439542389544094, 106832755917361143}, - }, - { - A0: fp.Element{10744145886747796703, 8741979218876153119, 4537642647264646058, 9645243825719833866, 16643801652280184094, 57528843479739428}, - A1: fp.Element{5785935421797206370, 847985697064985249, 11478142027129258160, 12741057482356268413, 10148591557028647803, 106797667835022069}, - }, - { - A0: fp.Element{6454832842704992412, 9977685523482313420, 413111938383295655, 13594952949000658414, 17807487788385728582, 108984464456649540}, - A1: fp.Element{17048359867690489456, 2859252502285541521, 10818623701995947153, 7550564651763690537, 459333235977057482, 37663478480017988}, - }, - { - A0: fp.Element{8658783637463168087, 13532094408327228336, 12875492560745818922, 6809856611120372218, 2853890452345629690, 87034840621524077}, - A1: fp.Element{16301307707120111515, 9104654412985804807, 12475785366789695268, 4024450921325678435, 5626908908910088752, 56687303925216568}, - }, - { - A0: fp.Element{9729408098285946449, 14379177692720606450, 15077053755146607368, 1299576162980711320, 13990524355831736308, 88070216003513722}, - A1: fp.Element{5766436769337206504, 1093294963802231624, 1118315683159380206, 16238633443172785277, 5463682062430385614, 116508026946667814}, - }, - { - A0: fp.Element{16584249698770136319, 8326278446225484560, 3131917383401484830, 4756633391835977312, 7642636045510739113, 6547192373501023}, - A1: fp.Element{10803045440816594384, 6133821182275761752, 7762705812675926549, 15035799326051880159, 10201360843527298396, 76693252438359195}, - }, - { - A0: fp.Element{3621702609341817994, 1179514540952803843, 9695126383219869545, 4861853798003230532, 15648444733987506481, 103088924877589738}, - A1: fp.Element{0}, - }, - }, - x) -} - -func g2IsogenyXDenominator(dst *fptower.E2, x *fptower.E2) { - g2EvalPolynomial(dst, - true, - []fptower.E2{ - { - A0: fp.Element{1063048776114699222, 13419136991291290443, 17670140655952814712, 17007170270485437006, 2714055472280753035, 14919040757258909}, - A1: fp.Element{16666868668043867029, 10413023948165423527, 2513282340300795191, 5135056029366772344, 18074639060500180041, 66260525510488187}, - }, - { - A0: fp.Element{10940415603117103310, 2845175453419864190, 16971099885047235913, 4517542951822462583, 12015180195047358700, 101962474939260879}, - A1: fp.Element{1812172074217037271, 9040376510937171745, 1548369375982775200, 5323713323104515663, 11625954855074087334, 4220230277540083}, - }, - { - A0: fp.Element{8797262280793960976, 17802450974932240081, 10157003283304584770, 593225980605733121, 14184353532500093055, 108979035901112461}, - A1: fp.Element{15554837140147424903, 1512405638789788986, 3262333938884419786, 4638305243452530609, 139542405126620667, 54024907639584882}, - }, - { - A0: fp.Element{11424716963860540790, 13456329776215064369, 1929697779149270213, 6306593112502705131, 13859057472975507250, 41785102954052035}, - A1: fp.Element{7602541488494927932, 4897344463908346766, 17005994653424089316, 17216735712046963938, 3756018940504096168, 5402674048264985}, - }, - { - A0: fp.Element{2416535722849524790, 4831233808757576698, 17297774284520319797, 6772473332127607735, 18174962172090050489, 58994994344686536}, - A1: fp.Element{15610410799617712282, 9543692017702705957, 8970286522052539731, 12714219237879632746, 2449975609997710437, 10121059733973512}, - }, - { - A0: fp.Element{15388608950644940213, 15178518612850901922, 4663566445208062329, 3999751164791233677, 7358895960008222342, 33044898311505685}, - A1: fp.Element{2356569524239497521, 4634121806982763800, 13294827248503187097, 18379906191200424608, 13949207972645393879, 37350653623873291}, - }, - { - A0: fp.Element{4970487283568561993, 8451944303783250587, 10744185545939488302, 297910826254460501, 5663064319185246782, 55864728573479562}, - A1: fp.Element{13676619861655804765, 9740179349809417716, 1447466405783296044, 7262347140551810932, 4460517809397706328, 48696693541469882}, - }, - { - A0: fp.Element{4218670501850515232, 1300837062036343562, 6322288902222626865, 2517640049285419442, 15933997662514683752, 35742655751559900}, - A1: fp.Element{8671399843829082486, 10727571055999201132, 18066412728811459184, 2077243532292929295, 18402906919639961112, 11053564656556137}, - }, - { - A0: fp.Element{13549293427847064273, 13454861990004702789, 12625716182603551974, 16289223817658875114, 709786698748164395, 79373748066056979}, - A1: fp.Element{9755261456181601166, 8062867867952015070, 11667298511884909423, 12783693965971962594, 5335701901003645771, 118924945769569072}, - }, - { - A0: fp.Element{5024330816113629597, 9162185537450801251, 14637535063833510048, 5042964231794706299, 10987285991634226322, 46336617111585333}, - A1: fp.Element{17451698037621354790, 10238258568486351103, 10306732172443683782, 16783673474705190959, 2366024509224094980, 27102949281362657}, - }, - { - A0: fp.Element{1779719694787807439, 13682444363499832102, 319805876265464201, 10878143779945294209, 5260570358490406259, 111384964548942529}, - A1: fp.Element{10364815279125342799, 5955681787042171859, 16259776976357711022, 698420282628335564, 14458917752432688041, 9951241155641633}, - }, - { - A0: fp.Element{9860169129499874274, 4710132861939245083, 16729683163954203081, 1163919786098698325, 16999533791398931846, 45007426249965870}, - A1: fp.Element{1554156753268998897, 13001788039766734041, 13083055690099472212, 15457335577166095794, 9225717367159961098, 40091861438122274}, - }, - { - A0: fp.Element{15170394446649694794, 515688257282406708, 7546053921359572147, 2040402108618036352, 14910633907967741865, 51620635462170312}, - A1: fp.Element{14097816726424606264, 12505549891408832791, 13993079436736795338, 10172463092702817360, 608991345474995671, 70034669163571313}, - }, - { - A0: fp.Element{4643108199199003526, 15736620484932148216, 15681664113334307244, 17299685843716562967, 13906356132799386736, 93346316071232156}, - A1: fp.Element{4605618257264761423, 18021103018327472901, 16108946406338519358, 9045268489748282166, 5059321869053749600, 110536556169650965}, - }, - { - A0: fp.Element{11517108407780568371, 7978619811691229504, 9264608640258152436, 8451802924690124465, 4675285626878377699, 109463398958344863}, - A1: fp.Element{3597960821476001565, 3759680844169152876, 14302414818654496990, 17433096654117785124, 17967041042193057544, 85366167313641495}, - }, - { - A0: fp.Element{9939822412604413185, 13452127979624463736, 5130248585009642508, 3885932386715663181, 5051687816649505884, 77901780572240613}, - A1: fp.Element{519763984047258436, 9600915485628319569, 15140529797299450996, 9971542775239334883, 8807015558507490608, 948222705021672}, - }, - { - A0: fp.Element{2827339587428175511, 6895834130469522434, 13331059522798479027, 13955187059915735579, 14378880524037078149, 37849146151734053}, - A1: fp.Element{5659129353366385472, 1315670479643534676, 5263307416551198333, 6925817959331280727, 2077163856293267360, 78059303625906606}, - }, - { - A0: fp.Element{12063007979636530410, 11856928215255593909, 11875394835884852884, 7779285203935234969, 6621016507099994054, 58081312732574672}, - A1: fp.Element{16883486087598545310, 13020319043706888256, 13790070886127375971, 1584348143126996741, 14269751476430075034, 39520851290632316}, - }, - { - A0: fp.Element{10496651096160116529, 17447330314090714314, 7901980568892205616, 12523643767284114259, 14047697587913173436, 75967257029771325}, - A1: fp.Element{928850053641029162, 14269106311960337185, 16222409674828338261, 5805191570224440459, 18405225593952050465, 81611267238126250}, - }, - { - A0: fp.Element{11963245856892367752, 10425756598646938656, 18335238837348744770, 15086772981218061512, 16514870314421827966, 31505685309500160}, - A1: fp.Element{12503518650914401765, 9253053408485518576, 7574198415595259890, 9578781703355827570, 4997060354564847196, 4129967821132897}, - }, - { - A0: fp.Element{2031421031641935199, 11357963626711833272, 3216176135850906142, 18356175605205399499, 14930266308542898024, 45166487627178747}, - A1: fp.Element{4224679465464892278, 5162816687557914011, 9625001313214472999, 9646089844316603379, 3042432097393437616, 116654205222221531}, - }, - { - A0: fp.Element{707631102761073363, 4675040476129639901, 7917747947488915690, 10109499984363985170, 8993410474198507338, 72712009800189820}, - A1: fp.Element{13149412355826661761, 13738163990683470943, 2035497293527985654, 18119267602401018212, 2631647798265895027, 2795783216290358}, - }, - }, - x) -} - -func g2IsogenyYNumerator(dst *fptower.E2, x *fptower.E2, y *fptower.E2) { - var _dst fptower.E2 - g2EvalPolynomial(&_dst, - false, - []fptower.E2{ - { - A0: fp.Element{17926225976816550695, 14023720841551579195, 6357178813752170559, 1429363592569423041, 10398153225153858948, 33711798988254397}, - A1: fp.Element{2451854115792992988, 8983506616720050336, 2910564589437158732, 14075622914381394491, 9210830493684175792, 3356683084380210}, - }, - { - A0: fp.Element{5363401642911389912, 1675875184098052872, 15320530934239994732, 16287584047609698426, 10234580471621189795, 40152057551620421}, - A1: fp.Element{2205557896318444105, 4065007897235623968, 4049591920488634456, 16004168804099107709, 13290522222905374988, 70089339901218536}, - }, - { - A0: fp.Element{1887285394871164447, 7142690945990485012, 11190732658400833066, 6881717282640585612, 12116088968278807379, 103071704289665226}, - A1: fp.Element{15968649428224979513, 622837296484333259, 15527184444320989860, 2221190225062639140, 16647213690505955661, 110449865605275384}, - }, - { - A0: fp.Element{8732294600695513394, 7924365878303510912, 12588020556237861366, 10068029016225118132, 785053188876688927, 120347068207419939}, - A1: fp.Element{14514622768737464893, 5553264648606662629, 12707457796658055665, 6066303778837734141, 8279024849745683367, 3564406469625657}, - }, - { - A0: fp.Element{10035254538193759291, 9758866910217654439, 2724217928072676653, 3087232989313988901, 14980280964270815877, 34590022796322467}, - A1: fp.Element{15702474365778911803, 7256912742043165018, 1566344877835261304, 4035729625101537726, 16346625826270990512, 84087754076446931}, - }, - { - A0: fp.Element{8353555275402615800, 6017666668033757053, 13076202439893933084, 1913164921831891521, 13296563472388407395, 43485447354470561}, - A1: fp.Element{12571296156797641372, 13988198528186614994, 5672291450663514913, 7033607850615758657, 16846880911077910300, 44471894806759326}, - }, - { - A0: fp.Element{1319289899879823718, 1591088360172441240, 7805677496653365276, 5569897284498525554, 5635591756513279404, 74901024143303203}, - A1: fp.Element{10251017843654697682, 10395107644570958416, 3071938417266745181, 16127666859700570668, 5111665418914357408, 2168588371926498}, - }, - { - A0: fp.Element{7692831217085618076, 6702179445852008930, 11308520252707392151, 12038365346701529390, 7201289518723110646, 24757234241788495}, - A1: fp.Element{17948859968330001914, 10144279887227452625, 5167544611537672341, 4094514978127885079, 17912079766649616973, 45691468580901020}, - }, - { - A0: fp.Element{3911440855998194160, 13198838254872822648, 13301641437413064797, 11598620320741753383, 6260523097595092689, 78284230929812985}, - A1: fp.Element{7876366075466990529, 13523468790275433139, 982512625724968021, 2122595334378906057, 14803785928219626498, 71415583741911053}, - }, - { - A0: fp.Element{14923926944529083273, 3172840012894527710, 8293434476071337387, 16713256045335958267, 14057165773167995662, 57626475506313562}, - A1: fp.Element{1362417042314121750, 3304417561071796103, 17626406775105189491, 11748219015558348173, 14151421547261463616, 82460535821434588}, - }, - { - A0: fp.Element{3641967463568066103, 8959416625663108732, 5147508997828480363, 16811352377666989046, 1441182181356889676, 52012247235371457}, - A1: fp.Element{17686146190561162997, 11457769513035421935, 11629039572857129752, 16013548565551254584, 3489389447040062088, 108111902919606578}, - }, - { - A0: fp.Element{3810472718885394006, 2981020169366520013, 2816385682378197235, 153866317221550159, 11847618666936524337, 45551005605881971}, - A1: fp.Element{3468095351662354134, 4642197759139584052, 4233923780028877603, 17495173774535575422, 6042084483130094534, 67695926977382460}, - }, - { - A0: fp.Element{1324953063484934482, 15924484690572898301, 11397027945012096698, 2650928770069584769, 15779309286157100138, 107280353846472153}, - A1: fp.Element{7825813464319090460, 9031312139767459777, 142189155675192148, 6582610291000324889, 17102396003811978688, 22084094988625284}, - }, - { - A0: fp.Element{5210064249141309135, 1705543797894948713, 2628665872375881350, 13536211673960271710, 18420806283098729881, 115824256193502087}, - A1: fp.Element{15082907751180860242, 6568697878451242210, 16244491021091296231, 17790448340613041754, 7733097786923840729, 14504831353209381}, - }, - { - A0: fp.Element{1708526764431582271, 13958279355051552323, 14990211071762970223, 7884242526085975541, 16332397605884981291, 80533848446738849}, - A1: fp.Element{14979957683309612745, 6077136825354362762, 8344075647158254715, 10162044015152162839, 5892600246835629906, 87516868768986919}, - }, - { - A0: fp.Element{13823384149985104375, 400062563487168190, 14946453239900597346, 3063239780002983931, 12307299790663558215, 82575345472847758}, - A1: fp.Element{4955387593349539956, 11580263215419679285, 13810204272372323220, 15118104627613044122, 5709821153764726112, 97792497530186865}, - }, - { - A0: fp.Element{8029106480647627463, 9339835209992361362, 2257747803917390435, 13841766612482081060, 11846105036367819521, 10985089103756089}, - A1: fp.Element{12896564185217823813, 11446288085903243988, 7990576940036837900, 3323202217483830000, 8230734762253073878, 36590510406546600}, - }, - { - A0: fp.Element{9258620980666570289, 14799769271847025124, 3337623733744503313, 7847288847664005088, 4443979768963902018, 60018570132140318}, - A1: fp.Element{2675246192261018596, 15150250319428322656, 8044595947793549351, 17819017498503740634, 8168003399719773701, 50802205070212383}, - }, - { - A0: fp.Element{6416675551757596528, 11137110755893373387, 12196234615749865580, 10261229930898283794, 16443034629854739148, 92762661836396101}, - A1: fp.Element{2617757450501858457, 13481841765161333192, 14399351126797435540, 14845648777279341476, 16479218442290092360, 58694504406226241}, - }, - { - A0: fp.Element{2498292483400110656, 17577335584861186499, 17782334663901894811, 2829649086165738601, 1498570879458573752, 54126946483698861}, - A1: fp.Element{13664305368410221366, 15519373467383236285, 6930373704919785768, 5035259077705758702, 15118622066815350587, 76218461077450180}, - }, - { - A0: fp.Element{2359464294290896887, 15126005627433822176, 8745471049496239338, 16249169944251666409, 5887779353961924474, 9756279022859315}, - A1: fp.Element{4564346538121733135, 7083224900235365477, 12708889282498498077, 7850548098138279688, 14178174888234998222, 79663491154927524}, - }, - { - A0: fp.Element{2363371748841007386, 8201543480932182326, 3606722496785934427, 11335897361905574349, 7238564335142183540, 28370763379089425}, - A1: fp.Element{17773120842166679454, 6968817275085296949, 589078002303466881, 11901496965136831973, 17508389603594408067, 105726710734816064}, - }, - { - A0: fp.Element{7295712044514929446, 1419749005841863626, 15921158613862149232, 9464988326326595083, 4254037448365833139, 69144288462579473}, - A1: fp.Element{2330521880128496868, 6942731841460529291, 16753201799444057524, 5125438220420299042, 743707329901356982, 86418732453789215}, - }, - { - A0: fp.Element{10073672469351267894, 7530218602938011234, 12150950127635720924, 14699101300080070173, 3657462378365608060, 50677269975209252}, - A1: fp.Element{16217326474471800173, 12182932688121705224, 9523557196391803719, 13559107473982584173, 14264388955497449506, 89155196038187526}, - }, - { - A0: fp.Element{8500524953883552338, 13471246252006481381, 399342016929624192, 15321780621361720165, 1735807610194144505, 81584295376527434}, - A1: fp.Element{3028140852425956403, 9738549527114127103, 13145547273810927, 15439064114192138046, 15332022320720552951, 84308032823666865}, - }, - { - A0: fp.Element{8795699974103596314, 642987394252844125, 12559698238980671421, 15439596853334509309, 8192837603484177265, 86858193154220713}, - A1: fp.Element{13665577425741482529, 6924526015867702055, 8773433633434605845, 4385776193759960181, 14751123844375383386, 84259094466106596}, - }, - { - A0: fp.Element{6308743764871173820, 14529376135552483358, 3992864522868188832, 16018150786687814926, 14942376479240309869, 30721880050281254}, - A1: fp.Element{8640235552523037016, 9835096537876469025, 789797926152341591, 17554386444425767744, 2184317346571194421, 105569965705365467}, - }, - { - A0: fp.Element{10895141504918788686, 5671269070898752172, 9721970862384110947, 6958416614840799556, 18087813302866953828, 120526621462965167}, - A1: fp.Element{4966785024859028542, 18182687130036955400, 10092534947477547130, 11367367723010839926, 7417818378683193783, 94369912047147779}, - }, - { - A0: fp.Element{5709922971951703245, 10382852257937442526, 3453842328747730539, 16133368957829378910, 8271517063962590774, 9539719803485949}, - A1: fp.Element{1704900793320796784, 8995901783485359023, 9994857694012530400, 7408202244508772902, 18055801701001909838, 109149704128086904}, - }, - { - A0: fp.Element{8357460663115985094, 5765296628618444602, 6421674075164890879, 1651079036919805888, 1287520506307076832, 98975482931648514}, - A1: fp.Element{8078944849704442787, 4038716179863104913, 8864619430523621449, 11983583689047803099, 2541042365160408900, 28281336919305267}, - }, - { - A0: fp.Element{13472601104608613638, 521231156844377864, 4649313698209759510, 5796371833735044995, 8684999192663632207, 51033152603009675}, - A1: fp.Element{3409558318672010377, 10145443448574304058, 3995874611835909177, 15021984820089990008, 15242143999191686238, 73656911605031936}, - }, - { - A0: fp.Element{9770462122700591808, 17547477902406858790, 14010124614813851222, 4165622522809648336, 16982670942141592785, 28856170353703120}, - A1: fp.Element{15290128055618535720, 17454664547186830394, 2442682438806360163, 18129275600450347134, 4187898517238597724, 22281223126461925}, - }, - { - A0: fp.Element{12998303454550796060, 5752293956714303316, 6752814987597331313, 3166668351495264669, 9929418606104908953, 29385282975911842}, - A1: fp.Element{8756413506556179286, 143408982899135549, 2705277708630136288, 5154523209628123430, 6318572504564936509, 15532021916109921}, - }, - { - A0: fp.Element{18250508560718013179, 7486164413457419330, 8732750857092323232, 457033717118918321, 12167888022606617966, 20277559260742340}, - A1: fp.Element{0}, - }, - }, - x) - - dst.Mul(&_dst, y) -} - -func g2IsogenyYDenominator(dst *fptower.E2, x *fptower.E2) { - g2EvalPolynomial(dst, - true, - []fptower.E2{ - { - A0: fp.Element{2775408832476871526, 9008699192344519496, 1102884431771657931, 11532306452895462867, 5856674524343862704, 99430919144638985}, - A1: fp.Element{15551301223123894338, 11614654532478001117, 17328204268627498271, 15544698294678786409, 1484472732893154418, 94605104690421825}, - }, - { - A0: fp.Element{15538486723908094425, 10978766348102143722, 15056964343960721360, 8732109610906448146, 8620899699042055528, 1351681984895437}, - A1: fp.Element{3175104032835843731, 9314571151837830613, 14059118678096680542, 2500500275627160283, 18190796245603721369, 49058560079762280}, - }, - { - A0: fp.Element{2177050294381443304, 18124514285214412099, 9381797198372716589, 8046190315005422985, 9931273159159670369, 8036418831901820}, - A1: fp.Element{1549742439238596983, 15619417821567290543, 9431498181016104480, 2850048082163302555, 17545915875775834651, 72687252788290726}, - }, - { - A0: fp.Element{16572119218800158686, 13113809656757589233, 12872678318679566545, 3255385198038960565, 17070551903094984362, 19742086936927308}, - A1: fp.Element{12635717383520653743, 12204869003999147728, 8256611698395114158, 12382254302890131233, 603685913325391887, 60927550204070150}, - }, - { - A0: fp.Element{15497795759006280655, 16847324196958114585, 8218328297664216257, 15353718428023978640, 6357440186573265200, 109435672289072692}, - A1: fp.Element{17126430308003109280, 8510055147921463837, 2424009275722614739, 9284383313721206596, 12867548350984534889, 46750493171897961}, - }, - { - A0: fp.Element{6993808529266055670, 10024278910497662817, 6638820395273369627, 17550512930522052164, 11971278025880956390, 4218694435301565}, - A1: fp.Element{4117072311900938869, 8052759146924035127, 1883914237959498468, 843437547616490150, 1332392274725871932, 100467415201018114}, - }, - { - A0: fp.Element{10031273074038578964, 6635740043384123318, 2357760728051263554, 12405057037224522557, 2967360385882286162, 53130165628915609}, - A1: fp.Element{9340276074750471546, 8779557686584984578, 12118682911992514942, 8792287004994786286, 11729922744948342197, 97115621599174349}, - }, - { - A0: fp.Element{8243258075199662251, 789646305137795307, 9501755430432007632, 15339245131080115010, 3036491630055907252, 4720358405852701}, - A1: fp.Element{6272873484523042114, 18180794113363272037, 10135093694274252446, 13006427779172872075, 12612518697452888675, 4088970499189038}, - }, - { - A0: fp.Element{12559327402496405011, 13162954855686166920, 2622361684062280170, 16985128559432625018, 10671934355632922492, 22106668982430516}, - A1: fp.Element{10342048742210368049, 4070662490021521195, 9050590024293164750, 6778744574336170333, 16385669267342466637, 110676722503289309}, - }, - { - A0: fp.Element{8257142434361782318, 11625188549524762434, 4162174183904813140, 15534648919830235837, 15345786270187761745, 49274740272907617}, - A1: fp.Element{17452699565973497082, 1589725784862892127, 17590303103109791779, 8233530623701537904, 717929863606521126, 42679722481449639}, - }, - { - A0: fp.Element{17135289411523873787, 11725292909156152853, 16347014946116696110, 13323937426977246609, 8703182288833044255, 99079409785168386}, - A1: fp.Element{9130446173903866415, 12010725389601806440, 9146179391205715125, 12338366065383252573, 9136251064810045627, 19315728226188373}, - }, - { - A0: fp.Element{13754907156191096138, 22846764546901886, 362622052532339515, 17013010775786408901, 13860043181928645305, 41171875858186406}, - A1: fp.Element{16141340011263075417, 18360728019638818576, 16264128300543356196, 12473458415555386384, 18336837302801391285, 63727493440743041}, - }, - { - A0: fp.Element{3658804449581456923, 1347747705877184398, 3978302900333357541, 5081865331785059868, 1329643100050532471, 64102076251113639}, - A1: fp.Element{6980160750786278877, 11782099681251246419, 5400025369843657828, 9848695260591786723, 7987487093370334558, 27115517650078156}, - }, - { - A0: fp.Element{408044901411159465, 18068234941175928745, 2992890619264445487, 8810813216534328625, 4005157550725594837, 26065038549738560}, - A1: fp.Element{10975300981822504330, 15715038812214651197, 7602692888794350386, 12917547374269268270, 422938878523833779, 36305463980543648}, - }, - { - A0: fp.Element{10382180122959422967, 15807168734599653808, 18372044240449882372, 17642941170379477011, 10340644338271517361, 36063527972088465}, - A1: fp.Element{17969075460977832752, 9177853432360197657, 2917850475625504299, 7079850467696515295, 787036529903063845, 107077168732108508}, - }, - { - A0: fp.Element{6502963492633373835, 9890663567118850708, 12445720805224431135, 6172862156806685987, 16576315346783950860, 5856337016358393}, - A1: fp.Element{4476660199518722374, 3771101137683024451, 489075951782192448, 6489873046594013732, 280944977367484653, 69709094171715534}, - }, - { - A0: fp.Element{5629815848909521275, 5316587566230943622, 7982019375390215350, 15543803108203970386, 5941855484214597918, 5142365312974746}, - A1: fp.Element{3442509802156923890, 6170315030905476396, 2122926024914179804, 17368567939581660282, 12200117156652989113, 7492215668086454}, - }, - { - A0: fp.Element{15017092692882720799, 2306085001940265068, 6863750251390498522, 772425548835188093, 7866794496176459304, 119478713276832042}, - A1: fp.Element{539473290914229032, 10680532665300974652, 2401493774971219183, 771791041055281045, 17266300769954562072, 46203199265737132}, - }, - { - A0: fp.Element{12080185159744170157, 6121786867780957883, 13378966825252880343, 16978399570563241468, 13189121794372052505, 31306179382417939}, - A1: fp.Element{6033582013845463960, 10201637616554513673, 3729832524646428556, 2564427389283182369, 662893124657004215, 101996692818942248}, - }, - { - A0: fp.Element{14864583376459179927, 16267452113314442715, 14135040057928255187, 712462212063179204, 12089188474131830930, 36841165809084721}, - A1: fp.Element{13089068048776542239, 1568107234484844315, 4262841373517201534, 572974140393742986, 13114372614372436015, 221271375458892}, - }, - { - A0: fp.Element{15352358256255559128, 14776149476170502093, 13834021062045579807, 16108249515581661111, 7563707564996631205, 86582638494403858}, - A1: fp.Element{16813570010660423536, 3065722476932153407, 8938713923763210470, 2255995557158728394, 8016474455897300271, 84052925693202818}, - }, - { - A0: fp.Element{15615825726181497195, 5658715128964929728, 13877560309241249627, 15409847795806183219, 382506108092986341, 33112756833083889}, - A1: fp.Element{4921115267284233431, 2093038862301396370, 11859221373400371788, 14840702906540650688, 3187022540654844811, 12940014803022939}, - }, - { - A0: fp.Element{10653597201928750109, 13006094245282229535, 13295987796930539448, 16777781019019743602, 516306931828031556, 114717773318043797}, - A1: fp.Element{235309942988776203, 14860563794932685398, 4559874204394395321, 16639699308077583607, 9227151754747780541, 15908917446924874}, - }, - { - A0: fp.Element{17337820088369903748, 8586614709689721762, 1507576901396006569, 12700849903501888588, 17971589925911161601, 108264042385722694}, - A1: fp.Element{16945398252920060844, 12661842631743740793, 3757011696927843364, 15267617233875676717, 4747339870779259550, 34661428542359791}, - }, - { - A0: fp.Element{16466466374773138846, 14279763770124955377, 2253148650834359538, 7990858085823320889, 7124676177871440280, 94151727797031734}, - A1: fp.Element{15321139925728056718, 15122461222407649886, 17533799169860262777, 16804941505997951982, 1600681788854461369, 44486672743339990}, - }, - { - A0: fp.Element{8867142699562737491, 18199028041645162481, 3517239929170429351, 775467166380995197, 5868381756625215392, 6197719424154602}, - A1: fp.Element{9737125075096738524, 9629792455358261596, 11564279494282885105, 5089237230157463720, 17189088638807565425, 106712839297101083}, - }, - { - A0: fp.Element{10270843696704620770, 13223598872017291793, 9010388952516938805, 15912131807459901749, 6846913031975448418, 86431140578472953}, - A1: fp.Element{15439335117817990542, 18208862128889198852, 1680174721576182500, 13180416124629130962, 7418066627384568449, 3653571306187636}, - }, - { - A0: fp.Element{1131060365675191416, 10374247235014096023, 5274169106847399340, 9643591707517384578, 8354961201546942085, 16860653124975415}, - A1: fp.Element{7591061314547569259, 3687653994280978709, 14906524746128876973, 7376139658567228596, 3304769414542873433, 39389809689964413}, - }, - { - A0: fp.Element{15061500520004024506, 13781868913987378153, 1311923405823490306, 13614698003779137726, 2734567429318555742, 41565578486180068}, - A1: fp.Element{2264606496492496938, 7463181801259856780, 4974231603582406689, 12631973597673125932, 13768142234619696863, 69859376569568629}, - }, - { - A0: fp.Element{12977806950220507699, 9598682745345891240, 12727041082031765282, 13876739454320532788, 16731345162096153922, 52377912619410421}, - A1: fp.Element{9749487977108607359, 9452745135768007871, 17734899000824388188, 6032906020241168466, 3891046964558379200, 42965172988847872}, - }, - { - A0: fp.Element{15134142718037669741, 2650609953202022541, 18444582952265559358, 10072051383647105272, 1614233522361858494, 6353896085976033}, - A1: fp.Element{1244819074686382314, 16827930012669440062, 7409202602064068605, 7833164804348414003, 14093967246945573989, 91886691830462491}, - }, - { - A0: fp.Element{3481568382353274479, 1454015438048276221, 18321294391133087854, 11721714833000613979, 10732204074831352562, 71241856315356756}, - A1: fp.Element{2091942538387325776, 9875355486415603002, 12623384858601965052, 7559030465493899268, 7674739998354242578, 75767137192853634}, - }, - { - A0: fp.Element{5491757234451068988, 6182298996664147147, 1538132785577256287, 4999224323735886804, 6348107227722746450, 48518858347037381}, - A1: fp.Element{15293807953430533698, 2990763629845967503, 13391735075948095730, 9673810945847290845, 11089480180973857099, 64742831177682886}, - }, - }, - x) +// MapToG2 invokes the SSWU map, and guarantees that the result is in G2. +func MapToG2(u fptower.E2) G2Affine { + res := MapToCurve2(&u) + //this is in an isogenous curve + hash_to_curve.G2Isogeny(&res.X, &res.Y) + res.ClearCofactor(&res) + return res } -func g2Isogeny(p *G2Affine) { - - den := make([]fptower.E2, 2) - - g2IsogenyYDenominator(&den[1], &p.X) - g2IsogenyXDenominator(&den[0], &p.X) +// EncodeToG2 hashes a message to a point on the G2 curve using the SSWU map. +// It is faster than [HashToG2], but the result is not uniformly distributed. Unsuitable as a random oracle. +// dst stands for "domain separation tag", a string unique to the construction using the hash function +// +// See: https://www.rfc-editor.org/rfc/rfc9380.html#roadmap +func EncodeToG2(msg, dst []byte) (G2Affine, error) { - g2IsogenyYNumerator(&p.Y, &p.X, &p.Y) - g2IsogenyXNumerator(&p.X, &p.X) + var res G2Affine + u, err := fp.Hash(msg, dst, 2) + if err != nil { + return res, err + } - den = fptower.BatchInvertE2(den) + res = MapToCurve2(&fptower.E2{ + A0: u[0], + A1: u[1], + }) - p.X.Mul(&p.X, &den[0]) - p.Y.Mul(&p.Y, &den[1]) + //this is in an isogenous curve + hash_to_curve.G2Isogeny(&res.X, &res.Y) + res.ClearCofactor(&res) + return res, nil } -// g2SqrtRatio computes the square root of u/v and returns 0 iff u/v was indeed a quadratic residue -// if not, we get sqrt(Z * u / v). Recall that Z is non-residue -// If v = 0, u/v is meaningless and the output is unspecified, without raising an error. -// The main idea is that since the computation of the square root involves taking large powers of u/v, the inversion of v can be avoided -func g2SqrtRatio(z *fptower.E2, u *fptower.E2, v *fptower.E2) uint64 { - - // https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html#name-sqrt_ratio-for-any-field - - tv1 := fptower.E2{ - A0: fp.Element{0}, - A1: fp.Element{9669507733633691314, 13074846433352412541, 11948543988290594071, 11104573675215509690, 878729975203857826, 120237394476367878}, - } //tv1 = c6 - - var tv2, tv3, tv4, tv5 fptower.E2 - var exp big.Int - // c4 = 140737488355327 = 2⁴⁷ - 1 - // q is odd so c1 is at least 1. - exp.SetBytes([]byte{127, 255, 255, 255, 255, 255}) - - tv2.Exp(*v, &exp) // 2. tv2 = vᶜ⁴ - tv3.Square(&tv2) // 3. tv3 = tv2² - tv3.Mul(&tv3, v) // 4. tv3 = tv3 * v - tv5.Mul(u, &tv3) // 5. tv5 = u * tv3 - - // c3 = 237702427642072544657662731610863241996908072983433720914596829155825880635712864411696995402952020023758239370111403151139377997388748144480691770738487127695940799749981367718443673617185911789718419957467908625 - exp.SetBytes([]byte{2, 211, 7, 208, 187, 175, 251, 34, 86, 145, 59, 179, 97, 38, 60, 75, 184, 184, 125, 164, 174, 233, 63, 31, 94, 113, 65, 61, 218, 77, 92, 9, 208, 24, 175, 185, 6, 96, 205, 192, 20, 231, 18, 80, 42, 77, 108, 70, 10, 170, 170, 139, 183, 10, 224, 49, 131, 36, 185, 88, 99, 140, 157, 107, 203, 251, 210, 53, 241, 192, 154, 74, 218, 38, 143, 46, 27, 216, 0, 115, 56, 210, 84, 240, 0, 0, 1, 10, 17}) - - tv5.Exp(tv5, &exp) // 6. tv5 = tv5ᶜ³ - tv5.Mul(&tv5, &tv2) // 7. tv5 = tv5 * tv2 - tv2.Mul(&tv5, v) // 8. tv2 = tv5 * v - tv3.Mul(&tv5, u) // 9. tv3 = tv5 * u - tv4.Mul(&tv3, &tv2) // 10. tv4 = tv3 * tv2 - - // c5 = 70368744177664 - exp.SetBytes([]byte{64, 0, 0, 0, 0, 0}) - tv5.Exp(tv4, &exp) // 11. tv5 = tv4ᶜ⁵ - isQNr := g2NotOne(&tv5) // 12. isQR = tv5 == 1 - c7 := fptower.E2{ - A0: fp.Element{1479358275892676257, 2814264704614556731, 13691179386454739330, 7530671302001941842, 60362263363904715, 37906327945374822}, - A1: fp.Element{5350190547200862053, 10822704806123199611, 5122684409451163826, 10616884767534481491, 1436196917100294910, 20226740120672211}, - } - tv2.Mul(&tv3, &c7) // 13. tv2 = tv3 * c7 - tv5.Mul(&tv4, &tv1) // 14. tv5 = tv4 * tv1 - tv3.Select(int(isQNr), &tv3, &tv2) // 15. tv3 = CMOV(tv2, tv3, isQR) - tv4.Select(int(isQNr), &tv4, &tv5) // 16. tv4 = CMOV(tv5, tv4, isQR) - exp.Lsh(big.NewInt(1), 47-2) // 18, 19: tv5 = 2ⁱ⁻² for i = c1 - - for i := 47; i >= 2; i-- { // 17. for i in (c1, c1 - 1, ..., 2): - - tv5.Exp(tv4, &exp) // 20. tv5 = tv4ᵗᵛ⁵ - nE1 := g2NotOne(&tv5) // 21. e1 = tv5 == 1 - tv2.Mul(&tv3, &tv1) // 22. tv2 = tv3 * tv1 - tv1.Mul(&tv1, &tv1) // 23. tv1 = tv1 * tv1 Why not write square? - tv5.Mul(&tv4, &tv1) // 24. tv5 = tv4 * tv1 - tv3.Select(int(nE1), &tv3, &tv2) // 25. tv3 = CMOV(tv2, tv3, e1) - tv4.Select(int(nE1), &tv4, &tv5) // 26. tv4 = CMOV(tv5, tv4, e1) - - if i > 2 { - exp.Rsh(&exp, 1) // 18, 19. tv5 = 2ⁱ⁻² - } +// HashToG2 hashes a message to a point on the G2 curve using the SSWU map. +// Slower than [EncodeToG2], but usable as a random oracle. +// dst stands for "domain separation tag", a string unique to the construction using the hash function. +// +// See https://www.rfc-editor.org/rfc/rfc9380.html#roadmap +func HashToG2(msg, dst []byte) (G2Affine, error) { + u, err := fp.Hash(msg, dst, 2*2) + if err != nil { + return G2Affine{}, err } - *z = tv3 - return isQNr -} - -func g2NotOne(x *fptower.E2) uint64 { - - //Assuming hash is implemented for G1 and that the curve is over Fp - var one fp.Element - return one.SetOne().NotEqual(&x.A0) | g1NotZero(&x.A1) + Q0 := MapToCurve2(&fptower.E2{ + A0: u[0], + A1: u[1], + }) + Q1 := MapToCurve2(&fptower.E2{ + A0: u[2+0], + A1: u[2+1], + }) -} + //TODO (perf): Add in E' first, then apply isogeny + hash_to_curve.G2Isogeny(&Q0.X, &Q0.Y) + hash_to_curve.G2Isogeny(&Q1.X, &Q1.Y) -// g2MulByZ multiplies x by [12, 1] and stores the result in z -func g2MulByZ(z *fptower.E2, x *fptower.E2) { + var _Q0, _Q1 G2Jac + _Q0.FromAffine(&Q0) + _Q1.FromAffine(&Q1).AddAssign(&_Q0) - z.Mul(x, &fptower.E2{ - A0: fp.Element{10560307807486212317, 9936456306313395274, 2092561269709285211, 8738829082964617622, 5243865315912343348, 114311569748804731}, - A1: fp.Element{202099033278250856, 5854854902718660529, 11492539364873682930, 8885205928937022213, 5545221690922665192, 39800542322357402}, - }) + _Q1.ClearCofactor(&_Q1) + Q1.FromJacobian(&_Q1) + return Q1, nil } -// https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html#name-simplified-swu-method -// MapToCurve2 implements the SSWU map -// No cofactor clearing or isogeny +// MapToCurve2 implements the SSWU map. It does not perform cofactor clearing nor isogeny. For map to group, use [MapToG2]. +// +// See: https://www.rfc-editor.org/rfc/rfc9380.html#name-simplified-swu-method func MapToCurve2(u *fptower.E2) G2Affine { - - var sswuIsoCurveCoeffA = fptower.E2{ - A0: fp.Element{4274545572028848265, 14157081418478689358, 13123833976752631407, 4466041663276938746, 9062541850312583986, 90030181981586611}, - A1: fp.Element{4627353644986202063, 14941155654691983603, 14266958733709189881, 10264689865410103271, 10052798319587953375, 111844286035220969}, - } - var sswuIsoCurveCoeffB = fptower.E2{ - A0: fp.Element{10237434857876739089, 8476639787604822147, 6641637803208190023, 1721529389316620686, 8656544759275761743, 38999476160258021}, - A1: fp.Element{2360755569119276357, 10390833517265838837, 12467133771585386911, 8219721226907645480, 3130947551623757939, 83517800164149569}, - } + sswuIsoCurveCoeffA, sswuIsoCurveCoeffB := hash_to_curve.G2SSWUIsogenyCurveCoefficients() var tv1 fptower.E2 tv1.Square(u) // 1. tv1 = u² //mul tv1 by Z - g2MulByZ(&tv1, &tv1) // 2. tv1 = Z * tv1 + hash_to_curve.G2MulByZ(&tv1, &tv1) // 2. tv1 = Z * tv1 var tv2 fptower.E2 tv2.Square(&tv1) // 3. tv2 = tv1² @@ -642,13 +100,10 @@ func MapToCurve2(u *fptower.E2) G2Affine { tv3.Add(&tv2, &tv4) // 5. tv3 = tv2 + 1 tv3.Mul(&tv3, &sswuIsoCurveCoeffB) // 6. tv3 = B * tv3 - tv2NZero := g2NotZero(&tv2) + tv2NZero := hash_to_curve.G2NotZero(&tv2) // tv4 = Z - tv4 = fptower.E2{ - A0: fp.Element{10560307807486212317, 9936456306313395274, 2092561269709285211, 8738829082964617622, 5243865315912343348, 114311569748804731}, - A1: fp.Element{202099033278250856, 5854854902718660529, 11492539364873682930, 8885205928937022213, 5545221690922665192, 39800542322357402}, - } + tv4 = hash_to_curve.G2SSWUIsogenyZ() tv2.Neg(&tv2) tv4.Select(int(tv2NZero), &tv4, &tv2) // 7. tv4 = CMOV(Z, -tv2, tv2 != 0) @@ -673,7 +128,7 @@ func MapToCurve2(u *fptower.E2) G2Affine { x.Mul(&tv1, &tv3) // 17. x = tv1 * tv3 var y1 fptower.E2 - gx1NSquare := g2SqrtRatio(&y1, &tv2, &tv6) // 18. (is_gx1_square, y1) = sqrt_ratio(tv2, tv6) + gx1NSquare := hash_to_curve.G2SqrtRatio(&y1, &tv2, &tv6) // 18. (is_gx1_square, y1) = sqrt_ratio(tv2, tv6) var y fptower.E2 y.Mul(&tv1, u) // 19. y = tv1 * u @@ -684,7 +139,7 @@ func MapToCurve2(u *fptower.E2) G2Affine { y.Select(int(gx1NSquare), &y1, &y) // 22. y = CMOV(y, y1, is_gx1_square) y1.Neg(&y) - y.Select(int(g2Sgn0(u)^g2Sgn0(&y)), &y, &y1) + y.Select(int(hash_to_curve.G2Sgn0(u)^hash_to_curve.G2Sgn0(&y)), &y, &y1) // 23. e1 = sgn0(u) == sgn0(y) // 24. y = CMOV(-y, y, e1) @@ -693,117 +148,3 @@ func MapToCurve2(u *fptower.E2) G2Affine { return G2Affine{x, y} } - -func g2EvalPolynomial(z *fptower.E2, monic bool, coefficients []fptower.E2, x *fptower.E2) { - dst := coefficients[len(coefficients)-1] - - if monic { - dst.Add(&dst, x) - } - - for i := len(coefficients) - 2; i >= 0; i-- { - dst.Mul(&dst, x) - dst.Add(&dst, &coefficients[i]) - } - - z.Set(&dst) -} - -// g2Sgn0 is an algebraic substitute for the notion of sign in ordered fields -// Namely, every non-zero quadratic residue in a finite field of characteristic =/= 2 has exactly two square roots, one of each sign -// https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html#name-the-sgn0-function -// The sign of an element is not obviously related to that of its Montgomery form -func g2Sgn0(z *fptower.E2) uint64 { - - nonMont := z.Bits() - - sign := uint64(0) // 1. sign = 0 - zero := uint64(1) // 2. zero = 1 - var signI uint64 - var zeroI uint64 - - // 3. i = 1 - signI = nonMont.A0[0] % 2 // 4. sign_i = x_i mod 2 - zeroI = g1NotZero(&nonMont.A0) - zeroI = 1 ^ (zeroI|-zeroI)>>63 // 5. zero_i = x_i == 0 - sign = sign | (zero & signI) // 6. sign = sign OR (zero AND sign_i) # Avoid short-circuit logic ops - zero = zero & zeroI // 7. zero = zero AND zero_i - // 3. i = 2 - signI = nonMont.A1[0] % 2 // 4. sign_i = x_i mod 2 - // 5. zero_i = x_i == 0 - sign = sign | (zero & signI) // 6. sign = sign OR (zero AND sign_i) # Avoid short-circuit logic ops - // 7. zero = zero AND zero_i - return sign - -} - -// MapToG2 invokes the SSWU map, and guarantees that the result is in g2 -func MapToG2(u fptower.E2) G2Affine { - res := MapToCurve2(&u) - //this is in an isogenous curve - g2Isogeny(&res) - res.ClearCofactor(&res) - return res -} - -// EncodeToG2 hashes a message to a point on the G2 curve using the SSWU map. -// It is faster than HashToG2, but the result is not uniformly distributed. Unsuitable as a random oracle. -// dst stands for "domain separation tag", a string unique to the construction using the hash function -// https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html#roadmap -func EncodeToG2(msg, dst []byte) (G2Affine, error) { - - var res G2Affine - u, err := fp.Hash(msg, dst, 2) - if err != nil { - return res, err - } - - res = MapToCurve2(&fptower.E2{ - A0: u[0], - A1: u[1], - }) - - //this is in an isogenous curve - g2Isogeny(&res) - res.ClearCofactor(&res) - return res, nil -} - -// HashToG2 hashes a message to a point on the G2 curve using the SSWU map. -// Slower than EncodeToG2, but usable as a random oracle. -// dst stands for "domain separation tag", a string unique to the construction using the hash function -// https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html#roadmap -func HashToG2(msg, dst []byte) (G2Affine, error) { - u, err := fp.Hash(msg, dst, 2*2) - if err != nil { - return G2Affine{}, err - } - - Q0 := MapToCurve2(&fptower.E2{ - A0: u[0], - A1: u[1], - }) - Q1 := MapToCurve2(&fptower.E2{ - A0: u[2+0], - A1: u[2+1], - }) - - //TODO (perf): Add in E' first, then apply isogeny - g2Isogeny(&Q0) - g2Isogeny(&Q1) - - var _Q0, _Q1 G2Jac - _Q0.FromAffine(&Q0) - _Q1.FromAffine(&Q1).AddAssign(&_Q0) - - _Q1.ClearCofactor(&_Q1) - - Q1.FromJacobian(&_Q1) - return Q1, nil -} - -func g2NotZero(x *fptower.E2) uint64 { - //Assuming G1 is over Fp and that if hashing is available for G2, it also is for G1 - return g1NotZero(&x.A0) | g1NotZero(&x.A1) - -} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/asm.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/asm.go index 49751a939..83956e0b4 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/asm.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/asm.go @@ -1,28 +1,16 @@ //go:build !noadx -// +build !noadx -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT package fptower -import "golang.org/x/sys/cpu" +import "github.com/consensys/gnark-crypto/utils/cpu" // supportAdx will be set only on amd64 that has MULX and ADDX instructions var ( - supportAdx = cpu.X86.HasADX && cpu.X86.HasBMI2 + supportAdx = cpu.SupportADX _ = supportAdx // used in asm ) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/asm_noadx.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/asm_noadx.go index c6a97081f..1dc20b499 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/asm_noadx.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/asm_noadx.go @@ -1,19 +1,7 @@ //go:build noadx -// +build noadx -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e12.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e12.go index 450562473..6f0a987d4 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e12.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e12.go @@ -1,16 +1,5 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -67,14 +56,14 @@ func (z *E12) SetOne() *E12 { return z } -// Add set z=x+y in E12 and return z +// Add sets z=x+y in E12 and returns z func (z *E12) Add(x, y *E12) *E12 { z.C0.Add(&x.C0, &y.C0) z.C1.Add(&x.C1, &y.C1) return z } -// Sub sets z to x sub y and return z +// Sub sets z to x-y and returns z func (z *E12) Sub(x, y *E12) *E12 { z.C0.Sub(&x.C0, &y.C0) z.C1.Sub(&x.C1, &y.C1) @@ -99,16 +88,25 @@ func (z *E12) SetRandom() (*E12, error) { return z, nil } -// IsZero returns true if the two elements are equal, false otherwise +// MustSetRandom sets a0 and a1 to random values. +// It panics if reading form crypto/rand fails +func (z *E12) MustSetRandom() { + if _, err := z.SetRandom(); err != nil { + panic(err) + } +} + +// IsZero returns true if z is zero, false otherwise func (z *E12) IsZero() bool { return z.C0.IsZero() && z.C1.IsZero() } +// IsOne returns true if z is one, false otherwise func (z *E12) IsOne() bool { return z.C0.IsOne() && z.C1.IsZero() } -// Mul set z=x*y in E12 and return z +// Mul sets z=x*y in E12 and returns z func (z *E12) Mul(x, y *E12) *E12 { var a, b, c E6 a.Add(&x.C0, &x.C1) @@ -121,7 +119,7 @@ func (z *E12) Mul(x, y *E12) *E12 { return z } -// Square set z=x*x in E12 and return z +// Square sets z=x*x in E12 and returns z func (z *E12) Square(x *E12) *E12 { //Algorithm 22 from https://eprint.iacr.org/2010/354.pdf @@ -406,7 +404,7 @@ func (z *E12) CyclotomicSquare(x *E12) *E12 { return z } -// Inverse set z to the inverse of x in E12 and return z +// Inverse sets z to the inverse of x in E12 and returns z // // if x == 0, sets and returns z = x func (z *E12) Inverse(x *E12) *E12 { @@ -424,8 +422,8 @@ func (z *E12) Inverse(x *E12) *E12 { return z } -// BatchInvertE12 returns a new slice with every element inverted. -// Uses Montgomery batch inversion trick +// BatchInvertE12 returns a new slice with every element in a inverted. +// It uses Montgomery batch inversion trick. // // if a[i] == 0, returns result[i] = a[i] func BatchInvertE12(a []E12) []E12 { @@ -535,7 +533,7 @@ func (z *E12) CyclotomicExp(x E12, k *big.Int) *E12 { n := ecc.NafDecomposition(e, eNAF[:]) for i := n - 1; i >= 0; i-- { res.CyclotomicSquare(&res) - if eNAF[i] == 1 { + if eNAF[i] == 1 { // nolint QF1003 res.Mul(&res, &x) } else if eNAF[i] == -1 { res.Mul(&res, &xInv) @@ -635,12 +633,12 @@ func (z *E12) ExpGLV(x E12, k *big.Int) *E12 { return z } -// InverseUnitary inverse a unitary element +// InverseUnitary inverses a unitary element func (z *E12) InverseUnitary(x *E12) *E12 { return z.Conjugate(x) } -// Conjugate set z to x conjugated and return z +// Conjugate sets z to x conjugated and returns z func (z *E12) Conjugate(x *E12) *E12 { *z = *x z.C1.Neg(&z.C1) @@ -846,6 +844,8 @@ func BatchDecompressTorus(x []E6) ([]E12, error) { return res, nil } +// Select is conditional move. +// If cond = 0, it sets z to caseZ and returns it. otherwise caseNz. func (z *E12) Select(cond int, caseZ *E12, caseNz *E12) *E12 { //Might be able to save a nanosecond or two by an aggregate implementation @@ -855,6 +855,7 @@ func (z *E12) Select(cond int, caseZ *E12, caseNz *E12) *E12 { return z } +// Div divides an element in E12 by an element in E12 func (z *E12) Div(x *E12, y *E12) *E12 { var r E12 r.Inverse(y).Mul(x, &r) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e12_pairing.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e12_pairing.go index 6888dfc4f..3af622473 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e12_pairing.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e12_pairing.go @@ -52,9 +52,31 @@ func (z *E12) MulBy034(c0, c3, c4 *E2) *E12 { b.Set(&z.C1) b.MulBy01(c3, c4) - c0.Add(c0, c3) + var d0 E2 + d0.Add(c0, c3) d.Add(&z.C0, &z.C1) - d.MulBy01(c0, c4) + d.MulBy01(&d0, c4) + + z.C1.Add(&a, &b).Neg(&z.C1).Add(&z.C1, &d) + z.C0.MulByNonResidue(&b).Add(&z.C0, &a) + + return z +} + +// MulBy34 multiplication by sparse element (1,0,0,c3,c4,0) +func (z *E12) MulBy34(c3, c4 *E2) *E12 { + + var a, b, d E6 + + a.Set(&z.C0) + + b.Set(&z.C1) + b.MulBy01(c3, c4) + + var d0 E2 + d0.SetOne().Add(&d0, c3) + d.Add(&z.C0, &z.C1) + d.MulBy01(&d0, c4) z.C1.Add(&a, &b).Neg(&z.C1).Add(&z.C1, &d) z.C0.MulByNonResidue(&b).Add(&z.C0, &a) @@ -90,6 +112,26 @@ func Mul034By034(d0, d3, d4, c0, c3, c4 *E2) [5]E2 { return [5]E2{z00, x3, x34, x03, x04} } +// Mul34By34 multiplication of sparse element (1,0,0,c3,c4,0) by sparse element (1,0,0,d3,d4,0) +func Mul34By34(d3, d4, c3, c4 *E2) [5]E2 { + var z00, tmp, x0, x3, x4, x04, x03, x34 E2 + x3.Mul(c3, d3) + x4.Mul(c4, d4) + x04.Add(c4, d4) + x03.Add(c3, d3) + tmp.Add(c3, c4) + x34.Add(d3, d4). + Mul(&x34, &tmp). + Sub(&x34, &x3). + Sub(&x34, &x4) + + x0.SetOne() + z00.MulByNonResidue(&x4). + Add(&z00, &x0) + + return [5]E2{z00, x3, x34, x03, x04} +} + // MulBy01234 multiplies z by an E12 sparse element of the form (x0, x1, x2, x3, x4, 0) func (z *E12) MulBy01234(x *[5]E2) *E12 { var c1, a, b, c, z0, z1 E6 diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e2.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e2.go index 874802d74..e8793a0c7 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e2.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e2.go @@ -1,16 +1,5 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -101,11 +90,20 @@ func (z *E2) SetRandom() (*E2, error) { return z, nil } -// IsZero returns true if the two elements are equal, false otherwise +// MustSetRandom sets a0 and a1 to random values. +// It panics if reading form crypto/rand fails +func (z *E2) MustSetRandom() { + if _, err := z.SetRandom(); err != nil { + panic(err) + } +} + +// IsZero returns true if z is zero, false otherwise func (z *E2) IsZero() bool { return z.A0.IsZero() && z.A1.IsZero() } +// IsOne returns true if z is one, false otherwise func (z *E2) IsOne() bool { return z.A0.IsOne() && z.A1.IsZero() } @@ -116,7 +114,7 @@ func (z *E2) Add(x, y *E2) *E2 { return z } -// Sub two elements of E2 +// Sub subtracts two elements of E2 func (z *E2) Sub(x, y *E2) *E2 { subE2(z, x, y) return z @@ -155,7 +153,7 @@ func (z *E2) Conjugate(x *E2) *E2 { return z } -// Halve sets z = z / 2 +// Halve sets z to z / 2 func (z *E2) Halve() { z.A0.Halve() z.A1.Halve() @@ -242,8 +240,8 @@ func (z *E2) Sqrt(x *E2) *E2 { return z } -// BatchInvertE2 returns a new slice with every element inverted. -// Uses Montgomery batch inversion trick +// BatchInvertE2 returns a new slice with every element in a inverted. +// It uses Montgomery batch inversion trick. // // if a[i] == 0, returns result[i] = a[i] func BatchInvertE2(a []E2) []E2 { @@ -278,6 +276,8 @@ func BatchInvertE2(a []E2) []E2 { return res } +// Select is conditional move. +// If cond = 0, it sets z to caseZ and returns it. otherwise caseNz. func (z *E2) Select(cond int, caseZ *E2, caseNz *E2) *E2 { //Might be able to save a nanosecond or two by an aggregate implementation @@ -287,6 +287,7 @@ func (z *E2) Select(cond int, caseZ *E2, caseNz *E2) *E2 { return z } +// Div divides an element in E2 by an element in E2 func (z *E2) Div(x *E2, y *E2) *E2 { var r E2 r.Inverse(y).Mul(x, &r) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e2_amd64.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e2_amd64.go index ac68ffa57..008953000 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e2_amd64.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e2_amd64.go @@ -1,21 +1,37 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT package fptower +import ( + "github.com/consensys/gnark-crypto/ecc/bls12-377/fp" +) + +// q + r'.r = 1, i.e., qInvNeg = - q⁻¹ mod r +// used for Montgomery reduction +const qInvNeg uint64 = 9586122913090633727 + +// Field modulus q (Fp) +const ( + q0 uint64 = 9586122913090633729 + q1 uint64 = 1660523435060625408 + q2 uint64 = 2230234197602682880 + q3 uint64 = 1883307231910630287 + q4 uint64 = 14284016967150029115 + q5 uint64 = 121098312706494698 +) + +var qElement = fp.Element{ + q0, + q1, + q2, + q3, + q4, + q5, +} + //go:noescape func addE2(res, x, y *E2) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e2_amd64.s b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e2_amd64.s index 053bd8ded..f1a8089f1 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e2_amd64.s +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e2_amd64.s @@ -1,104 +1,107 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. #include "textflag.h" #include "funcdata.h" +#include "go_asm.h" -// modulus q -DATA q<>+0(SB)/8, $0x8508c00000000001 -DATA q<>+8(SB)/8, $0x170b5d4430000000 -DATA q<>+16(SB)/8, $0x1ef3622fba094800 -DATA q<>+24(SB)/8, $0x1a22d9f300f5138f -DATA q<>+32(SB)/8, $0xc63b05c06ca1493b -DATA q<>+40(SB)/8, $0x01ae3a4617c510ea -GLOBL q<>(SB), (RODATA+NOPTR), $48 +#define REDUCE(ra0, ra1, ra2, ra3, ra4, ra5, rb0, rb1, rb2, rb3, rb4, rb5, q0, q1, q2, q3, q4, q5) \ + MOVQ ra0, rb0; \ + SUBQ q0, ra0; \ + MOVQ ra1, rb1; \ + SBBQ q1, ra1; \ + MOVQ ra2, rb2; \ + SBBQ q2, ra2; \ + MOVQ ra3, rb3; \ + SBBQ q3, ra3; \ + MOVQ ra4, rb4; \ + SBBQ q4, ra4; \ + MOVQ ra5, rb5; \ + SBBQ q5, ra5; \ + CMOVQCS rb0, ra0; \ + CMOVQCS rb1, ra1; \ + CMOVQCS rb2, ra2; \ + CMOVQCS rb3, ra3; \ + CMOVQCS rb4, ra4; \ + CMOVQCS rb5, ra5; \ -// qInv0 q'[0] -DATA qInv0<>(SB)/8, $0x8508bfffffffffff -GLOBL qInv0<>(SB), (RODATA+NOPTR), $8 +#define REDUCE_NOGLOBAL(ra0, ra1, ra2, ra3, ra4, ra5, rb0, rb1, rb2, rb3, rb4, rb5, scratch0) \ + MOVQ ra0, rb0; \ + MOVQ $const_q0, scratch0; \ + SUBQ scratch0, ra0; \ + MOVQ ra1, rb1; \ + MOVQ $const_q1, scratch0; \ + SBBQ scratch0, ra1; \ + MOVQ ra2, rb2; \ + MOVQ $const_q2, scratch0; \ + SBBQ scratch0, ra2; \ + MOVQ ra3, rb3; \ + MOVQ $const_q3, scratch0; \ + SBBQ scratch0, ra3; \ + MOVQ ra4, rb4; \ + MOVQ $const_q4, scratch0; \ + SBBQ scratch0, ra4; \ + MOVQ ra5, rb5; \ + MOVQ $const_q5, scratch0; \ + SBBQ scratch0, ra5; \ + CMOVQCS rb0, ra0; \ + CMOVQCS rb1, ra1; \ + CMOVQCS rb2, ra2; \ + CMOVQCS rb3, ra3; \ + CMOVQCS rb4, ra4; \ + CMOVQCS rb5, ra5; \ -#define REDUCE(ra0, ra1, ra2, ra3, ra4, ra5, rb0, rb1, rb2, rb3, rb4, rb5) \ - MOVQ ra0, rb0; \ - SUBQ q<>(SB), ra0; \ - MOVQ ra1, rb1; \ - SBBQ q<>+8(SB), ra1; \ - MOVQ ra2, rb2; \ - SBBQ q<>+16(SB), ra2; \ - MOVQ ra3, rb3; \ - SBBQ q<>+24(SB), ra3; \ - MOVQ ra4, rb4; \ - SBBQ q<>+32(SB), ra4; \ - MOVQ ra5, rb5; \ - SBBQ q<>+40(SB), ra5; \ - CMOVQCS rb0, ra0; \ - CMOVQCS rb1, ra1; \ - CMOVQCS rb2, ra2; \ - CMOVQCS rb3, ra3; \ - CMOVQCS rb4, ra4; \ - CMOVQCS rb5, ra5; \ - -TEXT ·addE2(SB), NOSPLIT, $0-24 +TEXT ·addE2(SB), $8-24 MOVQ x+8(FP), AX - MOVQ 0(AX), BX - MOVQ 8(AX), SI - MOVQ 16(AX), DI - MOVQ 24(AX), R8 - MOVQ 32(AX), R9 - MOVQ 40(AX), R10 + MOVQ 0(AX), CX + MOVQ 8(AX), BX + MOVQ 16(AX), SI + MOVQ 24(AX), DI + MOVQ 32(AX), R8 + MOVQ 40(AX), R9 MOVQ y+16(FP), DX - ADDQ 0(DX), BX - ADCQ 8(DX), SI - ADCQ 16(DX), DI - ADCQ 24(DX), R8 - ADCQ 32(DX), R9 - ADCQ 40(DX), R10 + ADDQ 0(DX), CX + ADCQ 8(DX), BX + ADCQ 16(DX), SI + ADCQ 24(DX), DI + ADCQ 32(DX), R8 + ADCQ 40(DX), R9 - // reduce element(BX,SI,DI,R8,R9,R10) using temp registers (R11,R12,R13,R14,R15,s0-8(SP)) - REDUCE(BX,SI,DI,R8,R9,R10,R11,R12,R13,R14,R15,s0-8(SP)) + // reduce element(CX,BX,SI,DI,R8,R9,) using temp registers (R11,R12,R13,R14,R15,s0-8(SP),R10) + REDUCE_NOGLOBAL(CX,BX,SI,DI,R8,R9,R11,R12,R13,R14,R15,s0-8(SP),R10) - MOVQ res+0(FP), CX - MOVQ BX, 0(CX) - MOVQ SI, 8(CX) - MOVQ DI, 16(CX) - MOVQ R8, 24(CX) - MOVQ R9, 32(CX) - MOVQ R10, 40(CX) - MOVQ 48(AX), BX - MOVQ 56(AX), SI - MOVQ 64(AX), DI - MOVQ 72(AX), R8 - MOVQ 80(AX), R9 - MOVQ 88(AX), R10 - ADDQ 48(DX), BX - ADCQ 56(DX), SI - ADCQ 64(DX), DI - ADCQ 72(DX), R8 - ADCQ 80(DX), R9 - ADCQ 88(DX), R10 + MOVQ res+0(FP), R11 + MOVQ CX, 0(R11) + MOVQ BX, 8(R11) + MOVQ SI, 16(R11) + MOVQ DI, 24(R11) + MOVQ R8, 32(R11) + MOVQ R9, 40(R11) + MOVQ 48(AX), CX + MOVQ 56(AX), BX + MOVQ 64(AX), SI + MOVQ 72(AX), DI + MOVQ 80(AX), R8 + MOVQ 88(AX), R9 + ADDQ 48(DX), CX + ADCQ 56(DX), BX + ADCQ 64(DX), SI + ADCQ 72(DX), DI + ADCQ 80(DX), R8 + ADCQ 88(DX), R9 - // reduce element(BX,SI,DI,R8,R9,R10) using temp registers (R11,R12,R13,R14,R15,s0-8(SP)) - REDUCE(BX,SI,DI,R8,R9,R10,R11,R12,R13,R14,R15,s0-8(SP)) + // reduce element(CX,BX,SI,DI,R8,R9,) using temp registers (R13,R14,R15,R10,AX,DX,R12) + REDUCE_NOGLOBAL(CX,BX,SI,DI,R8,R9,R13,R14,R15,R10,AX,DX,R12) - MOVQ BX, 48(CX) - MOVQ SI, 56(CX) - MOVQ DI, 64(CX) - MOVQ R8, 72(CX) - MOVQ R9, 80(CX) - MOVQ R10, 88(CX) + MOVQ CX, 48(R11) + MOVQ BX, 56(R11) + MOVQ SI, 64(R11) + MOVQ DI, 72(R11) + MOVQ R8, 80(R11) + MOVQ R9, 88(R11) RET -TEXT ·doubleE2(SB), NOSPLIT, $0-16 +TEXT ·doubleE2(SB), $8-16 MOVQ res+0(FP), DX MOVQ x+8(FP), AX MOVQ 0(AX), CX @@ -114,8 +117,8 @@ TEXT ·doubleE2(SB), NOSPLIT, $0-16 ADCQ R8, R8 ADCQ R9, R9 - // reduce element(CX,BX,SI,DI,R8,R9) using temp registers (R10,R11,R12,R13,R14,R15) - REDUCE(CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14,R15) + // reduce element(CX,BX,SI,DI,R8,R9,) using temp registers (R11,R12,R13,R14,R15,s0-8(SP),R10) + REDUCE_NOGLOBAL(CX,BX,SI,DI,R8,R9,R11,R12,R13,R14,R15,s0-8(SP),R10) MOVQ CX, 0(DX) MOVQ BX, 8(DX) @@ -136,8 +139,8 @@ TEXT ·doubleE2(SB), NOSPLIT, $0-16 ADCQ R8, R8 ADCQ R9, R9 - // reduce element(CX,BX,SI,DI,R8,R9) using temp registers (R10,R11,R12,R13,R14,R15) - REDUCE(CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14,R15) + // reduce element(CX,BX,SI,DI,R8,R9,) using temp registers (R12,R13,R14,R15,R10,s0-8(SP),R11) + REDUCE_NOGLOBAL(CX,BX,SI,DI,R8,R9,R12,R13,R14,R15,R10,s0-8(SP),R11) MOVQ CX, 48(DX) MOVQ BX, 56(DX) @@ -148,7 +151,7 @@ TEXT ·doubleE2(SB), NOSPLIT, $0-16 RET TEXT ·subE2(SB), NOSPLIT, $0-24 - XORQ R9, R9 + XORQ R15, R15 MOVQ x+8(FP), R8 MOVQ 0(R8), AX MOVQ 8(R8), DX @@ -164,31 +167,31 @@ TEXT ·subE2(SB), NOSPLIT, $0-24 SBBQ 32(R8), SI SBBQ 40(R8), DI MOVQ x+8(FP), R8 - MOVQ $0x8508c00000000001, R10 - MOVQ $0x170b5d4430000000, R11 - MOVQ $0x1ef3622fba094800, R12 - MOVQ $0x1a22d9f300f5138f, R13 - MOVQ $0xc63b05c06ca1493b, R14 - MOVQ $0x01ae3a4617c510ea, R15 - CMOVQCC R9, R10 - CMOVQCC R9, R11 - CMOVQCC R9, R12 - CMOVQCC R9, R13 - CMOVQCC R9, R14 - CMOVQCC R9, R15 - ADDQ R10, AX - ADCQ R11, DX - ADCQ R12, CX - ADCQ R13, BX - ADCQ R14, SI - ADCQ R15, DI - MOVQ res+0(FP), R10 - MOVQ AX, 0(R10) - MOVQ DX, 8(R10) - MOVQ CX, 16(R10) - MOVQ BX, 24(R10) - MOVQ SI, 32(R10) - MOVQ DI, 40(R10) + MOVQ $0x8508c00000000001, R9 + MOVQ $0x170b5d4430000000, R10 + MOVQ $0x1ef3622fba094800, R11 + MOVQ $0x1a22d9f300f5138f, R12 + MOVQ $0xc63b05c06ca1493b, R13 + MOVQ $0x01ae3a4617c510ea, R14 + CMOVQCC R15, R9 + CMOVQCC R15, R10 + CMOVQCC R15, R11 + CMOVQCC R15, R12 + CMOVQCC R15, R13 + CMOVQCC R15, R14 + ADDQ R9, AX + ADCQ R10, DX + ADCQ R11, CX + ADCQ R12, BX + ADCQ R13, SI + ADCQ R14, DI + MOVQ res+0(FP), R9 + MOVQ AX, 0(R9) + MOVQ DX, 8(R9) + MOVQ CX, 16(R9) + MOVQ BX, 24(R9) + MOVQ SI, 32(R9) + MOVQ DI, 40(R9) MOVQ 48(R8), AX MOVQ 56(R8), DX MOVQ 64(R8), CX @@ -202,24 +205,24 @@ TEXT ·subE2(SB), NOSPLIT, $0-24 SBBQ 72(R8), BX SBBQ 80(R8), SI SBBQ 88(R8), DI - MOVQ $0x8508c00000000001, R11 - MOVQ $0x170b5d4430000000, R12 - MOVQ $0x1ef3622fba094800, R13 - MOVQ $0x1a22d9f300f5138f, R14 - MOVQ $0xc63b05c06ca1493b, R15 - MOVQ $0x01ae3a4617c510ea, R10 - CMOVQCC R9, R11 - CMOVQCC R9, R12 - CMOVQCC R9, R13 - CMOVQCC R9, R14 - CMOVQCC R9, R15 - CMOVQCC R9, R10 - ADDQ R11, AX - ADCQ R12, DX - ADCQ R13, CX - ADCQ R14, BX - ADCQ R15, SI - ADCQ R10, DI + MOVQ $0x8508c00000000001, R10 + MOVQ $0x170b5d4430000000, R11 + MOVQ $0x1ef3622fba094800, R12 + MOVQ $0x1a22d9f300f5138f, R13 + MOVQ $0xc63b05c06ca1493b, R14 + MOVQ $0x01ae3a4617c510ea, R9 + CMOVQCC R15, R10 + CMOVQCC R15, R11 + CMOVQCC R15, R12 + CMOVQCC R15, R13 + CMOVQCC R15, R14 + CMOVQCC R15, R9 + ADDQ R10, AX + ADCQ R11, DX + ADCQ R12, CX + ADCQ R13, BX + ADCQ R14, SI + ADCQ R9, DI MOVQ res+0(FP), R8 MOVQ AX, 48(R8) MOVQ DX, 56(R8) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e2_bls377.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e2_bls377.go index 9505d5315..8e744274f 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e2_bls377.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e2_bls377.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys AG -// -// 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. package fptower diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e2_fallback.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e2_fallback.go index 6fe47c411..7a2461ec5 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e2_fallback.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e2_fallback.go @@ -1,19 +1,7 @@ //go:build !amd64 -// +build !amd64 -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e6.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e6.go index 128007df2..4c932208b 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e6.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/e6.go @@ -1,16 +1,5 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -63,11 +52,20 @@ func (z *E6) SetRandom() (*E6, error) { return z, nil } -// IsZero returns true if the two elements are equal, false otherwise +// MustSetRandom sets a0 and a1 to random values. +// It panics if reading form crypto/rand fails +func (z *E6) MustSetRandom() { + if _, err := z.SetRandom(); err != nil { + panic(err) + } +} + +// IsZero returns true if z is zero, false otherwise func (z *E6) IsZero() bool { return z.B0.IsZero() && z.B1.IsZero() && z.B2.IsZero() } +// IsOne returns true if z is one, false otherwise func (z *E6) IsOne() bool { return z.B0.IsOne() && z.B1.IsZero() && z.B2.IsZero() } @@ -88,7 +86,7 @@ func (z *E6) Neg(x *E6) *E6 { return z } -// Sub two elements of E6 +// Sub subtracts two elements of E6 func (z *E6) Sub(x, y *E6) *E6 { z.B0.Sub(&x.B0, &y.B0) z.B1.Sub(&x.B1, &y.B1) @@ -286,8 +284,8 @@ func (z *E6) Inverse(x *E6) *E6 { return z } -// BatchInvertE6 returns a new slice with every element inverted. -// Uses Montgomery batch inversion trick +// BatchInvertE6 returns a new slice with every element in a inverted. +// It uses Montgomery batch inversion trick. // // if a[i] == 0, returns result[i] = a[i] func BatchInvertE6(a []E6) []E6 { @@ -322,6 +320,8 @@ func BatchInvertE6(a []E6) []E6 { return res } +// Select is conditional move. +// If cond = 0, it sets z to caseZ and returns it. otherwise caseNz. func (z *E6) Select(cond int, caseZ *E6, caseNz *E6) *E6 { //Might be able to save a nanosecond or two by an aggregate implementation @@ -332,6 +332,7 @@ func (z *E6) Select(cond int, caseZ *E6, caseNz *E6) *E6 { return z } +// Div divides an element in E6 by an element in E6 func (z *E6) Div(x *E6, y *E6) *E6 { var r E6 r.Inverse(y).Mul(x, &r) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/frobenius.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/frobenius.go index a7e1b2a81..44ca7315b 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/frobenius.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/frobenius.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys AG -// -// 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. package fptower diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/parameters.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/parameters.go index 6f2b1d6c7..374a13ede 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/parameters.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower/parameters.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys AG -// -// 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. package fptower diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/marshal.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/marshal.go index 317f7c535..594fa3900 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/marshal.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/marshal.go @@ -1,16 +1,5 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -171,6 +160,26 @@ func (dec *Decoder) Decode(v interface{}) (err error) { dec.n += read64 } return + case *[][][]fr.Element: + if sliceLen, err = dec.readUint32(); err != nil { + return + } + if len(*t) != int(sliceLen) { + *t = make([][][]fr.Element, sliceLen) + } + for i := range *t { + if sliceLen, err = dec.readUint32(); err != nil { + return + } + if len((*t)[i]) != int(sliceLen) { + (*t)[i] = make([][]fr.Element, sliceLen) + } + for j := range (*t)[i] { + read64, err = (*fr.Vector)(&(*t)[i][j]).ReadFrom(dec.r) + dec.n += read64 + } + } + return case *G1Affine: // we start by reading compressed point size, if metadata tells us it is uncompressed, we read more. read, err = io.ReadFull(dec.r, buf[:SizeOfG1AffineCompressed]) @@ -405,7 +414,7 @@ func isMaskInvalid(msb byte) bool { func isCompressed(msb byte) bool { mData := msb & mMask - return !((mData == mUncompressed) || (mData == mUncompressedInfinity)) + return mData != mUncompressed && mData != mUncompressedInfinity } // NewEncoder returns a binary encoder supporting curve bls12-377 objects @@ -426,7 +435,7 @@ func NewEncoder(w io.Writer, options ...func(*Encoder)) *Encoder { } // Encode writes the binary encoding of v to the stream -// type must be uint64, *fr.Element, *fp.Element, *G1Affine, *G2Affine, []G1Affine or []G2Affine +// type must be uint64, *fr.Element, *fp.Element, *G1Affine, *G2Affine, []G1Affine, []G2Affine, *[]G1Affine or *[]G2Affine func (enc *Encoder) Encode(v interface{}) (err error) { if enc.raw { return enc.encodeRaw(v) @@ -537,6 +546,27 @@ func (enc *Encoder) encode(v interface{}) (err error) { enc.n += written64 } return + case [][][]fr.Element: + // number of collections + if err = binary.Write(enc.w, binary.BigEndian, uint32(len(t))); err != nil { + return + } + enc.n += 4 + for i := range t { + // size of current collection + if err = binary.Write(enc.w, binary.BigEndian, uint32(len(t[i]))); err != nil { + return + } + enc.n += 4 + // write each vector of the current collection + for j := range t[i] { + written64, err = (*fr.Vector)(&t[i][j]).WriteTo(enc.w) + enc.n += written64 + } + } + return + case *[]G1Affine: + return enc.encode(*t) case []G1Affine: // write slice length err = binary.Write(enc.w, binary.BigEndian, uint32(len(t))) @@ -556,6 +586,8 @@ func (enc *Encoder) encode(v interface{}) (err error) { } } return nil + case *[]G2Affine: + return enc.encode(*t) case []G2Affine: // write slice length err = binary.Write(enc.w, binary.BigEndian, uint32(len(t))) @@ -655,6 +687,27 @@ func (enc *Encoder) encodeRaw(v interface{}) (err error) { enc.n += written64 } return + case [][][]fr.Element: + // number of collections + if err = binary.Write(enc.w, binary.BigEndian, uint32(len(t))); err != nil { + return + } + enc.n += 4 + for i := range t { + // size of current collection + if err = binary.Write(enc.w, binary.BigEndian, uint32(len(t[i]))); err != nil { + return + } + enc.n += 4 + // write each vector of the current collection + for j := range t[i] { + written64, err = (*fr.Vector)(&t[i][j]).WriteTo(enc.w) + enc.n += written64 + } + } + return + case *[]G1Affine: + return enc.encodeRaw(*t) case []G1Affine: // write slice length err = binary.Write(enc.w, binary.BigEndian, uint32(len(t))) @@ -674,6 +727,8 @@ func (enc *Encoder) encodeRaw(v interface{}) (err error) { } } return nil + case *[]G2Affine: + return enc.encodeRaw(*t) case []G2Affine: // write slice length err = binary.Write(enc.w, binary.BigEndian, uint32(len(t))) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/multiexp.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/multiexp.go index 8ae82e0a3..93bbfa633 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/multiexp.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/multiexp.go @@ -1,16 +1,5 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -323,6 +312,31 @@ func msmReduceChunkG1Affine(p *G1Jac, c int, chChunks []chan g1JacExtended) *G1J return p.unsafeFromJacExtended(&_p) } +// Fold computes the multi-exponentiation \sum_{i=0}^{len(points)-1} points[i] * +// combinationCoeff^i and stores the result in p. It returns error in case +// configuration is invalid. +func (p *G1Affine) Fold(points []G1Affine, combinationCoeff fr.Element, config ecc.MultiExpConfig) (*G1Affine, error) { + var _p G1Jac + if _, err := _p.Fold(points, combinationCoeff, config); err != nil { + return nil, err + } + p.FromJacobian(&_p) + return p, nil +} + +// Fold computes the multi-exponentiation \sum_{i=0}^{len(points)-1} points[i] * +// combinationCoeff^i and stores the result in p. It returns error in case +// configuration is invalid. +func (p *G1Jac) Fold(points []G1Affine, combinationCoeff fr.Element, config ecc.MultiExpConfig) (*G1Jac, error) { + scalars := make([]fr.Element, len(points)) + scalar := fr.NewElement(1) + for i := 0; i < len(points); i++ { + scalars[i].Set(&scalar) + scalar.Mul(&scalar, &combinationCoeff) + } + return p.MultiExp(points, scalars, config) +} + // MultiExp implements section 4 of https://eprint.iacr.org/2012/549.pdf // // This call return an error if len(scalars) != len(points) or if provided config is invalid. @@ -621,6 +635,31 @@ func msmReduceChunkG2Affine(p *G2Jac, c int, chChunks []chan g2JacExtended) *G2J return p.unsafeFromJacExtended(&_p) } +// Fold computes the multi-exponentiation \sum_{i=0}^{len(points)-1} points[i] * +// combinationCoeff^i and stores the result in p. It returns error in case +// configuration is invalid. +func (p *G2Affine) Fold(points []G2Affine, combinationCoeff fr.Element, config ecc.MultiExpConfig) (*G2Affine, error) { + var _p G2Jac + if _, err := _p.Fold(points, combinationCoeff, config); err != nil { + return nil, err + } + p.FromJacobian(&_p) + return p, nil +} + +// Fold computes the multi-exponentiation \sum_{i=0}^{len(points)-1} points[i] * +// combinationCoeff^i and stores the result in p. It returns error in case +// configuration is invalid. +func (p *G2Jac) Fold(points []G2Affine, combinationCoeff fr.Element, config ecc.MultiExpConfig) (*G2Jac, error) { + scalars := make([]fr.Element, len(points)) + scalar := fr.NewElement(1) + for i := 0; i < len(points); i++ { + scalars[i].Set(&scalar) + scalar.Mul(&scalar, &combinationCoeff) + } + return p.MultiExp(points, scalars, config) +} + // selector stores the index, mask and shifts needed to select bits from a scalar // it is used during the multiExp algorithm or the batch scalar multiplication type selector struct { diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/multiexp_affine.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/multiexp_affine.go index 422862c77..d82f02e47 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/multiexp_affine.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/multiexp_affine.go @@ -1,16 +1,5 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -30,7 +19,7 @@ type batchOpG1Affine struct { // using affine coordinates for the buckets. To amortize the cost of the inverse in the affine addition // we use a batch affine addition. // -// this is derived from a PR by 0x0ece : https://github.com/ConsenSys/gnark-crypto/pull/249 +// this is derived from a PR by 0x0ece : https://github.com/Consensys/gnark-crypto/pull/249 // See Section 5.3: ia.cr/2022/1396 func processChunkG1BatchAffine[BJE ibg1JacExtended, B ibG1Affine, BS bitSet, TP pG1Affine, TPP ppG1Affine, TQ qOpsG1Affine, TC cG1Affine]( chunk uint64, @@ -60,11 +49,10 @@ func processChunkG1BatchAffine[BJE ibg1JacExtended, B ibG1Affine, BS bitSet, TP // note that we have 2 sets of buckets // 1 in G1Affine used with the batch affine additions // 1 in g1JacExtended used in case the queue of conflicting points - var buckets B + var buckets B // in G1Affine coordinates, infinity point is represented as (0,0), no need to init var bucketsJE BJE for i := 0; i < len(buckets); i++ { - buckets[i].setInfinity() - bucketsJE[i].setInfinity() + bucketsJE[i].SetInfinity() } // setup for the batch affine; @@ -107,7 +95,7 @@ func processChunkG1BatchAffine[BJE ibg1JacExtended, B ibG1Affine, BS bitSet, TP bucketsJE[op.bucketID].addMixed(&op.point) return } - BK.setInfinity() + BK.SetInfinity() return } @@ -135,12 +123,12 @@ func processChunkG1BatchAffine[BJE ibg1JacExtended, B ibG1Affine, BS bitSet, TP if isAdd { bucketsJE[bucketID].addMixed(PP) } else { - BK.setInfinity() + BK.SetInfinity() } return } if isAdd { - BK.setInfinity() + BK.SetInfinity() } else { bucketsJE[bucketID].subMixed(PP) } @@ -222,11 +210,11 @@ func processChunkG1BatchAffine[BJE ibg1JacExtended, B ibG1Affine, BS bitSet, TP // reduce buckets into total // total = bucket[0] + 2*bucket[1] + 3*bucket[2] ... + n*bucket[n-1] var runningSum, total g1JacExtended - runningSum.setInfinity() - total.setInfinity() + runningSum.SetInfinity() + total.SetInfinity() for k := len(buckets) - 1; k >= 0; k-- { runningSum.addMixed(&buckets[k]) - if !bucketsJE[k].IsZero() { + if !bucketsJE[k].IsInfinity() { runningSum.add(&bucketsJE[k]) } total.add(&runningSum) @@ -358,7 +346,7 @@ type batchOpG2Affine struct { // using affine coordinates for the buckets. To amortize the cost of the inverse in the affine addition // we use a batch affine addition. // -// this is derived from a PR by 0x0ece : https://github.com/ConsenSys/gnark-crypto/pull/249 +// this is derived from a PR by 0x0ece : https://github.com/Consensys/gnark-crypto/pull/249 // See Section 5.3: ia.cr/2022/1396 func processChunkG2BatchAffine[BJE ibg2JacExtended, B ibG2Affine, BS bitSet, TP pG2Affine, TPP ppG2Affine, TQ qOpsG2Affine, TC cG2Affine]( chunk uint64, @@ -388,11 +376,10 @@ func processChunkG2BatchAffine[BJE ibg2JacExtended, B ibG2Affine, BS bitSet, TP // note that we have 2 sets of buckets // 1 in G2Affine used with the batch affine additions // 1 in g2JacExtended used in case the queue of conflicting points - var buckets B + var buckets B // in G2Affine coordinates, infinity point is represented as (0,0), no need to init var bucketsJE BJE for i := 0; i < len(buckets); i++ { - buckets[i].setInfinity() - bucketsJE[i].setInfinity() + bucketsJE[i].SetInfinity() } // setup for the batch affine; @@ -435,7 +422,7 @@ func processChunkG2BatchAffine[BJE ibg2JacExtended, B ibG2Affine, BS bitSet, TP bucketsJE[op.bucketID].addMixed(&op.point) return } - BK.setInfinity() + BK.SetInfinity() return } @@ -463,12 +450,12 @@ func processChunkG2BatchAffine[BJE ibg2JacExtended, B ibG2Affine, BS bitSet, TP if isAdd { bucketsJE[bucketID].addMixed(PP) } else { - BK.setInfinity() + BK.SetInfinity() } return } if isAdd { - BK.setInfinity() + BK.SetInfinity() } else { bucketsJE[bucketID].subMixed(PP) } @@ -550,11 +537,11 @@ func processChunkG2BatchAffine[BJE ibg2JacExtended, B ibG2Affine, BS bitSet, TP // reduce buckets into total // total = bucket[0] + 2*bucket[1] + 3*bucket[2] ... + n*bucket[n-1] var runningSum, total g2JacExtended - runningSum.setInfinity() - total.setInfinity() + runningSum.SetInfinity() + total.SetInfinity() for k := len(buckets) - 1; k >= 0; k-- { runningSum.addMixed(&buckets[k]) - if !bucketsJE[k].IsZero() { + if !bucketsJE[k].IsInfinity() { runningSum.add(&bucketsJE[k]) } total.add(&runningSum) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/multiexp_jacobian.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/multiexp_jacobian.go index 0df516f5b..5bc761f30 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/multiexp_jacobian.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/multiexp_jacobian.go @@ -1,16 +1,5 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -30,7 +19,7 @@ func processChunkG1Jacobian[B ibg1JacExtended](chunk uint64, var buckets B for i := 0; i < len(buckets); i++ { - buckets[i].setInfinity() + buckets[i].SetInfinity() } // for each scalars, get the digit corresponding to the chunk we're processing. @@ -53,10 +42,10 @@ func processChunkG1Jacobian[B ibg1JacExtended](chunk uint64, // total = bucket[0] + 2*bucket[1] + 3*bucket[2] ... + n*bucket[n-1] var runningSum, total g1JacExtended - runningSum.setInfinity() - total.setInfinity() + runningSum.SetInfinity() + total.SetInfinity() for k := len(buckets) - 1; k >= 0; k-- { - if !buckets[k].IsZero() { + if !buckets[k].IsInfinity() { runningSum.add(&buckets[k]) } total.add(&runningSum) @@ -119,7 +108,7 @@ func processChunkG2Jacobian[B ibg2JacExtended](chunk uint64, var buckets B for i := 0; i < len(buckets); i++ { - buckets[i].setInfinity() + buckets[i].SetInfinity() } // for each scalars, get the digit corresponding to the chunk we're processing. @@ -142,10 +131,10 @@ func processChunkG2Jacobian[B ibg2JacExtended](chunk uint64, // total = bucket[0] + 2*bucket[1] + 3*bucket[2] ... + n*bucket[n-1] var runningSum, total g2JacExtended - runningSum.setInfinity() - total.setInfinity() + runningSum.SetInfinity() + total.SetInfinity() for k := len(buckets) - 1; k >= 0; k-- { - if !buckets[k].IsZero() { + if !buckets[k].IsInfinity() { runningSum.add(&buckets[k]) } total.add(&runningSum) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/pairing.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/pairing.go index f670902e4..bdef731e1 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/pairing.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-377/pairing.go @@ -1,22 +1,12 @@ -// Copyright 2020 ConsenSys AG -// -// 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. package bls12377 import ( "errors" + "github.com/consensys/gnark-crypto/ecc/bls12-377/fp" "github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower" ) @@ -147,7 +137,7 @@ func MillerLoop(P []G1Affine, Q []G2Affine) (GT, error) { if n >= 1 { // i = 62, separately to avoid an E12 Square // (Square(res) = 1² = 1) - // loopCounter[62] = 0 + // LoopCounter[62] = 0 // k = 0, separately to avoid MulBy034 (res × ℓ) // (assign line to res) @@ -189,7 +179,7 @@ func MillerLoop(P []G1Affine, Q []G2Affine) (GT, error) { } // i <= 61 - for i := len(loopCounter) - 3; i >= 1; i-- { + for i := len(LoopCounter) - 3; i >= 1; i-- { // mutualize the square among n Miller loops // (∏ᵢfᵢ)² result.Square(&result) @@ -201,7 +191,7 @@ func MillerLoop(P []G1Affine, Q []G2Affine) (GT, error) { l1.r0.MulByElement(&l1.r0, &p[k].Y) l1.r1.MulByElement(&l1.r1, &p[k].X) - if loopCounter[i] == 0 { + if LoopCounter[i] == 0 { // ℓ × res result.MulBy034(&l1.r0, &l1.r1, &l1.r2) } else { @@ -221,7 +211,7 @@ func MillerLoop(P []G1Affine, Q []G2Affine) (GT, error) { } // i = 0, separately to avoid a point addition - // loopCounter[0] = 1 + // LoopCounter[0] = 1 result.Square(&result) for k := 0; k < n; k++ { // qProj[k] ← 2qProj[k] and l1 the tangent ℓ passing 2qProj[k] @@ -341,3 +331,279 @@ func (p *g2Proj) lineCompute(evaluations *lineEvaluation, a *G2Affine) { evaluations.r1.Neg(&O) evaluations.r2.Set(&J) } + +// ---------------------- +// Fixed-argument pairing +// ---------------------- + +type LineEvaluationAff struct { + R0 fptower.E2 + R1 fptower.E2 +} + +// PairFixedQ calculates the reduced pairing for a set of points +// ∏ᵢ e(Pᵢ, Qᵢ) where Q are fixed points in G2. +// +// This function doesn't check that the inputs are in the correct subgroup. See IsInSubGroup. +func PairFixedQ(P []G1Affine, lines [][2][len(LoopCounter) - 1]LineEvaluationAff) (GT, error) { + f, err := MillerLoopFixedQ(P, lines) + if err != nil { + return GT{}, err + } + return FinalExponentiation(&f), nil +} + +// PairingCheckFixedQ calculates the reduced pairing for a set of points and returns True if the result is One +// ∏ᵢ e(Pᵢ, Qᵢ) =? 1 where Q are fixed points in G2. +// +// This function doesn't check that the inputs are in the correct subgroup. See IsInSubGroup. +func PairingCheckFixedQ(P []G1Affine, lines [][2][len(LoopCounter) - 1]LineEvaluationAff) (bool, error) { + f, err := PairFixedQ(P, lines) + if err != nil { + return false, err + } + var one GT + one.SetOne() + return f.Equal(&one), nil +} + +// PrecomputeLines precomputes the lines for the fixed-argument Miller loop +func PrecomputeLines(Q G2Affine) (PrecomputedLines [2][len(LoopCounter) - 1]LineEvaluationAff) { + var accQ G2Affine + accQ.Set(&Q) + + for i := len(LoopCounter) - 2; i >= 0; i-- { + if LoopCounter[i] == 0 { + accQ.doubleStep(&PrecomputedLines[0][i]) + } else { + accQ.doubleAndAddStep(&PrecomputedLines[0][i], &PrecomputedLines[1][i], &Q) + } + } + return PrecomputedLines +} + +// MillerLoopFixedQ computes the multi-Miller loop as in MillerLoop +// but Qᵢ are fixed points in G2 known in advance. +func MillerLoopFixedQ(P []G1Affine, lines [][2][len(LoopCounter) - 1]LineEvaluationAff) (GT, error) { + n := len(P) + if n == 0 || n != len(lines) { + return GT{}, errors.New("invalid inputs sizes") + } + + // no need to filter infinity points: + // 1. if Pᵢ=(0,0) then -x/y=1/y=0 by gnark-crypto convention and so + // lines R0 and R1 are 0. At the end it happens that result will stay + // 1 through the Miller loop because MulBy34(1,0,0)==1 + // Mul34By34(1,0,0,1,0,0)==1 and MulBy01234(1,0,0,0,0)==1. + // + // 2. if Qᵢ=(0,0) then PrecomputeLines(Qᵢ) will return lines R0 and R1 + // that are 0 because of gnark-convention (*/0==0) in doubleStep and + // addStep. Similarly to Pᵢ=(0,0) it happens that result stays 1 + // throughout the MillerLoop. + + // precomputations + yInv := make([]fp.Element, n) + xNegOverY := make([]fp.Element, n) + for k := 0; k < n; k++ { + yInv[k].Set(&P[k].Y) + } + yInv = fp.BatchInvert(yInv) + for k := 0; k < n; k++ { + xNegOverY[k].Mul(&P[k].X, &yInv[k]). + Neg(&xNegOverY[k]) + } + + var result GT + result.SetOne() + var prodLines [5]E2 + + // Compute ∏ᵢ { fᵢ_{x₀,Q}(P) } + if n >= 1 { + // i = 62, separately to avoid an E12 Square + // (Square(res) = 1² = 1) + // LoopCounter[62] = 0 + // k = 0, separately to avoid MulBy34 (res × ℓ) + // (assign line to res) + + // line evaluation at P[0] (assign) + result.C1.B0.MulByElement(&lines[0][0][62].R0, &xNegOverY[0]) + result.C1.B1.MulByElement(&lines[0][0][62].R1, &yInv[0]) + // the coefficient which MulBy34 sets to 1 happens to be already 1 (result = 1) + } + + if n >= 2 { + // k = 1, separately to avoid MulBy34 (res × ℓ) + // (res is also a line at this point, so we use Mul34By34 ℓ × ℓ) + // line evaluation at P[1] + lines[1][0][62].R0.MulByElement(&lines[1][0][62].R0, &xNegOverY[1]) + lines[1][0][62].R1.MulByElement(&lines[1][0][62].R1, &yInv[1]) + // ℓ × res + prodLines = fptower.Mul34By34(&lines[1][0][62].R0, &lines[1][0][62].R1, &result.C1.B0, &result.C1.B1) + result.C0.B0 = prodLines[0] + result.C0.B1 = prodLines[1] + result.C0.B2 = prodLines[2] + result.C1.B0 = prodLines[3] + result.C1.B1 = prodLines[4] + } + + // k >= 2 + for k := 2; k < n; k++ { + // line evaluation at P[k] + lines[k][0][62].R0.MulByElement(&lines[k][0][62].R0, &xNegOverY[k]) + lines[k][0][62].R1.MulByElement(&lines[k][0][62].R1, &yInv[k]) + // ℓ × res + result.MulBy34( + &lines[k][0][62].R0, + &lines[k][0][62].R1, + ) + } + + for i := len(LoopCounter) - 3; i >= 0; i-- { + // mutualize the square among n Miller loops + // (∏ᵢfᵢ)² + result.Square(&result) + + for k := 0; k < n; k++ { + // line evaluation at P[k] + lines[k][0][i].R0. + MulByElement( + &lines[k][0][i].R0, + &xNegOverY[k], + ) + lines[k][0][i].R1. + MulByElement( + &lines[k][0][i].R1, + &yInv[k], + ) + + if LoopCounter[i] == 0 { + // ℓ × res + result.MulBy34( + &lines[k][0][i].R0, + &lines[k][0][i].R1, + ) + } else { + // line evaluation at P[k] + lines[k][1][i].R0. + MulByElement( + &lines[k][1][i].R0, + &xNegOverY[k], + ) + lines[k][1][i].R1. + MulByElement( + &lines[k][1][i].R1, + &yInv[k], + ) + // ℓ × ℓ + prodLines = fptower.Mul34By34( + &lines[k][0][i].R0, &lines[k][0][i].R1, + &lines[k][1][i].R0, &lines[k][1][i].R1, + ) + // (ℓ × ℓ) × res + result.MulBy01234(&prodLines) + } + } + } + + return result, nil +} + +func (p *G2Affine) doubleStep(evaluations *LineEvaluationAff) { + + var n, d, λ, xr, yr fptower.E2 + // λ = 3x²/2y + n.Square(&p.X) + λ.Double(&n). + Add(&λ, &n) + d.Double(&p.Y) + λ.Div(&λ, &d) + + // xr = λ²-2x + xr.Square(&λ). + Sub(&xr, &p.X). + Sub(&xr, &p.X) + + // yr = λ(x-xr)-y + yr.Sub(&p.X, &xr). + Mul(&yr, &λ). + Sub(&yr, &p.Y) + + evaluations.R0.Set(&λ) + evaluations.R1.Mul(&λ, &p.X). + Sub(&evaluations.R1, &p.Y) + + p.X.Set(&xr) + p.Y.Set(&yr) +} + +func (p *G2Affine) addStep(evaluations *LineEvaluationAff, a *G2Affine) { + var n, d, λ, λλ, xr, yr fptower.E2 + + // compute λ = (y2-y1)/(x2-x1) + n.Sub(&a.Y, &p.Y) + d.Sub(&a.X, &p.X) + λ.Div(&n, &d) + + // xr = λ²-x1-x2 + λλ.Square(&λ) + n.Add(&p.X, &a.X) + xr.Sub(&λλ, &n) + + // yr = λ(x1-xr) - y1 + yr.Sub(&p.X, &xr). + Mul(&yr, &λ). + Sub(&yr, &p.Y) + + evaluations.R0.Set(&λ) + evaluations.R1.Mul(&λ, &p.X). + Sub(&evaluations.R1, &p.Y) + + p.X.Set(&xr) + p.Y.Set(&yr) +} + +func (p *G2Affine) doubleAndAddStep(evaluations1, evaluations2 *LineEvaluationAff, a *G2Affine) { + var n, d, l1, x3, l2, x4, y4 fptower.E2 + + // compute λ1 = (y2-y1)/(x2-x1) + n.Sub(&p.Y, &a.Y) + d.Sub(&p.X, &a.X) + l1.Div(&n, &d) + + // compute x3 =λ1²-x1-x2 + x3.Square(&l1) + x3.Sub(&x3, &p.X) + x3.Sub(&x3, &a.X) + + // omit y3 computation + + // compute line1 + evaluations1.R0.Set(&l1) + evaluations1.R1.Mul(&l1, &p.X) + evaluations1.R1.Sub(&evaluations1.R1, &p.Y) + + // compute λ2 = -λ1-2y1/(x3-x1) + n.Double(&p.Y) + d.Sub(&x3, &p.X) + l2.Div(&n, &d) + l2.Add(&l2, &l1) + l2.Neg(&l2) + + // compute x4 = λ2²-x1-x3 + x4.Square(&l2) + x4.Sub(&x4, &p.X) + x4.Sub(&x4, &x3) + + // compute y4 = λ2(x1 - x4)-y1 + y4.Sub(&p.X, &x4) + y4.Mul(&l2, &y4) + y4.Sub(&y4, &p.Y) + + // compute line2 + evaluations2.R0.Set(&l2) + evaluations2.R1.Mul(&l2, &p.X) + evaluations2.R1.Sub(&evaluations2.R1, &p.Y) + + p.X.Set(&x4) + p.Y.Set(&y4) +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/bls12-381.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/bls12-381.go index 86ab933a1..da16dbdde 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/bls12-381.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/bls12-381.go @@ -62,13 +62,13 @@ var g1Infinity G1Jac var g2Infinity G2Jac // optimal Ate loop counter -var loopCounter [64]int8 +var LoopCounter [64]int8 // Parameters useful for the GLV scalar multiplication. The third roots define the // endomorphisms ϕ₁ and ϕ₂ for and . lambda is such that lies above // in the ring Z[ϕ]. More concretely it's the associated eigenvalue // of ϕ₁ (resp ϕ₂) restricted to (resp ) -// see https://www.cosic.esat.kuleuven.be/nessie/reports/phase2/GLV.pdf +// see https://link.springer.com/content/pdf/10.1007/3-540-36492-7_3 var thirdRootOneG1 fp.Element var thirdRootOneG2 fp.Element var lambdaGLV big.Int @@ -77,6 +77,12 @@ var lambdaGLV big.Int // in ker((u,v) → u+vλ[r]), and their determinant var glvBasis ecc.Lattice +// g1ScalarMulChoose and g2ScalarmulChoose indicate the bitlength of the scalar +// in scalar multiplication from which it is more efficient to use the GLV +// decomposition. It is computed from the GLV basis and considers the overhead +// for the GLV decomposition. It is heuristic and may change in the future. +var g1ScalarMulChoose, g2ScalarMulChoose int + // ψ o π o ψ^{-1}, where ψ:E → E' is the degree 6 iso defined over 𝔽p¹² var endo struct { u fptower.E2 @@ -128,6 +134,8 @@ func init() { lambdaGLV.SetString("228988810152649578064853576960394133503", 10) //(x₀²-1) _r := fr.Modulus() ecc.PrecomputeLattice(_r, &lambdaGLV, &glvBasis) + g1ScalarMulChoose = fr.Bits/16 + max(glvBasis.V1[0].BitLen(), glvBasis.V1[1].BitLen(), glvBasis.V2[0].BitLen(), glvBasis.V2[1].BitLen()) + g2ScalarMulChoose = fr.Bits/32 + max(glvBasis.V1[0].BitLen(), glvBasis.V1[1].BitLen(), glvBasis.V2[0].BitLen(), glvBasis.V2[1].BitLen()) endo.u.A0.SetString("0") endo.u.A1.SetString("4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939437") @@ -135,7 +143,7 @@ func init() { endo.v.A1.SetString("1028732146235106349975324479215795277384839936929757896155643118032610843298655225875571310552543014690878354869257") // binary decomposition of -x₀ little endian - loopCounter = [64]int8{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1} + LoopCounter = [64]int8{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1} // -x₀ xGen.SetString("15132376222941642752", 10) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/arith.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/arith.go index 6f281563b..5c9905de8 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/arith.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/arith.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -58,16 +47,3 @@ func madd3(a, b, c, d, e uint64) (hi uint64, lo uint64) { hi, _ = bits.Add64(hi, e, carry) return } -func max(a int, b int) int { - if a > b { - return a - } - return b -} - -func min(a int, b int) int { - if a < b { - return a - } - return b -} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/asm.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/asm.go deleted file mode 100644 index 0481989ec..000000000 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/asm.go +++ /dev/null @@ -1,27 +0,0 @@ -//go:build !noadx -// +build !noadx - -// Copyright 2020 ConsenSys Software 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. - -// Code generated by consensys/gnark-crypto DO NOT EDIT - -package fp - -import "golang.org/x/sys/cpu" - -var ( - supportAdx = cpu.X86.HasADX && cpu.X86.HasBMI2 - _ = supportAdx -) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/asm_noadx.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/asm_noadx.go deleted file mode 100644 index 92f8cc0f4..000000000 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/asm_noadx.go +++ /dev/null @@ -1,28 +0,0 @@ -//go:build noadx -// +build noadx - -// Copyright 2020 ConsenSys Software 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. - -// Code generated by consensys/gnark-crypto DO NOT EDIT - -package fp - -// note: this is needed for test purposes, as dynamically changing supportAdx doesn't flag -// certain errors (like fatal error: missing stackmap) -// this ensures we test all asm path. -var ( - supportAdx = false - _ = supportAdx -) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/doc.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/doc.go index bf5b82c11..5d70da537 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/doc.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/doc.go @@ -1,22 +1,13 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT // Package fp contains field arithmetic operations for modulus = 0x1a0111...ffaaab. // -// The API is similar to math/big (big.Int), but the operations are significantly faster (up to 20x for the modular multiplication on amd64, see also https://hackmd.io/@gnark/modular_multiplication) +// The API is similar to math/big (big.Int), but the operations are significantly faster (up to 20x). +// +// Additionally fp.Vector offers an API to manipulate []Element. // // The modulus is hardcoded in all the operations. // @@ -49,5 +40,7 @@ // // # Warning // -// This code has not been audited and is provided as-is. In particular, there is no security guarantees such as constant time implementation or side-channel attack resistance. +// There is no security guarantees such as constant time implementation or side-channel attack resistance. +// This code is provided as-is. Partially audited, see https://github.com/Consensys/gnark/tree/master/audits +// for more details. package fp diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element.go index f5c2df0c2..ea4390d3e 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -54,12 +43,12 @@ const ( // Field modulus q const ( - q0 uint64 = 13402431016077863595 - q1 uint64 = 2210141511517208575 - q2 uint64 = 7435674573564081700 - q3 uint64 = 7239337960414712511 - q4 uint64 = 5412103778470702295 - q5 uint64 = 1873798617647539866 + q0 = 13402431016077863595 + q1 = 2210141511517208575 + q2 = 7435674573564081700 + q3 = 7239337960414712511 + q4 = 5412103778470702295 + q5 = 1873798617647539866 ) var qElement = Element{ @@ -83,7 +72,7 @@ func Modulus() *big.Int { // q + r'.r = 1, i.e., qInvNeg = - q⁻¹ mod r // used for Montgomery reduction -const qInvNeg uint64 = 9940570264628428797 +const qInvNeg = 9940570264628428797 func init() { _modulus.SetString("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab", 16) @@ -135,7 +124,7 @@ func (z *Element) Set(x *Element) *Element { } // SetInterface converts provided interface into Element -// returns an error if provided type is not supported +// returns an error if provided type is not supported. // supported types: // // Element @@ -374,6 +363,16 @@ func (z *Element) SetRandom() (*Element, error) { } } +// MustSetRandom sets z to a uniform random value in [0, q). +// +// It panics if reading from crypto/rand.Reader errors. +func (z *Element) MustSetRandom() *Element { + if _, err := z.SetRandom(); err != nil { + panic(err) + } + return z +} + // smallerThanModulus returns true if z < q // This is not constant time func (z *Element) smallerThanModulus() bool { @@ -521,32 +520,8 @@ func (z *Element) Select(c int, x0 *Element, x1 *Element) *Element { // and is used for testing purposes. func _mulGeneric(z, x, y *Element) { - // Implements CIOS multiplication -- section 2.3.2 of Tolga Acar's thesis - // https://www.microsoft.com/en-us/research/wp-content/uploads/1998/06/97Acar.pdf - // - // The algorithm: - // - // for i=0 to N-1 - // C := 0 - // for j=0 to N-1 - // (C,t[j]) := t[j] + x[j]*y[i] + C - // (t[N+1],t[N]) := t[N] + C - // - // C := 0 - // m := t[0]*q'[0] mod D - // (C,_) := t[0] + m*q[0] - // for j=1 to N-1 - // (C,t[j-1]) := t[j] + m*q[j] + C - // - // (C,t[N-1]) := t[N] + C - // t[N] := t[N+1] + C - // - // → N is the number of machine words needed to store the modulus q - // → D is the word size. For example, on a 64-bit architecture D is 2 64 - // → x[i], y[i], q[i] is the ith word of the numbers x,y,q - // → q'[0] is the lowest word of the number -q⁻¹ mod r. This quantity is pre-computed, as it does not depend on the inputs. - // → t is a temporary array of size N+2 - // → C, S are machine words. A pair (C,S) refers to (hi-bits, lo-bits) of a two-word number + // Algorithm 2 of "Faster Montgomery Multiplication and Multi-Scalar-Multiplication for SNARKS" + // by Y. El Housni and G. Botrel https://doi.org/10.46586/tches.v2023.i3.504-521 var t [7]uint64 var D uint64 @@ -1122,7 +1097,7 @@ func (z *Element) SetBigInt(v *big.Int) *Element { // v == 0 return z } else if c != 1 && v.Cmp(&zero) != -1 { - // 0 < v < q + // 0 <= v < q return z.setBigInt(v) } @@ -1249,6 +1224,8 @@ type ByteOrder interface { String() string } +var errInvalidEncoding = errors.New("invalid fp.Element encoding") + // BigEndian is the big-endian implementation of ByteOrder and AppendByteOrder. var BigEndian bigEndian @@ -1266,7 +1243,7 @@ func (bigEndian) Element(b *[Bytes]byte) (Element, error) { z[5] = binary.BigEndian.Uint64((*b)[0:8]) if !z.smallerThanModulus() { - return Element{}, errors.New("invalid fp.Element encoding") + return Element{}, errInvalidEncoding } z.toMont() @@ -1300,7 +1277,7 @@ func (littleEndian) Element(b *[Bytes]byte) (Element, error) { z[5] = binary.LittleEndian.Uint64((*b)[40:48]) if !z.smallerThanModulus() { - return Element{}, errors.New("invalid fp.Element encoding") + return Element{}, errInvalidEncoding } z.toMont() @@ -1321,19 +1298,174 @@ func (littleEndian) String() string { return "LittleEndian" } // Legendre returns the Legendre symbol of z (either +1, -1, or 0.) func (z *Element) Legendre() int { - var l Element - // z^((q-1)/2) - l.expByLegendreExp(*z) - if l.IsZero() { - return 0 + // Adapts "Optimized Binary GCD for Modular Inversion" + // https://github.com/pornin/bingcd/blob/main/doc/bingcd.pdf + // For a faithful implementation of Pornin20 see [Inverse]. + + // We don't need to account for z being in Montgomery form. + // (xR|q) = (x|q)(R|q). R is a square (an even power of 2), so (R|q) = 1. + a := *z + b := Element{ + q0, + q1, + q2, + q3, + q4, + q5, + } // b := q + + // Update factors: we get [a; b] ← [f₀ g₀; f₁ g₁] [a; b] + // cᵢ = fᵢ + 2³¹ - 1 + 2³² * (gᵢ + 2³¹ - 1) + var c0, c1 int64 + + var s Element + + l := 1 // loop invariant: (x|q) = (a|b) . l + // This means that every time a and b are updated into a' and b', + // l is updated into l' = (x|q)(a'|b')=(x|q)(a|b)(a|b)(a'|b') = l (a|b)(a'|b') + // During the algorithm's run, there is no guarantee that b remains prime, or even positive. + // Therefore, we use the properties of the Kronecker symbol, a generalization of the Legendre symbol to all integers. + + for !a.IsZero() { + n := max(a.BitLen(), b.BitLen()) + aApprox, bApprox := approximateForLegendre(&a, n), approximateForLegendre(&b, n) + + // f₀, g₀, f₁, g₁ = 1, 0, 0, 1 + c0, c1 = updateFactorIdentityMatrixRow0, updateFactorIdentityMatrixRow1 + + const nbIterations = k - 2 + // running fewer iterations because we need access to 3 low bits from b, rather than 1 in the inversion algorithm + for range nbIterations { + + if aApprox&1 == 0 { + aApprox /= 2 + + // update the Kronecker symbol + // + // (a/2 | b) (2|b) = (a|b) + // + // b is either odd or zero, the latter case implying a non-trivial GCD and an ultimate result of 0, + // regardless of what value l holds. + // So in updating l, we may assume that b is odd. + // Since a is even, we only need to correctly compute l if b is odd. + // if b is also even, the non-trivial GCD will result in the function returning 0 anyway. + // so we may here assume b is odd. + // (2|b) = 1 if b ≡ 1 or 7 (mod 8), and -1 if b ≡ 3 or 5 (mod 8) + if bMod8 := bApprox & 7; bMod8 == 3 || bMod8 == 5 { + l = -l + } + + } else { + s, borrow := bits.Sub64(aApprox, bApprox, 0) + if borrow == 1 { + // Compute (b-a|a) + // (x-y|z) = (x|z) unless z < 0 and sign(x-y) ≠ sign(x) + // Pornin20 asserts that at least one of a and b is non-negative. + // If a is non-negative, we immediately get (b-a|a) = (b|a) + // If a is negative, b-a > b. But b is already non-negative, so the b-a and b have the same sign. + // Thus in that case also (b-a|a) = (b|a) + // Since not both a and b are negative, we get a quadratic reciprocity law + // like that of the Legendre symbol: (b|a) = (a|b), unless a, b ≡ 3 (mod 4), in which case (b|a) = -(a|b) + if bApprox&3 == 3 && aApprox&3 == 3 { + l = -l + } + + s = bApprox - aApprox + bApprox = aApprox + c0, c1 = c1, c0 + } + + aApprox = s / 2 + c0 = c0 - c1 + + // update l to reflect halving a, just like in the case where a is even + if bMod8 := bApprox & 7; bMod8 == 3 || bMod8 == 5 { + l = -l + } + } + + c1 *= 2 + } + + s = a + + var g0 int64 + // from this point on c0 aliases for f0 + c0, g0 = updateFactorsDecompose(c0) + aHi := a.linearCombNonModular(&s, c0, &b, g0) + if aHi&signBitSelector != 0 { + // if aHi < 0 + aHi = negL(&a, aHi) + // Since a is negative, b is not and hence b ≠ -1 + // So we get (-a|b)=(-1|b)(a|b) + // b is odd so we get (-1|b) = 1 if b ≡ 1 (mod 4) and -1 otherwise. + if bApprox&3 == 3 { // we still have two valid lower bits for b + l = -l + } + } + // right-shift a by k-2 bits + a[0] = (a[0] >> nbIterations) | ((a[1]) << (2*k - nbIterations)) + a[1] = (a[1] >> nbIterations) | ((a[2]) << (2*k - nbIterations)) + a[2] = (a[2] >> nbIterations) | ((a[3]) << (2*k - nbIterations)) + a[3] = (a[3] >> nbIterations) | ((a[4]) << (2*k - nbIterations)) + a[4] = (a[4] >> nbIterations) | ((a[5]) << (2*k - nbIterations)) + a[5] = (a[5] >> nbIterations) | (aHi << (2*k - nbIterations)) + + var f1 int64 + // from this point on c1 aliases for g0 + f1, c1 = updateFactorsDecompose(c1) + bHi := b.linearCombNonModular(&s, f1, &b, c1) + if bHi&signBitSelector != 0 { + // if bHi < 0 + bHi = negL(&b, bHi) + // no need to update l, since we know a ≥ 0 + // (a|-1) = 1 if a ≥ 0 + } + // right-shift b by k-2 bits + b[0] = (b[0] >> nbIterations) | ((b[1]) << (2*k - nbIterations)) + b[1] = (b[1] >> nbIterations) | ((b[2]) << (2*k - nbIterations)) + b[2] = (b[2] >> nbIterations) | ((b[3]) << (2*k - nbIterations)) + b[3] = (b[3] >> nbIterations) | ((b[4]) << (2*k - nbIterations)) + b[4] = (b[4] >> nbIterations) | ((b[5]) << (2*k - nbIterations)) + b[5] = (b[5] >> nbIterations) | (bHi << (2*k - nbIterations)) } - // if l == 1 - if l.IsOne() { - return 1 + if b[0] == 1 && (b[1]|b[2]|b[3]|b[4]|b[5]) == 0 { + return l // (0|1) = 1 + } else { + return 0 // if b ≠ 1, then (z,q) ≠ 0 ⇒ (z|q) = 0 + } +} + +// approximate a big number x into a single 64 bit word using its uppermost and lowermost bits. +// If x fits in a word as is, no approximation necessary. +// This differs from the standard approximate function in that in the Legendre symbol computation +// we need to access the 3 low bits of b, rather than just one. So lo ≥ n+2 where n is the number of inner iterations. +// The requirement on the high bits is unchanged, hi ≥ n+1. +// Thus we hit a maximum of hi = lo = k and n = k-2 as opposed to n = lo = k-1 and hi = k+1 in the standard approximate function. +// Since we are doing fewer iterations than in the inversion algorithm, all the arguments on bounds for update factors remain valid. +func approximateForLegendre(x *Element, nBits int) uint64 { + + if nBits <= 64 { + return x[0] } - return -1 + + const mask = (uint64(1) << k) - 1 // k ones + lo := mask & x[0] + + hiWordIndex := (nBits - 1) / 64 + + hiWordBitsAvailable := nBits - hiWordIndex*64 + hiWordBitsUsed := min(hiWordBitsAvailable, k) + + mask_ := uint64(^((1 << (hiWordBitsAvailable - hiWordBitsUsed)) - 1)) + hi := (x[hiWordIndex] & mask_) << (64 - hiWordBitsAvailable) + + mask_ = ^(1<<(k+hiWordBitsUsed) - 1) + mid := (mask_ & x[hiWordIndex-1]) >> hiWordBitsUsed + + return lo | mid | hi } // Sqrt z = √x (mod q) @@ -1559,7 +1691,7 @@ func approximate(x *Element, nBits int) uint64 { return x[0] } - const mask = (uint64(1) << (k - 1)) - 1 // k-1 ones + const mask = (uint64(1) << approxLowBitsN) - 1 // k-1 ones lo := mask & x[0] hiWordIndex := (nBits - 1) / 64 diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_amd64.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_amd64.go new file mode 100644 index 000000000..ff2159178 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_amd64.go @@ -0,0 +1,62 @@ +//go:build !purego + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package fp + +import ( + _ "github.com/consensys/gnark-crypto/field/asm/element_6w" + "github.com/consensys/gnark-crypto/utils/cpu" +) + +var supportAdx = cpu.SupportADX + +//go:noescape +func MulBy3(x *Element) + +//go:noescape +func MulBy5(x *Element) + +//go:noescape +func MulBy13(x *Element) + +//go:noescape +func mul(res, x, y *Element) + +//go:noescape +func fromMont(res *Element) + +//go:noescape +func reduce(res *Element) + +// Butterfly sets +// +// a = a + b (mod q) +// b = a - b (mod q) +// +//go:noescape +func Butterfly(a, b *Element) + +// Mul z = x * y (mod q) +// +// x and y must be less than q +func (z *Element) Mul(x, y *Element) *Element { + + // Algorithm 2 of "Faster Montgomery Multiplication and Multi-Scalar-Multiplication for SNARKS" + // by Y. El Housni and G. Botrel https://doi.org/10.46586/tches.v2023.i3.504-521 + + mul(z, x, y) + return z +} + +// Square z = x * x (mod q) +// +// x must be less than q +func (z *Element) Square(x *Element) *Element { + // see Mul for doc. + mul(z, x, x) + return z +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_amd64.s b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_amd64.s new file mode 100644 index 000000000..e5d5240f0 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_amd64.s @@ -0,0 +1,10 @@ +//go:build !purego + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +// We include the hash to force the Go compiler to recompile: 7475536923510290409 +#include "../../../field/asm/element_6w/element_6w_amd64.s" + diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_arm64.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_arm64.go new file mode 100644 index 000000000..6cbd040cd --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_arm64.go @@ -0,0 +1,72 @@ +//go:build !purego + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package fp + +import ( + _ "github.com/consensys/gnark-crypto/field/asm/element_6w" +) + +// Butterfly sets +// +// a = a + b (mod q) +// b = a - b (mod q) +// +//go:noescape +func Butterfly(a, b *Element) + +//go:noescape +func mul(res, x, y *Element) + +// Mul z = x * y (mod q) +// +// x and y must be less than q +func (z *Element) Mul(x, y *Element) *Element { + mul(z, x, y) + return z +} + +// Square z = x * x (mod q) +// +// x must be less than q +func (z *Element) Square(x *Element) *Element { + // see Mul for doc. + mul(z, x, x) + return z +} + +// MulBy3 x *= 3 (mod q) +func MulBy3(x *Element) { + _x := *x + x.Double(x).Add(x, &_x) +} + +// MulBy5 x *= 5 (mod q) +func MulBy5(x *Element) { + _x := *x + x.Double(x).Double(x).Add(x, &_x) +} + +// MulBy13 x *= 13 (mod q) +func MulBy13(x *Element) { + var y = Element{ + 13438459813099623723, + 14459933216667336738, + 14900020990258308116, + 2941282712809091851, + 13639094935183769893, + 1835248516986607988, + } + x.Mul(x, &y) +} + +func fromMont(z *Element) { + _fromMontGeneric(z) +} + +//go:noescape +func reduce(res *Element) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_arm64.s b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_arm64.s new file mode 100644 index 000000000..2defbe4c2 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_arm64.s @@ -0,0 +1,10 @@ +//go:build !purego + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +// We include the hash to force the Go compiler to recompile: 15397482240260640864 +#include "../../../field/asm/element_6w/element_6w_arm64.s" + diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_exp.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_exp.go index 4d7fafa0a..b5c8ae8c1 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_exp.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_exp.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -559,542 +548,3 @@ func (z *Element) expBySqrtExp(x Element) *Element { return z } - -// expByLegendreExp is equivalent to z.Exp(x, d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7fffffffd555) -// -// uses github.com/mmcloughlin/addchain v0.4.0 to generate a shorter addition chain -func (z *Element) expByLegendreExp(x Element) *Element { - // addition chain: - // - // _10 = 2*1 - // _100 = 2*_10 - // _1000 = 2*_100 - // _1001 = 1 + _1000 - // _1011 = _10 + _1001 - // _1101 = _10 + _1011 - // _10001 = _100 + _1101 - // _10100 = _1001 + _1011 - // _11001 = _1000 + _10001 - // _11010 = 1 + _11001 - // _110100 = 2*_11010 - // _110110 = _10 + _110100 - // _110111 = 1 + _110110 - // _1001101 = _11001 + _110100 - // _1001111 = _10 + _1001101 - // _1010101 = _1000 + _1001101 - // _1011101 = _1000 + _1010101 - // _1100111 = _11010 + _1001101 - // _1101001 = _10 + _1100111 - // _1110111 = _11010 + _1011101 - // _1111011 = _100 + _1110111 - // _10001001 = _110100 + _1010101 - // _10010101 = _11010 + _1111011 - // _10010111 = _10 + _10010101 - // _10101001 = _10100 + _10010101 - // _10110001 = _1000 + _10101001 - // _10111111 = _110110 + _10001001 - // _11000011 = _100 + _10111111 - // _11010000 = _1101 + _11000011 - // _11010111 = _10100 + _11000011 - // _11100001 = _10001 + _11010000 - // _11100101 = _100 + _11100001 - // _11101011 = _10100 + _11010111 - // _11110101 = _10100 + _11100001 - // _11111111 = _10100 + _11101011 - // i57 = ((_10111111 + _11100001) << 8 + _10001) << 11 + _11110101 - // i85 = ((i57 << 11 + _11100101) << 8 + _11111111) << 7 - // i107 = ((_1001101 + i85) << 9 + _1101001) << 10 + _10110001 - // i131 = ((i107 << 7 + _1011101) << 9 + _1111011) << 6 - // i154 = ((_11001 + i131) << 11 + _1101001) << 9 + _11101011 - // i182 = ((i154 << 10 + _11010111) << 6 + _11001) << 10 - // i205 = ((_1110111 + i182) << 9 + _10010111) << 11 + _1001111 - // i235 = ((i205 << 10 + _11100001) << 9 + _10001001) << 9 - // i256 = ((_10111111 + i235) << 8 + _1100111) << 10 + _11000011 - // i284 = ((i256 << 9 + _10010101) << 12 + _1111011) << 5 - // i305 = ((_1011 + i284) << 11 + _1111011) << 7 + _1001 - // i337 = ((i305 << 13 + _11110101) << 9 + _10111111) << 8 - // i359 = ((_11111111 + i337) << 8 + _11101011) << 11 + _10101001 - // i383 = ((i359 << 8 + _11111111) << 8 + _11111111) << 6 - // i405 = ((_110111 + i383) << 10 + _11111111) << 9 + _11111111 - // i431 = ((i405 << 8 + _11111111) << 8 + _11111111) << 8 - // return ((_11111111 + i431) << 7 + _1010101) << 8 + _1010101 - // - // Operations: 375 squares 74 multiplies - - // Allocate Temporaries. - var ( - t0 = new(Element) - t1 = new(Element) - t2 = new(Element) - t3 = new(Element) - t4 = new(Element) - t5 = new(Element) - t6 = new(Element) - t7 = new(Element) - t8 = new(Element) - t9 = new(Element) - t10 = new(Element) - t11 = new(Element) - t12 = new(Element) - t13 = new(Element) - t14 = new(Element) - t15 = new(Element) - t16 = new(Element) - t17 = new(Element) - t18 = new(Element) - t19 = new(Element) - t20 = new(Element) - t21 = new(Element) - t22 = new(Element) - t23 = new(Element) - t24 = new(Element) - t25 = new(Element) - ) - - // var t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25 Element - // Step 1: t2 = x^0x2 - t2.Square(&x) - - // Step 2: t3 = x^0x4 - t3.Square(t2) - - // Step 3: t10 = x^0x8 - t10.Square(t3) - - // Step 4: t6 = x^0x9 - t6.Mul(&x, t10) - - // Step 5: t8 = x^0xb - t8.Mul(t2, t6) - - // Step 6: t5 = x^0xd - t5.Mul(t2, t8) - - // Step 7: t24 = x^0x11 - t24.Mul(t3, t5) - - // Step 8: t0 = x^0x14 - t0.Mul(t6, t8) - - // Step 9: t17 = x^0x19 - t17.Mul(t10, t24) - - // Step 10: t9 = x^0x1a - t9.Mul(&x, t17) - - // Step 11: t12 = x^0x34 - t12.Square(t9) - - // Step 12: t4 = x^0x36 - t4.Mul(t2, t12) - - // Step 13: t1 = x^0x37 - t1.Mul(&x, t4) - - // Step 14: t22 = x^0x4d - t22.Mul(t17, t12) - - // Step 15: t14 = x^0x4f - t14.Mul(t2, t22) - - // Step 16: z = x^0x55 - z.Mul(t10, t22) - - // Step 17: t20 = x^0x5d - t20.Mul(t10, z) - - // Step 18: t11 = x^0x67 - t11.Mul(t9, t22) - - // Step 19: t19 = x^0x69 - t19.Mul(t2, t11) - - // Step 20: t16 = x^0x77 - t16.Mul(t9, t20) - - // Step 21: t7 = x^0x7b - t7.Mul(t3, t16) - - // Step 22: t12 = x^0x89 - t12.Mul(t12, z) - - // Step 23: t9 = x^0x95 - t9.Mul(t9, t7) - - // Step 24: t15 = x^0x97 - t15.Mul(t2, t9) - - // Step 25: t2 = x^0xa9 - t2.Mul(t0, t9) - - // Step 26: t21 = x^0xb1 - t21.Mul(t10, t2) - - // Step 27: t4 = x^0xbf - t4.Mul(t4, t12) - - // Step 28: t10 = x^0xc3 - t10.Mul(t3, t4) - - // Step 29: t5 = x^0xd0 - t5.Mul(t5, t10) - - // Step 30: t18 = x^0xd7 - t18.Mul(t0, t10) - - // Step 31: t13 = x^0xe1 - t13.Mul(t24, t5) - - // Step 32: t23 = x^0xe5 - t23.Mul(t3, t13) - - // Step 33: t3 = x^0xeb - t3.Mul(t0, t18) - - // Step 34: t5 = x^0xf5 - t5.Mul(t0, t13) - - // Step 35: t0 = x^0xff - t0.Mul(t0, t3) - - // Step 36: t25 = x^0x1a0 - t25.Mul(t4, t13) - - // Step 44: t25 = x^0x1a000 - for s := 0; s < 8; s++ { - t25.Square(t25) - } - - // Step 45: t24 = x^0x1a011 - t24.Mul(t24, t25) - - // Step 56: t24 = x^0xd008800 - for s := 0; s < 11; s++ { - t24.Square(t24) - } - - // Step 57: t24 = x^0xd0088f5 - t24.Mul(t5, t24) - - // Step 68: t24 = x^0x680447a800 - for s := 0; s < 11; s++ { - t24.Square(t24) - } - - // Step 69: t23 = x^0x680447a8e5 - t23.Mul(t23, t24) - - // Step 77: t23 = x^0x680447a8e500 - for s := 0; s < 8; s++ { - t23.Square(t23) - } - - // Step 78: t23 = x^0x680447a8e5ff - t23.Mul(t0, t23) - - // Step 85: t23 = x^0x340223d472ff80 - for s := 0; s < 7; s++ { - t23.Square(t23) - } - - // Step 86: t22 = x^0x340223d472ffcd - t22.Mul(t22, t23) - - // Step 95: t22 = x^0x680447a8e5ff9a00 - for s := 0; s < 9; s++ { - t22.Square(t22) - } - - // Step 96: t22 = x^0x680447a8e5ff9a69 - t22.Mul(t19, t22) - - // Step 106: t22 = x^0x1a0111ea397fe69a400 - for s := 0; s < 10; s++ { - t22.Square(t22) - } - - // Step 107: t21 = x^0x1a0111ea397fe69a4b1 - t21.Mul(t21, t22) - - // Step 114: t21 = x^0xd0088f51cbff34d25880 - for s := 0; s < 7; s++ { - t21.Square(t21) - } - - // Step 115: t20 = x^0xd0088f51cbff34d258dd - t20.Mul(t20, t21) - - // Step 124: t20 = x^0x1a0111ea397fe69a4b1ba00 - for s := 0; s < 9; s++ { - t20.Square(t20) - } - - // Step 125: t20 = x^0x1a0111ea397fe69a4b1ba7b - t20.Mul(t7, t20) - - // Step 131: t20 = x^0x680447a8e5ff9a692c6e9ec0 - for s := 0; s < 6; s++ { - t20.Square(t20) - } - - // Step 132: t20 = x^0x680447a8e5ff9a692c6e9ed9 - t20.Mul(t17, t20) - - // Step 143: t20 = x^0x340223d472ffcd3496374f6c800 - for s := 0; s < 11; s++ { - t20.Square(t20) - } - - // Step 144: t19 = x^0x340223d472ffcd3496374f6c869 - t19.Mul(t19, t20) - - // Step 153: t19 = x^0x680447a8e5ff9a692c6e9ed90d200 - for s := 0; s < 9; s++ { - t19.Square(t19) - } - - // Step 154: t19 = x^0x680447a8e5ff9a692c6e9ed90d2eb - t19.Mul(t3, t19) - - // Step 164: t19 = x^0x1a0111ea397fe69a4b1ba7b6434bac00 - for s := 0; s < 10; s++ { - t19.Square(t19) - } - - // Step 165: t18 = x^0x1a0111ea397fe69a4b1ba7b6434bacd7 - t18.Mul(t18, t19) - - // Step 171: t18 = x^0x680447a8e5ff9a692c6e9ed90d2eb35c0 - for s := 0; s < 6; s++ { - t18.Square(t18) - } - - // Step 172: t17 = x^0x680447a8e5ff9a692c6e9ed90d2eb35d9 - t17.Mul(t17, t18) - - // Step 182: t17 = x^0x1a0111ea397fe69a4b1ba7b6434bacd76400 - for s := 0; s < 10; s++ { - t17.Square(t17) - } - - // Step 183: t16 = x^0x1a0111ea397fe69a4b1ba7b6434bacd76477 - t16.Mul(t16, t17) - - // Step 192: t16 = x^0x340223d472ffcd3496374f6c869759aec8ee00 - for s := 0; s < 9; s++ { - t16.Square(t16) - } - - // Step 193: t15 = x^0x340223d472ffcd3496374f6c869759aec8ee97 - t15.Mul(t15, t16) - - // Step 204: t15 = x^0x1a0111ea397fe69a4b1ba7b6434bacd764774b800 - for s := 0; s < 11; s++ { - t15.Square(t15) - } - - // Step 205: t14 = x^0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f - t14.Mul(t14, t15) - - // Step 215: t14 = x^0x680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13c00 - for s := 0; s < 10; s++ { - t14.Square(t14) - } - - // Step 216: t13 = x^0x680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce1 - t13.Mul(t13, t14) - - // Step 225: t13 = x^0xd0088f51cbff34d258dd3db21a5d66bb23ba5c279c200 - for s := 0; s < 9; s++ { - t13.Square(t13) - } - - // Step 226: t12 = x^0xd0088f51cbff34d258dd3db21a5d66bb23ba5c279c289 - t12.Mul(t12, t13) - - // Step 235: t12 = x^0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f3851200 - for s := 0; s < 9; s++ { - t12.Square(t12) - } - - // Step 236: t12 = x^0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf - t12.Mul(t4, t12) - - // Step 244: t12 = x^0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf00 - for s := 0; s < 8; s++ { - t12.Square(t12) - } - - // Step 245: t11 = x^0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf67 - t11.Mul(t11, t12) - - // Step 255: t11 = x^0x680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9c00 - for s := 0; s < 10; s++ { - t11.Square(t11) - } - - // Step 256: t10 = x^0x680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc3 - t10.Mul(t10, t11) - - // Step 265: t10 = x^0xd0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb398600 - for s := 0; s < 9; s++ { - t10.Square(t10) - } - - // Step 266: t9 = x^0xd0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb398695 - t9.Mul(t9, t10) - - // Step 278: t9 = x^0xd0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb398695000 - for s := 0; s < 12; s++ { - t9.Square(t9) - } - - // Step 279: t9 = x^0xd0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b - t9.Mul(t7, t9) - - // Step 284: t9 = x^0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f60 - for s := 0; s < 5; s++ { - t9.Square(t9) - } - - // Step 285: t8 = x^0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b - t8.Mul(t8, t9) - - // Step 296: t8 = x^0xd0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b5800 - for s := 0; s < 11; s++ { - t8.Square(t8) - } - - // Step 297: t7 = x^0xd0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b - t7.Mul(t7, t8) - - // Step 304: t7 = x^0x680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d80 - for s := 0; s < 7; s++ { - t7.Square(t7) - } - - // Step 305: t6 = x^0x680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d89 - t6.Mul(t6, t7) - - // Step 318: t6 = x^0xd0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b12000 - for s := 0; s < 13; s++ { - t6.Square(t6) - } - - // Step 319: t5 = x^0xd0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f5 - t5.Mul(t5, t6) - - // Step 328: t5 = x^0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241ea00 - for s := 0; s < 9; s++ { - t5.Square(t5) - } - - // Step 329: t4 = x^0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabf - t4.Mul(t4, t5) - - // Step 337: t4 = x^0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabf00 - for s := 0; s < 8; s++ { - t4.Square(t4) - } - - // Step 338: t4 = x^0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfff - t4.Mul(t0, t4) - - // Step 346: t4 = x^0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfff00 - for s := 0; s < 8; s++ { - t4.Square(t4) - } - - // Step 347: t3 = x^0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb - t3.Mul(t3, t4) - - // Step 358: t3 = x^0xd0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff5800 - for s := 0; s < 11; s++ { - t3.Square(t3) - } - - // Step 359: t2 = x^0xd0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9 - t2.Mul(t2, t3) - - // Step 367: t2 = x^0xd0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a900 - for s := 0; s < 8; s++ { - t2.Square(t2) - } - - // Step 368: t2 = x^0xd0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ff - t2.Mul(t0, t2) - - // Step 376: t2 = x^0xd0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ff00 - for s := 0; s < 8; s++ { - t2.Square(t2) - } - - // Step 377: t2 = x^0xd0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffff - t2.Mul(t0, t2) - - // Step 383: t2 = x^0x340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7fffc0 - for s := 0; s < 6; s++ { - t2.Square(t2) - } - - // Step 384: t1 = x^0x340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff7 - t1.Mul(t1, t2) - - // Step 394: t1 = x^0xd0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdc00 - for s := 0; s < 10; s++ { - t1.Square(t1) - } - - // Step 395: t1 = x^0xd0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff - t1.Mul(t0, t1) - - // Step 404: t1 = x^0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9fe00 - for s := 0; s < 9; s++ { - t1.Square(t1) - } - - // Step 405: t1 = x^0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feff - t1.Mul(t0, t1) - - // Step 413: t1 = x^0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feff00 - for s := 0; s < 8; s++ { - t1.Square(t1) - } - - // Step 414: t1 = x^0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffff - t1.Mul(t0, t1) - - // Step 422: t1 = x^0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffff00 - for s := 0; s < 8; s++ { - t1.Square(t1) - } - - // Step 423: t1 = x^0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffff - t1.Mul(t0, t1) - - // Step 431: t1 = x^0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffff00 - for s := 0; s < 8; s++ { - t1.Square(t1) - } - - // Step 432: t0 = x^0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffff - t0.Mul(t0, t1) - - // Step 439: t0 = x^0xd0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7fffffff80 - for s := 0; s < 7; s++ { - t0.Square(t0) - } - - // Step 440: t0 = x^0xd0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7fffffffd5 - t0.Mul(z, t0) - - // Step 448: t0 = x^0xd0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7fffffffd500 - for s := 0; s < 8; s++ { - t0.Square(t0) - } - - // Step 449: z = x^0xd0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7fffffffd555 - z.Mul(z, t0) - - return z -} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_mul_amd64.s b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_mul_amd64.s deleted file mode 100644 index 9e03b1c0a..000000000 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_mul_amd64.s +++ /dev/null @@ -1,857 +0,0 @@ -// +build !purego - -// Copyright 2020 ConsenSys Software 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. - -#include "textflag.h" -#include "funcdata.h" - -// modulus q -DATA q<>+0(SB)/8, $0xb9feffffffffaaab -DATA q<>+8(SB)/8, $0x1eabfffeb153ffff -DATA q<>+16(SB)/8, $0x6730d2a0f6b0f624 -DATA q<>+24(SB)/8, $0x64774b84f38512bf -DATA q<>+32(SB)/8, $0x4b1ba7b6434bacd7 -DATA q<>+40(SB)/8, $0x1a0111ea397fe69a -GLOBL q<>(SB), (RODATA+NOPTR), $48 - -// qInv0 q'[0] -DATA qInv0<>(SB)/8, $0x89f3fffcfffcfffd -GLOBL qInv0<>(SB), (RODATA+NOPTR), $8 - -#define REDUCE(ra0, ra1, ra2, ra3, ra4, ra5, rb0, rb1, rb2, rb3, rb4, rb5) \ - MOVQ ra0, rb0; \ - SUBQ q<>(SB), ra0; \ - MOVQ ra1, rb1; \ - SBBQ q<>+8(SB), ra1; \ - MOVQ ra2, rb2; \ - SBBQ q<>+16(SB), ra2; \ - MOVQ ra3, rb3; \ - SBBQ q<>+24(SB), ra3; \ - MOVQ ra4, rb4; \ - SBBQ q<>+32(SB), ra4; \ - MOVQ ra5, rb5; \ - SBBQ q<>+40(SB), ra5; \ - CMOVQCS rb0, ra0; \ - CMOVQCS rb1, ra1; \ - CMOVQCS rb2, ra2; \ - CMOVQCS rb3, ra3; \ - CMOVQCS rb4, ra4; \ - CMOVQCS rb5, ra5; \ - -// mul(res, x, y *Element) -TEXT ·mul(SB), $24-24 - - // the algorithm is described in the Element.Mul declaration (.go) - // however, to benefit from the ADCX and ADOX carry chains - // we split the inner loops in 2: - // for i=0 to N-1 - // for j=0 to N-1 - // (A,t[j]) := t[j] + x[j]*y[i] + A - // m := t[0]*q'[0] mod W - // C,_ := t[0] + m*q[0] - // for j=1 to N-1 - // (C,t[j-1]) := t[j] + m*q[j] + C - // t[N-1] = C + A - - NO_LOCAL_POINTERS - CMPB ·supportAdx(SB), $1 - JNE l1 - MOVQ x+8(FP), R8 - - // x[0] -> R10 - // x[1] -> R11 - // x[2] -> R12 - MOVQ 0(R8), R10 - MOVQ 8(R8), R11 - MOVQ 16(R8), R12 - MOVQ y+16(FP), R13 - - // A -> BP - // t[0] -> R14 - // t[1] -> R15 - // t[2] -> CX - // t[3] -> BX - // t[4] -> SI - // t[5] -> DI - // clear the flags - XORQ AX, AX - MOVQ 0(R13), DX - - // (A,t[0]) := x[0]*y[0] + A - MULXQ R10, R14, R15 - - // (A,t[1]) := x[1]*y[0] + A - MULXQ R11, AX, CX - ADOXQ AX, R15 - - // (A,t[2]) := x[2]*y[0] + A - MULXQ R12, AX, BX - ADOXQ AX, CX - - // (A,t[3]) := x[3]*y[0] + A - MULXQ 24(R8), AX, SI - ADOXQ AX, BX - - // (A,t[4]) := x[4]*y[0] + A - MULXQ 32(R8), AX, DI - ADOXQ AX, SI - - // (A,t[5]) := x[5]*y[0] + A - MULXQ 40(R8), AX, BP - ADOXQ AX, DI - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADOXQ AX, BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, R9 - ADCXQ R14, AX - MOVQ R9, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R15, R14 - MULXQ q<>+8(SB), AX, R15 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R15 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R15 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ SI, BX - MULXQ q<>+32(SB), AX, SI - ADOXQ AX, BX - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ DI, SI - MULXQ q<>+40(SB), AX, DI - ADOXQ AX, SI - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, DI - ADOXQ BP, DI - - // clear the flags - XORQ AX, AX - MOVQ 8(R13), DX - - // (A,t[0]) := t[0] + x[0]*y[1] + A - MULXQ R10, AX, BP - ADOXQ AX, R14 - - // (A,t[1]) := t[1] + x[1]*y[1] + A - ADCXQ BP, R15 - MULXQ R11, AX, BP - ADOXQ AX, R15 - - // (A,t[2]) := t[2] + x[2]*y[1] + A - ADCXQ BP, CX - MULXQ R12, AX, BP - ADOXQ AX, CX - - // (A,t[3]) := t[3] + x[3]*y[1] + A - ADCXQ BP, BX - MULXQ 24(R8), AX, BP - ADOXQ AX, BX - - // (A,t[4]) := t[4] + x[4]*y[1] + A - ADCXQ BP, SI - MULXQ 32(R8), AX, BP - ADOXQ AX, SI - - // (A,t[5]) := t[5] + x[5]*y[1] + A - ADCXQ BP, DI - MULXQ 40(R8), AX, BP - ADOXQ AX, DI - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, R9 - ADCXQ R14, AX - MOVQ R9, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R15, R14 - MULXQ q<>+8(SB), AX, R15 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R15 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R15 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ SI, BX - MULXQ q<>+32(SB), AX, SI - ADOXQ AX, BX - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ DI, SI - MULXQ q<>+40(SB), AX, DI - ADOXQ AX, SI - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, DI - ADOXQ BP, DI - - // clear the flags - XORQ AX, AX - MOVQ 16(R13), DX - - // (A,t[0]) := t[0] + x[0]*y[2] + A - MULXQ R10, AX, BP - ADOXQ AX, R14 - - // (A,t[1]) := t[1] + x[1]*y[2] + A - ADCXQ BP, R15 - MULXQ R11, AX, BP - ADOXQ AX, R15 - - // (A,t[2]) := t[2] + x[2]*y[2] + A - ADCXQ BP, CX - MULXQ R12, AX, BP - ADOXQ AX, CX - - // (A,t[3]) := t[3] + x[3]*y[2] + A - ADCXQ BP, BX - MULXQ 24(R8), AX, BP - ADOXQ AX, BX - - // (A,t[4]) := t[4] + x[4]*y[2] + A - ADCXQ BP, SI - MULXQ 32(R8), AX, BP - ADOXQ AX, SI - - // (A,t[5]) := t[5] + x[5]*y[2] + A - ADCXQ BP, DI - MULXQ 40(R8), AX, BP - ADOXQ AX, DI - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, R9 - ADCXQ R14, AX - MOVQ R9, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R15, R14 - MULXQ q<>+8(SB), AX, R15 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R15 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R15 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ SI, BX - MULXQ q<>+32(SB), AX, SI - ADOXQ AX, BX - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ DI, SI - MULXQ q<>+40(SB), AX, DI - ADOXQ AX, SI - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, DI - ADOXQ BP, DI - - // clear the flags - XORQ AX, AX - MOVQ 24(R13), DX - - // (A,t[0]) := t[0] + x[0]*y[3] + A - MULXQ R10, AX, BP - ADOXQ AX, R14 - - // (A,t[1]) := t[1] + x[1]*y[3] + A - ADCXQ BP, R15 - MULXQ R11, AX, BP - ADOXQ AX, R15 - - // (A,t[2]) := t[2] + x[2]*y[3] + A - ADCXQ BP, CX - MULXQ R12, AX, BP - ADOXQ AX, CX - - // (A,t[3]) := t[3] + x[3]*y[3] + A - ADCXQ BP, BX - MULXQ 24(R8), AX, BP - ADOXQ AX, BX - - // (A,t[4]) := t[4] + x[4]*y[3] + A - ADCXQ BP, SI - MULXQ 32(R8), AX, BP - ADOXQ AX, SI - - // (A,t[5]) := t[5] + x[5]*y[3] + A - ADCXQ BP, DI - MULXQ 40(R8), AX, BP - ADOXQ AX, DI - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, R9 - ADCXQ R14, AX - MOVQ R9, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R15, R14 - MULXQ q<>+8(SB), AX, R15 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R15 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R15 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ SI, BX - MULXQ q<>+32(SB), AX, SI - ADOXQ AX, BX - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ DI, SI - MULXQ q<>+40(SB), AX, DI - ADOXQ AX, SI - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, DI - ADOXQ BP, DI - - // clear the flags - XORQ AX, AX - MOVQ 32(R13), DX - - // (A,t[0]) := t[0] + x[0]*y[4] + A - MULXQ R10, AX, BP - ADOXQ AX, R14 - - // (A,t[1]) := t[1] + x[1]*y[4] + A - ADCXQ BP, R15 - MULXQ R11, AX, BP - ADOXQ AX, R15 - - // (A,t[2]) := t[2] + x[2]*y[4] + A - ADCXQ BP, CX - MULXQ R12, AX, BP - ADOXQ AX, CX - - // (A,t[3]) := t[3] + x[3]*y[4] + A - ADCXQ BP, BX - MULXQ 24(R8), AX, BP - ADOXQ AX, BX - - // (A,t[4]) := t[4] + x[4]*y[4] + A - ADCXQ BP, SI - MULXQ 32(R8), AX, BP - ADOXQ AX, SI - - // (A,t[5]) := t[5] + x[5]*y[4] + A - ADCXQ BP, DI - MULXQ 40(R8), AX, BP - ADOXQ AX, DI - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, R9 - ADCXQ R14, AX - MOVQ R9, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R15, R14 - MULXQ q<>+8(SB), AX, R15 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R15 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R15 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ SI, BX - MULXQ q<>+32(SB), AX, SI - ADOXQ AX, BX - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ DI, SI - MULXQ q<>+40(SB), AX, DI - ADOXQ AX, SI - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, DI - ADOXQ BP, DI - - // clear the flags - XORQ AX, AX - MOVQ 40(R13), DX - - // (A,t[0]) := t[0] + x[0]*y[5] + A - MULXQ R10, AX, BP - ADOXQ AX, R14 - - // (A,t[1]) := t[1] + x[1]*y[5] + A - ADCXQ BP, R15 - MULXQ R11, AX, BP - ADOXQ AX, R15 - - // (A,t[2]) := t[2] + x[2]*y[5] + A - ADCXQ BP, CX - MULXQ R12, AX, BP - ADOXQ AX, CX - - // (A,t[3]) := t[3] + x[3]*y[5] + A - ADCXQ BP, BX - MULXQ 24(R8), AX, BP - ADOXQ AX, BX - - // (A,t[4]) := t[4] + x[4]*y[5] + A - ADCXQ BP, SI - MULXQ 32(R8), AX, BP - ADOXQ AX, SI - - // (A,t[5]) := t[5] + x[5]*y[5] + A - ADCXQ BP, DI - MULXQ 40(R8), AX, BP - ADOXQ AX, DI - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, R9 - ADCXQ R14, AX - MOVQ R9, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R15, R14 - MULXQ q<>+8(SB), AX, R15 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R15 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R15 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ SI, BX - MULXQ q<>+32(SB), AX, SI - ADOXQ AX, BX - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ DI, SI - MULXQ q<>+40(SB), AX, DI - ADOXQ AX, SI - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, DI - ADOXQ BP, DI - - // reduce element(R14,R15,CX,BX,SI,DI) using temp registers (R9,R8,R13,R10,R11,R12) - REDUCE(R14,R15,CX,BX,SI,DI,R9,R8,R13,R10,R11,R12) - - MOVQ res+0(FP), AX - MOVQ R14, 0(AX) - MOVQ R15, 8(AX) - MOVQ CX, 16(AX) - MOVQ BX, 24(AX) - MOVQ SI, 32(AX) - MOVQ DI, 40(AX) - RET - -l1: - MOVQ res+0(FP), AX - MOVQ AX, (SP) - MOVQ x+8(FP), AX - MOVQ AX, 8(SP) - MOVQ y+16(FP), AX - MOVQ AX, 16(SP) - CALL ·_mulGeneric(SB) - RET - -TEXT ·fromMont(SB), $8-8 - NO_LOCAL_POINTERS - - // the algorithm is described here - // https://hackmd.io/@gnark/modular_multiplication - // when y = 1 we have: - // for i=0 to N-1 - // t[i] = x[i] - // for i=0 to N-1 - // m := t[0]*q'[0] mod W - // C,_ := t[0] + m*q[0] - // for j=1 to N-1 - // (C,t[j-1]) := t[j] + m*q[j] + C - // t[N-1] = C - CMPB ·supportAdx(SB), $1 - JNE l2 - MOVQ res+0(FP), DX - MOVQ 0(DX), R14 - MOVQ 8(DX), R15 - MOVQ 16(DX), CX - MOVQ 24(DX), BX - MOVQ 32(DX), SI - MOVQ 40(DX), DI - XORQ DX, DX - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R14, AX - MOVQ BP, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R15, R14 - MULXQ q<>+8(SB), AX, R15 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R15 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R15 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ SI, BX - MULXQ q<>+32(SB), AX, SI - ADOXQ AX, BX - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ DI, SI - MULXQ q<>+40(SB), AX, DI - ADOXQ AX, SI - MOVQ $0, AX - ADCXQ AX, DI - ADOXQ AX, DI - XORQ DX, DX - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R14, AX - MOVQ BP, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R15, R14 - MULXQ q<>+8(SB), AX, R15 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R15 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R15 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ SI, BX - MULXQ q<>+32(SB), AX, SI - ADOXQ AX, BX - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ DI, SI - MULXQ q<>+40(SB), AX, DI - ADOXQ AX, SI - MOVQ $0, AX - ADCXQ AX, DI - ADOXQ AX, DI - XORQ DX, DX - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R14, AX - MOVQ BP, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R15, R14 - MULXQ q<>+8(SB), AX, R15 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R15 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R15 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ SI, BX - MULXQ q<>+32(SB), AX, SI - ADOXQ AX, BX - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ DI, SI - MULXQ q<>+40(SB), AX, DI - ADOXQ AX, SI - MOVQ $0, AX - ADCXQ AX, DI - ADOXQ AX, DI - XORQ DX, DX - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R14, AX - MOVQ BP, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R15, R14 - MULXQ q<>+8(SB), AX, R15 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R15 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R15 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ SI, BX - MULXQ q<>+32(SB), AX, SI - ADOXQ AX, BX - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ DI, SI - MULXQ q<>+40(SB), AX, DI - ADOXQ AX, SI - MOVQ $0, AX - ADCXQ AX, DI - ADOXQ AX, DI - XORQ DX, DX - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R14, AX - MOVQ BP, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R15, R14 - MULXQ q<>+8(SB), AX, R15 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R15 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R15 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ SI, BX - MULXQ q<>+32(SB), AX, SI - ADOXQ AX, BX - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ DI, SI - MULXQ q<>+40(SB), AX, DI - ADOXQ AX, SI - MOVQ $0, AX - ADCXQ AX, DI - ADOXQ AX, DI - XORQ DX, DX - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R14, AX - MOVQ BP, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R15, R14 - MULXQ q<>+8(SB), AX, R15 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R15 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R15 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ SI, BX - MULXQ q<>+32(SB), AX, SI - ADOXQ AX, BX - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ DI, SI - MULXQ q<>+40(SB), AX, DI - ADOXQ AX, SI - MOVQ $0, AX - ADCXQ AX, DI - ADOXQ AX, DI - - // reduce element(R14,R15,CX,BX,SI,DI) using temp registers (R8,R9,R10,R11,R12,R13) - REDUCE(R14,R15,CX,BX,SI,DI,R8,R9,R10,R11,R12,R13) - - MOVQ res+0(FP), AX - MOVQ R14, 0(AX) - MOVQ R15, 8(AX) - MOVQ CX, 16(AX) - MOVQ BX, 24(AX) - MOVQ SI, 32(AX) - MOVQ DI, 40(AX) - RET - -l2: - MOVQ res+0(FP), AX - MOVQ AX, (SP) - CALL ·_fromMontGeneric(SB) - RET diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_ops_amd64.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_ops_amd64.go deleted file mode 100644 index 83bba45ae..000000000 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_ops_amd64.go +++ /dev/null @@ -1,107 +0,0 @@ -//go:build !purego -// +build !purego - -// Copyright 2020 ConsenSys Software 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. - -// Code generated by consensys/gnark-crypto DO NOT EDIT - -package fp - -//go:noescape -func MulBy3(x *Element) - -//go:noescape -func MulBy5(x *Element) - -//go:noescape -func MulBy13(x *Element) - -//go:noescape -func mul(res, x, y *Element) - -//go:noescape -func fromMont(res *Element) - -//go:noescape -func reduce(res *Element) - -// Butterfly sets -// -// a = a + b (mod q) -// b = a - b (mod q) -// -//go:noescape -func Butterfly(a, b *Element) - -// Mul z = x * y (mod q) -// -// x and y must be less than q -func (z *Element) Mul(x, y *Element) *Element { - - // Implements CIOS multiplication -- section 2.3.2 of Tolga Acar's thesis - // https://www.microsoft.com/en-us/research/wp-content/uploads/1998/06/97Acar.pdf - // - // The algorithm: - // - // for i=0 to N-1 - // C := 0 - // for j=0 to N-1 - // (C,t[j]) := t[j] + x[j]*y[i] + C - // (t[N+1],t[N]) := t[N] + C - // - // C := 0 - // m := t[0]*q'[0] mod D - // (C,_) := t[0] + m*q[0] - // for j=1 to N-1 - // (C,t[j-1]) := t[j] + m*q[j] + C - // - // (C,t[N-1]) := t[N] + C - // t[N] := t[N+1] + C - // - // → N is the number of machine words needed to store the modulus q - // → D is the word size. For example, on a 64-bit architecture D is 2 64 - // → x[i], y[i], q[i] is the ith word of the numbers x,y,q - // → q'[0] is the lowest word of the number -q⁻¹ mod r. This quantity is pre-computed, as it does not depend on the inputs. - // → t is a temporary array of size N+2 - // → C, S are machine words. A pair (C,S) refers to (hi-bits, lo-bits) of a two-word number - // - // As described here https://hackmd.io/@gnark/modular_multiplication we can get rid of one carry chain and simplify: - // (also described in https://eprint.iacr.org/2022/1400.pdf annex) - // - // for i=0 to N-1 - // (A,t[0]) := t[0] + x[0]*y[i] - // m := t[0]*q'[0] mod W - // C,_ := t[0] + m*q[0] - // for j=1 to N-1 - // (A,t[j]) := t[j] + x[j]*y[i] + A - // (C,t[j-1]) := t[j] + m*q[j] + C - // - // t[N-1] = C + A - // - // This optimization saves 5N + 2 additions in the algorithm, and can be used whenever the highest bit - // of the modulus is zero (and not all of the remaining bits are set). - - mul(z, x, y) - return z -} - -// Square z = x * x (mod q) -// -// x must be less than q -func (z *Element) Square(x *Element) *Element { - // see Mul for doc. - mul(z, x, x) - return z -} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_ops_amd64.s b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_ops_amd64.s deleted file mode 100644 index 830b2dd63..000000000 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_ops_amd64.s +++ /dev/null @@ -1,306 +0,0 @@ -// +build !purego - -// Copyright 2020 ConsenSys Software 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. - -#include "textflag.h" -#include "funcdata.h" - -// modulus q -DATA q<>+0(SB)/8, $0xb9feffffffffaaab -DATA q<>+8(SB)/8, $0x1eabfffeb153ffff -DATA q<>+16(SB)/8, $0x6730d2a0f6b0f624 -DATA q<>+24(SB)/8, $0x64774b84f38512bf -DATA q<>+32(SB)/8, $0x4b1ba7b6434bacd7 -DATA q<>+40(SB)/8, $0x1a0111ea397fe69a -GLOBL q<>(SB), (RODATA+NOPTR), $48 - -// qInv0 q'[0] -DATA qInv0<>(SB)/8, $0x89f3fffcfffcfffd -GLOBL qInv0<>(SB), (RODATA+NOPTR), $8 - -#define REDUCE(ra0, ra1, ra2, ra3, ra4, ra5, rb0, rb1, rb2, rb3, rb4, rb5) \ - MOVQ ra0, rb0; \ - SUBQ q<>(SB), ra0; \ - MOVQ ra1, rb1; \ - SBBQ q<>+8(SB), ra1; \ - MOVQ ra2, rb2; \ - SBBQ q<>+16(SB), ra2; \ - MOVQ ra3, rb3; \ - SBBQ q<>+24(SB), ra3; \ - MOVQ ra4, rb4; \ - SBBQ q<>+32(SB), ra4; \ - MOVQ ra5, rb5; \ - SBBQ q<>+40(SB), ra5; \ - CMOVQCS rb0, ra0; \ - CMOVQCS rb1, ra1; \ - CMOVQCS rb2, ra2; \ - CMOVQCS rb3, ra3; \ - CMOVQCS rb4, ra4; \ - CMOVQCS rb5, ra5; \ - -TEXT ·reduce(SB), NOSPLIT, $0-8 - MOVQ res+0(FP), AX - MOVQ 0(AX), DX - MOVQ 8(AX), CX - MOVQ 16(AX), BX - MOVQ 24(AX), SI - MOVQ 32(AX), DI - MOVQ 40(AX), R8 - - // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R9,R10,R11,R12,R13,R14) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14) - - MOVQ DX, 0(AX) - MOVQ CX, 8(AX) - MOVQ BX, 16(AX) - MOVQ SI, 24(AX) - MOVQ DI, 32(AX) - MOVQ R8, 40(AX) - RET - -// MulBy3(x *Element) -TEXT ·MulBy3(SB), NOSPLIT, $0-8 - MOVQ x+0(FP), AX - MOVQ 0(AX), DX - MOVQ 8(AX), CX - MOVQ 16(AX), BX - MOVQ 24(AX), SI - MOVQ 32(AX), DI - MOVQ 40(AX), R8 - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - ADCQ DI, DI - ADCQ R8, R8 - - // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R9,R10,R11,R12,R13,R14) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14) - - ADDQ 0(AX), DX - ADCQ 8(AX), CX - ADCQ 16(AX), BX - ADCQ 24(AX), SI - ADCQ 32(AX), DI - ADCQ 40(AX), R8 - - // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R15,R9,R10,R11,R12,R13) - REDUCE(DX,CX,BX,SI,DI,R8,R15,R9,R10,R11,R12,R13) - - MOVQ DX, 0(AX) - MOVQ CX, 8(AX) - MOVQ BX, 16(AX) - MOVQ SI, 24(AX) - MOVQ DI, 32(AX) - MOVQ R8, 40(AX) - RET - -// MulBy5(x *Element) -TEXT ·MulBy5(SB), NOSPLIT, $0-8 - MOVQ x+0(FP), AX - MOVQ 0(AX), DX - MOVQ 8(AX), CX - MOVQ 16(AX), BX - MOVQ 24(AX), SI - MOVQ 32(AX), DI - MOVQ 40(AX), R8 - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - ADCQ DI, DI - ADCQ R8, R8 - - // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R9,R10,R11,R12,R13,R14) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14) - - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - ADCQ DI, DI - ADCQ R8, R8 - - // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R15,R9,R10,R11,R12,R13) - REDUCE(DX,CX,BX,SI,DI,R8,R15,R9,R10,R11,R12,R13) - - ADDQ 0(AX), DX - ADCQ 8(AX), CX - ADCQ 16(AX), BX - ADCQ 24(AX), SI - ADCQ 32(AX), DI - ADCQ 40(AX), R8 - - // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R14,R15,R9,R10,R11,R12) - REDUCE(DX,CX,BX,SI,DI,R8,R14,R15,R9,R10,R11,R12) - - MOVQ DX, 0(AX) - MOVQ CX, 8(AX) - MOVQ BX, 16(AX) - MOVQ SI, 24(AX) - MOVQ DI, 32(AX) - MOVQ R8, 40(AX) - RET - -// MulBy13(x *Element) -TEXT ·MulBy13(SB), $40-8 - MOVQ x+0(FP), AX - MOVQ 0(AX), DX - MOVQ 8(AX), CX - MOVQ 16(AX), BX - MOVQ 24(AX), SI - MOVQ 32(AX), DI - MOVQ 40(AX), R8 - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - ADCQ DI, DI - ADCQ R8, R8 - - // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R9,R10,R11,R12,R13,R14) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14) - - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - ADCQ DI, DI - ADCQ R8, R8 - - // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R15,s0-8(SP),s1-16(SP),s2-24(SP),s3-32(SP),s4-40(SP)) - REDUCE(DX,CX,BX,SI,DI,R8,R15,s0-8(SP),s1-16(SP),s2-24(SP),s3-32(SP),s4-40(SP)) - - MOVQ DX, R15 - MOVQ CX, s0-8(SP) - MOVQ BX, s1-16(SP) - MOVQ SI, s2-24(SP) - MOVQ DI, s3-32(SP) - MOVQ R8, s4-40(SP) - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - ADCQ DI, DI - ADCQ R8, R8 - - // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R9,R10,R11,R12,R13,R14) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14) - - ADDQ R15, DX - ADCQ s0-8(SP), CX - ADCQ s1-16(SP), BX - ADCQ s2-24(SP), SI - ADCQ s3-32(SP), DI - ADCQ s4-40(SP), R8 - - // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R9,R10,R11,R12,R13,R14) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14) - - ADDQ 0(AX), DX - ADCQ 8(AX), CX - ADCQ 16(AX), BX - ADCQ 24(AX), SI - ADCQ 32(AX), DI - ADCQ 40(AX), R8 - - // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R9,R10,R11,R12,R13,R14) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14) - - MOVQ DX, 0(AX) - MOVQ CX, 8(AX) - MOVQ BX, 16(AX) - MOVQ SI, 24(AX) - MOVQ DI, 32(AX) - MOVQ R8, 40(AX) - RET - -// Butterfly(a, b *Element) sets a = a + b; b = a - b -TEXT ·Butterfly(SB), $48-16 - MOVQ a+0(FP), AX - MOVQ 0(AX), CX - MOVQ 8(AX), BX - MOVQ 16(AX), SI - MOVQ 24(AX), DI - MOVQ 32(AX), R8 - MOVQ 40(AX), R9 - MOVQ CX, R10 - MOVQ BX, R11 - MOVQ SI, R12 - MOVQ DI, R13 - MOVQ R8, R14 - MOVQ R9, R15 - XORQ AX, AX - MOVQ b+8(FP), DX - ADDQ 0(DX), CX - ADCQ 8(DX), BX - ADCQ 16(DX), SI - ADCQ 24(DX), DI - ADCQ 32(DX), R8 - ADCQ 40(DX), R9 - SUBQ 0(DX), R10 - SBBQ 8(DX), R11 - SBBQ 16(DX), R12 - SBBQ 24(DX), R13 - SBBQ 32(DX), R14 - SBBQ 40(DX), R15 - MOVQ CX, s0-8(SP) - MOVQ BX, s1-16(SP) - MOVQ SI, s2-24(SP) - MOVQ DI, s3-32(SP) - MOVQ R8, s4-40(SP) - MOVQ R9, s5-48(SP) - MOVQ $0xb9feffffffffaaab, CX - MOVQ $0x1eabfffeb153ffff, BX - MOVQ $0x6730d2a0f6b0f624, SI - MOVQ $0x64774b84f38512bf, DI - MOVQ $0x4b1ba7b6434bacd7, R8 - MOVQ $0x1a0111ea397fe69a, R9 - CMOVQCC AX, CX - CMOVQCC AX, BX - CMOVQCC AX, SI - CMOVQCC AX, DI - CMOVQCC AX, R8 - CMOVQCC AX, R9 - ADDQ CX, R10 - ADCQ BX, R11 - ADCQ SI, R12 - ADCQ DI, R13 - ADCQ R8, R14 - ADCQ R9, R15 - MOVQ s0-8(SP), CX - MOVQ s1-16(SP), BX - MOVQ s2-24(SP), SI - MOVQ s3-32(SP), DI - MOVQ s4-40(SP), R8 - MOVQ s5-48(SP), R9 - MOVQ R10, 0(DX) - MOVQ R11, 8(DX) - MOVQ R12, 16(DX) - MOVQ R13, 24(DX) - MOVQ R14, 32(DX) - MOVQ R15, 40(DX) - - // reduce element(CX,BX,SI,DI,R8,R9) using temp registers (R10,R11,R12,R13,R14,R15) - REDUCE(CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14,R15) - - MOVQ a+0(FP), AX - MOVQ CX, 0(AX) - MOVQ BX, 8(AX) - MOVQ SI, 16(AX) - MOVQ DI, 24(AX) - MOVQ R8, 32(AX) - MOVQ R9, 40(AX) - RET diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_ops_purego.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_purego.go similarity index 88% rename from vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_ops_purego.go rename to vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_purego.go index fc10b3df3..f3170f77e 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_ops_purego.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/element_purego.go @@ -1,19 +1,7 @@ -//go:build !amd64 || purego -// +build !amd64 purego +//go:build purego || (!amd64 && !arm64) -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -46,14 +34,6 @@ func MulBy13(x *Element) { x.Mul(x, &y) } -// Butterfly sets -// -// a = a + b (mod q) -// b = a - b (mod q) -func Butterfly(a, b *Element) { - _butterflyGeneric(a, b) -} - func fromMont(z *Element) { _fromMontGeneric(z) } @@ -67,48 +47,8 @@ func reduce(z *Element) { // x and y must be less than q func (z *Element) Mul(x, y *Element) *Element { - // Implements CIOS multiplication -- section 2.3.2 of Tolga Acar's thesis - // https://www.microsoft.com/en-us/research/wp-content/uploads/1998/06/97Acar.pdf - // - // The algorithm: - // - // for i=0 to N-1 - // C := 0 - // for j=0 to N-1 - // (C,t[j]) := t[j] + x[j]*y[i] + C - // (t[N+1],t[N]) := t[N] + C - // - // C := 0 - // m := t[0]*q'[0] mod D - // (C,_) := t[0] + m*q[0] - // for j=1 to N-1 - // (C,t[j-1]) := t[j] + m*q[j] + C - // - // (C,t[N-1]) := t[N] + C - // t[N] := t[N+1] + C - // - // → N is the number of machine words needed to store the modulus q - // → D is the word size. For example, on a 64-bit architecture D is 2 64 - // → x[i], y[i], q[i] is the ith word of the numbers x,y,q - // → q'[0] is the lowest word of the number -q⁻¹ mod r. This quantity is pre-computed, as it does not depend on the inputs. - // → t is a temporary array of size N+2 - // → C, S are machine words. A pair (C,S) refers to (hi-bits, lo-bits) of a two-word number - // - // As described here https://hackmd.io/@gnark/modular_multiplication we can get rid of one carry chain and simplify: - // (also described in https://eprint.iacr.org/2022/1400.pdf annex) - // - // for i=0 to N-1 - // (A,t[0]) := t[0] + x[0]*y[i] - // m := t[0]*q'[0] mod W - // C,_ := t[0] + m*q[0] - // for j=1 to N-1 - // (A,t[j]) := t[j] + x[j]*y[i] + A - // (C,t[j-1]) := t[j] + m*q[j] + C - // - // t[N-1] = C + A - // - // This optimization saves 5N + 2 additions in the algorithm, and can be used whenever the highest bit - // of the modulus is zero (and not all of the remaining bits are set). + // Algorithm 2 of "Faster Montgomery Multiplication and Multi-Scalar-Multiplication for SNARKS" + // by Y. El Housni and G. Botrel https://doi.org/10.46586/tches.v2023.i3.504-521 var t0, t1, t2, t3, t4, t5 uint64 var u0, u1, u2, u3, u4, u5 uint64 @@ -743,3 +683,11 @@ func (z *Element) Square(x *Element) *Element { } return z } + +// Butterfly sets +// +// a = a + b (mod q) +// b = a - b (mod q) +func Butterfly(a, b *Element) { + _butterflyGeneric(a, b) +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/vector.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/vector.go index 3fe113710..798d21214 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/vector.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/vector.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -19,9 +8,12 @@ package fp import ( "bytes" "encoding/binary" + "errors" "fmt" "io" + "math/bits" "runtime" + "slices" "strings" "sync" "sync/atomic" @@ -78,40 +70,84 @@ func (vector *Vector) WriteTo(w io.Writer) (int64, error) { return n, nil } -// AsyncReadFrom reads a vector of big endian encoded Element. -// Length of the vector must be encoded as a uint32 on the first 4 bytes. -// It consumes the needed bytes from the reader and returns the number of bytes read and an error if any. -// It also returns a channel that will be closed when the validation is done. -// The validation consist of checking that the elements are smaller than the modulus, and -// converting them to montgomery form. -func (vector *Vector) AsyncReadFrom(r io.Reader) (int64, error, chan error) { +// AsyncReadFrom implements an asynchronous version of [Vector.ReadFrom]. It +// reads the reader r in full and then performs the validation and conversion to +// Montgomery form separately in a goroutine. Any error encountered during +// reading is returned directly, while errors encountered during +// validation/conversion are sent on the returned channel. Thus the caller must +// wait on the channel to ensure the vector is ready to use. The method +// additionally returns the number of bytes read from r. +// +// The errors during reading can be: +// - an error while reading from r; +// - not enough bytes in r to read the full vector indicated by header. +// +// The reader can contain more bytes than needed to decode the vector, in which +// case the extra bytes are ignored. In that case the reader is not seeked nor +// read further. +// +// The method allocates sufficiently large slice to store the vector. If the +// current slice fits the vector, it is reused, otherwise the slice is grown to +// fit the vector. +// +// The serialized encoding is as follows: +// - first 4 bytes: length of the vector as a big-endian uint32 +// - for each element of the vector, [Bytes] bytes representing the element in +// big-endian encoding. +func (vector *Vector) AsyncReadFrom(r io.Reader) (int64, error, chan error) { // nolint ST1008 chErr := make(chan error, 1) var buf [Bytes]byte if read, err := io.ReadFull(r, buf[:4]); err != nil { close(chErr) return int64(read), err, chErr } - sliceLen := binary.BigEndian.Uint32(buf[:4]) - - n := int64(4) - (*vector) = make(Vector, sliceLen) - if sliceLen == 0 { + headerSliceLen := uint64(binary.BigEndian.Uint32(buf[:4])) + + // to avoid allocating too large slice when the header is tampered, we limit + // the maximum allocation. We set the target to 4GB. This incurs a performance + // hit when reading very large slices, but protects against OOM. + targetSize := uint64(1 << 32) // 4GB + if bits.UintSize == 32 { + // reduce target size to 1GB on 32 bits architectures + targetSize = uint64(1 << 30) // 1GB + } + maxAllocateSliceLength := targetSize / uint64(Bytes) + + totalRead := int64(4) + *vector = (*vector)[:0] + if headerSliceLen == 0 { + // if the vector was nil previously even by reslicing we have a nil vector. + // but we want to have an empty slice to indicate that the vector has zero length. + if *vector == nil { + *vector = []Element{} + } + // we return already here to avoid launching a goroutine doing nothing below close(chErr) - return n, nil, chErr + return totalRead, nil, chErr } - bSlice := unsafe.Slice((*byte)(unsafe.Pointer(&(*vector)[0])), sliceLen*Bytes) - read, err := io.ReadFull(r, bSlice) - n += int64(read) - if err != nil { - close(chErr) - return n, err, chErr + for i := uint64(0); i < headerSliceLen; i += maxAllocateSliceLength { + if len(*vector) <= int(i) { + (*vector) = append(*vector, make([]Element, int(min(headerSliceLen-i, maxAllocateSliceLength)))...) + } + bSlice := unsafe.Slice((*byte)(unsafe.Pointer(&(*vector)[i])), int(min(headerSliceLen-i, maxAllocateSliceLength))*Bytes) + read, err := io.ReadFull(r, bSlice) + totalRead += int64(read) + if errors.Is(err, io.ErrUnexpectedEOF) { + close(chErr) + return totalRead, fmt.Errorf("less data than expected: read %d elements, expected %d", i+uint64(read)/Bytes, headerSliceLen), chErr + } + if err != nil { + close(chErr) + return totalRead, err, chErr + } } + bSlice := unsafe.Slice((*byte)(unsafe.Pointer(&(*vector)[0])), int(headerSliceLen)*Bytes) go func() { var cptErrors uint64 // process the elements in parallel - execute(int(sliceLen), func(start, end int) { + execute(int(headerSliceLen), func(start, end int) { var z Element for i := start; i < end; i++ { @@ -140,35 +176,72 @@ func (vector *Vector) AsyncReadFrom(r io.Reader) (int64, error, chan error) { } close(chErr) }() - return n, nil, chErr + return totalRead, nil, chErr } -// ReadFrom implements io.ReaderFrom and reads a vector of big endian encoded Element. -// Length of the vector must be encoded as a uint32 on the first 4 bytes. +// ReadFrom reads the vector from the reader r. It returns the number of bytes +// read and an error, if any. The errors can be: +// - an error while reading from r; +// - not enough bytes in r to read the full vector indicated by header; +// - when decoding the bytes into elements. +// +// The reader can contain more bytes than needed to decode the vector, in which case +// the extra bytes are ignored. In that case the reader is not seeked nor read further. +// +// The method allocates sufficiently large slice to store the vector. If the current slice fits +// the vector, it is reused, otherwise the slice is grown to fit the vector. +// +// The serialized encoding is as follows: +// - first 4 bytes: length of the vector as a big-endian uint32 +// - for each element of the vector, [Bytes] bytes representing the element in big-endian encoding. +// +// The method implements [io.ReaderFrom] interface. func (vector *Vector) ReadFrom(r io.Reader) (int64, error) { - var buf [Bytes]byte if read, err := io.ReadFull(r, buf[:4]); err != nil { return int64(read), err } - sliceLen := binary.BigEndian.Uint32(buf[:4]) - - n := int64(4) - (*vector) = make(Vector, sliceLen) + headerSliceLen := uint64(binary.BigEndian.Uint32(buf[:4])) + + // to avoid allocating too large slice when the header is tampered, we limit + // the maximum allocation. We set the target to 4GB. This incurs a performance + // hit when reading very large slices, but protects against OOM. + targetSize := uint64(1 << 32) // 4GB + if bits.UintSize == 32 { + // reduce target size to 1GB on 32 bits architectures + targetSize = uint64(1 << 30) // 1GB + } + maxAllocateSliceLength := targetSize / uint64(Bytes) + + totalRead := int64(4) // include already the header length + *vector = (*vector)[:0] + // if the vector was nil previously even by reslicing we have a nil vector. But we want + // to have an empty slice to indicate that the vector has zero length. When headerSliceLen == 0 + // we handle this edge case after reading the header as the loop body below is skipped. + if headerSliceLen == 0 && *vector == nil { + *vector = []Element{} + } - for i := 0; i < int(sliceLen); i++ { + for i := uint64(0); i < headerSliceLen; i++ { read, err := io.ReadFull(r, buf[:]) - n += int64(read) + totalRead += int64(read) + if errors.Is(err, io.ErrUnexpectedEOF) { + return totalRead, fmt.Errorf("less data than expected: read %d elements, expected %d", i, headerSliceLen) + } if err != nil { - return n, err + return totalRead, fmt.Errorf("error reading element %d: %w", i, err) } - (*vector)[i], err = BigEndian.Element(&buf) + if uint64(cap(*vector)) <= i { + (*vector) = slices.Grow(*vector, int(min(headerSliceLen-i, maxAllocateSliceLength))) + } + el, err := BigEndian.Element(&buf) if err != nil { - return n, err + return totalRead, fmt.Errorf("error decoding element %d: %w", i, err) } + *vector = append(*vector, el) } - return n, nil + return totalRead, nil } // String implements fmt.Stringer interface @@ -201,6 +274,88 @@ func (vector Vector) Swap(i, j int) { vector[i], vector[j] = vector[j], vector[i] } +// SetRandom sets the elements in vector to independent uniform random values in [0, q). +// +// This might error only if reading from crypto/rand.Reader errors, +// in which case the values in vector are undefined. +func (vector Vector) SetRandom() error { + for i := range vector { + if _, err := vector[i].SetRandom(); err != nil { + return err + } + } + return nil +} + +// MustSetRandom sets the elements in vector to independent uniform random values in [0, q). +// +// It panics if reading from crypto/rand.Reader errors. +func (vector Vector) MustSetRandom() { + for i := range vector { + if _, err := vector[i].SetRandom(); err != nil { + panic(err) + } + } +} + +// Equal returns true if vector and other have the same length and same elements. +func (vector Vector) Equal(other Vector) bool { + return slices.Equal(vector, other) +} + +func addVecGeneric(res, a, b Vector) { + if len(a) != len(b) || len(a) != len(res) { + panic("vector.Add: vectors don't have the same length") + } + for i := 0; i < len(a); i++ { + res[i].Add(&a[i], &b[i]) + } +} + +func subVecGeneric(res, a, b Vector) { + if len(a) != len(b) || len(a) != len(res) { + panic("vector.Sub: vectors don't have the same length") + } + for i := 0; i < len(a); i++ { + res[i].Sub(&a[i], &b[i]) + } +} + +func scalarMulVecGeneric(res, a Vector, b *Element) { + if len(a) != len(res) { + panic("vector.ScalarMul: vectors don't have the same length") + } + for i := 0; i < len(a); i++ { + res[i].Mul(&a[i], b) + } +} + +func sumVecGeneric(res *Element, a Vector) { + for i := 0; i < len(a); i++ { + res.Add(res, &a[i]) + } +} + +func innerProductVecGeneric(res *Element, a, b Vector) { + if len(a) != len(b) { + panic("vector.InnerProduct: vectors don't have the same length") + } + var tmp Element + for i := 0; i < len(a); i++ { + tmp.Mul(&a[i], &b[i]) + res.Add(res, &tmp) + } +} + +func mulVecGeneric(res, a, b Vector) { + if len(a) != len(b) || len(a) != len(res) { + panic("vector.Mul: vectors don't have the same length") + } + for i := 0; i < len(a); i++ { + res[i].Mul(&a[i], &b[i]) + } +} + // TODO @gbotrel make a public package out of that. // execute executes the work function in parallel. // this is copy paste from internal/parallel/parallel.go diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/vector_purego.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/vector_purego.go new file mode 100644 index 000000000..85670501d --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fp/vector_purego.go @@ -0,0 +1,43 @@ +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package fp + +// Add adds two vectors element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) Add(a, b Vector) { + addVecGeneric(*vector, a, b) +} + +// Sub subtracts two vectors element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) Sub(a, b Vector) { + subVecGeneric(*vector, a, b) +} + +// ScalarMul multiplies a vector by a scalar element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) ScalarMul(a Vector, b *Element) { + scalarMulVecGeneric(*vector, a, b) +} + +// Sum computes the sum of all elements in the vector. +func (vector *Vector) Sum() (res Element) { + sumVecGeneric(&res, *vector) + return +} + +// InnerProduct computes the inner product of two vectors. +// It panics if the vectors don't have the same length. +func (vector *Vector) InnerProduct(other Vector) (res Element) { + innerProductVecGeneric(&res, *vector, other) + return +} + +// Mul multiplies two vectors element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) Mul(a, b Vector) { + mulVecGeneric(*vector, a, b) +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/arith.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/arith.go index 7cfd55da1..8dbae56e3 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/arith.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/arith.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -58,16 +47,3 @@ func madd3(a, b, c, d, e uint64) (hi uint64, lo uint64) { hi, _ = bits.Add64(hi, e, carry) return } -func max(a int, b int) int { - if a > b { - return a - } - return b -} - -func min(a int, b int) int { - if a < b { - return a - } - return b -} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/asm.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/asm.go deleted file mode 100644 index da061913b..000000000 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/asm.go +++ /dev/null @@ -1,27 +0,0 @@ -//go:build !noadx -// +build !noadx - -// Copyright 2020 ConsenSys Software 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. - -// Code generated by consensys/gnark-crypto DO NOT EDIT - -package fr - -import "golang.org/x/sys/cpu" - -var ( - supportAdx = cpu.X86.HasADX && cpu.X86.HasBMI2 - _ = supportAdx -) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/asm_noadx.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/asm_noadx.go deleted file mode 100644 index 7f52ffa19..000000000 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/asm_noadx.go +++ /dev/null @@ -1,28 +0,0 @@ -//go:build noadx -// +build noadx - -// Copyright 2020 ConsenSys Software 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. - -// Code generated by consensys/gnark-crypto DO NOT EDIT - -package fr - -// note: this is needed for test purposes, as dynamically changing supportAdx doesn't flag -// certain errors (like fatal error: missing stackmap) -// this ensures we test all asm path. -var ( - supportAdx = false - _ = supportAdx -) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/doc.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/doc.go index 71ea8a2dc..89c78bd60 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/doc.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/doc.go @@ -1,22 +1,13 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT // Package fr contains field arithmetic operations for modulus = 0x73eda7...000001. // -// The API is similar to math/big (big.Int), but the operations are significantly faster (up to 20x for the modular multiplication on amd64, see also https://hackmd.io/@gnark/modular_multiplication) +// The API is similar to math/big (big.Int), but the operations are significantly faster (up to 20x). +// +// Additionally fr.Vector offers an API to manipulate []Element using AVX512 instructions if available. // // The modulus is hardcoded in all the operations. // @@ -49,5 +40,7 @@ // // # Warning // -// This code has not been audited and is provided as-is. In particular, there is no security guarantees such as constant time implementation or side-channel attack resistance. +// There is no security guarantees such as constant time implementation or side-channel attack resistance. +// This code is provided as-is. Partially audited, see https://github.com/Consensys/gnark/tree/master/audits +// for more details. package fr diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element.go index aa6c47cdd..0671ae4a6 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -54,10 +43,10 @@ const ( // Field modulus q const ( - q0 uint64 = 18446744069414584321 - q1 uint64 = 6034159408538082302 - q2 uint64 = 3691218898639771653 - q3 uint64 = 8353516859464449352 + q0 = 18446744069414584321 + q1 = 6034159408538082302 + q2 = 3691218898639771653 + q3 = 8353516859464449352 ) var qElement = Element{ @@ -79,7 +68,10 @@ func Modulus() *big.Int { // q + r'.r = 1, i.e., qInvNeg = - q⁻¹ mod r // used for Montgomery reduction -const qInvNeg uint64 = 18446744069414584319 +const qInvNeg = 18446744069414584319 + +// mu = 2^288 / q needed for partial Barrett reduction +const mu uint64 = 9484408045 func init() { _modulus.SetString("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001", 16) @@ -129,7 +121,7 @@ func (z *Element) Set(x *Element) *Element { } // SetInterface converts provided interface into Element -// returns an error if provided type is not supported +// returns an error if provided type is not supported. // supported types: // // Element @@ -350,6 +342,16 @@ func (z *Element) SetRandom() (*Element, error) { } } +// MustSetRandom sets z to a uniform random value in [0, q). +// +// It panics if reading from crypto/rand.Reader errors. +func (z *Element) MustSetRandom() *Element { + if _, err := z.SetRandom(); err != nil { + panic(err) + } + return z +} + // smallerThanModulus returns true if z < q // This is not constant time func (z *Element) smallerThanModulus() bool { @@ -477,32 +479,8 @@ func (z *Element) Select(c int, x0 *Element, x1 *Element) *Element { // and is used for testing purposes. func _mulGeneric(z, x, y *Element) { - // Implements CIOS multiplication -- section 2.3.2 of Tolga Acar's thesis - // https://www.microsoft.com/en-us/research/wp-content/uploads/1998/06/97Acar.pdf - // - // The algorithm: - // - // for i=0 to N-1 - // C := 0 - // for j=0 to N-1 - // (C,t[j]) := t[j] + x[j]*y[i] + C - // (t[N+1],t[N]) := t[N] + C - // - // C := 0 - // m := t[0]*q'[0] mod D - // (C,_) := t[0] + m*q[0] - // for j=1 to N-1 - // (C,t[j-1]) := t[j] + m*q[j] + C - // - // (C,t[N-1]) := t[N] + C - // t[N] := t[N+1] + C - // - // → N is the number of machine words needed to store the modulus q - // → D is the word size. For example, on a 64-bit architecture D is 2 64 - // → x[i], y[i], q[i] is the ith word of the numbers x,y,q - // → q'[0] is the lowest word of the number -q⁻¹ mod r. This quantity is pre-computed, as it does not depend on the inputs. - // → t is a temporary array of size N+2 - // → C, S are machine words. A pair (C,S) refers to (hi-bits, lo-bits) of a two-word number + // Algorithm 2 of "Faster Montgomery Multiplication and Multi-Scalar-Multiplication for SNARKS" + // by Y. El Housni and G. Botrel https://doi.org/10.46586/tches.v2023.i3.504-521 var t [5]uint64 var D uint64 @@ -960,7 +938,7 @@ func (z *Element) SetBigInt(v *big.Int) *Element { // v == 0 return z } else if c != 1 && v.Cmp(&zero) != -1 { - // 0 < v < q + // 0 <= v < q return z.setBigInt(v) } @@ -1087,6 +1065,8 @@ type ByteOrder interface { String() string } +var errInvalidEncoding = errors.New("invalid fr.Element encoding") + // BigEndian is the big-endian implementation of ByteOrder and AppendByteOrder. var BigEndian bigEndian @@ -1102,7 +1082,7 @@ func (bigEndian) Element(b *[Bytes]byte) (Element, error) { z[3] = binary.BigEndian.Uint64((*b)[0:8]) if !z.smallerThanModulus() { - return Element{}, errors.New("invalid fr.Element encoding") + return Element{}, errInvalidEncoding } z.toMont() @@ -1132,7 +1112,7 @@ func (littleEndian) Element(b *[Bytes]byte) (Element, error) { z[3] = binary.LittleEndian.Uint64((*b)[24:32]) if !z.smallerThanModulus() { - return Element{}, errors.New("invalid fr.Element encoding") + return Element{}, errInvalidEncoding } z.toMont() @@ -1151,19 +1131,168 @@ func (littleEndian) String() string { return "LittleEndian" } // Legendre returns the Legendre symbol of z (either +1, -1, or 0.) func (z *Element) Legendre() int { - var l Element - // z^((q-1)/2) - l.expByLegendreExp(*z) - if l.IsZero() { - return 0 + // Adapts "Optimized Binary GCD for Modular Inversion" + // https://github.com/pornin/bingcd/blob/main/doc/bingcd.pdf + // For a faithful implementation of Pornin20 see [Inverse]. + + // We don't need to account for z being in Montgomery form. + // (xR|q) = (x|q)(R|q). R is a square (an even power of 2), so (R|q) = 1. + a := *z + b := Element{ + q0, + q1, + q2, + q3, + } // b := q + + // Update factors: we get [a; b] ← [f₀ g₀; f₁ g₁] [a; b] + // cᵢ = fᵢ + 2³¹ - 1 + 2³² * (gᵢ + 2³¹ - 1) + var c0, c1 int64 + + var s Element + + l := 1 // loop invariant: (x|q) = (a|b) . l + // This means that every time a and b are updated into a' and b', + // l is updated into l' = (x|q)(a'|b')=(x|q)(a|b)(a|b)(a'|b') = l (a|b)(a'|b') + // During the algorithm's run, there is no guarantee that b remains prime, or even positive. + // Therefore, we use the properties of the Kronecker symbol, a generalization of the Legendre symbol to all integers. + + for !a.IsZero() { + n := max(a.BitLen(), b.BitLen()) + aApprox, bApprox := approximateForLegendre(&a, n), approximateForLegendre(&b, n) + + // f₀, g₀, f₁, g₁ = 1, 0, 0, 1 + c0, c1 = updateFactorIdentityMatrixRow0, updateFactorIdentityMatrixRow1 + + const nbIterations = k - 2 + // running fewer iterations because we need access to 3 low bits from b, rather than 1 in the inversion algorithm + for range nbIterations { + + if aApprox&1 == 0 { + aApprox /= 2 + + // update the Kronecker symbol + // + // (a/2 | b) (2|b) = (a|b) + // + // b is either odd or zero, the latter case implying a non-trivial GCD and an ultimate result of 0, + // regardless of what value l holds. + // So in updating l, we may assume that b is odd. + // Since a is even, we only need to correctly compute l if b is odd. + // if b is also even, the non-trivial GCD will result in the function returning 0 anyway. + // so we may here assume b is odd. + // (2|b) = 1 if b ≡ 1 or 7 (mod 8), and -1 if b ≡ 3 or 5 (mod 8) + if bMod8 := bApprox & 7; bMod8 == 3 || bMod8 == 5 { + l = -l + } + + } else { + s, borrow := bits.Sub64(aApprox, bApprox, 0) + if borrow == 1 { + // Compute (b-a|a) + // (x-y|z) = (x|z) unless z < 0 and sign(x-y) ≠ sign(x) + // Pornin20 asserts that at least one of a and b is non-negative. + // If a is non-negative, we immediately get (b-a|a) = (b|a) + // If a is negative, b-a > b. But b is already non-negative, so the b-a and b have the same sign. + // Thus in that case also (b-a|a) = (b|a) + // Since not both a and b are negative, we get a quadratic reciprocity law + // like that of the Legendre symbol: (b|a) = (a|b), unless a, b ≡ 3 (mod 4), in which case (b|a) = -(a|b) + if bApprox&3 == 3 && aApprox&3 == 3 { + l = -l + } + + s = bApprox - aApprox + bApprox = aApprox + c0, c1 = c1, c0 + } + + aApprox = s / 2 + c0 = c0 - c1 + + // update l to reflect halving a, just like in the case where a is even + if bMod8 := bApprox & 7; bMod8 == 3 || bMod8 == 5 { + l = -l + } + } + + c1 *= 2 + } + + s = a + + var g0 int64 + // from this point on c0 aliases for f0 + c0, g0 = updateFactorsDecompose(c0) + aHi := a.linearCombNonModular(&s, c0, &b, g0) + if aHi&signBitSelector != 0 { + // if aHi < 0 + aHi = negL(&a, aHi) + // Since a is negative, b is not and hence b ≠ -1 + // So we get (-a|b)=(-1|b)(a|b) + // b is odd so we get (-1|b) = 1 if b ≡ 1 (mod 4) and -1 otherwise. + if bApprox&3 == 3 { // we still have two valid lower bits for b + l = -l + } + } + // right-shift a by k-2 bits + a[0] = (a[0] >> nbIterations) | ((a[1]) << (2*k - nbIterations)) + a[1] = (a[1] >> nbIterations) | ((a[2]) << (2*k - nbIterations)) + a[2] = (a[2] >> nbIterations) | ((a[3]) << (2*k - nbIterations)) + a[3] = (a[3] >> nbIterations) | (aHi << (2*k - nbIterations)) + + var f1 int64 + // from this point on c1 aliases for g0 + f1, c1 = updateFactorsDecompose(c1) + bHi := b.linearCombNonModular(&s, f1, &b, c1) + if bHi&signBitSelector != 0 { + // if bHi < 0 + bHi = negL(&b, bHi) + // no need to update l, since we know a ≥ 0 + // (a|-1) = 1 if a ≥ 0 + } + // right-shift b by k-2 bits + b[0] = (b[0] >> nbIterations) | ((b[1]) << (2*k - nbIterations)) + b[1] = (b[1] >> nbIterations) | ((b[2]) << (2*k - nbIterations)) + b[2] = (b[2] >> nbIterations) | ((b[3]) << (2*k - nbIterations)) + b[3] = (b[3] >> nbIterations) | (bHi << (2*k - nbIterations)) } - // if l == 1 - if l.IsOne() { - return 1 + if b[0] == 1 && (b[1]|b[2]|b[3]) == 0 { + return l // (0|1) = 1 + } else { + return 0 // if b ≠ 1, then (z,q) ≠ 0 ⇒ (z|q) = 0 + } +} + +// approximate a big number x into a single 64 bit word using its uppermost and lowermost bits. +// If x fits in a word as is, no approximation necessary. +// This differs from the standard approximate function in that in the Legendre symbol computation +// we need to access the 3 low bits of b, rather than just one. So lo ≥ n+2 where n is the number of inner iterations. +// The requirement on the high bits is unchanged, hi ≥ n+1. +// Thus we hit a maximum of hi = lo = k and n = k-2 as opposed to n = lo = k-1 and hi = k+1 in the standard approximate function. +// Since we are doing fewer iterations than in the inversion algorithm, all the arguments on bounds for update factors remain valid. +func approximateForLegendre(x *Element, nBits int) uint64 { + + if nBits <= 64 { + return x[0] } - return -1 + + const mask = (uint64(1) << k) - 1 // k ones + lo := mask & x[0] + + hiWordIndex := (nBits - 1) / 64 + + hiWordBitsAvailable := nBits - hiWordIndex*64 + hiWordBitsUsed := min(hiWordBitsAvailable, k) + + mask_ := uint64(^((1 << (hiWordBitsAvailable - hiWordBitsUsed)) - 1)) + hi := (x[hiWordIndex] & mask_) << (64 - hiWordBitsAvailable) + + mask_ = ^(1<<(k+hiWordBitsUsed) - 1) + mid := (mask_ & x[hiWordIndex-1]) >> hiWordBitsUsed + + return lo | mid | hi } // Sqrt z = √x (mod q) @@ -1431,7 +1560,7 @@ func approximate(x *Element, nBits int) uint64 { return x[0] } - const mask = (uint64(1) << (k - 1)) - 1 // k-1 ones + const mask = (uint64(1) << approxLowBitsN) - 1 // k-1 ones lo := mask & x[0] hiWordIndex := (nBits - 1) / 64 diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_amd64.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_amd64.go new file mode 100644 index 000000000..c282ebc9f --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_amd64.go @@ -0,0 +1,62 @@ +//go:build !purego + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package fr + +import ( + _ "github.com/consensys/gnark-crypto/field/asm/element_4w" + "github.com/consensys/gnark-crypto/utils/cpu" +) + +var supportAdx = cpu.SupportADX + +//go:noescape +func MulBy3(x *Element) + +//go:noescape +func MulBy5(x *Element) + +//go:noescape +func MulBy13(x *Element) + +//go:noescape +func mul(res, x, y *Element) + +//go:noescape +func fromMont(res *Element) + +//go:noescape +func reduce(res *Element) + +// Butterfly sets +// +// a = a + b (mod q) +// b = a - b (mod q) +// +//go:noescape +func Butterfly(a, b *Element) + +// Mul z = x * y (mod q) +// +// x and y must be less than q +func (z *Element) Mul(x, y *Element) *Element { + + // Algorithm 2 of "Faster Montgomery Multiplication and Multi-Scalar-Multiplication for SNARKS" + // by Y. El Housni and G. Botrel https://doi.org/10.46586/tches.v2023.i3.504-521 + + mul(z, x, y) + return z +} + +// Square z = x * x (mod q) +// +// x must be less than q +func (z *Element) Square(x *Element) *Element { + // see Mul for doc. + mul(z, x, x) + return z +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_amd64.s b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_amd64.s new file mode 100644 index 000000000..512d87236 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_amd64.s @@ -0,0 +1,10 @@ +//go:build !purego + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +// We include the hash to force the Go compiler to recompile: 6029369087367900835 +#include "../../../field/asm/element_4w/element_4w_amd64.s" + diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_arm64.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_arm64.go new file mode 100644 index 000000000..e8b6cb4d0 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_arm64.go @@ -0,0 +1,70 @@ +//go:build !purego + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package fr + +import ( + _ "github.com/consensys/gnark-crypto/field/asm/element_4w" +) + +// Butterfly sets +// +// a = a + b (mod q) +// b = a - b (mod q) +// +//go:noescape +func Butterfly(a, b *Element) + +//go:noescape +func mul(res, x, y *Element) + +// Mul z = x * y (mod q) +// +// x and y must be less than q +func (z *Element) Mul(x, y *Element) *Element { + mul(z, x, y) + return z +} + +// Square z = x * x (mod q) +// +// x must be less than q +func (z *Element) Square(x *Element) *Element { + // see Mul for doc. + mul(z, x, x) + return z +} + +// MulBy3 x *= 3 (mod q) +func MulBy3(x *Element) { + _x := *x + x.Double(x).Add(x, &_x) +} + +// MulBy5 x *= 5 (mod q) +func MulBy5(x *Element) { + _x := *x + x.Double(x).Double(x).Add(x, &_x) +} + +// MulBy13 x *= 13 (mod q) +func MulBy13(x *Element) { + var y = Element{ + 120259084260, + 15510977298029211676, + 7326335280343703402, + 5909200893219589146, + } + x.Mul(x, &y) +} + +func fromMont(z *Element) { + _fromMontGeneric(z) +} + +//go:noescape +func reduce(res *Element) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_arm64.s b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_arm64.s new file mode 100644 index 000000000..c8df07e34 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_arm64.s @@ -0,0 +1,10 @@ +//go:build !purego + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +// We include the hash to force the Go compiler to recompile: 1501560133179981797 +#include "../../../field/asm/element_4w/element_4w_arm64.s" + diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_exp.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_exp.go index 48073af8e..5110e7366 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_exp.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_exp.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -351,351 +340,3 @@ func (z *Element) expBySqrtExp(x Element) *Element { return z } - -// expByLegendreExp is equivalent to z.Exp(x, 39f6d3a994cebea4199cec0404d0ec02a9ded2017fff2dff7fffffff80000000) -// -// uses github.com/mmcloughlin/addchain v0.4.0 to generate a shorter addition chain -func (z *Element) expByLegendreExp(x Element) *Element { - // addition chain: - // - // _10 = 2*1 - // _11 = 1 + _10 - // _100 = 1 + _11 - // _110 = _10 + _100 - // _1100 = 2*_110 - // _10010 = _110 + _1100 - // _10011 = 1 + _10010 - // _10110 = _11 + _10011 - // _11000 = _10 + _10110 - // _11010 = _10 + _11000 - // _100010 = _1100 + _10110 - // _110101 = _10011 + _100010 - // _111011 = _110 + _110101 - // _1001011 = _10110 + _110101 - // _1001101 = _10 + _1001011 - // _1010101 = _11010 + _111011 - // _1100111 = _10010 + _1010101 - // _1101001 = _10 + _1100111 - // _10000011 = _11010 + _1101001 - // _10011001 = _10110 + _10000011 - // _10011101 = _100 + _10011001 - // _10111111 = _100010 + _10011101 - // _11010111 = _11000 + _10111111 - // _11011011 = _100 + _11010111 - // _11100111 = _1100 + _11011011 - // _11101111 = _11000 + _11010111 - // _11111111 = _11000 + _11100111 - // i55 = ((_11100111 << 8 + _11011011) << 9 + _10011101) << 9 - // i75 = ((_10011001 + i55) << 9 + _10011001) << 8 + _11010111 - // i102 = ((i75 << 6 + _110101) << 10 + _10000011) << 9 - // i121 = ((_1100111 + i102) << 8 + _111011) << 8 + 1 - // i162 = ((i121 << 14 + _1001101) << 10 + _111011) << 15 - // i183 = ((_1010101 + i162) << 10 + _11101111) << 8 + _1101001 - // i216 = ((i183 << 16 + _10111111) << 8 + _11111111) << 7 - // i236 = ((_1001011 + i216) << 9 + _11111111) << 8 + _10111111 - // i262 = ((i236 << 8 + _11111111) << 8 + _11111111) << 8 - // return ((_11111111 + i262) << 2 + _11) << 31 - // - // Operations: 248 squares 49 multiplies - - // Allocate Temporaries. - var ( - t0 = new(Element) - t1 = new(Element) - t2 = new(Element) - t3 = new(Element) - t4 = new(Element) - t5 = new(Element) - t6 = new(Element) - t7 = new(Element) - t8 = new(Element) - t9 = new(Element) - t10 = new(Element) - t11 = new(Element) - t12 = new(Element) - t13 = new(Element) - t14 = new(Element) - t15 = new(Element) - ) - - // var t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15 Element - // Step 1: t3 = x^0x2 - t3.Square(&x) - - // Step 2: z = x^0x3 - z.Mul(&x, t3) - - // Step 3: t14 = x^0x4 - t14.Mul(&x, z) - - // Step 4: t2 = x^0x6 - t2.Mul(t3, t14) - - // Step 5: t4 = x^0xc - t4.Square(t2) - - // Step 6: t8 = x^0x12 - t8.Mul(t2, t4) - - // Step 7: t5 = x^0x13 - t5.Mul(&x, t8) - - // Step 8: t11 = x^0x16 - t11.Mul(z, t5) - - // Step 9: t0 = x^0x18 - t0.Mul(t3, t11) - - // Step 10: t9 = x^0x1a - t9.Mul(t3, t0) - - // Step 11: t1 = x^0x22 - t1.Mul(t4, t11) - - // Step 12: t10 = x^0x35 - t10.Mul(t5, t1) - - // Step 13: t6 = x^0x3b - t6.Mul(t2, t10) - - // Step 14: t2 = x^0x4b - t2.Mul(t11, t10) - - // Step 15: t7 = x^0x4d - t7.Mul(t3, t2) - - // Step 16: t5 = x^0x55 - t5.Mul(t9, t6) - - // Step 17: t8 = x^0x67 - t8.Mul(t8, t5) - - // Step 18: t3 = x^0x69 - t3.Mul(t3, t8) - - // Step 19: t9 = x^0x83 - t9.Mul(t9, t3) - - // Step 20: t12 = x^0x99 - t12.Mul(t11, t9) - - // Step 21: t13 = x^0x9d - t13.Mul(t14, t12) - - // Step 22: t1 = x^0xbf - t1.Mul(t1, t13) - - // Step 23: t11 = x^0xd7 - t11.Mul(t0, t1) - - // Step 24: t14 = x^0xdb - t14.Mul(t14, t11) - - // Step 25: t15 = x^0xe7 - t15.Mul(t4, t14) - - // Step 26: t4 = x^0xef - t4.Mul(t0, t11) - - // Step 27: t0 = x^0xff - t0.Mul(t0, t15) - - // Step 35: t15 = x^0xe700 - for s := 0; s < 8; s++ { - t15.Square(t15) - } - - // Step 36: t14 = x^0xe7db - t14.Mul(t14, t15) - - // Step 45: t14 = x^0x1cfb600 - for s := 0; s < 9; s++ { - t14.Square(t14) - } - - // Step 46: t13 = x^0x1cfb69d - t13.Mul(t13, t14) - - // Step 55: t13 = x^0x39f6d3a00 - for s := 0; s < 9; s++ { - t13.Square(t13) - } - - // Step 56: t13 = x^0x39f6d3a99 - t13.Mul(t12, t13) - - // Step 65: t13 = x^0x73eda753200 - for s := 0; s < 9; s++ { - t13.Square(t13) - } - - // Step 66: t12 = x^0x73eda753299 - t12.Mul(t12, t13) - - // Step 74: t12 = x^0x73eda75329900 - for s := 0; s < 8; s++ { - t12.Square(t12) - } - - // Step 75: t11 = x^0x73eda753299d7 - t11.Mul(t11, t12) - - // Step 81: t11 = x^0x1cfb69d4ca675c0 - for s := 0; s < 6; s++ { - t11.Square(t11) - } - - // Step 82: t10 = x^0x1cfb69d4ca675f5 - t10.Mul(t10, t11) - - // Step 92: t10 = x^0x73eda753299d7d400 - for s := 0; s < 10; s++ { - t10.Square(t10) - } - - // Step 93: t9 = x^0x73eda753299d7d483 - t9.Mul(t9, t10) - - // Step 102: t9 = x^0xe7db4ea6533afa90600 - for s := 0; s < 9; s++ { - t9.Square(t9) - } - - // Step 103: t8 = x^0xe7db4ea6533afa90667 - t8.Mul(t8, t9) - - // Step 111: t8 = x^0xe7db4ea6533afa9066700 - for s := 0; s < 8; s++ { - t8.Square(t8) - } - - // Step 112: t8 = x^0xe7db4ea6533afa906673b - t8.Mul(t6, t8) - - // Step 120: t8 = x^0xe7db4ea6533afa906673b00 - for s := 0; s < 8; s++ { - t8.Square(t8) - } - - // Step 121: t8 = x^0xe7db4ea6533afa906673b01 - t8.Mul(&x, t8) - - // Step 135: t8 = x^0x39f6d3a994cebea4199cec04000 - for s := 0; s < 14; s++ { - t8.Square(t8) - } - - // Step 136: t7 = x^0x39f6d3a994cebea4199cec0404d - t7.Mul(t7, t8) - - // Step 146: t7 = x^0xe7db4ea6533afa906673b01013400 - for s := 0; s < 10; s++ { - t7.Square(t7) - } - - // Step 147: t6 = x^0xe7db4ea6533afa906673b0101343b - t6.Mul(t6, t7) - - // Step 162: t6 = x^0x73eda753299d7d483339d80809a1d8000 - for s := 0; s < 15; s++ { - t6.Square(t6) - } - - // Step 163: t5 = x^0x73eda753299d7d483339d80809a1d8055 - t5.Mul(t5, t6) - - // Step 173: t5 = x^0x1cfb69d4ca675f520cce7602026876015400 - for s := 0; s < 10; s++ { - t5.Square(t5) - } - - // Step 174: t4 = x^0x1cfb69d4ca675f520cce76020268760154ef - t4.Mul(t4, t5) - - // Step 182: t4 = x^0x1cfb69d4ca675f520cce76020268760154ef00 - for s := 0; s < 8; s++ { - t4.Square(t4) - } - - // Step 183: t3 = x^0x1cfb69d4ca675f520cce76020268760154ef69 - t3.Mul(t3, t4) - - // Step 199: t3 = x^0x1cfb69d4ca675f520cce76020268760154ef690000 - for s := 0; s < 16; s++ { - t3.Square(t3) - } - - // Step 200: t3 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bf - t3.Mul(t1, t3) - - // Step 208: t3 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bf00 - for s := 0; s < 8; s++ { - t3.Square(t3) - } - - // Step 209: t3 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff - t3.Mul(t0, t3) - - // Step 216: t3 = x^0xe7db4ea6533afa906673b0101343b00aa77b4805fff80 - for s := 0; s < 7; s++ { - t3.Square(t3) - } - - // Step 217: t2 = x^0xe7db4ea6533afa906673b0101343b00aa77b4805fffcb - t2.Mul(t2, t3) - - // Step 226: t2 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff9600 - for s := 0; s < 9; s++ { - t2.Square(t2) - } - - // Step 227: t2 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff96ff - t2.Mul(t0, t2) - - // Step 235: t2 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff96ff00 - for s := 0; s < 8; s++ { - t2.Square(t2) - } - - // Step 236: t1 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff96ffbf - t1.Mul(t1, t2) - - // Step 244: t1 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff96ffbf00 - for s := 0; s < 8; s++ { - t1.Square(t1) - } - - // Step 245: t1 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff96ffbfff - t1.Mul(t0, t1) - - // Step 253: t1 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff96ffbfff00 - for s := 0; s < 8; s++ { - t1.Square(t1) - } - - // Step 254: t1 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff96ffbfffff - t1.Mul(t0, t1) - - // Step 262: t1 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff96ffbfffff00 - for s := 0; s < 8; s++ { - t1.Square(t1) - } - - // Step 263: t0 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff96ffbfffffff - t0.Mul(t0, t1) - - // Step 265: t0 = x^0x73eda753299d7d483339d80809a1d80553bda402fffe5bfefffffffc - for s := 0; s < 2; s++ { - t0.Square(t0) - } - - // Step 266: z = x^0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff - z.Mul(z, t0) - - // Step 297: z = x^0x39f6d3a994cebea4199cec0404d0ec02a9ded2017fff2dff7fffffff80000000 - for s := 0; s < 31; s++ { - z.Square(z) - } - - return z -} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_mul_amd64.s b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_mul_amd64.s deleted file mode 100644 index ef89cc5df..000000000 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_mul_amd64.s +++ /dev/null @@ -1,487 +0,0 @@ -// +build !purego - -// Copyright 2020 ConsenSys Software 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. - -#include "textflag.h" -#include "funcdata.h" - -// modulus q -DATA q<>+0(SB)/8, $0xffffffff00000001 -DATA q<>+8(SB)/8, $0x53bda402fffe5bfe -DATA q<>+16(SB)/8, $0x3339d80809a1d805 -DATA q<>+24(SB)/8, $0x73eda753299d7d48 -GLOBL q<>(SB), (RODATA+NOPTR), $32 - -// qInv0 q'[0] -DATA qInv0<>(SB)/8, $0xfffffffeffffffff -GLOBL qInv0<>(SB), (RODATA+NOPTR), $8 - -#define REDUCE(ra0, ra1, ra2, ra3, rb0, rb1, rb2, rb3) \ - MOVQ ra0, rb0; \ - SUBQ q<>(SB), ra0; \ - MOVQ ra1, rb1; \ - SBBQ q<>+8(SB), ra1; \ - MOVQ ra2, rb2; \ - SBBQ q<>+16(SB), ra2; \ - MOVQ ra3, rb3; \ - SBBQ q<>+24(SB), ra3; \ - CMOVQCS rb0, ra0; \ - CMOVQCS rb1, ra1; \ - CMOVQCS rb2, ra2; \ - CMOVQCS rb3, ra3; \ - -// mul(res, x, y *Element) -TEXT ·mul(SB), $24-24 - - // the algorithm is described in the Element.Mul declaration (.go) - // however, to benefit from the ADCX and ADOX carry chains - // we split the inner loops in 2: - // for i=0 to N-1 - // for j=0 to N-1 - // (A,t[j]) := t[j] + x[j]*y[i] + A - // m := t[0]*q'[0] mod W - // C,_ := t[0] + m*q[0] - // for j=1 to N-1 - // (C,t[j-1]) := t[j] + m*q[j] + C - // t[N-1] = C + A - - NO_LOCAL_POINTERS - CMPB ·supportAdx(SB), $1 - JNE l1 - MOVQ x+8(FP), SI - - // x[0] -> DI - // x[1] -> R8 - // x[2] -> R9 - // x[3] -> R10 - MOVQ 0(SI), DI - MOVQ 8(SI), R8 - MOVQ 16(SI), R9 - MOVQ 24(SI), R10 - MOVQ y+16(FP), R11 - - // A -> BP - // t[0] -> R14 - // t[1] -> R13 - // t[2] -> CX - // t[3] -> BX - // clear the flags - XORQ AX, AX - MOVQ 0(R11), DX - - // (A,t[0]) := x[0]*y[0] + A - MULXQ DI, R14, R13 - - // (A,t[1]) := x[1]*y[0] + A - MULXQ R8, AX, CX - ADOXQ AX, R13 - - // (A,t[2]) := x[2]*y[0] + A - MULXQ R9, AX, BX - ADOXQ AX, CX - - // (A,t[3]) := x[3]*y[0] + A - MULXQ R10, AX, BP - ADOXQ AX, BX - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADOXQ AX, BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, R12 - ADCXQ R14, AX - MOVQ R12, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // t[3] = C + A - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ BP, BX - - // clear the flags - XORQ AX, AX - MOVQ 8(R11), DX - - // (A,t[0]) := t[0] + x[0]*y[1] + A - MULXQ DI, AX, BP - ADOXQ AX, R14 - - // (A,t[1]) := t[1] + x[1]*y[1] + A - ADCXQ BP, R13 - MULXQ R8, AX, BP - ADOXQ AX, R13 - - // (A,t[2]) := t[2] + x[2]*y[1] + A - ADCXQ BP, CX - MULXQ R9, AX, BP - ADOXQ AX, CX - - // (A,t[3]) := t[3] + x[3]*y[1] + A - ADCXQ BP, BX - MULXQ R10, AX, BP - ADOXQ AX, BX - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, R12 - ADCXQ R14, AX - MOVQ R12, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // t[3] = C + A - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ BP, BX - - // clear the flags - XORQ AX, AX - MOVQ 16(R11), DX - - // (A,t[0]) := t[0] + x[0]*y[2] + A - MULXQ DI, AX, BP - ADOXQ AX, R14 - - // (A,t[1]) := t[1] + x[1]*y[2] + A - ADCXQ BP, R13 - MULXQ R8, AX, BP - ADOXQ AX, R13 - - // (A,t[2]) := t[2] + x[2]*y[2] + A - ADCXQ BP, CX - MULXQ R9, AX, BP - ADOXQ AX, CX - - // (A,t[3]) := t[3] + x[3]*y[2] + A - ADCXQ BP, BX - MULXQ R10, AX, BP - ADOXQ AX, BX - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, R12 - ADCXQ R14, AX - MOVQ R12, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // t[3] = C + A - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ BP, BX - - // clear the flags - XORQ AX, AX - MOVQ 24(R11), DX - - // (A,t[0]) := t[0] + x[0]*y[3] + A - MULXQ DI, AX, BP - ADOXQ AX, R14 - - // (A,t[1]) := t[1] + x[1]*y[3] + A - ADCXQ BP, R13 - MULXQ R8, AX, BP - ADOXQ AX, R13 - - // (A,t[2]) := t[2] + x[2]*y[3] + A - ADCXQ BP, CX - MULXQ R9, AX, BP - ADOXQ AX, CX - - // (A,t[3]) := t[3] + x[3]*y[3] + A - ADCXQ BP, BX - MULXQ R10, AX, BP - ADOXQ AX, BX - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, R12 - ADCXQ R14, AX - MOVQ R12, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // t[3] = C + A - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ BP, BX - - // reduce element(R14,R13,CX,BX) using temp registers (SI,R12,R11,DI) - REDUCE(R14,R13,CX,BX,SI,R12,R11,DI) - - MOVQ res+0(FP), AX - MOVQ R14, 0(AX) - MOVQ R13, 8(AX) - MOVQ CX, 16(AX) - MOVQ BX, 24(AX) - RET - -l1: - MOVQ res+0(FP), AX - MOVQ AX, (SP) - MOVQ x+8(FP), AX - MOVQ AX, 8(SP) - MOVQ y+16(FP), AX - MOVQ AX, 16(SP) - CALL ·_mulGeneric(SB) - RET - -TEXT ·fromMont(SB), $8-8 - NO_LOCAL_POINTERS - - // the algorithm is described here - // https://hackmd.io/@gnark/modular_multiplication - // when y = 1 we have: - // for i=0 to N-1 - // t[i] = x[i] - // for i=0 to N-1 - // m := t[0]*q'[0] mod W - // C,_ := t[0] + m*q[0] - // for j=1 to N-1 - // (C,t[j-1]) := t[j] + m*q[j] + C - // t[N-1] = C - CMPB ·supportAdx(SB), $1 - JNE l2 - MOVQ res+0(FP), DX - MOVQ 0(DX), R14 - MOVQ 8(DX), R13 - MOVQ 16(DX), CX - MOVQ 24(DX), BX - XORQ DX, DX - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R14, AX - MOVQ BP, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ AX, BX - XORQ DX, DX - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R14, AX - MOVQ BP, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ AX, BX - XORQ DX, DX - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R14, AX - MOVQ BP, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ AX, BX - XORQ DX, DX - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R14, AX - MOVQ BP, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ AX, BX - - // reduce element(R14,R13,CX,BX) using temp registers (SI,DI,R8,R9) - REDUCE(R14,R13,CX,BX,SI,DI,R8,R9) - - MOVQ res+0(FP), AX - MOVQ R14, 0(AX) - MOVQ R13, 8(AX) - MOVQ CX, 16(AX) - MOVQ BX, 24(AX) - RET - -l2: - MOVQ res+0(FP), AX - MOVQ AX, (SP) - CALL ·_fromMontGeneric(SB) - RET diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_ops_amd64.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_ops_amd64.go deleted file mode 100644 index e40a9caed..000000000 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_ops_amd64.go +++ /dev/null @@ -1,107 +0,0 @@ -//go:build !purego -// +build !purego - -// Copyright 2020 ConsenSys Software 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. - -// Code generated by consensys/gnark-crypto DO NOT EDIT - -package fr - -//go:noescape -func MulBy3(x *Element) - -//go:noescape -func MulBy5(x *Element) - -//go:noescape -func MulBy13(x *Element) - -//go:noescape -func mul(res, x, y *Element) - -//go:noescape -func fromMont(res *Element) - -//go:noescape -func reduce(res *Element) - -// Butterfly sets -// -// a = a + b (mod q) -// b = a - b (mod q) -// -//go:noescape -func Butterfly(a, b *Element) - -// Mul z = x * y (mod q) -// -// x and y must be less than q -func (z *Element) Mul(x, y *Element) *Element { - - // Implements CIOS multiplication -- section 2.3.2 of Tolga Acar's thesis - // https://www.microsoft.com/en-us/research/wp-content/uploads/1998/06/97Acar.pdf - // - // The algorithm: - // - // for i=0 to N-1 - // C := 0 - // for j=0 to N-1 - // (C,t[j]) := t[j] + x[j]*y[i] + C - // (t[N+1],t[N]) := t[N] + C - // - // C := 0 - // m := t[0]*q'[0] mod D - // (C,_) := t[0] + m*q[0] - // for j=1 to N-1 - // (C,t[j-1]) := t[j] + m*q[j] + C - // - // (C,t[N-1]) := t[N] + C - // t[N] := t[N+1] + C - // - // → N is the number of machine words needed to store the modulus q - // → D is the word size. For example, on a 64-bit architecture D is 2 64 - // → x[i], y[i], q[i] is the ith word of the numbers x,y,q - // → q'[0] is the lowest word of the number -q⁻¹ mod r. This quantity is pre-computed, as it does not depend on the inputs. - // → t is a temporary array of size N+2 - // → C, S are machine words. A pair (C,S) refers to (hi-bits, lo-bits) of a two-word number - // - // As described here https://hackmd.io/@gnark/modular_multiplication we can get rid of one carry chain and simplify: - // (also described in https://eprint.iacr.org/2022/1400.pdf annex) - // - // for i=0 to N-1 - // (A,t[0]) := t[0] + x[0]*y[i] - // m := t[0]*q'[0] mod W - // C,_ := t[0] + m*q[0] - // for j=1 to N-1 - // (A,t[j]) := t[j] + x[j]*y[i] + A - // (C,t[j-1]) := t[j] + m*q[j] + C - // - // t[N-1] = C + A - // - // This optimization saves 5N + 2 additions in the algorithm, and can be used whenever the highest bit - // of the modulus is zero (and not all of the remaining bits are set). - - mul(z, x, y) - return z -} - -// Square z = x * x (mod q) -// -// x must be less than q -func (z *Element) Square(x *Element) *Element { - // see Mul for doc. - mul(z, x, x) - return z -} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_ops_amd64.s b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_ops_amd64.s deleted file mode 100644 index dde381328..000000000 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_ops_amd64.s +++ /dev/null @@ -1,230 +0,0 @@ -// +build !purego - -// Copyright 2020 ConsenSys Software 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. - -#include "textflag.h" -#include "funcdata.h" - -// modulus q -DATA q<>+0(SB)/8, $0xffffffff00000001 -DATA q<>+8(SB)/8, $0x53bda402fffe5bfe -DATA q<>+16(SB)/8, $0x3339d80809a1d805 -DATA q<>+24(SB)/8, $0x73eda753299d7d48 -GLOBL q<>(SB), (RODATA+NOPTR), $32 - -// qInv0 q'[0] -DATA qInv0<>(SB)/8, $0xfffffffeffffffff -GLOBL qInv0<>(SB), (RODATA+NOPTR), $8 - -#define REDUCE(ra0, ra1, ra2, ra3, rb0, rb1, rb2, rb3) \ - MOVQ ra0, rb0; \ - SUBQ q<>(SB), ra0; \ - MOVQ ra1, rb1; \ - SBBQ q<>+8(SB), ra1; \ - MOVQ ra2, rb2; \ - SBBQ q<>+16(SB), ra2; \ - MOVQ ra3, rb3; \ - SBBQ q<>+24(SB), ra3; \ - CMOVQCS rb0, ra0; \ - CMOVQCS rb1, ra1; \ - CMOVQCS rb2, ra2; \ - CMOVQCS rb3, ra3; \ - -TEXT ·reduce(SB), NOSPLIT, $0-8 - MOVQ res+0(FP), AX - MOVQ 0(AX), DX - MOVQ 8(AX), CX - MOVQ 16(AX), BX - MOVQ 24(AX), SI - - // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10) - - MOVQ DX, 0(AX) - MOVQ CX, 8(AX) - MOVQ BX, 16(AX) - MOVQ SI, 24(AX) - RET - -// MulBy3(x *Element) -TEXT ·MulBy3(SB), NOSPLIT, $0-8 - MOVQ x+0(FP), AX - MOVQ 0(AX), DX - MOVQ 8(AX), CX - MOVQ 16(AX), BX - MOVQ 24(AX), SI - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - - // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10) - - ADDQ 0(AX), DX - ADCQ 8(AX), CX - ADCQ 16(AX), BX - ADCQ 24(AX), SI - - // reduce element(DX,CX,BX,SI) using temp registers (R11,R12,R13,R14) - REDUCE(DX,CX,BX,SI,R11,R12,R13,R14) - - MOVQ DX, 0(AX) - MOVQ CX, 8(AX) - MOVQ BX, 16(AX) - MOVQ SI, 24(AX) - RET - -// MulBy5(x *Element) -TEXT ·MulBy5(SB), NOSPLIT, $0-8 - MOVQ x+0(FP), AX - MOVQ 0(AX), DX - MOVQ 8(AX), CX - MOVQ 16(AX), BX - MOVQ 24(AX), SI - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - - // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10) - - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - - // reduce element(DX,CX,BX,SI) using temp registers (R11,R12,R13,R14) - REDUCE(DX,CX,BX,SI,R11,R12,R13,R14) - - ADDQ 0(AX), DX - ADCQ 8(AX), CX - ADCQ 16(AX), BX - ADCQ 24(AX), SI - - // reduce element(DX,CX,BX,SI) using temp registers (R15,DI,R8,R9) - REDUCE(DX,CX,BX,SI,R15,DI,R8,R9) - - MOVQ DX, 0(AX) - MOVQ CX, 8(AX) - MOVQ BX, 16(AX) - MOVQ SI, 24(AX) - RET - -// MulBy13(x *Element) -TEXT ·MulBy13(SB), NOSPLIT, $0-8 - MOVQ x+0(FP), AX - MOVQ 0(AX), DX - MOVQ 8(AX), CX - MOVQ 16(AX), BX - MOVQ 24(AX), SI - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - - // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10) - - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - - // reduce element(DX,CX,BX,SI) using temp registers (R11,R12,R13,R14) - REDUCE(DX,CX,BX,SI,R11,R12,R13,R14) - - MOVQ DX, R11 - MOVQ CX, R12 - MOVQ BX, R13 - MOVQ SI, R14 - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - - // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10) - - ADDQ R11, DX - ADCQ R12, CX - ADCQ R13, BX - ADCQ R14, SI - - // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10) - - ADDQ 0(AX), DX - ADCQ 8(AX), CX - ADCQ 16(AX), BX - ADCQ 24(AX), SI - - // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10) - - MOVQ DX, 0(AX) - MOVQ CX, 8(AX) - MOVQ BX, 16(AX) - MOVQ SI, 24(AX) - RET - -// Butterfly(a, b *Element) sets a = a + b; b = a - b -TEXT ·Butterfly(SB), NOSPLIT, $0-16 - MOVQ a+0(FP), AX - MOVQ 0(AX), CX - MOVQ 8(AX), BX - MOVQ 16(AX), SI - MOVQ 24(AX), DI - MOVQ CX, R8 - MOVQ BX, R9 - MOVQ SI, R10 - MOVQ DI, R11 - XORQ AX, AX - MOVQ b+8(FP), DX - ADDQ 0(DX), CX - ADCQ 8(DX), BX - ADCQ 16(DX), SI - ADCQ 24(DX), DI - SUBQ 0(DX), R8 - SBBQ 8(DX), R9 - SBBQ 16(DX), R10 - SBBQ 24(DX), R11 - MOVQ $0xffffffff00000001, R12 - MOVQ $0x53bda402fffe5bfe, R13 - MOVQ $0x3339d80809a1d805, R14 - MOVQ $0x73eda753299d7d48, R15 - CMOVQCC AX, R12 - CMOVQCC AX, R13 - CMOVQCC AX, R14 - CMOVQCC AX, R15 - ADDQ R12, R8 - ADCQ R13, R9 - ADCQ R14, R10 - ADCQ R15, R11 - MOVQ R8, 0(DX) - MOVQ R9, 8(DX) - MOVQ R10, 16(DX) - MOVQ R11, 24(DX) - - // reduce element(CX,BX,SI,DI) using temp registers (R8,R9,R10,R11) - REDUCE(CX,BX,SI,DI,R8,R9,R10,R11) - - MOVQ a+0(FP), AX - MOVQ CX, 0(AX) - MOVQ BX, 8(AX) - MOVQ SI, 16(AX) - MOVQ DI, 24(AX) - RET diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_ops_purego.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_purego.go similarity index 80% rename from vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_ops_purego.go rename to vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_purego.go index 258157ab7..42ba2b9bb 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_ops_purego.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/element_purego.go @@ -1,19 +1,7 @@ -//go:build !amd64 || purego -// +build !amd64 purego +//go:build purego || (!amd64 && !arm64) -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -44,14 +32,6 @@ func MulBy13(x *Element) { x.Mul(x, &y) } -// Butterfly sets -// -// a = a + b (mod q) -// b = a - b (mod q) -func Butterfly(a, b *Element) { - _butterflyGeneric(a, b) -} - func fromMont(z *Element) { _fromMontGeneric(z) } @@ -65,48 +45,8 @@ func reduce(z *Element) { // x and y must be less than q func (z *Element) Mul(x, y *Element) *Element { - // Implements CIOS multiplication -- section 2.3.2 of Tolga Acar's thesis - // https://www.microsoft.com/en-us/research/wp-content/uploads/1998/06/97Acar.pdf - // - // The algorithm: - // - // for i=0 to N-1 - // C := 0 - // for j=0 to N-1 - // (C,t[j]) := t[j] + x[j]*y[i] + C - // (t[N+1],t[N]) := t[N] + C - // - // C := 0 - // m := t[0]*q'[0] mod D - // (C,_) := t[0] + m*q[0] - // for j=1 to N-1 - // (C,t[j-1]) := t[j] + m*q[j] + C - // - // (C,t[N-1]) := t[N] + C - // t[N] := t[N+1] + C - // - // → N is the number of machine words needed to store the modulus q - // → D is the word size. For example, on a 64-bit architecture D is 2 64 - // → x[i], y[i], q[i] is the ith word of the numbers x,y,q - // → q'[0] is the lowest word of the number -q⁻¹ mod r. This quantity is pre-computed, as it does not depend on the inputs. - // → t is a temporary array of size N+2 - // → C, S are machine words. A pair (C,S) refers to (hi-bits, lo-bits) of a two-word number - // - // As described here https://hackmd.io/@gnark/modular_multiplication we can get rid of one carry chain and simplify: - // (also described in https://eprint.iacr.org/2022/1400.pdf annex) - // - // for i=0 to N-1 - // (A,t[0]) := t[0] + x[0]*y[i] - // m := t[0]*q'[0] mod W - // C,_ := t[0] + m*q[0] - // for j=1 to N-1 - // (A,t[j]) := t[j] + x[j]*y[i] + A - // (C,t[j-1]) := t[j] + m*q[j] + C - // - // t[N-1] = C + A - // - // This optimization saves 5N + 2 additions in the algorithm, and can be used whenever the highest bit - // of the modulus is zero (and not all of the remaining bits are set). + // Algorithm 2 of "Faster Montgomery Multiplication and Multi-Scalar-Multiplication for SNARKS" + // by Y. El Housni and G. Botrel https://doi.org/10.46586/tches.v2023.i3.504-521 var t0, t1, t2, t3 uint64 var u0, u1, u2, u3 uint64 @@ -441,3 +381,11 @@ func (z *Element) Square(x *Element) *Element { } return z } + +// Butterfly sets +// +// a = a + b (mod q) +// b = a - b (mod q) +func Butterfly(a, b *Element) { + _butterflyGeneric(a, b) +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/generator.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/generator.go new file mode 100644 index 000000000..a0d24d2b3 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/generator.go @@ -0,0 +1,36 @@ +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package fr + +import ( + "fmt" + "math/big" + "math/bits" + + "github.com/consensys/gnark-crypto/ecc" +) + +// Generator returns a generator for Z/2^(log(m))Z +// or an error if m is too big (required root of unity doesn't exist) +func Generator(m uint64) (Element, error) { + x := ecc.NextPowerOfTwo(m) + + var rootOfUnity Element + + rootOfUnity.SetString("10238227357739495823651030575849232062558860180284477541189508159991286009131") + const maxOrderRoot uint64 = 32 + + // find generator for Z/2^(log(m))Z + logx := uint64(bits.TrailingZeros64(x)) + if logx > maxOrderRoot { + return Element{}, fmt.Errorf("m (%d) is too big: the required root of unity does not exist", m) + } + + expo := uint64(1 << (maxOrderRoot - logx)) + var generator Element + generator.Exp(rootOfUnity, big.NewInt(int64(expo))) // order x + return generator, nil +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/vector.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/vector.go index 00ad8a898..eee2062de 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/vector.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/vector.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -19,9 +8,12 @@ package fr import ( "bytes" "encoding/binary" + "errors" "fmt" "io" + "math/bits" "runtime" + "slices" "strings" "sync" "sync/atomic" @@ -78,40 +70,84 @@ func (vector *Vector) WriteTo(w io.Writer) (int64, error) { return n, nil } -// AsyncReadFrom reads a vector of big endian encoded Element. -// Length of the vector must be encoded as a uint32 on the first 4 bytes. -// It consumes the needed bytes from the reader and returns the number of bytes read and an error if any. -// It also returns a channel that will be closed when the validation is done. -// The validation consist of checking that the elements are smaller than the modulus, and -// converting them to montgomery form. -func (vector *Vector) AsyncReadFrom(r io.Reader) (int64, error, chan error) { +// AsyncReadFrom implements an asynchronous version of [Vector.ReadFrom]. It +// reads the reader r in full and then performs the validation and conversion to +// Montgomery form separately in a goroutine. Any error encountered during +// reading is returned directly, while errors encountered during +// validation/conversion are sent on the returned channel. Thus the caller must +// wait on the channel to ensure the vector is ready to use. The method +// additionally returns the number of bytes read from r. +// +// The errors during reading can be: +// - an error while reading from r; +// - not enough bytes in r to read the full vector indicated by header. +// +// The reader can contain more bytes than needed to decode the vector, in which +// case the extra bytes are ignored. In that case the reader is not seeked nor +// read further. +// +// The method allocates sufficiently large slice to store the vector. If the +// current slice fits the vector, it is reused, otherwise the slice is grown to +// fit the vector. +// +// The serialized encoding is as follows: +// - first 4 bytes: length of the vector as a big-endian uint32 +// - for each element of the vector, [Bytes] bytes representing the element in +// big-endian encoding. +func (vector *Vector) AsyncReadFrom(r io.Reader) (int64, error, chan error) { // nolint ST1008 chErr := make(chan error, 1) var buf [Bytes]byte if read, err := io.ReadFull(r, buf[:4]); err != nil { close(chErr) return int64(read), err, chErr } - sliceLen := binary.BigEndian.Uint32(buf[:4]) - - n := int64(4) - (*vector) = make(Vector, sliceLen) - if sliceLen == 0 { + headerSliceLen := uint64(binary.BigEndian.Uint32(buf[:4])) + + // to avoid allocating too large slice when the header is tampered, we limit + // the maximum allocation. We set the target to 4GB. This incurs a performance + // hit when reading very large slices, but protects against OOM. + targetSize := uint64(1 << 32) // 4GB + if bits.UintSize == 32 { + // reduce target size to 1GB on 32 bits architectures + targetSize = uint64(1 << 30) // 1GB + } + maxAllocateSliceLength := targetSize / uint64(Bytes) + + totalRead := int64(4) + *vector = (*vector)[:0] + if headerSliceLen == 0 { + // if the vector was nil previously even by reslicing we have a nil vector. + // but we want to have an empty slice to indicate that the vector has zero length. + if *vector == nil { + *vector = []Element{} + } + // we return already here to avoid launching a goroutine doing nothing below close(chErr) - return n, nil, chErr + return totalRead, nil, chErr } - bSlice := unsafe.Slice((*byte)(unsafe.Pointer(&(*vector)[0])), sliceLen*Bytes) - read, err := io.ReadFull(r, bSlice) - n += int64(read) - if err != nil { - close(chErr) - return n, err, chErr + for i := uint64(0); i < headerSliceLen; i += maxAllocateSliceLength { + if len(*vector) <= int(i) { + (*vector) = append(*vector, make([]Element, int(min(headerSliceLen-i, maxAllocateSliceLength)))...) + } + bSlice := unsafe.Slice((*byte)(unsafe.Pointer(&(*vector)[i])), int(min(headerSliceLen-i, maxAllocateSliceLength))*Bytes) + read, err := io.ReadFull(r, bSlice) + totalRead += int64(read) + if errors.Is(err, io.ErrUnexpectedEOF) { + close(chErr) + return totalRead, fmt.Errorf("less data than expected: read %d elements, expected %d", i+uint64(read)/Bytes, headerSliceLen), chErr + } + if err != nil { + close(chErr) + return totalRead, err, chErr + } } + bSlice := unsafe.Slice((*byte)(unsafe.Pointer(&(*vector)[0])), int(headerSliceLen)*Bytes) go func() { var cptErrors uint64 // process the elements in parallel - execute(int(sliceLen), func(start, end int) { + execute(int(headerSliceLen), func(start, end int) { var z Element for i := start; i < end; i++ { @@ -138,35 +174,72 @@ func (vector *Vector) AsyncReadFrom(r io.Reader) (int64, error, chan error) { } close(chErr) }() - return n, nil, chErr + return totalRead, nil, chErr } -// ReadFrom implements io.ReaderFrom and reads a vector of big endian encoded Element. -// Length of the vector must be encoded as a uint32 on the first 4 bytes. +// ReadFrom reads the vector from the reader r. It returns the number of bytes +// read and an error, if any. The errors can be: +// - an error while reading from r; +// - not enough bytes in r to read the full vector indicated by header; +// - when decoding the bytes into elements. +// +// The reader can contain more bytes than needed to decode the vector, in which case +// the extra bytes are ignored. In that case the reader is not seeked nor read further. +// +// The method allocates sufficiently large slice to store the vector. If the current slice fits +// the vector, it is reused, otherwise the slice is grown to fit the vector. +// +// The serialized encoding is as follows: +// - first 4 bytes: length of the vector as a big-endian uint32 +// - for each element of the vector, [Bytes] bytes representing the element in big-endian encoding. +// +// The method implements [io.ReaderFrom] interface. func (vector *Vector) ReadFrom(r io.Reader) (int64, error) { - var buf [Bytes]byte if read, err := io.ReadFull(r, buf[:4]); err != nil { return int64(read), err } - sliceLen := binary.BigEndian.Uint32(buf[:4]) - - n := int64(4) - (*vector) = make(Vector, sliceLen) + headerSliceLen := uint64(binary.BigEndian.Uint32(buf[:4])) + + // to avoid allocating too large slice when the header is tampered, we limit + // the maximum allocation. We set the target to 4GB. This incurs a performance + // hit when reading very large slices, but protects against OOM. + targetSize := uint64(1 << 32) // 4GB + if bits.UintSize == 32 { + // reduce target size to 1GB on 32 bits architectures + targetSize = uint64(1 << 30) // 1GB + } + maxAllocateSliceLength := targetSize / uint64(Bytes) + + totalRead := int64(4) // include already the header length + *vector = (*vector)[:0] + // if the vector was nil previously even by reslicing we have a nil vector. But we want + // to have an empty slice to indicate that the vector has zero length. When headerSliceLen == 0 + // we handle this edge case after reading the header as the loop body below is skipped. + if headerSliceLen == 0 && *vector == nil { + *vector = []Element{} + } - for i := 0; i < int(sliceLen); i++ { + for i := uint64(0); i < headerSliceLen; i++ { read, err := io.ReadFull(r, buf[:]) - n += int64(read) + totalRead += int64(read) + if errors.Is(err, io.ErrUnexpectedEOF) { + return totalRead, fmt.Errorf("less data than expected: read %d elements, expected %d", i, headerSliceLen) + } if err != nil { - return n, err + return totalRead, fmt.Errorf("error reading element %d: %w", i, err) } - (*vector)[i], err = BigEndian.Element(&buf) + if uint64(cap(*vector)) <= i { + (*vector) = slices.Grow(*vector, int(min(headerSliceLen-i, maxAllocateSliceLength))) + } + el, err := BigEndian.Element(&buf) if err != nil { - return n, err + return totalRead, fmt.Errorf("error decoding element %d: %w", i, err) } + *vector = append(*vector, el) } - return n, nil + return totalRead, nil } // String implements fmt.Stringer interface @@ -199,6 +272,88 @@ func (vector Vector) Swap(i, j int) { vector[i], vector[j] = vector[j], vector[i] } +// SetRandom sets the elements in vector to independent uniform random values in [0, q). +// +// This might error only if reading from crypto/rand.Reader errors, +// in which case the values in vector are undefined. +func (vector Vector) SetRandom() error { + for i := range vector { + if _, err := vector[i].SetRandom(); err != nil { + return err + } + } + return nil +} + +// MustSetRandom sets the elements in vector to independent uniform random values in [0, q). +// +// It panics if reading from crypto/rand.Reader errors. +func (vector Vector) MustSetRandom() { + for i := range vector { + if _, err := vector[i].SetRandom(); err != nil { + panic(err) + } + } +} + +// Equal returns true if vector and other have the same length and same elements. +func (vector Vector) Equal(other Vector) bool { + return slices.Equal(vector, other) +} + +func addVecGeneric(res, a, b Vector) { + if len(a) != len(b) || len(a) != len(res) { + panic("vector.Add: vectors don't have the same length") + } + for i := 0; i < len(a); i++ { + res[i].Add(&a[i], &b[i]) + } +} + +func subVecGeneric(res, a, b Vector) { + if len(a) != len(b) || len(a) != len(res) { + panic("vector.Sub: vectors don't have the same length") + } + for i := 0; i < len(a); i++ { + res[i].Sub(&a[i], &b[i]) + } +} + +func scalarMulVecGeneric(res, a Vector, b *Element) { + if len(a) != len(res) { + panic("vector.ScalarMul: vectors don't have the same length") + } + for i := 0; i < len(a); i++ { + res[i].Mul(&a[i], b) + } +} + +func sumVecGeneric(res *Element, a Vector) { + for i := 0; i < len(a); i++ { + res.Add(res, &a[i]) + } +} + +func innerProductVecGeneric(res *Element, a, b Vector) { + if len(a) != len(b) { + panic("vector.InnerProduct: vectors don't have the same length") + } + var tmp Element + for i := 0; i < len(a); i++ { + tmp.Mul(&a[i], &b[i]) + res.Add(res, &tmp) + } +} + +func mulVecGeneric(res, a, b Vector) { + if len(a) != len(b) || len(a) != len(res) { + panic("vector.Mul: vectors don't have the same length") + } + for i := 0; i < len(a); i++ { + res[i].Mul(&a[i], &b[i]) + } +} + // TODO @gbotrel make a public package out of that. // execute executes the work function in parallel. // this is copy paste from internal/parallel/parallel.go diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/vector_amd64.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/vector_amd64.go new file mode 100644 index 000000000..d7d56cd46 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/vector_amd64.go @@ -0,0 +1,154 @@ +//go:build !purego + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package fr + +import ( + _ "github.com/consensys/gnark-crypto/field/asm/element_4w" + "github.com/consensys/gnark-crypto/utils/cpu" +) + +// Add adds two vectors element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) Add(a, b Vector) { + if len(a) != len(b) || len(a) != len(*vector) { + panic("vector.Add: vectors don't have the same length") + } + n := uint64(len(a)) + addVec(&(*vector)[0], &a[0], &b[0], n) +} + +//go:noescape +func addVec(res, a, b *Element, n uint64) + +// Sub subtracts two vectors element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) Sub(a, b Vector) { + if len(a) != len(b) || len(a) != len(*vector) { + panic("vector.Sub: vectors don't have the same length") + } + subVec(&(*vector)[0], &a[0], &b[0], uint64(len(a))) +} + +//go:noescape +func subVec(res, a, b *Element, n uint64) + +// ScalarMul multiplies a vector by a scalar element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) ScalarMul(a Vector, b *Element) { + if len(a) != len(*vector) { + panic("vector.ScalarMul: vectors don't have the same length") + } + const maxN = (1 << 32) - 1 + if !cpu.SupportAVX512 || uint64(len(a)) >= maxN { + // call scalarMulVecGeneric + scalarMulVecGeneric(*vector, a, b) + return + } + n := uint64(len(a)) + if n == 0 { + return + } + // the code for scalarMul is identical to mulVec; and it expects at least + // 2 elements in the vector to fill the Z registers + var bb [2]Element + bb[0] = *b + bb[1] = *b + const blockSize = 16 + scalarMulVec(&(*vector)[0], &a[0], &bb[0], n/blockSize, qInvNeg, &patterns[0]) + if n%blockSize != 0 { + // call scalarMulVecGeneric on the rest + start := n - n%blockSize + scalarMulVecGeneric((*vector)[start:], a[start:], b) + } +} + +//go:noescape +func scalarMulVec(res, a, b *Element, n uint64, qInvNeg uint64, patterns *uint64) + +// Sum computes the sum of all elements in the vector. +func (vector *Vector) Sum() (res Element) { + n := uint64(len(*vector)) + if n == 0 { + return + } + const minN = 16 * 7 // AVX512 slower than generic for small n + const maxN = (1 << 32) - 1 + if !cpu.SupportAVX512 || n <= minN || n >= maxN { + // call sumVecGeneric + sumVecGeneric(&res, *vector) + return + } + sumVec(&res, &(*vector)[0], uint64(len(*vector))) + return +} + +//go:noescape +func sumVec(res *Element, a *Element, n uint64) + +// InnerProduct computes the inner product of two vectors. +// It panics if the vectors don't have the same length. +func (vector *Vector) InnerProduct(other Vector) (res Element) { + n := uint64(len(*vector)) + if n == 0 { + return + } + if n != uint64(len(other)) { + panic("vector.InnerProduct: vectors don't have the same length") + } + const maxN = (1 << 32) - 1 + if !cpu.SupportAVX512 || n >= maxN { + // call innerProductVecGeneric + // note; we could split the vector into smaller chunks and call innerProductVec + innerProductVecGeneric(&res, *vector, other) + return + } + innerProdVec(&res[0], &(*vector)[0], &other[0], uint64(len(*vector))) + + return +} + +//go:noescape +func innerProdVec(res *uint64, a, b *Element, n uint64) + +// Mul multiplies two vectors element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) Mul(a, b Vector) { + if len(a) != len(b) || len(a) != len(*vector) { + panic("vector.Mul: vectors don't have the same length") + } + n := uint64(len(a)) + if n == 0 { + return + } + const maxN = (1 << 32) - 1 + if !cpu.SupportAVX512 || n >= maxN { + // call mulVecGeneric + mulVecGeneric(*vector, a, b) + return + } + + const blockSize = 16 + mulVec(&(*vector)[0], &a[0], &b[0], n/blockSize, qInvNeg, &patterns[0]) + if n%blockSize != 0 { + // call mulVecGeneric on the rest + start := n - n%blockSize + mulVecGeneric((*vector)[start:], a[start:], b[start:]) + } + +} + +// Patterns use for transposing the vectors in mulVec +var ( + patterns = [8 * 4]uint64{0, 8, 1, 9, 2, 10, 3, 11, + 12, 4, 13, 5, 14, 6, 15, 7, + 0, 1, 8, 9, 2, 3, 10, 11, + 12, 13, 4, 5, 14, 15, 6, 7} +) + +//go:noescape +func mulVec(res, a, b *Element, n uint64, qInvNeg uint64, patterns *uint64) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/vector_purego.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/vector_purego.go new file mode 100644 index 000000000..6608e394c --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/fr/vector_purego.go @@ -0,0 +1,45 @@ +//go:build purego || !amd64 + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package fr + +// Add adds two vectors element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) Add(a, b Vector) { + addVecGeneric(*vector, a, b) +} + +// Sub subtracts two vectors element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) Sub(a, b Vector) { + subVecGeneric(*vector, a, b) +} + +// ScalarMul multiplies a vector by a scalar element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) ScalarMul(a Vector, b *Element) { + scalarMulVecGeneric(*vector, a, b) +} + +// Sum computes the sum of all elements in the vector. +func (vector *Vector) Sum() (res Element) { + sumVecGeneric(&res, *vector) + return +} + +// InnerProduct computes the inner product of two vectors. +// It panics if the vectors don't have the same length. +func (vector *Vector) InnerProduct(other Vector) (res Element) { + innerProductVecGeneric(&res, *vector, other) + return +} + +// Mul multiplies two vectors element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) Mul(a, b Vector) { + mulVecGeneric(*vector, a, b) +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/g1.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/g1.go index c24a82cda..ee79e19e6 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/g1.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/g1.go @@ -1,16 +1,5 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -20,112 +9,155 @@ import ( "github.com/consensys/gnark-crypto/ecc" "github.com/consensys/gnark-crypto/ecc/bls12-381/fp" "github.com/consensys/gnark-crypto/ecc/bls12-381/fr" + "github.com/consensys/gnark-crypto/ecc/bls12-381/hash_to_curve" "github.com/consensys/gnark-crypto/internal/parallel" "math/big" "runtime" ) -// G1Affine point in affine coordinates +// G1Affine is a point in affine coordinates (x,y) type G1Affine struct { X, Y fp.Element } -// G1Jac is a point with fp.Element coordinates +// G1Jac is a point in Jacobian coordinates (x=X/Z², y=Y/Z³) type G1Jac struct { X, Y, Z fp.Element } -// g1JacExtended parameterized Jacobian coordinates (x=X/ZZ, y=Y/ZZZ, ZZ³=ZZZ²) +// g1JacExtended is a point in extended Jacobian coordinates (x=X/ZZ, y=Y/ZZZ, ZZ³=ZZZ²) type g1JacExtended struct { X, Y, ZZ, ZZZ fp.Element } // ------------------------------------------------------------------------------------------------- -// Affine +// Affine coordinates -// Set sets p to the provided point +// Set sets p to a in affine coordinates. func (p *G1Affine) Set(a *G1Affine) *G1Affine { p.X, p.Y = a.X, a.Y return p } -// setInfinity sets p to O -func (p *G1Affine) setInfinity() *G1Affine { +// SetInfinity sets p to the infinity point, which is encoded as (0,0). +// N.B.: (0,0) is never on the curve for j=0 curves (Y²=X³+B). +func (p *G1Affine) SetInfinity() *G1Affine { p.X.SetZero() p.Y.SetZero() return p } -// ScalarMultiplication computes and returns p = a ⋅ s +// ScalarMultiplication computes and returns p = [s]a +// where p and a are affine points. func (p *G1Affine) ScalarMultiplication(a *G1Affine, s *big.Int) *G1Affine { var _p G1Jac _p.FromAffine(a) - _p.mulGLV(&_p, s) + if s.BitLen() >= g1ScalarMulChoose { + _p.mulGLV(&_p, s) + } else { + _p.mulWindowed(&_p, s) + } p.FromJacobian(&_p) return p } -// ScalarMultiplicationAffine computes and returns p = a ⋅ s -// Takes an affine point and returns a Jacobian point (useful for KZG) -func (p *G1Jac) ScalarMultiplicationAffine(a *G1Affine, s *big.Int) *G1Jac { - p.FromAffine(a) - p.mulGLV(p, s) - return p -} - -// ScalarMultiplicationBase computes and returns p = g ⋅ s where g is the prime subgroup generator +// ScalarMultiplicationBase computes and returns p = [s]g +// where g is the affine point generating the prime subgroup. func (p *G1Affine) ScalarMultiplicationBase(s *big.Int) *G1Affine { var _p G1Jac - _p.mulGLV(&g1Gen, s) + if s.BitLen() >= g1ScalarMulChoose { + _p.mulGLV(&g1Gen, s) + } else { + _p.mulWindowed(&g1Gen, s) + } p.FromJacobian(&_p) return p } -// Add adds two point in affine coordinates. -// This should rarely be used as it is very inefficient compared to Jacobian +// Add adds two points in affine coordinates. +// It uses the Jacobian addition with a.Z=b.Z=1 and converts the result to affine coordinates. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-mmadd-2007-bl +// ~Cost: 4M + 2S func (p *G1Affine) Add(a, b *G1Affine) *G1Affine { - var p1, p2 G1Jac - p1.FromAffine(a) - p2.FromAffine(b) - p1.AddAssign(&p2) - p.FromJacobian(&p1) - return p + var q G1Jac + // a is infinity, return b + if a.IsInfinity() { + p.Set(b) + return p + } + // b is infinity, return a + if b.IsInfinity() { + p.Set(a) + return p + } + if a.X.Equal(&b.X) { + // if b == a, we double instead + if a.Y.Equal(&b.Y) { + q.DoubleMixed(a) + return p.FromJacobian(&q) + } else { + // if b == -a, we return 0 + return p.SetInfinity() + } + } + var H, HH, I, J, r, V fp.Element + H.Sub(&b.X, &a.X) + HH.Square(&H) + I.Double(&HH).Double(&I) + J.Mul(&H, &I) + r.Sub(&b.Y, &a.Y) + r.Double(&r) + V.Mul(&a.X, &I) + q.X.Square(&r). + Sub(&q.X, &J). + Sub(&q.X, &V). + Sub(&q.X, &V) + q.Y.Sub(&V, &q.X). + Mul(&q.Y, &r) + J.Mul(&a.Y, &J).Double(&J) + q.Y.Sub(&q.Y, &J) + q.Z.Double(&H) + + return p.FromJacobian(&q) } // Double doubles a point in affine coordinates. -// This should rarely be used as it is very inefficient compared to Jacobian +// It converts the point to Jacobian coordinates, doubles it using Jacobian +// addition with a.Z=1, and converts it back to affine coordinates. +// +// http://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-mdbl-2007-bl +// ~Cost: 1M + 5S func (p *G1Affine) Double(a *G1Affine) *G1Affine { - var p1 G1Jac - p1.FromAffine(a) - p1.Double(&p1) - p.FromJacobian(&p1) + var q G1Jac + q.FromAffine(a) + q.DoubleMixed(a) + p.FromJacobian(&q) return p } -// Sub subs two point in affine coordinates. -// This should rarely be used as it is very inefficient compared to Jacobian +// Sub subtracts two points in affine coordinates. +// It uses a similar approach to Add, but negates the second point before adding. func (p *G1Affine) Sub(a, b *G1Affine) *G1Affine { - var p1, p2 G1Jac - p1.FromAffine(a) - p2.FromAffine(b) - p1.SubAssign(&p2) - p.FromJacobian(&p1) + var bneg G1Affine + bneg.Neg(b) + p.Add(a, &bneg) return p } -// Equal tests if two points (in Affine coordinates) are equal +// Equal tests if two points in affine coordinates are equal. func (p *G1Affine) Equal(a *G1Affine) bool { return p.X.Equal(&a.X) && p.Y.Equal(&a.Y) } -// Neg computes -G +// Neg sets p to the affine negative point -a = (a.X, -a.Y). func (p *G1Affine) Neg(a *G1Affine) *G1Affine { p.X = a.X p.Y.Neg(&a.Y) return p } -// FromJacobian rescales a point in Jacobian coord in z=1 plane +// FromJacobian converts a point p1 from Jacobian to affine coordinates. func (p *G1Affine) FromJacobian(p1 *G1Jac) *G1Affine { var a, b fp.Element @@ -144,7 +176,7 @@ func (p *G1Affine) FromJacobian(p1 *G1Jac) *G1Affine { return p } -// String returns the string representation of the point or "O" if it is infinity +// String returns the string representation E(x,y) of the affine point p or "O" if it is infinity. func (p *G1Affine) String() string { if p.IsInfinity() { return "O" @@ -152,106 +184,111 @@ func (p *G1Affine) String() string { return "E([" + p.X.String() + "," + p.Y.String() + "])" } -// IsInfinity checks if the point is infinity -// in affine, it's encoded as (0,0) -// (0,0) is never on the curve for j=0 curves +// IsInfinity checks if the affine point p is infinity, which is encoded as (0,0). +// N.B.: (0,0) is never on the curve for j=0 curves (Y²=X³+B). func (p *G1Affine) IsInfinity() bool { return p.X.IsZero() && p.Y.IsZero() } -// IsOnCurve returns true if p in on the curve +// IsOnCurve returns true if the affine point p in on the curve. func (p *G1Affine) IsOnCurve() bool { - var point G1Jac - point.FromAffine(p) - return point.IsOnCurve() // call this function to handle infinity point + if p.IsInfinity() { + return true + } + var left, right fp.Element + left.Square(&p.Y) + right.Square(&p.X).Mul(&right, &p.X) + right.Add(&right, &bCurveCoeff) + return left.Equal(&right) } -// IsInSubGroup returns true if p is in the correct subgroup, false otherwise +// IsInSubGroup returns true if the affine point p is in the correct subgroup, false otherwise. func (p *G1Affine) IsInSubGroup() bool { - var _p G1Jac + if !p.IsOnCurve() { + return false + } + var res, _p G1Jac _p.FromAffine(p) - return _p.IsInSubGroup() + res.phi(&_p). + mulBySeed(&res). + mulBySeed(&res). + Neg(&res) + + return res.Equal(&_p) } // ------------------------------------------------------------------------------------------------- -// Jacobian +// Jacobian coordinates -// Set sets p to the provided point -func (p *G1Jac) Set(a *G1Jac) *G1Jac { - p.X, p.Y, p.Z = a.X, a.Y, a.Z +// Set sets p to a in Jacobian coordinates. +func (p *G1Jac) Set(q *G1Jac) *G1Jac { + p.X, p.Y, p.Z = q.X, q.Y, q.Z return p } -// Equal tests if two points (in Jacobian coordinates) are equal -func (p *G1Jac) Equal(a *G1Jac) bool { +// Equal tests if two points in Jacobian coordinates are equal. +func (p *G1Jac) Equal(q *G1Jac) bool { // If one point is infinity, the other must also be infinity. if p.Z.IsZero() { - return a.Z.IsZero() + return q.Z.IsZero() } // If the other point is infinity, return false since we can't // the following checks would be incorrect. - if a.Z.IsZero() { + if q.Z.IsZero() { return false } var pZSquare, aZSquare fp.Element pZSquare.Square(&p.Z) - aZSquare.Square(&a.Z) + aZSquare.Square(&q.Z) var lhs, rhs fp.Element lhs.Mul(&p.X, &aZSquare) - rhs.Mul(&a.X, &pZSquare) + rhs.Mul(&q.X, &pZSquare) if !lhs.Equal(&rhs) { return false } - lhs.Mul(&p.Y, &aZSquare).Mul(&lhs, &a.Z) - rhs.Mul(&a.Y, &pZSquare).Mul(&rhs, &p.Z) + lhs.Mul(&p.Y, &aZSquare).Mul(&lhs, &q.Z) + rhs.Mul(&q.Y, &pZSquare).Mul(&rhs, &p.Z) return lhs.Equal(&rhs) } -// Neg computes -G -func (p *G1Jac) Neg(a *G1Jac) *G1Jac { - *p = *a - p.Y.Neg(&a.Y) +// Neg sets p to the Jacobian negative point -q = (q.X, -q.Y, q.Z). +func (p *G1Jac) Neg(q *G1Jac) *G1Jac { + *p = *q + p.Y.Neg(&q.Y) return p } -// SubAssign subtracts two points on the curve -func (p *G1Jac) SubAssign(a *G1Jac) *G1Jac { - var tmp G1Jac - tmp.Set(a) - tmp.Y.Neg(&tmp.Y) - p.AddAssign(&tmp) - return p -} - -// AddAssign point addition in montgomery form -// https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#addition-add-2007-bl -func (p *G1Jac) AddAssign(a *G1Jac) *G1Jac { +// AddAssign sets p to p+a in Jacobian coordinates. +// +// https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-add-2007-bl +// ~Cost: 11M + 5S +func (p *G1Jac) AddAssign(q *G1Jac) *G1Jac { - // p is infinity, return a + // p is infinity, return q if p.Z.IsZero() { - p.Set(a) + p.Set(q) return p } - // a is infinity, return p - if a.Z.IsZero() { + // q is infinity, return p + if q.Z.IsZero() { return p } var Z1Z1, Z2Z2, U1, U2, S1, S2, H, I, J, r, V fp.Element - Z1Z1.Square(&a.Z) + Z1Z1.Square(&q.Z) Z2Z2.Square(&p.Z) - U1.Mul(&a.X, &Z2Z2) + U1.Mul(&q.X, &Z2Z2) U2.Mul(&p.X, &Z1Z1) - S1.Mul(&a.Y, &p.Z). + S1.Mul(&q.Y, &p.Z). Mul(&S1, &Z2Z2) - S2.Mul(&p.Y, &a.Z). + S2.Mul(&p.Y, &q.Z). Mul(&S2, &Z1Z1) - // if p == a, we double instead + // if p == q, we double instead if U1.Equal(&U2) && S1.Equal(&S2) { return p.DoubleAssign() } @@ -270,7 +307,7 @@ func (p *G1Jac) AddAssign(a *G1Jac) *G1Jac { Mul(&p.Y, &r) S1.Mul(&S1, &J).Double(&S1) p.Y.Sub(&p.Y, &S1) - p.Z.Add(&p.Z, &a.Z) + p.Z.Add(&p.Z, &q.Z) p.Z.Square(&p.Z). Sub(&p.Z, &Z1Z1). Sub(&p.Z, &Z2Z2). @@ -279,8 +316,51 @@ func (p *G1Jac) AddAssign(a *G1Jac) *G1Jac { return p } -// AddMixed point addition +// SubAssign sets p to p-a in Jacobian coordinates. +// It uses a similar approach to AddAssign, but negates the point a before adding. +func (p *G1Jac) SubAssign(q *G1Jac) *G1Jac { + var tmp G1Jac + tmp.Set(q) + tmp.Y.Neg(&tmp.Y) + p.AddAssign(&tmp) + return p +} + +// Double sets p to [2]q in Jacobian coordinates. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-mdbl-2007-bl +// ~Cost: 1M + 5S +func (p *G1Jac) DoubleMixed(a *G1Affine) *G1Jac { + var XX, YY, YYYY, S, M, T fp.Element + XX.Square(&a.X) + YY.Square(&a.Y) + YYYY.Square(&YY) + S.Add(&a.X, &YY). + Square(&S). + Sub(&S, &XX). + Sub(&S, &YYYY). + Double(&S) + M.Double(&XX). + Add(&M, &XX) // -> + A, but A=0 here + T.Square(&M). + Sub(&T, &S). + Sub(&T, &S) + p.X.Set(&T) + p.Y.Sub(&S, &T). + Mul(&p.Y, &M) + YYYY.Double(&YYYY). + Double(&YYYY). + Double(&YYYY) + p.Y.Sub(&p.Y, &YYYY) + p.Z.Double(&a.Y) + + return p +} + +// AddMixed sets p to p+a in Jacobian coordinates, where a.Z = 1. +// // http://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-madd-2007-bl +// ~Cost: 7M + 4S func (p *G1Jac) AddMixed(a *G1Affine) *G1Jac { //if a is infinity return p @@ -303,7 +383,7 @@ func (p *G1Jac) AddMixed(a *G1Affine) *G1Jac { // if p == a, we double instead if U2.Equal(&p.X) && S2.Equal(&p.Y) { - return p.DoubleAssign() + return p.DoubleMixed(a) } H.Sub(&U2, &p.X) @@ -328,83 +408,100 @@ func (p *G1Jac) AddMixed(a *G1Affine) *G1Jac { return p } -// Double doubles a point in Jacobian coordinates -// https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2007-bl +// Double sets p to [2]q in Jacobian coordinates. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l +// ~Cost: 2M + 5S func (p *G1Jac) Double(q *G1Jac) *G1Jac { p.Set(q) p.DoubleAssign() return p } -// DoubleAssign doubles a point in Jacobian coordinates -// https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2007-bl +// DoubleAssign doubles p in Jacobian coordinates. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l +// ~Cost: 2M + 5S func (p *G1Jac) DoubleAssign() *G1Jac { - - var XX, YY, YYYY, ZZ, S, M, T fp.Element - - XX.Square(&p.X) - YY.Square(&p.Y) - YYYY.Square(&YY) - ZZ.Square(&p.Z) - S.Add(&p.X, &YY) - S.Square(&S). - Sub(&S, &XX). - Sub(&S, &YYYY). - Double(&S) - M.Double(&XX).Add(&M, &XX) - p.Z.Add(&p.Z, &p.Y). - Square(&p.Z). - Sub(&p.Z, &YY). - Sub(&p.Z, &ZZ) - T.Square(&M) - p.X = T - T.Double(&S) - p.X.Sub(&p.X, &T) - p.Y.Sub(&S, &p.X). - Mul(&p.Y, &M) - YYYY.Double(&YYYY).Double(&YYYY).Double(&YYYY) - p.Y.Sub(&p.Y, &YYYY) + var A, B, C, D, E, F, t fp.Element + A.Square(&p.X) + B.Square(&p.Y) + C.Square(&B) + D.Add(&p.X, &B). + Square(&D). + Sub(&D, &A). + Sub(&D, &C). + Double(&D) + E.Double(&A). + Add(&E, &A) + F.Square(&E) + t.Double(&D) + p.Z.Mul(&p.Y, &p.Z). + Double(&p.Z) + p.X.Sub(&F, &t) + p.Y.Sub(&D, &p.X). + Mul(&p.Y, &E) + t.Double(&C). + Double(&t). + Double(&t) + p.Y.Sub(&p.Y, &t) return p } -// ScalarMultiplication computes and returns p = a ⋅ s +// ScalarMultiplication computes and returns p = [s]a +// where p and a are Jacobian points. +// using the GLV technique. // see https://www.iacr.org/archive/crypto2001/21390189.pdf -func (p *G1Jac) ScalarMultiplication(a *G1Jac, s *big.Int) *G1Jac { - return p.mulGLV(a, s) +func (p *G1Jac) ScalarMultiplication(q *G1Jac, s *big.Int) *G1Jac { + if s.BitLen() >= g1ScalarMulChoose { + return p.mulGLV(q, s) + } else { + return p.mulWindowed(q, s) + } +} + +// ScalarMultiplicationBase computes and returns p = [s]g +// where g is the prime subgroup generator. +func (p *G1Jac) ScalarMultiplicationBase(s *big.Int) *G1Jac { + if s.BitLen() >= g1ScalarMulChoose { + return p.mulGLV(&g1Gen, s) + } else { + return p.mulWindowed(&g1Gen, s) + } + } -// String returns canonical representation of the point in affine coordinates +// String converts p to affine coordinates and returns its string representation E(x,y) or "O" if it is infinity. func (p *G1Jac) String() string { _p := G1Affine{} _p.FromJacobian(p) return _p.String() } -// FromAffine sets p = Q, p in Jacobian, Q in affine -func (p *G1Jac) FromAffine(Q *G1Affine) *G1Jac { - if Q.IsInfinity() { +// FromAffine converts a point a from affine to Jacobian coordinates. +func (p *G1Jac) FromAffine(a *G1Affine) *G1Jac { + if a.IsInfinity() { p.Z.SetZero() p.X.SetOne() p.Y.SetOne() return p } p.Z.SetOne() - p.X.Set(&Q.X) - p.Y.Set(&Q.Y) + p.X.Set(&a.X) + p.Y.Set(&a.Y) return p } -// IsOnCurve returns true if p in on the curve +// IsOnCurve returns true if the Jacobian point p in on the curve. func (p *G1Jac) IsOnCurve() bool { - var left, right, tmp fp.Element + var left, right, tmp, ZZ fp.Element left.Square(&p.Y) right.Square(&p.X).Mul(&right, &p.X) - tmp.Square(&p.Z). - Square(&tmp). - Mul(&tmp, &p.Z). - Mul(&tmp, &p.Z). - Mul(&tmp, &bCurveCoeff) + ZZ.Square(&p.Z) + tmp.Square(&ZZ).Mul(&tmp, &ZZ) + // Mul tmp by bCurveCoeff=4 + tmp.Double(&tmp).Double(&tmp) right.Add(&right, &tmp) return left.Equal(&right) } @@ -416,25 +513,41 @@ func (p *G1Jac) IsOnCurve() bool { // 1, x². So we check that p+x²ϕ(p) // is the infinity. func (p *G1Jac) IsInSubGroup() bool { - + if !p.IsOnCurve() { + return false + } var res G1Jac res.phi(p). - ScalarMultiplication(&res, &xGen). - ScalarMultiplication(&res, &xGen). - AddAssign(p) + mulBySeed(&res). + mulBySeed(&res). + Neg(&res) - return res.IsOnCurve() && res.Z.IsZero() + return res.Equal(p) + +} +func GeneratePointNotInG1(f fp.Element) G1Jac { + var res, jac G1Jac + aff := MapToCurve1(&f) + hash_to_curve.G1Isogeny(&aff.X, &aff.Y) + jac.FromAffine(&aff) + // p+x²ϕ(p) = [r]p + res.phi(&jac). + mulBySeed(&res). + mulBySeed(&res). + AddAssign(&jac) + return res } -// mulWindowed computes a 2-bits windowed scalar multiplication -func (p *G1Jac) mulWindowed(a *G1Jac, s *big.Int) *G1Jac { +// mulWindowed computes the 2-bits windowed double-and-add scalar +// multiplication p=[s]q in Jacobian coordinates. +func (p *G1Jac) mulWindowed(q *G1Jac, s *big.Int) *G1Jac { var res G1Jac var ops [3]G1Jac - ops[0].Set(a) + ops[0].Set(q) if s.Sign() == -1 { ops[0].Neg(&ops[0]) } @@ -461,17 +574,50 @@ func (p *G1Jac) mulWindowed(a *G1Jac, s *big.Int) *G1Jac { } -// ϕ assigns p to ϕ(a) where ϕ: (x,y) → (w x,y), and returns p -// where w is a third root of unity in 𝔽p -func (p *G1Jac) phi(a *G1Jac) *G1Jac { - p.Set(a) +// mulBySeed multiplies the point q by the seed xGen in Jacobian coordinates +// using an optimized addition chain. +func (p *G1Jac) mulBySeed(q *G1Jac) *G1Jac { + // Generated by github.com/mmcloughlin/addchain v0.4.0. + // Operations: 63 doublings 5 additions + + var res G1Jac + res.Double(q) + res.AddAssign(q) + for i := 0; i < 2; i++ { + res.Double(&res) + } + res.AddAssign(q) + for i := 0; i < 3; i++ { + res.Double(&res) + } + res.AddAssign(q) + for i := 0; i < 9; i++ { + res.Double(&res) + } + res.AddAssign(q) + for i := 0; i < 32; i++ { + res.Double(&res) + } + res.AddAssign(q) + for i := 0; i < 16; i++ { + res.Double(&res) + } + p.Set(&res) + return p +} + +// phi sets p to ϕ(a) where ϕ: (x,y) → (w x,y), +// where w is a third root of unity. +func (p *G1Jac) phi(q *G1Jac) *G1Jac { + p.Set(q) p.X.Mul(&p.X, &thirdRootOneG1) return p } // mulGLV computes the scalar multiplication using a windowed-GLV method +// // see https://www.iacr.org/archive/crypto2001/21390189.pdf -func (p *G1Jac) mulGLV(a *G1Jac, s *big.Int) *G1Jac { +func (p *G1Jac) mulGLV(q *G1Jac, s *big.Int) *G1Jac { var table [15]G1Jac var res G1Jac @@ -479,11 +625,11 @@ func (p *G1Jac) mulGLV(a *G1Jac, s *big.Int) *G1Jac { res.Set(&g1Infinity) - // table[b3b2b1b0-1] = b3b2 ⋅ ϕ(a) + b1b0*a - table[0].Set(a) - table[3].phi(a) + // table[b3b2b1b0-1] = b3b2 ⋅ ϕ(q) + b1b0*q + table[0].Set(q) + table[3].phi(q) - // split the scalar, modifies ±a, ϕ(a) accordingly + // split the scalar, modifies ±q, ϕ(q) accordingly k := ecc.SplitScalar(s, &glvBasis) if k[0].Sign() == -1 { @@ -496,7 +642,7 @@ func (p *G1Jac) mulGLV(a *G1Jac, s *big.Int) *G1Jac { } // precompute table (2 bits sliding window) - // table[b3b2b1b0-1] = b3b2 ⋅ ϕ(a) + b1b0 ⋅ a if b3b2b1b0 != 0 + // table[b3b2b1b0-1] = b3b2 ⋅ ϕ(q) + b1b0 ⋅ q if b3b2b1b0 != 0 table[1].Double(&table[0]) table[2].Set(&table[1]).AddAssign(&table[0]) table[4].Set(&table[3]).AddAssign(&table[0]) @@ -552,23 +698,23 @@ func (p *G1Affine) ClearCofactor(a *G1Affine) *G1Affine { } // ClearCofactor maps a point in E(Fp) to E(Fp)[r] -func (p *G1Jac) ClearCofactor(a *G1Jac) *G1Jac { +func (p *G1Jac) ClearCofactor(q *G1Jac) *G1Jac { // cf https://eprint.iacr.org/2019/403.pdf, 5 var res G1Jac - res.ScalarMultiplication(a, &xGen).AddAssign(a) + res.mulBySeed(q).AddAssign(q) p.Set(&res) return p } -// JointScalarMultiplicationBase computes [s1]g+[s2]a using Straus-Shamir technique -// where g is the prime subgroup generator -func (p *G1Jac) JointScalarMultiplicationBase(a *G1Affine, s1, s2 *big.Int) *G1Jac { +// JointScalarMultiplication computes [s1]a1+[s2]a2 using Strauss-Shamir technique +// where a1 and a2 are affine points. +func (p *G1Jac) JointScalarMultiplication(a1, a2 *G1Affine, s1, s2 *big.Int) *G1Jac { var res, p1, p2 G1Jac res.Set(&g1Infinity) - p1.Set(&g1Gen) - p2.FromAffine(a) + p1.FromAffine(a1) + p2.FromAffine(a2) var table [15]G1Jac @@ -632,17 +778,24 @@ func (p *G1Jac) JointScalarMultiplicationBase(a *G1Affine, s1, s2 *big.Int) *G1J } +// JointScalarMultiplicationBase computes [s1]g+[s2]a using Straus-Shamir technique +// where g is the prime subgroup generator. +func (p *G1Jac) JointScalarMultiplicationBase(a *G1Affine, s1, s2 *big.Int) *G1Jac { + return p.JointScalarMultiplication(&g1GenAff, a, s1, s2) + +} + // ------------------------------------------------------------------------------------------------- -// Jacobian extended +// extended Jacobian coordinates -// Set sets p to the provided point -func (p *g1JacExtended) Set(a *g1JacExtended) *g1JacExtended { - p.X, p.Y, p.ZZ, p.ZZZ = a.X, a.Y, a.ZZ, a.ZZZ +// Set sets p to a in extended Jacobian coordinates. +func (p *g1JacExtended) Set(q *g1JacExtended) *g1JacExtended { + p.X, p.Y, p.ZZ, p.ZZZ = q.X, q.Y, q.ZZ, q.ZZZ return p } -// setInfinity sets p to O -func (p *g1JacExtended) setInfinity() *g1JacExtended { +// SetInfinity sets p to the infinity point (1,1,0,0). +func (p *g1JacExtended) SetInfinity() *g1JacExtended { p.X.SetOne() p.Y.SetOne() p.ZZ = fp.Element{} @@ -650,44 +803,47 @@ func (p *g1JacExtended) setInfinity() *g1JacExtended { return p } -func (p *g1JacExtended) IsZero() bool { +// IsInfinity checks if the p is infinity, i.e. p.ZZ=0. +func (p *g1JacExtended) IsInfinity() bool { return p.ZZ.IsZero() } -// fromJacExtended sets Q in affine coordinates -func (p *G1Affine) fromJacExtended(Q *g1JacExtended) *G1Affine { - if Q.ZZ.IsZero() { +// fromJacExtended converts an extended Jacobian point to an affine point. +func (p *G1Affine) fromJacExtended(q *g1JacExtended) *G1Affine { + if q.ZZ.IsZero() { p.X = fp.Element{} p.Y = fp.Element{} return p } - p.X.Inverse(&Q.ZZ).Mul(&p.X, &Q.X) - p.Y.Inverse(&Q.ZZZ).Mul(&p.Y, &Q.Y) + p.X.Inverse(&q.ZZ).Mul(&p.X, &q.X) + p.Y.Inverse(&q.ZZZ).Mul(&p.Y, &q.Y) return p } -// fromJacExtended sets Q in Jacobian coordinates -func (p *G1Jac) fromJacExtended(Q *g1JacExtended) *G1Jac { - if Q.ZZ.IsZero() { +// fromJacExtended converts an extended Jacobian point to a Jacobian point. +func (p *G1Jac) fromJacExtended(q *g1JacExtended) *G1Jac { + if q.ZZ.IsZero() { p.Set(&g1Infinity) return p } - p.X.Mul(&Q.ZZ, &Q.X).Mul(&p.X, &Q.ZZ) - p.Y.Mul(&Q.ZZZ, &Q.Y).Mul(&p.Y, &Q.ZZZ) - p.Z.Set(&Q.ZZZ) + p.X.Mul(&q.ZZ, &q.X).Mul(&p.X, &q.ZZ) + p.Y.Mul(&q.ZZZ, &q.Y).Mul(&p.Y, &q.ZZZ) + p.Z.Set(&q.ZZZ) return p } -// unsafeFromJacExtended sets p in Jacobian coordinates, but don't check for infinity -func (p *G1Jac) unsafeFromJacExtended(Q *g1JacExtended) *G1Jac { - p.X.Square(&Q.ZZ).Mul(&p.X, &Q.X) - p.Y.Square(&Q.ZZZ).Mul(&p.Y, &Q.Y) - p.Z = Q.ZZZ +// unsafeFromJacExtended converts an extended Jacobian point, distinct from Infinity, to a Jacobian point. +func (p *G1Jac) unsafeFromJacExtended(q *g1JacExtended) *G1Jac { + p.X.Square(&q.ZZ).Mul(&p.X, &q.X) + p.Y.Square(&q.ZZZ).Mul(&p.Y, &q.Y) + p.Z = q.ZZZ return p } -// add point in Jacobian extended coordinates +// add sets p to p+q in extended Jacobian coordinates. +// // https://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#addition-add-2008-s +// ~Cost: 12M + 2S func (p *g1JacExtended) add(q *g1JacExtended) *g1JacExtended { //if q is infinity return p if q.ZZ.IsZero() { @@ -742,10 +898,13 @@ func (p *g1JacExtended) add(q *g1JacExtended) *g1JacExtended { return p } -// double point in Jacobian extended coordinates +// double sets p to [2]q in Jacobian extended coordinates. +// // http://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#doubling-dbl-2008-s-1 -// since we consider any point on Z=0 as the point at infinity -// this doubling formula works for infinity points as well +// ~Cost: 6M + 3S +// +// N.B.: since we consider any point on Z=0 as the point at infinity +// this doubling formula works for infinity points as well. func (p *g1JacExtended) double(q *g1JacExtended) *g1JacExtended { var U, V, W, S, XX, M fp.Element @@ -755,7 +914,7 @@ func (p *g1JacExtended) double(q *g1JacExtended) *g1JacExtended { S.Mul(&q.X, &V) XX.Square(&q.X) M.Double(&XX). - Add(&M, &XX) // -> + a, but a=0 here + Add(&M, &XX) // -> + A, but A=0 here U.Mul(&W, &q.Y) p.X.Square(&M). @@ -770,9 +929,11 @@ func (p *g1JacExtended) double(q *g1JacExtended) *g1JacExtended { return p } -// subMixed same as addMixed, but will negate a.Y +// addMixed sets p to p+q in extended Jacobian coordinates, where a.ZZ=1. +// // http://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#addition-madd-2008-s -func (p *g1JacExtended) subMixed(a *G1Affine) *g1JacExtended { +// ~Cost: 8M + 2S +func (p *g1JacExtended) addMixed(a *G1Affine) *g1JacExtended { //if a is infinity return p if a.IsInfinity() { @@ -781,7 +942,7 @@ func (p *g1JacExtended) subMixed(a *G1Affine) *g1JacExtended { // p is infinity, return a if p.ZZ.IsZero() { p.X = a.X - p.Y.Neg(&a.Y) + p.Y = a.Y p.ZZ.SetOne() p.ZZZ.SetOne() return p @@ -794,12 +955,11 @@ func (p *g1JacExtended) subMixed(a *G1Affine) *g1JacExtended { P.Sub(&P, &p.X) R.Mul(&a.Y, &p.ZZZ) - R.Neg(&R) R.Sub(&R, &p.Y) if P.IsZero() { if R.IsZero() { - return p.doubleNegMixed(a) + return p.doubleMixed(a) } p.ZZ = fp.Element{} @@ -826,9 +986,11 @@ func (p *g1JacExtended) subMixed(a *G1Affine) *g1JacExtended { } -// addMixed +// subMixed works the same as addMixed, but negates a.Y. +// // http://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#addition-madd-2008-s -func (p *g1JacExtended) addMixed(a *G1Affine) *g1JacExtended { +// ~Cost: 8M + 2S +func (p *g1JacExtended) subMixed(a *G1Affine) *g1JacExtended { //if a is infinity return p if a.IsInfinity() { @@ -837,7 +999,7 @@ func (p *g1JacExtended) addMixed(a *G1Affine) *g1JacExtended { // p is infinity, return a if p.ZZ.IsZero() { p.X = a.X - p.Y = a.Y + p.Y.Neg(&a.Y) p.ZZ.SetOne() p.ZZZ.SetOne() return p @@ -850,11 +1012,12 @@ func (p *g1JacExtended) addMixed(a *G1Affine) *g1JacExtended { P.Sub(&P, &p.X) R.Mul(&a.Y, &p.ZZZ) + R.Neg(&R) R.Sub(&R, &p.Y) if P.IsZero() { if R.IsZero() { - return p.doubleMixed(a) + return p.doubleNegMixed(a) } p.ZZ = fp.Element{} @@ -881,54 +1044,57 @@ func (p *g1JacExtended) addMixed(a *G1Affine) *g1JacExtended { } -// doubleNegMixed same as double, but will negate q.Y -func (p *g1JacExtended) doubleNegMixed(q *G1Affine) *g1JacExtended { +// doubleNegMixed works the same as doubleMixed, but negates q.Y. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#doubling-mdbl-2008-s-1 +// ~Cost: 4M + 3S +func (p *g1JacExtended) doubleNegMixed(a *G1Affine) *g1JacExtended { - var U, V, W, S, XX, M, S2, L fp.Element + var U, V, W, S, M, t fp.Element - U.Double(&q.Y) + U.Double(&a.Y) U.Neg(&U) V.Square(&U) W.Mul(&U, &V) - S.Mul(&q.X, &V) - XX.Square(&q.X) - M.Double(&XX). - Add(&M, &XX) // -> + a, but a=0 here - S2.Double(&S) - L.Mul(&W, &q.Y) - - p.X.Square(&M). - Sub(&p.X, &S2) + S.Mul(&a.X, &V) + t.Square(&a.X) + M.Double(&t). + Add(&M, &t) // -> + A, but A=0 here + p.X.Square(&M) + t.Double(&S) + p.X.Sub(&p.X, &t) + t.Mul(&W, &a.Y) p.Y.Sub(&S, &p.X). Mul(&p.Y, &M). - Add(&p.Y, &L) + Add(&p.Y, &t) p.ZZ.Set(&V) p.ZZZ.Set(&W) return p } -// doubleMixed point in Jacobian extended coordinates -// http://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#doubling-dbl-2008-s-1 -func (p *g1JacExtended) doubleMixed(q *G1Affine) *g1JacExtended { +// doubleMixed sets p to [2]a in Jacobian extended coordinates, where a.ZZ=1. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#doubling-mdbl-2008-s-1 +// ~Cost: 4M + 3S +func (p *g1JacExtended) doubleMixed(a *G1Affine) *g1JacExtended { - var U, V, W, S, XX, M, S2, L fp.Element + var U, V, W, S, M, t fp.Element - U.Double(&q.Y) + U.Double(&a.Y) V.Square(&U) W.Mul(&U, &V) - S.Mul(&q.X, &V) - XX.Square(&q.X) - M.Double(&XX). - Add(&M, &XX) // -> + a, but a=0 here - S2.Double(&S) - L.Mul(&W, &q.Y) - - p.X.Square(&M). - Sub(&p.X, &S2) + S.Mul(&a.X, &V) + t.Square(&a.X) + M.Double(&t). + Add(&M, &t) // -> + A, but A=0 here + p.X.Square(&M) + t.Double(&S) + p.X.Sub(&p.X, &t) + t.Mul(&W, &a.Y) p.Y.Sub(&S, &p.X). Mul(&p.Y, &M). - Sub(&p.Y, &L) + Sub(&p.Y, &t) p.ZZ.Set(&V) p.ZZZ.Set(&W) @@ -936,7 +1102,7 @@ func (p *g1JacExtended) doubleMixed(q *G1Affine) *g1JacExtended { } // BatchJacobianToAffineG1 converts points in Jacobian coordinates to Affine coordinates -// performing a single field inversion (Montgomery batch inversion trick). +// performing a single field inversion using the Montgomery batch inversion trick. func BatchJacobianToAffineG1(points []G1Jac) []G1Affine { result := make([]G1Affine, len(points)) zeroes := make([]bool, len(points)) @@ -986,7 +1152,7 @@ func BatchJacobianToAffineG1(points []G1Jac) []G1Affine { // BatchScalarMultiplicationG1 multiplies the same base by all scalars // and return resulting points in affine coordinates -// uses a simple windowed-NAF like exponentiation algorithm +// uses a simple windowed-NAF-like multiplication algorithm. func BatchScalarMultiplicationG1(base *G1Affine, scalars []fr.Element) []G1Affine { // approximate cost in group ops is // cost = 2^{c-1} + n(scalar.nbBits+nbChunks) @@ -1068,18 +1234,29 @@ func BatchScalarMultiplicationG1(base *G1Affine, scalars []fr.Element) []G1Affin return toReturnAff } -// batch add affine coordinates -// using batch inversion -// special cases (doubling, infinity) must be filtered out before this call +// batchAddG1Affine adds affine points using the Montgomery batch inversion trick. +// Special cases (doubling, infinity) must be filtered out before this call. func batchAddG1Affine[TP pG1Affine, TPP ppG1Affine, TC cG1Affine](R *TPP, P *TP, batchSize int) { var lambda, lambdain TC - // add part + // from https://docs.zkproof.org/pages/standards/accepted-workshop3/proposal-turbo_plonk.pdf + // affine point addition formula + // R(X1, Y1) + P(X2, Y2) = Q(X3, Y3) + // λ = (Y2 - Y1) / (X2 - X1) + // X3 = λ² - (X1 + X2) + // Y3 = λ * (X1 - X3) - Y1 + + // first we compute the 1 / (X2 - X1) for all points using Montgomery batch inversion trick + + // X2 - X1 for j := 0; j < batchSize; j++ { lambdain[j].Sub(&(*P)[j].X, &(*R)[j].X) } - // invert denominator using montgomery batch invert technique + // montgomery batch inversion; + // lambda[0] = 1 / (P[0].X - R[0].X) + // lambda[1] = 1 / (P[1].X - R[1].X) + // ... { var accumulator fp.Element lambda[0].SetOne() @@ -1099,22 +1276,24 @@ func batchAddG1Affine[TP pG1Affine, TPP ppG1Affine, TC cG1Affine](R *TPP, P *TP, lambda[0].Set(&accumulator) } - var d fp.Element - var rr G1Affine + var t fp.Element + var Q G1Affine - // add part for j := 0; j < batchSize; j++ { - // computa lambda - d.Sub(&(*P)[j].Y, &(*R)[j].Y) - lambda[j].Mul(&lambda[j], &d) - - // compute X, Y - rr.X.Square(&lambda[j]) - rr.X.Sub(&rr.X, &(*R)[j].X) - rr.X.Sub(&rr.X, &(*P)[j].X) - d.Sub(&(*R)[j].X, &rr.X) - rr.Y.Mul(&lambda[j], &d) - rr.Y.Sub(&rr.Y, &(*R)[j].Y) - (*R)[j].Set(&rr) + // λ = (Y2 - Y1) / (X2 - X1) + t.Sub(&(*P)[j].Y, &(*R)[j].Y) + lambda[j].Mul(&lambda[j], &t) + + // X3 = λ² - (X1 + X2) + Q.X.Square(&lambda[j]) + Q.X.Sub(&Q.X, &(*R)[j].X) + Q.X.Sub(&Q.X, &(*P)[j].X) + + // Y3 = λ * (X1 - X3) - Y1 + t.Sub(&(*R)[j].X, &Q.X) + Q.Y.Mul(&lambda[j], &t) + Q.Y.Sub(&Q.Y, &(*R)[j].Y) + + (*R)[j].Set(&Q) } } diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/g2.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/g2.go index cd32bfb46..6da47e8ae 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/g2.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/g2.go @@ -1,41 +1,33 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT package bls12381 import ( + "crypto/rand" "github.com/consensys/gnark-crypto/ecc" "github.com/consensys/gnark-crypto/ecc/bls12-381/fr" "github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower" "github.com/consensys/gnark-crypto/internal/parallel" "math/big" "runtime" + + "github.com/consensys/gnark-crypto/ecc/bls12-381/hash_to_curve" ) -// G2Affine point in affine coordinates +// G2Affine is a point in affine coordinates (x,y) type G2Affine struct { X, Y fptower.E2 } -// G2Jac is a point with fptower.E2 coordinates +// G2Jac is a point in Jacobian coordinates (x=X/Z², y=Y/Z³) type G2Jac struct { X, Y, Z fptower.E2 } -// g2JacExtended parameterized Jacobian coordinates (x=X/ZZ, y=Y/ZZZ, ZZ³=ZZZ²) +// g2JacExtended is a point in extended Jacobian coordinates (x=X/ZZ, y=Y/ZZZ, ZZ³=ZZZ²) type g2JacExtended struct { X, Y, ZZ, ZZZ fptower.E2 } @@ -46,75 +38,133 @@ type g2Proj struct { } // ------------------------------------------------------------------------------------------------- -// Affine +// Affine coordinates -// Set sets p to the provided point +// Set sets p to a in affine coordinates. func (p *G2Affine) Set(a *G2Affine) *G2Affine { p.X, p.Y = a.X, a.Y return p } -// setInfinity sets p to O -func (p *G2Affine) setInfinity() *G2Affine { +// SetInfinity sets p to the infinity point, which is encoded as (0,0). +// N.B.: (0,0) is never on the curve for j=0 curves (Y²=X³+B). +func (p *G2Affine) SetInfinity() *G2Affine { p.X.SetZero() p.Y.SetZero() return p } -// ScalarMultiplication computes and returns p = a ⋅ s +// ScalarMultiplication computes and returns p = [s]a +// where p and a are affine points. func (p *G2Affine) ScalarMultiplication(a *G2Affine, s *big.Int) *G2Affine { var _p G2Jac _p.FromAffine(a) - _p.mulGLV(&_p, s) + if s.BitLen() >= g2ScalarMulChoose { + _p.mulGLV(&_p, s) + } else { + _p.mulWindowed(&_p, s) + } p.FromJacobian(&_p) return p } -// Add adds two point in affine coordinates. -// This should rarely be used as it is very inefficient compared to Jacobian -func (p *G2Affine) Add(a, b *G2Affine) *G2Affine { - var p1, p2 G2Jac - p1.FromAffine(a) - p2.FromAffine(b) - p1.AddAssign(&p2) - p.FromJacobian(&p1) +// ScalarMultiplicationBase computes and returns p = [s]g +// where g is the affine point generating the prime subgroup. +func (p *G2Affine) ScalarMultiplicationBase(s *big.Int) *G2Affine { + var _p G2Jac + if s.BitLen() >= g2ScalarMulChoose { + _p.mulGLV(&g2Gen, s) + } else { + _p.mulWindowed(&g2Gen, s) + } + p.FromJacobian(&_p) return p } +// Add adds two points in affine coordinates. +// It uses the Jacobian addition with a.Z=b.Z=1 and converts the result to affine coordinates. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-mmadd-2007-bl +// ~Cost: 4M + 2S +func (p *G2Affine) Add(a, b *G2Affine) *G2Affine { + var q G2Jac + // a is infinity, return b + if a.IsInfinity() { + p.Set(b) + return p + } + // b is infinity, return a + if b.IsInfinity() { + p.Set(a) + return p + } + if a.X.Equal(&b.X) { + // if b == a, we double instead + if a.Y.Equal(&b.Y) { + q.DoubleMixed(a) + return p.FromJacobian(&q) + } else { + // if b == -a, we return 0 + return p.SetInfinity() + } + } + var H, HH, I, J, r, V fptower.E2 + H.Sub(&b.X, &a.X) + HH.Square(&H) + I.Double(&HH).Double(&I) + J.Mul(&H, &I) + r.Sub(&b.Y, &a.Y) + r.Double(&r) + V.Mul(&a.X, &I) + q.X.Square(&r). + Sub(&q.X, &J). + Sub(&q.X, &V). + Sub(&q.X, &V) + q.Y.Sub(&V, &q.X). + Mul(&q.Y, &r) + J.Mul(&a.Y, &J).Double(&J) + q.Y.Sub(&q.Y, &J) + q.Z.Double(&H) + + return p.FromJacobian(&q) +} + // Double doubles a point in affine coordinates. -// This should rarely be used as it is very inefficient compared to Jacobian +// It converts the point to Jacobian coordinates, doubles it using Jacobian +// addition with a.Z=1, and converts it back to affine coordinates. +// +// http://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-mdbl-2007-bl +// ~Cost: 1M + 5S func (p *G2Affine) Double(a *G2Affine) *G2Affine { - var p1 G2Jac - p1.FromAffine(a) - p1.Double(&p1) - p.FromJacobian(&p1) + var q G2Jac + q.FromAffine(a) + q.DoubleMixed(a) + p.FromJacobian(&q) return p } -// Sub subs two point in affine coordinates. -// This should rarely be used as it is very inefficient compared to Jacobian +// Sub subtracts two points in affine coordinates. +// It uses a similar approach to Add, but negates the second point before adding. func (p *G2Affine) Sub(a, b *G2Affine) *G2Affine { - var p1, p2 G2Jac - p1.FromAffine(a) - p2.FromAffine(b) - p1.SubAssign(&p2) - p.FromJacobian(&p1) + var bneg G2Affine + bneg.Neg(b) + p.Add(a, &bneg) return p } -// Equal tests if two points (in Affine coordinates) are equal +// Equal tests if two points in affine coordinates are equal. func (p *G2Affine) Equal(a *G2Affine) bool { return p.X.Equal(&a.X) && p.Y.Equal(&a.Y) } -// Neg computes -G +// Neg sets p to the affine negative point -a = (a.X, -a.Y). func (p *G2Affine) Neg(a *G2Affine) *G2Affine { p.X = a.X p.Y.Neg(&a.Y) return p } -// FromJacobian rescales a point in Jacobian coord in z=1 plane +// FromJacobian converts a point p1 from Jacobian to affine coordinates. func (p *G2Affine) FromJacobian(p1 *G2Jac) *G2Affine { var a, b fptower.E2 @@ -133,7 +183,7 @@ func (p *G2Affine) FromJacobian(p1 *G2Jac) *G2Affine { return p } -// String returns the string representation of the point or "O" if it is infinity +// String returns the string representation E(x,y) of the affine point p or "O" if it is infinity. func (p *G2Affine) String() string { if p.IsInfinity() { return "O" @@ -141,106 +191,109 @@ func (p *G2Affine) String() string { return "E([" + p.X.String() + "," + p.Y.String() + "])" } -// IsInfinity checks if the point is infinity -// in affine, it's encoded as (0,0) -// (0,0) is never on the curve for j=0 curves +// IsInfinity checks if the affine point p is infinity, which is encoded as (0,0). +// N.B.: (0,0) is never on the curve for j=0 curves (Y²=X³+B). func (p *G2Affine) IsInfinity() bool { return p.X.IsZero() && p.Y.IsZero() } -// IsOnCurve returns true if p in on the curve +// IsOnCurve returns true if the affine point p in on the curve. func (p *G2Affine) IsOnCurve() bool { - var point G2Jac - point.FromAffine(p) - return point.IsOnCurve() // call this function to handle infinity point + if p.IsInfinity() { + return true + } + var left, right fptower.E2 + left.Square(&p.Y) + right.Square(&p.X).Mul(&right, &p.X) + right.Add(&right, &bTwistCurveCoeff) + return left.Equal(&right) } -// IsInSubGroup returns true if p is in the correct subgroup, false otherwise +// IsInSubGroup returns true if the affine point p is in the correct subgroup, false otherwise. func (p *G2Affine) IsInSubGroup() bool { - var _p G2Jac + if !p.IsOnCurve() { + return false + } + var _p, res, img G2Jac _p.FromAffine(p) - return _p.IsInSubGroup() + img.psi(&_p) + res.mulBySeed(&_p).Neg(&res) + + return res.Equal(&img) } // ------------------------------------------------------------------------------------------------- -// Jacobian +// Jacobian coordinates -// Set sets p to the provided point -func (p *G2Jac) Set(a *G2Jac) *G2Jac { - p.X, p.Y, p.Z = a.X, a.Y, a.Z +// Set sets p to a in Jacobian coordinates. +func (p *G2Jac) Set(q *G2Jac) *G2Jac { + p.X, p.Y, p.Z = q.X, q.Y, q.Z return p } -// Equal tests if two points (in Jacobian coordinates) are equal -func (p *G2Jac) Equal(a *G2Jac) bool { +// Equal tests if two points in Jacobian coordinates are equal. +func (p *G2Jac) Equal(q *G2Jac) bool { // If one point is infinity, the other must also be infinity. if p.Z.IsZero() { - return a.Z.IsZero() + return q.Z.IsZero() } // If the other point is infinity, return false since we can't // the following checks would be incorrect. - if a.Z.IsZero() { + if q.Z.IsZero() { return false } var pZSquare, aZSquare fptower.E2 pZSquare.Square(&p.Z) - aZSquare.Square(&a.Z) + aZSquare.Square(&q.Z) var lhs, rhs fptower.E2 lhs.Mul(&p.X, &aZSquare) - rhs.Mul(&a.X, &pZSquare) + rhs.Mul(&q.X, &pZSquare) if !lhs.Equal(&rhs) { return false } - lhs.Mul(&p.Y, &aZSquare).Mul(&lhs, &a.Z) - rhs.Mul(&a.Y, &pZSquare).Mul(&rhs, &p.Z) + lhs.Mul(&p.Y, &aZSquare).Mul(&lhs, &q.Z) + rhs.Mul(&q.Y, &pZSquare).Mul(&rhs, &p.Z) return lhs.Equal(&rhs) } -// Neg computes -G -func (p *G2Jac) Neg(a *G2Jac) *G2Jac { - *p = *a - p.Y.Neg(&a.Y) +// Neg sets p to the Jacobian negative point -q = (q.X, -q.Y, q.Z). +func (p *G2Jac) Neg(q *G2Jac) *G2Jac { + *p = *q + p.Y.Neg(&q.Y) return p } -// SubAssign subtracts two points on the curve -func (p *G2Jac) SubAssign(a *G2Jac) *G2Jac { - var tmp G2Jac - tmp.Set(a) - tmp.Y.Neg(&tmp.Y) - p.AddAssign(&tmp) - return p -} - -// AddAssign point addition in montgomery form -// https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#addition-add-2007-bl -func (p *G2Jac) AddAssign(a *G2Jac) *G2Jac { +// AddAssign sets p to p+a in Jacobian coordinates. +// +// https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-add-2007-bl +// ~Cost: 11M + 5S +func (p *G2Jac) AddAssign(q *G2Jac) *G2Jac { - // p is infinity, return a + // p is infinity, return q if p.Z.IsZero() { - p.Set(a) + p.Set(q) return p } - // a is infinity, return p - if a.Z.IsZero() { + // q is infinity, return p + if q.Z.IsZero() { return p } var Z1Z1, Z2Z2, U1, U2, S1, S2, H, I, J, r, V fptower.E2 - Z1Z1.Square(&a.Z) + Z1Z1.Square(&q.Z) Z2Z2.Square(&p.Z) - U1.Mul(&a.X, &Z2Z2) + U1.Mul(&q.X, &Z2Z2) U2.Mul(&p.X, &Z1Z1) - S1.Mul(&a.Y, &p.Z). + S1.Mul(&q.Y, &p.Z). Mul(&S1, &Z2Z2) - S2.Mul(&p.Y, &a.Z). + S2.Mul(&p.Y, &q.Z). Mul(&S2, &Z1Z1) - // if p == a, we double instead + // if p == q, we double instead if U1.Equal(&U2) && S1.Equal(&S2) { return p.DoubleAssign() } @@ -259,7 +312,7 @@ func (p *G2Jac) AddAssign(a *G2Jac) *G2Jac { Mul(&p.Y, &r) S1.Mul(&S1, &J).Double(&S1) p.Y.Sub(&p.Y, &S1) - p.Z.Add(&p.Z, &a.Z) + p.Z.Add(&p.Z, &q.Z) p.Z.Square(&p.Z). Sub(&p.Z, &Z1Z1). Sub(&p.Z, &Z2Z2). @@ -268,8 +321,51 @@ func (p *G2Jac) AddAssign(a *G2Jac) *G2Jac { return p } -// AddMixed point addition +// SubAssign sets p to p-a in Jacobian coordinates. +// It uses a similar approach to AddAssign, but negates the point a before adding. +func (p *G2Jac) SubAssign(q *G2Jac) *G2Jac { + var tmp G2Jac + tmp.Set(q) + tmp.Y.Neg(&tmp.Y) + p.AddAssign(&tmp) + return p +} + +// Double sets p to [2]q in Jacobian coordinates. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-mdbl-2007-bl +// ~Cost: 1M + 5S +func (p *G2Jac) DoubleMixed(a *G2Affine) *G2Jac { + var XX, YY, YYYY, S, M, T fptower.E2 + XX.Square(&a.X) + YY.Square(&a.Y) + YYYY.Square(&YY) + S.Add(&a.X, &YY). + Square(&S). + Sub(&S, &XX). + Sub(&S, &YYYY). + Double(&S) + M.Double(&XX). + Add(&M, &XX) // -> + A, but A=0 here + T.Square(&M). + Sub(&T, &S). + Sub(&T, &S) + p.X.Set(&T) + p.Y.Sub(&S, &T). + Mul(&p.Y, &M) + YYYY.Double(&YYYY). + Double(&YYYY). + Double(&YYYY) + p.Y.Sub(&p.Y, &YYYY) + p.Z.Double(&a.Y) + + return p +} + +// AddMixed sets p to p+a in Jacobian coordinates, where a.Z = 1. +// // http://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-madd-2007-bl +// ~Cost: 7M + 4S func (p *G2Jac) AddMixed(a *G2Affine) *G2Jac { //if a is infinity return p @@ -292,7 +388,7 @@ func (p *G2Jac) AddMixed(a *G2Affine) *G2Jac { // if p == a, we double instead if U2.Equal(&p.X) && S2.Equal(&p.Y) { - return p.DoubleAssign() + return p.DoubleMixed(a) } H.Sub(&U2, &p.X) @@ -317,83 +413,99 @@ func (p *G2Jac) AddMixed(a *G2Affine) *G2Jac { return p } -// Double doubles a point in Jacobian coordinates -// https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2007-bl +// Double sets p to [2]q in Jacobian coordinates. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l +// ~Cost: 2M + 5S func (p *G2Jac) Double(q *G2Jac) *G2Jac { p.Set(q) p.DoubleAssign() return p } -// DoubleAssign doubles a point in Jacobian coordinates -// https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2007-bl +// DoubleAssign doubles p in Jacobian coordinates. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l +// ~Cost: 2M + 5S func (p *G2Jac) DoubleAssign() *G2Jac { - - var XX, YY, YYYY, ZZ, S, M, T fptower.E2 - - XX.Square(&p.X) - YY.Square(&p.Y) - YYYY.Square(&YY) - ZZ.Square(&p.Z) - S.Add(&p.X, &YY) - S.Square(&S). - Sub(&S, &XX). - Sub(&S, &YYYY). - Double(&S) - M.Double(&XX).Add(&M, &XX) - p.Z.Add(&p.Z, &p.Y). - Square(&p.Z). - Sub(&p.Z, &YY). - Sub(&p.Z, &ZZ) - T.Square(&M) - p.X = T - T.Double(&S) - p.X.Sub(&p.X, &T) - p.Y.Sub(&S, &p.X). - Mul(&p.Y, &M) - YYYY.Double(&YYYY).Double(&YYYY).Double(&YYYY) - p.Y.Sub(&p.Y, &YYYY) + var A, B, C, D, E, F, t fptower.E2 + A.Square(&p.X) + B.Square(&p.Y) + C.Square(&B) + D.Add(&p.X, &B). + Square(&D). + Sub(&D, &A). + Sub(&D, &C). + Double(&D) + E.Double(&A). + Add(&E, &A) + F.Square(&E) + t.Double(&D) + p.Z.Mul(&p.Y, &p.Z). + Double(&p.Z) + p.X.Sub(&F, &t) + p.Y.Sub(&D, &p.X). + Mul(&p.Y, &E) + t.Double(&C). + Double(&t). + Double(&t) + p.Y.Sub(&p.Y, &t) return p } -// ScalarMultiplication computes and returns p = a ⋅ s +// ScalarMultiplication computes and returns p = [s]a +// where p and a are Jacobian points. +// using the GLV technique. // see https://www.iacr.org/archive/crypto2001/21390189.pdf -func (p *G2Jac) ScalarMultiplication(a *G2Jac, s *big.Int) *G2Jac { - return p.mulGLV(a, s) +func (p *G2Jac) ScalarMultiplication(q *G2Jac, s *big.Int) *G2Jac { + if s.BitLen() >= g2ScalarMulChoose { + return p.mulGLV(q, s) + } else { + return p.mulWindowed(q, s) + } } -// String returns canonical representation of the point in affine coordinates +// ScalarMultiplicationBase computes and returns p = [s]g +// where g is the prime subgroup generator. +func (p *G2Jac) ScalarMultiplicationBase(s *big.Int) *G2Jac { + if s.BitLen() >= g2ScalarMulChoose { + return p.mulGLV(&g2Gen, s) + } else { + return p.mulWindowed(&g2Gen, s) + } + +} + +// String converts p to affine coordinates and returns its string representation E(x,y) or "O" if it is infinity. func (p *G2Jac) String() string { _p := G2Affine{} _p.FromJacobian(p) return _p.String() } -// FromAffine sets p = Q, p in Jacobian, Q in affine -func (p *G2Jac) FromAffine(Q *G2Affine) *G2Jac { - if Q.IsInfinity() { +// FromAffine converts a point a from affine to Jacobian coordinates. +func (p *G2Jac) FromAffine(a *G2Affine) *G2Jac { + if a.IsInfinity() { p.Z.SetZero() p.X.SetOne() p.Y.SetOne() return p } p.Z.SetOne() - p.X.Set(&Q.X) - p.Y.Set(&Q.Y) + p.X.Set(&a.X) + p.Y.Set(&a.Y) return p } -// IsOnCurve returns true if p in on the curve +// IsOnCurve returns true if the Jacobian point p in on the curve. func (p *G2Jac) IsOnCurve() bool { - var left, right, tmp fptower.E2 + var left, right, tmp, ZZ fptower.E2 left.Square(&p.Y) right.Square(&p.X).Mul(&right, &p.X) - tmp.Square(&p.Z). - Square(&tmp). - Mul(&tmp, &p.Z). - Mul(&tmp, &p.Z). - Mul(&tmp, &bTwistCurveCoeff) + ZZ.Square(&p.Z) + tmp.Square(&ZZ).Mul(&tmp, &ZZ) + tmp.MulBybTwistCurveCoeff(&tmp) right.Add(&right, &tmp) return left.Equal(&right) } @@ -403,21 +515,36 @@ func (p *G2Jac) IsOnCurve() bool { // and https://eprint.iacr.org/2022/352.pdf, sec. 4.2 // ψ(p) = [x₀]P func (p *G2Jac) IsInSubGroup() bool { - var res, tmp G2Jac - tmp.psi(p) - res.ScalarMultiplication(p, &xGen). - AddAssign(&tmp) + if !p.IsOnCurve() { + return false + } + var res, img G2Jac + img.psi(p) + res.mulBySeed(p).Neg(&res) + + return res.Equal(&img) +} - return res.IsOnCurve() && res.Z.IsZero() +func GeneratePointNotInG2(f E2) G2Jac { + var res, jac G2Jac + aff := MapToCurve2(&f) + hash_to_curve.G2Isogeny(&aff.X, &aff.Y) + jac.FromAffine(&aff) + // ψ(p)-[x₀]P = [r]p + res.mulBySeed(&jac) + jac.psi(&jac) + res.AddAssign(&jac) + return res } -// mulWindowed computes a 2-bits windowed scalar multiplication -func (p *G2Jac) mulWindowed(a *G2Jac, s *big.Int) *G2Jac { +// mulWindowed computes the 2-bits windowed double-and-add scalar +// multiplication p=[s]q in Jacobian coordinates. +func (p *G2Jac) mulWindowed(q *G2Jac, s *big.Int) *G2Jac { var res G2Jac var ops [3]G2Jac - ops[0].Set(a) + ops[0].Set(q) if s.Sign() == -1 { ops[0].Neg(&ops[0]) } @@ -444,26 +571,59 @@ func (p *G2Jac) mulWindowed(a *G2Jac, s *big.Int) *G2Jac { } -// ψ(p) = u o π o u⁻¹ where u:E'→E iso from the twist to E -func (p *G2Jac) psi(a *G2Jac) *G2Jac { - p.Set(a) +// mulBySeed multiplies the point q by the seed xGen in Jacobian coordinates +// using an optimized addition chain. +func (p *G2Jac) mulBySeed(q *G2Jac) *G2Jac { + // Generated by github.com/mmcloughlin/addchain v0.4.0. + // Operations: 63 doublings 5 additions + + var res G2Jac + res.Double(q) + res.AddAssign(q) + for i := 0; i < 2; i++ { + res.Double(&res) + } + res.AddAssign(q) + for i := 0; i < 3; i++ { + res.Double(&res) + } + res.AddAssign(q) + for i := 0; i < 9; i++ { + res.Double(&res) + } + res.AddAssign(q) + for i := 0; i < 32; i++ { + res.Double(&res) + } + res.AddAssign(q) + for i := 0; i < 16; i++ { + res.Double(&res) + } + p.Set(&res) + return p +} + +// psi sets p to ψ(q) = u o π o u⁻¹ where u:E'→E is the isomorphism from the twist to the curve E and π is the Frobenius map. +func (p *G2Jac) psi(q *G2Jac) *G2Jac { + p.Set(q) p.X.Conjugate(&p.X).Mul(&p.X, &endo.u) p.Y.Conjugate(&p.Y).Mul(&p.Y, &endo.v) p.Z.Conjugate(&p.Z) return p } -// ϕ assigns p to ϕ(a) where ϕ: (x,y) → (w x,y), and returns p -// where w is a third root of unity in 𝔽p -func (p *G2Jac) phi(a *G2Jac) *G2Jac { - p.Set(a) +// phi sets p to ϕ(a) where ϕ: (x,y) → (w x,y), +// where w is a third root of unity. +func (p *G2Jac) phi(q *G2Jac) *G2Jac { + p.Set(q) p.X.MulByElement(&p.X, &thirdRootOneG2) return p } // mulGLV computes the scalar multiplication using a windowed-GLV method +// // see https://www.iacr.org/archive/crypto2001/21390189.pdf -func (p *G2Jac) mulGLV(a *G2Jac, s *big.Int) *G2Jac { +func (p *G2Jac) mulGLV(q *G2Jac, s *big.Int) *G2Jac { var table [15]G2Jac var res G2Jac @@ -471,11 +631,11 @@ func (p *G2Jac) mulGLV(a *G2Jac, s *big.Int) *G2Jac { res.Set(&g2Infinity) - // table[b3b2b1b0-1] = b3b2 ⋅ ϕ(a) + b1b0*a - table[0].Set(a) - table[3].phi(a) + // table[b3b2b1b0-1] = b3b2 ⋅ ϕ(q) + b1b0*q + table[0].Set(q) + table[3].phi(q) - // split the scalar, modifies ±a, ϕ(a) accordingly + // split the scalar, modifies ±q, ϕ(q) accordingly k := ecc.SplitScalar(s, &glvBasis) if k[0].Sign() == -1 { @@ -488,7 +648,7 @@ func (p *G2Jac) mulGLV(a *G2Jac, s *big.Int) *G2Jac { } // precompute table (2 bits sliding window) - // table[b3b2b1b0-1] = b3b2 ⋅ ϕ(a) + b1b0 ⋅ a if b3b2b1b0 != 0 + // table[b3b2b1b0-1] = b3b2 ⋅ ϕ(q) + b1b0 ⋅ q if b3b2b1b0 != 0 table[1].Double(&table[0]) table[2].Set(&table[1]).AddAssign(&table[0]) table[4].Set(&table[3]).AddAssign(&table[0]) @@ -544,23 +704,23 @@ func (p *G2Affine) ClearCofactor(a *G2Affine) *G2Affine { } // ClearCofactor maps a point in curve to r-torsion -func (p *G2Jac) ClearCofactor(a *G2Jac) *G2Jac { +func (p *G2Jac) ClearCofactor(q *G2Jac) *G2Jac { // https://eprint.iacr.org/2017/419.pdf, 4.1 var xg, xxg, res, t G2Jac - xg.ScalarMultiplication(a, &xGen).Neg(&xg) - xxg.ScalarMultiplication(&xg, &xGen).Neg(&xxg) + xg.mulBySeed(q).Neg(&xg) + xxg.mulBySeed(&xg).Neg(&xxg) res.Set(&xxg). SubAssign(&xg). - SubAssign(a) + SubAssign(q) t.Set(&xg). - SubAssign(a). + SubAssign(q). psi(&t) res.AddAssign(&t) - t.Double(a) + t.Double(q) t.X.MulByElement(&t.X, &thirdRootOneG1) res.SubAssign(&t) @@ -572,16 +732,16 @@ func (p *G2Jac) ClearCofactor(a *G2Jac) *G2Jac { } // ------------------------------------------------------------------------------------------------- -// Jacobian extended +// extended Jacobian coordinates -// Set sets p to the provided point -func (p *g2JacExtended) Set(a *g2JacExtended) *g2JacExtended { - p.X, p.Y, p.ZZ, p.ZZZ = a.X, a.Y, a.ZZ, a.ZZZ +// Set sets p to a in extended Jacobian coordinates. +func (p *g2JacExtended) Set(q *g2JacExtended) *g2JacExtended { + p.X, p.Y, p.ZZ, p.ZZZ = q.X, q.Y, q.ZZ, q.ZZZ return p } -// setInfinity sets p to O -func (p *g2JacExtended) setInfinity() *g2JacExtended { +// SetInfinity sets p to the infinity point (1,1,0,0). +func (p *g2JacExtended) SetInfinity() *g2JacExtended { p.X.SetOne() p.Y.SetOne() p.ZZ = fptower.E2{} @@ -589,44 +749,47 @@ func (p *g2JacExtended) setInfinity() *g2JacExtended { return p } -func (p *g2JacExtended) IsZero() bool { +// IsInfinity checks if the p is infinity, i.e. p.ZZ=0. +func (p *g2JacExtended) IsInfinity() bool { return p.ZZ.IsZero() } -// fromJacExtended sets Q in affine coordinates -func (p *G2Affine) fromJacExtended(Q *g2JacExtended) *G2Affine { - if Q.ZZ.IsZero() { +// fromJacExtended converts an extended Jacobian point to an affine point. +func (p *G2Affine) fromJacExtended(q *g2JacExtended) *G2Affine { + if q.ZZ.IsZero() { p.X = fptower.E2{} p.Y = fptower.E2{} return p } - p.X.Inverse(&Q.ZZ).Mul(&p.X, &Q.X) - p.Y.Inverse(&Q.ZZZ).Mul(&p.Y, &Q.Y) + p.X.Inverse(&q.ZZ).Mul(&p.X, &q.X) + p.Y.Inverse(&q.ZZZ).Mul(&p.Y, &q.Y) return p } -// fromJacExtended sets Q in Jacobian coordinates -func (p *G2Jac) fromJacExtended(Q *g2JacExtended) *G2Jac { - if Q.ZZ.IsZero() { +// fromJacExtended converts an extended Jacobian point to a Jacobian point. +func (p *G2Jac) fromJacExtended(q *g2JacExtended) *G2Jac { + if q.ZZ.IsZero() { p.Set(&g2Infinity) return p } - p.X.Mul(&Q.ZZ, &Q.X).Mul(&p.X, &Q.ZZ) - p.Y.Mul(&Q.ZZZ, &Q.Y).Mul(&p.Y, &Q.ZZZ) - p.Z.Set(&Q.ZZZ) + p.X.Mul(&q.ZZ, &q.X).Mul(&p.X, &q.ZZ) + p.Y.Mul(&q.ZZZ, &q.Y).Mul(&p.Y, &q.ZZZ) + p.Z.Set(&q.ZZZ) return p } -// unsafeFromJacExtended sets p in Jacobian coordinates, but don't check for infinity -func (p *G2Jac) unsafeFromJacExtended(Q *g2JacExtended) *G2Jac { - p.X.Square(&Q.ZZ).Mul(&p.X, &Q.X) - p.Y.Square(&Q.ZZZ).Mul(&p.Y, &Q.Y) - p.Z = Q.ZZZ +// unsafeFromJacExtended converts an extended Jacobian point, distinct from Infinity, to a Jacobian point. +func (p *G2Jac) unsafeFromJacExtended(q *g2JacExtended) *G2Jac { + p.X.Square(&q.ZZ).Mul(&p.X, &q.X) + p.Y.Square(&q.ZZZ).Mul(&p.Y, &q.Y) + p.Z = q.ZZZ return p } -// add point in Jacobian extended coordinates +// add sets p to p+q in extended Jacobian coordinates. +// // https://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#addition-add-2008-s +// ~Cost: 12M + 2S func (p *g2JacExtended) add(q *g2JacExtended) *g2JacExtended { //if q is infinity return p if q.ZZ.IsZero() { @@ -681,10 +844,13 @@ func (p *g2JacExtended) add(q *g2JacExtended) *g2JacExtended { return p } -// double point in Jacobian extended coordinates +// double sets p to [2]q in Jacobian extended coordinates. +// // http://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#doubling-dbl-2008-s-1 -// since we consider any point on Z=0 as the point at infinity -// this doubling formula works for infinity points as well +// ~Cost: 6M + 3S +// +// N.B.: since we consider any point on Z=0 as the point at infinity +// this doubling formula works for infinity points as well. func (p *g2JacExtended) double(q *g2JacExtended) *g2JacExtended { var U, V, W, S, XX, M fptower.E2 @@ -694,7 +860,7 @@ func (p *g2JacExtended) double(q *g2JacExtended) *g2JacExtended { S.Mul(&q.X, &V) XX.Square(&q.X) M.Double(&XX). - Add(&M, &XX) // -> + a, but a=0 here + Add(&M, &XX) // -> + A, but A=0 here U.Mul(&W, &q.Y) p.X.Square(&M). @@ -709,9 +875,11 @@ func (p *g2JacExtended) double(q *g2JacExtended) *g2JacExtended { return p } -// subMixed same as addMixed, but will negate a.Y +// addMixed sets p to p+q in extended Jacobian coordinates, where a.ZZ=1. +// // http://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#addition-madd-2008-s -func (p *g2JacExtended) subMixed(a *G2Affine) *g2JacExtended { +// ~Cost: 8M + 2S +func (p *g2JacExtended) addMixed(a *G2Affine) *g2JacExtended { //if a is infinity return p if a.IsInfinity() { @@ -720,7 +888,7 @@ func (p *g2JacExtended) subMixed(a *G2Affine) *g2JacExtended { // p is infinity, return a if p.ZZ.IsZero() { p.X = a.X - p.Y.Neg(&a.Y) + p.Y = a.Y p.ZZ.SetOne() p.ZZZ.SetOne() return p @@ -733,12 +901,11 @@ func (p *g2JacExtended) subMixed(a *G2Affine) *g2JacExtended { P.Sub(&P, &p.X) R.Mul(&a.Y, &p.ZZZ) - R.Neg(&R) R.Sub(&R, &p.Y) if P.IsZero() { if R.IsZero() { - return p.doubleNegMixed(a) + return p.doubleMixed(a) } p.ZZ = fptower.E2{} @@ -765,9 +932,11 @@ func (p *g2JacExtended) subMixed(a *G2Affine) *g2JacExtended { } -// addMixed +// subMixed works the same as addMixed, but negates a.Y. +// // http://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#addition-madd-2008-s -func (p *g2JacExtended) addMixed(a *G2Affine) *g2JacExtended { +// ~Cost: 8M + 2S +func (p *g2JacExtended) subMixed(a *G2Affine) *g2JacExtended { //if a is infinity return p if a.IsInfinity() { @@ -776,7 +945,7 @@ func (p *g2JacExtended) addMixed(a *G2Affine) *g2JacExtended { // p is infinity, return a if p.ZZ.IsZero() { p.X = a.X - p.Y = a.Y + p.Y.Neg(&a.Y) p.ZZ.SetOne() p.ZZZ.SetOne() return p @@ -789,11 +958,12 @@ func (p *g2JacExtended) addMixed(a *G2Affine) *g2JacExtended { P.Sub(&P, &p.X) R.Mul(&a.Y, &p.ZZZ) + R.Neg(&R) R.Sub(&R, &p.Y) if P.IsZero() { if R.IsZero() { - return p.doubleMixed(a) + return p.doubleNegMixed(a) } p.ZZ = fptower.E2{} @@ -820,54 +990,57 @@ func (p *g2JacExtended) addMixed(a *G2Affine) *g2JacExtended { } -// doubleNegMixed same as double, but will negate q.Y -func (p *g2JacExtended) doubleNegMixed(q *G2Affine) *g2JacExtended { +// doubleNegMixed works the same as doubleMixed, but negates q.Y. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#doubling-mdbl-2008-s-1 +// ~Cost: 4M + 3S +func (p *g2JacExtended) doubleNegMixed(a *G2Affine) *g2JacExtended { - var U, V, W, S, XX, M, S2, L fptower.E2 + var U, V, W, S, M, t fptower.E2 - U.Double(&q.Y) + U.Double(&a.Y) U.Neg(&U) V.Square(&U) W.Mul(&U, &V) - S.Mul(&q.X, &V) - XX.Square(&q.X) - M.Double(&XX). - Add(&M, &XX) // -> + a, but a=0 here - S2.Double(&S) - L.Mul(&W, &q.Y) - - p.X.Square(&M). - Sub(&p.X, &S2) + S.Mul(&a.X, &V) + t.Square(&a.X) + M.Double(&t). + Add(&M, &t) // -> + A, but A=0 here + p.X.Square(&M) + t.Double(&S) + p.X.Sub(&p.X, &t) + t.Mul(&W, &a.Y) p.Y.Sub(&S, &p.X). Mul(&p.Y, &M). - Add(&p.Y, &L) + Add(&p.Y, &t) p.ZZ.Set(&V) p.ZZZ.Set(&W) return p } -// doubleMixed point in Jacobian extended coordinates -// http://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#doubling-dbl-2008-s-1 -func (p *g2JacExtended) doubleMixed(q *G2Affine) *g2JacExtended { +// doubleMixed sets p to [2]a in Jacobian extended coordinates, where a.ZZ=1. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#doubling-mdbl-2008-s-1 +// ~Cost: 4M + 3S +func (p *g2JacExtended) doubleMixed(a *G2Affine) *g2JacExtended { - var U, V, W, S, XX, M, S2, L fptower.E2 + var U, V, W, S, M, t fptower.E2 - U.Double(&q.Y) + U.Double(&a.Y) V.Square(&U) W.Mul(&U, &V) - S.Mul(&q.X, &V) - XX.Square(&q.X) - M.Double(&XX). - Add(&M, &XX) // -> + a, but a=0 here - S2.Double(&S) - L.Mul(&W, &q.Y) - - p.X.Square(&M). - Sub(&p.X, &S2) + S.Mul(&a.X, &V) + t.Square(&a.X) + M.Double(&t). + Add(&M, &t) // -> + A, but A=0 here + p.X.Square(&M) + t.Double(&S) + p.X.Sub(&p.X, &t) + t.Mul(&W, &a.Y) p.Y.Sub(&S, &p.X). Mul(&p.Y, &M). - Sub(&p.Y, &L) + Sub(&p.Y, &t) p.ZZ.Set(&V) p.ZZZ.Set(&W) @@ -875,38 +1048,38 @@ func (p *g2JacExtended) doubleMixed(q *G2Affine) *g2JacExtended { } // ------------------------------------------------------------------------------------------------- -// Homogenous projective +// Homogenous projective coordinates -// Set sets p to the provided point -func (p *g2Proj) Set(a *g2Proj) *g2Proj { - p.x, p.y, p.z = a.x, a.y, a.z +// Set sets p to a in projective coordinates. +func (p *g2Proj) Set(q *g2Proj) *g2Proj { + p.x, p.y, p.z = q.x, q.y, q.z return p } -// Neg computes -G -func (p *g2Proj) Neg(a *g2Proj) *g2Proj { - *p = *a - p.y.Neg(&a.y) +// Neg sets p to the projective negative point -q = (q.X, -q.Y). +func (p *g2Proj) Neg(q *g2Proj) *g2Proj { + *p = *q + p.y.Neg(&q.y) return p } -// FromAffine sets p = Q, p in homogenous projective, Q in affine -func (p *g2Proj) FromAffine(Q *G2Affine) *g2Proj { - if Q.X.IsZero() && Q.Y.IsZero() { +// FromAffine converts q in affine to p in projective coordinates. +func (p *g2Proj) FromAffine(a *G2Affine) *g2Proj { + if a.X.IsZero() && a.Y.IsZero() { p.z.SetZero() p.x.SetOne() p.y.SetOne() return p } p.z.SetOne() - p.x.Set(&Q.X) - p.y.Set(&Q.Y) + p.x.Set(&a.X) + p.y.Set(&a.Y) return p } // BatchScalarMultiplicationG2 multiplies the same base by all scalars // and return resulting points in affine coordinates -// uses a simple windowed-NAF like exponentiation algorithm +// uses a simple windowed-NAF-like multiplication algorithm. func BatchScalarMultiplicationG2(base *G2Affine, scalars []fr.Element) []G2Affine { // approximate cost in group ops is // cost = 2^{c-1} + n(scalar.nbBits+nbChunks) @@ -985,18 +1158,29 @@ func BatchScalarMultiplicationG2(base *G2Affine, scalars []fr.Element) []G2Affin return toReturn } -// batch add affine coordinates -// using batch inversion -// special cases (doubling, infinity) must be filtered out before this call +// batchAddG2Affine adds affine points using the Montgomery batch inversion trick. +// Special cases (doubling, infinity) must be filtered out before this call. func batchAddG2Affine[TP pG2Affine, TPP ppG2Affine, TC cG2Affine](R *TPP, P *TP, batchSize int) { var lambda, lambdain TC - // add part + // from https://docs.zkproof.org/pages/standards/accepted-workshop3/proposal-turbo_plonk.pdf + // affine point addition formula + // R(X1, Y1) + P(X2, Y2) = Q(X3, Y3) + // λ = (Y2 - Y1) / (X2 - X1) + // X3 = λ² - (X1 + X2) + // Y3 = λ * (X1 - X3) - Y1 + + // first we compute the 1 / (X2 - X1) for all points using Montgomery batch inversion trick + + // X2 - X1 for j := 0; j < batchSize; j++ { lambdain[j].Sub(&(*P)[j].X, &(*R)[j].X) } - // invert denominator using montgomery batch invert technique + // montgomery batch inversion; + // lambda[0] = 1 / (P[0].X - R[0].X) + // lambda[1] = 1 / (P[1].X - R[1].X) + // ... { var accumulator fptower.E2 lambda[0].SetOne() @@ -1016,22 +1200,41 @@ func batchAddG2Affine[TP pG2Affine, TPP ppG2Affine, TC cG2Affine](R *TPP, P *TP, lambda[0].Set(&accumulator) } - var d fptower.E2 - var rr G2Affine + var t fptower.E2 + var Q G2Affine - // add part for j := 0; j < batchSize; j++ { - // computa lambda - d.Sub(&(*P)[j].Y, &(*R)[j].Y) - lambda[j].Mul(&lambda[j], &d) - - // compute X, Y - rr.X.Square(&lambda[j]) - rr.X.Sub(&rr.X, &(*R)[j].X) - rr.X.Sub(&rr.X, &(*P)[j].X) - d.Sub(&(*R)[j].X, &rr.X) - rr.Y.Mul(&lambda[j], &d) - rr.Y.Sub(&rr.Y, &(*R)[j].Y) - (*R)[j].Set(&rr) + // λ = (Y2 - Y1) / (X2 - X1) + t.Sub(&(*P)[j].Y, &(*R)[j].Y) + lambda[j].Mul(&lambda[j], &t) + + // X3 = λ² - (X1 + X2) + Q.X.Square(&lambda[j]) + Q.X.Sub(&Q.X, &(*R)[j].X) + Q.X.Sub(&Q.X, &(*P)[j].X) + + // Y3 = λ * (X1 - X3) - Y1 + t.Sub(&(*R)[j].X, &Q.X) + Q.Y.Mul(&lambda[j], &t) + Q.Y.Sub(&Q.Y, &(*R)[j].Y) + + (*R)[j].Set(&Q) } } + +// RandomOnG2 produces a random point in G2 +// using standard map-to-curve methods, which means the relative discrete log +// of the generated point with respect to the canonical generator is not known. +func RandomOnG2() (G2Affine, error) { + if gBytes, err := randomFrSizedBytes(); err != nil { + return G2Affine{}, err + } else { + return HashToG2(gBytes, []byte("random on g2")) + } +} + +func randomFrSizedBytes() ([]byte, error) { + res := make([]byte, fr.Bytes) + _, err := rand.Read(res) + return res, err +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/hash_to_curve/g1.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/hash_to_curve/g1.go new file mode 100644 index 000000000..9928ca0e8 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/hash_to_curve/g1.go @@ -0,0 +1,230 @@ +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package hash_to_curve + +import ( + "math/big" + + "github.com/consensys/gnark-crypto/ecc/bls12-381/fp" +) + +// Note: This only works for simple extensions + +var ( + g1sswuCurveACoeff = fp.Element{3415322872136444497, 9675504606121301699, 13284745414851768802, 2873609449387478652, 2897906769629812789, 1536947672689614213} + g1sswuCurveBCoeff = fp.Element{18129637713272545760, 11144507692959411567, 10108153527111632324, 9745270364868568433, 14587922135379007624, 469008097655535723} +) + +var g1sswuCurveZ = fp.Element{9830232086645309404, 1112389714365644829, 8603885298299447491, 11361495444721768256, 5788602283869803809, 543934104870762216} + +// G1SSWUCurveCoefficients returns the coefficients of the SSWU curve. +func G1SSWUIsogenyCurveCoefficients() (A fp.Element, B fp.Element) { + return g1sswuCurveACoeff, g1sswuCurveBCoeff +} + +// G1SSWUIsogenyZ returns the recommended Z value of the SSWU curve. +// +// See https://www.rfc-editor.org/rfc/rfc9380.html#weierstrass +func G1SSWUIsogenyZ() fp.Element { + return g1sswuCurveZ +} + +var ( + g1IsogenyXNumeratorMap = []fp.Element{ + {5555391298090832668, 1871845530032595596, 4551034694774233518, 2584197799339864836, 15085749040064757844, 654075415717002996}, + {9910598932128054667, 4357765064159749802, 1555960221863322426, 9671461638228026285, 1275132148248838779, 507072521670460589}, + {11908177372061066827, 18190436643933350086, 6603102998733829542, 6581045210674032871, 16099974426311393401, 541581077397919012}, + {5282195870529824577, 12365729195083706401, 2807246122435955773, 332702220601507168, 7339422050895811209, 1050416448951884523}, + {10443415753526299973, 8852419397684277637, 1088333252544296036, 1174353327457337436, 1626144519293139599, 716651429285276662}, + {7916646322956281527, 11909818257232418749, 1455301921509471421, 3317627683558310107, 12693445337245173919, 1798273032850409769}, + {2577731109215284733, 8810166123993386985, 3186592767751348067, 15050850291391518479, 18435652654155870871, 1330813445865859326}, + {8787912969482053798, 9653629252694769025, 1358451377919714320, 16331599695590198629, 13519934665722691825, 628078949001449512}, + {16605411443261943819, 9536014432113026165, 8685402948537367476, 16291074259433785035, 407185289045737198, 713426768049972652}, + {1001421273809907975, 724433776290697394, 16309429154639760781, 10003715605277815375, 307249038158020985, 688008371043525493}, + {16622893420529658311, 18333652517857227637, 2139173376235292830, 16496634502105693419, 5355299366650241487, 382770009771704860}, + {8276255265012938363, 9997870203437298645, 16819210142450232135, 5062450688048499179, 12776432501206859311, 1778476024187613533}, + } + g1IsogenyXDenominatorMap = []fp.Element{ + {13358415881952098629, 12009257493157516192, 13928884382876484932, 12988314785833227070, 11244145530317148182, 100673949996487007}, + {2533162896381624793, 10578896196504721258, 4263020647280931071, 1255899686249737875, 17097124965295857733, 590960935246623182}, + {10990404485039254780, 5344458621503091696, 1718862119039451458, 11600049052019063549, 18389973225607751698, 1092616849767867362}, + {16377845895484993601, 15314247056264135931, 14543008873173635408, 4875476272346940127, 2030129768648768484, 1297689274107773964}, + {6376927397170316667, 1460555178565443615, 18156708192400235081, 14761117739963869762, 8361091377443400626, 1421233557303902229}, + {18127417459170613536, 5353764292720778676, 858818813615405862, 3528937506143354306, 12604964186779349896, 489837025077541867}, + {15285065477075910543, 3650488990300576179, 7274499670465195193, 16100555180954076900, 7580582425312971905, 896074979407586822}, + {7582945168915351799, 2506680954090651888, 10272835934257987876, 9924916350558121763, 13577194922650729507, 1698254565890367778}, + {2009730524583761661, 11053280693947850663, 14409256190409559425, 3658799329773368860, 13529638021208614900, 869243908766415668}, + {11058048790650732295, 7059501760293999296, 6596812464094265283, 14567744481299745071, 1591898617514919697, 1344004358835331304}, + } + g1IsogenyYNumeratorMap = []fp.Element{ + {3122824077082063463, 2111517899915568999, 14844585557031220083, 14713720721132803039, 9041847780307969683, 950267513573868304}, + {11079511902567680319, 18338468344530008184, 6769016392463638666, 1504264063027988936, 8098359051856762276, 760455062874047829}, + {1430247552210236986, 3854575382974307965, 14917507996414511245, 207936139448560, 9498310774218301406, 1438631746617682181}, + {6654065794071117243, 2928282753802966791, 4144383358731160429, 12673586709493869907, 12918170109018188791, 844088361957958231}, + {6416330705244672319, 3552017270878949117, 7777490944331917312, 7917192495177481567, 7271851377118683537, 253926972271069325}, + {11903306495973637341, 11622313950541285762, 17991208474928993001, 12280964980743791783, 14941570282955772167, 143516344770893715}, + {7324386472845891920, 16310961984705608217, 14050364318273732029, 410622978843904432, 13407944087243235067, 570579643952782879}, + {10655681039374273828, 3913226275392147601, 9613292388335178165, 11852815148890010639, 17652581670569921892, 780578093363976825}, + {10454026283255684948, 15005802245309313587, 4420421943175638630, 18052347756729021570, 12181908985148691767, 1485233717472293779}, + {5056344670784885274, 15896288289018563095, 11120951801157184493, 7250506164525313606, 9295677455526059106, 1757175036496698059}, + {417067620545670182, 113740147118943311, 7666319924200602156, 1469963335415292317, 13482947512490784447, 1353298443678343909}, + {13069093794065563159, 18364685236451803588, 2235996605706292724, 1007629142299662669, 4077244143222018961, 162586537120788900}, + {12976751790971550752, 10256454045927919861, 8968423978443605586, 91636529236982767, 9459527627289574163, 949550897353139410}, + {10595118024452621845, 8010256778549625402, 10333144214150401956, 17682229685967587631, 8235697699445463546, 317883997785997129}, + {16894283457285346118, 10513943172407809423, 4685513162956315481, 11558261883362075118, 574375951146893083, 1159440548124233311}, + {9739780494108151959, 17207219630538774058, 553911396609642498, 6085929320386029624, 14175410874026216616, 1183751611824804793}, + } + g1IsogenyYDenominatorMap = []fp.Element{ + {16963992846030154524, 1796759822929186144, 15995221960860457854, 8232142361908220707, 5977498266010213481, 759868220591477233}, + {7019489280640006651, 8025136855967848721, 17464762292772824538, 4490335113250743896, 7652702793653159798, 1129822927746498110}, + {3164260796573156764, 2639884922337322818, 1251365706181388855, 13142429936036186189, 359878619957828340, 126848055205862465}, + {17472832885692408710, 9911075278795900735, 2614390623136861791, 14474775734428698630, 6462878218464609418, 1225960780180864957}, + {3586995257703132870, 2143554115308730112, 15207899356205612465, 4372523065560113828, 12811868595146042778, 307251632623424763}, + {14298637377310410728, 10963101290308221781, 8192510423058716701, 1175370967867267532, 1029599188863854120, 678981456155013844}, + {11149806480082726900, 3664985661428410608, 18095361538178773836, 14174906593575241395, 15305104369759711886, 901234928011491053}, + {4727074327869776987, 15736954329525418288, 14642679026711520511, 11429849039208981702, 17333567062758618213, 951235897335772166}, + {9130114290642375589, 14069725355798443159, 6621984191700563591, 270173975669947883, 6218390495944243859, 1077419361593130421}, + {9144875514986933294, 16561351410666797616, 8591333879886582656, 15059370240386191395, 7834396448114781869, 946553772269403391}, + {17809450171377747225, 15896956440537434491, 8451524482089653422, 1694507265233574136, 18224201536921880842, 317503425606567070}, + {13940503876759740187, 8772047862193200131, 6080360161890657205, 7935486160089058373, 9407473295146243021, 1255078947940629503}, + {1160821217138360586, 13542760608074182996, 11595911004531652098, 18158686636947034451, 13330657138280564947, 1773960737279760188}, + {9132548444917292754, 16464415422105000789, 6319313500251671073, 12727658548847517900, 10985275115076354035, 1431541893474124246}, + {662485641082390837, 260809847827618849, 6177381409359357075, 18231947741742261351, 18128540110746580014, 1079107229429227022}, + } +) + +// G1IsogenyMap returns the isogeny map for the curve. +// The isogeny map is a list of polynomial coefficients for the x and y coordinate computation. +// The order of the coefficients is as follows: +// - x numerator, x denominator, y numerator, y denominator. +func G1IsogenyMap() [4][]fp.Element { + return [4][]fp.Element{ + g1IsogenyXNumeratorMap, + g1IsogenyXDenominatorMap, + g1IsogenyYNumeratorMap, + g1IsogenyYDenominatorMap, + } +} + +func g1IsogenyXNumerator(dst *fp.Element, x *fp.Element) { + g1EvalPolynomial(dst, false, g1IsogenyXNumeratorMap, x) +} + +func g1IsogenyXDenominator(dst *fp.Element, x *fp.Element) { + g1EvalPolynomial(dst, true, g1IsogenyXDenominatorMap, x) +} + +func g1IsogenyYNumerator(dst *fp.Element, x *fp.Element, y *fp.Element) { + var _dst fp.Element + g1EvalPolynomial(&_dst, false, g1IsogenyYNumeratorMap, x) + dst.Mul(&_dst, y) +} + +func g1IsogenyYDenominator(dst *fp.Element, x *fp.Element) { + g1EvalPolynomial(dst, true, g1IsogenyYDenominatorMap, x) +} + +// G1 computes the isogeny map of the curve element, given by its coordinates pX and pY. +// It mutates the coordinates pX and pY to the new coordinates of the isogeny map. +func G1Isogeny(pX, pY *fp.Element) { + + den := make([]fp.Element, 2) + + g1IsogenyYDenominator(&den[1], pX) + g1IsogenyXDenominator(&den[0], pX) + + g1IsogenyYNumerator(pY, pX, pY) + g1IsogenyXNumerator(pX, pX) + + den = fp.BatchInvert(den) + + pX.Mul(pX, &den[0]) + pY.Mul(pY, &den[1]) +} + +// G1SqrtRatio computes the square root of u/v and returns 0 iff u/v was indeed a quadratic residue. +// If not, we get sqrt(Z * u / v). Recall that Z is non-residue. +// If v = 0, u/v is meaningless and the output is unspecified, without raising an error. +// The main idea is that since the computation of the square root involves taking large powers of u/v, the inversion of v can be avoided +func G1SqrtRatio(z *fp.Element, u *fp.Element, v *fp.Element) uint64 { + // https://www.rfc-editor.org/rfc/rfc9380.html#name-optimized-sqrt_ratio-for-q- (3 mod 4) + var tv1 fp.Element + tv1.Square(v) // 1. tv1 = v² + var tv2 fp.Element + tv2.Mul(u, v) // 2. tv2 = u * v + tv1.Mul(&tv1, &tv2) // 3. tv1 = tv1 * tv2 + + var y1 fp.Element + { + var c1 big.Int + // c1 = 1000602388805416848354447456433976039139220704984751971333014534031007912622709466110671907282253916009473568139946 + c1.SetBytes([]byte{6, 128, 68, 122, 142, 95, 249, 166, 146, 198, 233, 237, 144, 210, 235, 53, 217, 29, 210, 225, 60, 225, 68, 175, 217, 204, 52, 168, 61, 172, 61, 137, 7, 170, 255, 255, 172, 84, 255, 255, 238, 127, 191, 255, 255, 255, 234, 170}) // c1 = (q - 3) / 4 # Integer arithmetic + + y1.Exp(tv1, &c1) // 4. y1 = tv1ᶜ¹ + } + + y1.Mul(&y1, &tv2) // 5. y1 = y1 * tv2 + + var y2 fp.Element + // c2 = sqrt(-Z) + tv3 := fp.Element{17544630987809824292, 17306709551153317753, 8299808889594647786, 5930295261504720397, 675038575008112577, 167386374569371918} + y2.Mul(&y1, &tv3) // 6. y2 = y1 * c2 + tv3.Square(&y1) // 7. tv3 = y1² + tv3.Mul(&tv3, v) // 8. tv3 = tv3 * v + isQNr := tv3.NotEqual(u) // 9. isQR = tv3 == u + z.Select(int(isQNr), &y1, &y2) // 10. y = CMOV(y2, y1, isQR) + return isQNr +} + +// G1MulByZ multiplies x by [11] and stores the result in z +func G1MulByZ(z *fp.Element, x *fp.Element) { + + res := *x + + res.Double(&res) + res.Double(&res) + res.Add(&res, x) + res.Double(&res) + res.Add(&res, x) + + *z = res +} + +func g1EvalPolynomial(z *fp.Element, monic bool, coefficients []fp.Element, x *fp.Element) { + dst := coefficients[len(coefficients)-1] + + if monic { + dst.Add(&dst, x) + } + + for i := len(coefficients) - 2; i >= 0; i-- { + dst.Mul(&dst, x) + dst.Add(&dst, &coefficients[i]) + } + + z.Set(&dst) +} + +// G1Sgn0 is an algebraic substitute for the notion of sign in ordered fields. +// Namely, every non-zero quadratic residue in a finite field of characteristic =/= 2 has exactly two square roots, one of each sign. +// +// See: https://www.rfc-editor.org/rfc/rfc9380.html#name-the-sgn0-function +// +// The sign of an element is not obviously related to that of its Montgomery form +func G1Sgn0(z *fp.Element) uint64 { + + nonMont := z.Bits() + + // m == 1 + return nonMont[0] % 2 + +} + +func G1NotZero(x *fp.Element) uint64 { + + return x[0] | x[1] | x[2] | x[3] | x[4] | x[5] + +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/hash_to_curve/g2.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/hash_to_curve/g2.go new file mode 100644 index 000000000..45c1bc126 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/hash_to_curve/g2.go @@ -0,0 +1,290 @@ +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package hash_to_curve + +import ( + "math/big" + + "github.com/consensys/gnark-crypto/ecc/bls12-381/fp" + "github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower" +) + +// Note: This only works for simple extensions + +var ( + g2sswuCurveACoeff = fptower.E2{ + A0: fp.Element{0}, + A1: fp.Element{16517514583386313282, 74322656156451461, 16683759486841714365, 815493829203396097, 204518332920448171, 1306242806803223655}, + } + g2sswuCurveBCoeff = fptower.E2{ + A0: fp.Element{2515823342057463218, 7982686274772798116, 7934098172177393262, 8484566552980779962, 4455086327883106868, 1323173589274087377}, + A1: fp.Element{2515823342057463218, 7982686274772798116, 7934098172177393262, 8484566552980779962, 4455086327883106868, 1323173589274087377}, + } +) + +var g2sswuCurveZ = fptower.E2{ + A0: fp.Element{9794203289623549276, 7309342082925068282, 1139538881605221074, 15659550692327388916, 16008355200866287827, 582484205531694093}, + A1: fp.Element{4897101644811774638, 3654671041462534141, 569769440802610537, 17053147383018470266, 17227549637287919721, 291242102765847046}, +} + +// G2SSWUCurveCoefficients returns the coefficients of the SSWU curve. +func G2SSWUIsogenyCurveCoefficients() (A fptower.E2, B fptower.E2) { + return g2sswuCurveACoeff, g2sswuCurveBCoeff +} + +// G2SSWUIsogenyZ returns the recommended Z value of the SSWU curve. +// +// See https://www.rfc-editor.org/rfc/rfc9380.html#weierstrass +func G2SSWUIsogenyZ() fptower.E2 { + return g2sswuCurveZ +} + +var ( + g2IsogenyXNumeratorMap = []fptower.E2{ + { + A0: fp.Element{5185457120960601698, 494647221959407934, 8971396042087821730, 324544954362548322, 14214792730224113654, 1405280679127738945}, + A1: fp.Element{5185457120960601698, 494647221959407934, 8971396042087821730, 324544954362548322, 14214792730224113654, 1405280679127738945}, + }, + { + A0: fp.Element{0}, + A1: fp.Element{6910023028261548496, 9745789443900091043, 7668299866710145304, 2432656849393633605, 2897729527445498821, 776645607375592125}, + }, + { + A0: fp.Element{724047465092313539, 15783990863276714670, 12824896677063784855, 15246381572572671516, 13186611051602728692, 1485475813959743803}, + A1: fp.Element{12678383550985550056, 4872894721950045521, 13057521970209848460, 10439700461551592610, 10672236800577525218, 388322803687796062}, + }, + { + A0: fp.Element{4659755689450087917, 1804066951354704782, 15570919779568036803, 15592734958806855601, 7597208057374167129, 1841438384006890194}, + A1: fp.Element{0}, + }, + } + g2IsogenyXDenominatorMap = []fptower.E2{ + { + A0: fp.Element{0}, + A1: fp.Element{2250392438786206615, 17463829474098544446, 14571211649711714824, 4495761442775821336, 258811604141191305, 357646605018048850}, + }, + { + A0: fp.Element{4933130441833534766, 15904462746612662304, 8034115857496836953, 12755092135412849606, 7007796720291435703, 252692002104915169}, + A1: fp.Element{8469300574244328829, 4752422838614097887, 17848302789776796362, 12930989898711414520, 16851051131888818207, 1621106615542624696}, + }, + } + g2IsogenyYNumeratorMap = []fptower.E2{ + { + A0: fp.Element{10869708750642247614, 13056187057366814946, 1750362034917495549, 6326189602300757217, 1140223926335695785, 632761649765668291}, + A1: fp.Element{10869708750642247614, 13056187057366814946, 1750362034917495549, 6326189602300757217, 1140223926335695785, 632761649765668291}, + }, + { + A0: fp.Element{0}, + A1: fp.Element{13765940311003083782, 5579209876153186557, 11349908400803699438, 11707848830955952341, 199199289641242246, 899896674917908607}, + }, + { + A0: fp.Element{15562563812347550836, 2436447360975022760, 6528760985104924230, 5219850230775796305, 5336118400288762609, 194161401843898031}, + A1: fp.Element{16286611277439864375, 18220438224251737430, 906913588459157469, 2019487729638916206, 75985378181939686, 1679637215803641835}, + }, + { + A0: fp.Element{11849179119594500956, 13906615243538674725, 14543197362847770509, 2041759640812427310, 2879701092679313252, 1259985822978576468}, + A1: fp.Element{0}, + }, + } + g2IsogenyYDenominatorMap = []fptower.E2{ + { + A0: fp.Element{99923616639376095, 10339114964526300021, 6204619029868000785, 1288486622530663893, 14587509920085997152, 272081012460753233}, + A1: fp.Element{99923616639376095, 10339114964526300021, 6204619029868000785, 1288486622530663893, 14587509920085997152, 272081012460753233}, + }, + { + A0: fp.Element{0}, + A1: fp.Element{6751177316358619845, 15498000274876530106, 6820146801716041242, 13487284328327464010, 776434812423573915, 1072939815054146550}, + }, + { + A0: fp.Element{7399695662750302149, 14633322083064217648, 12051173786245255430, 9909266166264498601, 1288323043582377747, 379038003157372754}, + A1: fp.Element{6002735353327561446, 6023563502162542543, 13831244861028377885, 15776815867859765525, 4123780734888324547, 1494760614490167112}, + }, + } +) + +// G2IsogenyMap returns the isogeny map for the curve. +// The isogeny map is a list of polynomial coefficients for the x and y coordinate computation. +// The order of the coefficients is as follows: +// - x numerator, x denominator, y numerator, y denominator. +func G2IsogenyMap() [4][]fptower.E2 { + return [4][]fptower.E2{ + g2IsogenyXNumeratorMap, + g2IsogenyXDenominatorMap, + g2IsogenyYNumeratorMap, + g2IsogenyYDenominatorMap, + } +} + +func g2IsogenyXNumerator(dst *fptower.E2, x *fptower.E2) { + g2EvalPolynomial(dst, false, g2IsogenyXNumeratorMap, x) +} + +func g2IsogenyXDenominator(dst *fptower.E2, x *fptower.E2) { + g2EvalPolynomial(dst, true, g2IsogenyXDenominatorMap, x) +} + +func g2IsogenyYNumerator(dst *fptower.E2, x *fptower.E2, y *fptower.E2) { + var _dst fptower.E2 + g2EvalPolynomial(&_dst, false, g2IsogenyYNumeratorMap, x) + dst.Mul(&_dst, y) +} + +func g2IsogenyYDenominator(dst *fptower.E2, x *fptower.E2) { + g2EvalPolynomial(dst, true, g2IsogenyYDenominatorMap, x) +} + +// G2 computes the isogeny map of the curve element, given by its coordinates pX and pY. +// It mutates the coordinates pX and pY to the new coordinates of the isogeny map. +func G2Isogeny(pX, pY *fptower.E2) { + + den := make([]fptower.E2, 2) + + g2IsogenyYDenominator(&den[1], pX) + g2IsogenyXDenominator(&den[0], pX) + + g2IsogenyYNumerator(pY, pX, pY) + g2IsogenyXNumerator(pX, pX) + + den = fptower.BatchInvertE2(den) + + pX.Mul(pX, &den[0]) + pY.Mul(pY, &den[1]) +} + +// G2SqrtRatio computes the square root of u/v and returns 0 iff u/v was indeed a quadratic residue. +// If not, we get sqrt(Z * u / v). Recall that Z is non-residue. +// If v = 0, u/v is meaningless and the output is unspecified, without raising an error. +// The main idea is that since the computation of the square root involves taking large powers of u/v, the inversion of v can be avoided +func G2SqrtRatio(z *fptower.E2, u *fptower.E2, v *fptower.E2) uint64 { + + // https://www.rfc-editor.org/rfc/rfc9380.html#name-sqrt_ratio-for-any-field + + tv1 := fptower.E2{ + A0: fp.Element{8921533702591418330, 15859389534032789116, 3389114680249073393, 15116930867080254631, 3288288975085550621, 1021049300055853010}, + A1: fp.Element{8921533702591418330, 15859389534032789116, 3389114680249073393, 15116930867080254631, 3288288975085550621, 1021049300055853010}, + } //tv1 = c6 + + var tv2, tv3, tv4, tv5 fptower.E2 + var exp big.Int + // c4 = 7 = 2³ - 1 + // q is odd so c1 is at least 1. + exp.SetBytes([]byte{7}) + + tv2.Exp(*v, &exp) // 2. tv2 = vᶜ⁴ + tv3.Square(&tv2) // 3. tv3 = tv2² + tv3.Mul(&tv3, v) // 4. tv3 = tv3 * v + tv5.Mul(u, &tv3) // 5. tv5 = u * tv3 + + // c3 = 1001205140483106588246484290269935788605945006208159541241399033561623546780709821462541004956387089373434649096260670658193992783731681621012512651314777238193313314641988297376025498093520728838658813979860931248214124593092835 + exp.SetBytes([]byte{42, 67, 122, 75, 140, 53, 252, 116, 189, 39, 142, 170, 34, 242, 94, 158, 45, 201, 14, 80, 231, 4, 107, 70, 110, 89, 228, 147, 73, 232, 189, 5, 10, 98, 207, 209, 109, 220, 166, 239, 83, 20, 147, 48, 151, 142, 240, 17, 214, 134, 25, 200, 97, 133, 199, 178, 146, 232, 90, 135, 9, 26, 4, 150, 107, 249, 30, 211, 231, 27, 116, 49, 98, 195, 56, 54, 33, 19, 207, 215, 206, 214, 177, 215, 99, 130, 234, 178, 106, 160, 0, 1, 199, 24, 227}) + + tv5.Exp(tv5, &exp) // 6. tv5 = tv5ᶜ³ + tv5.Mul(&tv5, &tv2) // 7. tv5 = tv5 * tv2 + tv2.Mul(&tv5, v) // 8. tv2 = tv5 * v + tv3.Mul(&tv5, u) // 9. tv3 = tv5 * u + tv4.Mul(&tv3, &tv2) // 10. tv4 = tv3 * tv2 + + // c5 = 4 + exp.SetBytes([]byte{4}) + tv5.Exp(tv4, &exp) // 11. tv5 = tv4ᶜ⁵ + isQNr := g2NotOne(&tv5) // 12. isQR = tv5 == 1 + c7 := fptower.E2{ + A0: fp.Element{1921729236329761493, 9193968980645934504, 9862280504246317678, 6861748847800817560, 10375788487011937166, 4460107375738415}, + A1: fp.Element{16821121318233475459, 10183025025229892778, 1779012082459463630, 3442292649700377418, 1061500799026501234, 1352426537312017168}, + } + tv2.Mul(&tv3, &c7) // 13. tv2 = tv3 * c7 + tv5.Mul(&tv4, &tv1) // 14. tv5 = tv4 * tv1 + tv3.Select(int(isQNr), &tv3, &tv2) // 15. tv3 = CMOV(tv2, tv3, isQR) + tv4.Select(int(isQNr), &tv4, &tv5) // 16. tv4 = CMOV(tv5, tv4, isQR) + exp.Lsh(big.NewInt(1), 3-2) // 18, 19: tv5 = 2ⁱ⁻² for i = c1 + + for i := 3; i >= 2; i-- { // 17. for i in (c1, c1 - 1, ..., 2): + + tv5.Exp(tv4, &exp) // 20. tv5 = tv4ᵗᵛ⁵ + nE1 := g2NotOne(&tv5) // 21. e1 = tv5 == 1 + tv2.Mul(&tv3, &tv1) // 22. tv2 = tv3 * tv1 + tv1.Mul(&tv1, &tv1) // 23. tv1 = tv1 * tv1 Why not write square? + tv5.Mul(&tv4, &tv1) // 24. tv5 = tv4 * tv1 + tv3.Select(int(nE1), &tv3, &tv2) // 25. tv3 = CMOV(tv2, tv3, e1) + tv4.Select(int(nE1), &tv4, &tv5) // 26. tv4 = CMOV(tv5, tv4, e1) + + if i > 2 { + exp.Rsh(&exp, 1) // 18, 19. tv5 = 2ⁱ⁻² + } + } + + *z = tv3 + return isQNr +} + +func g2NotOne(x *fptower.E2) uint64 { + + //Assuming hash is implemented for G1 and that the curve is over Fp + var one fp.Element + return one.SetOne().NotEqual(&x.A0) | G1NotZero(&x.A1) + +} + +// G2MulByZ multiplies x by [-2, -1] and stores the result in z +func G2MulByZ(z *fptower.E2, x *fptower.E2) { + + z.Mul(x, &fptower.E2{ + A0: fp.Element{9794203289623549276, 7309342082925068282, 1139538881605221074, 15659550692327388916, 16008355200866287827, 582484205531694093}, + A1: fp.Element{4897101644811774638, 3654671041462534141, 569769440802610537, 17053147383018470266, 17227549637287919721, 291242102765847046}, + }) + +} + +func g2EvalPolynomial(z *fptower.E2, monic bool, coefficients []fptower.E2, x *fptower.E2) { + dst := coefficients[len(coefficients)-1] + + if monic { + dst.Add(&dst, x) + } + + for i := len(coefficients) - 2; i >= 0; i-- { + dst.Mul(&dst, x) + dst.Add(&dst, &coefficients[i]) + } + + z.Set(&dst) +} + +// G2Sgn0 is an algebraic substitute for the notion of sign in ordered fields. +// Namely, every non-zero quadratic residue in a finite field of characteristic =/= 2 has exactly two square roots, one of each sign. +// +// See: https://www.rfc-editor.org/rfc/rfc9380.html#name-the-sgn0-function +// +// The sign of an element is not obviously related to that of its Montgomery form +func G2Sgn0(z *fptower.E2) uint64 { + + nonMont := z.Bits() + + sign := uint64(0) // 1. sign = 0 + zero := uint64(1) // 2. zero = 1 + var signI uint64 + var zeroI uint64 + + // 3. i = 1 + signI = nonMont.A0[0] % 2 // 4. sign_i = x_i mod 2 + zeroI = G1NotZero(&nonMont.A0) + zeroI = 1 ^ (zeroI|-zeroI)>>63 // 5. zero_i = x_i == 0 + sign = sign | (zero & signI) // 6. sign = sign OR (zero AND sign_i) # Avoid short-circuit logic ops + zero = zero & zeroI // 7. zero = zero AND zero_i + // 3. i = 2 + signI = nonMont.A1[0] % 2 // 4. sign_i = x_i mod 2 + // 5. zero_i = x_i == 0 + sign = sign | (zero & signI) // 6. sign = sign OR (zero AND sign_i) # Avoid short-circuit logic ops + // 7. zero = zero AND zero_i + return sign + +} + +func G2NotZero(x *fptower.E2) uint64 { + //Assuming G1 is over Fp and that if hashing is available for G2, it also is for G1 + return G1NotZero(&x.A0) | G1NotZero(&x.A1) + +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/hash_to_g1.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/hash_to_g1.go index 715278283..75722523a 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/hash_to_g1.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/hash_to_g1.go @@ -1,16 +1,5 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -18,177 +7,78 @@ package bls12381 import ( "github.com/consensys/gnark-crypto/ecc/bls12-381/fp" - - "math/big" + "github.com/consensys/gnark-crypto/ecc/bls12-381/hash_to_curve" ) -//Note: This only works for simple extensions - -func g1IsogenyXNumerator(dst *fp.Element, x *fp.Element) { - g1EvalPolynomial(dst, - false, - []fp.Element{ - {5555391298090832668, 1871845530032595596, 4551034694774233518, 2584197799339864836, 15085749040064757844, 654075415717002996}, - {9910598932128054667, 4357765064159749802, 1555960221863322426, 9671461638228026285, 1275132148248838779, 507072521670460589}, - {11908177372061066827, 18190436643933350086, 6603102998733829542, 6581045210674032871, 16099974426311393401, 541581077397919012}, - {5282195870529824577, 12365729195083706401, 2807246122435955773, 332702220601507168, 7339422050895811209, 1050416448951884523}, - {10443415753526299973, 8852419397684277637, 1088333252544296036, 1174353327457337436, 1626144519293139599, 716651429285276662}, - {7916646322956281527, 11909818257232418749, 1455301921509471421, 3317627683558310107, 12693445337245173919, 1798273032850409769}, - {2577731109215284733, 8810166123993386985, 3186592767751348067, 15050850291391518479, 18435652654155870871, 1330813445865859326}, - {8787912969482053798, 9653629252694769025, 1358451377919714320, 16331599695590198629, 13519934665722691825, 628078949001449512}, - {16605411443261943819, 9536014432113026165, 8685402948537367476, 16291074259433785035, 407185289045737198, 713426768049972652}, - {1001421273809907975, 724433776290697394, 16309429154639760781, 10003715605277815375, 307249038158020985, 688008371043525493}, - {16622893420529658311, 18333652517857227637, 2139173376235292830, 16496634502105693419, 5355299366650241487, 382770009771704860}, - {8276255265012938363, 9997870203437298645, 16819210142450232135, 5062450688048499179, 12776432501206859311, 1778476024187613533}, - }, - x) -} - -func g1IsogenyXDenominator(dst *fp.Element, x *fp.Element) { - g1EvalPolynomial(dst, - true, - []fp.Element{ - {13358415881952098629, 12009257493157516192, 13928884382876484932, 12988314785833227070, 11244145530317148182, 100673949996487007}, - {2533162896381624793, 10578896196504721258, 4263020647280931071, 1255899686249737875, 17097124965295857733, 590960935246623182}, - {10990404485039254780, 5344458621503091696, 1718862119039451458, 11600049052019063549, 18389973225607751698, 1092616849767867362}, - {16377845895484993601, 15314247056264135931, 14543008873173635408, 4875476272346940127, 2030129768648768484, 1297689274107773964}, - {6376927397170316667, 1460555178565443615, 18156708192400235081, 14761117739963869762, 8361091377443400626, 1421233557303902229}, - {18127417459170613536, 5353764292720778676, 858818813615405862, 3528937506143354306, 12604964186779349896, 489837025077541867}, - {15285065477075910543, 3650488990300576179, 7274499670465195193, 16100555180954076900, 7580582425312971905, 896074979407586822}, - {7582945168915351799, 2506680954090651888, 10272835934257987876, 9924916350558121763, 13577194922650729507, 1698254565890367778}, - {2009730524583761661, 11053280693947850663, 14409256190409559425, 3658799329773368860, 13529638021208614900, 869243908766415668}, - {11058048790650732295, 7059501760293999296, 6596812464094265283, 14567744481299745071, 1591898617514919697, 1344004358835331304}, - }, - x) -} - -func g1IsogenyYNumerator(dst *fp.Element, x *fp.Element, y *fp.Element) { - var _dst fp.Element - g1EvalPolynomial(&_dst, - false, - []fp.Element{ - {3122824077082063463, 2111517899915568999, 14844585557031220083, 14713720721132803039, 9041847780307969683, 950267513573868304}, - {11079511902567680319, 18338468344530008184, 6769016392463638666, 1504264063027988936, 8098359051856762276, 760455062874047829}, - {1430247552210236986, 3854575382974307965, 14917507996414511245, 207936139448560, 9498310774218301406, 1438631746617682181}, - {6654065794071117243, 2928282753802966791, 4144383358731160429, 12673586709493869907, 12918170109018188791, 844088361957958231}, - {6416330705244672319, 3552017270878949117, 7777490944331917312, 7917192495177481567, 7271851377118683537, 253926972271069325}, - {11903306495973637341, 11622313950541285762, 17991208474928993001, 12280964980743791783, 14941570282955772167, 143516344770893715}, - {7324386472845891920, 16310961984705608217, 14050364318273732029, 410622978843904432, 13407944087243235067, 570579643952782879}, - {10655681039374273828, 3913226275392147601, 9613292388335178165, 11852815148890010639, 17652581670569921892, 780578093363976825}, - {10454026283255684948, 15005802245309313587, 4420421943175638630, 18052347756729021570, 12181908985148691767, 1485233717472293779}, - {5056344670784885274, 15896288289018563095, 11120951801157184493, 7250506164525313606, 9295677455526059106, 1757175036496698059}, - {417067620545670182, 113740147118943311, 7666319924200602156, 1469963335415292317, 13482947512490784447, 1353298443678343909}, - {13069093794065563159, 18364685236451803588, 2235996605706292724, 1007629142299662669, 4077244143222018961, 162586537120788900}, - {12976751790971550752, 10256454045927919861, 8968423978443605586, 91636529236982767, 9459527627289574163, 949550897353139410}, - {10595118024452621845, 8010256778549625402, 10333144214150401956, 17682229685967587631, 8235697699445463546, 317883997785997129}, - {16894283457285346118, 10513943172407809423, 4685513162956315481, 11558261883362075118, 574375951146893083, 1159440548124233311}, - {9739780494108151959, 17207219630538774058, 553911396609642498, 6085929320386029624, 14175410874026216616, 1183751611824804793}, - }, - x) - - dst.Mul(&_dst, y) -} - -func g1IsogenyYDenominator(dst *fp.Element, x *fp.Element) { - g1EvalPolynomial(dst, - true, - []fp.Element{ - {16963992846030154524, 1796759822929186144, 15995221960860457854, 8232142361908220707, 5977498266010213481, 759868220591477233}, - {7019489280640006651, 8025136855967848721, 17464762292772824538, 4490335113250743896, 7652702793653159798, 1129822927746498110}, - {3164260796573156764, 2639884922337322818, 1251365706181388855, 13142429936036186189, 359878619957828340, 126848055205862465}, - {17472832885692408710, 9911075278795900735, 2614390623136861791, 14474775734428698630, 6462878218464609418, 1225960780180864957}, - {3586995257703132870, 2143554115308730112, 15207899356205612465, 4372523065560113828, 12811868595146042778, 307251632623424763}, - {14298637377310410728, 10963101290308221781, 8192510423058716701, 1175370967867267532, 1029599188863854120, 678981456155013844}, - {11149806480082726900, 3664985661428410608, 18095361538178773836, 14174906593575241395, 15305104369759711886, 901234928011491053}, - {4727074327869776987, 15736954329525418288, 14642679026711520511, 11429849039208981702, 17333567062758618213, 951235897335772166}, - {9130114290642375589, 14069725355798443159, 6621984191700563591, 270173975669947883, 6218390495944243859, 1077419361593130421}, - {9144875514986933294, 16561351410666797616, 8591333879886582656, 15059370240386191395, 7834396448114781869, 946553772269403391}, - {17809450171377747225, 15896956440537434491, 8451524482089653422, 1694507265233574136, 18224201536921880842, 317503425606567070}, - {13940503876759740187, 8772047862193200131, 6080360161890657205, 7935486160089058373, 9407473295146243021, 1255078947940629503}, - {1160821217138360586, 13542760608074182996, 11595911004531652098, 18158686636947034451, 13330657138280564947, 1773960737279760188}, - {9132548444917292754, 16464415422105000789, 6319313500251671073, 12727658548847517900, 10985275115076354035, 1431541893474124246}, - {662485641082390837, 260809847827618849, 6177381409359357075, 18231947741742261351, 18128540110746580014, 1079107229429227022}, - }, - x) +// MapToG1 invokes the SSWU map, and guarantees that the result is in G1. +func MapToG1(u fp.Element) G1Affine { + res := MapToCurve1(&u) + //this is in an isogenous curve + hash_to_curve.G1Isogeny(&res.X, &res.Y) + res.ClearCofactor(&res) + return res } -func g1Isogeny(p *G1Affine) { - - den := make([]fp.Element, 2) - - g1IsogenyYDenominator(&den[1], &p.X) - g1IsogenyXDenominator(&den[0], &p.X) +// EncodeToG1 hashes a message to a point on the G1 curve using the SSWU map. +// It is faster than [HashToG1], but the result is not uniformly distributed. Unsuitable as a random oracle. +// dst stands for "domain separation tag", a string unique to the construction using the hash function +// +// See: https://www.rfc-editor.org/rfc/rfc9380.html#roadmap +func EncodeToG1(msg, dst []byte) (G1Affine, error) { - g1IsogenyYNumerator(&p.Y, &p.X, &p.Y) - g1IsogenyXNumerator(&p.X, &p.X) + var res G1Affine + u, err := fp.Hash(msg, dst, 1) + if err != nil { + return res, err + } - den = fp.BatchInvert(den) + res = MapToCurve1(&u[0]) - p.X.Mul(&p.X, &den[0]) - p.Y.Mul(&p.Y, &den[1]) + //this is in an isogenous curve + hash_to_curve.G1Isogeny(&res.X, &res.Y) + res.ClearCofactor(&res) + return res, nil } -// g1SqrtRatio computes the square root of u/v and returns 0 iff u/v was indeed a quadratic residue -// if not, we get sqrt(Z * u / v). Recall that Z is non-residue -// If v = 0, u/v is meaningless and the output is unspecified, without raising an error. -// The main idea is that since the computation of the square root involves taking large powers of u/v, the inversion of v can be avoided -func g1SqrtRatio(z *fp.Element, u *fp.Element, v *fp.Element) uint64 { - // https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html#name-optimized-sqrt_ratio-for-q- (3 mod 4) - var tv1 fp.Element - tv1.Square(v) // 1. tv1 = v² - var tv2 fp.Element - tv2.Mul(u, v) // 2. tv2 = u * v - tv1.Mul(&tv1, &tv2) // 3. tv1 = tv1 * tv2 - - var y1 fp.Element - { - var c1 big.Int - // c1 = 1000602388805416848354447456433976039139220704984751971333014534031007912622709466110671907282253916009473568139946 - c1.SetBytes([]byte{6, 128, 68, 122, 142, 95, 249, 166, 146, 198, 233, 237, 144, 210, 235, 53, 217, 29, 210, 225, 60, 225, 68, 175, 217, 204, 52, 168, 61, 172, 61, 137, 7, 170, 255, 255, 172, 84, 255, 255, 238, 127, 191, 255, 255, 255, 234, 170}) // c1 = (q - 3) / 4 # Integer arithmetic - - y1.Exp(tv1, &c1) // 4. y1 = tv1ᶜ¹ +// HashToG1 hashes a message to a point on the G1 curve using the SSWU map. +// Slower than [EncodeToG1], but usable as a random oracle. +// dst stands for "domain separation tag", a string unique to the construction using the hash function. +// +// See https://www.rfc-editor.org/rfc/rfc9380.html#roadmap +func HashToG1(msg, dst []byte) (G1Affine, error) { + u, err := fp.Hash(msg, dst, 2*1) + if err != nil { + return G1Affine{}, err } - y1.Mul(&y1, &tv2) // 5. y1 = y1 * tv2 - - var y2 fp.Element - // c2 = sqrt(-Z) - tv3 := fp.Element{17544630987809824292, 17306709551153317753, 8299808889594647786, 5930295261504720397, 675038575008112577, 167386374569371918} - y2.Mul(&y1, &tv3) // 6. y2 = y1 * c2 - tv3.Square(&y1) // 7. tv3 = y1² - tv3.Mul(&tv3, v) // 8. tv3 = tv3 * v - isQNr := tv3.NotEqual(u) // 9. isQR = tv3 == u - z.Select(int(isQNr), &y1, &y2) // 10. y = CMOV(y2, y1, isQR) - return isQNr -} + Q0 := MapToCurve1(&u[0]) + Q1 := MapToCurve1(&u[1]) -// g1MulByZ multiplies x by [11] and stores the result in z -func g1MulByZ(z *fp.Element, x *fp.Element) { + //TODO (perf): Add in E' first, then apply isogeny + hash_to_curve.G1Isogeny(&Q0.X, &Q0.Y) + hash_to_curve.G1Isogeny(&Q1.X, &Q1.Y) - res := *x + var _Q0, _Q1 G1Jac + _Q0.FromAffine(&Q0) + _Q1.FromAffine(&Q1).AddAssign(&_Q0) - res.Double(&res) - res.Double(&res) - res.Add(&res, x) - res.Double(&res) - res.Add(&res, x) + _Q1.ClearCofactor(&_Q1) - *z = res + Q1.FromJacobian(&_Q1) + return Q1, nil } -// https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html#name-simplified-swu-method -// MapToCurve1 implements the SSWU map -// No cofactor clearing or isogeny +// MapToCurve1 implements the SSWU map. It does not perform cofactor clearing nor isogeny. For map to group, use [MapToG1]. +// +// See: https://www.rfc-editor.org/rfc/rfc9380.html#name-simplified-swu-method func MapToCurve1(u *fp.Element) G1Affine { - - var sswuIsoCurveCoeffA = fp.Element{3415322872136444497, 9675504606121301699, 13284745414851768802, 2873609449387478652, 2897906769629812789, 1536947672689614213} - var sswuIsoCurveCoeffB = fp.Element{18129637713272545760, 11144507692959411567, 10108153527111632324, 9745270364868568433, 14587922135379007624, 469008097655535723} + sswuIsoCurveCoeffA, sswuIsoCurveCoeffB := hash_to_curve.G1SSWUIsogenyCurveCoefficients() var tv1 fp.Element tv1.Square(u) // 1. tv1 = u² //mul tv1 by Z - g1MulByZ(&tv1, &tv1) // 2. tv1 = Z * tv1 + hash_to_curve.G1MulByZ(&tv1, &tv1) // 2. tv1 = Z * tv1 var tv2 fp.Element tv2.Square(&tv1) // 3. tv2 = tv1² @@ -200,10 +90,10 @@ func MapToCurve1(u *fp.Element) G1Affine { tv3.Add(&tv2, &tv4) // 5. tv3 = tv2 + 1 tv3.Mul(&tv3, &sswuIsoCurveCoeffB) // 6. tv3 = B * tv3 - tv2NZero := g1NotZero(&tv2) + tv2NZero := hash_to_curve.G1NotZero(&tv2) // tv4 = Z - tv4 = fp.Element{9830232086645309404, 1112389714365644829, 8603885298299447491, 11361495444721768256, 5788602283869803809, 543934104870762216} + tv4 = hash_to_curve.G1SSWUIsogenyZ() tv2.Neg(&tv2) tv4.Select(int(tv2NZero), &tv4, &tv2) // 7. tv4 = CMOV(Z, -tv2, tv2 != 0) @@ -228,7 +118,7 @@ func MapToCurve1(u *fp.Element) G1Affine { x.Mul(&tv1, &tv3) // 17. x = tv1 * tv3 var y1 fp.Element - gx1NSquare := g1SqrtRatio(&y1, &tv2, &tv6) // 18. (is_gx1_square, y1) = sqrt_ratio(tv2, tv6) + gx1NSquare := hash_to_curve.G1SqrtRatio(&y1, &tv2, &tv6) // 18. (is_gx1_square, y1) = sqrt_ratio(tv2, tv6) var y fp.Element y.Mul(&tv1, u) // 19. y = tv1 * u @@ -239,7 +129,7 @@ func MapToCurve1(u *fp.Element) G1Affine { y.Select(int(gx1NSquare), &y1, &y) // 22. y = CMOV(y, y1, is_gx1_square) y1.Neg(&y) - y.Select(int(g1Sgn0(u)^g1Sgn0(&y)), &y, &y1) + y.Select(int(hash_to_curve.G1Sgn0(u)^hash_to_curve.G1Sgn0(&y)), &y, &y1) // 23. e1 = sgn0(u) == sgn0(y) // 24. y = CMOV(-y, y, e1) @@ -248,93 +138,3 @@ func MapToCurve1(u *fp.Element) G1Affine { return G1Affine{x, y} } - -func g1EvalPolynomial(z *fp.Element, monic bool, coefficients []fp.Element, x *fp.Element) { - dst := coefficients[len(coefficients)-1] - - if monic { - dst.Add(&dst, x) - } - - for i := len(coefficients) - 2; i >= 0; i-- { - dst.Mul(&dst, x) - dst.Add(&dst, &coefficients[i]) - } - - z.Set(&dst) -} - -// g1Sgn0 is an algebraic substitute for the notion of sign in ordered fields -// Namely, every non-zero quadratic residue in a finite field of characteristic =/= 2 has exactly two square roots, one of each sign -// https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html#name-the-sgn0-function -// The sign of an element is not obviously related to that of its Montgomery form -func g1Sgn0(z *fp.Element) uint64 { - - nonMont := z.Bits() - - // m == 1 - return nonMont[0] % 2 - -} - -// MapToG1 invokes the SSWU map, and guarantees that the result is in g1 -func MapToG1(u fp.Element) G1Affine { - res := MapToCurve1(&u) - //this is in an isogenous curve - g1Isogeny(&res) - res.ClearCofactor(&res) - return res -} - -// EncodeToG1 hashes a message to a point on the G1 curve using the SSWU map. -// It is faster than HashToG1, but the result is not uniformly distributed. Unsuitable as a random oracle. -// dst stands for "domain separation tag", a string unique to the construction using the hash function -// https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html#roadmap -func EncodeToG1(msg, dst []byte) (G1Affine, error) { - - var res G1Affine - u, err := fp.Hash(msg, dst, 1) - if err != nil { - return res, err - } - - res = MapToCurve1(&u[0]) - - //this is in an isogenous curve - g1Isogeny(&res) - res.ClearCofactor(&res) - return res, nil -} - -// HashToG1 hashes a message to a point on the G1 curve using the SSWU map. -// Slower than EncodeToG1, but usable as a random oracle. -// dst stands for "domain separation tag", a string unique to the construction using the hash function -// https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html#roadmap -func HashToG1(msg, dst []byte) (G1Affine, error) { - u, err := fp.Hash(msg, dst, 2*1) - if err != nil { - return G1Affine{}, err - } - - Q0 := MapToCurve1(&u[0]) - Q1 := MapToCurve1(&u[1]) - - //TODO (perf): Add in E' first, then apply isogeny - g1Isogeny(&Q0) - g1Isogeny(&Q1) - - var _Q0, _Q1 G1Jac - _Q0.FromAffine(&Q0) - _Q1.FromAffine(&Q1).AddAssign(&_Q0) - - _Q1.ClearCofactor(&_Q1) - - Q1.FromJacobian(&_Q1) - return Q1, nil -} - -func g1NotZero(x *fp.Element) uint64 { - - return x[0] | x[1] | x[2] | x[3] | x[4] | x[5] - -} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/hash_to_g2.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/hash_to_g2.go index 4feafbfb1..43103b909 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/hash_to_g2.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/hash_to_g2.go @@ -1,16 +1,5 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -18,219 +7,88 @@ package bls12381 import ( "github.com/consensys/gnark-crypto/ecc/bls12-381/fp" + "github.com/consensys/gnark-crypto/ecc/bls12-381/hash_to_curve" "github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower" - - "math/big" ) -//Note: This only works for simple extensions - -func g2IsogenyXNumerator(dst *fptower.E2, x *fptower.E2) { - g2EvalPolynomial(dst, - false, - []fptower.E2{ - { - A0: fp.Element{5185457120960601698, 494647221959407934, 8971396042087821730, 324544954362548322, 14214792730224113654, 1405280679127738945}, - A1: fp.Element{5185457120960601698, 494647221959407934, 8971396042087821730, 324544954362548322, 14214792730224113654, 1405280679127738945}, - }, - { - A0: fp.Element{0}, - A1: fp.Element{6910023028261548496, 9745789443900091043, 7668299866710145304, 2432656849393633605, 2897729527445498821, 776645607375592125}, - }, - { - A0: fp.Element{724047465092313539, 15783990863276714670, 12824896677063784855, 15246381572572671516, 13186611051602728692, 1485475813959743803}, - A1: fp.Element{12678383550985550056, 4872894721950045521, 13057521970209848460, 10439700461551592610, 10672236800577525218, 388322803687796062}, - }, - { - A0: fp.Element{4659755689450087917, 1804066951354704782, 15570919779568036803, 15592734958806855601, 7597208057374167129, 1841438384006890194}, - A1: fp.Element{0}, - }, - }, - x) -} - -func g2IsogenyXDenominator(dst *fptower.E2, x *fptower.E2) { - g2EvalPolynomial(dst, - true, - []fptower.E2{ - { - A0: fp.Element{0}, - A1: fp.Element{2250392438786206615, 17463829474098544446, 14571211649711714824, 4495761442775821336, 258811604141191305, 357646605018048850}, - }, - { - A0: fp.Element{4933130441833534766, 15904462746612662304, 8034115857496836953, 12755092135412849606, 7007796720291435703, 252692002104915169}, - A1: fp.Element{8469300574244328829, 4752422838614097887, 17848302789776796362, 12930989898711414520, 16851051131888818207, 1621106615542624696}, - }, - }, - x) -} - -func g2IsogenyYNumerator(dst *fptower.E2, x *fptower.E2, y *fptower.E2) { - var _dst fptower.E2 - g2EvalPolynomial(&_dst, - false, - []fptower.E2{ - { - A0: fp.Element{10869708750642247614, 13056187057366814946, 1750362034917495549, 6326189602300757217, 1140223926335695785, 632761649765668291}, - A1: fp.Element{10869708750642247614, 13056187057366814946, 1750362034917495549, 6326189602300757217, 1140223926335695785, 632761649765668291}, - }, - { - A0: fp.Element{0}, - A1: fp.Element{13765940311003083782, 5579209876153186557, 11349908400803699438, 11707848830955952341, 199199289641242246, 899896674917908607}, - }, - { - A0: fp.Element{15562563812347550836, 2436447360975022760, 6528760985104924230, 5219850230775796305, 5336118400288762609, 194161401843898031}, - A1: fp.Element{16286611277439864375, 18220438224251737430, 906913588459157469, 2019487729638916206, 75985378181939686, 1679637215803641835}, - }, - { - A0: fp.Element{11849179119594500956, 13906615243538674725, 14543197362847770509, 2041759640812427310, 2879701092679313252, 1259985822978576468}, - A1: fp.Element{0}, - }, - }, - x) - - dst.Mul(&_dst, y) -} - -func g2IsogenyYDenominator(dst *fptower.E2, x *fptower.E2) { - g2EvalPolynomial(dst, - true, - []fptower.E2{ - { - A0: fp.Element{99923616639376095, 10339114964526300021, 6204619029868000785, 1288486622530663893, 14587509920085997152, 272081012460753233}, - A1: fp.Element{99923616639376095, 10339114964526300021, 6204619029868000785, 1288486622530663893, 14587509920085997152, 272081012460753233}, - }, - { - A0: fp.Element{0}, - A1: fp.Element{6751177316358619845, 15498000274876530106, 6820146801716041242, 13487284328327464010, 776434812423573915, 1072939815054146550}, - }, - { - A0: fp.Element{7399695662750302149, 14633322083064217648, 12051173786245255430, 9909266166264498601, 1288323043582377747, 379038003157372754}, - A1: fp.Element{6002735353327561446, 6023563502162542543, 13831244861028377885, 15776815867859765525, 4123780734888324547, 1494760614490167112}, - }, - }, - x) +// MapToG2 invokes the SSWU map, and guarantees that the result is in G2. +func MapToG2(u fptower.E2) G2Affine { + res := MapToCurve2(&u) + //this is in an isogenous curve + hash_to_curve.G2Isogeny(&res.X, &res.Y) + res.ClearCofactor(&res) + return res } -func g2Isogeny(p *G2Affine) { - - den := make([]fptower.E2, 2) - - g2IsogenyYDenominator(&den[1], &p.X) - g2IsogenyXDenominator(&den[0], &p.X) +// EncodeToG2 hashes a message to a point on the G2 curve using the SSWU map. +// It is faster than [HashToG2], but the result is not uniformly distributed. Unsuitable as a random oracle. +// dst stands for "domain separation tag", a string unique to the construction using the hash function +// +// See: https://www.rfc-editor.org/rfc/rfc9380.html#roadmap +func EncodeToG2(msg, dst []byte) (G2Affine, error) { - g2IsogenyYNumerator(&p.Y, &p.X, &p.Y) - g2IsogenyXNumerator(&p.X, &p.X) + var res G2Affine + u, err := fp.Hash(msg, dst, 2) + if err != nil { + return res, err + } - den = fptower.BatchInvertE2(den) + res = MapToCurve2(&fptower.E2{ + A0: u[0], + A1: u[1], + }) - p.X.Mul(&p.X, &den[0]) - p.Y.Mul(&p.Y, &den[1]) + //this is in an isogenous curve + hash_to_curve.G2Isogeny(&res.X, &res.Y) + res.ClearCofactor(&res) + return res, nil } -// g2SqrtRatio computes the square root of u/v and returns 0 iff u/v was indeed a quadratic residue -// if not, we get sqrt(Z * u / v). Recall that Z is non-residue -// If v = 0, u/v is meaningless and the output is unspecified, without raising an error. -// The main idea is that since the computation of the square root involves taking large powers of u/v, the inversion of v can be avoided -func g2SqrtRatio(z *fptower.E2, u *fptower.E2, v *fptower.E2) uint64 { - - // https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html#name-sqrt_ratio-for-any-field - - tv1 := fptower.E2{ - A0: fp.Element{8921533702591418330, 15859389534032789116, 3389114680249073393, 15116930867080254631, 3288288975085550621, 1021049300055853010}, - A1: fp.Element{8921533702591418330, 15859389534032789116, 3389114680249073393, 15116930867080254631, 3288288975085550621, 1021049300055853010}, - } //tv1 = c6 - - var tv2, tv3, tv4, tv5 fptower.E2 - var exp big.Int - // c4 = 7 = 2³ - 1 - // q is odd so c1 is at least 1. - exp.SetBytes([]byte{7}) - - tv2.Exp(*v, &exp) // 2. tv2 = vᶜ⁴ - tv3.Square(&tv2) // 3. tv3 = tv2² - tv3.Mul(&tv3, v) // 4. tv3 = tv3 * v - tv5.Mul(u, &tv3) // 5. tv5 = u * tv3 - - // c3 = 1001205140483106588246484290269935788605945006208159541241399033561623546780709821462541004956387089373434649096260670658193992783731681621012512651314777238193313314641988297376025498093520728838658813979860931248214124593092835 - exp.SetBytes([]byte{42, 67, 122, 75, 140, 53, 252, 116, 189, 39, 142, 170, 34, 242, 94, 158, 45, 201, 14, 80, 231, 4, 107, 70, 110, 89, 228, 147, 73, 232, 189, 5, 10, 98, 207, 209, 109, 220, 166, 239, 83, 20, 147, 48, 151, 142, 240, 17, 214, 134, 25, 200, 97, 133, 199, 178, 146, 232, 90, 135, 9, 26, 4, 150, 107, 249, 30, 211, 231, 27, 116, 49, 98, 195, 56, 54, 33, 19, 207, 215, 206, 214, 177, 215, 99, 130, 234, 178, 106, 160, 0, 1, 199, 24, 227}) - - tv5.Exp(tv5, &exp) // 6. tv5 = tv5ᶜ³ - tv5.Mul(&tv5, &tv2) // 7. tv5 = tv5 * tv2 - tv2.Mul(&tv5, v) // 8. tv2 = tv5 * v - tv3.Mul(&tv5, u) // 9. tv3 = tv5 * u - tv4.Mul(&tv3, &tv2) // 10. tv4 = tv3 * tv2 - - // c5 = 4 - exp.SetBytes([]byte{4}) - tv5.Exp(tv4, &exp) // 11. tv5 = tv4ᶜ⁵ - isQNr := g2NotOne(&tv5) // 12. isQR = tv5 == 1 - c7 := fptower.E2{ - A0: fp.Element{1921729236329761493, 9193968980645934504, 9862280504246317678, 6861748847800817560, 10375788487011937166, 4460107375738415}, - A1: fp.Element{16821121318233475459, 10183025025229892778, 1779012082459463630, 3442292649700377418, 1061500799026501234, 1352426537312017168}, - } - tv2.Mul(&tv3, &c7) // 13. tv2 = tv3 * c7 - tv5.Mul(&tv4, &tv1) // 14. tv5 = tv4 * tv1 - tv3.Select(int(isQNr), &tv3, &tv2) // 15. tv3 = CMOV(tv2, tv3, isQR) - tv4.Select(int(isQNr), &tv4, &tv5) // 16. tv4 = CMOV(tv5, tv4, isQR) - exp.Lsh(big.NewInt(1), 3-2) // 18, 19: tv5 = 2ⁱ⁻² for i = c1 - - for i := 3; i >= 2; i-- { // 17. for i in (c1, c1 - 1, ..., 2): - - tv5.Exp(tv4, &exp) // 20. tv5 = tv4ᵗᵛ⁵ - nE1 := g2NotOne(&tv5) // 21. e1 = tv5 == 1 - tv2.Mul(&tv3, &tv1) // 22. tv2 = tv3 * tv1 - tv1.Mul(&tv1, &tv1) // 23. tv1 = tv1 * tv1 Why not write square? - tv5.Mul(&tv4, &tv1) // 24. tv5 = tv4 * tv1 - tv3.Select(int(nE1), &tv3, &tv2) // 25. tv3 = CMOV(tv2, tv3, e1) - tv4.Select(int(nE1), &tv4, &tv5) // 26. tv4 = CMOV(tv5, tv4, e1) - - if i > 2 { - exp.Rsh(&exp, 1) // 18, 19. tv5 = 2ⁱ⁻² - } +// HashToG2 hashes a message to a point on the G2 curve using the SSWU map. +// Slower than [EncodeToG2], but usable as a random oracle. +// dst stands for "domain separation tag", a string unique to the construction using the hash function. +// +// See https://www.rfc-editor.org/rfc/rfc9380.html#roadmap +func HashToG2(msg, dst []byte) (G2Affine, error) { + u, err := fp.Hash(msg, dst, 2*2) + if err != nil { + return G2Affine{}, err } - *z = tv3 - return isQNr -} - -func g2NotOne(x *fptower.E2) uint64 { - - //Assuming hash is implemented for G1 and that the curve is over Fp - var one fp.Element - return one.SetOne().NotEqual(&x.A0) | g1NotZero(&x.A1) + Q0 := MapToCurve2(&fptower.E2{ + A0: u[0], + A1: u[1], + }) + Q1 := MapToCurve2(&fptower.E2{ + A0: u[2+0], + A1: u[2+1], + }) -} + //TODO (perf): Add in E' first, then apply isogeny + hash_to_curve.G2Isogeny(&Q0.X, &Q0.Y) + hash_to_curve.G2Isogeny(&Q1.X, &Q1.Y) -// g2MulByZ multiplies x by [-2, -1] and stores the result in z -func g2MulByZ(z *fptower.E2, x *fptower.E2) { + var _Q0, _Q1 G2Jac + _Q0.FromAffine(&Q0) + _Q1.FromAffine(&Q1).AddAssign(&_Q0) - z.Mul(x, &fptower.E2{ - A0: fp.Element{9794203289623549276, 7309342082925068282, 1139538881605221074, 15659550692327388916, 16008355200866287827, 582484205531694093}, - A1: fp.Element{4897101644811774638, 3654671041462534141, 569769440802610537, 17053147383018470266, 17227549637287919721, 291242102765847046}, - }) + _Q1.ClearCofactor(&_Q1) + Q1.FromJacobian(&_Q1) + return Q1, nil } -// https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html#name-simplified-swu-method -// MapToCurve2 implements the SSWU map -// No cofactor clearing or isogeny +// MapToCurve2 implements the SSWU map. It does not perform cofactor clearing nor isogeny. For map to group, use [MapToG2]. +// +// See: https://www.rfc-editor.org/rfc/rfc9380.html#name-simplified-swu-method func MapToCurve2(u *fptower.E2) G2Affine { - - var sswuIsoCurveCoeffA = fptower.E2{ - A0: fp.Element{0}, - A1: fp.Element{16517514583386313282, 74322656156451461, 16683759486841714365, 815493829203396097, 204518332920448171, 1306242806803223655}, - } - var sswuIsoCurveCoeffB = fptower.E2{ - A0: fp.Element{2515823342057463218, 7982686274772798116, 7934098172177393262, 8484566552980779962, 4455086327883106868, 1323173589274087377}, - A1: fp.Element{2515823342057463218, 7982686274772798116, 7934098172177393262, 8484566552980779962, 4455086327883106868, 1323173589274087377}, - } + sswuIsoCurveCoeffA, sswuIsoCurveCoeffB := hash_to_curve.G2SSWUIsogenyCurveCoefficients() var tv1 fptower.E2 tv1.Square(u) // 1. tv1 = u² //mul tv1 by Z - g2MulByZ(&tv1, &tv1) // 2. tv1 = Z * tv1 + hash_to_curve.G2MulByZ(&tv1, &tv1) // 2. tv1 = Z * tv1 var tv2 fptower.E2 tv2.Square(&tv1) // 3. tv2 = tv1² @@ -242,13 +100,10 @@ func MapToCurve2(u *fptower.E2) G2Affine { tv3.Add(&tv2, &tv4) // 5. tv3 = tv2 + 1 tv3.Mul(&tv3, &sswuIsoCurveCoeffB) // 6. tv3 = B * tv3 - tv2NZero := g2NotZero(&tv2) + tv2NZero := hash_to_curve.G2NotZero(&tv2) // tv4 = Z - tv4 = fptower.E2{ - A0: fp.Element{9794203289623549276, 7309342082925068282, 1139538881605221074, 15659550692327388916, 16008355200866287827, 582484205531694093}, - A1: fp.Element{4897101644811774638, 3654671041462534141, 569769440802610537, 17053147383018470266, 17227549637287919721, 291242102765847046}, - } + tv4 = hash_to_curve.G2SSWUIsogenyZ() tv2.Neg(&tv2) tv4.Select(int(tv2NZero), &tv4, &tv2) // 7. tv4 = CMOV(Z, -tv2, tv2 != 0) @@ -273,7 +128,7 @@ func MapToCurve2(u *fptower.E2) G2Affine { x.Mul(&tv1, &tv3) // 17. x = tv1 * tv3 var y1 fptower.E2 - gx1NSquare := g2SqrtRatio(&y1, &tv2, &tv6) // 18. (is_gx1_square, y1) = sqrt_ratio(tv2, tv6) + gx1NSquare := hash_to_curve.G2SqrtRatio(&y1, &tv2, &tv6) // 18. (is_gx1_square, y1) = sqrt_ratio(tv2, tv6) var y fptower.E2 y.Mul(&tv1, u) // 19. y = tv1 * u @@ -284,7 +139,7 @@ func MapToCurve2(u *fptower.E2) G2Affine { y.Select(int(gx1NSquare), &y1, &y) // 22. y = CMOV(y, y1, is_gx1_square) y1.Neg(&y) - y.Select(int(g2Sgn0(u)^g2Sgn0(&y)), &y, &y1) + y.Select(int(hash_to_curve.G2Sgn0(u)^hash_to_curve.G2Sgn0(&y)), &y, &y1) // 23. e1 = sgn0(u) == sgn0(y) // 24. y = CMOV(-y, y, e1) @@ -293,117 +148,3 @@ func MapToCurve2(u *fptower.E2) G2Affine { return G2Affine{x, y} } - -func g2EvalPolynomial(z *fptower.E2, monic bool, coefficients []fptower.E2, x *fptower.E2) { - dst := coefficients[len(coefficients)-1] - - if monic { - dst.Add(&dst, x) - } - - for i := len(coefficients) - 2; i >= 0; i-- { - dst.Mul(&dst, x) - dst.Add(&dst, &coefficients[i]) - } - - z.Set(&dst) -} - -// g2Sgn0 is an algebraic substitute for the notion of sign in ordered fields -// Namely, every non-zero quadratic residue in a finite field of characteristic =/= 2 has exactly two square roots, one of each sign -// https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html#name-the-sgn0-function -// The sign of an element is not obviously related to that of its Montgomery form -func g2Sgn0(z *fptower.E2) uint64 { - - nonMont := z.Bits() - - sign := uint64(0) // 1. sign = 0 - zero := uint64(1) // 2. zero = 1 - var signI uint64 - var zeroI uint64 - - // 3. i = 1 - signI = nonMont.A0[0] % 2 // 4. sign_i = x_i mod 2 - zeroI = g1NotZero(&nonMont.A0) - zeroI = 1 ^ (zeroI|-zeroI)>>63 // 5. zero_i = x_i == 0 - sign = sign | (zero & signI) // 6. sign = sign OR (zero AND sign_i) # Avoid short-circuit logic ops - zero = zero & zeroI // 7. zero = zero AND zero_i - // 3. i = 2 - signI = nonMont.A1[0] % 2 // 4. sign_i = x_i mod 2 - // 5. zero_i = x_i == 0 - sign = sign | (zero & signI) // 6. sign = sign OR (zero AND sign_i) # Avoid short-circuit logic ops - // 7. zero = zero AND zero_i - return sign - -} - -// MapToG2 invokes the SSWU map, and guarantees that the result is in g2 -func MapToG2(u fptower.E2) G2Affine { - res := MapToCurve2(&u) - //this is in an isogenous curve - g2Isogeny(&res) - res.ClearCofactor(&res) - return res -} - -// EncodeToG2 hashes a message to a point on the G2 curve using the SSWU map. -// It is faster than HashToG2, but the result is not uniformly distributed. Unsuitable as a random oracle. -// dst stands for "domain separation tag", a string unique to the construction using the hash function -// https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html#roadmap -func EncodeToG2(msg, dst []byte) (G2Affine, error) { - - var res G2Affine - u, err := fp.Hash(msg, dst, 2) - if err != nil { - return res, err - } - - res = MapToCurve2(&fptower.E2{ - A0: u[0], - A1: u[1], - }) - - //this is in an isogenous curve - g2Isogeny(&res) - res.ClearCofactor(&res) - return res, nil -} - -// HashToG2 hashes a message to a point on the G2 curve using the SSWU map. -// Slower than EncodeToG2, but usable as a random oracle. -// dst stands for "domain separation tag", a string unique to the construction using the hash function -// https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html#roadmap -func HashToG2(msg, dst []byte) (G2Affine, error) { - u, err := fp.Hash(msg, dst, 2*2) - if err != nil { - return G2Affine{}, err - } - - Q0 := MapToCurve2(&fptower.E2{ - A0: u[0], - A1: u[1], - }) - Q1 := MapToCurve2(&fptower.E2{ - A0: u[2+0], - A1: u[2+1], - }) - - //TODO (perf): Add in E' first, then apply isogeny - g2Isogeny(&Q0) - g2Isogeny(&Q1) - - var _Q0, _Q1 G2Jac - _Q0.FromAffine(&Q0) - _Q1.FromAffine(&Q1).AddAssign(&_Q0) - - _Q1.ClearCofactor(&_Q1) - - Q1.FromJacobian(&_Q1) - return Q1, nil -} - -func g2NotZero(x *fptower.E2) uint64 { - //Assuming G1 is over Fp and that if hashing is available for G2, it also is for G1 - return g1NotZero(&x.A0) | g1NotZero(&x.A1) - -} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/asm.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/asm.go index 49751a939..83956e0b4 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/asm.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/asm.go @@ -1,28 +1,16 @@ //go:build !noadx -// +build !noadx -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT package fptower -import "golang.org/x/sys/cpu" +import "github.com/consensys/gnark-crypto/utils/cpu" // supportAdx will be set only on amd64 that has MULX and ADDX instructions var ( - supportAdx = cpu.X86.HasADX && cpu.X86.HasBMI2 + supportAdx = cpu.SupportADX _ = supportAdx // used in asm ) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/asm_noadx.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/asm_noadx.go index c6a97081f..1dc20b499 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/asm_noadx.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/asm_noadx.go @@ -1,19 +1,7 @@ //go:build noadx -// +build noadx -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e12.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e12.go index 095a79a4c..cd2f072e6 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e12.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e12.go @@ -1,16 +1,5 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -67,14 +56,14 @@ func (z *E12) SetOne() *E12 { return z } -// Add set z=x+y in E12 and return z +// Add sets z=x+y in E12 and returns z func (z *E12) Add(x, y *E12) *E12 { z.C0.Add(&x.C0, &y.C0) z.C1.Add(&x.C1, &y.C1) return z } -// Sub sets z to x sub y and return z +// Sub sets z to x-y and returns z func (z *E12) Sub(x, y *E12) *E12 { z.C0.Sub(&x.C0, &y.C0) z.C1.Sub(&x.C1, &y.C1) @@ -99,16 +88,25 @@ func (z *E12) SetRandom() (*E12, error) { return z, nil } -// IsZero returns true if the two elements are equal, false otherwise +// MustSetRandom sets a0 and a1 to random values. +// It panics if reading form crypto/rand fails +func (z *E12) MustSetRandom() { + if _, err := z.SetRandom(); err != nil { + panic(err) + } +} + +// IsZero returns true if z is zero, false otherwise func (z *E12) IsZero() bool { return z.C0.IsZero() && z.C1.IsZero() } +// IsOne returns true if z is one, false otherwise func (z *E12) IsOne() bool { return z.C0.IsOne() && z.C1.IsZero() } -// Mul set z=x*y in E12 and return z +// Mul sets z=x*y in E12 and returns z func (z *E12) Mul(x, y *E12) *E12 { var a, b, c E6 a.Add(&x.C0, &x.C1) @@ -121,7 +119,7 @@ func (z *E12) Mul(x, y *E12) *E12 { return z } -// Square set z=x*x in E12 and return z +// Square sets z=x*x in E12 and returns z func (z *E12) Square(x *E12) *E12 { //Algorithm 22 from https://eprint.iacr.org/2010/354.pdf @@ -406,7 +404,7 @@ func (z *E12) CyclotomicSquare(x *E12) *E12 { return z } -// Inverse set z to the inverse of x in E12 and return z +// Inverse sets z to the inverse of x in E12 and returns z // // if x == 0, sets and returns z = x func (z *E12) Inverse(x *E12) *E12 { @@ -424,8 +422,8 @@ func (z *E12) Inverse(x *E12) *E12 { return z } -// BatchInvertE12 returns a new slice with every element inverted. -// Uses Montgomery batch inversion trick +// BatchInvertE12 returns a new slice with every element in a inverted. +// It uses Montgomery batch inversion trick. // // if a[i] == 0, returns result[i] = a[i] func BatchInvertE12(a []E12) []E12 { @@ -535,7 +533,7 @@ func (z *E12) CyclotomicExp(x E12, k *big.Int) *E12 { n := ecc.NafDecomposition(e, eNAF[:]) for i := n - 1; i >= 0; i-- { res.CyclotomicSquare(&res) - if eNAF[i] == 1 { + if eNAF[i] == 1 { // nolint QF1003 res.Mul(&res, &x) } else if eNAF[i] == -1 { res.Mul(&res, &xInv) @@ -635,12 +633,12 @@ func (z *E12) ExpGLV(x E12, k *big.Int) *E12 { return z } -// InverseUnitary inverse a unitary element +// InverseUnitary inverses a unitary element func (z *E12) InverseUnitary(x *E12) *E12 { return z.Conjugate(x) } -// Conjugate set z to x conjugated and return z +// Conjugate sets z to x conjugated and returns z func (z *E12) Conjugate(x *E12) *E12 { *z = *x z.C1.Neg(&z.C1) @@ -846,6 +844,8 @@ func BatchDecompressTorus(x []E6) ([]E12, error) { return res, nil } +// Select is conditional move. +// If cond = 0, it sets z to caseZ and returns it. otherwise caseNz. func (z *E12) Select(cond int, caseZ *E12, caseNz *E12) *E12 { //Might be able to save a nanosecond or two by an aggregate implementation @@ -855,6 +855,7 @@ func (z *E12) Select(cond int, caseZ *E12, caseNz *E12) *E12 { return z } +// Div divides an element in E12 by an element in E12 func (z *E12) Div(x *E12, y *E12) *E12 { var r E12 r.Inverse(y).Mul(x, &r) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e12_pairing.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e12_pairing.go index 880520f81..035f26e73 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e12_pairing.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e12_pairing.go @@ -66,6 +66,28 @@ func (z *E12) MulBy014(c0, c1, c4 *E2) *E12 { return z } +// MulBy01 multiplication by sparse element (c0, c1, 0, 0, 1) +func (z *E12) MulBy01(c0, c1 *E2) *E12 { + + var a, b E6 + var d E2 + + a.Set(&z.C0) + a.MulBy01(c0, c1) + + b.MulByNonResidue(&z.C1) + d.SetOne().Add(c1, &d) + + z.C1.Add(&z.C1, &z.C0) + z.C1.MulBy01(c0, &d) + z.C1.Sub(&z.C1, &a) + z.C1.Sub(&z.C1, &b) + z.C0.MulByNonResidue(&b) + z.C0.Add(&z.C0, &a) + + return z +} + // Mul014By014 multiplication of sparse element (c0,c1,0,0,c4,0) by sparse element (d0,d1,0,0,d4,0) func Mul014By014(d0, d1, d4, c0, c1, c4 *E2) [5]E2 { var z00, tmp, x0, x1, x4, x04, x01, x14 E2 @@ -94,6 +116,26 @@ func Mul014By014(d0, d1, d4, c0, c1, c4 *E2) [5]E2 { return [5]E2{z00, x01, x1, x04, x14} } +// Mul01By01 multiplication of sparse element (c0,c1,0,0,1,0) by sparse element (d0,d1,0,0,1,0) +func Mul01By01(d0, d1, c0, c1 *E2) [5]E2 { + var z00, tmp, x0, x1, x4, x04, x01, x14 E2 + x0.Mul(c0, d0) + x1.Mul(c1, d1) + x4.SetOne() + x04.Add(d0, c0) + tmp.Add(c0, c1) + x01.Add(d0, d1). + Mul(&x01, &tmp). + Sub(&x01, &x0). + Sub(&x01, &x1) + x14.Add(d1, c1) + + z00.MulByNonResidue(&x4). + Add(&z00, &x0) + + return [5]E2{z00, x01, x1, x04, x14} +} + // MulBy01245 multiplies z by an E12 sparse element of the form (x0, x1, x2, 0, x4, x5) func (z *E12) MulBy01245(x *[5]E2) *E12 { var c1, a, b, c, z0, z1 E6 diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e2.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e2.go index 0390e7e4b..3e50a6380 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e2.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e2.go @@ -1,16 +1,5 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -101,11 +90,20 @@ func (z *E2) SetRandom() (*E2, error) { return z, nil } -// IsZero returns true if the two elements are equal, false otherwise +// MustSetRandom sets a0 and a1 to random values. +// It panics if reading form crypto/rand fails +func (z *E2) MustSetRandom() { + if _, err := z.SetRandom(); err != nil { + panic(err) + } +} + +// IsZero returns true if z is zero, false otherwise func (z *E2) IsZero() bool { return z.A0.IsZero() && z.A1.IsZero() } +// IsOne returns true if z is one, false otherwise func (z *E2) IsOne() bool { return z.A0.IsOne() && z.A1.IsZero() } @@ -116,7 +114,7 @@ func (z *E2) Add(x, y *E2) *E2 { return z } -// Sub two elements of E2 +// Sub subtracts two elements of E2 func (z *E2) Sub(x, y *E2) *E2 { subE2(z, x, y) return z @@ -155,7 +153,7 @@ func (z *E2) Conjugate(x *E2) *E2 { return z } -// Halve sets z = z / 2 +// Halve sets z to z / 2 func (z *E2) Halve() { z.A0.Halve() z.A1.Halve() @@ -213,7 +211,7 @@ func init() { var sqrtExp1, sqrtExp2 big.Int -// Sqrt sets z to the square root of and returns z +// Sqrt sets z to the square root of x and returns z // The function does not test whether the square root // exists or not, it's up to the caller to call // Legendre beforehand. @@ -243,8 +241,8 @@ func (z *E2) Sqrt(x *E2) *E2 { return z } -// BatchInvertE2 returns a new slice with every element inverted. -// Uses Montgomery batch inversion trick +// BatchInvertE2 returns a new slice with every element in a inverted. +// It uses Montgomery batch inversion trick. // // if a[i] == 0, returns result[i] = a[i] func BatchInvertE2(a []E2) []E2 { @@ -279,6 +277,8 @@ func BatchInvertE2(a []E2) []E2 { return res } +// Select is conditional move. +// If cond = 0, it sets z to caseZ and returns it. otherwise caseNz. func (z *E2) Select(cond int, caseZ *E2, caseNz *E2) *E2 { //Might be able to save a nanosecond or two by an aggregate implementation @@ -288,6 +288,7 @@ func (z *E2) Select(cond int, caseZ *E2, caseNz *E2) *E2 { return z } +// Div divides an element in E2 by an element in E2 func (z *E2) Div(x *E2, y *E2) *E2 { var r E2 r.Inverse(y).Mul(x, &r) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e2_amd64.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e2_amd64.go index 5121f7cca..25d0ee60c 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e2_amd64.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e2_amd64.go @@ -1,21 +1,37 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT package fptower +import ( + "github.com/consensys/gnark-crypto/ecc/bls12-381/fp" +) + +// q + r'.r = 1, i.e., qInvNeg = - q⁻¹ mod r +// used for Montgomery reduction +const qInvNeg uint64 = 9940570264628428797 + +// Field modulus q (Fp) +const ( + q0 uint64 = 13402431016077863595 + q1 uint64 = 2210141511517208575 + q2 uint64 = 7435674573564081700 + q3 uint64 = 7239337960414712511 + q4 uint64 = 5412103778470702295 + q5 uint64 = 1873798617647539866 +) + +var qElement = fp.Element{ + q0, + q1, + q2, + q3, + q4, + q5, +} + //go:noescape func addE2(res, x, y *E2) @@ -35,17 +51,17 @@ func mulNonResE2(res, x *E2) func squareAdxE2(res, x *E2) //go:noescape -func mulAdxE2(z, x, y *E2) +func mulAdxE2(res, x, y *E2) -// Mul sets z to the E2-product of x,y, returns z -func (z *E2) Mul(x, y *E2) *E2 { - mulAdxE2(z, x, y) +// MulByNonResidue multiplies a E2 by (9,1) +func (z *E2) MulByNonResidue(x *E2) *E2 { + mulNonResE2(z, x) return z } -// MulByNonResidue multiplies a E2 by (1,1) -func (z *E2) MulByNonResidue(x *E2) *E2 { - mulNonResE2(z, x) +// Mul sets z to the E2-product of x,y, returns z +func (z *E2) Mul(x, y *E2) *E2 { + mulAdxE2(z, x, y) return z } diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e2_amd64.s b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e2_amd64.s index 7fc53f463..de562b080 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e2_amd64.s +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e2_amd64.s @@ -1,104 +1,107 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. #include "textflag.h" #include "funcdata.h" - -// modulus q -DATA q<>+0(SB)/8, $0xb9feffffffffaaab -DATA q<>+8(SB)/8, $0x1eabfffeb153ffff -DATA q<>+16(SB)/8, $0x6730d2a0f6b0f624 -DATA q<>+24(SB)/8, $0x64774b84f38512bf -DATA q<>+32(SB)/8, $0x4b1ba7b6434bacd7 -DATA q<>+40(SB)/8, $0x1a0111ea397fe69a -GLOBL q<>(SB), (RODATA+NOPTR), $48 - -// qInv0 q'[0] -DATA qInv0<>(SB)/8, $0x89f3fffcfffcfffd -GLOBL qInv0<>(SB), (RODATA+NOPTR), $8 - -#define REDUCE(ra0, ra1, ra2, ra3, ra4, ra5, rb0, rb1, rb2, rb3, rb4, rb5) \ - MOVQ ra0, rb0; \ - SUBQ q<>(SB), ra0; \ - MOVQ ra1, rb1; \ - SBBQ q<>+8(SB), ra1; \ - MOVQ ra2, rb2; \ - SBBQ q<>+16(SB), ra2; \ - MOVQ ra3, rb3; \ - SBBQ q<>+24(SB), ra3; \ - MOVQ ra4, rb4; \ - SBBQ q<>+32(SB), ra4; \ - MOVQ ra5, rb5; \ - SBBQ q<>+40(SB), ra5; \ - CMOVQCS rb0, ra0; \ - CMOVQCS rb1, ra1; \ - CMOVQCS rb2, ra2; \ - CMOVQCS rb3, ra3; \ - CMOVQCS rb4, ra4; \ - CMOVQCS rb5, ra5; \ - -TEXT ·addE2(SB), NOSPLIT, $0-24 +#include "go_asm.h" + +#define REDUCE(ra0, ra1, ra2, ra3, ra4, ra5, rb0, rb1, rb2, rb3, rb4, rb5, q0, q1, q2, q3, q4, q5) \ + MOVQ ra0, rb0; \ + SUBQ q0, ra0; \ + MOVQ ra1, rb1; \ + SBBQ q1, ra1; \ + MOVQ ra2, rb2; \ + SBBQ q2, ra2; \ + MOVQ ra3, rb3; \ + SBBQ q3, ra3; \ + MOVQ ra4, rb4; \ + SBBQ q4, ra4; \ + MOVQ ra5, rb5; \ + SBBQ q5, ra5; \ + CMOVQCS rb0, ra0; \ + CMOVQCS rb1, ra1; \ + CMOVQCS rb2, ra2; \ + CMOVQCS rb3, ra3; \ + CMOVQCS rb4, ra4; \ + CMOVQCS rb5, ra5; \ + +#define REDUCE_NOGLOBAL(ra0, ra1, ra2, ra3, ra4, ra5, rb0, rb1, rb2, rb3, rb4, rb5, scratch0) \ + MOVQ ra0, rb0; \ + MOVQ $const_q0, scratch0; \ + SUBQ scratch0, ra0; \ + MOVQ ra1, rb1; \ + MOVQ $const_q1, scratch0; \ + SBBQ scratch0, ra1; \ + MOVQ ra2, rb2; \ + MOVQ $const_q2, scratch0; \ + SBBQ scratch0, ra2; \ + MOVQ ra3, rb3; \ + MOVQ $const_q3, scratch0; \ + SBBQ scratch0, ra3; \ + MOVQ ra4, rb4; \ + MOVQ $const_q4, scratch0; \ + SBBQ scratch0, ra4; \ + MOVQ ra5, rb5; \ + MOVQ $const_q5, scratch0; \ + SBBQ scratch0, ra5; \ + CMOVQCS rb0, ra0; \ + CMOVQCS rb1, ra1; \ + CMOVQCS rb2, ra2; \ + CMOVQCS rb3, ra3; \ + CMOVQCS rb4, ra4; \ + CMOVQCS rb5, ra5; \ + +TEXT ·addE2(SB), $8-24 MOVQ x+8(FP), AX - MOVQ 0(AX), BX - MOVQ 8(AX), SI - MOVQ 16(AX), DI - MOVQ 24(AX), R8 - MOVQ 32(AX), R9 - MOVQ 40(AX), R10 + MOVQ 0(AX), CX + MOVQ 8(AX), BX + MOVQ 16(AX), SI + MOVQ 24(AX), DI + MOVQ 32(AX), R8 + MOVQ 40(AX), R9 MOVQ y+16(FP), DX - ADDQ 0(DX), BX - ADCQ 8(DX), SI - ADCQ 16(DX), DI - ADCQ 24(DX), R8 - ADCQ 32(DX), R9 - ADCQ 40(DX), R10 - - // reduce element(BX,SI,DI,R8,R9,R10) using temp registers (R11,R12,R13,R14,R15,s0-8(SP)) - REDUCE(BX,SI,DI,R8,R9,R10,R11,R12,R13,R14,R15,s0-8(SP)) - - MOVQ res+0(FP), CX - MOVQ BX, 0(CX) - MOVQ SI, 8(CX) - MOVQ DI, 16(CX) - MOVQ R8, 24(CX) - MOVQ R9, 32(CX) - MOVQ R10, 40(CX) - MOVQ 48(AX), BX - MOVQ 56(AX), SI - MOVQ 64(AX), DI - MOVQ 72(AX), R8 - MOVQ 80(AX), R9 - MOVQ 88(AX), R10 - ADDQ 48(DX), BX - ADCQ 56(DX), SI - ADCQ 64(DX), DI - ADCQ 72(DX), R8 - ADCQ 80(DX), R9 - ADCQ 88(DX), R10 - - // reduce element(BX,SI,DI,R8,R9,R10) using temp registers (R11,R12,R13,R14,R15,s0-8(SP)) - REDUCE(BX,SI,DI,R8,R9,R10,R11,R12,R13,R14,R15,s0-8(SP)) - - MOVQ BX, 48(CX) - MOVQ SI, 56(CX) - MOVQ DI, 64(CX) - MOVQ R8, 72(CX) - MOVQ R9, 80(CX) - MOVQ R10, 88(CX) + ADDQ 0(DX), CX + ADCQ 8(DX), BX + ADCQ 16(DX), SI + ADCQ 24(DX), DI + ADCQ 32(DX), R8 + ADCQ 40(DX), R9 + + // reduce element(CX,BX,SI,DI,R8,R9,) using temp registers (R11,R12,R13,R14,R15,s0-8(SP),R10) + REDUCE_NOGLOBAL(CX,BX,SI,DI,R8,R9,R11,R12,R13,R14,R15,s0-8(SP),R10) + + MOVQ res+0(FP), R11 + MOVQ CX, 0(R11) + MOVQ BX, 8(R11) + MOVQ SI, 16(R11) + MOVQ DI, 24(R11) + MOVQ R8, 32(R11) + MOVQ R9, 40(R11) + MOVQ 48(AX), CX + MOVQ 56(AX), BX + MOVQ 64(AX), SI + MOVQ 72(AX), DI + MOVQ 80(AX), R8 + MOVQ 88(AX), R9 + ADDQ 48(DX), CX + ADCQ 56(DX), BX + ADCQ 64(DX), SI + ADCQ 72(DX), DI + ADCQ 80(DX), R8 + ADCQ 88(DX), R9 + + // reduce element(CX,BX,SI,DI,R8,R9,) using temp registers (R13,R14,R15,R10,AX,DX,R12) + REDUCE_NOGLOBAL(CX,BX,SI,DI,R8,R9,R13,R14,R15,R10,AX,DX,R12) + + MOVQ CX, 48(R11) + MOVQ BX, 56(R11) + MOVQ SI, 64(R11) + MOVQ DI, 72(R11) + MOVQ R8, 80(R11) + MOVQ R9, 88(R11) RET -TEXT ·doubleE2(SB), NOSPLIT, $0-16 +TEXT ·doubleE2(SB), $8-16 MOVQ res+0(FP), DX MOVQ x+8(FP), AX MOVQ 0(AX), CX @@ -114,8 +117,8 @@ TEXT ·doubleE2(SB), NOSPLIT, $0-16 ADCQ R8, R8 ADCQ R9, R9 - // reduce element(CX,BX,SI,DI,R8,R9) using temp registers (R10,R11,R12,R13,R14,R15) - REDUCE(CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14,R15) + // reduce element(CX,BX,SI,DI,R8,R9,) using temp registers (R11,R12,R13,R14,R15,s0-8(SP),R10) + REDUCE_NOGLOBAL(CX,BX,SI,DI,R8,R9,R11,R12,R13,R14,R15,s0-8(SP),R10) MOVQ CX, 0(DX) MOVQ BX, 8(DX) @@ -136,8 +139,8 @@ TEXT ·doubleE2(SB), NOSPLIT, $0-16 ADCQ R8, R8 ADCQ R9, R9 - // reduce element(CX,BX,SI,DI,R8,R9) using temp registers (R10,R11,R12,R13,R14,R15) - REDUCE(CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14,R15) + // reduce element(CX,BX,SI,DI,R8,R9,) using temp registers (R12,R13,R14,R15,R10,s0-8(SP),R11) + REDUCE_NOGLOBAL(CX,BX,SI,DI,R8,R9,R12,R13,R14,R15,R10,s0-8(SP),R11) MOVQ CX, 48(DX) MOVQ BX, 56(DX) @@ -148,7 +151,7 @@ TEXT ·doubleE2(SB), NOSPLIT, $0-16 RET TEXT ·subE2(SB), NOSPLIT, $0-24 - XORQ R9, R9 + XORQ R15, R15 MOVQ x+8(FP), R8 MOVQ 0(R8), AX MOVQ 8(R8), DX @@ -164,31 +167,31 @@ TEXT ·subE2(SB), NOSPLIT, $0-24 SBBQ 32(R8), SI SBBQ 40(R8), DI MOVQ x+8(FP), R8 - MOVQ $0xb9feffffffffaaab, R10 - MOVQ $0x1eabfffeb153ffff, R11 - MOVQ $0x6730d2a0f6b0f624, R12 - MOVQ $0x64774b84f38512bf, R13 - MOVQ $0x4b1ba7b6434bacd7, R14 - MOVQ $0x1a0111ea397fe69a, R15 - CMOVQCC R9, R10 - CMOVQCC R9, R11 - CMOVQCC R9, R12 - CMOVQCC R9, R13 - CMOVQCC R9, R14 - CMOVQCC R9, R15 - ADDQ R10, AX - ADCQ R11, DX - ADCQ R12, CX - ADCQ R13, BX - ADCQ R14, SI - ADCQ R15, DI - MOVQ res+0(FP), R10 - MOVQ AX, 0(R10) - MOVQ DX, 8(R10) - MOVQ CX, 16(R10) - MOVQ BX, 24(R10) - MOVQ SI, 32(R10) - MOVQ DI, 40(R10) + MOVQ $0xb9feffffffffaaab, R9 + MOVQ $0x1eabfffeb153ffff, R10 + MOVQ $0x6730d2a0f6b0f624, R11 + MOVQ $0x64774b84f38512bf, R12 + MOVQ $0x4b1ba7b6434bacd7, R13 + MOVQ $0x1a0111ea397fe69a, R14 + CMOVQCC R15, R9 + CMOVQCC R15, R10 + CMOVQCC R15, R11 + CMOVQCC R15, R12 + CMOVQCC R15, R13 + CMOVQCC R15, R14 + ADDQ R9, AX + ADCQ R10, DX + ADCQ R11, CX + ADCQ R12, BX + ADCQ R13, SI + ADCQ R14, DI + MOVQ res+0(FP), R9 + MOVQ AX, 0(R9) + MOVQ DX, 8(R9) + MOVQ CX, 16(R9) + MOVQ BX, 24(R9) + MOVQ SI, 32(R9) + MOVQ DI, 40(R9) MOVQ 48(R8), AX MOVQ 56(R8), DX MOVQ 64(R8), CX @@ -202,24 +205,24 @@ TEXT ·subE2(SB), NOSPLIT, $0-24 SBBQ 72(R8), BX SBBQ 80(R8), SI SBBQ 88(R8), DI - MOVQ $0xb9feffffffffaaab, R11 - MOVQ $0x1eabfffeb153ffff, R12 - MOVQ $0x6730d2a0f6b0f624, R13 - MOVQ $0x64774b84f38512bf, R14 - MOVQ $0x4b1ba7b6434bacd7, R15 - MOVQ $0x1a0111ea397fe69a, R10 - CMOVQCC R9, R11 - CMOVQCC R9, R12 - CMOVQCC R9, R13 - CMOVQCC R9, R14 - CMOVQCC R9, R15 - CMOVQCC R9, R10 - ADDQ R11, AX - ADCQ R12, DX - ADCQ R13, CX - ADCQ R14, BX - ADCQ R15, SI - ADCQ R10, DI + MOVQ $0xb9feffffffffaaab, R10 + MOVQ $0x1eabfffeb153ffff, R11 + MOVQ $0x6730d2a0f6b0f624, R12 + MOVQ $0x64774b84f38512bf, R13 + MOVQ $0x4b1ba7b6434bacd7, R14 + MOVQ $0x1a0111ea397fe69a, R9 + CMOVQCC R15, R10 + CMOVQCC R15, R11 + CMOVQCC R15, R12 + CMOVQCC R15, R13 + CMOVQCC R15, R14 + CMOVQCC R15, R9 + ADDQ R10, AX + ADCQ R11, DX + ADCQ R12, CX + ADCQ R13, BX + ADCQ R14, SI + ADCQ R9, DI MOVQ res+0(FP), R8 MOVQ AX, 48(R8) MOVQ DX, 56(R8) @@ -364,51 +367,404 @@ TEXT ·mulNonResE2(SB), NOSPLIT, $0-16 ADCQ 24(R14), R11 ADCQ 32(R14), R12 ADCQ 40(R14), R13 - MOVQ res+0(FP), R15 - MOVQ AX, 0(R15) - MOVQ DX, 8(R15) - MOVQ CX, 16(R15) - MOVQ BX, 24(R15) - MOVQ SI, 32(R15) - MOVQ DI, 40(R15) + MOVQ res+0(FP), R14 + MOVQ AX, 0(R14) + MOVQ DX, 8(R14) + MOVQ CX, 16(R14) + MOVQ BX, 24(R14) + MOVQ SI, 32(R14) + MOVQ DI, 40(R14) + + // reduce element(R8,R9,R10,R11,R12,R13,) using temp registers (AX,DX,CX,BX,SI,DI,R15) + REDUCE_NOGLOBAL(R8,R9,R10,R11,R12,R13,AX,DX,CX,BX,SI,DI,R15) + + MOVQ R8, 48(R14) + MOVQ R9, 56(R14) + MOVQ R10, 64(R14) + MOVQ R11, 72(R14) + MOVQ R12, 80(R14) + MOVQ R13, 88(R14) + RET + +TEXT ·mulAdxE2(SB), $144-24 + NO_LOCAL_POINTERS + CMPB ·supportAdx(SB), $1 + JNE l4 + + // var a, b, c fp.Element + // a.Add(&x.A0, &x.A1) + // b.Add(&y.A0, &y.A1) + // a.Mul(&a, &b) + // b.Mul(&x.A0, &y.A0) + // c.Mul(&x.A1, &y.A1) + // z.A1.Sub(&a, &b).Sub(&z.A1, &c) + // z.A0.Sub(&b, &c) + + MOVQ $const_q0, AX + MOVQ AX, s0-8(SP) + MOVQ $const_q1, AX + MOVQ AX, s1-16(SP) + MOVQ $const_q2, AX + MOVQ AX, s2-24(SP) + MOVQ $const_q3, AX + MOVQ AX, s3-32(SP) + MOVQ $const_q4, AX + MOVQ AX, s4-40(SP) + MOVQ $const_q5, AX + MOVQ AX, s5-48(SP) + MOVQ x+8(FP), AX + MOVQ 48(AX), R13 + MOVQ 56(AX), R14 + MOVQ 64(AX), CX + MOVQ 72(AX), BX + MOVQ 80(AX), SI + MOVQ 88(AX), DI + + // A -> BP + // t[0] -> R8 + // t[1] -> R9 + // t[2] -> R10 + // t[3] -> R11 + // t[4] -> R12 + // t[5] -> R15 +#define MACC(in0, in1, in2) \ + ADCXQ in0, in1 \ + MULXQ in2, AX, in0 \ + ADOXQ AX, in1 \ + +#define DIV_SHIFT() \ + PUSHQ BP \ + MOVQ $const_qInvNeg, DX \ + IMULQ R8, DX \ + XORQ AX, AX \ + MULXQ s0-8(SP), AX, BP \ + ADCXQ R8, AX \ + MOVQ BP, R8 \ + POPQ BP \ + MACC(R9, R8, s1-16(SP)) \ + MACC(R10, R9, s2-24(SP)) \ + MACC(R11, R10, s3-32(SP)) \ + MACC(R12, R11, s4-40(SP)) \ + MACC(R15, R12, s5-48(SP)) \ + MOVQ $0, AX \ + ADCXQ AX, R15 \ + ADOXQ BP, R15 \ + +#define MUL_WORD_0() \ + XORQ AX, AX \ + MULXQ R13, R8, R9 \ + MULXQ R14, AX, R10 \ + ADOXQ AX, R9 \ + MULXQ CX, AX, R11 \ + ADOXQ AX, R10 \ + MULXQ BX, AX, R12 \ + ADOXQ AX, R11 \ + MULXQ SI, AX, R15 \ + ADOXQ AX, R12 \ + MULXQ DI, AX, BP \ + ADOXQ AX, R15 \ + MOVQ $0, AX \ + ADOXQ AX, BP \ + DIV_SHIFT() \ + +#define MUL_WORD_N() \ + XORQ AX, AX \ + MULXQ R13, AX, BP \ + ADOXQ AX, R8 \ + MACC(BP, R9, R14) \ + MACC(BP, R10, CX) \ + MACC(BP, R11, BX) \ + MACC(BP, R12, SI) \ + MACC(BP, R15, DI) \ + MOVQ $0, AX \ + ADCXQ AX, BP \ + ADOXQ AX, BP \ + DIV_SHIFT() \ + + // mul body + MOVQ y+16(FP), DX + MOVQ 48(DX), DX + MUL_WORD_0() + MOVQ y+16(FP), DX + MOVQ 56(DX), DX + MUL_WORD_N() + MOVQ y+16(FP), DX + MOVQ 64(DX), DX + MUL_WORD_N() + MOVQ y+16(FP), DX + MOVQ 72(DX), DX + MUL_WORD_N() + MOVQ y+16(FP), DX + MOVQ 80(DX), DX + MUL_WORD_N() + MOVQ y+16(FP), DX + MOVQ 88(DX), DX + MUL_WORD_N() + + // reduce element(R8,R9,R10,R11,R12,R15) using temp registers (R13,R14,CX,BX,SI,DI) + REDUCE(R8,R9,R10,R11,R12,R15,R13,R14,CX,BX,SI,DI,s0-8(SP),s1-16(SP),s2-24(SP),s3-32(SP),s4-40(SP),s5-48(SP)) + + MOVQ R8, s12-104(SP) + MOVQ R9, s13-112(SP) + MOVQ R10, s14-120(SP) + MOVQ R11, s15-128(SP) + MOVQ R12, s16-136(SP) + MOVQ R15, s17-144(SP) + MOVQ x+8(FP), AX + MOVQ y+16(FP), DX + MOVQ 48(AX), R13 + MOVQ 56(AX), R14 + MOVQ 64(AX), CX + MOVQ 72(AX), BX + MOVQ 80(AX), SI + MOVQ 88(AX), DI + ADDQ 0(AX), R13 + ADCQ 8(AX), R14 + ADCQ 16(AX), CX + ADCQ 24(AX), BX + ADCQ 32(AX), SI + ADCQ 40(AX), DI + MOVQ R13, s6-56(SP) + MOVQ R14, s7-64(SP) + MOVQ CX, s8-72(SP) + MOVQ BX, s9-80(SP) + MOVQ SI, s10-88(SP) + MOVQ DI, s11-96(SP) + MOVQ 0(DX), R13 + MOVQ 8(DX), R14 + MOVQ 16(DX), CX + MOVQ 24(DX), BX + MOVQ 32(DX), SI + MOVQ 40(DX), DI + ADDQ 48(DX), R13 + ADCQ 56(DX), R14 + ADCQ 64(DX), CX + ADCQ 72(DX), BX + ADCQ 80(DX), SI + ADCQ 88(DX), DI + + // A -> BP + // t[0] -> R8 + // t[1] -> R9 + // t[2] -> R10 + // t[3] -> R11 + // t[4] -> R12 + // t[5] -> R15 + // mul body + MOVQ s6-56(SP), DX + MUL_WORD_0() + MOVQ s7-64(SP), DX + MUL_WORD_N() + MOVQ s8-72(SP), DX + MUL_WORD_N() + MOVQ s9-80(SP), DX + MUL_WORD_N() + MOVQ s10-88(SP), DX + MUL_WORD_N() + MOVQ s11-96(SP), DX + MUL_WORD_N() + + // reduce element(R8,R9,R10,R11,R12,R15) using temp registers (R13,R14,CX,BX,SI,DI) + REDUCE(R8,R9,R10,R11,R12,R15,R13,R14,CX,BX,SI,DI,s0-8(SP),s1-16(SP),s2-24(SP),s3-32(SP),s4-40(SP),s5-48(SP)) + + MOVQ R8, s6-56(SP) + MOVQ R9, s7-64(SP) + MOVQ R10, s8-72(SP) + MOVQ R11, s9-80(SP) + MOVQ R12, s10-88(SP) + MOVQ R15, s11-96(SP) + MOVQ x+8(FP), AX + MOVQ 0(AX), R13 + MOVQ 8(AX), R14 + MOVQ 16(AX), CX + MOVQ 24(AX), BX + MOVQ 32(AX), SI + MOVQ 40(AX), DI + + // A -> BP + // t[0] -> R8 + // t[1] -> R9 + // t[2] -> R10 + // t[3] -> R11 + // t[4] -> R12 + // t[5] -> R15 + // mul body + MOVQ y+16(FP), DX + MOVQ 0(DX), DX + MUL_WORD_0() + MOVQ y+16(FP), DX + MOVQ 8(DX), DX + MUL_WORD_N() + MOVQ y+16(FP), DX + MOVQ 16(DX), DX + MUL_WORD_N() + MOVQ y+16(FP), DX + MOVQ 24(DX), DX + MUL_WORD_N() + MOVQ y+16(FP), DX + MOVQ 32(DX), DX + MUL_WORD_N() + MOVQ y+16(FP), DX + MOVQ 40(DX), DX + MUL_WORD_N() + + // reduce element(R8,R9,R10,R11,R12,R15) using temp registers (R13,R14,CX,BX,SI,DI) + REDUCE(R8,R9,R10,R11,R12,R15,R13,R14,CX,BX,SI,DI,s0-8(SP),s1-16(SP),s2-24(SP),s3-32(SP),s4-40(SP),s5-48(SP)) - // reduce element(R8,R9,R10,R11,R12,R13) using temp registers (AX,DX,CX,BX,SI,DI) - REDUCE(R8,R9,R10,R11,R12,R13,AX,DX,CX,BX,SI,DI) + XORQ DX, DX + MOVQ s6-56(SP), R13 + MOVQ s7-64(SP), R14 + MOVQ s8-72(SP), CX + MOVQ s9-80(SP), BX + MOVQ s10-88(SP), SI + MOVQ s11-96(SP), DI + SUBQ R8, R13 + SBBQ R9, R14 + SBBQ R10, CX + SBBQ R11, BX + SBBQ R12, SI + SBBQ R15, DI + MOVQ R8, s6-56(SP) + MOVQ R9, s7-64(SP) + MOVQ R10, s8-72(SP) + MOVQ R11, s9-80(SP) + MOVQ R12, s10-88(SP) + MOVQ R15, s11-96(SP) + MOVQ $0xb9feffffffffaaab, R8 + MOVQ $0x1eabfffeb153ffff, R9 + MOVQ $0x6730d2a0f6b0f624, R10 + MOVQ $0x64774b84f38512bf, R11 + MOVQ $0x4b1ba7b6434bacd7, R12 + MOVQ $0x1a0111ea397fe69a, R15 + CMOVQCC DX, R8 + CMOVQCC DX, R9 + CMOVQCC DX, R10 + CMOVQCC DX, R11 + CMOVQCC DX, R12 + CMOVQCC DX, R15 + ADDQ R8, R13 + ADCQ R9, R14 + ADCQ R10, CX + ADCQ R11, BX + ADCQ R12, SI + ADCQ R15, DI + SUBQ s12-104(SP), R13 + SBBQ s13-112(SP), R14 + SBBQ s14-120(SP), CX + SBBQ s15-128(SP), BX + SBBQ s16-136(SP), SI + SBBQ s17-144(SP), DI + MOVQ $0xb9feffffffffaaab, R8 + MOVQ $0x1eabfffeb153ffff, R9 + MOVQ $0x6730d2a0f6b0f624, R10 + MOVQ $0x64774b84f38512bf, R11 + MOVQ $0x4b1ba7b6434bacd7, R12 + MOVQ $0x1a0111ea397fe69a, R15 + CMOVQCC DX, R8 + CMOVQCC DX, R9 + CMOVQCC DX, R10 + CMOVQCC DX, R11 + CMOVQCC DX, R12 + CMOVQCC DX, R15 + ADDQ R8, R13 + ADCQ R9, R14 + ADCQ R10, CX + ADCQ R11, BX + ADCQ R12, SI + ADCQ R15, DI + MOVQ res+0(FP), AX + MOVQ R13, 48(AX) + MOVQ R14, 56(AX) + MOVQ CX, 64(AX) + MOVQ BX, 72(AX) + MOVQ SI, 80(AX) + MOVQ DI, 88(AX) + MOVQ s6-56(SP), R8 + MOVQ s7-64(SP), R9 + MOVQ s8-72(SP), R10 + MOVQ s9-80(SP), R11 + MOVQ s10-88(SP), R12 + MOVQ s11-96(SP), R15 + SUBQ s12-104(SP), R8 + SBBQ s13-112(SP), R9 + SBBQ s14-120(SP), R10 + SBBQ s15-128(SP), R11 + SBBQ s16-136(SP), R12 + SBBQ s17-144(SP), R15 + MOVQ $0xb9feffffffffaaab, R13 + MOVQ $0x1eabfffeb153ffff, R14 + MOVQ $0x6730d2a0f6b0f624, CX + MOVQ $0x64774b84f38512bf, BX + MOVQ $0x4b1ba7b6434bacd7, SI + MOVQ $0x1a0111ea397fe69a, DI + CMOVQCC DX, R13 + CMOVQCC DX, R14 + CMOVQCC DX, CX + CMOVQCC DX, BX + CMOVQCC DX, SI + CMOVQCC DX, DI + ADDQ R13, R8 + ADCQ R14, R9 + ADCQ CX, R10 + ADCQ BX, R11 + ADCQ SI, R12 + ADCQ DI, R15 + MOVQ R8, 0(AX) + MOVQ R9, 8(AX) + MOVQ R10, 16(AX) + MOVQ R11, 24(AX) + MOVQ R12, 32(AX) + MOVQ R15, 40(AX) + RET - MOVQ R8, 48(R15) - MOVQ R9, 56(R15) - MOVQ R10, 64(R15) - MOVQ R11, 72(R15) - MOVQ R12, 80(R15) - MOVQ R13, 88(R15) +l4: + MOVQ res+0(FP), AX + MOVQ AX, (SP) + MOVQ x+8(FP), AX + MOVQ AX, 8(SP) + MOVQ y+16(FP), AX + MOVQ AX, 16(SP) + CALL ·mulGenericE2(SB) RET -TEXT ·squareAdxE2(SB), $48-16 +TEXT ·squareAdxE2(SB), $96-16 NO_LOCAL_POINTERS + CMPB ·supportAdx(SB), $1 + JNE l5 // z.A0 = (x.A0 + x.A1) * (x.A0 - x.A1) // z.A1 = 2 * x.A0 * x.A1 - CMPB ·supportAdx(SB), $1 - JNE l4 + MOVQ $const_q0, AX + MOVQ AX, s0-8(SP) + MOVQ $const_q1, AX + MOVQ AX, s1-16(SP) + MOVQ $const_q2, AX + MOVQ AX, s2-24(SP) + MOVQ $const_q3, AX + MOVQ AX, s3-32(SP) + MOVQ $const_q4, AX + MOVQ AX, s4-40(SP) + MOVQ $const_q5, AX + MOVQ AX, s5-48(SP) // 2 * x.A0 * x.A1 MOVQ x+8(FP), AX - // 2 * x.A1[0] -> R14 - // 2 * x.A1[1] -> R15 + // 2 * x.A1[0] -> R13 + // 2 * x.A1[1] -> R14 // 2 * x.A1[2] -> CX // 2 * x.A1[3] -> BX // 2 * x.A1[4] -> SI // 2 * x.A1[5] -> DI - MOVQ 48(AX), R14 - MOVQ 56(AX), R15 + MOVQ 48(AX), R13 + MOVQ 56(AX), R14 MOVQ 64(AX), CX MOVQ 72(AX), BX MOVQ 80(AX), SI MOVQ 88(AX), DI - ADDQ R14, R14 - ADCQ R15, R15 + ADDQ R13, R13 + ADCQ R14, R14 ADCQ CX, CX ADCQ BX, BX ADCQ SI, SI @@ -420,511 +776,40 @@ TEXT ·squareAdxE2(SB), $48-16 // t[2] -> R10 // t[3] -> R11 // t[4] -> R12 - // t[5] -> R13 - // clear the flags - XORQ AX, AX + // t[5] -> R15 + // mul body MOVQ x+8(FP), DX MOVQ 0(DX), DX - - // (A,t[0]) := x[0]*y[0] + A - MULXQ R14, R8, R9 - - // (A,t[1]) := x[1]*y[0] + A - MULXQ R15, AX, R10 - ADOXQ AX, R9 - - // (A,t[2]) := x[2]*y[0] + A - MULXQ CX, AX, R11 - ADOXQ AX, R10 - - // (A,t[3]) := x[3]*y[0] + A - MULXQ BX, AX, R12 - ADOXQ AX, R11 - - // (A,t[4]) := x[4]*y[0] + A - MULXQ SI, AX, R13 - ADOXQ AX, R12 - - // (A,t[5]) := x[5]*y[0] + A - MULXQ DI, AX, BP - ADOXQ AX, R13 - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADOXQ AX, BP - PUSHQ BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R8, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R8, AX - MOVQ BP, R8 - POPQ BP - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R9, R8 - MULXQ q<>+8(SB), AX, R9 - ADOXQ AX, R8 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ R10, R9 - MULXQ q<>+16(SB), AX, R10 - ADOXQ AX, R9 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ R11, R10 - MULXQ q<>+24(SB), AX, R11 - ADOXQ AX, R10 - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ R12, R11 - MULXQ q<>+32(SB), AX, R12 - ADOXQ AX, R11 - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ R13, R12 - MULXQ q<>+40(SB), AX, R13 - ADOXQ AX, R12 - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, R13 - ADOXQ BP, R13 - - // clear the flags - XORQ AX, AX + MUL_WORD_0() MOVQ x+8(FP), DX MOVQ 8(DX), DX + MUL_WORD_N() + MOVQ x+8(FP), DX + MOVQ 16(DX), DX + MUL_WORD_N() + MOVQ x+8(FP), DX + MOVQ 24(DX), DX + MUL_WORD_N() + MOVQ x+8(FP), DX + MOVQ 32(DX), DX + MUL_WORD_N() + MOVQ x+8(FP), DX + MOVQ 40(DX), DX + MUL_WORD_N() - // (A,t[0]) := t[0] + x[0]*y[1] + A - MULXQ R14, AX, BP - ADOXQ AX, R8 - - // (A,t[1]) := t[1] + x[1]*y[1] + A - ADCXQ BP, R9 - MULXQ R15, AX, BP - ADOXQ AX, R9 - - // (A,t[2]) := t[2] + x[2]*y[1] + A - ADCXQ BP, R10 - MULXQ CX, AX, BP - ADOXQ AX, R10 - - // (A,t[3]) := t[3] + x[3]*y[1] + A - ADCXQ BP, R11 - MULXQ BX, AX, BP - ADOXQ AX, R11 - - // (A,t[4]) := t[4] + x[4]*y[1] + A - ADCXQ BP, R12 - MULXQ SI, AX, BP - ADOXQ AX, R12 - - // (A,t[5]) := t[5] + x[5]*y[1] + A - ADCXQ BP, R13 - MULXQ DI, AX, BP - ADOXQ AX, R13 - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - PUSHQ BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R8, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R8, AX - MOVQ BP, R8 - POPQ BP + // reduce element(R8,R9,R10,R11,R12,R15) using temp registers (R13,R14,CX,BX,SI,DI) + REDUCE(R8,R9,R10,R11,R12,R15,R13,R14,CX,BX,SI,DI,s0-8(SP),s1-16(SP),s2-24(SP),s3-32(SP),s4-40(SP),s5-48(SP)) - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R9, R8 - MULXQ q<>+8(SB), AX, R9 - ADOXQ AX, R8 + MOVQ x+8(FP), AX - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ R10, R9 - MULXQ q<>+16(SB), AX, R10 - ADOXQ AX, R9 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ R11, R10 - MULXQ q<>+24(SB), AX, R11 - ADOXQ AX, R10 - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ R12, R11 - MULXQ q<>+32(SB), AX, R12 - ADOXQ AX, R11 - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ R13, R12 - MULXQ q<>+40(SB), AX, R13 - ADOXQ AX, R12 - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, R13 - ADOXQ BP, R13 - - // clear the flags - XORQ AX, AX - MOVQ x+8(FP), DX - MOVQ 16(DX), DX - - // (A,t[0]) := t[0] + x[0]*y[2] + A - MULXQ R14, AX, BP - ADOXQ AX, R8 - - // (A,t[1]) := t[1] + x[1]*y[2] + A - ADCXQ BP, R9 - MULXQ R15, AX, BP - ADOXQ AX, R9 - - // (A,t[2]) := t[2] + x[2]*y[2] + A - ADCXQ BP, R10 - MULXQ CX, AX, BP - ADOXQ AX, R10 - - // (A,t[3]) := t[3] + x[3]*y[2] + A - ADCXQ BP, R11 - MULXQ BX, AX, BP - ADOXQ AX, R11 - - // (A,t[4]) := t[4] + x[4]*y[2] + A - ADCXQ BP, R12 - MULXQ SI, AX, BP - ADOXQ AX, R12 - - // (A,t[5]) := t[5] + x[5]*y[2] + A - ADCXQ BP, R13 - MULXQ DI, AX, BP - ADOXQ AX, R13 - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - PUSHQ BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R8, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R8, AX - MOVQ BP, R8 - POPQ BP - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R9, R8 - MULXQ q<>+8(SB), AX, R9 - ADOXQ AX, R8 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ R10, R9 - MULXQ q<>+16(SB), AX, R10 - ADOXQ AX, R9 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ R11, R10 - MULXQ q<>+24(SB), AX, R11 - ADOXQ AX, R10 - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ R12, R11 - MULXQ q<>+32(SB), AX, R12 - ADOXQ AX, R11 - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ R13, R12 - MULXQ q<>+40(SB), AX, R13 - ADOXQ AX, R12 - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, R13 - ADOXQ BP, R13 - - // clear the flags - XORQ AX, AX - MOVQ x+8(FP), DX - MOVQ 24(DX), DX - - // (A,t[0]) := t[0] + x[0]*y[3] + A - MULXQ R14, AX, BP - ADOXQ AX, R8 - - // (A,t[1]) := t[1] + x[1]*y[3] + A - ADCXQ BP, R9 - MULXQ R15, AX, BP - ADOXQ AX, R9 - - // (A,t[2]) := t[2] + x[2]*y[3] + A - ADCXQ BP, R10 - MULXQ CX, AX, BP - ADOXQ AX, R10 - - // (A,t[3]) := t[3] + x[3]*y[3] + A - ADCXQ BP, R11 - MULXQ BX, AX, BP - ADOXQ AX, R11 - - // (A,t[4]) := t[4] + x[4]*y[3] + A - ADCXQ BP, R12 - MULXQ SI, AX, BP - ADOXQ AX, R12 - - // (A,t[5]) := t[5] + x[5]*y[3] + A - ADCXQ BP, R13 - MULXQ DI, AX, BP - ADOXQ AX, R13 - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - PUSHQ BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R8, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R8, AX - MOVQ BP, R8 - POPQ BP - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R9, R8 - MULXQ q<>+8(SB), AX, R9 - ADOXQ AX, R8 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ R10, R9 - MULXQ q<>+16(SB), AX, R10 - ADOXQ AX, R9 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ R11, R10 - MULXQ q<>+24(SB), AX, R11 - ADOXQ AX, R10 - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ R12, R11 - MULXQ q<>+32(SB), AX, R12 - ADOXQ AX, R11 - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ R13, R12 - MULXQ q<>+40(SB), AX, R13 - ADOXQ AX, R12 - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, R13 - ADOXQ BP, R13 - - // clear the flags - XORQ AX, AX - MOVQ x+8(FP), DX - MOVQ 32(DX), DX - - // (A,t[0]) := t[0] + x[0]*y[4] + A - MULXQ R14, AX, BP - ADOXQ AX, R8 - - // (A,t[1]) := t[1] + x[1]*y[4] + A - ADCXQ BP, R9 - MULXQ R15, AX, BP - ADOXQ AX, R9 - - // (A,t[2]) := t[2] + x[2]*y[4] + A - ADCXQ BP, R10 - MULXQ CX, AX, BP - ADOXQ AX, R10 - - // (A,t[3]) := t[3] + x[3]*y[4] + A - ADCXQ BP, R11 - MULXQ BX, AX, BP - ADOXQ AX, R11 - - // (A,t[4]) := t[4] + x[4]*y[4] + A - ADCXQ BP, R12 - MULXQ SI, AX, BP - ADOXQ AX, R12 - - // (A,t[5]) := t[5] + x[5]*y[4] + A - ADCXQ BP, R13 - MULXQ DI, AX, BP - ADOXQ AX, R13 - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - PUSHQ BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R8, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R8, AX - MOVQ BP, R8 - POPQ BP - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R9, R8 - MULXQ q<>+8(SB), AX, R9 - ADOXQ AX, R8 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ R10, R9 - MULXQ q<>+16(SB), AX, R10 - ADOXQ AX, R9 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ R11, R10 - MULXQ q<>+24(SB), AX, R11 - ADOXQ AX, R10 - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ R12, R11 - MULXQ q<>+32(SB), AX, R12 - ADOXQ AX, R11 - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ R13, R12 - MULXQ q<>+40(SB), AX, R13 - ADOXQ AX, R12 - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, R13 - ADOXQ BP, R13 - - // clear the flags - XORQ AX, AX - MOVQ x+8(FP), DX - MOVQ 40(DX), DX - - // (A,t[0]) := t[0] + x[0]*y[5] + A - MULXQ R14, AX, BP - ADOXQ AX, R8 - - // (A,t[1]) := t[1] + x[1]*y[5] + A - ADCXQ BP, R9 - MULXQ R15, AX, BP - ADOXQ AX, R9 - - // (A,t[2]) := t[2] + x[2]*y[5] + A - ADCXQ BP, R10 - MULXQ CX, AX, BP - ADOXQ AX, R10 - - // (A,t[3]) := t[3] + x[3]*y[5] + A - ADCXQ BP, R11 - MULXQ BX, AX, BP - ADOXQ AX, R11 - - // (A,t[4]) := t[4] + x[4]*y[5] + A - ADCXQ BP, R12 - MULXQ SI, AX, BP - ADOXQ AX, R12 - - // (A,t[5]) := t[5] + x[5]*y[5] + A - ADCXQ BP, R13 - MULXQ DI, AX, BP - ADOXQ AX, R13 - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - PUSHQ BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R8, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R8, AX - MOVQ BP, R8 - POPQ BP - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R9, R8 - MULXQ q<>+8(SB), AX, R9 - ADOXQ AX, R8 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ R10, R9 - MULXQ q<>+16(SB), AX, R10 - ADOXQ AX, R9 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ R11, R10 - MULXQ q<>+24(SB), AX, R11 - ADOXQ AX, R10 - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ R12, R11 - MULXQ q<>+32(SB), AX, R12 - ADOXQ AX, R11 - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ R13, R12 - MULXQ q<>+40(SB), AX, R13 - ADOXQ AX, R12 - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, R13 - ADOXQ BP, R13 - - // reduce element(R8,R9,R10,R11,R12,R13) using temp registers (R14,R15,CX,BX,SI,DI) - REDUCE(R8,R9,R10,R11,R12,R13,R14,R15,CX,BX,SI,DI) - - MOVQ x+8(FP), AX - - // x.A1[0] -> R14 - // x.A1[1] -> R15 + // x.A1[0] -> R13 + // x.A1[1] -> R14 // x.A1[2] -> CX // x.A1[3] -> BX // x.A1[4] -> SI // x.A1[5] -> DI - MOVQ 48(AX), R14 - MOVQ 56(AX), R15 + MOVQ 48(AX), R13 + MOVQ 56(AX), R14 MOVQ 64(AX), CX MOVQ 72(AX), BX MOVQ 80(AX), SI @@ -935,60 +820,60 @@ TEXT ·squareAdxE2(SB), $48-16 MOVQ R10, 64(DX) MOVQ R11, 72(DX) MOVQ R12, 80(DX) - MOVQ R13, 88(DX) - MOVQ R14, R8 - MOVQ R15, R9 + MOVQ R15, 88(DX) + MOVQ R13, R8 + MOVQ R14, R9 MOVQ CX, R10 MOVQ BX, R11 MOVQ SI, R12 - MOVQ DI, R13 + MOVQ DI, R15 // Add(&x.A0, &x.A1) - ADDQ 0(AX), R14 - ADCQ 8(AX), R15 + ADDQ 0(AX), R13 + ADCQ 8(AX), R14 ADCQ 16(AX), CX ADCQ 24(AX), BX ADCQ 32(AX), SI ADCQ 40(AX), DI - MOVQ R14, s0-8(SP) - MOVQ R15, s1-16(SP) - MOVQ CX, s2-24(SP) - MOVQ BX, s3-32(SP) - MOVQ SI, s4-40(SP) - MOVQ DI, s5-48(SP) - XORQ BP, BP + MOVQ R13, s6-56(SP) + MOVQ R14, s7-64(SP) + MOVQ CX, s8-72(SP) + MOVQ BX, s9-80(SP) + MOVQ SI, s10-88(SP) + MOVQ DI, s11-96(SP) + XORQ DX, DX // Sub(&x.A0, &x.A1) - MOVQ 0(AX), R14 - MOVQ 8(AX), R15 + MOVQ 0(AX), R13 + MOVQ 8(AX), R14 MOVQ 16(AX), CX MOVQ 24(AX), BX MOVQ 32(AX), SI MOVQ 40(AX), DI - SUBQ R8, R14 - SBBQ R9, R15 + SUBQ R8, R13 + SBBQ R9, R14 SBBQ R10, CX SBBQ R11, BX SBBQ R12, SI - SBBQ R13, DI + SBBQ R15, DI MOVQ $0xb9feffffffffaaab, R8 MOVQ $0x1eabfffeb153ffff, R9 MOVQ $0x6730d2a0f6b0f624, R10 MOVQ $0x64774b84f38512bf, R11 MOVQ $0x4b1ba7b6434bacd7, R12 - MOVQ $0x1a0111ea397fe69a, R13 - CMOVQCC BP, R8 - CMOVQCC BP, R9 - CMOVQCC BP, R10 - CMOVQCC BP, R11 - CMOVQCC BP, R12 - CMOVQCC BP, R13 - ADDQ R8, R14 - ADCQ R9, R15 + MOVQ $0x1a0111ea397fe69a, R15 + CMOVQCC DX, R8 + CMOVQCC DX, R9 + CMOVQCC DX, R10 + CMOVQCC DX, R11 + CMOVQCC DX, R12 + CMOVQCC DX, R15 + ADDQ R8, R13 + ADCQ R9, R14 ADCQ R10, CX ADCQ R11, BX ADCQ R12, SI - ADCQ R13, DI + ADCQ R15, DI // A -> BP // t[0] -> R8 @@ -996,494 +881,23 @@ TEXT ·squareAdxE2(SB), $48-16 // t[2] -> R10 // t[3] -> R11 // t[4] -> R12 - // t[5] -> R13 - // clear the flags - XORQ AX, AX - MOVQ s0-8(SP), DX - - // (A,t[0]) := x[0]*y[0] + A - MULXQ R14, R8, R9 - - // (A,t[1]) := x[1]*y[0] + A - MULXQ R15, AX, R10 - ADOXQ AX, R9 - - // (A,t[2]) := x[2]*y[0] + A - MULXQ CX, AX, R11 - ADOXQ AX, R10 - - // (A,t[3]) := x[3]*y[0] + A - MULXQ BX, AX, R12 - ADOXQ AX, R11 - - // (A,t[4]) := x[4]*y[0] + A - MULXQ SI, AX, R13 - ADOXQ AX, R12 - - // (A,t[5]) := x[5]*y[0] + A - MULXQ DI, AX, BP - ADOXQ AX, R13 - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADOXQ AX, BP - PUSHQ BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R8, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R8, AX - MOVQ BP, R8 - POPQ BP - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R9, R8 - MULXQ q<>+8(SB), AX, R9 - ADOXQ AX, R8 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ R10, R9 - MULXQ q<>+16(SB), AX, R10 - ADOXQ AX, R9 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ R11, R10 - MULXQ q<>+24(SB), AX, R11 - ADOXQ AX, R10 - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ R12, R11 - MULXQ q<>+32(SB), AX, R12 - ADOXQ AX, R11 - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ R13, R12 - MULXQ q<>+40(SB), AX, R13 - ADOXQ AX, R12 - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, R13 - ADOXQ BP, R13 - - // clear the flags - XORQ AX, AX - MOVQ s1-16(SP), DX - - // (A,t[0]) := t[0] + x[0]*y[1] + A - MULXQ R14, AX, BP - ADOXQ AX, R8 - - // (A,t[1]) := t[1] + x[1]*y[1] + A - ADCXQ BP, R9 - MULXQ R15, AX, BP - ADOXQ AX, R9 - - // (A,t[2]) := t[2] + x[2]*y[1] + A - ADCXQ BP, R10 - MULXQ CX, AX, BP - ADOXQ AX, R10 - - // (A,t[3]) := t[3] + x[3]*y[1] + A - ADCXQ BP, R11 - MULXQ BX, AX, BP - ADOXQ AX, R11 - - // (A,t[4]) := t[4] + x[4]*y[1] + A - ADCXQ BP, R12 - MULXQ SI, AX, BP - ADOXQ AX, R12 - - // (A,t[5]) := t[5] + x[5]*y[1] + A - ADCXQ BP, R13 - MULXQ DI, AX, BP - ADOXQ AX, R13 - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - PUSHQ BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R8, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R8, AX - MOVQ BP, R8 - POPQ BP - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R9, R8 - MULXQ q<>+8(SB), AX, R9 - ADOXQ AX, R8 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ R10, R9 - MULXQ q<>+16(SB), AX, R10 - ADOXQ AX, R9 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ R11, R10 - MULXQ q<>+24(SB), AX, R11 - ADOXQ AX, R10 - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ R12, R11 - MULXQ q<>+32(SB), AX, R12 - ADOXQ AX, R11 - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ R13, R12 - MULXQ q<>+40(SB), AX, R13 - ADOXQ AX, R12 - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, R13 - ADOXQ BP, R13 - - // clear the flags - XORQ AX, AX - MOVQ s2-24(SP), DX - - // (A,t[0]) := t[0] + x[0]*y[2] + A - MULXQ R14, AX, BP - ADOXQ AX, R8 - - // (A,t[1]) := t[1] + x[1]*y[2] + A - ADCXQ BP, R9 - MULXQ R15, AX, BP - ADOXQ AX, R9 - - // (A,t[2]) := t[2] + x[2]*y[2] + A - ADCXQ BP, R10 - MULXQ CX, AX, BP - ADOXQ AX, R10 - - // (A,t[3]) := t[3] + x[3]*y[2] + A - ADCXQ BP, R11 - MULXQ BX, AX, BP - ADOXQ AX, R11 - - // (A,t[4]) := t[4] + x[4]*y[2] + A - ADCXQ BP, R12 - MULXQ SI, AX, BP - ADOXQ AX, R12 - - // (A,t[5]) := t[5] + x[5]*y[2] + A - ADCXQ BP, R13 - MULXQ DI, AX, BP - ADOXQ AX, R13 - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - PUSHQ BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R8, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R8, AX - MOVQ BP, R8 - POPQ BP - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R9, R8 - MULXQ q<>+8(SB), AX, R9 - ADOXQ AX, R8 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ R10, R9 - MULXQ q<>+16(SB), AX, R10 - ADOXQ AX, R9 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ R11, R10 - MULXQ q<>+24(SB), AX, R11 - ADOXQ AX, R10 - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ R12, R11 - MULXQ q<>+32(SB), AX, R12 - ADOXQ AX, R11 - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ R13, R12 - MULXQ q<>+40(SB), AX, R13 - ADOXQ AX, R12 - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, R13 - ADOXQ BP, R13 - - // clear the flags - XORQ AX, AX - MOVQ s3-32(SP), DX - - // (A,t[0]) := t[0] + x[0]*y[3] + A - MULXQ R14, AX, BP - ADOXQ AX, R8 - - // (A,t[1]) := t[1] + x[1]*y[3] + A - ADCXQ BP, R9 - MULXQ R15, AX, BP - ADOXQ AX, R9 - - // (A,t[2]) := t[2] + x[2]*y[3] + A - ADCXQ BP, R10 - MULXQ CX, AX, BP - ADOXQ AX, R10 - - // (A,t[3]) := t[3] + x[3]*y[3] + A - ADCXQ BP, R11 - MULXQ BX, AX, BP - ADOXQ AX, R11 - - // (A,t[4]) := t[4] + x[4]*y[3] + A - ADCXQ BP, R12 - MULXQ SI, AX, BP - ADOXQ AX, R12 - - // (A,t[5]) := t[5] + x[5]*y[3] + A - ADCXQ BP, R13 - MULXQ DI, AX, BP - ADOXQ AX, R13 - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - PUSHQ BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R8, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R8, AX - MOVQ BP, R8 - POPQ BP - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R9, R8 - MULXQ q<>+8(SB), AX, R9 - ADOXQ AX, R8 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ R10, R9 - MULXQ q<>+16(SB), AX, R10 - ADOXQ AX, R9 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ R11, R10 - MULXQ q<>+24(SB), AX, R11 - ADOXQ AX, R10 - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ R12, R11 - MULXQ q<>+32(SB), AX, R12 - ADOXQ AX, R11 - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ R13, R12 - MULXQ q<>+40(SB), AX, R13 - ADOXQ AX, R12 - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, R13 - ADOXQ BP, R13 - - // clear the flags - XORQ AX, AX - MOVQ s4-40(SP), DX - - // (A,t[0]) := t[0] + x[0]*y[4] + A - MULXQ R14, AX, BP - ADOXQ AX, R8 - - // (A,t[1]) := t[1] + x[1]*y[4] + A - ADCXQ BP, R9 - MULXQ R15, AX, BP - ADOXQ AX, R9 - - // (A,t[2]) := t[2] + x[2]*y[4] + A - ADCXQ BP, R10 - MULXQ CX, AX, BP - ADOXQ AX, R10 - - // (A,t[3]) := t[3] + x[3]*y[4] + A - ADCXQ BP, R11 - MULXQ BX, AX, BP - ADOXQ AX, R11 - - // (A,t[4]) := t[4] + x[4]*y[4] + A - ADCXQ BP, R12 - MULXQ SI, AX, BP - ADOXQ AX, R12 - - // (A,t[5]) := t[5] + x[5]*y[4] + A - ADCXQ BP, R13 - MULXQ DI, AX, BP - ADOXQ AX, R13 - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - PUSHQ BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R8, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R8, AX - MOVQ BP, R8 - POPQ BP - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R9, R8 - MULXQ q<>+8(SB), AX, R9 - ADOXQ AX, R8 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ R10, R9 - MULXQ q<>+16(SB), AX, R10 - ADOXQ AX, R9 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ R11, R10 - MULXQ q<>+24(SB), AX, R11 - ADOXQ AX, R10 - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ R12, R11 - MULXQ q<>+32(SB), AX, R12 - ADOXQ AX, R11 - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ R13, R12 - MULXQ q<>+40(SB), AX, R13 - ADOXQ AX, R12 - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, R13 - ADOXQ BP, R13 - - // clear the flags - XORQ AX, AX - MOVQ s5-48(SP), DX - - // (A,t[0]) := t[0] + x[0]*y[5] + A - MULXQ R14, AX, BP - ADOXQ AX, R8 - - // (A,t[1]) := t[1] + x[1]*y[5] + A - ADCXQ BP, R9 - MULXQ R15, AX, BP - ADOXQ AX, R9 - - // (A,t[2]) := t[2] + x[2]*y[5] + A - ADCXQ BP, R10 - MULXQ CX, AX, BP - ADOXQ AX, R10 - - // (A,t[3]) := t[3] + x[3]*y[5] + A - ADCXQ BP, R11 - MULXQ BX, AX, BP - ADOXQ AX, R11 - - // (A,t[4]) := t[4] + x[4]*y[5] + A - ADCXQ BP, R12 - MULXQ SI, AX, BP - ADOXQ AX, R12 - - // (A,t[5]) := t[5] + x[5]*y[5] + A - ADCXQ BP, R13 - MULXQ DI, AX, BP - ADOXQ AX, R13 - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - PUSHQ BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R8, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R8, AX - MOVQ BP, R8 - POPQ BP - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R9, R8 - MULXQ q<>+8(SB), AX, R9 - ADOXQ AX, R8 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ R10, R9 - MULXQ q<>+16(SB), AX, R10 - ADOXQ AX, R9 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ R11, R10 - MULXQ q<>+24(SB), AX, R11 - ADOXQ AX, R10 - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ R12, R11 - MULXQ q<>+32(SB), AX, R12 - ADOXQ AX, R11 - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ R13, R12 - MULXQ q<>+40(SB), AX, R13 - ADOXQ AX, R12 - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, R13 - ADOXQ BP, R13 - - // reduce element(R8,R9,R10,R11,R12,R13) using temp registers (R14,R15,CX,BX,SI,DI) - REDUCE(R8,R9,R10,R11,R12,R13,R14,R15,CX,BX,SI,DI) + // t[5] -> R15 + // mul body + MOVQ s6-56(SP), DX + MUL_WORD_0() + MOVQ s7-64(SP), DX + MUL_WORD_N() + MOVQ s8-72(SP), DX + MUL_WORD_N() + MOVQ s9-80(SP), DX + MUL_WORD_N() + MOVQ s10-88(SP), DX + MUL_WORD_N() + MOVQ s11-96(SP), DX + MUL_WORD_N() + + // reduce element(R8,R9,R10,R11,R12,R15) using temp registers (R13,R14,CX,BX,SI,DI) + REDUCE(R8,R9,R10,R11,R12,R15,R13,R14,CX,BX,SI,DI,s0-8(SP),s1-16(SP),s2-24(SP),s3-32(SP),s4-40(SP),s5-48(SP)) MOVQ res+0(FP), AX MOVQ R8, 0(AX) @@ -1491,1701 +905,13 @@ TEXT ·squareAdxE2(SB), $48-16 MOVQ R10, 16(AX) MOVQ R11, 24(AX) MOVQ R12, 32(AX) - MOVQ R13, 40(AX) + MOVQ R15, 40(AX) RET -l4: +l5: MOVQ res+0(FP), AX MOVQ AX, (SP) MOVQ x+8(FP), AX MOVQ AX, 8(SP) CALL ·squareGenericE2(SB) RET - -TEXT ·mulAdxE2(SB), $96-24 - NO_LOCAL_POINTERS - - // var a, b, c fp.Element - // a.Add(&x.A0, &x.A1) - // b.Add(&y.A0, &y.A1) - // a.Mul(&a, &b) - // b.Mul(&x.A0, &y.A0) - // c.Mul(&x.A1, &y.A1) - // z.A1.Sub(&a, &b).Sub(&z.A1, &c) - // z.A0.Sub(&b, &c) - - CMPB ·supportAdx(SB), $1 - JNE l5 - MOVQ x+8(FP), AX - MOVQ 48(AX), R14 - MOVQ 56(AX), R15 - MOVQ 64(AX), CX - MOVQ 72(AX), BX - MOVQ 80(AX), SI - MOVQ 88(AX), DI - - // A -> BP - // t[0] -> R8 - // t[1] -> R9 - // t[2] -> R10 - // t[3] -> R11 - // t[4] -> R12 - // t[5] -> R13 - // clear the flags - XORQ AX, AX - MOVQ y+16(FP), DX - MOVQ 48(DX), DX - - // (A,t[0]) := x[0]*y[0] + A - MULXQ R14, R8, R9 - - // (A,t[1]) := x[1]*y[0] + A - MULXQ R15, AX, R10 - ADOXQ AX, R9 - - // (A,t[2]) := x[2]*y[0] + A - MULXQ CX, AX, R11 - ADOXQ AX, R10 - - // (A,t[3]) := x[3]*y[0] + A - MULXQ BX, AX, R12 - ADOXQ AX, R11 - - // (A,t[4]) := x[4]*y[0] + A - MULXQ SI, AX, R13 - ADOXQ AX, R12 - - // (A,t[5]) := x[5]*y[0] + A - MULXQ DI, AX, BP - ADOXQ AX, R13 - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADOXQ AX, BP - PUSHQ BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R8, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R8, AX - MOVQ BP, R8 - POPQ BP - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R9, R8 - MULXQ q<>+8(SB), AX, R9 - ADOXQ AX, R8 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ R10, R9 - MULXQ q<>+16(SB), AX, R10 - ADOXQ AX, R9 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ R11, R10 - MULXQ q<>+24(SB), AX, R11 - ADOXQ AX, R10 - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ R12, R11 - MULXQ q<>+32(SB), AX, R12 - ADOXQ AX, R11 - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ R13, R12 - MULXQ q<>+40(SB), AX, R13 - ADOXQ AX, R12 - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, R13 - ADOXQ BP, R13 - - // clear the flags - XORQ AX, AX - MOVQ y+16(FP), DX - MOVQ 56(DX), DX - - // (A,t[0]) := t[0] + x[0]*y[1] + A - MULXQ R14, AX, BP - ADOXQ AX, R8 - - // (A,t[1]) := t[1] + x[1]*y[1] + A - ADCXQ BP, R9 - MULXQ R15, AX, BP - ADOXQ AX, R9 - - // (A,t[2]) := t[2] + x[2]*y[1] + A - ADCXQ BP, R10 - MULXQ CX, AX, BP - ADOXQ AX, R10 - - // (A,t[3]) := t[3] + x[3]*y[1] + A - ADCXQ BP, R11 - MULXQ BX, AX, BP - ADOXQ AX, R11 - - // (A,t[4]) := t[4] + x[4]*y[1] + A - ADCXQ BP, R12 - MULXQ SI, AX, BP - ADOXQ AX, R12 - - // (A,t[5]) := t[5] + x[5]*y[1] + A - ADCXQ BP, R13 - MULXQ DI, AX, BP - ADOXQ AX, R13 - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - PUSHQ BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R8, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R8, AX - MOVQ BP, R8 - POPQ BP - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R9, R8 - MULXQ q<>+8(SB), AX, R9 - ADOXQ AX, R8 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ R10, R9 - MULXQ q<>+16(SB), AX, R10 - ADOXQ AX, R9 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ R11, R10 - MULXQ q<>+24(SB), AX, R11 - ADOXQ AX, R10 - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ R12, R11 - MULXQ q<>+32(SB), AX, R12 - ADOXQ AX, R11 - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ R13, R12 - MULXQ q<>+40(SB), AX, R13 - ADOXQ AX, R12 - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, R13 - ADOXQ BP, R13 - - // clear the flags - XORQ AX, AX - MOVQ y+16(FP), DX - MOVQ 64(DX), DX - - // (A,t[0]) := t[0] + x[0]*y[2] + A - MULXQ R14, AX, BP - ADOXQ AX, R8 - - // (A,t[1]) := t[1] + x[1]*y[2] + A - ADCXQ BP, R9 - MULXQ R15, AX, BP - ADOXQ AX, R9 - - // (A,t[2]) := t[2] + x[2]*y[2] + A - ADCXQ BP, R10 - MULXQ CX, AX, BP - ADOXQ AX, R10 - - // (A,t[3]) := t[3] + x[3]*y[2] + A - ADCXQ BP, R11 - MULXQ BX, AX, BP - ADOXQ AX, R11 - - // (A,t[4]) := t[4] + x[4]*y[2] + A - ADCXQ BP, R12 - MULXQ SI, AX, BP - ADOXQ AX, R12 - - // (A,t[5]) := t[5] + x[5]*y[2] + A - ADCXQ BP, R13 - MULXQ DI, AX, BP - ADOXQ AX, R13 - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - PUSHQ BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R8, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R8, AX - MOVQ BP, R8 - POPQ BP - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R9, R8 - MULXQ q<>+8(SB), AX, R9 - ADOXQ AX, R8 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ R10, R9 - MULXQ q<>+16(SB), AX, R10 - ADOXQ AX, R9 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ R11, R10 - MULXQ q<>+24(SB), AX, R11 - ADOXQ AX, R10 - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ R12, R11 - MULXQ q<>+32(SB), AX, R12 - ADOXQ AX, R11 - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ R13, R12 - MULXQ q<>+40(SB), AX, R13 - ADOXQ AX, R12 - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, R13 - ADOXQ BP, R13 - - // clear the flags - XORQ AX, AX - MOVQ y+16(FP), DX - MOVQ 72(DX), DX - - // (A,t[0]) := t[0] + x[0]*y[3] + A - MULXQ R14, AX, BP - ADOXQ AX, R8 - - // (A,t[1]) := t[1] + x[1]*y[3] + A - ADCXQ BP, R9 - MULXQ R15, AX, BP - ADOXQ AX, R9 - - // (A,t[2]) := t[2] + x[2]*y[3] + A - ADCXQ BP, R10 - MULXQ CX, AX, BP - ADOXQ AX, R10 - - // (A,t[3]) := t[3] + x[3]*y[3] + A - ADCXQ BP, R11 - MULXQ BX, AX, BP - ADOXQ AX, R11 - - // (A,t[4]) := t[4] + x[4]*y[3] + A - ADCXQ BP, R12 - MULXQ SI, AX, BP - ADOXQ AX, R12 - - // (A,t[5]) := t[5] + x[5]*y[3] + A - ADCXQ BP, R13 - MULXQ DI, AX, BP - ADOXQ AX, R13 - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - PUSHQ BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R8, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R8, AX - MOVQ BP, R8 - POPQ BP - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R9, R8 - MULXQ q<>+8(SB), AX, R9 - ADOXQ AX, R8 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ R10, R9 - MULXQ q<>+16(SB), AX, R10 - ADOXQ AX, R9 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ R11, R10 - MULXQ q<>+24(SB), AX, R11 - ADOXQ AX, R10 - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ R12, R11 - MULXQ q<>+32(SB), AX, R12 - ADOXQ AX, R11 - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ R13, R12 - MULXQ q<>+40(SB), AX, R13 - ADOXQ AX, R12 - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, R13 - ADOXQ BP, R13 - - // clear the flags - XORQ AX, AX - MOVQ y+16(FP), DX - MOVQ 80(DX), DX - - // (A,t[0]) := t[0] + x[0]*y[4] + A - MULXQ R14, AX, BP - ADOXQ AX, R8 - - // (A,t[1]) := t[1] + x[1]*y[4] + A - ADCXQ BP, R9 - MULXQ R15, AX, BP - ADOXQ AX, R9 - - // (A,t[2]) := t[2] + x[2]*y[4] + A - ADCXQ BP, R10 - MULXQ CX, AX, BP - ADOXQ AX, R10 - - // (A,t[3]) := t[3] + x[3]*y[4] + A - ADCXQ BP, R11 - MULXQ BX, AX, BP - ADOXQ AX, R11 - - // (A,t[4]) := t[4] + x[4]*y[4] + A - ADCXQ BP, R12 - MULXQ SI, AX, BP - ADOXQ AX, R12 - - // (A,t[5]) := t[5] + x[5]*y[4] + A - ADCXQ BP, R13 - MULXQ DI, AX, BP - ADOXQ AX, R13 - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - PUSHQ BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R8, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R8, AX - MOVQ BP, R8 - POPQ BP - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R9, R8 - MULXQ q<>+8(SB), AX, R9 - ADOXQ AX, R8 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ R10, R9 - MULXQ q<>+16(SB), AX, R10 - ADOXQ AX, R9 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ R11, R10 - MULXQ q<>+24(SB), AX, R11 - ADOXQ AX, R10 - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ R12, R11 - MULXQ q<>+32(SB), AX, R12 - ADOXQ AX, R11 - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ R13, R12 - MULXQ q<>+40(SB), AX, R13 - ADOXQ AX, R12 - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, R13 - ADOXQ BP, R13 - - // clear the flags - XORQ AX, AX - MOVQ y+16(FP), DX - MOVQ 88(DX), DX - - // (A,t[0]) := t[0] + x[0]*y[5] + A - MULXQ R14, AX, BP - ADOXQ AX, R8 - - // (A,t[1]) := t[1] + x[1]*y[5] + A - ADCXQ BP, R9 - MULXQ R15, AX, BP - ADOXQ AX, R9 - - // (A,t[2]) := t[2] + x[2]*y[5] + A - ADCXQ BP, R10 - MULXQ CX, AX, BP - ADOXQ AX, R10 - - // (A,t[3]) := t[3] + x[3]*y[5] + A - ADCXQ BP, R11 - MULXQ BX, AX, BP - ADOXQ AX, R11 - - // (A,t[4]) := t[4] + x[4]*y[5] + A - ADCXQ BP, R12 - MULXQ SI, AX, BP - ADOXQ AX, R12 - - // (A,t[5]) := t[5] + x[5]*y[5] + A - ADCXQ BP, R13 - MULXQ DI, AX, BP - ADOXQ AX, R13 - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - PUSHQ BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R8, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R8, AX - MOVQ BP, R8 - POPQ BP - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R9, R8 - MULXQ q<>+8(SB), AX, R9 - ADOXQ AX, R8 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ R10, R9 - MULXQ q<>+16(SB), AX, R10 - ADOXQ AX, R9 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ R11, R10 - MULXQ q<>+24(SB), AX, R11 - ADOXQ AX, R10 - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ R12, R11 - MULXQ q<>+32(SB), AX, R12 - ADOXQ AX, R11 - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ R13, R12 - MULXQ q<>+40(SB), AX, R13 - ADOXQ AX, R12 - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, R13 - ADOXQ BP, R13 - - // reduce element(R8,R9,R10,R11,R12,R13) using temp registers (R14,R15,CX,BX,SI,DI) - REDUCE(R8,R9,R10,R11,R12,R13,R14,R15,CX,BX,SI,DI) - - MOVQ R8, s6-56(SP) - MOVQ R9, s7-64(SP) - MOVQ R10, s8-72(SP) - MOVQ R11, s9-80(SP) - MOVQ R12, s10-88(SP) - MOVQ R13, s11-96(SP) - MOVQ x+8(FP), AX - MOVQ y+16(FP), DX - MOVQ 48(AX), R14 - MOVQ 56(AX), R15 - MOVQ 64(AX), CX - MOVQ 72(AX), BX - MOVQ 80(AX), SI - MOVQ 88(AX), DI - ADDQ 0(AX), R14 - ADCQ 8(AX), R15 - ADCQ 16(AX), CX - ADCQ 24(AX), BX - ADCQ 32(AX), SI - ADCQ 40(AX), DI - MOVQ R14, s0-8(SP) - MOVQ R15, s1-16(SP) - MOVQ CX, s2-24(SP) - MOVQ BX, s3-32(SP) - MOVQ SI, s4-40(SP) - MOVQ DI, s5-48(SP) - MOVQ 0(DX), R14 - MOVQ 8(DX), R15 - MOVQ 16(DX), CX - MOVQ 24(DX), BX - MOVQ 32(DX), SI - MOVQ 40(DX), DI - ADDQ 48(DX), R14 - ADCQ 56(DX), R15 - ADCQ 64(DX), CX - ADCQ 72(DX), BX - ADCQ 80(DX), SI - ADCQ 88(DX), DI - - // A -> BP - // t[0] -> R8 - // t[1] -> R9 - // t[2] -> R10 - // t[3] -> R11 - // t[4] -> R12 - // t[5] -> R13 - // clear the flags - XORQ AX, AX - MOVQ s0-8(SP), DX - - // (A,t[0]) := x[0]*y[0] + A - MULXQ R14, R8, R9 - - // (A,t[1]) := x[1]*y[0] + A - MULXQ R15, AX, R10 - ADOXQ AX, R9 - - // (A,t[2]) := x[2]*y[0] + A - MULXQ CX, AX, R11 - ADOXQ AX, R10 - - // (A,t[3]) := x[3]*y[0] + A - MULXQ BX, AX, R12 - ADOXQ AX, R11 - - // (A,t[4]) := x[4]*y[0] + A - MULXQ SI, AX, R13 - ADOXQ AX, R12 - - // (A,t[5]) := x[5]*y[0] + A - MULXQ DI, AX, BP - ADOXQ AX, R13 - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADOXQ AX, BP - PUSHQ BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R8, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R8, AX - MOVQ BP, R8 - POPQ BP - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R9, R8 - MULXQ q<>+8(SB), AX, R9 - ADOXQ AX, R8 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ R10, R9 - MULXQ q<>+16(SB), AX, R10 - ADOXQ AX, R9 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ R11, R10 - MULXQ q<>+24(SB), AX, R11 - ADOXQ AX, R10 - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ R12, R11 - MULXQ q<>+32(SB), AX, R12 - ADOXQ AX, R11 - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ R13, R12 - MULXQ q<>+40(SB), AX, R13 - ADOXQ AX, R12 - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, R13 - ADOXQ BP, R13 - - // clear the flags - XORQ AX, AX - MOVQ s1-16(SP), DX - - // (A,t[0]) := t[0] + x[0]*y[1] + A - MULXQ R14, AX, BP - ADOXQ AX, R8 - - // (A,t[1]) := t[1] + x[1]*y[1] + A - ADCXQ BP, R9 - MULXQ R15, AX, BP - ADOXQ AX, R9 - - // (A,t[2]) := t[2] + x[2]*y[1] + A - ADCXQ BP, R10 - MULXQ CX, AX, BP - ADOXQ AX, R10 - - // (A,t[3]) := t[3] + x[3]*y[1] + A - ADCXQ BP, R11 - MULXQ BX, AX, BP - ADOXQ AX, R11 - - // (A,t[4]) := t[4] + x[4]*y[1] + A - ADCXQ BP, R12 - MULXQ SI, AX, BP - ADOXQ AX, R12 - - // (A,t[5]) := t[5] + x[5]*y[1] + A - ADCXQ BP, R13 - MULXQ DI, AX, BP - ADOXQ AX, R13 - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - PUSHQ BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R8, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R8, AX - MOVQ BP, R8 - POPQ BP - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R9, R8 - MULXQ q<>+8(SB), AX, R9 - ADOXQ AX, R8 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ R10, R9 - MULXQ q<>+16(SB), AX, R10 - ADOXQ AX, R9 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ R11, R10 - MULXQ q<>+24(SB), AX, R11 - ADOXQ AX, R10 - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ R12, R11 - MULXQ q<>+32(SB), AX, R12 - ADOXQ AX, R11 - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ R13, R12 - MULXQ q<>+40(SB), AX, R13 - ADOXQ AX, R12 - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, R13 - ADOXQ BP, R13 - - // clear the flags - XORQ AX, AX - MOVQ s2-24(SP), DX - - // (A,t[0]) := t[0] + x[0]*y[2] + A - MULXQ R14, AX, BP - ADOXQ AX, R8 - - // (A,t[1]) := t[1] + x[1]*y[2] + A - ADCXQ BP, R9 - MULXQ R15, AX, BP - ADOXQ AX, R9 - - // (A,t[2]) := t[2] + x[2]*y[2] + A - ADCXQ BP, R10 - MULXQ CX, AX, BP - ADOXQ AX, R10 - - // (A,t[3]) := t[3] + x[3]*y[2] + A - ADCXQ BP, R11 - MULXQ BX, AX, BP - ADOXQ AX, R11 - - // (A,t[4]) := t[4] + x[4]*y[2] + A - ADCXQ BP, R12 - MULXQ SI, AX, BP - ADOXQ AX, R12 - - // (A,t[5]) := t[5] + x[5]*y[2] + A - ADCXQ BP, R13 - MULXQ DI, AX, BP - ADOXQ AX, R13 - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - PUSHQ BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R8, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R8, AX - MOVQ BP, R8 - POPQ BP - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R9, R8 - MULXQ q<>+8(SB), AX, R9 - ADOXQ AX, R8 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ R10, R9 - MULXQ q<>+16(SB), AX, R10 - ADOXQ AX, R9 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ R11, R10 - MULXQ q<>+24(SB), AX, R11 - ADOXQ AX, R10 - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ R12, R11 - MULXQ q<>+32(SB), AX, R12 - ADOXQ AX, R11 - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ R13, R12 - MULXQ q<>+40(SB), AX, R13 - ADOXQ AX, R12 - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, R13 - ADOXQ BP, R13 - - // clear the flags - XORQ AX, AX - MOVQ s3-32(SP), DX - - // (A,t[0]) := t[0] + x[0]*y[3] + A - MULXQ R14, AX, BP - ADOXQ AX, R8 - - // (A,t[1]) := t[1] + x[1]*y[3] + A - ADCXQ BP, R9 - MULXQ R15, AX, BP - ADOXQ AX, R9 - - // (A,t[2]) := t[2] + x[2]*y[3] + A - ADCXQ BP, R10 - MULXQ CX, AX, BP - ADOXQ AX, R10 - - // (A,t[3]) := t[3] + x[3]*y[3] + A - ADCXQ BP, R11 - MULXQ BX, AX, BP - ADOXQ AX, R11 - - // (A,t[4]) := t[4] + x[4]*y[3] + A - ADCXQ BP, R12 - MULXQ SI, AX, BP - ADOXQ AX, R12 - - // (A,t[5]) := t[5] + x[5]*y[3] + A - ADCXQ BP, R13 - MULXQ DI, AX, BP - ADOXQ AX, R13 - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - PUSHQ BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R8, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R8, AX - MOVQ BP, R8 - POPQ BP - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R9, R8 - MULXQ q<>+8(SB), AX, R9 - ADOXQ AX, R8 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ R10, R9 - MULXQ q<>+16(SB), AX, R10 - ADOXQ AX, R9 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ R11, R10 - MULXQ q<>+24(SB), AX, R11 - ADOXQ AX, R10 - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ R12, R11 - MULXQ q<>+32(SB), AX, R12 - ADOXQ AX, R11 - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ R13, R12 - MULXQ q<>+40(SB), AX, R13 - ADOXQ AX, R12 - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, R13 - ADOXQ BP, R13 - - // clear the flags - XORQ AX, AX - MOVQ s4-40(SP), DX - - // (A,t[0]) := t[0] + x[0]*y[4] + A - MULXQ R14, AX, BP - ADOXQ AX, R8 - - // (A,t[1]) := t[1] + x[1]*y[4] + A - ADCXQ BP, R9 - MULXQ R15, AX, BP - ADOXQ AX, R9 - - // (A,t[2]) := t[2] + x[2]*y[4] + A - ADCXQ BP, R10 - MULXQ CX, AX, BP - ADOXQ AX, R10 - - // (A,t[3]) := t[3] + x[3]*y[4] + A - ADCXQ BP, R11 - MULXQ BX, AX, BP - ADOXQ AX, R11 - - // (A,t[4]) := t[4] + x[4]*y[4] + A - ADCXQ BP, R12 - MULXQ SI, AX, BP - ADOXQ AX, R12 - - // (A,t[5]) := t[5] + x[5]*y[4] + A - ADCXQ BP, R13 - MULXQ DI, AX, BP - ADOXQ AX, R13 - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - PUSHQ BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R8, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R8, AX - MOVQ BP, R8 - POPQ BP - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R9, R8 - MULXQ q<>+8(SB), AX, R9 - ADOXQ AX, R8 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ R10, R9 - MULXQ q<>+16(SB), AX, R10 - ADOXQ AX, R9 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ R11, R10 - MULXQ q<>+24(SB), AX, R11 - ADOXQ AX, R10 - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ R12, R11 - MULXQ q<>+32(SB), AX, R12 - ADOXQ AX, R11 - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ R13, R12 - MULXQ q<>+40(SB), AX, R13 - ADOXQ AX, R12 - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, R13 - ADOXQ BP, R13 - - // clear the flags - XORQ AX, AX - MOVQ s5-48(SP), DX - - // (A,t[0]) := t[0] + x[0]*y[5] + A - MULXQ R14, AX, BP - ADOXQ AX, R8 - - // (A,t[1]) := t[1] + x[1]*y[5] + A - ADCXQ BP, R9 - MULXQ R15, AX, BP - ADOXQ AX, R9 - - // (A,t[2]) := t[2] + x[2]*y[5] + A - ADCXQ BP, R10 - MULXQ CX, AX, BP - ADOXQ AX, R10 - - // (A,t[3]) := t[3] + x[3]*y[5] + A - ADCXQ BP, R11 - MULXQ BX, AX, BP - ADOXQ AX, R11 - - // (A,t[4]) := t[4] + x[4]*y[5] + A - ADCXQ BP, R12 - MULXQ SI, AX, BP - ADOXQ AX, R12 - - // (A,t[5]) := t[5] + x[5]*y[5] + A - ADCXQ BP, R13 - MULXQ DI, AX, BP - ADOXQ AX, R13 - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - PUSHQ BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R8, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R8, AX - MOVQ BP, R8 - POPQ BP - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R9, R8 - MULXQ q<>+8(SB), AX, R9 - ADOXQ AX, R8 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ R10, R9 - MULXQ q<>+16(SB), AX, R10 - ADOXQ AX, R9 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ R11, R10 - MULXQ q<>+24(SB), AX, R11 - ADOXQ AX, R10 - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ R12, R11 - MULXQ q<>+32(SB), AX, R12 - ADOXQ AX, R11 - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ R13, R12 - MULXQ q<>+40(SB), AX, R13 - ADOXQ AX, R12 - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, R13 - ADOXQ BP, R13 - - // reduce element(R8,R9,R10,R11,R12,R13) using temp registers (R14,R15,CX,BX,SI,DI) - REDUCE(R8,R9,R10,R11,R12,R13,R14,R15,CX,BX,SI,DI) - - MOVQ R8, s0-8(SP) - MOVQ R9, s1-16(SP) - MOVQ R10, s2-24(SP) - MOVQ R11, s3-32(SP) - MOVQ R12, s4-40(SP) - MOVQ R13, s5-48(SP) - MOVQ x+8(FP), AX - MOVQ 0(AX), R14 - MOVQ 8(AX), R15 - MOVQ 16(AX), CX - MOVQ 24(AX), BX - MOVQ 32(AX), SI - MOVQ 40(AX), DI - - // A -> BP - // t[0] -> R8 - // t[1] -> R9 - // t[2] -> R10 - // t[3] -> R11 - // t[4] -> R12 - // t[5] -> R13 - // clear the flags - XORQ AX, AX - MOVQ y+16(FP), DX - MOVQ 0(DX), DX - - // (A,t[0]) := x[0]*y[0] + A - MULXQ R14, R8, R9 - - // (A,t[1]) := x[1]*y[0] + A - MULXQ R15, AX, R10 - ADOXQ AX, R9 - - // (A,t[2]) := x[2]*y[0] + A - MULXQ CX, AX, R11 - ADOXQ AX, R10 - - // (A,t[3]) := x[3]*y[0] + A - MULXQ BX, AX, R12 - ADOXQ AX, R11 - - // (A,t[4]) := x[4]*y[0] + A - MULXQ SI, AX, R13 - ADOXQ AX, R12 - - // (A,t[5]) := x[5]*y[0] + A - MULXQ DI, AX, BP - ADOXQ AX, R13 - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADOXQ AX, BP - PUSHQ BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R8, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R8, AX - MOVQ BP, R8 - POPQ BP - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R9, R8 - MULXQ q<>+8(SB), AX, R9 - ADOXQ AX, R8 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ R10, R9 - MULXQ q<>+16(SB), AX, R10 - ADOXQ AX, R9 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ R11, R10 - MULXQ q<>+24(SB), AX, R11 - ADOXQ AX, R10 - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ R12, R11 - MULXQ q<>+32(SB), AX, R12 - ADOXQ AX, R11 - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ R13, R12 - MULXQ q<>+40(SB), AX, R13 - ADOXQ AX, R12 - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, R13 - ADOXQ BP, R13 - - // clear the flags - XORQ AX, AX - MOVQ y+16(FP), DX - MOVQ 8(DX), DX - - // (A,t[0]) := t[0] + x[0]*y[1] + A - MULXQ R14, AX, BP - ADOXQ AX, R8 - - // (A,t[1]) := t[1] + x[1]*y[1] + A - ADCXQ BP, R9 - MULXQ R15, AX, BP - ADOXQ AX, R9 - - // (A,t[2]) := t[2] + x[2]*y[1] + A - ADCXQ BP, R10 - MULXQ CX, AX, BP - ADOXQ AX, R10 - - // (A,t[3]) := t[3] + x[3]*y[1] + A - ADCXQ BP, R11 - MULXQ BX, AX, BP - ADOXQ AX, R11 - - // (A,t[4]) := t[4] + x[4]*y[1] + A - ADCXQ BP, R12 - MULXQ SI, AX, BP - ADOXQ AX, R12 - - // (A,t[5]) := t[5] + x[5]*y[1] + A - ADCXQ BP, R13 - MULXQ DI, AX, BP - ADOXQ AX, R13 - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - PUSHQ BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R8, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R8, AX - MOVQ BP, R8 - POPQ BP - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R9, R8 - MULXQ q<>+8(SB), AX, R9 - ADOXQ AX, R8 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ R10, R9 - MULXQ q<>+16(SB), AX, R10 - ADOXQ AX, R9 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ R11, R10 - MULXQ q<>+24(SB), AX, R11 - ADOXQ AX, R10 - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ R12, R11 - MULXQ q<>+32(SB), AX, R12 - ADOXQ AX, R11 - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ R13, R12 - MULXQ q<>+40(SB), AX, R13 - ADOXQ AX, R12 - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, R13 - ADOXQ BP, R13 - - // clear the flags - XORQ AX, AX - MOVQ y+16(FP), DX - MOVQ 16(DX), DX - - // (A,t[0]) := t[0] + x[0]*y[2] + A - MULXQ R14, AX, BP - ADOXQ AX, R8 - - // (A,t[1]) := t[1] + x[1]*y[2] + A - ADCXQ BP, R9 - MULXQ R15, AX, BP - ADOXQ AX, R9 - - // (A,t[2]) := t[2] + x[2]*y[2] + A - ADCXQ BP, R10 - MULXQ CX, AX, BP - ADOXQ AX, R10 - - // (A,t[3]) := t[3] + x[3]*y[2] + A - ADCXQ BP, R11 - MULXQ BX, AX, BP - ADOXQ AX, R11 - - // (A,t[4]) := t[4] + x[4]*y[2] + A - ADCXQ BP, R12 - MULXQ SI, AX, BP - ADOXQ AX, R12 - - // (A,t[5]) := t[5] + x[5]*y[2] + A - ADCXQ BP, R13 - MULXQ DI, AX, BP - ADOXQ AX, R13 - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - PUSHQ BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R8, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R8, AX - MOVQ BP, R8 - POPQ BP - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R9, R8 - MULXQ q<>+8(SB), AX, R9 - ADOXQ AX, R8 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ R10, R9 - MULXQ q<>+16(SB), AX, R10 - ADOXQ AX, R9 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ R11, R10 - MULXQ q<>+24(SB), AX, R11 - ADOXQ AX, R10 - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ R12, R11 - MULXQ q<>+32(SB), AX, R12 - ADOXQ AX, R11 - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ R13, R12 - MULXQ q<>+40(SB), AX, R13 - ADOXQ AX, R12 - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, R13 - ADOXQ BP, R13 - - // clear the flags - XORQ AX, AX - MOVQ y+16(FP), DX - MOVQ 24(DX), DX - - // (A,t[0]) := t[0] + x[0]*y[3] + A - MULXQ R14, AX, BP - ADOXQ AX, R8 - - // (A,t[1]) := t[1] + x[1]*y[3] + A - ADCXQ BP, R9 - MULXQ R15, AX, BP - ADOXQ AX, R9 - - // (A,t[2]) := t[2] + x[2]*y[3] + A - ADCXQ BP, R10 - MULXQ CX, AX, BP - ADOXQ AX, R10 - - // (A,t[3]) := t[3] + x[3]*y[3] + A - ADCXQ BP, R11 - MULXQ BX, AX, BP - ADOXQ AX, R11 - - // (A,t[4]) := t[4] + x[4]*y[3] + A - ADCXQ BP, R12 - MULXQ SI, AX, BP - ADOXQ AX, R12 - - // (A,t[5]) := t[5] + x[5]*y[3] + A - ADCXQ BP, R13 - MULXQ DI, AX, BP - ADOXQ AX, R13 - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - PUSHQ BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R8, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R8, AX - MOVQ BP, R8 - POPQ BP - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R9, R8 - MULXQ q<>+8(SB), AX, R9 - ADOXQ AX, R8 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ R10, R9 - MULXQ q<>+16(SB), AX, R10 - ADOXQ AX, R9 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ R11, R10 - MULXQ q<>+24(SB), AX, R11 - ADOXQ AX, R10 - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ R12, R11 - MULXQ q<>+32(SB), AX, R12 - ADOXQ AX, R11 - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ R13, R12 - MULXQ q<>+40(SB), AX, R13 - ADOXQ AX, R12 - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, R13 - ADOXQ BP, R13 - - // clear the flags - XORQ AX, AX - MOVQ y+16(FP), DX - MOVQ 32(DX), DX - - // (A,t[0]) := t[0] + x[0]*y[4] + A - MULXQ R14, AX, BP - ADOXQ AX, R8 - - // (A,t[1]) := t[1] + x[1]*y[4] + A - ADCXQ BP, R9 - MULXQ R15, AX, BP - ADOXQ AX, R9 - - // (A,t[2]) := t[2] + x[2]*y[4] + A - ADCXQ BP, R10 - MULXQ CX, AX, BP - ADOXQ AX, R10 - - // (A,t[3]) := t[3] + x[3]*y[4] + A - ADCXQ BP, R11 - MULXQ BX, AX, BP - ADOXQ AX, R11 - - // (A,t[4]) := t[4] + x[4]*y[4] + A - ADCXQ BP, R12 - MULXQ SI, AX, BP - ADOXQ AX, R12 - - // (A,t[5]) := t[5] + x[5]*y[4] + A - ADCXQ BP, R13 - MULXQ DI, AX, BP - ADOXQ AX, R13 - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - PUSHQ BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R8, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R8, AX - MOVQ BP, R8 - POPQ BP - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R9, R8 - MULXQ q<>+8(SB), AX, R9 - ADOXQ AX, R8 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ R10, R9 - MULXQ q<>+16(SB), AX, R10 - ADOXQ AX, R9 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ R11, R10 - MULXQ q<>+24(SB), AX, R11 - ADOXQ AX, R10 - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ R12, R11 - MULXQ q<>+32(SB), AX, R12 - ADOXQ AX, R11 - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ R13, R12 - MULXQ q<>+40(SB), AX, R13 - ADOXQ AX, R12 - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, R13 - ADOXQ BP, R13 - - // clear the flags - XORQ AX, AX - MOVQ y+16(FP), DX - MOVQ 40(DX), DX - - // (A,t[0]) := t[0] + x[0]*y[5] + A - MULXQ R14, AX, BP - ADOXQ AX, R8 - - // (A,t[1]) := t[1] + x[1]*y[5] + A - ADCXQ BP, R9 - MULXQ R15, AX, BP - ADOXQ AX, R9 - - // (A,t[2]) := t[2] + x[2]*y[5] + A - ADCXQ BP, R10 - MULXQ CX, AX, BP - ADOXQ AX, R10 - - // (A,t[3]) := t[3] + x[3]*y[5] + A - ADCXQ BP, R11 - MULXQ BX, AX, BP - ADOXQ AX, R11 - - // (A,t[4]) := t[4] + x[4]*y[5] + A - ADCXQ BP, R12 - MULXQ SI, AX, BP - ADOXQ AX, R12 - - // (A,t[5]) := t[5] + x[5]*y[5] + A - ADCXQ BP, R13 - MULXQ DI, AX, BP - ADOXQ AX, R13 - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - PUSHQ BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R8, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R8, AX - MOVQ BP, R8 - POPQ BP - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R9, R8 - MULXQ q<>+8(SB), AX, R9 - ADOXQ AX, R8 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ R10, R9 - MULXQ q<>+16(SB), AX, R10 - ADOXQ AX, R9 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ R11, R10 - MULXQ q<>+24(SB), AX, R11 - ADOXQ AX, R10 - - // (C,t[3]) := t[4] + m*q[4] + C - ADCXQ R12, R11 - MULXQ q<>+32(SB), AX, R12 - ADOXQ AX, R11 - - // (C,t[4]) := t[5] + m*q[5] + C - ADCXQ R13, R12 - MULXQ q<>+40(SB), AX, R13 - ADOXQ AX, R12 - - // t[5] = C + A - MOVQ $0, AX - ADCXQ AX, R13 - ADOXQ BP, R13 - - // reduce element(R8,R9,R10,R11,R12,R13) using temp registers (R14,R15,CX,BX,SI,DI) - REDUCE(R8,R9,R10,R11,R12,R13,R14,R15,CX,BX,SI,DI) - - XORQ DX, DX - MOVQ s0-8(SP), R14 - MOVQ s1-16(SP), R15 - MOVQ s2-24(SP), CX - MOVQ s3-32(SP), BX - MOVQ s4-40(SP), SI - MOVQ s5-48(SP), DI - SUBQ R8, R14 - SBBQ R9, R15 - SBBQ R10, CX - SBBQ R11, BX - SBBQ R12, SI - SBBQ R13, DI - MOVQ R8, s0-8(SP) - MOVQ R9, s1-16(SP) - MOVQ R10, s2-24(SP) - MOVQ R11, s3-32(SP) - MOVQ R12, s4-40(SP) - MOVQ R13, s5-48(SP) - MOVQ $0xb9feffffffffaaab, R8 - MOVQ $0x1eabfffeb153ffff, R9 - MOVQ $0x6730d2a0f6b0f624, R10 - MOVQ $0x64774b84f38512bf, R11 - MOVQ $0x4b1ba7b6434bacd7, R12 - MOVQ $0x1a0111ea397fe69a, R13 - CMOVQCC DX, R8 - CMOVQCC DX, R9 - CMOVQCC DX, R10 - CMOVQCC DX, R11 - CMOVQCC DX, R12 - CMOVQCC DX, R13 - ADDQ R8, R14 - ADCQ R9, R15 - ADCQ R10, CX - ADCQ R11, BX - ADCQ R12, SI - ADCQ R13, DI - SUBQ s6-56(SP), R14 - SBBQ s7-64(SP), R15 - SBBQ s8-72(SP), CX - SBBQ s9-80(SP), BX - SBBQ s10-88(SP), SI - SBBQ s11-96(SP), DI - MOVQ $0xb9feffffffffaaab, R8 - MOVQ $0x1eabfffeb153ffff, R9 - MOVQ $0x6730d2a0f6b0f624, R10 - MOVQ $0x64774b84f38512bf, R11 - MOVQ $0x4b1ba7b6434bacd7, R12 - MOVQ $0x1a0111ea397fe69a, R13 - CMOVQCC DX, R8 - CMOVQCC DX, R9 - CMOVQCC DX, R10 - CMOVQCC DX, R11 - CMOVQCC DX, R12 - CMOVQCC DX, R13 - ADDQ R8, R14 - ADCQ R9, R15 - ADCQ R10, CX - ADCQ R11, BX - ADCQ R12, SI - ADCQ R13, DI - MOVQ z+0(FP), AX - MOVQ R14, 48(AX) - MOVQ R15, 56(AX) - MOVQ CX, 64(AX) - MOVQ BX, 72(AX) - MOVQ SI, 80(AX) - MOVQ DI, 88(AX) - MOVQ s0-8(SP), R8 - MOVQ s1-16(SP), R9 - MOVQ s2-24(SP), R10 - MOVQ s3-32(SP), R11 - MOVQ s4-40(SP), R12 - MOVQ s5-48(SP), R13 - SUBQ s6-56(SP), R8 - SBBQ s7-64(SP), R9 - SBBQ s8-72(SP), R10 - SBBQ s9-80(SP), R11 - SBBQ s10-88(SP), R12 - SBBQ s11-96(SP), R13 - MOVQ $0xb9feffffffffaaab, R14 - MOVQ $0x1eabfffeb153ffff, R15 - MOVQ $0x6730d2a0f6b0f624, CX - MOVQ $0x64774b84f38512bf, BX - MOVQ $0x4b1ba7b6434bacd7, SI - MOVQ $0x1a0111ea397fe69a, DI - CMOVQCC DX, R14 - CMOVQCC DX, R15 - CMOVQCC DX, CX - CMOVQCC DX, BX - CMOVQCC DX, SI - CMOVQCC DX, DI - ADDQ R14, R8 - ADCQ R15, R9 - ADCQ CX, R10 - ADCQ BX, R11 - ADCQ SI, R12 - ADCQ DI, R13 - MOVQ R8, 0(AX) - MOVQ R9, 8(AX) - MOVQ R10, 16(AX) - MOVQ R11, 24(AX) - MOVQ R12, 32(AX) - MOVQ R13, 40(AX) - RET - -l5: - MOVQ z+0(FP), AX - MOVQ AX, (SP) - MOVQ x+8(FP), AX - MOVQ AX, 8(SP) - MOVQ y+16(FP), AX - MOVQ AX, 16(SP) - CALL ·mulGenericE2(SB) - RET diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e2_bls381.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e2_bls381.go index 32fb644b6..41a36ab35 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e2_bls381.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e2_bls381.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys AG -// -// 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. package fptower diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e2_bls381_fallback.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e2_bls381_fallback.go index 0ae39042d..3e81e3ee1 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e2_bls381_fallback.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e2_bls381_fallback.go @@ -1,19 +1,8 @@ //go:build !amd64 // +build !amd64 -// Copyright 2020 ConsenSys AG -// -// 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. package fptower diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e2_fallback.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e2_fallback.go index 6fe47c411..7a2461ec5 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e2_fallback.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e2_fallback.go @@ -1,19 +1,7 @@ //go:build !amd64 -// +build !amd64 -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e6.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e6.go index 128007df2..4c932208b 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e6.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/e6.go @@ -1,16 +1,5 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -63,11 +52,20 @@ func (z *E6) SetRandom() (*E6, error) { return z, nil } -// IsZero returns true if the two elements are equal, false otherwise +// MustSetRandom sets a0 and a1 to random values. +// It panics if reading form crypto/rand fails +func (z *E6) MustSetRandom() { + if _, err := z.SetRandom(); err != nil { + panic(err) + } +} + +// IsZero returns true if z is zero, false otherwise func (z *E6) IsZero() bool { return z.B0.IsZero() && z.B1.IsZero() && z.B2.IsZero() } +// IsOne returns true if z is one, false otherwise func (z *E6) IsOne() bool { return z.B0.IsOne() && z.B1.IsZero() && z.B2.IsZero() } @@ -88,7 +86,7 @@ func (z *E6) Neg(x *E6) *E6 { return z } -// Sub two elements of E6 +// Sub subtracts two elements of E6 func (z *E6) Sub(x, y *E6) *E6 { z.B0.Sub(&x.B0, &y.B0) z.B1.Sub(&x.B1, &y.B1) @@ -286,8 +284,8 @@ func (z *E6) Inverse(x *E6) *E6 { return z } -// BatchInvertE6 returns a new slice with every element inverted. -// Uses Montgomery batch inversion trick +// BatchInvertE6 returns a new slice with every element in a inverted. +// It uses Montgomery batch inversion trick. // // if a[i] == 0, returns result[i] = a[i] func BatchInvertE6(a []E6) []E6 { @@ -322,6 +320,8 @@ func BatchInvertE6(a []E6) []E6 { return res } +// Select is conditional move. +// If cond = 0, it sets z to caseZ and returns it. otherwise caseNz. func (z *E6) Select(cond int, caseZ *E6, caseNz *E6) *E6 { //Might be able to save a nanosecond or two by an aggregate implementation @@ -332,6 +332,7 @@ func (z *E6) Select(cond int, caseZ *E6, caseNz *E6) *E6 { return z } +// Div divides an element in E6 by an element in E6 func (z *E6) Div(x *E6, y *E6) *E6 { var r E6 r.Inverse(y).Mul(x, &r) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/frobenius.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/frobenius.go index 94b38f428..5a3bbc088 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/frobenius.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/frobenius.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys AG -// -// 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. package fptower diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/parameters.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/parameters.go index 9f97e1175..798b3a802 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/parameters.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower/parameters.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys AG -// -// 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. package fptower diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/marshal.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/marshal.go index 8779479b2..d6e2c5675 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/marshal.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/marshal.go @@ -1,16 +1,5 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -171,6 +160,26 @@ func (dec *Decoder) Decode(v interface{}) (err error) { dec.n += read64 } return + case *[][][]fr.Element: + if sliceLen, err = dec.readUint32(); err != nil { + return + } + if len(*t) != int(sliceLen) { + *t = make([][][]fr.Element, sliceLen) + } + for i := range *t { + if sliceLen, err = dec.readUint32(); err != nil { + return + } + if len((*t)[i]) != int(sliceLen) { + (*t)[i] = make([][]fr.Element, sliceLen) + } + for j := range (*t)[i] { + read64, err = (*fr.Vector)(&(*t)[i][j]).ReadFrom(dec.r) + dec.n += read64 + } + } + return case *G1Affine: // we start by reading compressed point size, if metadata tells us it is uncompressed, we read more. read, err = io.ReadFull(dec.r, buf[:SizeOfG1AffineCompressed]) @@ -405,7 +414,7 @@ func isMaskInvalid(msb byte) bool { func isCompressed(msb byte) bool { mData := msb & mMask - return !((mData == mUncompressed) || (mData == mUncompressedInfinity)) + return mData != mUncompressed && mData != mUncompressedInfinity } // NewEncoder returns a binary encoder supporting curve bls12-381 objects @@ -426,7 +435,7 @@ func NewEncoder(w io.Writer, options ...func(*Encoder)) *Encoder { } // Encode writes the binary encoding of v to the stream -// type must be uint64, *fr.Element, *fp.Element, *G1Affine, *G2Affine, []G1Affine or []G2Affine +// type must be uint64, *fr.Element, *fp.Element, *G1Affine, *G2Affine, []G1Affine, []G2Affine, *[]G1Affine or *[]G2Affine func (enc *Encoder) Encode(v interface{}) (err error) { if enc.raw { return enc.encodeRaw(v) @@ -537,6 +546,27 @@ func (enc *Encoder) encode(v interface{}) (err error) { enc.n += written64 } return + case [][][]fr.Element: + // number of collections + if err = binary.Write(enc.w, binary.BigEndian, uint32(len(t))); err != nil { + return + } + enc.n += 4 + for i := range t { + // size of current collection + if err = binary.Write(enc.w, binary.BigEndian, uint32(len(t[i]))); err != nil { + return + } + enc.n += 4 + // write each vector of the current collection + for j := range t[i] { + written64, err = (*fr.Vector)(&t[i][j]).WriteTo(enc.w) + enc.n += written64 + } + } + return + case *[]G1Affine: + return enc.encode(*t) case []G1Affine: // write slice length err = binary.Write(enc.w, binary.BigEndian, uint32(len(t))) @@ -556,6 +586,8 @@ func (enc *Encoder) encode(v interface{}) (err error) { } } return nil + case *[]G2Affine: + return enc.encode(*t) case []G2Affine: // write slice length err = binary.Write(enc.w, binary.BigEndian, uint32(len(t))) @@ -655,6 +687,27 @@ func (enc *Encoder) encodeRaw(v interface{}) (err error) { enc.n += written64 } return + case [][][]fr.Element: + // number of collections + if err = binary.Write(enc.w, binary.BigEndian, uint32(len(t))); err != nil { + return + } + enc.n += 4 + for i := range t { + // size of current collection + if err = binary.Write(enc.w, binary.BigEndian, uint32(len(t[i]))); err != nil { + return + } + enc.n += 4 + // write each vector of the current collection + for j := range t[i] { + written64, err = (*fr.Vector)(&t[i][j]).WriteTo(enc.w) + enc.n += written64 + } + } + return + case *[]G1Affine: + return enc.encodeRaw(*t) case []G1Affine: // write slice length err = binary.Write(enc.w, binary.BigEndian, uint32(len(t))) @@ -674,6 +727,8 @@ func (enc *Encoder) encodeRaw(v interface{}) (err error) { } } return nil + case *[]G2Affine: + return enc.encodeRaw(*t) case []G2Affine: // write slice length err = binary.Write(enc.w, binary.BigEndian, uint32(len(t))) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/multiexp.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/multiexp.go index 19350818f..bd0427c04 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/multiexp.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/multiexp.go @@ -1,16 +1,5 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -323,6 +312,31 @@ func msmReduceChunkG1Affine(p *G1Jac, c int, chChunks []chan g1JacExtended) *G1J return p.unsafeFromJacExtended(&_p) } +// Fold computes the multi-exponentiation \sum_{i=0}^{len(points)-1} points[i] * +// combinationCoeff^i and stores the result in p. It returns error in case +// configuration is invalid. +func (p *G1Affine) Fold(points []G1Affine, combinationCoeff fr.Element, config ecc.MultiExpConfig) (*G1Affine, error) { + var _p G1Jac + if _, err := _p.Fold(points, combinationCoeff, config); err != nil { + return nil, err + } + p.FromJacobian(&_p) + return p, nil +} + +// Fold computes the multi-exponentiation \sum_{i=0}^{len(points)-1} points[i] * +// combinationCoeff^i and stores the result in p. It returns error in case +// configuration is invalid. +func (p *G1Jac) Fold(points []G1Affine, combinationCoeff fr.Element, config ecc.MultiExpConfig) (*G1Jac, error) { + scalars := make([]fr.Element, len(points)) + scalar := fr.NewElement(1) + for i := 0; i < len(points); i++ { + scalars[i].Set(&scalar) + scalar.Mul(&scalar, &combinationCoeff) + } + return p.MultiExp(points, scalars, config) +} + // MultiExp implements section 4 of https://eprint.iacr.org/2012/549.pdf // // This call return an error if len(scalars) != len(points) or if provided config is invalid. @@ -621,6 +635,31 @@ func msmReduceChunkG2Affine(p *G2Jac, c int, chChunks []chan g2JacExtended) *G2J return p.unsafeFromJacExtended(&_p) } +// Fold computes the multi-exponentiation \sum_{i=0}^{len(points)-1} points[i] * +// combinationCoeff^i and stores the result in p. It returns error in case +// configuration is invalid. +func (p *G2Affine) Fold(points []G2Affine, combinationCoeff fr.Element, config ecc.MultiExpConfig) (*G2Affine, error) { + var _p G2Jac + if _, err := _p.Fold(points, combinationCoeff, config); err != nil { + return nil, err + } + p.FromJacobian(&_p) + return p, nil +} + +// Fold computes the multi-exponentiation \sum_{i=0}^{len(points)-1} points[i] * +// combinationCoeff^i and stores the result in p. It returns error in case +// configuration is invalid. +func (p *G2Jac) Fold(points []G2Affine, combinationCoeff fr.Element, config ecc.MultiExpConfig) (*G2Jac, error) { + scalars := make([]fr.Element, len(points)) + scalar := fr.NewElement(1) + for i := 0; i < len(points); i++ { + scalars[i].Set(&scalar) + scalar.Mul(&scalar, &combinationCoeff) + } + return p.MultiExp(points, scalars, config) +} + // selector stores the index, mask and shifts needed to select bits from a scalar // it is used during the multiExp algorithm or the batch scalar multiplication type selector struct { diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/multiexp_affine.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/multiexp_affine.go index 937a43c9d..a7005c76b 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/multiexp_affine.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/multiexp_affine.go @@ -1,16 +1,5 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -30,7 +19,7 @@ type batchOpG1Affine struct { // using affine coordinates for the buckets. To amortize the cost of the inverse in the affine addition // we use a batch affine addition. // -// this is derived from a PR by 0x0ece : https://github.com/ConsenSys/gnark-crypto/pull/249 +// this is derived from a PR by 0x0ece : https://github.com/Consensys/gnark-crypto/pull/249 // See Section 5.3: ia.cr/2022/1396 func processChunkG1BatchAffine[BJE ibg1JacExtended, B ibG1Affine, BS bitSet, TP pG1Affine, TPP ppG1Affine, TQ qOpsG1Affine, TC cG1Affine]( chunk uint64, @@ -60,11 +49,10 @@ func processChunkG1BatchAffine[BJE ibg1JacExtended, B ibG1Affine, BS bitSet, TP // note that we have 2 sets of buckets // 1 in G1Affine used with the batch affine additions // 1 in g1JacExtended used in case the queue of conflicting points - var buckets B + var buckets B // in G1Affine coordinates, infinity point is represented as (0,0), no need to init var bucketsJE BJE for i := 0; i < len(buckets); i++ { - buckets[i].setInfinity() - bucketsJE[i].setInfinity() + bucketsJE[i].SetInfinity() } // setup for the batch affine; @@ -107,7 +95,7 @@ func processChunkG1BatchAffine[BJE ibg1JacExtended, B ibG1Affine, BS bitSet, TP bucketsJE[op.bucketID].addMixed(&op.point) return } - BK.setInfinity() + BK.SetInfinity() return } @@ -135,12 +123,12 @@ func processChunkG1BatchAffine[BJE ibg1JacExtended, B ibG1Affine, BS bitSet, TP if isAdd { bucketsJE[bucketID].addMixed(PP) } else { - BK.setInfinity() + BK.SetInfinity() } return } if isAdd { - BK.setInfinity() + BK.SetInfinity() } else { bucketsJE[bucketID].subMixed(PP) } @@ -222,11 +210,11 @@ func processChunkG1BatchAffine[BJE ibg1JacExtended, B ibG1Affine, BS bitSet, TP // reduce buckets into total // total = bucket[0] + 2*bucket[1] + 3*bucket[2] ... + n*bucket[n-1] var runningSum, total g1JacExtended - runningSum.setInfinity() - total.setInfinity() + runningSum.SetInfinity() + total.SetInfinity() for k := len(buckets) - 1; k >= 0; k-- { runningSum.addMixed(&buckets[k]) - if !bucketsJE[k].IsZero() { + if !bucketsJE[k].IsInfinity() { runningSum.add(&bucketsJE[k]) } total.add(&runningSum) @@ -358,7 +346,7 @@ type batchOpG2Affine struct { // using affine coordinates for the buckets. To amortize the cost of the inverse in the affine addition // we use a batch affine addition. // -// this is derived from a PR by 0x0ece : https://github.com/ConsenSys/gnark-crypto/pull/249 +// this is derived from a PR by 0x0ece : https://github.com/Consensys/gnark-crypto/pull/249 // See Section 5.3: ia.cr/2022/1396 func processChunkG2BatchAffine[BJE ibg2JacExtended, B ibG2Affine, BS bitSet, TP pG2Affine, TPP ppG2Affine, TQ qOpsG2Affine, TC cG2Affine]( chunk uint64, @@ -388,11 +376,10 @@ func processChunkG2BatchAffine[BJE ibg2JacExtended, B ibG2Affine, BS bitSet, TP // note that we have 2 sets of buckets // 1 in G2Affine used with the batch affine additions // 1 in g2JacExtended used in case the queue of conflicting points - var buckets B + var buckets B // in G2Affine coordinates, infinity point is represented as (0,0), no need to init var bucketsJE BJE for i := 0; i < len(buckets); i++ { - buckets[i].setInfinity() - bucketsJE[i].setInfinity() + bucketsJE[i].SetInfinity() } // setup for the batch affine; @@ -435,7 +422,7 @@ func processChunkG2BatchAffine[BJE ibg2JacExtended, B ibG2Affine, BS bitSet, TP bucketsJE[op.bucketID].addMixed(&op.point) return } - BK.setInfinity() + BK.SetInfinity() return } @@ -463,12 +450,12 @@ func processChunkG2BatchAffine[BJE ibg2JacExtended, B ibG2Affine, BS bitSet, TP if isAdd { bucketsJE[bucketID].addMixed(PP) } else { - BK.setInfinity() + BK.SetInfinity() } return } if isAdd { - BK.setInfinity() + BK.SetInfinity() } else { bucketsJE[bucketID].subMixed(PP) } @@ -550,11 +537,11 @@ func processChunkG2BatchAffine[BJE ibg2JacExtended, B ibG2Affine, BS bitSet, TP // reduce buckets into total // total = bucket[0] + 2*bucket[1] + 3*bucket[2] ... + n*bucket[n-1] var runningSum, total g2JacExtended - runningSum.setInfinity() - total.setInfinity() + runningSum.SetInfinity() + total.SetInfinity() for k := len(buckets) - 1; k >= 0; k-- { runningSum.addMixed(&buckets[k]) - if !bucketsJE[k].IsZero() { + if !bucketsJE[k].IsInfinity() { runningSum.add(&bucketsJE[k]) } total.add(&runningSum) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/multiexp_jacobian.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/multiexp_jacobian.go index 1b8c0e79a..b2a94f793 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/multiexp_jacobian.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/multiexp_jacobian.go @@ -1,16 +1,5 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -30,7 +19,7 @@ func processChunkG1Jacobian[B ibg1JacExtended](chunk uint64, var buckets B for i := 0; i < len(buckets); i++ { - buckets[i].setInfinity() + buckets[i].SetInfinity() } // for each scalars, get the digit corresponding to the chunk we're processing. @@ -53,10 +42,10 @@ func processChunkG1Jacobian[B ibg1JacExtended](chunk uint64, // total = bucket[0] + 2*bucket[1] + 3*bucket[2] ... + n*bucket[n-1] var runningSum, total g1JacExtended - runningSum.setInfinity() - total.setInfinity() + runningSum.SetInfinity() + total.SetInfinity() for k := len(buckets) - 1; k >= 0; k-- { - if !buckets[k].IsZero() { + if !buckets[k].IsInfinity() { runningSum.add(&buckets[k]) } total.add(&runningSum) @@ -119,7 +108,7 @@ func processChunkG2Jacobian[B ibg2JacExtended](chunk uint64, var buckets B for i := 0; i < len(buckets); i++ { - buckets[i].setInfinity() + buckets[i].SetInfinity() } // for each scalars, get the digit corresponding to the chunk we're processing. @@ -142,10 +131,10 @@ func processChunkG2Jacobian[B ibg2JacExtended](chunk uint64, // total = bucket[0] + 2*bucket[1] + 3*bucket[2] ... + n*bucket[n-1] var runningSum, total g2JacExtended - runningSum.setInfinity() - total.setInfinity() + runningSum.SetInfinity() + total.SetInfinity() for k := len(buckets) - 1; k >= 0; k-- { - if !buckets[k].IsZero() { + if !buckets[k].IsInfinity() { runningSum.add(&buckets[k]) } total.add(&runningSum) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/pairing.go b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/pairing.go index e2c362f9b..3379bd25b 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/pairing.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bls12-381/pairing.go @@ -1,22 +1,12 @@ -// Copyright 2020 ConsenSys AG -// -// 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. package bls12381 import ( "errors" + "github.com/consensys/gnark-crypto/ecc/bls12-381/fp" "github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower" ) @@ -146,7 +136,7 @@ func MillerLoop(P []G1Affine, Q []G2Affine) (GT, error) { if n >= 1 { // i = 62, separately to avoid an E12 Square // (Square(res) = 1² = 1) - // loopCounter[62] = 1 + // LoopCounter[62] = 1 // k = 0, separately to avoid MulBy014 (res × ℓ) // (assign line to res) @@ -193,7 +183,7 @@ func MillerLoop(P []G1Affine, Q []G2Affine) (GT, error) { } // i <= 61 - for i := len(loopCounter) - 3; i >= 1; i-- { + for i := len(LoopCounter) - 3; i >= 1; i-- { // mutualize the square among n Miller loops // (∏ᵢfᵢ)² result.Square(&result) @@ -205,7 +195,7 @@ func MillerLoop(P []G1Affine, Q []G2Affine) (GT, error) { l1.r1.MulByElement(&l1.r1, &p[k].X) l1.r2.MulByElement(&l1.r2, &p[k].Y) - if loopCounter[i] == 0 { + if LoopCounter[i] == 0 { // ℓ × res result.MulBy014(&l1.r0, &l1.r1, &l1.r2) } else { @@ -224,7 +214,7 @@ func MillerLoop(P []G1Affine, Q []G2Affine) (GT, error) { } // i = 0, separately to avoid a point doubling - // loopCounter[0] = 0 + // LoopCounter[0] = 0 result.Square(&result) for k := 0; k < n; k++ { // l1 the tangent ℓ passing 2qProj[k] @@ -345,3 +335,245 @@ func (p *g2Proj) tangentLine(l *lineEvaluation) { Add(&l.r1, &J) l.r2.Neg(&H) } + +// ---------------------- +// Fixed-argument pairing +// ---------------------- + +type LineEvaluationAff struct { + R0 fptower.E2 + R1 fptower.E2 +} + +// PairFixedQ calculates the reduced pairing for a set of points +// ∏ᵢ e(Pᵢ, Qᵢ) where Q are fixed points in G2. +// +// This function doesn't check that the inputs are in the correct subgroup. See IsInSubGroup. +func PairFixedQ(P []G1Affine, lines [][2][len(LoopCounter) - 1]LineEvaluationAff) (GT, error) { + f, err := MillerLoopFixedQ(P, lines) + if err != nil { + return GT{}, err + } + return FinalExponentiation(&f), nil +} + +// PairingCheckFixedQ calculates the reduced pairing for a set of points and returns True if the result is One +// ∏ᵢ e(Pᵢ, Qᵢ) =? 1 where Q are fixed points in G2. +// +// This function doesn't check that the inputs are in the correct subgroup. See IsInSubGroup. +func PairingCheckFixedQ(P []G1Affine, lines [][2][len(LoopCounter) - 1]LineEvaluationAff) (bool, error) { + f, err := PairFixedQ(P, lines) + if err != nil { + return false, err + } + var one GT + one.SetOne() + return f.Equal(&one), nil +} + +// PrecomputeLines precomputes the lines for the fixed-argument Miller loop +func PrecomputeLines(Q G2Affine) (PrecomputedLines [2][len(LoopCounter) - 1]LineEvaluationAff) { + var accQ G2Affine + accQ.Set(&Q) + n := len(LoopCounter) + // i = n - 2 + accQ.doubleStep(&PrecomputedLines[0][n-2]) + accQ.addStep(&PrecomputedLines[1][n-2], &Q) + for i := n - 3; i >= 0; i-- { + if LoopCounter[i] == 0 { + accQ.doubleStep(&PrecomputedLines[0][i]) + } else { + accQ.doubleAndAddStep(&PrecomputedLines[0][i], &PrecomputedLines[1][i], &Q) + } + } + return PrecomputedLines +} + +// MillerLoopFixedQ computes the multi-Miller loop as in MillerLoop +// but Qᵢ are fixed points in G2 known in advance. +func MillerLoopFixedQ(P []G1Affine, lines [][2][len(LoopCounter) - 1]LineEvaluationAff) (GT, error) { + n := len(P) + if n == 0 || n != len(lines) { + return GT{}, errors.New("invalid inputs sizes") + } + + // no need to filter infinity points: + // 1. if Pᵢ=(0,0) then -x/y=1/y=0 by gnark-crypto convention and so + // lines R0 and R1 are 0. It happens that result will stay, through + // the Miller loop, in 𝔽p⁶ because MulBy01(0,0,1), + // Mul01By01(0,0,1,0,0,1) and MulBy01245 set result.C0 to 0. At the + // end result will be in a proper subgroup of Fp¹² so it be reduced to + // 1 in FinalExponentiation. + // + // and/or + // + // 2. if Qᵢ=(0,0) then PrecomputeLines(Qᵢ) will return lines R0 and R1 + // that are 0 because of gnark-convention (*/0==0) in doubleStep and + // addStep. Similarly to Pᵢ=(0,0) it happens that result be 1 + // after the FinalExponentiation. + + // precomputations + yInv := make([]fp.Element, n) + xNegOverY := make([]fp.Element, n) + for k := 0; k < n; k++ { + yInv[k].Set(&P[k].Y) + } + yInv = fp.BatchInvert(yInv) + for k := 0; k < n; k++ { + xNegOverY[k].Mul(&P[k].X, &yInv[k]). + Neg(&xNegOverY[k]) + } + + var result GT + result.SetOne() + var prodLines [5]E2 + + // Compute ∏ᵢ { fᵢ_{x₀,Q}(P) } + for i := len(LoopCounter) - 2; i >= 0; i-- { + // mutualize the square among n Miller loops + // (∏ᵢfᵢ)² + result.Square(&result) + + for k := 0; k < n; k++ { + // line evaluation at P[k] + lines[k][0][i].R1. + MulByElement( + &lines[k][0][i].R1, + &yInv[k], + ) + lines[k][0][i].R0. + MulByElement(&lines[k][0][i].R0, + &xNegOverY[k], + ) + if LoopCounter[i] == 0 { + // ℓ × res + result.MulBy01( + &lines[k][0][i].R1, + &lines[k][0][i].R0, + ) + + } else { + lines[k][1][i].R1. + MulByElement( + &lines[k][1][i].R1, + &yInv[k], + ) + lines[k][1][i].R0. + MulByElement( + &lines[k][1][i].R0, + &xNegOverY[k], + ) + prodLines = fptower.Mul01By01( + &lines[k][0][i].R1, &lines[k][0][i].R0, + &lines[k][1][i].R1, &lines[k][1][i].R0, + ) + result.MulBy01245(&prodLines) + } + } + } + + // negative x₀ + result.Conjugate(&result) + + return result, nil +} + +func (p *G2Affine) doubleStep(evaluations *LineEvaluationAff) { + + var n, d, λ, xr, yr fptower.E2 + // λ = 3x²/2y + n.Square(&p.X) + λ.Double(&n). + Add(&λ, &n) + d.Double(&p.Y) + λ.Div(&λ, &d) + + // xr = λ²-2x + xr.Square(&λ). + Sub(&xr, &p.X). + Sub(&xr, &p.X) + + // yr = λ(x-xr)-y + yr.Sub(&p.X, &xr). + Mul(&yr, &λ). + Sub(&yr, &p.Y) + + evaluations.R0.Set(&λ) + evaluations.R1.Mul(&λ, &p.X). + Sub(&evaluations.R1, &p.Y) + + p.X.Set(&xr) + p.Y.Set(&yr) +} + +func (p *G2Affine) addStep(evaluations *LineEvaluationAff, a *G2Affine) { + var n, d, λ, λλ, xr, yr fptower.E2 + + // compute λ = (y2-y1)/(x2-x1) + n.Sub(&a.Y, &p.Y) + d.Sub(&a.X, &p.X) + λ.Div(&n, &d) + + // xr = λ²-x1-x2 + λλ.Square(&λ) + n.Add(&p.X, &a.X) + xr.Sub(&λλ, &n) + + // yr = λ(x1-xr) - y1 + yr.Sub(&p.X, &xr). + Mul(&yr, &λ). + Sub(&yr, &p.Y) + + evaluations.R0.Set(&λ) + evaluations.R1.Mul(&λ, &p.X). + Sub(&evaluations.R1, &p.Y) + + p.X.Set(&xr) + p.Y.Set(&yr) +} + +func (p *G2Affine) doubleAndAddStep(evaluations1, evaluations2 *LineEvaluationAff, a *G2Affine) { + var n, d, l1, x3, l2, x4, y4 fptower.E2 + + // compute λ1 = (y2-y1)/(x2-x1) + n.Sub(&p.Y, &a.Y) + d.Sub(&p.X, &a.X) + l1.Div(&n, &d) + + // compute x3 =λ1²-x1-x2 + x3.Square(&l1) + x3.Sub(&x3, &p.X) + x3.Sub(&x3, &a.X) + + // omit y3 computation + + // compute line1 + evaluations1.R0.Set(&l1) + evaluations1.R1.Mul(&l1, &p.X) + evaluations1.R1.Sub(&evaluations1.R1, &p.Y) + + // compute λ2 = -λ1-2y1/(x3-x1) + n.Double(&p.Y) + d.Sub(&x3, &p.X) + l2.Div(&n, &d) + l2.Add(&l2, &l1) + l2.Neg(&l2) + + // compute x4 = λ2²-x1-x3 + x4.Square(&l2) + x4.Sub(&x4, &p.X) + x4.Sub(&x4, &x3) + + // compute y4 = λ2(x1 - x4)-y1 + y4.Sub(&p.X, &x4) + y4.Mul(&l2, &y4) + y4.Sub(&y4, &p.Y) + + // compute line2 + evaluations2.R0.Set(&l2) + evaluations2.R1.Mul(&l2, &p.X) + evaluations2.R1.Sub(&evaluations2.R1, &p.Y) + + p.X.Set(&x4) + p.Y.Set(&y4) +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/bn254.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/bn254.go index f6f2990ca..bcf0b3eba 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/bn254.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/bn254.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Package bn254 efficient elliptic curve, pairing and hash to curve implementation for bn254. This curve appears in // Ethereum pre-compiles as altbn128. @@ -76,13 +65,13 @@ var g1Infinity G1Jac var g2Infinity G2Jac // optimal Ate loop counter -var loopCounter [66]int8 +var LoopCounter [66]int8 // Parameters useful for the GLV scalar multiplication. The third roots define the // endomorphisms ϕ₁ and ϕ₂ for and . lambda is such that lies above // in the ring Z[ϕ]. More concretely it's the associated eigenvalue // of ϕ₁ (resp ϕ₂) restricted to (resp ) -// see https://www.cosic.esat.kuleuven.be/nessie/reports/phase2/GLV.pdf +// see https://link.springer.com/content/pdf/10.1007/3-540-36492-7_3 var thirdRootOneG1 fp.Element var thirdRootOneG2 fp.Element var lambdaGLV big.Int @@ -91,6 +80,12 @@ var lambdaGLV big.Int // in ker((u,v) → u+vλ[r]), and their determinant var glvBasis ecc.Lattice +// g1ScalarMulChoose and g2ScalarmulChoose indicate the bitlength of the scalar +// in scalar multiplication from which it is more efficient to use the GLV +// decomposition. It is computed from the GLV basis and considers the overhead +// for the GLV decomposition. It is heuristic and may change in the future. +var g1ScalarMulChoose, g2ScalarMulChoose int + // ψ o π o ψ⁻¹, where ψ:E → E' is the degree 6 iso defined over 𝔽p¹² var endo struct { u fptower.E2 @@ -144,6 +139,8 @@ func init() { lambdaGLV.SetString("4407920970296243842393367215006156084916469457145843978461", 10) // (36x₀³+18x₀²+6x₀+1) _r := fr.Modulus() ecc.PrecomputeLattice(_r, &lambdaGLV, &glvBasis) + g1ScalarMulChoose = fr.Bits/16 + max(glvBasis.V1[0].BitLen(), glvBasis.V1[1].BitLen(), glvBasis.V2[0].BitLen(), glvBasis.V2[1].BitLen()) + g2ScalarMulChoose = fr.Bits/32 + max(glvBasis.V1[0].BitLen(), glvBasis.V1[1].BitLen(), glvBasis.V2[0].BitLen(), glvBasis.V2[1].BitLen()) endo.u.A0.SetString("21575463638280843010398324269430826099269044274347216827212613867836435027261") endo.u.A1.SetString("10307601595873709700152284273816112264069230130616436755625194854815875713954") @@ -152,7 +149,7 @@ func init() { // 2-NAF decomposition of 6x₀+2 little endian optimaAteLoop, _ := new(big.Int).SetString("29793968203157093288", 10) - ecc.NafDecomposition(optimaAteLoop, loopCounter[:]) + ecc.NafDecomposition(optimaAteLoop, LoopCounter[:]) xGen.SetString("4965661367192848881", 10) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/arith.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/arith.go index 6f281563b..5c9905de8 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/arith.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/arith.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -58,16 +47,3 @@ func madd3(a, b, c, d, e uint64) (hi uint64, lo uint64) { hi, _ = bits.Add64(hi, e, carry) return } -func max(a int, b int) int { - if a > b { - return a - } - return b -} - -func min(a int, b int) int { - if a < b { - return a - } - return b -} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/asm.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/asm.go deleted file mode 100644 index 0481989ec..000000000 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/asm.go +++ /dev/null @@ -1,27 +0,0 @@ -//go:build !noadx -// +build !noadx - -// Copyright 2020 ConsenSys Software 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. - -// Code generated by consensys/gnark-crypto DO NOT EDIT - -package fp - -import "golang.org/x/sys/cpu" - -var ( - supportAdx = cpu.X86.HasADX && cpu.X86.HasBMI2 - _ = supportAdx -) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/asm_noadx.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/asm_noadx.go deleted file mode 100644 index 92f8cc0f4..000000000 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/asm_noadx.go +++ /dev/null @@ -1,28 +0,0 @@ -//go:build noadx -// +build noadx - -// Copyright 2020 ConsenSys Software 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. - -// Code generated by consensys/gnark-crypto DO NOT EDIT - -package fp - -// note: this is needed for test purposes, as dynamically changing supportAdx doesn't flag -// certain errors (like fatal error: missing stackmap) -// this ensures we test all asm path. -var ( - supportAdx = false - _ = supportAdx -) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/doc.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/doc.go index ac24d2e0d..0a37ea68e 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/doc.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/doc.go @@ -1,22 +1,13 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT // Package fp contains field arithmetic operations for modulus = 0x30644e...7cfd47. // -// The API is similar to math/big (big.Int), but the operations are significantly faster (up to 20x for the modular multiplication on amd64, see also https://hackmd.io/@gnark/modular_multiplication) +// The API is similar to math/big (big.Int), but the operations are significantly faster (up to 20x). +// +// Additionally fp.Vector offers an API to manipulate []Element using AVX512 instructions if available. // // The modulus is hardcoded in all the operations. // @@ -49,5 +40,7 @@ // // # Warning // -// This code has not been audited and is provided as-is. In particular, there is no security guarantees such as constant time implementation or side-channel attack resistance. +// There is no security guarantees such as constant time implementation or side-channel attack resistance. +// This code is provided as-is. Partially audited, see https://github.com/Consensys/gnark/tree/master/audits +// for more details. package fp diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element.go index 5ba388e73..10920f7fc 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -54,10 +43,10 @@ const ( // Field modulus q const ( - q0 uint64 = 4332616871279656263 - q1 uint64 = 10917124144477883021 - q2 uint64 = 13281191951274694749 - q3 uint64 = 3486998266802970665 + q0 = 4332616871279656263 + q1 = 10917124144477883021 + q2 = 13281191951274694749 + q3 = 3486998266802970665 ) var qElement = Element{ @@ -79,7 +68,10 @@ func Modulus() *big.Int { // q + r'.r = 1, i.e., qInvNeg = - q⁻¹ mod r // used for Montgomery reduction -const qInvNeg uint64 = 9786893198990664585 +const qInvNeg = 9786893198990664585 + +// mu = 2^288 / q needed for partial Barrett reduction +const mu uint64 = 22721021478 func init() { _modulus.SetString("30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47", 16) @@ -129,7 +121,7 @@ func (z *Element) Set(x *Element) *Element { } // SetInterface converts provided interface into Element -// returns an error if provided type is not supported +// returns an error if provided type is not supported. // supported types: // // Element @@ -350,6 +342,16 @@ func (z *Element) SetRandom() (*Element, error) { } } +// MustSetRandom sets z to a uniform random value in [0, q). +// +// It panics if reading from crypto/rand.Reader errors. +func (z *Element) MustSetRandom() *Element { + if _, err := z.SetRandom(); err != nil { + panic(err) + } + return z +} + // smallerThanModulus returns true if z < q // This is not constant time func (z *Element) smallerThanModulus() bool { @@ -477,32 +479,8 @@ func (z *Element) Select(c int, x0 *Element, x1 *Element) *Element { // and is used for testing purposes. func _mulGeneric(z, x, y *Element) { - // Implements CIOS multiplication -- section 2.3.2 of Tolga Acar's thesis - // https://www.microsoft.com/en-us/research/wp-content/uploads/1998/06/97Acar.pdf - // - // The algorithm: - // - // for i=0 to N-1 - // C := 0 - // for j=0 to N-1 - // (C,t[j]) := t[j] + x[j]*y[i] + C - // (t[N+1],t[N]) := t[N] + C - // - // C := 0 - // m := t[0]*q'[0] mod D - // (C,_) := t[0] + m*q[0] - // for j=1 to N-1 - // (C,t[j-1]) := t[j] + m*q[j] + C - // - // (C,t[N-1]) := t[N] + C - // t[N] := t[N+1] + C - // - // → N is the number of machine words needed to store the modulus q - // → D is the word size. For example, on a 64-bit architecture D is 2 64 - // → x[i], y[i], q[i] is the ith word of the numbers x,y,q - // → q'[0] is the lowest word of the number -q⁻¹ mod r. This quantity is pre-computed, as it does not depend on the inputs. - // → t is a temporary array of size N+2 - // → C, S are machine words. A pair (C,S) refers to (hi-bits, lo-bits) of a two-word number + // Algorithm 2 of "Faster Montgomery Multiplication and Multi-Scalar-Multiplication for SNARKS" + // by Y. El Housni and G. Botrel https://doi.org/10.46586/tches.v2023.i3.504-521 var t [5]uint64 var D uint64 @@ -960,7 +938,7 @@ func (z *Element) SetBigInt(v *big.Int) *Element { // v == 0 return z } else if c != 1 && v.Cmp(&zero) != -1 { - // 0 < v < q + // 0 <= v < q return z.setBigInt(v) } @@ -1087,6 +1065,8 @@ type ByteOrder interface { String() string } +var errInvalidEncoding = errors.New("invalid fp.Element encoding") + // BigEndian is the big-endian implementation of ByteOrder and AppendByteOrder. var BigEndian bigEndian @@ -1102,7 +1082,7 @@ func (bigEndian) Element(b *[Bytes]byte) (Element, error) { z[3] = binary.BigEndian.Uint64((*b)[0:8]) if !z.smallerThanModulus() { - return Element{}, errors.New("invalid fp.Element encoding") + return Element{}, errInvalidEncoding } z.toMont() @@ -1132,7 +1112,7 @@ func (littleEndian) Element(b *[Bytes]byte) (Element, error) { z[3] = binary.LittleEndian.Uint64((*b)[24:32]) if !z.smallerThanModulus() { - return Element{}, errors.New("invalid fp.Element encoding") + return Element{}, errInvalidEncoding } z.toMont() @@ -1151,19 +1131,168 @@ func (littleEndian) String() string { return "LittleEndian" } // Legendre returns the Legendre symbol of z (either +1, -1, or 0.) func (z *Element) Legendre() int { - var l Element - // z^((q-1)/2) - l.expByLegendreExp(*z) - if l.IsZero() { - return 0 + // Adapts "Optimized Binary GCD for Modular Inversion" + // https://github.com/pornin/bingcd/blob/main/doc/bingcd.pdf + // For a faithful implementation of Pornin20 see [Inverse]. + + // We don't need to account for z being in Montgomery form. + // (xR|q) = (x|q)(R|q). R is a square (an even power of 2), so (R|q) = 1. + a := *z + b := Element{ + q0, + q1, + q2, + q3, + } // b := q + + // Update factors: we get [a; b] ← [f₀ g₀; f₁ g₁] [a; b] + // cᵢ = fᵢ + 2³¹ - 1 + 2³² * (gᵢ + 2³¹ - 1) + var c0, c1 int64 + + var s Element + + l := 1 // loop invariant: (x|q) = (a|b) . l + // This means that every time a and b are updated into a' and b', + // l is updated into l' = (x|q)(a'|b')=(x|q)(a|b)(a|b)(a'|b') = l (a|b)(a'|b') + // During the algorithm's run, there is no guarantee that b remains prime, or even positive. + // Therefore, we use the properties of the Kronecker symbol, a generalization of the Legendre symbol to all integers. + + for !a.IsZero() { + n := max(a.BitLen(), b.BitLen()) + aApprox, bApprox := approximateForLegendre(&a, n), approximateForLegendre(&b, n) + + // f₀, g₀, f₁, g₁ = 1, 0, 0, 1 + c0, c1 = updateFactorIdentityMatrixRow0, updateFactorIdentityMatrixRow1 + + const nbIterations = k - 2 + // running fewer iterations because we need access to 3 low bits from b, rather than 1 in the inversion algorithm + for range nbIterations { + + if aApprox&1 == 0 { + aApprox /= 2 + + // update the Kronecker symbol + // + // (a/2 | b) (2|b) = (a|b) + // + // b is either odd or zero, the latter case implying a non-trivial GCD and an ultimate result of 0, + // regardless of what value l holds. + // So in updating l, we may assume that b is odd. + // Since a is even, we only need to correctly compute l if b is odd. + // if b is also even, the non-trivial GCD will result in the function returning 0 anyway. + // so we may here assume b is odd. + // (2|b) = 1 if b ≡ 1 or 7 (mod 8), and -1 if b ≡ 3 or 5 (mod 8) + if bMod8 := bApprox & 7; bMod8 == 3 || bMod8 == 5 { + l = -l + } + + } else { + s, borrow := bits.Sub64(aApprox, bApprox, 0) + if borrow == 1 { + // Compute (b-a|a) + // (x-y|z) = (x|z) unless z < 0 and sign(x-y) ≠ sign(x) + // Pornin20 asserts that at least one of a and b is non-negative. + // If a is non-negative, we immediately get (b-a|a) = (b|a) + // If a is negative, b-a > b. But b is already non-negative, so the b-a and b have the same sign. + // Thus in that case also (b-a|a) = (b|a) + // Since not both a and b are negative, we get a quadratic reciprocity law + // like that of the Legendre symbol: (b|a) = (a|b), unless a, b ≡ 3 (mod 4), in which case (b|a) = -(a|b) + if bApprox&3 == 3 && aApprox&3 == 3 { + l = -l + } + + s = bApprox - aApprox + bApprox = aApprox + c0, c1 = c1, c0 + } + + aApprox = s / 2 + c0 = c0 - c1 + + // update l to reflect halving a, just like in the case where a is even + if bMod8 := bApprox & 7; bMod8 == 3 || bMod8 == 5 { + l = -l + } + } + + c1 *= 2 + } + + s = a + + var g0 int64 + // from this point on c0 aliases for f0 + c0, g0 = updateFactorsDecompose(c0) + aHi := a.linearCombNonModular(&s, c0, &b, g0) + if aHi&signBitSelector != 0 { + // if aHi < 0 + aHi = negL(&a, aHi) + // Since a is negative, b is not and hence b ≠ -1 + // So we get (-a|b)=(-1|b)(a|b) + // b is odd so we get (-1|b) = 1 if b ≡ 1 (mod 4) and -1 otherwise. + if bApprox&3 == 3 { // we still have two valid lower bits for b + l = -l + } + } + // right-shift a by k-2 bits + a[0] = (a[0] >> nbIterations) | ((a[1]) << (2*k - nbIterations)) + a[1] = (a[1] >> nbIterations) | ((a[2]) << (2*k - nbIterations)) + a[2] = (a[2] >> nbIterations) | ((a[3]) << (2*k - nbIterations)) + a[3] = (a[3] >> nbIterations) | (aHi << (2*k - nbIterations)) + + var f1 int64 + // from this point on c1 aliases for g0 + f1, c1 = updateFactorsDecompose(c1) + bHi := b.linearCombNonModular(&s, f1, &b, c1) + if bHi&signBitSelector != 0 { + // if bHi < 0 + bHi = negL(&b, bHi) + // no need to update l, since we know a ≥ 0 + // (a|-1) = 1 if a ≥ 0 + } + // right-shift b by k-2 bits + b[0] = (b[0] >> nbIterations) | ((b[1]) << (2*k - nbIterations)) + b[1] = (b[1] >> nbIterations) | ((b[2]) << (2*k - nbIterations)) + b[2] = (b[2] >> nbIterations) | ((b[3]) << (2*k - nbIterations)) + b[3] = (b[3] >> nbIterations) | (bHi << (2*k - nbIterations)) } - // if l == 1 - if l.IsOne() { - return 1 + if b[0] == 1 && (b[1]|b[2]|b[3]) == 0 { + return l // (0|1) = 1 + } else { + return 0 // if b ≠ 1, then (z,q) ≠ 0 ⇒ (z|q) = 0 + } +} + +// approximate a big number x into a single 64 bit word using its uppermost and lowermost bits. +// If x fits in a word as is, no approximation necessary. +// This differs from the standard approximate function in that in the Legendre symbol computation +// we need to access the 3 low bits of b, rather than just one. So lo ≥ n+2 where n is the number of inner iterations. +// The requirement on the high bits is unchanged, hi ≥ n+1. +// Thus we hit a maximum of hi = lo = k and n = k-2 as opposed to n = lo = k-1 and hi = k+1 in the standard approximate function. +// Since we are doing fewer iterations than in the inversion algorithm, all the arguments on bounds for update factors remain valid. +func approximateForLegendre(x *Element, nBits int) uint64 { + + if nBits <= 64 { + return x[0] } - return -1 + + const mask = (uint64(1) << k) - 1 // k ones + lo := mask & x[0] + + hiWordIndex := (nBits - 1) / 64 + + hiWordBitsAvailable := nBits - hiWordIndex*64 + hiWordBitsUsed := min(hiWordBitsAvailable, k) + + mask_ := uint64(^((1 << (hiWordBitsAvailable - hiWordBitsUsed)) - 1)) + hi := (x[hiWordIndex] & mask_) << (64 - hiWordBitsAvailable) + + mask_ = ^(1<<(k+hiWordBitsUsed) - 1) + mid := (mask_ & x[hiWordIndex-1]) >> hiWordBitsUsed + + return lo | mid | hi } // Sqrt z = √x (mod q) @@ -1379,7 +1508,7 @@ func approximate(x *Element, nBits int) uint64 { return x[0] } - const mask = (uint64(1) << (k - 1)) - 1 // k-1 ones + const mask = (uint64(1) << approxLowBitsN) - 1 // k-1 ones lo := mask & x[0] hiWordIndex := (nBits - 1) / 64 diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_amd64.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_amd64.go new file mode 100644 index 000000000..e02a9d04c --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_amd64.go @@ -0,0 +1,62 @@ +//go:build !purego + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package fp + +import ( + _ "github.com/consensys/gnark-crypto/field/asm/element_4w" + "github.com/consensys/gnark-crypto/utils/cpu" +) + +var supportAdx = cpu.SupportADX + +//go:noescape +func MulBy3(x *Element) + +//go:noescape +func MulBy5(x *Element) + +//go:noescape +func MulBy13(x *Element) + +//go:noescape +func mul(res, x, y *Element) + +//go:noescape +func fromMont(res *Element) + +//go:noescape +func reduce(res *Element) + +// Butterfly sets +// +// a = a + b (mod q) +// b = a - b (mod q) +// +//go:noescape +func Butterfly(a, b *Element) + +// Mul z = x * y (mod q) +// +// x and y must be less than q +func (z *Element) Mul(x, y *Element) *Element { + + // Algorithm 2 of "Faster Montgomery Multiplication and Multi-Scalar-Multiplication for SNARKS" + // by Y. El Housni and G. Botrel https://doi.org/10.46586/tches.v2023.i3.504-521 + + mul(z, x, y) + return z +} + +// Square z = x * x (mod q) +// +// x must be less than q +func (z *Element) Square(x *Element) *Element { + // see Mul for doc. + mul(z, x, x) + return z +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_amd64.s b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_amd64.s new file mode 100644 index 000000000..512d87236 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_amd64.s @@ -0,0 +1,10 @@ +//go:build !purego + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +// We include the hash to force the Go compiler to recompile: 6029369087367900835 +#include "../../../field/asm/element_4w/element_4w_amd64.s" + diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_arm64.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_arm64.go new file mode 100644 index 000000000..4d030715d --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_arm64.go @@ -0,0 +1,70 @@ +//go:build !purego + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package fp + +import ( + _ "github.com/consensys/gnark-crypto/field/asm/element_4w" +) + +// Butterfly sets +// +// a = a + b (mod q) +// b = a - b (mod q) +// +//go:noescape +func Butterfly(a, b *Element) + +//go:noescape +func mul(res, x, y *Element) + +// Mul z = x * y (mod q) +// +// x and y must be less than q +func (z *Element) Mul(x, y *Element) *Element { + mul(z, x, y) + return z +} + +// Square z = x * x (mod q) +// +// x must be less than q +func (z *Element) Square(x *Element) *Element { + // see Mul for doc. + mul(z, x, x) + return z +} + +// MulBy3 x *= 3 (mod q) +func MulBy3(x *Element) { + _x := *x + x.Double(x).Add(x, &_x) +} + +// MulBy5 x *= 5 (mod q) +func MulBy5(x *Element) { + _x := *x + x.Double(x).Double(x).Add(x, &_x) +} + +// MulBy13 x *= 13 (mod q) +func MulBy13(x *Element) { + var y = Element{ + 529957932336199972, + 13952065197595570812, + 769406925088786211, + 2691790815622165739, + } + x.Mul(x, &y) +} + +func fromMont(z *Element) { + _fromMontGeneric(z) +} + +//go:noescape +func reduce(res *Element) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_arm64.s b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_arm64.s new file mode 100644 index 000000000..c8df07e34 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_arm64.s @@ -0,0 +1,10 @@ +//go:build !purego + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +// We include the hash to force the Go compiler to recompile: 1501560133179981797 +#include "../../../field/asm/element_4w/element_4w_arm64.s" + diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_exp.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_exp.go index 315a40b9f..cc21fcbf7 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_exp.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_exp.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -415,388 +404,3 @@ func (z *Element) expBySqrtExp(x Element) *Element { return z } - -// expByLegendreExp is equivalent to z.Exp(x, 183227397098d014dc2822db40c0ac2ecbc0b548b438e5469e10460b6c3e7ea3) -// -// uses github.com/mmcloughlin/addchain v0.4.0 to generate a shorter addition chain -func (z *Element) expByLegendreExp(x Element) *Element { - // addition chain: - // - // _10 = 2*1 - // _11 = 1 + _10 - // _101 = _10 + _11 - // _110 = 1 + _101 - // _1000 = _10 + _110 - // _1101 = _101 + _1000 - // _10010 = _101 + _1101 - // _10011 = 1 + _10010 - // _10100 = 1 + _10011 - // _10111 = _11 + _10100 - // _11100 = _101 + _10111 - // _100000 = _1101 + _10011 - // _100011 = _11 + _100000 - // _101011 = _1000 + _100011 - // _101111 = _10011 + _11100 - // _1000001 = _10010 + _101111 - // _1010011 = _10010 + _1000001 - // _1011011 = _1000 + _1010011 - // _1100001 = _110 + _1011011 - // _1110101 = _10100 + _1100001 - // _10010001 = _11100 + _1110101 - // _10010101 = _100000 + _1110101 - // _10110101 = _100000 + _10010101 - // _10111011 = _110 + _10110101 - // _11000001 = _110 + _10111011 - // _11000011 = _10 + _11000001 - // _11010011 = _10010 + _11000001 - // _11100001 = _100000 + _11000001 - // _11100011 = _10 + _11100001 - // _11100111 = _110 + _11100001 - // i57 = ((_11000001 << 8 + _10010001) << 10 + _11100111) << 7 - // i76 = ((_10111 + i57) << 9 + _10011) << 7 + _1101 - // i109 = ((i76 << 14 + _1010011) << 9 + _11100001) << 8 - // i127 = ((_1000001 + i109) << 10 + _1011011) << 5 + _1101 - // i161 = ((i127 << 8 + _11) << 12 + _101011) << 12 - // i186 = ((_10111011 + i161) << 8 + _101111) << 14 + _10110101 - // i214 = ((i186 << 9 + _10010001) << 5 + _1101) << 12 - // i236 = ((_11100011 + i214) << 8 + _10010101) << 11 + _11010011 - // i268 = ((i236 << 7 + _1100001) << 11 + _100011) << 12 - // i288 = ((_1011011 + i268) << 9 + _11000011) << 8 + _11100111 - // return (i288 << 7 + _1110101) << 5 + _11 - // - // Operations: 246 squares 56 multiplies - - // Allocate Temporaries. - var ( - t0 = new(Element) - t1 = new(Element) - t2 = new(Element) - t3 = new(Element) - t4 = new(Element) - t5 = new(Element) - t6 = new(Element) - t7 = new(Element) - t8 = new(Element) - t9 = new(Element) - t10 = new(Element) - t11 = new(Element) - t12 = new(Element) - t13 = new(Element) - t14 = new(Element) - t15 = new(Element) - t16 = new(Element) - t17 = new(Element) - t18 = new(Element) - t19 = new(Element) - t20 = new(Element) - ) - - // var t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20 Element - // Step 1: t8 = x^0x2 - t8.Square(&x) - - // Step 2: z = x^0x3 - z.Mul(&x, t8) - - // Step 3: t2 = x^0x5 - t2.Mul(t8, z) - - // Step 4: t1 = x^0x6 - t1.Mul(&x, t2) - - // Step 5: t3 = x^0x8 - t3.Mul(t8, t1) - - // Step 6: t9 = x^0xd - t9.Mul(t2, t3) - - // Step 7: t6 = x^0x12 - t6.Mul(t2, t9) - - // Step 8: t18 = x^0x13 - t18.Mul(&x, t6) - - // Step 9: t0 = x^0x14 - t0.Mul(&x, t18) - - // Step 10: t19 = x^0x17 - t19.Mul(z, t0) - - // Step 11: t2 = x^0x1c - t2.Mul(t2, t19) - - // Step 12: t16 = x^0x20 - t16.Mul(t9, t18) - - // Step 13: t4 = x^0x23 - t4.Mul(z, t16) - - // Step 14: t14 = x^0x2b - t14.Mul(t3, t4) - - // Step 15: t12 = x^0x2f - t12.Mul(t18, t2) - - // Step 16: t15 = x^0x41 - t15.Mul(t6, t12) - - // Step 17: t17 = x^0x53 - t17.Mul(t6, t15) - - // Step 18: t3 = x^0x5b - t3.Mul(t3, t17) - - // Step 19: t5 = x^0x61 - t5.Mul(t1, t3) - - // Step 20: t0 = x^0x75 - t0.Mul(t0, t5) - - // Step 21: t10 = x^0x91 - t10.Mul(t2, t0) - - // Step 22: t7 = x^0x95 - t7.Mul(t16, t0) - - // Step 23: t11 = x^0xb5 - t11.Mul(t16, t7) - - // Step 24: t13 = x^0xbb - t13.Mul(t1, t11) - - // Step 25: t20 = x^0xc1 - t20.Mul(t1, t13) - - // Step 26: t2 = x^0xc3 - t2.Mul(t8, t20) - - // Step 27: t6 = x^0xd3 - t6.Mul(t6, t20) - - // Step 28: t16 = x^0xe1 - t16.Mul(t16, t20) - - // Step 29: t8 = x^0xe3 - t8.Mul(t8, t16) - - // Step 30: t1 = x^0xe7 - t1.Mul(t1, t16) - - // Step 38: t20 = x^0xc100 - for s := 0; s < 8; s++ { - t20.Square(t20) - } - - // Step 39: t20 = x^0xc191 - t20.Mul(t10, t20) - - // Step 49: t20 = x^0x3064400 - for s := 0; s < 10; s++ { - t20.Square(t20) - } - - // Step 50: t20 = x^0x30644e7 - t20.Mul(t1, t20) - - // Step 57: t20 = x^0x183227380 - for s := 0; s < 7; s++ { - t20.Square(t20) - } - - // Step 58: t19 = x^0x183227397 - t19.Mul(t19, t20) - - // Step 67: t19 = x^0x30644e72e00 - for s := 0; s < 9; s++ { - t19.Square(t19) - } - - // Step 68: t18 = x^0x30644e72e13 - t18.Mul(t18, t19) - - // Step 75: t18 = x^0x1832273970980 - for s := 0; s < 7; s++ { - t18.Square(t18) - } - - // Step 76: t18 = x^0x183227397098d - t18.Mul(t9, t18) - - // Step 90: t18 = x^0x60c89ce5c2634000 - for s := 0; s < 14; s++ { - t18.Square(t18) - } - - // Step 91: t17 = x^0x60c89ce5c2634053 - t17.Mul(t17, t18) - - // Step 100: t17 = x^0xc19139cb84c680a600 - for s := 0; s < 9; s++ { - t17.Square(t17) - } - - // Step 101: t16 = x^0xc19139cb84c680a6e1 - t16.Mul(t16, t17) - - // Step 109: t16 = x^0xc19139cb84c680a6e100 - for s := 0; s < 8; s++ { - t16.Square(t16) - } - - // Step 110: t15 = x^0xc19139cb84c680a6e141 - t15.Mul(t15, t16) - - // Step 120: t15 = x^0x30644e72e131a029b850400 - for s := 0; s < 10; s++ { - t15.Square(t15) - } - - // Step 121: t15 = x^0x30644e72e131a029b85045b - t15.Mul(t3, t15) - - // Step 126: t15 = x^0x60c89ce5c263405370a08b60 - for s := 0; s < 5; s++ { - t15.Square(t15) - } - - // Step 127: t15 = x^0x60c89ce5c263405370a08b6d - t15.Mul(t9, t15) - - // Step 135: t15 = x^0x60c89ce5c263405370a08b6d00 - for s := 0; s < 8; s++ { - t15.Square(t15) - } - - // Step 136: t15 = x^0x60c89ce5c263405370a08b6d03 - t15.Mul(z, t15) - - // Step 148: t15 = x^0x60c89ce5c263405370a08b6d03000 - for s := 0; s < 12; s++ { - t15.Square(t15) - } - - // Step 149: t14 = x^0x60c89ce5c263405370a08b6d0302b - t14.Mul(t14, t15) - - // Step 161: t14 = x^0x60c89ce5c263405370a08b6d0302b000 - for s := 0; s < 12; s++ { - t14.Square(t14) - } - - // Step 162: t13 = x^0x60c89ce5c263405370a08b6d0302b0bb - t13.Mul(t13, t14) - - // Step 170: t13 = x^0x60c89ce5c263405370a08b6d0302b0bb00 - for s := 0; s < 8; s++ { - t13.Square(t13) - } - - // Step 171: t12 = x^0x60c89ce5c263405370a08b6d0302b0bb2f - t12.Mul(t12, t13) - - // Step 185: t12 = x^0x183227397098d014dc2822db40c0ac2ecbc000 - for s := 0; s < 14; s++ { - t12.Square(t12) - } - - // Step 186: t11 = x^0x183227397098d014dc2822db40c0ac2ecbc0b5 - t11.Mul(t11, t12) - - // Step 195: t11 = x^0x30644e72e131a029b85045b68181585d97816a00 - for s := 0; s < 9; s++ { - t11.Square(t11) - } - - // Step 196: t10 = x^0x30644e72e131a029b85045b68181585d97816a91 - t10.Mul(t10, t11) - - // Step 201: t10 = x^0x60c89ce5c263405370a08b6d0302b0bb2f02d5220 - for s := 0; s < 5; s++ { - t10.Square(t10) - } - - // Step 202: t9 = x^0x60c89ce5c263405370a08b6d0302b0bb2f02d522d - t9.Mul(t9, t10) - - // Step 214: t9 = x^0x60c89ce5c263405370a08b6d0302b0bb2f02d522d000 - for s := 0; s < 12; s++ { - t9.Square(t9) - } - - // Step 215: t8 = x^0x60c89ce5c263405370a08b6d0302b0bb2f02d522d0e3 - t8.Mul(t8, t9) - - // Step 223: t8 = x^0x60c89ce5c263405370a08b6d0302b0bb2f02d522d0e300 - for s := 0; s < 8; s++ { - t8.Square(t8) - } - - // Step 224: t7 = x^0x60c89ce5c263405370a08b6d0302b0bb2f02d522d0e395 - t7.Mul(t7, t8) - - // Step 235: t7 = x^0x30644e72e131a029b85045b68181585d97816a916871ca800 - for s := 0; s < 11; s++ { - t7.Square(t7) - } - - // Step 236: t6 = x^0x30644e72e131a029b85045b68181585d97816a916871ca8d3 - t6.Mul(t6, t7) - - // Step 243: t6 = x^0x183227397098d014dc2822db40c0ac2ecbc0b548b438e546980 - for s := 0; s < 7; s++ { - t6.Square(t6) - } - - // Step 244: t5 = x^0x183227397098d014dc2822db40c0ac2ecbc0b548b438e5469e1 - t5.Mul(t5, t6) - - // Step 255: t5 = x^0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f0800 - for s := 0; s < 11; s++ { - t5.Square(t5) - } - - // Step 256: t4 = x^0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f0823 - t4.Mul(t4, t5) - - // Step 268: t4 = x^0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f0823000 - for s := 0; s < 12; s++ { - t4.Square(t4) - } - - // Step 269: t3 = x^0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b - t3.Mul(t3, t4) - - // Step 278: t3 = x^0x183227397098d014dc2822db40c0ac2ecbc0b548b438e5469e10460b600 - for s := 0; s < 9; s++ { - t3.Square(t3) - } - - // Step 279: t2 = x^0x183227397098d014dc2822db40c0ac2ecbc0b548b438e5469e10460b6c3 - t2.Mul(t2, t3) - - // Step 287: t2 = x^0x183227397098d014dc2822db40c0ac2ecbc0b548b438e5469e10460b6c300 - for s := 0; s < 8; s++ { - t2.Square(t2) - } - - // Step 288: t1 = x^0x183227397098d014dc2822db40c0ac2ecbc0b548b438e5469e10460b6c3e7 - t1.Mul(t1, t2) - - // Step 295: t1 = x^0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b61f380 - for s := 0; s < 7; s++ { - t1.Square(t1) - } - - // Step 296: t0 = x^0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b61f3f5 - t0.Mul(t0, t1) - - // Step 301: t0 = x^0x183227397098d014dc2822db40c0ac2ecbc0b548b438e5469e10460b6c3e7ea0 - for s := 0; s < 5; s++ { - t0.Square(t0) - } - - // Step 302: z = x^0x183227397098d014dc2822db40c0ac2ecbc0b548b438e5469e10460b6c3e7ea3 - z.Mul(z, t0) - - return z -} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_mul_amd64.s b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_mul_amd64.s deleted file mode 100644 index e58b31681..000000000 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_mul_amd64.s +++ /dev/null @@ -1,487 +0,0 @@ -// +build !purego - -// Copyright 2020 ConsenSys Software 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. - -#include "textflag.h" -#include "funcdata.h" - -// modulus q -DATA q<>+0(SB)/8, $0x3c208c16d87cfd47 -DATA q<>+8(SB)/8, $0x97816a916871ca8d -DATA q<>+16(SB)/8, $0xb85045b68181585d -DATA q<>+24(SB)/8, $0x30644e72e131a029 -GLOBL q<>(SB), (RODATA+NOPTR), $32 - -// qInv0 q'[0] -DATA qInv0<>(SB)/8, $0x87d20782e4866389 -GLOBL qInv0<>(SB), (RODATA+NOPTR), $8 - -#define REDUCE(ra0, ra1, ra2, ra3, rb0, rb1, rb2, rb3) \ - MOVQ ra0, rb0; \ - SUBQ q<>(SB), ra0; \ - MOVQ ra1, rb1; \ - SBBQ q<>+8(SB), ra1; \ - MOVQ ra2, rb2; \ - SBBQ q<>+16(SB), ra2; \ - MOVQ ra3, rb3; \ - SBBQ q<>+24(SB), ra3; \ - CMOVQCS rb0, ra0; \ - CMOVQCS rb1, ra1; \ - CMOVQCS rb2, ra2; \ - CMOVQCS rb3, ra3; \ - -// mul(res, x, y *Element) -TEXT ·mul(SB), $24-24 - - // the algorithm is described in the Element.Mul declaration (.go) - // however, to benefit from the ADCX and ADOX carry chains - // we split the inner loops in 2: - // for i=0 to N-1 - // for j=0 to N-1 - // (A,t[j]) := t[j] + x[j]*y[i] + A - // m := t[0]*q'[0] mod W - // C,_ := t[0] + m*q[0] - // for j=1 to N-1 - // (C,t[j-1]) := t[j] + m*q[j] + C - // t[N-1] = C + A - - NO_LOCAL_POINTERS - CMPB ·supportAdx(SB), $1 - JNE l1 - MOVQ x+8(FP), SI - - // x[0] -> DI - // x[1] -> R8 - // x[2] -> R9 - // x[3] -> R10 - MOVQ 0(SI), DI - MOVQ 8(SI), R8 - MOVQ 16(SI), R9 - MOVQ 24(SI), R10 - MOVQ y+16(FP), R11 - - // A -> BP - // t[0] -> R14 - // t[1] -> R13 - // t[2] -> CX - // t[3] -> BX - // clear the flags - XORQ AX, AX - MOVQ 0(R11), DX - - // (A,t[0]) := x[0]*y[0] + A - MULXQ DI, R14, R13 - - // (A,t[1]) := x[1]*y[0] + A - MULXQ R8, AX, CX - ADOXQ AX, R13 - - // (A,t[2]) := x[2]*y[0] + A - MULXQ R9, AX, BX - ADOXQ AX, CX - - // (A,t[3]) := x[3]*y[0] + A - MULXQ R10, AX, BP - ADOXQ AX, BX - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADOXQ AX, BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, R12 - ADCXQ R14, AX - MOVQ R12, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // t[3] = C + A - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ BP, BX - - // clear the flags - XORQ AX, AX - MOVQ 8(R11), DX - - // (A,t[0]) := t[0] + x[0]*y[1] + A - MULXQ DI, AX, BP - ADOXQ AX, R14 - - // (A,t[1]) := t[1] + x[1]*y[1] + A - ADCXQ BP, R13 - MULXQ R8, AX, BP - ADOXQ AX, R13 - - // (A,t[2]) := t[2] + x[2]*y[1] + A - ADCXQ BP, CX - MULXQ R9, AX, BP - ADOXQ AX, CX - - // (A,t[3]) := t[3] + x[3]*y[1] + A - ADCXQ BP, BX - MULXQ R10, AX, BP - ADOXQ AX, BX - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, R12 - ADCXQ R14, AX - MOVQ R12, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // t[3] = C + A - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ BP, BX - - // clear the flags - XORQ AX, AX - MOVQ 16(R11), DX - - // (A,t[0]) := t[0] + x[0]*y[2] + A - MULXQ DI, AX, BP - ADOXQ AX, R14 - - // (A,t[1]) := t[1] + x[1]*y[2] + A - ADCXQ BP, R13 - MULXQ R8, AX, BP - ADOXQ AX, R13 - - // (A,t[2]) := t[2] + x[2]*y[2] + A - ADCXQ BP, CX - MULXQ R9, AX, BP - ADOXQ AX, CX - - // (A,t[3]) := t[3] + x[3]*y[2] + A - ADCXQ BP, BX - MULXQ R10, AX, BP - ADOXQ AX, BX - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, R12 - ADCXQ R14, AX - MOVQ R12, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // t[3] = C + A - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ BP, BX - - // clear the flags - XORQ AX, AX - MOVQ 24(R11), DX - - // (A,t[0]) := t[0] + x[0]*y[3] + A - MULXQ DI, AX, BP - ADOXQ AX, R14 - - // (A,t[1]) := t[1] + x[1]*y[3] + A - ADCXQ BP, R13 - MULXQ R8, AX, BP - ADOXQ AX, R13 - - // (A,t[2]) := t[2] + x[2]*y[3] + A - ADCXQ BP, CX - MULXQ R9, AX, BP - ADOXQ AX, CX - - // (A,t[3]) := t[3] + x[3]*y[3] + A - ADCXQ BP, BX - MULXQ R10, AX, BP - ADOXQ AX, BX - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, R12 - ADCXQ R14, AX - MOVQ R12, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // t[3] = C + A - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ BP, BX - - // reduce element(R14,R13,CX,BX) using temp registers (SI,R12,R11,DI) - REDUCE(R14,R13,CX,BX,SI,R12,R11,DI) - - MOVQ res+0(FP), AX - MOVQ R14, 0(AX) - MOVQ R13, 8(AX) - MOVQ CX, 16(AX) - MOVQ BX, 24(AX) - RET - -l1: - MOVQ res+0(FP), AX - MOVQ AX, (SP) - MOVQ x+8(FP), AX - MOVQ AX, 8(SP) - MOVQ y+16(FP), AX - MOVQ AX, 16(SP) - CALL ·_mulGeneric(SB) - RET - -TEXT ·fromMont(SB), $8-8 - NO_LOCAL_POINTERS - - // the algorithm is described here - // https://hackmd.io/@gnark/modular_multiplication - // when y = 1 we have: - // for i=0 to N-1 - // t[i] = x[i] - // for i=0 to N-1 - // m := t[0]*q'[0] mod W - // C,_ := t[0] + m*q[0] - // for j=1 to N-1 - // (C,t[j-1]) := t[j] + m*q[j] + C - // t[N-1] = C - CMPB ·supportAdx(SB), $1 - JNE l2 - MOVQ res+0(FP), DX - MOVQ 0(DX), R14 - MOVQ 8(DX), R13 - MOVQ 16(DX), CX - MOVQ 24(DX), BX - XORQ DX, DX - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R14, AX - MOVQ BP, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ AX, BX - XORQ DX, DX - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R14, AX - MOVQ BP, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ AX, BX - XORQ DX, DX - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R14, AX - MOVQ BP, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ AX, BX - XORQ DX, DX - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R14, AX - MOVQ BP, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ AX, BX - - // reduce element(R14,R13,CX,BX) using temp registers (SI,DI,R8,R9) - REDUCE(R14,R13,CX,BX,SI,DI,R8,R9) - - MOVQ res+0(FP), AX - MOVQ R14, 0(AX) - MOVQ R13, 8(AX) - MOVQ CX, 16(AX) - MOVQ BX, 24(AX) - RET - -l2: - MOVQ res+0(FP), AX - MOVQ AX, (SP) - CALL ·_fromMontGeneric(SB) - RET diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_ops_amd64.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_ops_amd64.go deleted file mode 100644 index 83bba45ae..000000000 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_ops_amd64.go +++ /dev/null @@ -1,107 +0,0 @@ -//go:build !purego -// +build !purego - -// Copyright 2020 ConsenSys Software 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. - -// Code generated by consensys/gnark-crypto DO NOT EDIT - -package fp - -//go:noescape -func MulBy3(x *Element) - -//go:noescape -func MulBy5(x *Element) - -//go:noescape -func MulBy13(x *Element) - -//go:noescape -func mul(res, x, y *Element) - -//go:noescape -func fromMont(res *Element) - -//go:noescape -func reduce(res *Element) - -// Butterfly sets -// -// a = a + b (mod q) -// b = a - b (mod q) -// -//go:noescape -func Butterfly(a, b *Element) - -// Mul z = x * y (mod q) -// -// x and y must be less than q -func (z *Element) Mul(x, y *Element) *Element { - - // Implements CIOS multiplication -- section 2.3.2 of Tolga Acar's thesis - // https://www.microsoft.com/en-us/research/wp-content/uploads/1998/06/97Acar.pdf - // - // The algorithm: - // - // for i=0 to N-1 - // C := 0 - // for j=0 to N-1 - // (C,t[j]) := t[j] + x[j]*y[i] + C - // (t[N+1],t[N]) := t[N] + C - // - // C := 0 - // m := t[0]*q'[0] mod D - // (C,_) := t[0] + m*q[0] - // for j=1 to N-1 - // (C,t[j-1]) := t[j] + m*q[j] + C - // - // (C,t[N-1]) := t[N] + C - // t[N] := t[N+1] + C - // - // → N is the number of machine words needed to store the modulus q - // → D is the word size. For example, on a 64-bit architecture D is 2 64 - // → x[i], y[i], q[i] is the ith word of the numbers x,y,q - // → q'[0] is the lowest word of the number -q⁻¹ mod r. This quantity is pre-computed, as it does not depend on the inputs. - // → t is a temporary array of size N+2 - // → C, S are machine words. A pair (C,S) refers to (hi-bits, lo-bits) of a two-word number - // - // As described here https://hackmd.io/@gnark/modular_multiplication we can get rid of one carry chain and simplify: - // (also described in https://eprint.iacr.org/2022/1400.pdf annex) - // - // for i=0 to N-1 - // (A,t[0]) := t[0] + x[0]*y[i] - // m := t[0]*q'[0] mod W - // C,_ := t[0] + m*q[0] - // for j=1 to N-1 - // (A,t[j]) := t[j] + x[j]*y[i] + A - // (C,t[j-1]) := t[j] + m*q[j] + C - // - // t[N-1] = C + A - // - // This optimization saves 5N + 2 additions in the algorithm, and can be used whenever the highest bit - // of the modulus is zero (and not all of the remaining bits are set). - - mul(z, x, y) - return z -} - -// Square z = x * x (mod q) -// -// x must be less than q -func (z *Element) Square(x *Element) *Element { - // see Mul for doc. - mul(z, x, x) - return z -} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_ops_amd64.s b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_ops_amd64.s deleted file mode 100644 index 48f34db8f..000000000 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_ops_amd64.s +++ /dev/null @@ -1,230 +0,0 @@ -// +build !purego - -// Copyright 2020 ConsenSys Software 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. - -#include "textflag.h" -#include "funcdata.h" - -// modulus q -DATA q<>+0(SB)/8, $0x3c208c16d87cfd47 -DATA q<>+8(SB)/8, $0x97816a916871ca8d -DATA q<>+16(SB)/8, $0xb85045b68181585d -DATA q<>+24(SB)/8, $0x30644e72e131a029 -GLOBL q<>(SB), (RODATA+NOPTR), $32 - -// qInv0 q'[0] -DATA qInv0<>(SB)/8, $0x87d20782e4866389 -GLOBL qInv0<>(SB), (RODATA+NOPTR), $8 - -#define REDUCE(ra0, ra1, ra2, ra3, rb0, rb1, rb2, rb3) \ - MOVQ ra0, rb0; \ - SUBQ q<>(SB), ra0; \ - MOVQ ra1, rb1; \ - SBBQ q<>+8(SB), ra1; \ - MOVQ ra2, rb2; \ - SBBQ q<>+16(SB), ra2; \ - MOVQ ra3, rb3; \ - SBBQ q<>+24(SB), ra3; \ - CMOVQCS rb0, ra0; \ - CMOVQCS rb1, ra1; \ - CMOVQCS rb2, ra2; \ - CMOVQCS rb3, ra3; \ - -TEXT ·reduce(SB), NOSPLIT, $0-8 - MOVQ res+0(FP), AX - MOVQ 0(AX), DX - MOVQ 8(AX), CX - MOVQ 16(AX), BX - MOVQ 24(AX), SI - - // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10) - - MOVQ DX, 0(AX) - MOVQ CX, 8(AX) - MOVQ BX, 16(AX) - MOVQ SI, 24(AX) - RET - -// MulBy3(x *Element) -TEXT ·MulBy3(SB), NOSPLIT, $0-8 - MOVQ x+0(FP), AX - MOVQ 0(AX), DX - MOVQ 8(AX), CX - MOVQ 16(AX), BX - MOVQ 24(AX), SI - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - - // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10) - - ADDQ 0(AX), DX - ADCQ 8(AX), CX - ADCQ 16(AX), BX - ADCQ 24(AX), SI - - // reduce element(DX,CX,BX,SI) using temp registers (R11,R12,R13,R14) - REDUCE(DX,CX,BX,SI,R11,R12,R13,R14) - - MOVQ DX, 0(AX) - MOVQ CX, 8(AX) - MOVQ BX, 16(AX) - MOVQ SI, 24(AX) - RET - -// MulBy5(x *Element) -TEXT ·MulBy5(SB), NOSPLIT, $0-8 - MOVQ x+0(FP), AX - MOVQ 0(AX), DX - MOVQ 8(AX), CX - MOVQ 16(AX), BX - MOVQ 24(AX), SI - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - - // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10) - - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - - // reduce element(DX,CX,BX,SI) using temp registers (R11,R12,R13,R14) - REDUCE(DX,CX,BX,SI,R11,R12,R13,R14) - - ADDQ 0(AX), DX - ADCQ 8(AX), CX - ADCQ 16(AX), BX - ADCQ 24(AX), SI - - // reduce element(DX,CX,BX,SI) using temp registers (R15,DI,R8,R9) - REDUCE(DX,CX,BX,SI,R15,DI,R8,R9) - - MOVQ DX, 0(AX) - MOVQ CX, 8(AX) - MOVQ BX, 16(AX) - MOVQ SI, 24(AX) - RET - -// MulBy13(x *Element) -TEXT ·MulBy13(SB), NOSPLIT, $0-8 - MOVQ x+0(FP), AX - MOVQ 0(AX), DX - MOVQ 8(AX), CX - MOVQ 16(AX), BX - MOVQ 24(AX), SI - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - - // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10) - - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - - // reduce element(DX,CX,BX,SI) using temp registers (R11,R12,R13,R14) - REDUCE(DX,CX,BX,SI,R11,R12,R13,R14) - - MOVQ DX, R11 - MOVQ CX, R12 - MOVQ BX, R13 - MOVQ SI, R14 - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - - // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10) - - ADDQ R11, DX - ADCQ R12, CX - ADCQ R13, BX - ADCQ R14, SI - - // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10) - - ADDQ 0(AX), DX - ADCQ 8(AX), CX - ADCQ 16(AX), BX - ADCQ 24(AX), SI - - // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10) - - MOVQ DX, 0(AX) - MOVQ CX, 8(AX) - MOVQ BX, 16(AX) - MOVQ SI, 24(AX) - RET - -// Butterfly(a, b *Element) sets a = a + b; b = a - b -TEXT ·Butterfly(SB), NOSPLIT, $0-16 - MOVQ a+0(FP), AX - MOVQ 0(AX), CX - MOVQ 8(AX), BX - MOVQ 16(AX), SI - MOVQ 24(AX), DI - MOVQ CX, R8 - MOVQ BX, R9 - MOVQ SI, R10 - MOVQ DI, R11 - XORQ AX, AX - MOVQ b+8(FP), DX - ADDQ 0(DX), CX - ADCQ 8(DX), BX - ADCQ 16(DX), SI - ADCQ 24(DX), DI - SUBQ 0(DX), R8 - SBBQ 8(DX), R9 - SBBQ 16(DX), R10 - SBBQ 24(DX), R11 - MOVQ $0x3c208c16d87cfd47, R12 - MOVQ $0x97816a916871ca8d, R13 - MOVQ $0xb85045b68181585d, R14 - MOVQ $0x30644e72e131a029, R15 - CMOVQCC AX, R12 - CMOVQCC AX, R13 - CMOVQCC AX, R14 - CMOVQCC AX, R15 - ADDQ R12, R8 - ADCQ R13, R9 - ADCQ R14, R10 - ADCQ R15, R11 - MOVQ R8, 0(DX) - MOVQ R9, 8(DX) - MOVQ R10, 16(DX) - MOVQ R11, 24(DX) - - // reduce element(CX,BX,SI,DI) using temp registers (R8,R9,R10,R11) - REDUCE(CX,BX,SI,DI,R8,R9,R10,R11) - - MOVQ a+0(FP), AX - MOVQ CX, 0(AX) - MOVQ BX, 8(AX) - MOVQ SI, 16(AX) - MOVQ DI, 24(AX) - RET diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_ops_purego.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_purego.go similarity index 80% rename from vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_ops_purego.go rename to vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_purego.go index 93aca54dd..69565d890 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_ops_purego.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/element_purego.go @@ -1,19 +1,7 @@ -//go:build !amd64 || purego -// +build !amd64 purego +//go:build purego || (!amd64 && !arm64) -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -44,14 +32,6 @@ func MulBy13(x *Element) { x.Mul(x, &y) } -// Butterfly sets -// -// a = a + b (mod q) -// b = a - b (mod q) -func Butterfly(a, b *Element) { - _butterflyGeneric(a, b) -} - func fromMont(z *Element) { _fromMontGeneric(z) } @@ -65,48 +45,8 @@ func reduce(z *Element) { // x and y must be less than q func (z *Element) Mul(x, y *Element) *Element { - // Implements CIOS multiplication -- section 2.3.2 of Tolga Acar's thesis - // https://www.microsoft.com/en-us/research/wp-content/uploads/1998/06/97Acar.pdf - // - // The algorithm: - // - // for i=0 to N-1 - // C := 0 - // for j=0 to N-1 - // (C,t[j]) := t[j] + x[j]*y[i] + C - // (t[N+1],t[N]) := t[N] + C - // - // C := 0 - // m := t[0]*q'[0] mod D - // (C,_) := t[0] + m*q[0] - // for j=1 to N-1 - // (C,t[j-1]) := t[j] + m*q[j] + C - // - // (C,t[N-1]) := t[N] + C - // t[N] := t[N+1] + C - // - // → N is the number of machine words needed to store the modulus q - // → D is the word size. For example, on a 64-bit architecture D is 2 64 - // → x[i], y[i], q[i] is the ith word of the numbers x,y,q - // → q'[0] is the lowest word of the number -q⁻¹ mod r. This quantity is pre-computed, as it does not depend on the inputs. - // → t is a temporary array of size N+2 - // → C, S are machine words. A pair (C,S) refers to (hi-bits, lo-bits) of a two-word number - // - // As described here https://hackmd.io/@gnark/modular_multiplication we can get rid of one carry chain and simplify: - // (also described in https://eprint.iacr.org/2022/1400.pdf annex) - // - // for i=0 to N-1 - // (A,t[0]) := t[0] + x[0]*y[i] - // m := t[0]*q'[0] mod W - // C,_ := t[0] + m*q[0] - // for j=1 to N-1 - // (A,t[j]) := t[j] + x[j]*y[i] + A - // (C,t[j-1]) := t[j] + m*q[j] + C - // - // t[N-1] = C + A - // - // This optimization saves 5N + 2 additions in the algorithm, and can be used whenever the highest bit - // of the modulus is zero (and not all of the remaining bits are set). + // Algorithm 2 of "Faster Montgomery Multiplication and Multi-Scalar-Multiplication for SNARKS" + // by Y. El Housni and G. Botrel https://doi.org/10.46586/tches.v2023.i3.504-521 var t0, t1, t2, t3 uint64 var u0, u1, u2, u3 uint64 @@ -441,3 +381,11 @@ func (z *Element) Square(x *Element) *Element { } return z } + +// Butterfly sets +// +// a = a + b (mod q) +// b = a - b (mod q) +func Butterfly(a, b *Element) { + _butterflyGeneric(a, b) +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/vector.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/vector.go index acf1e44ea..46e630879 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/vector.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/vector.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -19,9 +8,12 @@ package fp import ( "bytes" "encoding/binary" + "errors" "fmt" "io" + "math/bits" "runtime" + "slices" "strings" "sync" "sync/atomic" @@ -78,40 +70,84 @@ func (vector *Vector) WriteTo(w io.Writer) (int64, error) { return n, nil } -// AsyncReadFrom reads a vector of big endian encoded Element. -// Length of the vector must be encoded as a uint32 on the first 4 bytes. -// It consumes the needed bytes from the reader and returns the number of bytes read and an error if any. -// It also returns a channel that will be closed when the validation is done. -// The validation consist of checking that the elements are smaller than the modulus, and -// converting them to montgomery form. -func (vector *Vector) AsyncReadFrom(r io.Reader) (int64, error, chan error) { +// AsyncReadFrom implements an asynchronous version of [Vector.ReadFrom]. It +// reads the reader r in full and then performs the validation and conversion to +// Montgomery form separately in a goroutine. Any error encountered during +// reading is returned directly, while errors encountered during +// validation/conversion are sent on the returned channel. Thus the caller must +// wait on the channel to ensure the vector is ready to use. The method +// additionally returns the number of bytes read from r. +// +// The errors during reading can be: +// - an error while reading from r; +// - not enough bytes in r to read the full vector indicated by header. +// +// The reader can contain more bytes than needed to decode the vector, in which +// case the extra bytes are ignored. In that case the reader is not seeked nor +// read further. +// +// The method allocates sufficiently large slice to store the vector. If the +// current slice fits the vector, it is reused, otherwise the slice is grown to +// fit the vector. +// +// The serialized encoding is as follows: +// - first 4 bytes: length of the vector as a big-endian uint32 +// - for each element of the vector, [Bytes] bytes representing the element in +// big-endian encoding. +func (vector *Vector) AsyncReadFrom(r io.Reader) (int64, error, chan error) { // nolint ST1008 chErr := make(chan error, 1) var buf [Bytes]byte if read, err := io.ReadFull(r, buf[:4]); err != nil { close(chErr) return int64(read), err, chErr } - sliceLen := binary.BigEndian.Uint32(buf[:4]) - - n := int64(4) - (*vector) = make(Vector, sliceLen) - if sliceLen == 0 { + headerSliceLen := uint64(binary.BigEndian.Uint32(buf[:4])) + + // to avoid allocating too large slice when the header is tampered, we limit + // the maximum allocation. We set the target to 4GB. This incurs a performance + // hit when reading very large slices, but protects against OOM. + targetSize := uint64(1 << 32) // 4GB + if bits.UintSize == 32 { + // reduce target size to 1GB on 32 bits architectures + targetSize = uint64(1 << 30) // 1GB + } + maxAllocateSliceLength := targetSize / uint64(Bytes) + + totalRead := int64(4) + *vector = (*vector)[:0] + if headerSliceLen == 0 { + // if the vector was nil previously even by reslicing we have a nil vector. + // but we want to have an empty slice to indicate that the vector has zero length. + if *vector == nil { + *vector = []Element{} + } + // we return already here to avoid launching a goroutine doing nothing below close(chErr) - return n, nil, chErr + return totalRead, nil, chErr } - bSlice := unsafe.Slice((*byte)(unsafe.Pointer(&(*vector)[0])), sliceLen*Bytes) - read, err := io.ReadFull(r, bSlice) - n += int64(read) - if err != nil { - close(chErr) - return n, err, chErr + for i := uint64(0); i < headerSliceLen; i += maxAllocateSliceLength { + if len(*vector) <= int(i) { + (*vector) = append(*vector, make([]Element, int(min(headerSliceLen-i, maxAllocateSliceLength)))...) + } + bSlice := unsafe.Slice((*byte)(unsafe.Pointer(&(*vector)[i])), int(min(headerSliceLen-i, maxAllocateSliceLength))*Bytes) + read, err := io.ReadFull(r, bSlice) + totalRead += int64(read) + if errors.Is(err, io.ErrUnexpectedEOF) { + close(chErr) + return totalRead, fmt.Errorf("less data than expected: read %d elements, expected %d", i+uint64(read)/Bytes, headerSliceLen), chErr + } + if err != nil { + close(chErr) + return totalRead, err, chErr + } } + bSlice := unsafe.Slice((*byte)(unsafe.Pointer(&(*vector)[0])), int(headerSliceLen)*Bytes) go func() { var cptErrors uint64 // process the elements in parallel - execute(int(sliceLen), func(start, end int) { + execute(int(headerSliceLen), func(start, end int) { var z Element for i := start; i < end; i++ { @@ -138,35 +174,72 @@ func (vector *Vector) AsyncReadFrom(r io.Reader) (int64, error, chan error) { } close(chErr) }() - return n, nil, chErr + return totalRead, nil, chErr } -// ReadFrom implements io.ReaderFrom and reads a vector of big endian encoded Element. -// Length of the vector must be encoded as a uint32 on the first 4 bytes. +// ReadFrom reads the vector from the reader r. It returns the number of bytes +// read and an error, if any. The errors can be: +// - an error while reading from r; +// - not enough bytes in r to read the full vector indicated by header; +// - when decoding the bytes into elements. +// +// The reader can contain more bytes than needed to decode the vector, in which case +// the extra bytes are ignored. In that case the reader is not seeked nor read further. +// +// The method allocates sufficiently large slice to store the vector. If the current slice fits +// the vector, it is reused, otherwise the slice is grown to fit the vector. +// +// The serialized encoding is as follows: +// - first 4 bytes: length of the vector as a big-endian uint32 +// - for each element of the vector, [Bytes] bytes representing the element in big-endian encoding. +// +// The method implements [io.ReaderFrom] interface. func (vector *Vector) ReadFrom(r io.Reader) (int64, error) { - var buf [Bytes]byte if read, err := io.ReadFull(r, buf[:4]); err != nil { return int64(read), err } - sliceLen := binary.BigEndian.Uint32(buf[:4]) - - n := int64(4) - (*vector) = make(Vector, sliceLen) + headerSliceLen := uint64(binary.BigEndian.Uint32(buf[:4])) + + // to avoid allocating too large slice when the header is tampered, we limit + // the maximum allocation. We set the target to 4GB. This incurs a performance + // hit when reading very large slices, but protects against OOM. + targetSize := uint64(1 << 32) // 4GB + if bits.UintSize == 32 { + // reduce target size to 1GB on 32 bits architectures + targetSize = uint64(1 << 30) // 1GB + } + maxAllocateSliceLength := targetSize / uint64(Bytes) + + totalRead := int64(4) // include already the header length + *vector = (*vector)[:0] + // if the vector was nil previously even by reslicing we have a nil vector. But we want + // to have an empty slice to indicate that the vector has zero length. When headerSliceLen == 0 + // we handle this edge case after reading the header as the loop body below is skipped. + if headerSliceLen == 0 && *vector == nil { + *vector = []Element{} + } - for i := 0; i < int(sliceLen); i++ { + for i := uint64(0); i < headerSliceLen; i++ { read, err := io.ReadFull(r, buf[:]) - n += int64(read) + totalRead += int64(read) + if errors.Is(err, io.ErrUnexpectedEOF) { + return totalRead, fmt.Errorf("less data than expected: read %d elements, expected %d", i, headerSliceLen) + } if err != nil { - return n, err + return totalRead, fmt.Errorf("error reading element %d: %w", i, err) } - (*vector)[i], err = BigEndian.Element(&buf) + if uint64(cap(*vector)) <= i { + (*vector) = slices.Grow(*vector, int(min(headerSliceLen-i, maxAllocateSliceLength))) + } + el, err := BigEndian.Element(&buf) if err != nil { - return n, err + return totalRead, fmt.Errorf("error decoding element %d: %w", i, err) } + *vector = append(*vector, el) } - return n, nil + return totalRead, nil } // String implements fmt.Stringer interface @@ -199,6 +272,88 @@ func (vector Vector) Swap(i, j int) { vector[i], vector[j] = vector[j], vector[i] } +// SetRandom sets the elements in vector to independent uniform random values in [0, q). +// +// This might error only if reading from crypto/rand.Reader errors, +// in which case the values in vector are undefined. +func (vector Vector) SetRandom() error { + for i := range vector { + if _, err := vector[i].SetRandom(); err != nil { + return err + } + } + return nil +} + +// MustSetRandom sets the elements in vector to independent uniform random values in [0, q). +// +// It panics if reading from crypto/rand.Reader errors. +func (vector Vector) MustSetRandom() { + for i := range vector { + if _, err := vector[i].SetRandom(); err != nil { + panic(err) + } + } +} + +// Equal returns true if vector and other have the same length and same elements. +func (vector Vector) Equal(other Vector) bool { + return slices.Equal(vector, other) +} + +func addVecGeneric(res, a, b Vector) { + if len(a) != len(b) || len(a) != len(res) { + panic("vector.Add: vectors don't have the same length") + } + for i := 0; i < len(a); i++ { + res[i].Add(&a[i], &b[i]) + } +} + +func subVecGeneric(res, a, b Vector) { + if len(a) != len(b) || len(a) != len(res) { + panic("vector.Sub: vectors don't have the same length") + } + for i := 0; i < len(a); i++ { + res[i].Sub(&a[i], &b[i]) + } +} + +func scalarMulVecGeneric(res, a Vector, b *Element) { + if len(a) != len(res) { + panic("vector.ScalarMul: vectors don't have the same length") + } + for i := 0; i < len(a); i++ { + res[i].Mul(&a[i], b) + } +} + +func sumVecGeneric(res *Element, a Vector) { + for i := 0; i < len(a); i++ { + res.Add(res, &a[i]) + } +} + +func innerProductVecGeneric(res *Element, a, b Vector) { + if len(a) != len(b) { + panic("vector.InnerProduct: vectors don't have the same length") + } + var tmp Element + for i := 0; i < len(a); i++ { + tmp.Mul(&a[i], &b[i]) + res.Add(res, &tmp) + } +} + +func mulVecGeneric(res, a, b Vector) { + if len(a) != len(b) || len(a) != len(res) { + panic("vector.Mul: vectors don't have the same length") + } + for i := 0; i < len(a); i++ { + res[i].Mul(&a[i], &b[i]) + } +} + // TODO @gbotrel make a public package out of that. // execute executes the work function in parallel. // this is copy paste from internal/parallel/parallel.go diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/vector_amd64.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/vector_amd64.go new file mode 100644 index 000000000..74d90a2e3 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/vector_amd64.go @@ -0,0 +1,154 @@ +//go:build !purego + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package fp + +import ( + _ "github.com/consensys/gnark-crypto/field/asm/element_4w" + "github.com/consensys/gnark-crypto/utils/cpu" +) + +// Add adds two vectors element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) Add(a, b Vector) { + if len(a) != len(b) || len(a) != len(*vector) { + panic("vector.Add: vectors don't have the same length") + } + n := uint64(len(a)) + addVec(&(*vector)[0], &a[0], &b[0], n) +} + +//go:noescape +func addVec(res, a, b *Element, n uint64) + +// Sub subtracts two vectors element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) Sub(a, b Vector) { + if len(a) != len(b) || len(a) != len(*vector) { + panic("vector.Sub: vectors don't have the same length") + } + subVec(&(*vector)[0], &a[0], &b[0], uint64(len(a))) +} + +//go:noescape +func subVec(res, a, b *Element, n uint64) + +// ScalarMul multiplies a vector by a scalar element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) ScalarMul(a Vector, b *Element) { + if len(a) != len(*vector) { + panic("vector.ScalarMul: vectors don't have the same length") + } + const maxN = (1 << 32) - 1 + if !cpu.SupportAVX512 || uint64(len(a)) >= maxN { + // call scalarMulVecGeneric + scalarMulVecGeneric(*vector, a, b) + return + } + n := uint64(len(a)) + if n == 0 { + return + } + // the code for scalarMul is identical to mulVec; and it expects at least + // 2 elements in the vector to fill the Z registers + var bb [2]Element + bb[0] = *b + bb[1] = *b + const blockSize = 16 + scalarMulVec(&(*vector)[0], &a[0], &bb[0], n/blockSize, qInvNeg, &patterns[0]) + if n%blockSize != 0 { + // call scalarMulVecGeneric on the rest + start := n - n%blockSize + scalarMulVecGeneric((*vector)[start:], a[start:], b) + } +} + +//go:noescape +func scalarMulVec(res, a, b *Element, n uint64, qInvNeg uint64, patterns *uint64) + +// Sum computes the sum of all elements in the vector. +func (vector *Vector) Sum() (res Element) { + n := uint64(len(*vector)) + if n == 0 { + return + } + const minN = 16 * 7 // AVX512 slower than generic for small n + const maxN = (1 << 32) - 1 + if !cpu.SupportAVX512 || n <= minN || n >= maxN { + // call sumVecGeneric + sumVecGeneric(&res, *vector) + return + } + sumVec(&res, &(*vector)[0], uint64(len(*vector))) + return +} + +//go:noescape +func sumVec(res *Element, a *Element, n uint64) + +// InnerProduct computes the inner product of two vectors. +// It panics if the vectors don't have the same length. +func (vector *Vector) InnerProduct(other Vector) (res Element) { + n := uint64(len(*vector)) + if n == 0 { + return + } + if n != uint64(len(other)) { + panic("vector.InnerProduct: vectors don't have the same length") + } + const maxN = (1 << 32) - 1 + if !cpu.SupportAVX512 || n >= maxN { + // call innerProductVecGeneric + // note; we could split the vector into smaller chunks and call innerProductVec + innerProductVecGeneric(&res, *vector, other) + return + } + innerProdVec(&res[0], &(*vector)[0], &other[0], uint64(len(*vector))) + + return +} + +//go:noescape +func innerProdVec(res *uint64, a, b *Element, n uint64) + +// Mul multiplies two vectors element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) Mul(a, b Vector) { + if len(a) != len(b) || len(a) != len(*vector) { + panic("vector.Mul: vectors don't have the same length") + } + n := uint64(len(a)) + if n == 0 { + return + } + const maxN = (1 << 32) - 1 + if !cpu.SupportAVX512 || n >= maxN { + // call mulVecGeneric + mulVecGeneric(*vector, a, b) + return + } + + const blockSize = 16 + mulVec(&(*vector)[0], &a[0], &b[0], n/blockSize, qInvNeg, &patterns[0]) + if n%blockSize != 0 { + // call mulVecGeneric on the rest + start := n - n%blockSize + mulVecGeneric((*vector)[start:], a[start:], b[start:]) + } + +} + +// Patterns use for transposing the vectors in mulVec +var ( + patterns = [8 * 4]uint64{0, 8, 1, 9, 2, 10, 3, 11, + 12, 4, 13, 5, 14, 6, 15, 7, + 0, 1, 8, 9, 2, 3, 10, 11, + 12, 13, 4, 5, 14, 15, 6, 7} +) + +//go:noescape +func mulVec(res, a, b *Element, n uint64, qInvNeg uint64, patterns *uint64) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/vector_purego.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/vector_purego.go new file mode 100644 index 000000000..98343052a --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fp/vector_purego.go @@ -0,0 +1,45 @@ +//go:build purego || !amd64 + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package fp + +// Add adds two vectors element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) Add(a, b Vector) { + addVecGeneric(*vector, a, b) +} + +// Sub subtracts two vectors element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) Sub(a, b Vector) { + subVecGeneric(*vector, a, b) +} + +// ScalarMul multiplies a vector by a scalar element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) ScalarMul(a Vector, b *Element) { + scalarMulVecGeneric(*vector, a, b) +} + +// Sum computes the sum of all elements in the vector. +func (vector *Vector) Sum() (res Element) { + sumVecGeneric(&res, *vector) + return +} + +// InnerProduct computes the inner product of two vectors. +// It panics if the vectors don't have the same length. +func (vector *Vector) InnerProduct(other Vector) (res Element) { + innerProductVecGeneric(&res, *vector, other) + return +} + +// Mul multiplies two vectors element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) Mul(a, b Vector) { + mulVecGeneric(*vector, a, b) +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/arith.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/arith.go index 7cfd55da1..8dbae56e3 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/arith.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/arith.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -58,16 +47,3 @@ func madd3(a, b, c, d, e uint64) (hi uint64, lo uint64) { hi, _ = bits.Add64(hi, e, carry) return } -func max(a int, b int) int { - if a > b { - return a - } - return b -} - -func min(a int, b int) int { - if a < b { - return a - } - return b -} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/asm.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/asm.go deleted file mode 100644 index da061913b..000000000 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/asm.go +++ /dev/null @@ -1,27 +0,0 @@ -//go:build !noadx -// +build !noadx - -// Copyright 2020 ConsenSys Software 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. - -// Code generated by consensys/gnark-crypto DO NOT EDIT - -package fr - -import "golang.org/x/sys/cpu" - -var ( - supportAdx = cpu.X86.HasADX && cpu.X86.HasBMI2 - _ = supportAdx -) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/asm_noadx.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/asm_noadx.go deleted file mode 100644 index 7f52ffa19..000000000 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/asm_noadx.go +++ /dev/null @@ -1,28 +0,0 @@ -//go:build noadx -// +build noadx - -// Copyright 2020 ConsenSys Software 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. - -// Code generated by consensys/gnark-crypto DO NOT EDIT - -package fr - -// note: this is needed for test purposes, as dynamically changing supportAdx doesn't flag -// certain errors (like fatal error: missing stackmap) -// this ensures we test all asm path. -var ( - supportAdx = false - _ = supportAdx -) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/doc.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/doc.go index 35388f880..49b9df511 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/doc.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/doc.go @@ -1,22 +1,13 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT // Package fr contains field arithmetic operations for modulus = 0x30644e...000001. // -// The API is similar to math/big (big.Int), but the operations are significantly faster (up to 20x for the modular multiplication on amd64, see also https://hackmd.io/@gnark/modular_multiplication) +// The API is similar to math/big (big.Int), but the operations are significantly faster (up to 20x). +// +// Additionally fr.Vector offers an API to manipulate []Element using AVX512 instructions if available. // // The modulus is hardcoded in all the operations. // @@ -49,5 +40,7 @@ // // # Warning // -// This code has not been audited and is provided as-is. In particular, there is no security guarantees such as constant time implementation or side-channel attack resistance. +// There is no security guarantees such as constant time implementation or side-channel attack resistance. +// This code is provided as-is. Partially audited, see https://github.com/Consensys/gnark/tree/master/audits +// for more details. package fr diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element.go index cda0b2c28..30249f8b0 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -54,10 +43,10 @@ const ( // Field modulus q const ( - q0 uint64 = 4891460686036598785 - q1 uint64 = 2896914383306846353 - q2 uint64 = 13281191951274694749 - q3 uint64 = 3486998266802970665 + q0 = 4891460686036598785 + q1 = 2896914383306846353 + q2 = 13281191951274694749 + q3 = 3486998266802970665 ) var qElement = Element{ @@ -79,7 +68,10 @@ func Modulus() *big.Int { // q + r'.r = 1, i.e., qInvNeg = - q⁻¹ mod r // used for Montgomery reduction -const qInvNeg uint64 = 14042775128853446655 +const qInvNeg = 14042775128853446655 + +// mu = 2^288 / q needed for partial Barrett reduction +const mu uint64 = 22721021478 func init() { _modulus.SetString("30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001", 16) @@ -129,7 +121,7 @@ func (z *Element) Set(x *Element) *Element { } // SetInterface converts provided interface into Element -// returns an error if provided type is not supported +// returns an error if provided type is not supported. // supported types: // // Element @@ -350,6 +342,16 @@ func (z *Element) SetRandom() (*Element, error) { } } +// MustSetRandom sets z to a uniform random value in [0, q). +// +// It panics if reading from crypto/rand.Reader errors. +func (z *Element) MustSetRandom() *Element { + if _, err := z.SetRandom(); err != nil { + panic(err) + } + return z +} + // smallerThanModulus returns true if z < q // This is not constant time func (z *Element) smallerThanModulus() bool { @@ -477,32 +479,8 @@ func (z *Element) Select(c int, x0 *Element, x1 *Element) *Element { // and is used for testing purposes. func _mulGeneric(z, x, y *Element) { - // Implements CIOS multiplication -- section 2.3.2 of Tolga Acar's thesis - // https://www.microsoft.com/en-us/research/wp-content/uploads/1998/06/97Acar.pdf - // - // The algorithm: - // - // for i=0 to N-1 - // C := 0 - // for j=0 to N-1 - // (C,t[j]) := t[j] + x[j]*y[i] + C - // (t[N+1],t[N]) := t[N] + C - // - // C := 0 - // m := t[0]*q'[0] mod D - // (C,_) := t[0] + m*q[0] - // for j=1 to N-1 - // (C,t[j-1]) := t[j] + m*q[j] + C - // - // (C,t[N-1]) := t[N] + C - // t[N] := t[N+1] + C - // - // → N is the number of machine words needed to store the modulus q - // → D is the word size. For example, on a 64-bit architecture D is 2 64 - // → x[i], y[i], q[i] is the ith word of the numbers x,y,q - // → q'[0] is the lowest word of the number -q⁻¹ mod r. This quantity is pre-computed, as it does not depend on the inputs. - // → t is a temporary array of size N+2 - // → C, S are machine words. A pair (C,S) refers to (hi-bits, lo-bits) of a two-word number + // Algorithm 2 of "Faster Montgomery Multiplication and Multi-Scalar-Multiplication for SNARKS" + // by Y. El Housni and G. Botrel https://doi.org/10.46586/tches.v2023.i3.504-521 var t [5]uint64 var D uint64 @@ -960,7 +938,7 @@ func (z *Element) SetBigInt(v *big.Int) *Element { // v == 0 return z } else if c != 1 && v.Cmp(&zero) != -1 { - // 0 < v < q + // 0 <= v < q return z.setBigInt(v) } @@ -1087,6 +1065,8 @@ type ByteOrder interface { String() string } +var errInvalidEncoding = errors.New("invalid fr.Element encoding") + // BigEndian is the big-endian implementation of ByteOrder and AppendByteOrder. var BigEndian bigEndian @@ -1102,7 +1082,7 @@ func (bigEndian) Element(b *[Bytes]byte) (Element, error) { z[3] = binary.BigEndian.Uint64((*b)[0:8]) if !z.smallerThanModulus() { - return Element{}, errors.New("invalid fr.Element encoding") + return Element{}, errInvalidEncoding } z.toMont() @@ -1132,7 +1112,7 @@ func (littleEndian) Element(b *[Bytes]byte) (Element, error) { z[3] = binary.LittleEndian.Uint64((*b)[24:32]) if !z.smallerThanModulus() { - return Element{}, errors.New("invalid fr.Element encoding") + return Element{}, errInvalidEncoding } z.toMont() @@ -1151,19 +1131,168 @@ func (littleEndian) String() string { return "LittleEndian" } // Legendre returns the Legendre symbol of z (either +1, -1, or 0.) func (z *Element) Legendre() int { - var l Element - // z^((q-1)/2) - l.expByLegendreExp(*z) - if l.IsZero() { - return 0 + // Adapts "Optimized Binary GCD for Modular Inversion" + // https://github.com/pornin/bingcd/blob/main/doc/bingcd.pdf + // For a faithful implementation of Pornin20 see [Inverse]. + + // We don't need to account for z being in Montgomery form. + // (xR|q) = (x|q)(R|q). R is a square (an even power of 2), so (R|q) = 1. + a := *z + b := Element{ + q0, + q1, + q2, + q3, + } // b := q + + // Update factors: we get [a; b] ← [f₀ g₀; f₁ g₁] [a; b] + // cᵢ = fᵢ + 2³¹ - 1 + 2³² * (gᵢ + 2³¹ - 1) + var c0, c1 int64 + + var s Element + + l := 1 // loop invariant: (x|q) = (a|b) . l + // This means that every time a and b are updated into a' and b', + // l is updated into l' = (x|q)(a'|b')=(x|q)(a|b)(a|b)(a'|b') = l (a|b)(a'|b') + // During the algorithm's run, there is no guarantee that b remains prime, or even positive. + // Therefore, we use the properties of the Kronecker symbol, a generalization of the Legendre symbol to all integers. + + for !a.IsZero() { + n := max(a.BitLen(), b.BitLen()) + aApprox, bApprox := approximateForLegendre(&a, n), approximateForLegendre(&b, n) + + // f₀, g₀, f₁, g₁ = 1, 0, 0, 1 + c0, c1 = updateFactorIdentityMatrixRow0, updateFactorIdentityMatrixRow1 + + const nbIterations = k - 2 + // running fewer iterations because we need access to 3 low bits from b, rather than 1 in the inversion algorithm + for range nbIterations { + + if aApprox&1 == 0 { + aApprox /= 2 + + // update the Kronecker symbol + // + // (a/2 | b) (2|b) = (a|b) + // + // b is either odd or zero, the latter case implying a non-trivial GCD and an ultimate result of 0, + // regardless of what value l holds. + // So in updating l, we may assume that b is odd. + // Since a is even, we only need to correctly compute l if b is odd. + // if b is also even, the non-trivial GCD will result in the function returning 0 anyway. + // so we may here assume b is odd. + // (2|b) = 1 if b ≡ 1 or 7 (mod 8), and -1 if b ≡ 3 or 5 (mod 8) + if bMod8 := bApprox & 7; bMod8 == 3 || bMod8 == 5 { + l = -l + } + + } else { + s, borrow := bits.Sub64(aApprox, bApprox, 0) + if borrow == 1 { + // Compute (b-a|a) + // (x-y|z) = (x|z) unless z < 0 and sign(x-y) ≠ sign(x) + // Pornin20 asserts that at least one of a and b is non-negative. + // If a is non-negative, we immediately get (b-a|a) = (b|a) + // If a is negative, b-a > b. But b is already non-negative, so the b-a and b have the same sign. + // Thus in that case also (b-a|a) = (b|a) + // Since not both a and b are negative, we get a quadratic reciprocity law + // like that of the Legendre symbol: (b|a) = (a|b), unless a, b ≡ 3 (mod 4), in which case (b|a) = -(a|b) + if bApprox&3 == 3 && aApprox&3 == 3 { + l = -l + } + + s = bApprox - aApprox + bApprox = aApprox + c0, c1 = c1, c0 + } + + aApprox = s / 2 + c0 = c0 - c1 + + // update l to reflect halving a, just like in the case where a is even + if bMod8 := bApprox & 7; bMod8 == 3 || bMod8 == 5 { + l = -l + } + } + + c1 *= 2 + } + + s = a + + var g0 int64 + // from this point on c0 aliases for f0 + c0, g0 = updateFactorsDecompose(c0) + aHi := a.linearCombNonModular(&s, c0, &b, g0) + if aHi&signBitSelector != 0 { + // if aHi < 0 + aHi = negL(&a, aHi) + // Since a is negative, b is not and hence b ≠ -1 + // So we get (-a|b)=(-1|b)(a|b) + // b is odd so we get (-1|b) = 1 if b ≡ 1 (mod 4) and -1 otherwise. + if bApprox&3 == 3 { // we still have two valid lower bits for b + l = -l + } + } + // right-shift a by k-2 bits + a[0] = (a[0] >> nbIterations) | ((a[1]) << (2*k - nbIterations)) + a[1] = (a[1] >> nbIterations) | ((a[2]) << (2*k - nbIterations)) + a[2] = (a[2] >> nbIterations) | ((a[3]) << (2*k - nbIterations)) + a[3] = (a[3] >> nbIterations) | (aHi << (2*k - nbIterations)) + + var f1 int64 + // from this point on c1 aliases for g0 + f1, c1 = updateFactorsDecompose(c1) + bHi := b.linearCombNonModular(&s, f1, &b, c1) + if bHi&signBitSelector != 0 { + // if bHi < 0 + bHi = negL(&b, bHi) + // no need to update l, since we know a ≥ 0 + // (a|-1) = 1 if a ≥ 0 + } + // right-shift b by k-2 bits + b[0] = (b[0] >> nbIterations) | ((b[1]) << (2*k - nbIterations)) + b[1] = (b[1] >> nbIterations) | ((b[2]) << (2*k - nbIterations)) + b[2] = (b[2] >> nbIterations) | ((b[3]) << (2*k - nbIterations)) + b[3] = (b[3] >> nbIterations) | (bHi << (2*k - nbIterations)) } - // if l == 1 - if l.IsOne() { - return 1 + if b[0] == 1 && (b[1]|b[2]|b[3]) == 0 { + return l // (0|1) = 1 + } else { + return 0 // if b ≠ 1, then (z,q) ≠ 0 ⇒ (z|q) = 0 + } +} + +// approximate a big number x into a single 64 bit word using its uppermost and lowermost bits. +// If x fits in a word as is, no approximation necessary. +// This differs from the standard approximate function in that in the Legendre symbol computation +// we need to access the 3 low bits of b, rather than just one. So lo ≥ n+2 where n is the number of inner iterations. +// The requirement on the high bits is unchanged, hi ≥ n+1. +// Thus we hit a maximum of hi = lo = k and n = k-2 as opposed to n = lo = k-1 and hi = k+1 in the standard approximate function. +// Since we are doing fewer iterations than in the inversion algorithm, all the arguments on bounds for update factors remain valid. +func approximateForLegendre(x *Element, nBits int) uint64 { + + if nBits <= 64 { + return x[0] } - return -1 + + const mask = (uint64(1) << k) - 1 // k ones + lo := mask & x[0] + + hiWordIndex := (nBits - 1) / 64 + + hiWordBitsAvailable := nBits - hiWordIndex*64 + hiWordBitsUsed := min(hiWordBitsAvailable, k) + + mask_ := uint64(^((1 << (hiWordBitsAvailable - hiWordBitsUsed)) - 1)) + hi := (x[hiWordIndex] & mask_) << (64 - hiWordBitsAvailable) + + mask_ = ^(1<<(k+hiWordBitsUsed) - 1) + mid := (mask_ & x[hiWordIndex-1]) >> hiWordBitsUsed + + return lo | mid | hi } // Sqrt z = √x (mod q) @@ -1431,7 +1560,7 @@ func approximate(x *Element, nBits int) uint64 { return x[0] } - const mask = (uint64(1) << (k - 1)) - 1 // k-1 ones + const mask = (uint64(1) << approxLowBitsN) - 1 // k-1 ones lo := mask & x[0] hiWordIndex := (nBits - 1) / 64 diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_amd64.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_amd64.go new file mode 100644 index 000000000..c282ebc9f --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_amd64.go @@ -0,0 +1,62 @@ +//go:build !purego + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package fr + +import ( + _ "github.com/consensys/gnark-crypto/field/asm/element_4w" + "github.com/consensys/gnark-crypto/utils/cpu" +) + +var supportAdx = cpu.SupportADX + +//go:noescape +func MulBy3(x *Element) + +//go:noescape +func MulBy5(x *Element) + +//go:noescape +func MulBy13(x *Element) + +//go:noescape +func mul(res, x, y *Element) + +//go:noescape +func fromMont(res *Element) + +//go:noescape +func reduce(res *Element) + +// Butterfly sets +// +// a = a + b (mod q) +// b = a - b (mod q) +// +//go:noescape +func Butterfly(a, b *Element) + +// Mul z = x * y (mod q) +// +// x and y must be less than q +func (z *Element) Mul(x, y *Element) *Element { + + // Algorithm 2 of "Faster Montgomery Multiplication and Multi-Scalar-Multiplication for SNARKS" + // by Y. El Housni and G. Botrel https://doi.org/10.46586/tches.v2023.i3.504-521 + + mul(z, x, y) + return z +} + +// Square z = x * x (mod q) +// +// x must be less than q +func (z *Element) Square(x *Element) *Element { + // see Mul for doc. + mul(z, x, x) + return z +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_amd64.s b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_amd64.s new file mode 100644 index 000000000..512d87236 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_amd64.s @@ -0,0 +1,10 @@ +//go:build !purego + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +// We include the hash to force the Go compiler to recompile: 6029369087367900835 +#include "../../../field/asm/element_4w/element_4w_amd64.s" + diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_arm64.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_arm64.go new file mode 100644 index 000000000..b99b03a7e --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_arm64.go @@ -0,0 +1,70 @@ +//go:build !purego + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package fr + +import ( + _ "github.com/consensys/gnark-crypto/field/asm/element_4w" +) + +// Butterfly sets +// +// a = a + b (mod q) +// b = a - b (mod q) +// +//go:noescape +func Butterfly(a, b *Element) + +//go:noescape +func mul(res, x, y *Element) + +// Mul z = x * y (mod q) +// +// x and y must be less than q +func (z *Element) Mul(x, y *Element) *Element { + mul(z, x, y) + return z +} + +// Square z = x * x (mod q) +// +// x must be less than q +func (z *Element) Square(x *Element) *Element { + // see Mul for doc. + mul(z, x, x) + return z +} + +// MulBy3 x *= 3 (mod q) +func MulBy3(x *Element) { + _x := *x + x.Double(x).Add(x, &_x) +} + +// MulBy5 x *= 5 (mod q) +func MulBy5(x *Element) { + _x := *x + x.Double(x).Double(x).Add(x, &_x) +} + +// MulBy13 x *= 13 (mod q) +func MulBy13(x *Element) { + var y = Element{ + 17868810749992763324, + 5924006745939515753, + 769406925088786241, + 2691790815622165739, + } + x.Mul(x, &y) +} + +func fromMont(z *Element) { + _fromMontGeneric(z) +} + +//go:noescape +func reduce(res *Element) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_arm64.s b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_arm64.s new file mode 100644 index 000000000..c8df07e34 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_arm64.s @@ -0,0 +1,10 @@ +//go:build !purego + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +// We include the hash to force the Go compiler to recompile: 1501560133179981797 +#include "../../../field/asm/element_4w/element_4w_arm64.s" + diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_exp.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_exp.go index e8c4da792..dca75611e 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_exp.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_exp.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -410,410 +399,3 @@ func (z *Element) expBySqrtExp(x Element) *Element { return z } - -// expByLegendreExp is equivalent to z.Exp(x, 183227397098d014dc2822db40c0ac2e9419f4243cdcb848a1f0fac9f8000000) -// -// uses github.com/mmcloughlin/addchain v0.4.0 to generate a shorter addition chain -func (z *Element) expByLegendreExp(x Element) *Element { - // addition chain: - // - // _10 = 2*1 - // _11 = 1 + _10 - // _101 = _10 + _11 - // _111 = _10 + _101 - // _1001 = _10 + _111 - // _1011 = _10 + _1001 - // _1101 = _10 + _1011 - // _1111 = _10 + _1101 - // _11000 = _1001 + _1111 - // _11111 = _111 + _11000 - // i26 = ((_11000 << 4 + _11) << 3 + 1) << 7 - // i36 = ((_1001 + i26) << 2 + _11) << 5 + _111 - // i53 = (2*(i36 << 6 + _1011) + 1) << 8 - // i64 = (2*(_1001 + i53) + 1) << 7 + _1101 - // i84 = ((i64 << 10 + _101) << 6 + _1101) << 2 - // i100 = ((_11 + i84) << 7 + _101) << 6 + 1 - // i117 = ((i100 << 7 + _1011) << 5 + _1101) << 3 - // i137 = ((_101 + i117) << 8 + _11) << 9 + _101 - // i153 = ((i137 << 3 + _11) << 8 + _1011) << 3 - // i168 = ((_101 + i153) << 5 + _101) << 7 + _11 - // i187 = ((i168 << 7 + _11111) << 2 + 1) << 8 - // i204 = ((_1001 + i187) << 8 + _1111) << 6 + _1101 - // i215 = 2*((i204 << 2 + _11) << 6 + _1011) - // i232 = ((1 + i215) << 8 + _1001) << 6 + _101 - // i257 = ((i232 << 9 + _11111) << 9 + _11111) << 5 - // i270 = ((_1011 + i257) << 3 + 1) << 7 + _11111 - // return (2*i270 + 1) << 27 - // - // Operations: 249 squares 50 multiplies - - // Allocate Temporaries. - var ( - t0 = new(Element) - t1 = new(Element) - t2 = new(Element) - t3 = new(Element) - t4 = new(Element) - t5 = new(Element) - t6 = new(Element) - t7 = new(Element) - ) - - // var t0,t1,t2,t3,t4,t5,t6,t7 Element - // Step 1: z = x^0x2 - z.Square(&x) - - // Step 2: t3 = x^0x3 - t3.Mul(&x, z) - - // Step 3: t1 = x^0x5 - t1.Mul(z, t3) - - // Step 4: t6 = x^0x7 - t6.Mul(z, t1) - - // Step 5: t2 = x^0x9 - t2.Mul(z, t6) - - // Step 6: t0 = x^0xb - t0.Mul(z, t2) - - // Step 7: t4 = x^0xd - t4.Mul(z, t0) - - // Step 8: t5 = x^0xf - t5.Mul(z, t4) - - // Step 9: t7 = x^0x18 - t7.Mul(t2, t5) - - // Step 10: z = x^0x1f - z.Mul(t6, t7) - - // Step 14: t7 = x^0x180 - for s := 0; s < 4; s++ { - t7.Square(t7) - } - - // Step 15: t7 = x^0x183 - t7.Mul(t3, t7) - - // Step 18: t7 = x^0xc18 - for s := 0; s < 3; s++ { - t7.Square(t7) - } - - // Step 19: t7 = x^0xc19 - t7.Mul(&x, t7) - - // Step 26: t7 = x^0x60c80 - for s := 0; s < 7; s++ { - t7.Square(t7) - } - - // Step 27: t7 = x^0x60c89 - t7.Mul(t2, t7) - - // Step 29: t7 = x^0x183224 - for s := 0; s < 2; s++ { - t7.Square(t7) - } - - // Step 30: t7 = x^0x183227 - t7.Mul(t3, t7) - - // Step 35: t7 = x^0x30644e0 - for s := 0; s < 5; s++ { - t7.Square(t7) - } - - // Step 36: t6 = x^0x30644e7 - t6.Mul(t6, t7) - - // Step 42: t6 = x^0xc19139c0 - for s := 0; s < 6; s++ { - t6.Square(t6) - } - - // Step 43: t6 = x^0xc19139cb - t6.Mul(t0, t6) - - // Step 44: t6 = x^0x183227396 - t6.Square(t6) - - // Step 45: t6 = x^0x183227397 - t6.Mul(&x, t6) - - // Step 53: t6 = x^0x18322739700 - for s := 0; s < 8; s++ { - t6.Square(t6) - } - - // Step 54: t6 = x^0x18322739709 - t6.Mul(t2, t6) - - // Step 55: t6 = x^0x30644e72e12 - t6.Square(t6) - - // Step 56: t6 = x^0x30644e72e13 - t6.Mul(&x, t6) - - // Step 63: t6 = x^0x1832273970980 - for s := 0; s < 7; s++ { - t6.Square(t6) - } - - // Step 64: t6 = x^0x183227397098d - t6.Mul(t4, t6) - - // Step 74: t6 = x^0x60c89ce5c263400 - for s := 0; s < 10; s++ { - t6.Square(t6) - } - - // Step 75: t6 = x^0x60c89ce5c263405 - t6.Mul(t1, t6) - - // Step 81: t6 = x^0x183227397098d0140 - for s := 0; s < 6; s++ { - t6.Square(t6) - } - - // Step 82: t6 = x^0x183227397098d014d - t6.Mul(t4, t6) - - // Step 84: t6 = x^0x60c89ce5c26340534 - for s := 0; s < 2; s++ { - t6.Square(t6) - } - - // Step 85: t6 = x^0x60c89ce5c26340537 - t6.Mul(t3, t6) - - // Step 92: t6 = x^0x30644e72e131a029b80 - for s := 0; s < 7; s++ { - t6.Square(t6) - } - - // Step 93: t6 = x^0x30644e72e131a029b85 - t6.Mul(t1, t6) - - // Step 99: t6 = x^0xc19139cb84c680a6e140 - for s := 0; s < 6; s++ { - t6.Square(t6) - } - - // Step 100: t6 = x^0xc19139cb84c680a6e141 - t6.Mul(&x, t6) - - // Step 107: t6 = x^0x60c89ce5c263405370a080 - for s := 0; s < 7; s++ { - t6.Square(t6) - } - - // Step 108: t6 = x^0x60c89ce5c263405370a08b - t6.Mul(t0, t6) - - // Step 113: t6 = x^0xc19139cb84c680a6e141160 - for s := 0; s < 5; s++ { - t6.Square(t6) - } - - // Step 114: t6 = x^0xc19139cb84c680a6e14116d - t6.Mul(t4, t6) - - // Step 117: t6 = x^0x60c89ce5c263405370a08b68 - for s := 0; s < 3; s++ { - t6.Square(t6) - } - - // Step 118: t6 = x^0x60c89ce5c263405370a08b6d - t6.Mul(t1, t6) - - // Step 126: t6 = x^0x60c89ce5c263405370a08b6d00 - for s := 0; s < 8; s++ { - t6.Square(t6) - } - - // Step 127: t6 = x^0x60c89ce5c263405370a08b6d03 - t6.Mul(t3, t6) - - // Step 136: t6 = x^0xc19139cb84c680a6e14116da0600 - for s := 0; s < 9; s++ { - t6.Square(t6) - } - - // Step 137: t6 = x^0xc19139cb84c680a6e14116da0605 - t6.Mul(t1, t6) - - // Step 140: t6 = x^0x60c89ce5c263405370a08b6d03028 - for s := 0; s < 3; s++ { - t6.Square(t6) - } - - // Step 141: t6 = x^0x60c89ce5c263405370a08b6d0302b - t6.Mul(t3, t6) - - // Step 149: t6 = x^0x60c89ce5c263405370a08b6d0302b00 - for s := 0; s < 8; s++ { - t6.Square(t6) - } - - // Step 150: t6 = x^0x60c89ce5c263405370a08b6d0302b0b - t6.Mul(t0, t6) - - // Step 153: t6 = x^0x30644e72e131a029b85045b681815858 - for s := 0; s < 3; s++ { - t6.Square(t6) - } - - // Step 154: t6 = x^0x30644e72e131a029b85045b68181585d - t6.Mul(t1, t6) - - // Step 159: t6 = x^0x60c89ce5c263405370a08b6d0302b0ba0 - for s := 0; s < 5; s++ { - t6.Square(t6) - } - - // Step 160: t6 = x^0x60c89ce5c263405370a08b6d0302b0ba5 - t6.Mul(t1, t6) - - // Step 167: t6 = x^0x30644e72e131a029b85045b68181585d280 - for s := 0; s < 7; s++ { - t6.Square(t6) - } - - // Step 168: t6 = x^0x30644e72e131a029b85045b68181585d283 - t6.Mul(t3, t6) - - // Step 175: t6 = x^0x183227397098d014dc2822db40c0ac2e94180 - for s := 0; s < 7; s++ { - t6.Square(t6) - } - - // Step 176: t6 = x^0x183227397098d014dc2822db40c0ac2e9419f - t6.Mul(z, t6) - - // Step 178: t6 = x^0x60c89ce5c263405370a08b6d0302b0ba5067c - for s := 0; s < 2; s++ { - t6.Square(t6) - } - - // Step 179: t6 = x^0x60c89ce5c263405370a08b6d0302b0ba5067d - t6.Mul(&x, t6) - - // Step 187: t6 = x^0x60c89ce5c263405370a08b6d0302b0ba5067d00 - for s := 0; s < 8; s++ { - t6.Square(t6) - } - - // Step 188: t6 = x^0x60c89ce5c263405370a08b6d0302b0ba5067d09 - t6.Mul(t2, t6) - - // Step 196: t6 = x^0x60c89ce5c263405370a08b6d0302b0ba5067d0900 - for s := 0; s < 8; s++ { - t6.Square(t6) - } - - // Step 197: t5 = x^0x60c89ce5c263405370a08b6d0302b0ba5067d090f - t5.Mul(t5, t6) - - // Step 203: t5 = x^0x183227397098d014dc2822db40c0ac2e9419f4243c0 - for s := 0; s < 6; s++ { - t5.Square(t5) - } - - // Step 204: t4 = x^0x183227397098d014dc2822db40c0ac2e9419f4243cd - t4.Mul(t4, t5) - - // Step 206: t4 = x^0x60c89ce5c263405370a08b6d0302b0ba5067d090f34 - for s := 0; s < 2; s++ { - t4.Square(t4) - } - - // Step 207: t3 = x^0x60c89ce5c263405370a08b6d0302b0ba5067d090f37 - t3.Mul(t3, t4) - - // Step 213: t3 = x^0x183227397098d014dc2822db40c0ac2e9419f4243cdc0 - for s := 0; s < 6; s++ { - t3.Square(t3) - } - - // Step 214: t3 = x^0x183227397098d014dc2822db40c0ac2e9419f4243cdcb - t3.Mul(t0, t3) - - // Step 215: t3 = x^0x30644e72e131a029b85045b68181585d2833e84879b96 - t3.Square(t3) - - // Step 216: t3 = x^0x30644e72e131a029b85045b68181585d2833e84879b97 - t3.Mul(&x, t3) - - // Step 224: t3 = x^0x30644e72e131a029b85045b68181585d2833e84879b9700 - for s := 0; s < 8; s++ { - t3.Square(t3) - } - - // Step 225: t2 = x^0x30644e72e131a029b85045b68181585d2833e84879b9709 - t2.Mul(t2, t3) - - // Step 231: t2 = x^0xc19139cb84c680a6e14116da06056174a0cfa121e6e5c240 - for s := 0; s < 6; s++ { - t2.Square(t2) - } - - // Step 232: t1 = x^0xc19139cb84c680a6e14116da06056174a0cfa121e6e5c245 - t1.Mul(t1, t2) - - // Step 241: t1 = x^0x183227397098d014dc2822db40c0ac2e9419f4243cdcb848a00 - for s := 0; s < 9; s++ { - t1.Square(t1) - } - - // Step 242: t1 = x^0x183227397098d014dc2822db40c0ac2e9419f4243cdcb848a1f - t1.Mul(z, t1) - - // Step 251: t1 = x^0x30644e72e131a029b85045b68181585d2833e84879b9709143e00 - for s := 0; s < 9; s++ { - t1.Square(t1) - } - - // Step 252: t1 = x^0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f - t1.Mul(z, t1) - - // Step 257: t1 = x^0x60c89ce5c263405370a08b6d0302b0ba5067d090f372e12287c3e0 - for s := 0; s < 5; s++ { - t1.Square(t1) - } - - // Step 258: t0 = x^0x60c89ce5c263405370a08b6d0302b0ba5067d090f372e12287c3eb - t0.Mul(t0, t1) - - // Step 261: t0 = x^0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f58 - for s := 0; s < 3; s++ { - t0.Square(t0) - } - - // Step 262: t0 = x^0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f59 - t0.Mul(&x, t0) - - // Step 269: t0 = x^0x183227397098d014dc2822db40c0ac2e9419f4243cdcb848a1f0fac80 - for s := 0; s < 7; s++ { - t0.Square(t0) - } - - // Step 270: z = x^0x183227397098d014dc2822db40c0ac2e9419f4243cdcb848a1f0fac9f - z.Mul(z, t0) - - // Step 271: z = x^0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593e - z.Square(z) - - // Step 272: z = x^0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f - z.Mul(&x, z) - - // Step 299: z = x^0x183227397098d014dc2822db40c0ac2e9419f4243cdcb848a1f0fac9f8000000 - for s := 0; s < 27; s++ { - z.Square(z) - } - - return z -} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_mul_amd64.s b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_mul_amd64.s deleted file mode 100644 index b51bc6998..000000000 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_mul_amd64.s +++ /dev/null @@ -1,487 +0,0 @@ -// +build !purego - -// Copyright 2020 ConsenSys Software 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. - -#include "textflag.h" -#include "funcdata.h" - -// modulus q -DATA q<>+0(SB)/8, $0x43e1f593f0000001 -DATA q<>+8(SB)/8, $0x2833e84879b97091 -DATA q<>+16(SB)/8, $0xb85045b68181585d -DATA q<>+24(SB)/8, $0x30644e72e131a029 -GLOBL q<>(SB), (RODATA+NOPTR), $32 - -// qInv0 q'[0] -DATA qInv0<>(SB)/8, $0xc2e1f593efffffff -GLOBL qInv0<>(SB), (RODATA+NOPTR), $8 - -#define REDUCE(ra0, ra1, ra2, ra3, rb0, rb1, rb2, rb3) \ - MOVQ ra0, rb0; \ - SUBQ q<>(SB), ra0; \ - MOVQ ra1, rb1; \ - SBBQ q<>+8(SB), ra1; \ - MOVQ ra2, rb2; \ - SBBQ q<>+16(SB), ra2; \ - MOVQ ra3, rb3; \ - SBBQ q<>+24(SB), ra3; \ - CMOVQCS rb0, ra0; \ - CMOVQCS rb1, ra1; \ - CMOVQCS rb2, ra2; \ - CMOVQCS rb3, ra3; \ - -// mul(res, x, y *Element) -TEXT ·mul(SB), $24-24 - - // the algorithm is described in the Element.Mul declaration (.go) - // however, to benefit from the ADCX and ADOX carry chains - // we split the inner loops in 2: - // for i=0 to N-1 - // for j=0 to N-1 - // (A,t[j]) := t[j] + x[j]*y[i] + A - // m := t[0]*q'[0] mod W - // C,_ := t[0] + m*q[0] - // for j=1 to N-1 - // (C,t[j-1]) := t[j] + m*q[j] + C - // t[N-1] = C + A - - NO_LOCAL_POINTERS - CMPB ·supportAdx(SB), $1 - JNE l1 - MOVQ x+8(FP), SI - - // x[0] -> DI - // x[1] -> R8 - // x[2] -> R9 - // x[3] -> R10 - MOVQ 0(SI), DI - MOVQ 8(SI), R8 - MOVQ 16(SI), R9 - MOVQ 24(SI), R10 - MOVQ y+16(FP), R11 - - // A -> BP - // t[0] -> R14 - // t[1] -> R13 - // t[2] -> CX - // t[3] -> BX - // clear the flags - XORQ AX, AX - MOVQ 0(R11), DX - - // (A,t[0]) := x[0]*y[0] + A - MULXQ DI, R14, R13 - - // (A,t[1]) := x[1]*y[0] + A - MULXQ R8, AX, CX - ADOXQ AX, R13 - - // (A,t[2]) := x[2]*y[0] + A - MULXQ R9, AX, BX - ADOXQ AX, CX - - // (A,t[3]) := x[3]*y[0] + A - MULXQ R10, AX, BP - ADOXQ AX, BX - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADOXQ AX, BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, R12 - ADCXQ R14, AX - MOVQ R12, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // t[3] = C + A - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ BP, BX - - // clear the flags - XORQ AX, AX - MOVQ 8(R11), DX - - // (A,t[0]) := t[0] + x[0]*y[1] + A - MULXQ DI, AX, BP - ADOXQ AX, R14 - - // (A,t[1]) := t[1] + x[1]*y[1] + A - ADCXQ BP, R13 - MULXQ R8, AX, BP - ADOXQ AX, R13 - - // (A,t[2]) := t[2] + x[2]*y[1] + A - ADCXQ BP, CX - MULXQ R9, AX, BP - ADOXQ AX, CX - - // (A,t[3]) := t[3] + x[3]*y[1] + A - ADCXQ BP, BX - MULXQ R10, AX, BP - ADOXQ AX, BX - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, R12 - ADCXQ R14, AX - MOVQ R12, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // t[3] = C + A - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ BP, BX - - // clear the flags - XORQ AX, AX - MOVQ 16(R11), DX - - // (A,t[0]) := t[0] + x[0]*y[2] + A - MULXQ DI, AX, BP - ADOXQ AX, R14 - - // (A,t[1]) := t[1] + x[1]*y[2] + A - ADCXQ BP, R13 - MULXQ R8, AX, BP - ADOXQ AX, R13 - - // (A,t[2]) := t[2] + x[2]*y[2] + A - ADCXQ BP, CX - MULXQ R9, AX, BP - ADOXQ AX, CX - - // (A,t[3]) := t[3] + x[3]*y[2] + A - ADCXQ BP, BX - MULXQ R10, AX, BP - ADOXQ AX, BX - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, R12 - ADCXQ R14, AX - MOVQ R12, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // t[3] = C + A - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ BP, BX - - // clear the flags - XORQ AX, AX - MOVQ 24(R11), DX - - // (A,t[0]) := t[0] + x[0]*y[3] + A - MULXQ DI, AX, BP - ADOXQ AX, R14 - - // (A,t[1]) := t[1] + x[1]*y[3] + A - ADCXQ BP, R13 - MULXQ R8, AX, BP - ADOXQ AX, R13 - - // (A,t[2]) := t[2] + x[2]*y[3] + A - ADCXQ BP, CX - MULXQ R9, AX, BP - ADOXQ AX, CX - - // (A,t[3]) := t[3] + x[3]*y[3] + A - ADCXQ BP, BX - MULXQ R10, AX, BP - ADOXQ AX, BX - - // A += carries from ADCXQ and ADOXQ - MOVQ $0, AX - ADCXQ AX, BP - ADOXQ AX, BP - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - - // clear the flags - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, R12 - ADCXQ R14, AX - MOVQ R12, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - - // t[3] = C + A - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ BP, BX - - // reduce element(R14,R13,CX,BX) using temp registers (SI,R12,R11,DI) - REDUCE(R14,R13,CX,BX,SI,R12,R11,DI) - - MOVQ res+0(FP), AX - MOVQ R14, 0(AX) - MOVQ R13, 8(AX) - MOVQ CX, 16(AX) - MOVQ BX, 24(AX) - RET - -l1: - MOVQ res+0(FP), AX - MOVQ AX, (SP) - MOVQ x+8(FP), AX - MOVQ AX, 8(SP) - MOVQ y+16(FP), AX - MOVQ AX, 16(SP) - CALL ·_mulGeneric(SB) - RET - -TEXT ·fromMont(SB), $8-8 - NO_LOCAL_POINTERS - - // the algorithm is described here - // https://hackmd.io/@gnark/modular_multiplication - // when y = 1 we have: - // for i=0 to N-1 - // t[i] = x[i] - // for i=0 to N-1 - // m := t[0]*q'[0] mod W - // C,_ := t[0] + m*q[0] - // for j=1 to N-1 - // (C,t[j-1]) := t[j] + m*q[j] + C - // t[N-1] = C - CMPB ·supportAdx(SB), $1 - JNE l2 - MOVQ res+0(FP), DX - MOVQ 0(DX), R14 - MOVQ 8(DX), R13 - MOVQ 16(DX), CX - MOVQ 24(DX), BX - XORQ DX, DX - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R14, AX - MOVQ BP, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ AX, BX - XORQ DX, DX - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R14, AX - MOVQ BP, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ AX, BX - XORQ DX, DX - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R14, AX - MOVQ BP, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ AX, BX - XORQ DX, DX - - // m := t[0]*q'[0] mod W - MOVQ qInv0<>(SB), DX - IMULQ R14, DX - XORQ AX, AX - - // C,_ := t[0] + m*q[0] - MULXQ q<>+0(SB), AX, BP - ADCXQ R14, AX - MOVQ BP, R14 - - // (C,t[0]) := t[1] + m*q[1] + C - ADCXQ R13, R14 - MULXQ q<>+8(SB), AX, R13 - ADOXQ AX, R14 - - // (C,t[1]) := t[2] + m*q[2] + C - ADCXQ CX, R13 - MULXQ q<>+16(SB), AX, CX - ADOXQ AX, R13 - - // (C,t[2]) := t[3] + m*q[3] + C - ADCXQ BX, CX - MULXQ q<>+24(SB), AX, BX - ADOXQ AX, CX - MOVQ $0, AX - ADCXQ AX, BX - ADOXQ AX, BX - - // reduce element(R14,R13,CX,BX) using temp registers (SI,DI,R8,R9) - REDUCE(R14,R13,CX,BX,SI,DI,R8,R9) - - MOVQ res+0(FP), AX - MOVQ R14, 0(AX) - MOVQ R13, 8(AX) - MOVQ CX, 16(AX) - MOVQ BX, 24(AX) - RET - -l2: - MOVQ res+0(FP), AX - MOVQ AX, (SP) - CALL ·_fromMontGeneric(SB) - RET diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_ops_amd64.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_ops_amd64.go deleted file mode 100644 index e40a9caed..000000000 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_ops_amd64.go +++ /dev/null @@ -1,107 +0,0 @@ -//go:build !purego -// +build !purego - -// Copyright 2020 ConsenSys Software 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. - -// Code generated by consensys/gnark-crypto DO NOT EDIT - -package fr - -//go:noescape -func MulBy3(x *Element) - -//go:noescape -func MulBy5(x *Element) - -//go:noescape -func MulBy13(x *Element) - -//go:noescape -func mul(res, x, y *Element) - -//go:noescape -func fromMont(res *Element) - -//go:noescape -func reduce(res *Element) - -// Butterfly sets -// -// a = a + b (mod q) -// b = a - b (mod q) -// -//go:noescape -func Butterfly(a, b *Element) - -// Mul z = x * y (mod q) -// -// x and y must be less than q -func (z *Element) Mul(x, y *Element) *Element { - - // Implements CIOS multiplication -- section 2.3.2 of Tolga Acar's thesis - // https://www.microsoft.com/en-us/research/wp-content/uploads/1998/06/97Acar.pdf - // - // The algorithm: - // - // for i=0 to N-1 - // C := 0 - // for j=0 to N-1 - // (C,t[j]) := t[j] + x[j]*y[i] + C - // (t[N+1],t[N]) := t[N] + C - // - // C := 0 - // m := t[0]*q'[0] mod D - // (C,_) := t[0] + m*q[0] - // for j=1 to N-1 - // (C,t[j-1]) := t[j] + m*q[j] + C - // - // (C,t[N-1]) := t[N] + C - // t[N] := t[N+1] + C - // - // → N is the number of machine words needed to store the modulus q - // → D is the word size. For example, on a 64-bit architecture D is 2 64 - // → x[i], y[i], q[i] is the ith word of the numbers x,y,q - // → q'[0] is the lowest word of the number -q⁻¹ mod r. This quantity is pre-computed, as it does not depend on the inputs. - // → t is a temporary array of size N+2 - // → C, S are machine words. A pair (C,S) refers to (hi-bits, lo-bits) of a two-word number - // - // As described here https://hackmd.io/@gnark/modular_multiplication we can get rid of one carry chain and simplify: - // (also described in https://eprint.iacr.org/2022/1400.pdf annex) - // - // for i=0 to N-1 - // (A,t[0]) := t[0] + x[0]*y[i] - // m := t[0]*q'[0] mod W - // C,_ := t[0] + m*q[0] - // for j=1 to N-1 - // (A,t[j]) := t[j] + x[j]*y[i] + A - // (C,t[j-1]) := t[j] + m*q[j] + C - // - // t[N-1] = C + A - // - // This optimization saves 5N + 2 additions in the algorithm, and can be used whenever the highest bit - // of the modulus is zero (and not all of the remaining bits are set). - - mul(z, x, y) - return z -} - -// Square z = x * x (mod q) -// -// x must be less than q -func (z *Element) Square(x *Element) *Element { - // see Mul for doc. - mul(z, x, x) - return z -} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_ops_amd64.s b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_ops_amd64.s deleted file mode 100644 index b9d8a5bfa..000000000 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_ops_amd64.s +++ /dev/null @@ -1,230 +0,0 @@ -// +build !purego - -// Copyright 2020 ConsenSys Software 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. - -#include "textflag.h" -#include "funcdata.h" - -// modulus q -DATA q<>+0(SB)/8, $0x43e1f593f0000001 -DATA q<>+8(SB)/8, $0x2833e84879b97091 -DATA q<>+16(SB)/8, $0xb85045b68181585d -DATA q<>+24(SB)/8, $0x30644e72e131a029 -GLOBL q<>(SB), (RODATA+NOPTR), $32 - -// qInv0 q'[0] -DATA qInv0<>(SB)/8, $0xc2e1f593efffffff -GLOBL qInv0<>(SB), (RODATA+NOPTR), $8 - -#define REDUCE(ra0, ra1, ra2, ra3, rb0, rb1, rb2, rb3) \ - MOVQ ra0, rb0; \ - SUBQ q<>(SB), ra0; \ - MOVQ ra1, rb1; \ - SBBQ q<>+8(SB), ra1; \ - MOVQ ra2, rb2; \ - SBBQ q<>+16(SB), ra2; \ - MOVQ ra3, rb3; \ - SBBQ q<>+24(SB), ra3; \ - CMOVQCS rb0, ra0; \ - CMOVQCS rb1, ra1; \ - CMOVQCS rb2, ra2; \ - CMOVQCS rb3, ra3; \ - -TEXT ·reduce(SB), NOSPLIT, $0-8 - MOVQ res+0(FP), AX - MOVQ 0(AX), DX - MOVQ 8(AX), CX - MOVQ 16(AX), BX - MOVQ 24(AX), SI - - // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10) - - MOVQ DX, 0(AX) - MOVQ CX, 8(AX) - MOVQ BX, 16(AX) - MOVQ SI, 24(AX) - RET - -// MulBy3(x *Element) -TEXT ·MulBy3(SB), NOSPLIT, $0-8 - MOVQ x+0(FP), AX - MOVQ 0(AX), DX - MOVQ 8(AX), CX - MOVQ 16(AX), BX - MOVQ 24(AX), SI - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - - // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10) - - ADDQ 0(AX), DX - ADCQ 8(AX), CX - ADCQ 16(AX), BX - ADCQ 24(AX), SI - - // reduce element(DX,CX,BX,SI) using temp registers (R11,R12,R13,R14) - REDUCE(DX,CX,BX,SI,R11,R12,R13,R14) - - MOVQ DX, 0(AX) - MOVQ CX, 8(AX) - MOVQ BX, 16(AX) - MOVQ SI, 24(AX) - RET - -// MulBy5(x *Element) -TEXT ·MulBy5(SB), NOSPLIT, $0-8 - MOVQ x+0(FP), AX - MOVQ 0(AX), DX - MOVQ 8(AX), CX - MOVQ 16(AX), BX - MOVQ 24(AX), SI - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - - // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10) - - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - - // reduce element(DX,CX,BX,SI) using temp registers (R11,R12,R13,R14) - REDUCE(DX,CX,BX,SI,R11,R12,R13,R14) - - ADDQ 0(AX), DX - ADCQ 8(AX), CX - ADCQ 16(AX), BX - ADCQ 24(AX), SI - - // reduce element(DX,CX,BX,SI) using temp registers (R15,DI,R8,R9) - REDUCE(DX,CX,BX,SI,R15,DI,R8,R9) - - MOVQ DX, 0(AX) - MOVQ CX, 8(AX) - MOVQ BX, 16(AX) - MOVQ SI, 24(AX) - RET - -// MulBy13(x *Element) -TEXT ·MulBy13(SB), NOSPLIT, $0-8 - MOVQ x+0(FP), AX - MOVQ 0(AX), DX - MOVQ 8(AX), CX - MOVQ 16(AX), BX - MOVQ 24(AX), SI - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - - // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10) - - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - - // reduce element(DX,CX,BX,SI) using temp registers (R11,R12,R13,R14) - REDUCE(DX,CX,BX,SI,R11,R12,R13,R14) - - MOVQ DX, R11 - MOVQ CX, R12 - MOVQ BX, R13 - MOVQ SI, R14 - ADDQ DX, DX - ADCQ CX, CX - ADCQ BX, BX - ADCQ SI, SI - - // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10) - - ADDQ R11, DX - ADCQ R12, CX - ADCQ R13, BX - ADCQ R14, SI - - // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10) - - ADDQ 0(AX), DX - ADCQ 8(AX), CX - ADCQ 16(AX), BX - ADCQ 24(AX), SI - - // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) - REDUCE(DX,CX,BX,SI,DI,R8,R9,R10) - - MOVQ DX, 0(AX) - MOVQ CX, 8(AX) - MOVQ BX, 16(AX) - MOVQ SI, 24(AX) - RET - -// Butterfly(a, b *Element) sets a = a + b; b = a - b -TEXT ·Butterfly(SB), NOSPLIT, $0-16 - MOVQ a+0(FP), AX - MOVQ 0(AX), CX - MOVQ 8(AX), BX - MOVQ 16(AX), SI - MOVQ 24(AX), DI - MOVQ CX, R8 - MOVQ BX, R9 - MOVQ SI, R10 - MOVQ DI, R11 - XORQ AX, AX - MOVQ b+8(FP), DX - ADDQ 0(DX), CX - ADCQ 8(DX), BX - ADCQ 16(DX), SI - ADCQ 24(DX), DI - SUBQ 0(DX), R8 - SBBQ 8(DX), R9 - SBBQ 16(DX), R10 - SBBQ 24(DX), R11 - MOVQ $0x43e1f593f0000001, R12 - MOVQ $0x2833e84879b97091, R13 - MOVQ $0xb85045b68181585d, R14 - MOVQ $0x30644e72e131a029, R15 - CMOVQCC AX, R12 - CMOVQCC AX, R13 - CMOVQCC AX, R14 - CMOVQCC AX, R15 - ADDQ R12, R8 - ADCQ R13, R9 - ADCQ R14, R10 - ADCQ R15, R11 - MOVQ R8, 0(DX) - MOVQ R9, 8(DX) - MOVQ R10, 16(DX) - MOVQ R11, 24(DX) - - // reduce element(CX,BX,SI,DI) using temp registers (R8,R9,R10,R11) - REDUCE(CX,BX,SI,DI,R8,R9,R10,R11) - - MOVQ a+0(FP), AX - MOVQ CX, 0(AX) - MOVQ BX, 8(AX) - MOVQ SI, 16(AX) - MOVQ DI, 24(AX) - RET diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_ops_purego.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_purego.go similarity index 80% rename from vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_ops_purego.go rename to vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_purego.go index be0f08583..8b6bab2e0 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_ops_purego.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/element_purego.go @@ -1,19 +1,7 @@ -//go:build !amd64 || purego -// +build !amd64 purego +//go:build purego || (!amd64 && !arm64) -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -44,14 +32,6 @@ func MulBy13(x *Element) { x.Mul(x, &y) } -// Butterfly sets -// -// a = a + b (mod q) -// b = a - b (mod q) -func Butterfly(a, b *Element) { - _butterflyGeneric(a, b) -} - func fromMont(z *Element) { _fromMontGeneric(z) } @@ -65,48 +45,8 @@ func reduce(z *Element) { // x and y must be less than q func (z *Element) Mul(x, y *Element) *Element { - // Implements CIOS multiplication -- section 2.3.2 of Tolga Acar's thesis - // https://www.microsoft.com/en-us/research/wp-content/uploads/1998/06/97Acar.pdf - // - // The algorithm: - // - // for i=0 to N-1 - // C := 0 - // for j=0 to N-1 - // (C,t[j]) := t[j] + x[j]*y[i] + C - // (t[N+1],t[N]) := t[N] + C - // - // C := 0 - // m := t[0]*q'[0] mod D - // (C,_) := t[0] + m*q[0] - // for j=1 to N-1 - // (C,t[j-1]) := t[j] + m*q[j] + C - // - // (C,t[N-1]) := t[N] + C - // t[N] := t[N+1] + C - // - // → N is the number of machine words needed to store the modulus q - // → D is the word size. For example, on a 64-bit architecture D is 2 64 - // → x[i], y[i], q[i] is the ith word of the numbers x,y,q - // → q'[0] is the lowest word of the number -q⁻¹ mod r. This quantity is pre-computed, as it does not depend on the inputs. - // → t is a temporary array of size N+2 - // → C, S are machine words. A pair (C,S) refers to (hi-bits, lo-bits) of a two-word number - // - // As described here https://hackmd.io/@gnark/modular_multiplication we can get rid of one carry chain and simplify: - // (also described in https://eprint.iacr.org/2022/1400.pdf annex) - // - // for i=0 to N-1 - // (A,t[0]) := t[0] + x[0]*y[i] - // m := t[0]*q'[0] mod W - // C,_ := t[0] + m*q[0] - // for j=1 to N-1 - // (A,t[j]) := t[j] + x[j]*y[i] + A - // (C,t[j-1]) := t[j] + m*q[j] + C - // - // t[N-1] = C + A - // - // This optimization saves 5N + 2 additions in the algorithm, and can be used whenever the highest bit - // of the modulus is zero (and not all of the remaining bits are set). + // Algorithm 2 of "Faster Montgomery Multiplication and Multi-Scalar-Multiplication for SNARKS" + // by Y. El Housni and G. Botrel https://doi.org/10.46586/tches.v2023.i3.504-521 var t0, t1, t2, t3 uint64 var u0, u1, u2, u3 uint64 @@ -441,3 +381,11 @@ func (z *Element) Square(x *Element) *Element { } return z } + +// Butterfly sets +// +// a = a + b (mod q) +// b = a - b (mod q) +func Butterfly(a, b *Element) { + _butterflyGeneric(a, b) +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/generator.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/generator.go new file mode 100644 index 000000000..085998e5c --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/generator.go @@ -0,0 +1,36 @@ +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package fr + +import ( + "fmt" + "math/big" + "math/bits" + + "github.com/consensys/gnark-crypto/ecc" +) + +// Generator returns a generator for Z/2^(log(m))Z +// or an error if m is too big (required root of unity doesn't exist) +func Generator(m uint64) (Element, error) { + x := ecc.NextPowerOfTwo(m) + + var rootOfUnity Element + + rootOfUnity.SetString("19103219067921713944291392827692070036145651957329286315305642004821462161904") + const maxOrderRoot uint64 = 28 + + // find generator for Z/2^(log(m))Z + logx := uint64(bits.TrailingZeros64(x)) + if logx > maxOrderRoot { + return Element{}, fmt.Errorf("m (%d) is too big: the required root of unity does not exist", m) + } + + expo := uint64(1 << (maxOrderRoot - logx)) + var generator Element + generator.Exp(rootOfUnity, big.NewInt(int64(expo))) // order x + return generator, nil +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/vector.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/vector.go index 00ad8a898..eee2062de 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/vector.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/vector.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -19,9 +8,12 @@ package fr import ( "bytes" "encoding/binary" + "errors" "fmt" "io" + "math/bits" "runtime" + "slices" "strings" "sync" "sync/atomic" @@ -78,40 +70,84 @@ func (vector *Vector) WriteTo(w io.Writer) (int64, error) { return n, nil } -// AsyncReadFrom reads a vector of big endian encoded Element. -// Length of the vector must be encoded as a uint32 on the first 4 bytes. -// It consumes the needed bytes from the reader and returns the number of bytes read and an error if any. -// It also returns a channel that will be closed when the validation is done. -// The validation consist of checking that the elements are smaller than the modulus, and -// converting them to montgomery form. -func (vector *Vector) AsyncReadFrom(r io.Reader) (int64, error, chan error) { +// AsyncReadFrom implements an asynchronous version of [Vector.ReadFrom]. It +// reads the reader r in full and then performs the validation and conversion to +// Montgomery form separately in a goroutine. Any error encountered during +// reading is returned directly, while errors encountered during +// validation/conversion are sent on the returned channel. Thus the caller must +// wait on the channel to ensure the vector is ready to use. The method +// additionally returns the number of bytes read from r. +// +// The errors during reading can be: +// - an error while reading from r; +// - not enough bytes in r to read the full vector indicated by header. +// +// The reader can contain more bytes than needed to decode the vector, in which +// case the extra bytes are ignored. In that case the reader is not seeked nor +// read further. +// +// The method allocates sufficiently large slice to store the vector. If the +// current slice fits the vector, it is reused, otherwise the slice is grown to +// fit the vector. +// +// The serialized encoding is as follows: +// - first 4 bytes: length of the vector as a big-endian uint32 +// - for each element of the vector, [Bytes] bytes representing the element in +// big-endian encoding. +func (vector *Vector) AsyncReadFrom(r io.Reader) (int64, error, chan error) { // nolint ST1008 chErr := make(chan error, 1) var buf [Bytes]byte if read, err := io.ReadFull(r, buf[:4]); err != nil { close(chErr) return int64(read), err, chErr } - sliceLen := binary.BigEndian.Uint32(buf[:4]) - - n := int64(4) - (*vector) = make(Vector, sliceLen) - if sliceLen == 0 { + headerSliceLen := uint64(binary.BigEndian.Uint32(buf[:4])) + + // to avoid allocating too large slice when the header is tampered, we limit + // the maximum allocation. We set the target to 4GB. This incurs a performance + // hit when reading very large slices, but protects against OOM. + targetSize := uint64(1 << 32) // 4GB + if bits.UintSize == 32 { + // reduce target size to 1GB on 32 bits architectures + targetSize = uint64(1 << 30) // 1GB + } + maxAllocateSliceLength := targetSize / uint64(Bytes) + + totalRead := int64(4) + *vector = (*vector)[:0] + if headerSliceLen == 0 { + // if the vector was nil previously even by reslicing we have a nil vector. + // but we want to have an empty slice to indicate that the vector has zero length. + if *vector == nil { + *vector = []Element{} + } + // we return already here to avoid launching a goroutine doing nothing below close(chErr) - return n, nil, chErr + return totalRead, nil, chErr } - bSlice := unsafe.Slice((*byte)(unsafe.Pointer(&(*vector)[0])), sliceLen*Bytes) - read, err := io.ReadFull(r, bSlice) - n += int64(read) - if err != nil { - close(chErr) - return n, err, chErr + for i := uint64(0); i < headerSliceLen; i += maxAllocateSliceLength { + if len(*vector) <= int(i) { + (*vector) = append(*vector, make([]Element, int(min(headerSliceLen-i, maxAllocateSliceLength)))...) + } + bSlice := unsafe.Slice((*byte)(unsafe.Pointer(&(*vector)[i])), int(min(headerSliceLen-i, maxAllocateSliceLength))*Bytes) + read, err := io.ReadFull(r, bSlice) + totalRead += int64(read) + if errors.Is(err, io.ErrUnexpectedEOF) { + close(chErr) + return totalRead, fmt.Errorf("less data than expected: read %d elements, expected %d", i+uint64(read)/Bytes, headerSliceLen), chErr + } + if err != nil { + close(chErr) + return totalRead, err, chErr + } } + bSlice := unsafe.Slice((*byte)(unsafe.Pointer(&(*vector)[0])), int(headerSliceLen)*Bytes) go func() { var cptErrors uint64 // process the elements in parallel - execute(int(sliceLen), func(start, end int) { + execute(int(headerSliceLen), func(start, end int) { var z Element for i := start; i < end; i++ { @@ -138,35 +174,72 @@ func (vector *Vector) AsyncReadFrom(r io.Reader) (int64, error, chan error) { } close(chErr) }() - return n, nil, chErr + return totalRead, nil, chErr } -// ReadFrom implements io.ReaderFrom and reads a vector of big endian encoded Element. -// Length of the vector must be encoded as a uint32 on the first 4 bytes. +// ReadFrom reads the vector from the reader r. It returns the number of bytes +// read and an error, if any. The errors can be: +// - an error while reading from r; +// - not enough bytes in r to read the full vector indicated by header; +// - when decoding the bytes into elements. +// +// The reader can contain more bytes than needed to decode the vector, in which case +// the extra bytes are ignored. In that case the reader is not seeked nor read further. +// +// The method allocates sufficiently large slice to store the vector. If the current slice fits +// the vector, it is reused, otherwise the slice is grown to fit the vector. +// +// The serialized encoding is as follows: +// - first 4 bytes: length of the vector as a big-endian uint32 +// - for each element of the vector, [Bytes] bytes representing the element in big-endian encoding. +// +// The method implements [io.ReaderFrom] interface. func (vector *Vector) ReadFrom(r io.Reader) (int64, error) { - var buf [Bytes]byte if read, err := io.ReadFull(r, buf[:4]); err != nil { return int64(read), err } - sliceLen := binary.BigEndian.Uint32(buf[:4]) - - n := int64(4) - (*vector) = make(Vector, sliceLen) + headerSliceLen := uint64(binary.BigEndian.Uint32(buf[:4])) + + // to avoid allocating too large slice when the header is tampered, we limit + // the maximum allocation. We set the target to 4GB. This incurs a performance + // hit when reading very large slices, but protects against OOM. + targetSize := uint64(1 << 32) // 4GB + if bits.UintSize == 32 { + // reduce target size to 1GB on 32 bits architectures + targetSize = uint64(1 << 30) // 1GB + } + maxAllocateSliceLength := targetSize / uint64(Bytes) + + totalRead := int64(4) // include already the header length + *vector = (*vector)[:0] + // if the vector was nil previously even by reslicing we have a nil vector. But we want + // to have an empty slice to indicate that the vector has zero length. When headerSliceLen == 0 + // we handle this edge case after reading the header as the loop body below is skipped. + if headerSliceLen == 0 && *vector == nil { + *vector = []Element{} + } - for i := 0; i < int(sliceLen); i++ { + for i := uint64(0); i < headerSliceLen; i++ { read, err := io.ReadFull(r, buf[:]) - n += int64(read) + totalRead += int64(read) + if errors.Is(err, io.ErrUnexpectedEOF) { + return totalRead, fmt.Errorf("less data than expected: read %d elements, expected %d", i, headerSliceLen) + } if err != nil { - return n, err + return totalRead, fmt.Errorf("error reading element %d: %w", i, err) } - (*vector)[i], err = BigEndian.Element(&buf) + if uint64(cap(*vector)) <= i { + (*vector) = slices.Grow(*vector, int(min(headerSliceLen-i, maxAllocateSliceLength))) + } + el, err := BigEndian.Element(&buf) if err != nil { - return n, err + return totalRead, fmt.Errorf("error decoding element %d: %w", i, err) } + *vector = append(*vector, el) } - return n, nil + return totalRead, nil } // String implements fmt.Stringer interface @@ -199,6 +272,88 @@ func (vector Vector) Swap(i, j int) { vector[i], vector[j] = vector[j], vector[i] } +// SetRandom sets the elements in vector to independent uniform random values in [0, q). +// +// This might error only if reading from crypto/rand.Reader errors, +// in which case the values in vector are undefined. +func (vector Vector) SetRandom() error { + for i := range vector { + if _, err := vector[i].SetRandom(); err != nil { + return err + } + } + return nil +} + +// MustSetRandom sets the elements in vector to independent uniform random values in [0, q). +// +// It panics if reading from crypto/rand.Reader errors. +func (vector Vector) MustSetRandom() { + for i := range vector { + if _, err := vector[i].SetRandom(); err != nil { + panic(err) + } + } +} + +// Equal returns true if vector and other have the same length and same elements. +func (vector Vector) Equal(other Vector) bool { + return slices.Equal(vector, other) +} + +func addVecGeneric(res, a, b Vector) { + if len(a) != len(b) || len(a) != len(res) { + panic("vector.Add: vectors don't have the same length") + } + for i := 0; i < len(a); i++ { + res[i].Add(&a[i], &b[i]) + } +} + +func subVecGeneric(res, a, b Vector) { + if len(a) != len(b) || len(a) != len(res) { + panic("vector.Sub: vectors don't have the same length") + } + for i := 0; i < len(a); i++ { + res[i].Sub(&a[i], &b[i]) + } +} + +func scalarMulVecGeneric(res, a Vector, b *Element) { + if len(a) != len(res) { + panic("vector.ScalarMul: vectors don't have the same length") + } + for i := 0; i < len(a); i++ { + res[i].Mul(&a[i], b) + } +} + +func sumVecGeneric(res *Element, a Vector) { + for i := 0; i < len(a); i++ { + res.Add(res, &a[i]) + } +} + +func innerProductVecGeneric(res *Element, a, b Vector) { + if len(a) != len(b) { + panic("vector.InnerProduct: vectors don't have the same length") + } + var tmp Element + for i := 0; i < len(a); i++ { + tmp.Mul(&a[i], &b[i]) + res.Add(res, &tmp) + } +} + +func mulVecGeneric(res, a, b Vector) { + if len(a) != len(b) || len(a) != len(res) { + panic("vector.Mul: vectors don't have the same length") + } + for i := 0; i < len(a); i++ { + res[i].Mul(&a[i], &b[i]) + } +} + // TODO @gbotrel make a public package out of that. // execute executes the work function in parallel. // this is copy paste from internal/parallel/parallel.go diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/vector_amd64.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/vector_amd64.go new file mode 100644 index 000000000..d7d56cd46 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/vector_amd64.go @@ -0,0 +1,154 @@ +//go:build !purego + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package fr + +import ( + _ "github.com/consensys/gnark-crypto/field/asm/element_4w" + "github.com/consensys/gnark-crypto/utils/cpu" +) + +// Add adds two vectors element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) Add(a, b Vector) { + if len(a) != len(b) || len(a) != len(*vector) { + panic("vector.Add: vectors don't have the same length") + } + n := uint64(len(a)) + addVec(&(*vector)[0], &a[0], &b[0], n) +} + +//go:noescape +func addVec(res, a, b *Element, n uint64) + +// Sub subtracts two vectors element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) Sub(a, b Vector) { + if len(a) != len(b) || len(a) != len(*vector) { + panic("vector.Sub: vectors don't have the same length") + } + subVec(&(*vector)[0], &a[0], &b[0], uint64(len(a))) +} + +//go:noescape +func subVec(res, a, b *Element, n uint64) + +// ScalarMul multiplies a vector by a scalar element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) ScalarMul(a Vector, b *Element) { + if len(a) != len(*vector) { + panic("vector.ScalarMul: vectors don't have the same length") + } + const maxN = (1 << 32) - 1 + if !cpu.SupportAVX512 || uint64(len(a)) >= maxN { + // call scalarMulVecGeneric + scalarMulVecGeneric(*vector, a, b) + return + } + n := uint64(len(a)) + if n == 0 { + return + } + // the code for scalarMul is identical to mulVec; and it expects at least + // 2 elements in the vector to fill the Z registers + var bb [2]Element + bb[0] = *b + bb[1] = *b + const blockSize = 16 + scalarMulVec(&(*vector)[0], &a[0], &bb[0], n/blockSize, qInvNeg, &patterns[0]) + if n%blockSize != 0 { + // call scalarMulVecGeneric on the rest + start := n - n%blockSize + scalarMulVecGeneric((*vector)[start:], a[start:], b) + } +} + +//go:noescape +func scalarMulVec(res, a, b *Element, n uint64, qInvNeg uint64, patterns *uint64) + +// Sum computes the sum of all elements in the vector. +func (vector *Vector) Sum() (res Element) { + n := uint64(len(*vector)) + if n == 0 { + return + } + const minN = 16 * 7 // AVX512 slower than generic for small n + const maxN = (1 << 32) - 1 + if !cpu.SupportAVX512 || n <= minN || n >= maxN { + // call sumVecGeneric + sumVecGeneric(&res, *vector) + return + } + sumVec(&res, &(*vector)[0], uint64(len(*vector))) + return +} + +//go:noescape +func sumVec(res *Element, a *Element, n uint64) + +// InnerProduct computes the inner product of two vectors. +// It panics if the vectors don't have the same length. +func (vector *Vector) InnerProduct(other Vector) (res Element) { + n := uint64(len(*vector)) + if n == 0 { + return + } + if n != uint64(len(other)) { + panic("vector.InnerProduct: vectors don't have the same length") + } + const maxN = (1 << 32) - 1 + if !cpu.SupportAVX512 || n >= maxN { + // call innerProductVecGeneric + // note; we could split the vector into smaller chunks and call innerProductVec + innerProductVecGeneric(&res, *vector, other) + return + } + innerProdVec(&res[0], &(*vector)[0], &other[0], uint64(len(*vector))) + + return +} + +//go:noescape +func innerProdVec(res *uint64, a, b *Element, n uint64) + +// Mul multiplies two vectors element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) Mul(a, b Vector) { + if len(a) != len(b) || len(a) != len(*vector) { + panic("vector.Mul: vectors don't have the same length") + } + n := uint64(len(a)) + if n == 0 { + return + } + const maxN = (1 << 32) - 1 + if !cpu.SupportAVX512 || n >= maxN { + // call mulVecGeneric + mulVecGeneric(*vector, a, b) + return + } + + const blockSize = 16 + mulVec(&(*vector)[0], &a[0], &b[0], n/blockSize, qInvNeg, &patterns[0]) + if n%blockSize != 0 { + // call mulVecGeneric on the rest + start := n - n%blockSize + mulVecGeneric((*vector)[start:], a[start:], b[start:]) + } + +} + +// Patterns use for transposing the vectors in mulVec +var ( + patterns = [8 * 4]uint64{0, 8, 1, 9, 2, 10, 3, 11, + 12, 4, 13, 5, 14, 6, 15, 7, + 0, 1, 8, 9, 2, 3, 10, 11, + 12, 13, 4, 5, 14, 15, 6, 7} +) + +//go:noescape +func mulVec(res, a, b *Element, n uint64, qInvNeg uint64, patterns *uint64) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/vector_purego.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/vector_purego.go new file mode 100644 index 000000000..6608e394c --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/fr/vector_purego.go @@ -0,0 +1,45 @@ +//go:build purego || !amd64 + +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package fr + +// Add adds two vectors element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) Add(a, b Vector) { + addVecGeneric(*vector, a, b) +} + +// Sub subtracts two vectors element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) Sub(a, b Vector) { + subVecGeneric(*vector, a, b) +} + +// ScalarMul multiplies a vector by a scalar element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) ScalarMul(a Vector, b *Element) { + scalarMulVecGeneric(*vector, a, b) +} + +// Sum computes the sum of all elements in the vector. +func (vector *Vector) Sum() (res Element) { + sumVecGeneric(&res, *vector) + return +} + +// InnerProduct computes the inner product of two vectors. +// It panics if the vectors don't have the same length. +func (vector *Vector) InnerProduct(other Vector) (res Element) { + innerProductVecGeneric(&res, *vector, other) + return +} + +// Mul multiplies two vectors element-wise and stores the result in self. +// It panics if the vectors don't have the same length. +func (vector *Vector) Mul(a, b Vector) { + mulVecGeneric(*vector, a, b) +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/g1.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/g1.go index e64b53ffa..16dc0b9ff 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/g1.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/g1.go @@ -1,16 +1,5 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -25,107 +14,149 @@ import ( "runtime" ) -// G1Affine point in affine coordinates +// G1Affine is a point in affine coordinates (x,y) type G1Affine struct { X, Y fp.Element } -// G1Jac is a point with fp.Element coordinates +// G1Jac is a point in Jacobian coordinates (x=X/Z², y=Y/Z³) type G1Jac struct { X, Y, Z fp.Element } -// g1JacExtended parameterized Jacobian coordinates (x=X/ZZ, y=Y/ZZZ, ZZ³=ZZZ²) +// g1JacExtended is a point in extended Jacobian coordinates (x=X/ZZ, y=Y/ZZZ, ZZ³=ZZZ²) type g1JacExtended struct { X, Y, ZZ, ZZZ fp.Element } // ------------------------------------------------------------------------------------------------- -// Affine +// Affine coordinates -// Set sets p to the provided point +// Set sets p to a in affine coordinates. func (p *G1Affine) Set(a *G1Affine) *G1Affine { p.X, p.Y = a.X, a.Y return p } -// setInfinity sets p to O -func (p *G1Affine) setInfinity() *G1Affine { +// SetInfinity sets p to the infinity point, which is encoded as (0,0). +// N.B.: (0,0) is never on the curve for j=0 curves (Y²=X³+B). +func (p *G1Affine) SetInfinity() *G1Affine { p.X.SetZero() p.Y.SetZero() return p } -// ScalarMultiplication computes and returns p = a ⋅ s +// ScalarMultiplication computes and returns p = [s]a +// where p and a are affine points. func (p *G1Affine) ScalarMultiplication(a *G1Affine, s *big.Int) *G1Affine { var _p G1Jac _p.FromAffine(a) - _p.mulGLV(&_p, s) + if s.BitLen() >= g1ScalarMulChoose { + _p.mulGLV(&_p, s) + } else { + _p.mulWindowed(&_p, s) + } p.FromJacobian(&_p) return p } -// ScalarMultiplicationAffine computes and returns p = a ⋅ s -// Takes an affine point and returns a Jacobian point (useful for KZG) -func (p *G1Jac) ScalarMultiplicationAffine(a *G1Affine, s *big.Int) *G1Jac { - p.FromAffine(a) - p.mulGLV(p, s) - return p -} - -// ScalarMultiplicationBase computes and returns p = g ⋅ s where g is the prime subgroup generator +// ScalarMultiplicationBase computes and returns p = [s]g +// where g is the affine point generating the prime subgroup. func (p *G1Affine) ScalarMultiplicationBase(s *big.Int) *G1Affine { var _p G1Jac - _p.mulGLV(&g1Gen, s) + if s.BitLen() >= g1ScalarMulChoose { + _p.mulGLV(&g1Gen, s) + } else { + _p.mulWindowed(&g1Gen, s) + } p.FromJacobian(&_p) return p } -// Add adds two point in affine coordinates. -// This should rarely be used as it is very inefficient compared to Jacobian +// Add adds two points in affine coordinates. +// It uses the Jacobian addition with a.Z=b.Z=1 and converts the result to affine coordinates. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-mmadd-2007-bl +// ~Cost: 4M + 2S func (p *G1Affine) Add(a, b *G1Affine) *G1Affine { - var p1, p2 G1Jac - p1.FromAffine(a) - p2.FromAffine(b) - p1.AddAssign(&p2) - p.FromJacobian(&p1) - return p + var q G1Jac + // a is infinity, return b + if a.IsInfinity() { + p.Set(b) + return p + } + // b is infinity, return a + if b.IsInfinity() { + p.Set(a) + return p + } + if a.X.Equal(&b.X) { + // if b == a, we double instead + if a.Y.Equal(&b.Y) { + q.DoubleMixed(a) + return p.FromJacobian(&q) + } else { + // if b == -a, we return 0 + return p.SetInfinity() + } + } + var H, HH, I, J, r, V fp.Element + H.Sub(&b.X, &a.X) + HH.Square(&H) + I.Double(&HH).Double(&I) + J.Mul(&H, &I) + r.Sub(&b.Y, &a.Y) + r.Double(&r) + V.Mul(&a.X, &I) + q.X.Square(&r). + Sub(&q.X, &J). + Sub(&q.X, &V). + Sub(&q.X, &V) + q.Y.Sub(&V, &q.X). + Mul(&q.Y, &r) + J.Mul(&a.Y, &J).Double(&J) + q.Y.Sub(&q.Y, &J) + q.Z.Double(&H) + + return p.FromJacobian(&q) } // Double doubles a point in affine coordinates. -// This should rarely be used as it is very inefficient compared to Jacobian +// It converts the point to Jacobian coordinates, doubles it using Jacobian +// addition with a.Z=1, and converts it back to affine coordinates. +// +// http://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-mdbl-2007-bl +// ~Cost: 1M + 5S func (p *G1Affine) Double(a *G1Affine) *G1Affine { - var p1 G1Jac - p1.FromAffine(a) - p1.Double(&p1) - p.FromJacobian(&p1) + var q G1Jac + q.FromAffine(a) + q.DoubleMixed(a) + p.FromJacobian(&q) return p } -// Sub subs two point in affine coordinates. -// This should rarely be used as it is very inefficient compared to Jacobian +// Sub subtracts two points in affine coordinates. +// It uses a similar approach to Add, but negates the second point before adding. func (p *G1Affine) Sub(a, b *G1Affine) *G1Affine { - var p1, p2 G1Jac - p1.FromAffine(a) - p2.FromAffine(b) - p1.SubAssign(&p2) - p.FromJacobian(&p1) + var bneg G1Affine + bneg.Neg(b) + p.Add(a, &bneg) return p } -// Equal tests if two points (in Affine coordinates) are equal +// Equal tests if two points in affine coordinates are equal. func (p *G1Affine) Equal(a *G1Affine) bool { return p.X.Equal(&a.X) && p.Y.Equal(&a.Y) } -// Neg computes -G +// Neg sets p to the affine negative point -a = (a.X, -a.Y). func (p *G1Affine) Neg(a *G1Affine) *G1Affine { p.X = a.X p.Y.Neg(&a.Y) return p } -// FromJacobian rescales a point in Jacobian coord in z=1 plane +// FromJacobian converts a point p1 from Jacobian to affine coordinates. func (p *G1Affine) FromJacobian(p1 *G1Jac) *G1Affine { var a, b fp.Element @@ -144,7 +175,7 @@ func (p *G1Affine) FromJacobian(p1 *G1Jac) *G1Affine { return p } -// String returns the string representation of the point or "O" if it is infinity +// String returns the string representation E(x,y) of the affine point p or "O" if it is infinity. func (p *G1Affine) String() string { if p.IsInfinity() { return "O" @@ -152,106 +183,101 @@ func (p *G1Affine) String() string { return "E([" + p.X.String() + "," + p.Y.String() + "])" } -// IsInfinity checks if the point is infinity -// in affine, it's encoded as (0,0) -// (0,0) is never on the curve for j=0 curves +// IsInfinity checks if the affine point p is infinity, which is encoded as (0,0). +// N.B.: (0,0) is never on the curve for j=0 curves (Y²=X³+B). func (p *G1Affine) IsInfinity() bool { return p.X.IsZero() && p.Y.IsZero() } -// IsOnCurve returns true if p in on the curve +// IsOnCurve returns true if the affine point p in on the curve. func (p *G1Affine) IsOnCurve() bool { - var point G1Jac - point.FromAffine(p) - return point.IsOnCurve() // call this function to handle infinity point + if p.IsInfinity() { + return true + } + var left, right fp.Element + left.Square(&p.Y) + right.Square(&p.X).Mul(&right, &p.X) + right.Add(&right, &bCurveCoeff) + return left.Equal(&right) } -// IsInSubGroup returns true if p is in the correct subgroup, false otherwise +// IsInSubGroup returns true if the affine point p is in the correct subgroup, false otherwise. func (p *G1Affine) IsInSubGroup() bool { - var _p G1Jac - _p.FromAffine(p) - return _p.IsInSubGroup() + return p.IsOnCurve() } // ------------------------------------------------------------------------------------------------- -// Jacobian +// Jacobian coordinates -// Set sets p to the provided point -func (p *G1Jac) Set(a *G1Jac) *G1Jac { - p.X, p.Y, p.Z = a.X, a.Y, a.Z +// Set sets p to a in Jacobian coordinates. +func (p *G1Jac) Set(q *G1Jac) *G1Jac { + p.X, p.Y, p.Z = q.X, q.Y, q.Z return p } -// Equal tests if two points (in Jacobian coordinates) are equal -func (p *G1Jac) Equal(a *G1Jac) bool { +// Equal tests if two points in Jacobian coordinates are equal. +func (p *G1Jac) Equal(q *G1Jac) bool { // If one point is infinity, the other must also be infinity. if p.Z.IsZero() { - return a.Z.IsZero() + return q.Z.IsZero() } // If the other point is infinity, return false since we can't // the following checks would be incorrect. - if a.Z.IsZero() { + if q.Z.IsZero() { return false } var pZSquare, aZSquare fp.Element pZSquare.Square(&p.Z) - aZSquare.Square(&a.Z) + aZSquare.Square(&q.Z) var lhs, rhs fp.Element lhs.Mul(&p.X, &aZSquare) - rhs.Mul(&a.X, &pZSquare) + rhs.Mul(&q.X, &pZSquare) if !lhs.Equal(&rhs) { return false } - lhs.Mul(&p.Y, &aZSquare).Mul(&lhs, &a.Z) - rhs.Mul(&a.Y, &pZSquare).Mul(&rhs, &p.Z) + lhs.Mul(&p.Y, &aZSquare).Mul(&lhs, &q.Z) + rhs.Mul(&q.Y, &pZSquare).Mul(&rhs, &p.Z) return lhs.Equal(&rhs) } -// Neg computes -G -func (p *G1Jac) Neg(a *G1Jac) *G1Jac { - *p = *a - p.Y.Neg(&a.Y) - return p -} - -// SubAssign subtracts two points on the curve -func (p *G1Jac) SubAssign(a *G1Jac) *G1Jac { - var tmp G1Jac - tmp.Set(a) - tmp.Y.Neg(&tmp.Y) - p.AddAssign(&tmp) +// Neg sets p to the Jacobian negative point -q = (q.X, -q.Y, q.Z). +func (p *G1Jac) Neg(q *G1Jac) *G1Jac { + *p = *q + p.Y.Neg(&q.Y) return p } -// AddAssign point addition in montgomery form -// https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#addition-add-2007-bl -func (p *G1Jac) AddAssign(a *G1Jac) *G1Jac { +// AddAssign sets p to p+a in Jacobian coordinates. +// +// https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-add-2007-bl +// ~Cost: 11M + 5S +func (p *G1Jac) AddAssign(q *G1Jac) *G1Jac { - // p is infinity, return a + // p is infinity, return q if p.Z.IsZero() { - p.Set(a) + p.Set(q) return p } - // a is infinity, return p - if a.Z.IsZero() { + // q is infinity, return p + if q.Z.IsZero() { return p } var Z1Z1, Z2Z2, U1, U2, S1, S2, H, I, J, r, V fp.Element - Z1Z1.Square(&a.Z) + Z1Z1.Square(&q.Z) Z2Z2.Square(&p.Z) - U1.Mul(&a.X, &Z2Z2) + U1.Mul(&q.X, &Z2Z2) U2.Mul(&p.X, &Z1Z1) - S1.Mul(&a.Y, &p.Z). + S1.Mul(&q.Y, &p.Z). Mul(&S1, &Z2Z2) - S2.Mul(&p.Y, &a.Z). + S2.Mul(&p.Y, &q.Z). Mul(&S2, &Z1Z1) - // if p == a, we double instead + // if p == q, we double instead if U1.Equal(&U2) && S1.Equal(&S2) { return p.DoubleAssign() } @@ -270,7 +296,7 @@ func (p *G1Jac) AddAssign(a *G1Jac) *G1Jac { Mul(&p.Y, &r) S1.Mul(&S1, &J).Double(&S1) p.Y.Sub(&p.Y, &S1) - p.Z.Add(&p.Z, &a.Z) + p.Z.Add(&p.Z, &q.Z) p.Z.Square(&p.Z). Sub(&p.Z, &Z1Z1). Sub(&p.Z, &Z2Z2). @@ -279,8 +305,51 @@ func (p *G1Jac) AddAssign(a *G1Jac) *G1Jac { return p } -// AddMixed point addition +// SubAssign sets p to p-a in Jacobian coordinates. +// It uses a similar approach to AddAssign, but negates the point a before adding. +func (p *G1Jac) SubAssign(q *G1Jac) *G1Jac { + var tmp G1Jac + tmp.Set(q) + tmp.Y.Neg(&tmp.Y) + p.AddAssign(&tmp) + return p +} + +// Double sets p to [2]q in Jacobian coordinates. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-mdbl-2007-bl +// ~Cost: 1M + 5S +func (p *G1Jac) DoubleMixed(a *G1Affine) *G1Jac { + var XX, YY, YYYY, S, M, T fp.Element + XX.Square(&a.X) + YY.Square(&a.Y) + YYYY.Square(&YY) + S.Add(&a.X, &YY). + Square(&S). + Sub(&S, &XX). + Sub(&S, &YYYY). + Double(&S) + M.Double(&XX). + Add(&M, &XX) // -> + A, but A=0 here + T.Square(&M). + Sub(&T, &S). + Sub(&T, &S) + p.X.Set(&T) + p.Y.Sub(&S, &T). + Mul(&p.Y, &M) + YYYY.Double(&YYYY). + Double(&YYYY). + Double(&YYYY) + p.Y.Sub(&p.Y, &YYYY) + p.Z.Double(&a.Y) + + return p +} + +// AddMixed sets p to p+a in Jacobian coordinates, where a.Z = 1. +// // http://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-madd-2007-bl +// ~Cost: 7M + 4S func (p *G1Jac) AddMixed(a *G1Affine) *G1Jac { //if a is infinity return p @@ -303,7 +372,7 @@ func (p *G1Jac) AddMixed(a *G1Affine) *G1Jac { // if p == a, we double instead if U2.Equal(&p.X) && S2.Equal(&p.Y) { - return p.DoubleAssign() + return p.DoubleMixed(a) } H.Sub(&U2, &p.X) @@ -328,83 +397,100 @@ func (p *G1Jac) AddMixed(a *G1Affine) *G1Jac { return p } -// Double doubles a point in Jacobian coordinates -// https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2007-bl +// Double sets p to [2]q in Jacobian coordinates. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l +// ~Cost: 2M + 5S func (p *G1Jac) Double(q *G1Jac) *G1Jac { p.Set(q) p.DoubleAssign() return p } -// DoubleAssign doubles a point in Jacobian coordinates -// https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2007-bl +// DoubleAssign doubles p in Jacobian coordinates. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l +// ~Cost: 2M + 5S func (p *G1Jac) DoubleAssign() *G1Jac { - - var XX, YY, YYYY, ZZ, S, M, T fp.Element - - XX.Square(&p.X) - YY.Square(&p.Y) - YYYY.Square(&YY) - ZZ.Square(&p.Z) - S.Add(&p.X, &YY) - S.Square(&S). - Sub(&S, &XX). - Sub(&S, &YYYY). - Double(&S) - M.Double(&XX).Add(&M, &XX) - p.Z.Add(&p.Z, &p.Y). - Square(&p.Z). - Sub(&p.Z, &YY). - Sub(&p.Z, &ZZ) - T.Square(&M) - p.X = T - T.Double(&S) - p.X.Sub(&p.X, &T) - p.Y.Sub(&S, &p.X). - Mul(&p.Y, &M) - YYYY.Double(&YYYY).Double(&YYYY).Double(&YYYY) - p.Y.Sub(&p.Y, &YYYY) + var A, B, C, D, E, F, t fp.Element + A.Square(&p.X) + B.Square(&p.Y) + C.Square(&B) + D.Add(&p.X, &B). + Square(&D). + Sub(&D, &A). + Sub(&D, &C). + Double(&D) + E.Double(&A). + Add(&E, &A) + F.Square(&E) + t.Double(&D) + p.Z.Mul(&p.Y, &p.Z). + Double(&p.Z) + p.X.Sub(&F, &t) + p.Y.Sub(&D, &p.X). + Mul(&p.Y, &E) + t.Double(&C). + Double(&t). + Double(&t) + p.Y.Sub(&p.Y, &t) return p } -// ScalarMultiplication computes and returns p = a ⋅ s +// ScalarMultiplication computes and returns p = [s]a +// where p and a are Jacobian points. +// using the GLV technique. // see https://www.iacr.org/archive/crypto2001/21390189.pdf -func (p *G1Jac) ScalarMultiplication(a *G1Jac, s *big.Int) *G1Jac { - return p.mulGLV(a, s) +func (p *G1Jac) ScalarMultiplication(q *G1Jac, s *big.Int) *G1Jac { + if s.BitLen() >= g1ScalarMulChoose { + return p.mulGLV(q, s) + } else { + return p.mulWindowed(q, s) + } +} + +// ScalarMultiplicationBase computes and returns p = [s]g +// where g is the prime subgroup generator. +func (p *G1Jac) ScalarMultiplicationBase(s *big.Int) *G1Jac { + if s.BitLen() >= g1ScalarMulChoose { + return p.mulGLV(&g1Gen, s) + } else { + return p.mulWindowed(&g1Gen, s) + } + } -// String returns canonical representation of the point in affine coordinates +// String converts p to affine coordinates and returns its string representation E(x,y) or "O" if it is infinity. func (p *G1Jac) String() string { _p := G1Affine{} _p.FromJacobian(p) return _p.String() } -// FromAffine sets p = Q, p in Jacobian, Q in affine -func (p *G1Jac) FromAffine(Q *G1Affine) *G1Jac { - if Q.IsInfinity() { +// FromAffine converts a point a from affine to Jacobian coordinates. +func (p *G1Jac) FromAffine(a *G1Affine) *G1Jac { + if a.IsInfinity() { p.Z.SetZero() p.X.SetOne() p.Y.SetOne() return p } p.Z.SetOne() - p.X.Set(&Q.X) - p.Y.Set(&Q.Y) + p.X.Set(&a.X) + p.Y.Set(&a.Y) return p } -// IsOnCurve returns true if p in on the curve +// IsOnCurve returns true if the Jacobian point p in on the curve. func (p *G1Jac) IsOnCurve() bool { - var left, right, tmp fp.Element + var left, right, tmp, ZZ fp.Element left.Square(&p.Y) right.Square(&p.X).Mul(&right, &p.X) - tmp.Square(&p.Z). - Square(&tmp). - Mul(&tmp, &p.Z). - Mul(&tmp, &p.Z). - Mul(&tmp, &bCurveCoeff) + ZZ.Square(&p.Z) + tmp.Square(&ZZ).Mul(&tmp, &ZZ) + // Mul tmp by bCurveCoeff=3 + fp.MulBy3(&tmp) right.Add(&right, &tmp) return left.Equal(&right) } @@ -418,13 +504,14 @@ func (p *G1Jac) IsInSubGroup() bool { } -// mulWindowed computes a 2-bits windowed scalar multiplication -func (p *G1Jac) mulWindowed(a *G1Jac, s *big.Int) *G1Jac { +// mulWindowed computes the 2-bits windowed double-and-add scalar +// multiplication p=[s]q in Jacobian coordinates. +func (p *G1Jac) mulWindowed(q *G1Jac, s *big.Int) *G1Jac { var res G1Jac var ops [3]G1Jac - ops[0].Set(a) + ops[0].Set(q) if s.Sign() == -1 { ops[0].Neg(&ops[0]) } @@ -451,17 +538,74 @@ func (p *G1Jac) mulWindowed(a *G1Jac, s *big.Int) *G1Jac { } -// ϕ assigns p to ϕ(a) where ϕ: (x,y) → (w x,y), and returns p -// where w is a third root of unity in 𝔽p -func (p *G1Jac) phi(a *G1Jac) *G1Jac { - p.Set(a) +// mulBySeed multiplies the point q by the seed xGen in Jacobian coordinates +// using an optimized addition chain. +func (p *G1Jac) mulBySeed(q *G1Jac) *G1Jac { + // Generated by github.com/mmcloughlin/addchain v0.4.0. + // Operations: 62 squares 17 multiplies + + // Allocate Temporaries. + var res, t0, t1, t2, t3 G1Jac + + res.Double(q) + t0.Set(q).AddAssign(&res) + t2.Set(q).AddAssign(&t0) + t1.Set(&res).AddAssign(&t2) + res.Double(&t1) + res.AddAssign(&t0) + t0.AddAssign(&res) + t2.AddAssign(&t0) + t1.AddAssign(&t2) + t0.AddAssign(&t1) + t1.AddAssign(&t0) + t0.AddAssign(&t1) + t2.AddAssign(&t0) + t3.Double(&t2) + t1.AddAssign(&t3) + t2.AddAssign(&t1) + res.AddAssign(&t2) + t2.AddAssign(&res) + t3.Double(&t2) + res.AddAssign(&t3) + t0.AddAssign(&res) + t1.AddAssign(&t0) + t3.Double(&t1) + for s := 1; s < 2; s++ { + t3.Double(&t3) + } + t3.AddAssign(&t1) + t2.AddAssign(&t3) + t1.AddAssign(&t2) + t2.AddAssign(&t1) + for s := 0; s < 17; s++ { + t2.Double(&t2) + } + t1.AddAssign(&t2) + for s := 0; s < 14; s++ { + t1.Double(&t1) + } + t0.AddAssign(&t1) + for s := 0; s < 16; s++ { + t0.Double(&t0) + } + res.AddAssign(&t0) + + p.Set(&res) + return p +} + +// phi sets p to ϕ(a) where ϕ: (x,y) → (w x,y), +// where w is a third root of unity. +func (p *G1Jac) phi(q *G1Jac) *G1Jac { + p.Set(q) p.X.Mul(&p.X, &thirdRootOneG1) return p } // mulGLV computes the scalar multiplication using a windowed-GLV method +// // see https://www.iacr.org/archive/crypto2001/21390189.pdf -func (p *G1Jac) mulGLV(a *G1Jac, s *big.Int) *G1Jac { +func (p *G1Jac) mulGLV(q *G1Jac, s *big.Int) *G1Jac { var table [15]G1Jac var res G1Jac @@ -469,11 +613,11 @@ func (p *G1Jac) mulGLV(a *G1Jac, s *big.Int) *G1Jac { res.Set(&g1Infinity) - // table[b3b2b1b0-1] = b3b2 ⋅ ϕ(a) + b1b0*a - table[0].Set(a) - table[3].phi(a) + // table[b3b2b1b0-1] = b3b2 ⋅ ϕ(q) + b1b0*q + table[0].Set(q) + table[3].phi(q) - // split the scalar, modifies ±a, ϕ(a) accordingly + // split the scalar, modifies ±q, ϕ(q) accordingly k := ecc.SplitScalar(s, &glvBasis) if k[0].Sign() == -1 { @@ -486,7 +630,7 @@ func (p *G1Jac) mulGLV(a *G1Jac, s *big.Int) *G1Jac { } // precompute table (2 bits sliding window) - // table[b3b2b1b0-1] = b3b2 ⋅ ϕ(a) + b1b0 ⋅ a if b3b2b1b0 != 0 + // table[b3b2b1b0-1] = b3b2 ⋅ ϕ(q) + b1b0 ⋅ q if b3b2b1b0 != 0 table[1].Double(&table[0]) table[2].Set(&table[1]).AddAssign(&table[0]) table[4].Set(&table[3]).AddAssign(&table[0]) @@ -532,14 +676,14 @@ func (p *G1Jac) mulGLV(a *G1Jac, s *big.Int) *G1Jac { return p } -// JointScalarMultiplicationBase computes [s1]g+[s2]a using Straus-Shamir technique -// where g is the prime subgroup generator -func (p *G1Jac) JointScalarMultiplicationBase(a *G1Affine, s1, s2 *big.Int) *G1Jac { +// JointScalarMultiplication computes [s1]a1+[s2]a2 using Strauss-Shamir technique +// where a1 and a2 are affine points. +func (p *G1Jac) JointScalarMultiplication(a1, a2 *G1Affine, s1, s2 *big.Int) *G1Jac { var res, p1, p2 G1Jac res.Set(&g1Infinity) - p1.Set(&g1Gen) - p2.FromAffine(a) + p1.FromAffine(a1) + p2.FromAffine(a2) var table [15]G1Jac @@ -603,17 +747,24 @@ func (p *G1Jac) JointScalarMultiplicationBase(a *G1Affine, s1, s2 *big.Int) *G1J } +// JointScalarMultiplicationBase computes [s1]g+[s2]a using Straus-Shamir technique +// where g is the prime subgroup generator. +func (p *G1Jac) JointScalarMultiplicationBase(a *G1Affine, s1, s2 *big.Int) *G1Jac { + return p.JointScalarMultiplication(&g1GenAff, a, s1, s2) + +} + // ------------------------------------------------------------------------------------------------- -// Jacobian extended +// extended Jacobian coordinates -// Set sets p to the provided point -func (p *g1JacExtended) Set(a *g1JacExtended) *g1JacExtended { - p.X, p.Y, p.ZZ, p.ZZZ = a.X, a.Y, a.ZZ, a.ZZZ +// Set sets p to a in extended Jacobian coordinates. +func (p *g1JacExtended) Set(q *g1JacExtended) *g1JacExtended { + p.X, p.Y, p.ZZ, p.ZZZ = q.X, q.Y, q.ZZ, q.ZZZ return p } -// setInfinity sets p to O -func (p *g1JacExtended) setInfinity() *g1JacExtended { +// SetInfinity sets p to the infinity point (1,1,0,0). +func (p *g1JacExtended) SetInfinity() *g1JacExtended { p.X.SetOne() p.Y.SetOne() p.ZZ = fp.Element{} @@ -621,44 +772,47 @@ func (p *g1JacExtended) setInfinity() *g1JacExtended { return p } -func (p *g1JacExtended) IsZero() bool { +// IsInfinity checks if the p is infinity, i.e. p.ZZ=0. +func (p *g1JacExtended) IsInfinity() bool { return p.ZZ.IsZero() } -// fromJacExtended sets Q in affine coordinates -func (p *G1Affine) fromJacExtended(Q *g1JacExtended) *G1Affine { - if Q.ZZ.IsZero() { +// fromJacExtended converts an extended Jacobian point to an affine point. +func (p *G1Affine) fromJacExtended(q *g1JacExtended) *G1Affine { + if q.ZZ.IsZero() { p.X = fp.Element{} p.Y = fp.Element{} return p } - p.X.Inverse(&Q.ZZ).Mul(&p.X, &Q.X) - p.Y.Inverse(&Q.ZZZ).Mul(&p.Y, &Q.Y) + p.X.Inverse(&q.ZZ).Mul(&p.X, &q.X) + p.Y.Inverse(&q.ZZZ).Mul(&p.Y, &q.Y) return p } -// fromJacExtended sets Q in Jacobian coordinates -func (p *G1Jac) fromJacExtended(Q *g1JacExtended) *G1Jac { - if Q.ZZ.IsZero() { +// fromJacExtended converts an extended Jacobian point to a Jacobian point. +func (p *G1Jac) fromJacExtended(q *g1JacExtended) *G1Jac { + if q.ZZ.IsZero() { p.Set(&g1Infinity) return p } - p.X.Mul(&Q.ZZ, &Q.X).Mul(&p.X, &Q.ZZ) - p.Y.Mul(&Q.ZZZ, &Q.Y).Mul(&p.Y, &Q.ZZZ) - p.Z.Set(&Q.ZZZ) + p.X.Mul(&q.ZZ, &q.X).Mul(&p.X, &q.ZZ) + p.Y.Mul(&q.ZZZ, &q.Y).Mul(&p.Y, &q.ZZZ) + p.Z.Set(&q.ZZZ) return p } -// unsafeFromJacExtended sets p in Jacobian coordinates, but don't check for infinity -func (p *G1Jac) unsafeFromJacExtended(Q *g1JacExtended) *G1Jac { - p.X.Square(&Q.ZZ).Mul(&p.X, &Q.X) - p.Y.Square(&Q.ZZZ).Mul(&p.Y, &Q.Y) - p.Z = Q.ZZZ +// unsafeFromJacExtended converts an extended Jacobian point, distinct from Infinity, to a Jacobian point. +func (p *G1Jac) unsafeFromJacExtended(q *g1JacExtended) *G1Jac { + p.X.Square(&q.ZZ).Mul(&p.X, &q.X) + p.Y.Square(&q.ZZZ).Mul(&p.Y, &q.Y) + p.Z = q.ZZZ return p } -// add point in Jacobian extended coordinates +// add sets p to p+q in extended Jacobian coordinates. +// // https://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#addition-add-2008-s +// ~Cost: 12M + 2S func (p *g1JacExtended) add(q *g1JacExtended) *g1JacExtended { //if q is infinity return p if q.ZZ.IsZero() { @@ -713,10 +867,13 @@ func (p *g1JacExtended) add(q *g1JacExtended) *g1JacExtended { return p } -// double point in Jacobian extended coordinates +// double sets p to [2]q in Jacobian extended coordinates. +// // http://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#doubling-dbl-2008-s-1 -// since we consider any point on Z=0 as the point at infinity -// this doubling formula works for infinity points as well +// ~Cost: 6M + 3S +// +// N.B.: since we consider any point on Z=0 as the point at infinity +// this doubling formula works for infinity points as well. func (p *g1JacExtended) double(q *g1JacExtended) *g1JacExtended { var U, V, W, S, XX, M fp.Element @@ -726,7 +883,7 @@ func (p *g1JacExtended) double(q *g1JacExtended) *g1JacExtended { S.Mul(&q.X, &V) XX.Square(&q.X) M.Double(&XX). - Add(&M, &XX) // -> + a, but a=0 here + Add(&M, &XX) // -> + A, but A=0 here U.Mul(&W, &q.Y) p.X.Square(&M). @@ -741,9 +898,11 @@ func (p *g1JacExtended) double(q *g1JacExtended) *g1JacExtended { return p } -// subMixed same as addMixed, but will negate a.Y +// addMixed sets p to p+q in extended Jacobian coordinates, where a.ZZ=1. +// // http://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#addition-madd-2008-s -func (p *g1JacExtended) subMixed(a *G1Affine) *g1JacExtended { +// ~Cost: 8M + 2S +func (p *g1JacExtended) addMixed(a *G1Affine) *g1JacExtended { //if a is infinity return p if a.IsInfinity() { @@ -752,7 +911,7 @@ func (p *g1JacExtended) subMixed(a *G1Affine) *g1JacExtended { // p is infinity, return a if p.ZZ.IsZero() { p.X = a.X - p.Y.Neg(&a.Y) + p.Y = a.Y p.ZZ.SetOne() p.ZZZ.SetOne() return p @@ -765,12 +924,11 @@ func (p *g1JacExtended) subMixed(a *G1Affine) *g1JacExtended { P.Sub(&P, &p.X) R.Mul(&a.Y, &p.ZZZ) - R.Neg(&R) R.Sub(&R, &p.Y) if P.IsZero() { if R.IsZero() { - return p.doubleNegMixed(a) + return p.doubleMixed(a) } p.ZZ = fp.Element{} @@ -797,9 +955,11 @@ func (p *g1JacExtended) subMixed(a *G1Affine) *g1JacExtended { } -// addMixed +// subMixed works the same as addMixed, but negates a.Y. +// // http://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#addition-madd-2008-s -func (p *g1JacExtended) addMixed(a *G1Affine) *g1JacExtended { +// ~Cost: 8M + 2S +func (p *g1JacExtended) subMixed(a *G1Affine) *g1JacExtended { //if a is infinity return p if a.IsInfinity() { @@ -808,7 +968,7 @@ func (p *g1JacExtended) addMixed(a *G1Affine) *g1JacExtended { // p is infinity, return a if p.ZZ.IsZero() { p.X = a.X - p.Y = a.Y + p.Y.Neg(&a.Y) p.ZZ.SetOne() p.ZZZ.SetOne() return p @@ -821,11 +981,12 @@ func (p *g1JacExtended) addMixed(a *G1Affine) *g1JacExtended { P.Sub(&P, &p.X) R.Mul(&a.Y, &p.ZZZ) + R.Neg(&R) R.Sub(&R, &p.Y) if P.IsZero() { if R.IsZero() { - return p.doubleMixed(a) + return p.doubleNegMixed(a) } p.ZZ = fp.Element{} @@ -852,54 +1013,57 @@ func (p *g1JacExtended) addMixed(a *G1Affine) *g1JacExtended { } -// doubleNegMixed same as double, but will negate q.Y -func (p *g1JacExtended) doubleNegMixed(q *G1Affine) *g1JacExtended { +// doubleNegMixed works the same as doubleMixed, but negates q.Y. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#doubling-mdbl-2008-s-1 +// ~Cost: 4M + 3S +func (p *g1JacExtended) doubleNegMixed(a *G1Affine) *g1JacExtended { - var U, V, W, S, XX, M, S2, L fp.Element + var U, V, W, S, M, t fp.Element - U.Double(&q.Y) + U.Double(&a.Y) U.Neg(&U) V.Square(&U) W.Mul(&U, &V) - S.Mul(&q.X, &V) - XX.Square(&q.X) - M.Double(&XX). - Add(&M, &XX) // -> + a, but a=0 here - S2.Double(&S) - L.Mul(&W, &q.Y) - - p.X.Square(&M). - Sub(&p.X, &S2) + S.Mul(&a.X, &V) + t.Square(&a.X) + M.Double(&t). + Add(&M, &t) // -> + A, but A=0 here + p.X.Square(&M) + t.Double(&S) + p.X.Sub(&p.X, &t) + t.Mul(&W, &a.Y) p.Y.Sub(&S, &p.X). Mul(&p.Y, &M). - Add(&p.Y, &L) + Add(&p.Y, &t) p.ZZ.Set(&V) p.ZZZ.Set(&W) return p } -// doubleMixed point in Jacobian extended coordinates -// http://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#doubling-dbl-2008-s-1 -func (p *g1JacExtended) doubleMixed(q *G1Affine) *g1JacExtended { +// doubleMixed sets p to [2]a in Jacobian extended coordinates, where a.ZZ=1. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#doubling-mdbl-2008-s-1 +// ~Cost: 4M + 3S +func (p *g1JacExtended) doubleMixed(a *G1Affine) *g1JacExtended { - var U, V, W, S, XX, M, S2, L fp.Element + var U, V, W, S, M, t fp.Element - U.Double(&q.Y) + U.Double(&a.Y) V.Square(&U) W.Mul(&U, &V) - S.Mul(&q.X, &V) - XX.Square(&q.X) - M.Double(&XX). - Add(&M, &XX) // -> + a, but a=0 here - S2.Double(&S) - L.Mul(&W, &q.Y) - - p.X.Square(&M). - Sub(&p.X, &S2) + S.Mul(&a.X, &V) + t.Square(&a.X) + M.Double(&t). + Add(&M, &t) // -> + A, but A=0 here + p.X.Square(&M) + t.Double(&S) + p.X.Sub(&p.X, &t) + t.Mul(&W, &a.Y) p.Y.Sub(&S, &p.X). Mul(&p.Y, &M). - Sub(&p.Y, &L) + Sub(&p.Y, &t) p.ZZ.Set(&V) p.ZZZ.Set(&W) @@ -907,7 +1071,7 @@ func (p *g1JacExtended) doubleMixed(q *G1Affine) *g1JacExtended { } // BatchJacobianToAffineG1 converts points in Jacobian coordinates to Affine coordinates -// performing a single field inversion (Montgomery batch inversion trick). +// performing a single field inversion using the Montgomery batch inversion trick. func BatchJacobianToAffineG1(points []G1Jac) []G1Affine { result := make([]G1Affine, len(points)) zeroes := make([]bool, len(points)) @@ -957,7 +1121,7 @@ func BatchJacobianToAffineG1(points []G1Jac) []G1Affine { // BatchScalarMultiplicationG1 multiplies the same base by all scalars // and return resulting points in affine coordinates -// uses a simple windowed-NAF like exponentiation algorithm +// uses a simple windowed-NAF-like multiplication algorithm. func BatchScalarMultiplicationG1(base *G1Affine, scalars []fr.Element) []G1Affine { // approximate cost in group ops is // cost = 2^{c-1} + n(scalar.nbBits+nbChunks) @@ -1039,18 +1203,29 @@ func BatchScalarMultiplicationG1(base *G1Affine, scalars []fr.Element) []G1Affin return toReturnAff } -// batch add affine coordinates -// using batch inversion -// special cases (doubling, infinity) must be filtered out before this call +// batchAddG1Affine adds affine points using the Montgomery batch inversion trick. +// Special cases (doubling, infinity) must be filtered out before this call. func batchAddG1Affine[TP pG1Affine, TPP ppG1Affine, TC cG1Affine](R *TPP, P *TP, batchSize int) { var lambda, lambdain TC - // add part + // from https://docs.zkproof.org/pages/standards/accepted-workshop3/proposal-turbo_plonk.pdf + // affine point addition formula + // R(X1, Y1) + P(X2, Y2) = Q(X3, Y3) + // λ = (Y2 - Y1) / (X2 - X1) + // X3 = λ² - (X1 + X2) + // Y3 = λ * (X1 - X3) - Y1 + + // first we compute the 1 / (X2 - X1) for all points using Montgomery batch inversion trick + + // X2 - X1 for j := 0; j < batchSize; j++ { lambdain[j].Sub(&(*P)[j].X, &(*R)[j].X) } - // invert denominator using montgomery batch invert technique + // montgomery batch inversion; + // lambda[0] = 1 / (P[0].X - R[0].X) + // lambda[1] = 1 / (P[1].X - R[1].X) + // ... { var accumulator fp.Element lambda[0].SetOne() @@ -1070,22 +1245,24 @@ func batchAddG1Affine[TP pG1Affine, TPP ppG1Affine, TC cG1Affine](R *TPP, P *TP, lambda[0].Set(&accumulator) } - var d fp.Element - var rr G1Affine + var t fp.Element + var Q G1Affine - // add part for j := 0; j < batchSize; j++ { - // computa lambda - d.Sub(&(*P)[j].Y, &(*R)[j].Y) - lambda[j].Mul(&lambda[j], &d) - - // compute X, Y - rr.X.Square(&lambda[j]) - rr.X.Sub(&rr.X, &(*R)[j].X) - rr.X.Sub(&rr.X, &(*P)[j].X) - d.Sub(&(*R)[j].X, &rr.X) - rr.Y.Mul(&lambda[j], &d) - rr.Y.Sub(&rr.Y, &(*R)[j].Y) - (*R)[j].Set(&rr) + // λ = (Y2 - Y1) / (X2 - X1) + t.Sub(&(*P)[j].Y, &(*R)[j].Y) + lambda[j].Mul(&lambda[j], &t) + + // X3 = λ² - (X1 + X2) + Q.X.Square(&lambda[j]) + Q.X.Sub(&Q.X, &(*R)[j].X) + Q.X.Sub(&Q.X, &(*P)[j].X) + + // Y3 = λ * (X1 - X3) - Y1 + t.Sub(&(*R)[j].X, &Q.X) + Q.Y.Mul(&lambda[j], &t) + Q.Y.Sub(&Q.Y, &(*R)[j].Y) + + (*R)[j].Set(&Q) } } diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/g2.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/g2.go index b4f279fc3..4bb5dd8f0 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/g2.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/g2.go @@ -1,22 +1,12 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT package bn254 import ( + "crypto/rand" "github.com/consensys/gnark-crypto/ecc" "github.com/consensys/gnark-crypto/ecc/bn254/fr" "github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower" @@ -25,17 +15,17 @@ import ( "runtime" ) -// G2Affine point in affine coordinates +// G2Affine is a point in affine coordinates (x,y) type G2Affine struct { X, Y fptower.E2 } -// G2Jac is a point with fptower.E2 coordinates +// G2Jac is a point in Jacobian coordinates (x=X/Z², y=Y/Z³) type G2Jac struct { X, Y, Z fptower.E2 } -// g2JacExtended parameterized Jacobian coordinates (x=X/ZZ, y=Y/ZZZ, ZZ³=ZZZ²) +// g2JacExtended is a point in extended Jacobian coordinates (x=X/ZZ, y=Y/ZZZ, ZZ³=ZZZ²) type g2JacExtended struct { X, Y, ZZ, ZZZ fptower.E2 } @@ -46,75 +36,133 @@ type g2Proj struct { } // ------------------------------------------------------------------------------------------------- -// Affine +// Affine coordinates -// Set sets p to the provided point +// Set sets p to a in affine coordinates. func (p *G2Affine) Set(a *G2Affine) *G2Affine { p.X, p.Y = a.X, a.Y return p } -// setInfinity sets p to O -func (p *G2Affine) setInfinity() *G2Affine { +// SetInfinity sets p to the infinity point, which is encoded as (0,0). +// N.B.: (0,0) is never on the curve for j=0 curves (Y²=X³+B). +func (p *G2Affine) SetInfinity() *G2Affine { p.X.SetZero() p.Y.SetZero() return p } -// ScalarMultiplication computes and returns p = a ⋅ s +// ScalarMultiplication computes and returns p = [s]a +// where p and a are affine points. func (p *G2Affine) ScalarMultiplication(a *G2Affine, s *big.Int) *G2Affine { var _p G2Jac _p.FromAffine(a) - _p.mulGLV(&_p, s) + if s.BitLen() >= g2ScalarMulChoose { + _p.mulGLV(&_p, s) + } else { + _p.mulWindowed(&_p, s) + } p.FromJacobian(&_p) return p } -// Add adds two point in affine coordinates. -// This should rarely be used as it is very inefficient compared to Jacobian -func (p *G2Affine) Add(a, b *G2Affine) *G2Affine { - var p1, p2 G2Jac - p1.FromAffine(a) - p2.FromAffine(b) - p1.AddAssign(&p2) - p.FromJacobian(&p1) +// ScalarMultiplicationBase computes and returns p = [s]g +// where g is the affine point generating the prime subgroup. +func (p *G2Affine) ScalarMultiplicationBase(s *big.Int) *G2Affine { + var _p G2Jac + if s.BitLen() >= g2ScalarMulChoose { + _p.mulGLV(&g2Gen, s) + } else { + _p.mulWindowed(&g2Gen, s) + } + p.FromJacobian(&_p) return p } +// Add adds two points in affine coordinates. +// It uses the Jacobian addition with a.Z=b.Z=1 and converts the result to affine coordinates. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-mmadd-2007-bl +// ~Cost: 4M + 2S +func (p *G2Affine) Add(a, b *G2Affine) *G2Affine { + var q G2Jac + // a is infinity, return b + if a.IsInfinity() { + p.Set(b) + return p + } + // b is infinity, return a + if b.IsInfinity() { + p.Set(a) + return p + } + if a.X.Equal(&b.X) { + // if b == a, we double instead + if a.Y.Equal(&b.Y) { + q.DoubleMixed(a) + return p.FromJacobian(&q) + } else { + // if b == -a, we return 0 + return p.SetInfinity() + } + } + var H, HH, I, J, r, V fptower.E2 + H.Sub(&b.X, &a.X) + HH.Square(&H) + I.Double(&HH).Double(&I) + J.Mul(&H, &I) + r.Sub(&b.Y, &a.Y) + r.Double(&r) + V.Mul(&a.X, &I) + q.X.Square(&r). + Sub(&q.X, &J). + Sub(&q.X, &V). + Sub(&q.X, &V) + q.Y.Sub(&V, &q.X). + Mul(&q.Y, &r) + J.Mul(&a.Y, &J).Double(&J) + q.Y.Sub(&q.Y, &J) + q.Z.Double(&H) + + return p.FromJacobian(&q) +} + // Double doubles a point in affine coordinates. -// This should rarely be used as it is very inefficient compared to Jacobian +// It converts the point to Jacobian coordinates, doubles it using Jacobian +// addition with a.Z=1, and converts it back to affine coordinates. +// +// http://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-mdbl-2007-bl +// ~Cost: 1M + 5S func (p *G2Affine) Double(a *G2Affine) *G2Affine { - var p1 G2Jac - p1.FromAffine(a) - p1.Double(&p1) - p.FromJacobian(&p1) + var q G2Jac + q.FromAffine(a) + q.DoubleMixed(a) + p.FromJacobian(&q) return p } -// Sub subs two point in affine coordinates. -// This should rarely be used as it is very inefficient compared to Jacobian +// Sub subtracts two points in affine coordinates. +// It uses a similar approach to Add, but negates the second point before adding. func (p *G2Affine) Sub(a, b *G2Affine) *G2Affine { - var p1, p2 G2Jac - p1.FromAffine(a) - p2.FromAffine(b) - p1.SubAssign(&p2) - p.FromJacobian(&p1) + var bneg G2Affine + bneg.Neg(b) + p.Add(a, &bneg) return p } -// Equal tests if two points (in Affine coordinates) are equal +// Equal tests if two points in affine coordinates are equal. func (p *G2Affine) Equal(a *G2Affine) bool { return p.X.Equal(&a.X) && p.Y.Equal(&a.Y) } -// Neg computes -G +// Neg sets p to the affine negative point -a = (a.X, -a.Y). func (p *G2Affine) Neg(a *G2Affine) *G2Affine { p.X = a.X p.Y.Neg(&a.Y) return p } -// FromJacobian rescales a point in Jacobian coord in z=1 plane +// FromJacobian converts a point p1 from Jacobian to affine coordinates. func (p *G2Affine) FromJacobian(p1 *G2Jac) *G2Affine { var a, b fptower.E2 @@ -133,7 +181,7 @@ func (p *G2Affine) FromJacobian(p1 *G2Jac) *G2Affine { return p } -// String returns the string representation of the point or "O" if it is infinity +// String returns the string representation E(x,y) of the affine point p or "O" if it is infinity. func (p *G2Affine) String() string { if p.IsInfinity() { return "O" @@ -141,106 +189,116 @@ func (p *G2Affine) String() string { return "E([" + p.X.String() + "," + p.Y.String() + "])" } -// IsInfinity checks if the point is infinity -// in affine, it's encoded as (0,0) -// (0,0) is never on the curve for j=0 curves +// IsInfinity checks if the affine point p is infinity, which is encoded as (0,0). +// N.B.: (0,0) is never on the curve for j=0 curves (Y²=X³+B). func (p *G2Affine) IsInfinity() bool { return p.X.IsZero() && p.Y.IsZero() } -// IsOnCurve returns true if p in on the curve +// IsOnCurve returns true if the affine point p in on the curve. func (p *G2Affine) IsOnCurve() bool { - var point G2Jac - point.FromAffine(p) - return point.IsOnCurve() // call this function to handle infinity point + if p.IsInfinity() { + return true + } + var left, right fptower.E2 + left.Square(&p.Y) + right.Square(&p.X).Mul(&right, &p.X) + right.Add(&right, &bTwistCurveCoeff) + return left.Equal(&right) } -// IsInSubGroup returns true if p is in the correct subgroup, false otherwise +// IsInSubGroup returns true if the affine point p is in the correct subgroup, false otherwise. func (p *G2Affine) IsInSubGroup() bool { - var _p G2Jac + if !p.IsOnCurve() { + return false + } + var a, b, c, res, _p G2Jac _p.FromAffine(p) - return _p.IsInSubGroup() + a.mulBySeed(&_p) + b.psi(&a) + a.AddAssign(&_p) + res.psi(&b) + c.Set(&res). + AddAssign(&b). + AddAssign(&a) + res.psi(&res). + Double(&res) + + return res.Equal(&c) } // ------------------------------------------------------------------------------------------------- -// Jacobian +// Jacobian coordinates -// Set sets p to the provided point -func (p *G2Jac) Set(a *G2Jac) *G2Jac { - p.X, p.Y, p.Z = a.X, a.Y, a.Z +// Set sets p to a in Jacobian coordinates. +func (p *G2Jac) Set(q *G2Jac) *G2Jac { + p.X, p.Y, p.Z = q.X, q.Y, q.Z return p } -// Equal tests if two points (in Jacobian coordinates) are equal -func (p *G2Jac) Equal(a *G2Jac) bool { +// Equal tests if two points in Jacobian coordinates are equal. +func (p *G2Jac) Equal(q *G2Jac) bool { // If one point is infinity, the other must also be infinity. if p.Z.IsZero() { - return a.Z.IsZero() + return q.Z.IsZero() } // If the other point is infinity, return false since we can't // the following checks would be incorrect. - if a.Z.IsZero() { + if q.Z.IsZero() { return false } var pZSquare, aZSquare fptower.E2 pZSquare.Square(&p.Z) - aZSquare.Square(&a.Z) + aZSquare.Square(&q.Z) var lhs, rhs fptower.E2 lhs.Mul(&p.X, &aZSquare) - rhs.Mul(&a.X, &pZSquare) + rhs.Mul(&q.X, &pZSquare) if !lhs.Equal(&rhs) { return false } - lhs.Mul(&p.Y, &aZSquare).Mul(&lhs, &a.Z) - rhs.Mul(&a.Y, &pZSquare).Mul(&rhs, &p.Z) + lhs.Mul(&p.Y, &aZSquare).Mul(&lhs, &q.Z) + rhs.Mul(&q.Y, &pZSquare).Mul(&rhs, &p.Z) return lhs.Equal(&rhs) } -// Neg computes -G -func (p *G2Jac) Neg(a *G2Jac) *G2Jac { - *p = *a - p.Y.Neg(&a.Y) +// Neg sets p to the Jacobian negative point -q = (q.X, -q.Y, q.Z). +func (p *G2Jac) Neg(q *G2Jac) *G2Jac { + *p = *q + p.Y.Neg(&q.Y) return p } -// SubAssign subtracts two points on the curve -func (p *G2Jac) SubAssign(a *G2Jac) *G2Jac { - var tmp G2Jac - tmp.Set(a) - tmp.Y.Neg(&tmp.Y) - p.AddAssign(&tmp) - return p -} - -// AddAssign point addition in montgomery form -// https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#addition-add-2007-bl -func (p *G2Jac) AddAssign(a *G2Jac) *G2Jac { +// AddAssign sets p to p+a in Jacobian coordinates. +// +// https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-add-2007-bl +// ~Cost: 11M + 5S +func (p *G2Jac) AddAssign(q *G2Jac) *G2Jac { - // p is infinity, return a + // p is infinity, return q if p.Z.IsZero() { - p.Set(a) + p.Set(q) return p } - // a is infinity, return p - if a.Z.IsZero() { + // q is infinity, return p + if q.Z.IsZero() { return p } var Z1Z1, Z2Z2, U1, U2, S1, S2, H, I, J, r, V fptower.E2 - Z1Z1.Square(&a.Z) + Z1Z1.Square(&q.Z) Z2Z2.Square(&p.Z) - U1.Mul(&a.X, &Z2Z2) + U1.Mul(&q.X, &Z2Z2) U2.Mul(&p.X, &Z1Z1) - S1.Mul(&a.Y, &p.Z). + S1.Mul(&q.Y, &p.Z). Mul(&S1, &Z2Z2) - S2.Mul(&p.Y, &a.Z). + S2.Mul(&p.Y, &q.Z). Mul(&S2, &Z1Z1) - // if p == a, we double instead + // if p == q, we double instead if U1.Equal(&U2) && S1.Equal(&S2) { return p.DoubleAssign() } @@ -259,7 +317,7 @@ func (p *G2Jac) AddAssign(a *G2Jac) *G2Jac { Mul(&p.Y, &r) S1.Mul(&S1, &J).Double(&S1) p.Y.Sub(&p.Y, &S1) - p.Z.Add(&p.Z, &a.Z) + p.Z.Add(&p.Z, &q.Z) p.Z.Square(&p.Z). Sub(&p.Z, &Z1Z1). Sub(&p.Z, &Z2Z2). @@ -268,8 +326,51 @@ func (p *G2Jac) AddAssign(a *G2Jac) *G2Jac { return p } -// AddMixed point addition +// SubAssign sets p to p-a in Jacobian coordinates. +// It uses a similar approach to AddAssign, but negates the point a before adding. +func (p *G2Jac) SubAssign(q *G2Jac) *G2Jac { + var tmp G2Jac + tmp.Set(q) + tmp.Y.Neg(&tmp.Y) + p.AddAssign(&tmp) + return p +} + +// Double sets p to [2]q in Jacobian coordinates. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-mdbl-2007-bl +// ~Cost: 1M + 5S +func (p *G2Jac) DoubleMixed(a *G2Affine) *G2Jac { + var XX, YY, YYYY, S, M, T fptower.E2 + XX.Square(&a.X) + YY.Square(&a.Y) + YYYY.Square(&YY) + S.Add(&a.X, &YY). + Square(&S). + Sub(&S, &XX). + Sub(&S, &YYYY). + Double(&S) + M.Double(&XX). + Add(&M, &XX) // -> + A, but A=0 here + T.Square(&M). + Sub(&T, &S). + Sub(&T, &S) + p.X.Set(&T) + p.Y.Sub(&S, &T). + Mul(&p.Y, &M) + YYYY.Double(&YYYY). + Double(&YYYY). + Double(&YYYY) + p.Y.Sub(&p.Y, &YYYY) + p.Z.Double(&a.Y) + + return p +} + +// AddMixed sets p to p+a in Jacobian coordinates, where a.Z = 1. +// // http://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-madd-2007-bl +// ~Cost: 7M + 4S func (p *G2Jac) AddMixed(a *G2Affine) *G2Jac { //if a is infinity return p @@ -292,7 +393,7 @@ func (p *G2Jac) AddMixed(a *G2Affine) *G2Jac { // if p == a, we double instead if U2.Equal(&p.X) && S2.Equal(&p.Y) { - return p.DoubleAssign() + return p.DoubleMixed(a) } H.Sub(&U2, &p.X) @@ -317,83 +418,99 @@ func (p *G2Jac) AddMixed(a *G2Affine) *G2Jac { return p } -// Double doubles a point in Jacobian coordinates -// https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2007-bl +// Double sets p to [2]q in Jacobian coordinates. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l +// ~Cost: 2M + 5S func (p *G2Jac) Double(q *G2Jac) *G2Jac { p.Set(q) p.DoubleAssign() return p } -// DoubleAssign doubles a point in Jacobian coordinates -// https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2007-bl +// DoubleAssign doubles p in Jacobian coordinates. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l +// ~Cost: 2M + 5S func (p *G2Jac) DoubleAssign() *G2Jac { - - var XX, YY, YYYY, ZZ, S, M, T fptower.E2 - - XX.Square(&p.X) - YY.Square(&p.Y) - YYYY.Square(&YY) - ZZ.Square(&p.Z) - S.Add(&p.X, &YY) - S.Square(&S). - Sub(&S, &XX). - Sub(&S, &YYYY). - Double(&S) - M.Double(&XX).Add(&M, &XX) - p.Z.Add(&p.Z, &p.Y). - Square(&p.Z). - Sub(&p.Z, &YY). - Sub(&p.Z, &ZZ) - T.Square(&M) - p.X = T - T.Double(&S) - p.X.Sub(&p.X, &T) - p.Y.Sub(&S, &p.X). - Mul(&p.Y, &M) - YYYY.Double(&YYYY).Double(&YYYY).Double(&YYYY) - p.Y.Sub(&p.Y, &YYYY) + var A, B, C, D, E, F, t fptower.E2 + A.Square(&p.X) + B.Square(&p.Y) + C.Square(&B) + D.Add(&p.X, &B). + Square(&D). + Sub(&D, &A). + Sub(&D, &C). + Double(&D) + E.Double(&A). + Add(&E, &A) + F.Square(&E) + t.Double(&D) + p.Z.Mul(&p.Y, &p.Z). + Double(&p.Z) + p.X.Sub(&F, &t) + p.Y.Sub(&D, &p.X). + Mul(&p.Y, &E) + t.Double(&C). + Double(&t). + Double(&t) + p.Y.Sub(&p.Y, &t) return p } -// ScalarMultiplication computes and returns p = a ⋅ s +// ScalarMultiplication computes and returns p = [s]a +// where p and a are Jacobian points. +// using the GLV technique. // see https://www.iacr.org/archive/crypto2001/21390189.pdf -func (p *G2Jac) ScalarMultiplication(a *G2Jac, s *big.Int) *G2Jac { - return p.mulGLV(a, s) +func (p *G2Jac) ScalarMultiplication(q *G2Jac, s *big.Int) *G2Jac { + if s.BitLen() >= g2ScalarMulChoose { + return p.mulGLV(q, s) + } else { + return p.mulWindowed(q, s) + } +} + +// ScalarMultiplicationBase computes and returns p = [s]g +// where g is the prime subgroup generator. +func (p *G2Jac) ScalarMultiplicationBase(s *big.Int) *G2Jac { + if s.BitLen() >= g2ScalarMulChoose { + return p.mulGLV(&g2Gen, s) + } else { + return p.mulWindowed(&g2Gen, s) + } + } -// String returns canonical representation of the point in affine coordinates +// String converts p to affine coordinates and returns its string representation E(x,y) or "O" if it is infinity. func (p *G2Jac) String() string { _p := G2Affine{} _p.FromJacobian(p) return _p.String() } -// FromAffine sets p = Q, p in Jacobian, Q in affine -func (p *G2Jac) FromAffine(Q *G2Affine) *G2Jac { - if Q.IsInfinity() { +// FromAffine converts a point a from affine to Jacobian coordinates. +func (p *G2Jac) FromAffine(a *G2Affine) *G2Jac { + if a.IsInfinity() { p.Z.SetZero() p.X.SetOne() p.Y.SetOne() return p } p.Z.SetOne() - p.X.Set(&Q.X) - p.Y.Set(&Q.Y) + p.X.Set(&a.X) + p.Y.Set(&a.Y) return p } -// IsOnCurve returns true if p in on the curve +// IsOnCurve returns true if the Jacobian point p in on the curve. func (p *G2Jac) IsOnCurve() bool { - var left, right, tmp fptower.E2 + var left, right, tmp, ZZ fptower.E2 left.Square(&p.Y) right.Square(&p.X).Mul(&right, &p.X) - tmp.Square(&p.Z). - Square(&tmp). - Mul(&tmp, &p.Z). - Mul(&tmp, &p.Z). - Mul(&tmp, &bTwistCurveCoeff) + ZZ.Square(&p.Z) + tmp.Square(&ZZ).Mul(&tmp, &ZZ) + tmp.MulBybTwistCurveCoeff(&tmp) right.Add(&right, &tmp) return left.Equal(&right) } @@ -402,28 +519,49 @@ func (p *G2Jac) IsOnCurve() bool { // https://eprint.iacr.org/2022/348.pdf, sec. 3 and 5.1 // [r]P == 0 <==> [x₀+1]P + ψ([x₀]P) + ψ²([x₀]P) = ψ³([2x₀]P) func (p *G2Jac) IsInSubGroup() bool { + if !p.IsOnCurve() { + return false + } var a, b, c, res G2Jac - a.ScalarMultiplication(p, &xGen) + a.mulBySeed(p) b.psi(&a) a.AddAssign(p) res.psi(&b) + c.Set(&res). + AddAssign(&b). + AddAssign(&a) + res.psi(&res). + Double(&res) + + return res.Equal(&c) +} + +func GeneratePointNotInG2(f E2) G2Jac { + var res, jac, a, b, c G2Jac + aff := MapToCurve2(&f) + jac.FromAffine(&aff) + // [x₀+1]P + ψ([x₀]P) + ψ²([x₀]P) - ψ³([2x₀]P) = [r]P + a.mulBySeed(&jac) + b.psi(&a) + a.AddAssign(&jac) + res.psi(&b) c.Set(&res). AddAssign(&b). AddAssign(&a) res.psi(&res). Double(&res). SubAssign(&c) - - return res.IsOnCurve() && res.Z.IsZero() + return res } -// mulWindowed computes a 2-bits windowed scalar multiplication -func (p *G2Jac) mulWindowed(a *G2Jac, s *big.Int) *G2Jac { +// mulWindowed computes the 2-bits windowed double-and-add scalar +// multiplication p=[s]q in Jacobian coordinates. +func (p *G2Jac) mulWindowed(q *G2Jac, s *big.Int) *G2Jac { var res G2Jac var ops [3]G2Jac - ops[0].Set(a) + ops[0].Set(q) if s.Sign() == -1 { ops[0].Neg(&ops[0]) } @@ -450,26 +588,83 @@ func (p *G2Jac) mulWindowed(a *G2Jac, s *big.Int) *G2Jac { } -// ψ(p) = u o π o u⁻¹ where u:E'→E iso from the twist to E -func (p *G2Jac) psi(a *G2Jac) *G2Jac { - p.Set(a) +// mulBySeed multiplies the point q by the seed xGen in Jacobian coordinates +// using an optimized addition chain. +func (p *G2Jac) mulBySeed(q *G2Jac) *G2Jac { + // Generated by github.com/mmcloughlin/addchain v0.4.0. + // Operations: 62 squares 17 multiplies + + // Allocate Temporaries. + var res, t0, t1, t2, t3 G2Jac + + res.Double(q) + t0.Set(q).AddAssign(&res) + t2.Set(q).AddAssign(&t0) + t1.Set(&res).AddAssign(&t2) + res.Double(&t1) + res.AddAssign(&t0) + t0.AddAssign(&res) + t2.AddAssign(&t0) + t1.AddAssign(&t2) + t0.AddAssign(&t1) + t1.AddAssign(&t0) + t0.AddAssign(&t1) + t2.AddAssign(&t0) + t3.Double(&t2) + t1.AddAssign(&t3) + t2.AddAssign(&t1) + res.AddAssign(&t2) + t2.AddAssign(&res) + t3.Double(&t2) + res.AddAssign(&t3) + t0.AddAssign(&res) + t1.AddAssign(&t0) + t3.Double(&t1) + for s := 1; s < 2; s++ { + t3.Double(&t3) + } + t3.AddAssign(&t1) + t2.AddAssign(&t3) + t1.AddAssign(&t2) + t2.AddAssign(&t1) + for s := 0; s < 17; s++ { + t2.Double(&t2) + } + t1.AddAssign(&t2) + for s := 0; s < 14; s++ { + t1.Double(&t1) + } + t0.AddAssign(&t1) + for s := 0; s < 16; s++ { + t0.Double(&t0) + } + res.AddAssign(&t0) + + p.Set(&res) + return p +} + +// psi sets p to ψ(q) = u o π o u⁻¹ where u:E'→E is the isomorphism from the twist to the curve E and π is the Frobenius map. +func (p *G2Jac) psi(q *G2Jac) *G2Jac { + p.Set(q) p.X.Conjugate(&p.X).Mul(&p.X, &endo.u) p.Y.Conjugate(&p.Y).Mul(&p.Y, &endo.v) p.Z.Conjugate(&p.Z) return p } -// ϕ assigns p to ϕ(a) where ϕ: (x,y) → (w x,y), and returns p -// where w is a third root of unity in 𝔽p -func (p *G2Jac) phi(a *G2Jac) *G2Jac { - p.Set(a) +// phi sets p to ϕ(a) where ϕ: (x,y) → (w x,y), +// where w is a third root of unity. +func (p *G2Jac) phi(q *G2Jac) *G2Jac { + p.Set(q) p.X.MulByElement(&p.X, &thirdRootOneG2) return p } // mulGLV computes the scalar multiplication using a windowed-GLV method +// // see https://www.iacr.org/archive/crypto2001/21390189.pdf -func (p *G2Jac) mulGLV(a *G2Jac, s *big.Int) *G2Jac { +func (p *G2Jac) mulGLV(q *G2Jac, s *big.Int) *G2Jac { var table [15]G2Jac var res G2Jac @@ -477,11 +672,11 @@ func (p *G2Jac) mulGLV(a *G2Jac, s *big.Int) *G2Jac { res.Set(&g2Infinity) - // table[b3b2b1b0-1] = b3b2 ⋅ ϕ(a) + b1b0*a - table[0].Set(a) - table[3].phi(a) + // table[b3b2b1b0-1] = b3b2 ⋅ ϕ(q) + b1b0*q + table[0].Set(q) + table[3].phi(q) - // split the scalar, modifies ±a, ϕ(a) accordingly + // split the scalar, modifies ±q, ϕ(q) accordingly k := ecc.SplitScalar(s, &glvBasis) if k[0].Sign() == -1 { @@ -494,7 +689,7 @@ func (p *G2Jac) mulGLV(a *G2Jac, s *big.Int) *G2Jac { } // precompute table (2 bits sliding window) - // table[b3b2b1b0-1] = b3b2 ⋅ ϕ(a) + b1b0 ⋅ a if b3b2b1b0 != 0 + // table[b3b2b1b0-1] = b3b2 ⋅ ϕ(q) + b1b0 ⋅ q if b3b2b1b0 != 0 table[1].Double(&table[0]) table[2].Set(&table[1]).AddAssign(&table[0]) table[4].Set(&table[3]).AddAssign(&table[0]) @@ -550,11 +745,11 @@ func (p *G2Affine) ClearCofactor(a *G2Affine) *G2Affine { } // ClearCofactor maps a point in curve to r-torsion -func (p *G2Jac) ClearCofactor(a *G2Jac) *G2Jac { +func (p *G2Jac) ClearCofactor(q *G2Jac) *G2Jac { // cf http://cacr.uwaterloo.ca/techreports/2011/cacr2011-26.pdf, 6.1 var points [4]G2Jac - points[0].ScalarMultiplication(a, &xGen) + points[0].mulBySeed(q) points[1].Double(&points[0]). AddAssign(&points[0]). @@ -563,7 +758,7 @@ func (p *G2Jac) ClearCofactor(a *G2Jac) *G2Jac { points[2].psi(&points[0]). psi(&points[2]) - points[3].psi(a).psi(&points[3]).psi(&points[3]) + points[3].psi(q).psi(&points[3]).psi(&points[3]) var res G2Jac res.Set(&g2Infinity) @@ -576,16 +771,16 @@ func (p *G2Jac) ClearCofactor(a *G2Jac) *G2Jac { } // ------------------------------------------------------------------------------------------------- -// Jacobian extended +// extended Jacobian coordinates -// Set sets p to the provided point -func (p *g2JacExtended) Set(a *g2JacExtended) *g2JacExtended { - p.X, p.Y, p.ZZ, p.ZZZ = a.X, a.Y, a.ZZ, a.ZZZ +// Set sets p to a in extended Jacobian coordinates. +func (p *g2JacExtended) Set(q *g2JacExtended) *g2JacExtended { + p.X, p.Y, p.ZZ, p.ZZZ = q.X, q.Y, q.ZZ, q.ZZZ return p } -// setInfinity sets p to O -func (p *g2JacExtended) setInfinity() *g2JacExtended { +// SetInfinity sets p to the infinity point (1,1,0,0). +func (p *g2JacExtended) SetInfinity() *g2JacExtended { p.X.SetOne() p.Y.SetOne() p.ZZ = fptower.E2{} @@ -593,44 +788,47 @@ func (p *g2JacExtended) setInfinity() *g2JacExtended { return p } -func (p *g2JacExtended) IsZero() bool { +// IsInfinity checks if the p is infinity, i.e. p.ZZ=0. +func (p *g2JacExtended) IsInfinity() bool { return p.ZZ.IsZero() } -// fromJacExtended sets Q in affine coordinates -func (p *G2Affine) fromJacExtended(Q *g2JacExtended) *G2Affine { - if Q.ZZ.IsZero() { +// fromJacExtended converts an extended Jacobian point to an affine point. +func (p *G2Affine) fromJacExtended(q *g2JacExtended) *G2Affine { + if q.ZZ.IsZero() { p.X = fptower.E2{} p.Y = fptower.E2{} return p } - p.X.Inverse(&Q.ZZ).Mul(&p.X, &Q.X) - p.Y.Inverse(&Q.ZZZ).Mul(&p.Y, &Q.Y) + p.X.Inverse(&q.ZZ).Mul(&p.X, &q.X) + p.Y.Inverse(&q.ZZZ).Mul(&p.Y, &q.Y) return p } -// fromJacExtended sets Q in Jacobian coordinates -func (p *G2Jac) fromJacExtended(Q *g2JacExtended) *G2Jac { - if Q.ZZ.IsZero() { +// fromJacExtended converts an extended Jacobian point to a Jacobian point. +func (p *G2Jac) fromJacExtended(q *g2JacExtended) *G2Jac { + if q.ZZ.IsZero() { p.Set(&g2Infinity) return p } - p.X.Mul(&Q.ZZ, &Q.X).Mul(&p.X, &Q.ZZ) - p.Y.Mul(&Q.ZZZ, &Q.Y).Mul(&p.Y, &Q.ZZZ) - p.Z.Set(&Q.ZZZ) + p.X.Mul(&q.ZZ, &q.X).Mul(&p.X, &q.ZZ) + p.Y.Mul(&q.ZZZ, &q.Y).Mul(&p.Y, &q.ZZZ) + p.Z.Set(&q.ZZZ) return p } -// unsafeFromJacExtended sets p in Jacobian coordinates, but don't check for infinity -func (p *G2Jac) unsafeFromJacExtended(Q *g2JacExtended) *G2Jac { - p.X.Square(&Q.ZZ).Mul(&p.X, &Q.X) - p.Y.Square(&Q.ZZZ).Mul(&p.Y, &Q.Y) - p.Z = Q.ZZZ +// unsafeFromJacExtended converts an extended Jacobian point, distinct from Infinity, to a Jacobian point. +func (p *G2Jac) unsafeFromJacExtended(q *g2JacExtended) *G2Jac { + p.X.Square(&q.ZZ).Mul(&p.X, &q.X) + p.Y.Square(&q.ZZZ).Mul(&p.Y, &q.Y) + p.Z = q.ZZZ return p } -// add point in Jacobian extended coordinates +// add sets p to p+q in extended Jacobian coordinates. +// // https://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#addition-add-2008-s +// ~Cost: 12M + 2S func (p *g2JacExtended) add(q *g2JacExtended) *g2JacExtended { //if q is infinity return p if q.ZZ.IsZero() { @@ -685,10 +883,13 @@ func (p *g2JacExtended) add(q *g2JacExtended) *g2JacExtended { return p } -// double point in Jacobian extended coordinates +// double sets p to [2]q in Jacobian extended coordinates. +// // http://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#doubling-dbl-2008-s-1 -// since we consider any point on Z=0 as the point at infinity -// this doubling formula works for infinity points as well +// ~Cost: 6M + 3S +// +// N.B.: since we consider any point on Z=0 as the point at infinity +// this doubling formula works for infinity points as well. func (p *g2JacExtended) double(q *g2JacExtended) *g2JacExtended { var U, V, W, S, XX, M fptower.E2 @@ -698,7 +899,7 @@ func (p *g2JacExtended) double(q *g2JacExtended) *g2JacExtended { S.Mul(&q.X, &V) XX.Square(&q.X) M.Double(&XX). - Add(&M, &XX) // -> + a, but a=0 here + Add(&M, &XX) // -> + A, but A=0 here U.Mul(&W, &q.Y) p.X.Square(&M). @@ -713,9 +914,11 @@ func (p *g2JacExtended) double(q *g2JacExtended) *g2JacExtended { return p } -// subMixed same as addMixed, but will negate a.Y +// addMixed sets p to p+q in extended Jacobian coordinates, where a.ZZ=1. +// // http://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#addition-madd-2008-s -func (p *g2JacExtended) subMixed(a *G2Affine) *g2JacExtended { +// ~Cost: 8M + 2S +func (p *g2JacExtended) addMixed(a *G2Affine) *g2JacExtended { //if a is infinity return p if a.IsInfinity() { @@ -724,7 +927,7 @@ func (p *g2JacExtended) subMixed(a *G2Affine) *g2JacExtended { // p is infinity, return a if p.ZZ.IsZero() { p.X = a.X - p.Y.Neg(&a.Y) + p.Y = a.Y p.ZZ.SetOne() p.ZZZ.SetOne() return p @@ -737,12 +940,11 @@ func (p *g2JacExtended) subMixed(a *G2Affine) *g2JacExtended { P.Sub(&P, &p.X) R.Mul(&a.Y, &p.ZZZ) - R.Neg(&R) R.Sub(&R, &p.Y) if P.IsZero() { if R.IsZero() { - return p.doubleNegMixed(a) + return p.doubleMixed(a) } p.ZZ = fptower.E2{} @@ -769,9 +971,11 @@ func (p *g2JacExtended) subMixed(a *G2Affine) *g2JacExtended { } -// addMixed +// subMixed works the same as addMixed, but negates a.Y. +// // http://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#addition-madd-2008-s -func (p *g2JacExtended) addMixed(a *G2Affine) *g2JacExtended { +// ~Cost: 8M + 2S +func (p *g2JacExtended) subMixed(a *G2Affine) *g2JacExtended { //if a is infinity return p if a.IsInfinity() { @@ -780,7 +984,7 @@ func (p *g2JacExtended) addMixed(a *G2Affine) *g2JacExtended { // p is infinity, return a if p.ZZ.IsZero() { p.X = a.X - p.Y = a.Y + p.Y.Neg(&a.Y) p.ZZ.SetOne() p.ZZZ.SetOne() return p @@ -793,11 +997,12 @@ func (p *g2JacExtended) addMixed(a *G2Affine) *g2JacExtended { P.Sub(&P, &p.X) R.Mul(&a.Y, &p.ZZZ) + R.Neg(&R) R.Sub(&R, &p.Y) if P.IsZero() { if R.IsZero() { - return p.doubleMixed(a) + return p.doubleNegMixed(a) } p.ZZ = fptower.E2{} @@ -824,54 +1029,57 @@ func (p *g2JacExtended) addMixed(a *G2Affine) *g2JacExtended { } -// doubleNegMixed same as double, but will negate q.Y -func (p *g2JacExtended) doubleNegMixed(q *G2Affine) *g2JacExtended { +// doubleNegMixed works the same as doubleMixed, but negates q.Y. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#doubling-mdbl-2008-s-1 +// ~Cost: 4M + 3S +func (p *g2JacExtended) doubleNegMixed(a *G2Affine) *g2JacExtended { - var U, V, W, S, XX, M, S2, L fptower.E2 + var U, V, W, S, M, t fptower.E2 - U.Double(&q.Y) + U.Double(&a.Y) U.Neg(&U) V.Square(&U) W.Mul(&U, &V) - S.Mul(&q.X, &V) - XX.Square(&q.X) - M.Double(&XX). - Add(&M, &XX) // -> + a, but a=0 here - S2.Double(&S) - L.Mul(&W, &q.Y) - - p.X.Square(&M). - Sub(&p.X, &S2) + S.Mul(&a.X, &V) + t.Square(&a.X) + M.Double(&t). + Add(&M, &t) // -> + A, but A=0 here + p.X.Square(&M) + t.Double(&S) + p.X.Sub(&p.X, &t) + t.Mul(&W, &a.Y) p.Y.Sub(&S, &p.X). Mul(&p.Y, &M). - Add(&p.Y, &L) + Add(&p.Y, &t) p.ZZ.Set(&V) p.ZZZ.Set(&W) return p } -// doubleMixed point in Jacobian extended coordinates -// http://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#doubling-dbl-2008-s-1 -func (p *g2JacExtended) doubleMixed(q *G2Affine) *g2JacExtended { +// doubleMixed sets p to [2]a in Jacobian extended coordinates, where a.ZZ=1. +// +// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#doubling-mdbl-2008-s-1 +// ~Cost: 4M + 3S +func (p *g2JacExtended) doubleMixed(a *G2Affine) *g2JacExtended { - var U, V, W, S, XX, M, S2, L fptower.E2 + var U, V, W, S, M, t fptower.E2 - U.Double(&q.Y) + U.Double(&a.Y) V.Square(&U) W.Mul(&U, &V) - S.Mul(&q.X, &V) - XX.Square(&q.X) - M.Double(&XX). - Add(&M, &XX) // -> + a, but a=0 here - S2.Double(&S) - L.Mul(&W, &q.Y) - - p.X.Square(&M). - Sub(&p.X, &S2) + S.Mul(&a.X, &V) + t.Square(&a.X) + M.Double(&t). + Add(&M, &t) // -> + A, but A=0 here + p.X.Square(&M) + t.Double(&S) + p.X.Sub(&p.X, &t) + t.Mul(&W, &a.Y) p.Y.Sub(&S, &p.X). Mul(&p.Y, &M). - Sub(&p.Y, &L) + Sub(&p.Y, &t) p.ZZ.Set(&V) p.ZZZ.Set(&W) @@ -879,38 +1087,38 @@ func (p *g2JacExtended) doubleMixed(q *G2Affine) *g2JacExtended { } // ------------------------------------------------------------------------------------------------- -// Homogenous projective +// Homogenous projective coordinates -// Set sets p to the provided point -func (p *g2Proj) Set(a *g2Proj) *g2Proj { - p.x, p.y, p.z = a.x, a.y, a.z +// Set sets p to a in projective coordinates. +func (p *g2Proj) Set(q *g2Proj) *g2Proj { + p.x, p.y, p.z = q.x, q.y, q.z return p } -// Neg computes -G -func (p *g2Proj) Neg(a *g2Proj) *g2Proj { - *p = *a - p.y.Neg(&a.y) +// Neg sets p to the projective negative point -q = (q.X, -q.Y). +func (p *g2Proj) Neg(q *g2Proj) *g2Proj { + *p = *q + p.y.Neg(&q.y) return p } -// FromAffine sets p = Q, p in homogenous projective, Q in affine -func (p *g2Proj) FromAffine(Q *G2Affine) *g2Proj { - if Q.X.IsZero() && Q.Y.IsZero() { +// FromAffine converts q in affine to p in projective coordinates. +func (p *g2Proj) FromAffine(a *G2Affine) *g2Proj { + if a.X.IsZero() && a.Y.IsZero() { p.z.SetZero() p.x.SetOne() p.y.SetOne() return p } p.z.SetOne() - p.x.Set(&Q.X) - p.y.Set(&Q.Y) + p.x.Set(&a.X) + p.y.Set(&a.Y) return p } // BatchScalarMultiplicationG2 multiplies the same base by all scalars // and return resulting points in affine coordinates -// uses a simple windowed-NAF like exponentiation algorithm +// uses a simple windowed-NAF-like multiplication algorithm. func BatchScalarMultiplicationG2(base *G2Affine, scalars []fr.Element) []G2Affine { // approximate cost in group ops is // cost = 2^{c-1} + n(scalar.nbBits+nbChunks) @@ -989,18 +1197,29 @@ func BatchScalarMultiplicationG2(base *G2Affine, scalars []fr.Element) []G2Affin return toReturn } -// batch add affine coordinates -// using batch inversion -// special cases (doubling, infinity) must be filtered out before this call +// batchAddG2Affine adds affine points using the Montgomery batch inversion trick. +// Special cases (doubling, infinity) must be filtered out before this call. func batchAddG2Affine[TP pG2Affine, TPP ppG2Affine, TC cG2Affine](R *TPP, P *TP, batchSize int) { var lambda, lambdain TC - // add part + // from https://docs.zkproof.org/pages/standards/accepted-workshop3/proposal-turbo_plonk.pdf + // affine point addition formula + // R(X1, Y1) + P(X2, Y2) = Q(X3, Y3) + // λ = (Y2 - Y1) / (X2 - X1) + // X3 = λ² - (X1 + X2) + // Y3 = λ * (X1 - X3) - Y1 + + // first we compute the 1 / (X2 - X1) for all points using Montgomery batch inversion trick + + // X2 - X1 for j := 0; j < batchSize; j++ { lambdain[j].Sub(&(*P)[j].X, &(*R)[j].X) } - // invert denominator using montgomery batch invert technique + // montgomery batch inversion; + // lambda[0] = 1 / (P[0].X - R[0].X) + // lambda[1] = 1 / (P[1].X - R[1].X) + // ... { var accumulator fptower.E2 lambda[0].SetOne() @@ -1020,22 +1239,41 @@ func batchAddG2Affine[TP pG2Affine, TPP ppG2Affine, TC cG2Affine](R *TPP, P *TP, lambda[0].Set(&accumulator) } - var d fptower.E2 - var rr G2Affine + var t fptower.E2 + var Q G2Affine - // add part for j := 0; j < batchSize; j++ { - // computa lambda - d.Sub(&(*P)[j].Y, &(*R)[j].Y) - lambda[j].Mul(&lambda[j], &d) - - // compute X, Y - rr.X.Square(&lambda[j]) - rr.X.Sub(&rr.X, &(*R)[j].X) - rr.X.Sub(&rr.X, &(*P)[j].X) - d.Sub(&(*R)[j].X, &rr.X) - rr.Y.Mul(&lambda[j], &d) - rr.Y.Sub(&rr.Y, &(*R)[j].Y) - (*R)[j].Set(&rr) + // λ = (Y2 - Y1) / (X2 - X1) + t.Sub(&(*P)[j].Y, &(*R)[j].Y) + lambda[j].Mul(&lambda[j], &t) + + // X3 = λ² - (X1 + X2) + Q.X.Square(&lambda[j]) + Q.X.Sub(&Q.X, &(*R)[j].X) + Q.X.Sub(&Q.X, &(*P)[j].X) + + // Y3 = λ * (X1 - X3) - Y1 + t.Sub(&(*R)[j].X, &Q.X) + Q.Y.Mul(&lambda[j], &t) + Q.Y.Sub(&Q.Y, &(*R)[j].Y) + + (*R)[j].Set(&Q) } } + +// RandomOnG2 produces a random point in G2 +// using standard map-to-curve methods, which means the relative discrete log +// of the generated point with respect to the canonical generator is not known. +func RandomOnG2() (G2Affine, error) { + if gBytes, err := randomFrSizedBytes(); err != nil { + return G2Affine{}, err + } else { + return HashToG2(gBytes, []byte("random on g2")) + } +} + +func randomFrSizedBytes() ([]byte, error) { + res := make([]byte, fr.Bytes) + _, err := rand.Read(res) + return res, err +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/hash_to_curve/g1.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/hash_to_curve/g1.go new file mode 100644 index 000000000..9f8daab16 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/hash_to_curve/g1.go @@ -0,0 +1,31 @@ +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package hash_to_curve + +import ( + "github.com/consensys/gnark-crypto/ecc/bn254/fp" +) + +// G1Sgn0 is an algebraic substitute for the notion of sign in ordered fields. +// Namely, every non-zero quadratic residue in a finite field of characteristic =/= 2 has exactly two square roots, one of each sign. +// +// See: https://www.rfc-editor.org/rfc/rfc9380.html#name-the-sgn0-function +// +// The sign of an element is not obviously related to that of its Montgomery form +func G1Sgn0(z *fp.Element) uint64 { + + nonMont := z.Bits() + + // m == 1 + return nonMont[0] % 2 + +} + +func G1NotZero(x *fp.Element) uint64 { + + return x[0] | x[1] | x[2] | x[3] + +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/hash_to_curve/g2.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/hash_to_curve/g2.go new file mode 100644 index 000000000..4b259f7c5 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/hash_to_curve/g2.go @@ -0,0 +1,46 @@ +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package hash_to_curve + +import ( + "github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower" +) + +// G2Sgn0 is an algebraic substitute for the notion of sign in ordered fields. +// Namely, every non-zero quadratic residue in a finite field of characteristic =/= 2 has exactly two square roots, one of each sign. +// +// See: https://www.rfc-editor.org/rfc/rfc9380.html#name-the-sgn0-function +// +// The sign of an element is not obviously related to that of its Montgomery form +func G2Sgn0(z *fptower.E2) uint64 { + + nonMont := z.Bits() + + sign := uint64(0) // 1. sign = 0 + zero := uint64(1) // 2. zero = 1 + var signI uint64 + var zeroI uint64 + + // 3. i = 1 + signI = nonMont.A0[0] % 2 // 4. sign_i = x_i mod 2 + zeroI = G1NotZero(&nonMont.A0) + zeroI = 1 ^ (zeroI|-zeroI)>>63 // 5. zero_i = x_i == 0 + sign = sign | (zero & signI) // 6. sign = sign OR (zero AND sign_i) # Avoid short-circuit logic ops + zero = zero & zeroI // 7. zero = zero AND zero_i + // 3. i = 2 + signI = nonMont.A1[0] % 2 // 4. sign_i = x_i mod 2 + // 5. zero_i = x_i == 0 + sign = sign | (zero & signI) // 6. sign = sign OR (zero AND sign_i) # Avoid short-circuit logic ops + // 7. zero = zero AND zero_i + return sign + +} + +func G2NotZero(x *fptower.E2) uint64 { + //Assuming G1 is over Fp and that if hashing is available for G2, it also is for G1 + return G1NotZero(&x.A0) | G1NotZero(&x.A1) + +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/hash_to_g1.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/hash_to_g1.go index 6be3be8e1..953645555 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/hash_to_g1.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/hash_to_g1.go @@ -1,16 +1,5 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -18,11 +7,59 @@ package bn254 import ( "github.com/consensys/gnark-crypto/ecc/bn254/fp" + "github.com/consensys/gnark-crypto/ecc/bn254/hash_to_curve" ) -// MapToCurve1 implements the Shallue and van de Woestijne method, applicable to any elliptic curve in Weierstrass form -// No cofactor clearing or isogeny -// https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html#straightline-svdw +// MapToG1 invokes the SVDW map, and guarantees that the result is in G1. +func MapToG1(u fp.Element) G1Affine { + res := MapToCurve1(&u) + return res +} + +// EncodeToG1 hashes a message to a point on the G1 curve using the SVDW map. +// It is faster than [HashToG1], but the result is not uniformly distributed. Unsuitable as a random oracle. +// dst stands for "domain separation tag", a string unique to the construction using the hash function +// +// See: https://www.rfc-editor.org/rfc/rfc9380.html#roadmap +func EncodeToG1(msg, dst []byte) (G1Affine, error) { + + var res G1Affine + u, err := fp.Hash(msg, dst, 1) + if err != nil { + return res, err + } + + res = MapToCurve1(&u[0]) + + return res, nil +} + +// HashToG1 hashes a message to a point on the G1 curve using the SVDW map. +// Slower than [EncodeToG1], but usable as a random oracle. +// dst stands for "domain separation tag", a string unique to the construction using the hash function. +// +// See https://www.rfc-editor.org/rfc/rfc9380.html#roadmap +func HashToG1(msg, dst []byte) (G1Affine, error) { + u, err := fp.Hash(msg, dst, 2*1) + if err != nil { + return G1Affine{}, err + } + + Q0 := MapToCurve1(&u[0]) + Q1 := MapToCurve1(&u[1]) + + var _Q0, _Q1 G1Jac + _Q0.FromAffine(&Q0) + _Q1.FromAffine(&Q1).AddAssign(&_Q0) + + Q1.FromJacobian(&_Q1) + return Q1, nil +} + +// MapToCurve1 implements the Shallue and van de Woestijne method, applicable to any elliptic curve in Weierstrass form. +// It does not perform cofactor clearing nor isogeny. Use [MapToG1] for mapping to group. +// +// See: https://www.rfc-editor.org/rfc/rfc9380.html#straightline-svdw func MapToCurve1(u *fp.Element) G1Affine { var tv1, tv2, tv3, tv4 fp.Element var x1, x2, x3, gx1, gx2, gx, x, y fp.Element @@ -89,73 +126,10 @@ func MapToCurve1(u *fp.Element) G1Affine { gx.Mul(&gx, &x) // 31. gx = gx * x gx.Add(&gx, &bCurveCoeff) // 32. gx = gx + B - y.Sqrt(&gx) // 33. y = sqrt(gx) - signsNotEqual := g1Sgn0(u) ^ g1Sgn0(&y) // 34. e3 = sgn0(u) == sgn0(y) + y.Sqrt(&gx) // 33. y = sqrt(gx) + signsNotEqual := hash_to_curve.G1Sgn0(u) ^ hash_to_curve.G1Sgn0(&y) // 34. e3 = sgn0(u) == sgn0(y) tv1.Neg(&y) y.Select(int(signsNotEqual), &y, &tv1) // 35. y = CMOV(-y, y, e3) # Select correct sign of y return G1Affine{x, y} } - -// g1Sgn0 is an algebraic substitute for the notion of sign in ordered fields -// Namely, every non-zero quadratic residue in a finite field of characteristic =/= 2 has exactly two square roots, one of each sign -// https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html#name-the-sgn0-function -// The sign of an element is not obviously related to that of its Montgomery form -func g1Sgn0(z *fp.Element) uint64 { - - nonMont := z.Bits() - - // m == 1 - return nonMont[0] % 2 - -} - -// MapToG1 invokes the SVDW map, and guarantees that the result is in g1 -func MapToG1(u fp.Element) G1Affine { - res := MapToCurve1(&u) - return res -} - -// EncodeToG1 hashes a message to a point on the G1 curve using the SVDW map. -// It is faster than HashToG1, but the result is not uniformly distributed. Unsuitable as a random oracle. -// dst stands for "domain separation tag", a string unique to the construction using the hash function -// https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html#roadmap -func EncodeToG1(msg, dst []byte) (G1Affine, error) { - - var res G1Affine - u, err := fp.Hash(msg, dst, 1) - if err != nil { - return res, err - } - - res = MapToCurve1(&u[0]) - - return res, nil -} - -// HashToG1 hashes a message to a point on the G1 curve using the SVDW map. -// Slower than EncodeToG1, but usable as a random oracle. -// dst stands for "domain separation tag", a string unique to the construction using the hash function -// https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html#roadmap -func HashToG1(msg, dst []byte) (G1Affine, error) { - u, err := fp.Hash(msg, dst, 2*1) - if err != nil { - return G1Affine{}, err - } - - Q0 := MapToCurve1(&u[0]) - Q1 := MapToCurve1(&u[1]) - - var _Q0, _Q1 G1Jac - _Q0.FromAffine(&Q0) - _Q1.FromAffine(&Q1).AddAssign(&_Q0) - - Q1.FromJacobian(&_Q1) - return Q1, nil -} - -func g1NotZero(x *fp.Element) uint64 { - - return x[0] | x[1] | x[2] | x[3] - -} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/hash_to_g2.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/hash_to_g2.go index fa81853d0..f09de46b6 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/hash_to_g2.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/hash_to_g2.go @@ -1,16 +1,5 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -18,12 +7,73 @@ package bn254 import ( "github.com/consensys/gnark-crypto/ecc/bn254/fp" + "github.com/consensys/gnark-crypto/ecc/bn254/hash_to_curve" "github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower" ) -// MapToCurve2 implements the Shallue and van de Woestijne method, applicable to any elliptic curve in Weierstrass form -// No cofactor clearing or isogeny -// https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html#straightline-svdw +// MapToG2 invokes the SVDW map, and guarantees that the result is in G2. +func MapToG2(u fptower.E2) G2Affine { + res := MapToCurve2(&u) + res.ClearCofactor(&res) + return res +} + +// EncodeToG2 hashes a message to a point on the G2 curve using the SVDW map. +// It is faster than [HashToG2], but the result is not uniformly distributed. Unsuitable as a random oracle. +// dst stands for "domain separation tag", a string unique to the construction using the hash function +// +// See: https://www.rfc-editor.org/rfc/rfc9380.html#roadmap +func EncodeToG2(msg, dst []byte) (G2Affine, error) { + + var res G2Affine + u, err := fp.Hash(msg, dst, 2) + if err != nil { + return res, err + } + + res = MapToCurve2(&fptower.E2{ + A0: u[0], + A1: u[1], + }) + + res.ClearCofactor(&res) + return res, nil +} + +// HashToG2 hashes a message to a point on the G2 curve using the SVDW map. +// Slower than [EncodeToG2], but usable as a random oracle. +// dst stands for "domain separation tag", a string unique to the construction using the hash function. +// +// See https://www.rfc-editor.org/rfc/rfc9380.html#roadmap +func HashToG2(msg, dst []byte) (G2Affine, error) { + u, err := fp.Hash(msg, dst, 2*2) + if err != nil { + return G2Affine{}, err + } + + Q0 := MapToCurve2(&fptower.E2{ + A0: u[0], + A1: u[1], + }) + Q1 := MapToCurve2(&fptower.E2{ + A0: u[2+0], + A1: u[2+1], + }) + + var _Q0, _Q1 G2Jac + _Q0.FromAffine(&Q0) + _Q1.FromAffine(&Q1).AddAssign(&_Q0) + + _Q1.ClearCofactor(&_Q1) + + Q1.FromJacobian(&_Q1) + return Q1, nil +} + +// MapToCurve2 implements the Shallue and van de Woestijne method, applicable to any elliptic curve in Weierstrass form. +// It does not perform cofactor clearing nor isogeny. Use [MapToG2] for mapping to group. +// +// See: https://www.rfc-editor.org/rfc/rfc9380.html#straightline-svdw func MapToCurve2(u *fptower.E2) G2Affine { var tv1, tv2, tv3, tv4 fptower.E2 var x1, x2, x3, gx1, gx2, gx, x, y fptower.E2 @@ -105,101 +155,10 @@ func MapToCurve2(u *fptower.E2) G2Affine { gx.Mul(&gx, &x) // 31. gx = gx * x gx.Add(&gx, &bTwistCurveCoeff) // 32. gx = gx + B - y.Sqrt(&gx) // 33. y = sqrt(gx) - signsNotEqual := g2Sgn0(u) ^ g2Sgn0(&y) // 34. e3 = sgn0(u) == sgn0(y) + y.Sqrt(&gx) // 33. y = sqrt(gx) + signsNotEqual := hash_to_curve.G2Sgn0(u) ^ hash_to_curve.G2Sgn0(&y) // 34. e3 = sgn0(u) == sgn0(y) tv1.Neg(&y) y.Select(int(signsNotEqual), &y, &tv1) // 35. y = CMOV(-y, y, e3) # Select correct sign of y return G2Affine{x, y} } - -// g2Sgn0 is an algebraic substitute for the notion of sign in ordered fields -// Namely, every non-zero quadratic residue in a finite field of characteristic =/= 2 has exactly two square roots, one of each sign -// https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html#name-the-sgn0-function -// The sign of an element is not obviously related to that of its Montgomery form -func g2Sgn0(z *fptower.E2) uint64 { - - nonMont := z.Bits() - - sign := uint64(0) // 1. sign = 0 - zero := uint64(1) // 2. zero = 1 - var signI uint64 - var zeroI uint64 - - // 3. i = 1 - signI = nonMont.A0[0] % 2 // 4. sign_i = x_i mod 2 - zeroI = g1NotZero(&nonMont.A0) - zeroI = 1 ^ (zeroI|-zeroI)>>63 // 5. zero_i = x_i == 0 - sign = sign | (zero & signI) // 6. sign = sign OR (zero AND sign_i) # Avoid short-circuit logic ops - zero = zero & zeroI // 7. zero = zero AND zero_i - // 3. i = 2 - signI = nonMont.A1[0] % 2 // 4. sign_i = x_i mod 2 - // 5. zero_i = x_i == 0 - sign = sign | (zero & signI) // 6. sign = sign OR (zero AND sign_i) # Avoid short-circuit logic ops - // 7. zero = zero AND zero_i - return sign - -} - -// MapToG2 invokes the SVDW map, and guarantees that the result is in g2 -func MapToG2(u fptower.E2) G2Affine { - res := MapToCurve2(&u) - res.ClearCofactor(&res) - return res -} - -// EncodeToG2 hashes a message to a point on the G2 curve using the SVDW map. -// It is faster than HashToG2, but the result is not uniformly distributed. Unsuitable as a random oracle. -// dst stands for "domain separation tag", a string unique to the construction using the hash function -// https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html#roadmap -func EncodeToG2(msg, dst []byte) (G2Affine, error) { - - var res G2Affine - u, err := fp.Hash(msg, dst, 2) - if err != nil { - return res, err - } - - res = MapToCurve2(&fptower.E2{ - A0: u[0], - A1: u[1], - }) - - res.ClearCofactor(&res) - return res, nil -} - -// HashToG2 hashes a message to a point on the G2 curve using the SVDW map. -// Slower than EncodeToG2, but usable as a random oracle. -// dst stands for "domain separation tag", a string unique to the construction using the hash function -// https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html#roadmap -func HashToG2(msg, dst []byte) (G2Affine, error) { - u, err := fp.Hash(msg, dst, 2*2) - if err != nil { - return G2Affine{}, err - } - - Q0 := MapToCurve2(&fptower.E2{ - A0: u[0], - A1: u[1], - }) - Q1 := MapToCurve2(&fptower.E2{ - A0: u[2+0], - A1: u[2+1], - }) - - var _Q0, _Q1 G2Jac - _Q0.FromAffine(&Q0) - _Q1.FromAffine(&Q1).AddAssign(&_Q0) - - _Q1.ClearCofactor(&_Q1) - - Q1.FromJacobian(&_Q1) - return Q1, nil -} - -func g2NotZero(x *fptower.E2) uint64 { - //Assuming G1 is over Fp and that if hashing is available for G2, it also is for G1 - return g1NotZero(&x.A0) | g1NotZero(&x.A1) - -} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/asm.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/asm.go index 49751a939..83956e0b4 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/asm.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/asm.go @@ -1,28 +1,16 @@ //go:build !noadx -// +build !noadx -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT package fptower -import "golang.org/x/sys/cpu" +import "github.com/consensys/gnark-crypto/utils/cpu" // supportAdx will be set only on amd64 that has MULX and ADDX instructions var ( - supportAdx = cpu.X86.HasADX && cpu.X86.HasBMI2 + supportAdx = cpu.SupportADX _ = supportAdx // used in asm ) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/asm_noadx.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/asm_noadx.go index c6a97081f..1dc20b499 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/asm_noadx.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/asm_noadx.go @@ -1,19 +1,7 @@ //go:build noadx -// +build noadx -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e12.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e12.go index a9f6d28e9..3d0946cfd 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e12.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e12.go @@ -1,16 +1,5 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -67,14 +56,14 @@ func (z *E12) SetOne() *E12 { return z } -// Add set z=x+y in E12 and return z +// Add sets z=x+y in E12 and returns z func (z *E12) Add(x, y *E12) *E12 { z.C0.Add(&x.C0, &y.C0) z.C1.Add(&x.C1, &y.C1) return z } -// Sub sets z to x sub y and return z +// Sub sets z to x-y and returns z func (z *E12) Sub(x, y *E12) *E12 { z.C0.Sub(&x.C0, &y.C0) z.C1.Sub(&x.C1, &y.C1) @@ -99,16 +88,25 @@ func (z *E12) SetRandom() (*E12, error) { return z, nil } -// IsZero returns true if the two elements are equal, false otherwise +// MustSetRandom sets a0 and a1 to random values. +// It panics if reading form crypto/rand fails +func (z *E12) MustSetRandom() { + if _, err := z.SetRandom(); err != nil { + panic(err) + } +} + +// IsZero returns true if z is zero, false otherwise func (z *E12) IsZero() bool { return z.C0.IsZero() && z.C1.IsZero() } +// IsOne returns true if z is one, false otherwise func (z *E12) IsOne() bool { return z.C0.IsOne() && z.C1.IsZero() } -// Mul set z=x*y in E12 and return z +// Mul sets z=x*y in E12 and returns z func (z *E12) Mul(x, y *E12) *E12 { var a, b, c E6 a.Add(&x.C0, &x.C1) @@ -121,7 +119,7 @@ func (z *E12) Mul(x, y *E12) *E12 { return z } -// Square set z=x*x in E12 and return z +// Square sets z=x*x in E12 and returns z func (z *E12) Square(x *E12) *E12 { //Algorithm 22 from https://eprint.iacr.org/2010/354.pdf @@ -406,7 +404,7 @@ func (z *E12) CyclotomicSquare(x *E12) *E12 { return z } -// Inverse set z to the inverse of x in E12 and return z +// Inverse sets z to the inverse of x in E12 and returns z // // if x == 0, sets and returns z = x func (z *E12) Inverse(x *E12) *E12 { @@ -424,8 +422,8 @@ func (z *E12) Inverse(x *E12) *E12 { return z } -// BatchInvertE12 returns a new slice with every element inverted. -// Uses Montgomery batch inversion trick +// BatchInvertE12 returns a new slice with every element in a inverted. +// It uses Montgomery batch inversion trick. // // if a[i] == 0, returns result[i] = a[i] func BatchInvertE12(a []E12) []E12 { @@ -535,7 +533,7 @@ func (z *E12) CyclotomicExp(x E12, k *big.Int) *E12 { n := ecc.NafDecomposition(e, eNAF[:]) for i := n - 1; i >= 0; i-- { res.CyclotomicSquare(&res) - if eNAF[i] == 1 { + if eNAF[i] == 1 { // nolint QF1003 res.Mul(&res, &x) } else if eNAF[i] == -1 { res.Mul(&res, &xInv) @@ -635,12 +633,12 @@ func (z *E12) ExpGLV(x E12, k *big.Int) *E12 { return z } -// InverseUnitary inverse a unitary element +// InverseUnitary inverses a unitary element func (z *E12) InverseUnitary(x *E12) *E12 { return z.Conjugate(x) } -// Conjugate set z to x conjugated and return z +// Conjugate sets z to x conjugated and returns z func (z *E12) Conjugate(x *E12) *E12 { *z = *x z.C1.Neg(&z.C1) @@ -841,6 +839,8 @@ func BatchDecompressTorus(x []E6) ([]E12, error) { return res, nil } +// Select is conditional move. +// If cond = 0, it sets z to caseZ and returns it. otherwise caseNz. func (z *E12) Select(cond int, caseZ *E12, caseNz *E12) *E12 { //Might be able to save a nanosecond or two by an aggregate implementation @@ -850,6 +850,7 @@ func (z *E12) Select(cond int, caseZ *E12, caseNz *E12) *E12 { return z } +// Div divides an element in E12 by an element in E12 func (z *E12) Div(x *E12, y *E12) *E12 { var r E12 r.Inverse(y).Mul(x, &r) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e12_pairing.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e12_pairing.go index 78c94d2f6..4a068d7a1 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e12_pairing.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e12_pairing.go @@ -142,9 +142,31 @@ func (z *E12) MulBy034(c0, c3, c4 *E2) *E12 { b.Set(&z.C1) b.MulBy01(c3, c4) - c0.Add(c0, c3) + var d0 E2 + d0.Add(c0, c3) d.Add(&z.C0, &z.C1) - d.MulBy01(c0, c4) + d.MulBy01(&d0, c4) + + z.C1.Add(&a, &b).Neg(&z.C1).Add(&z.C1, &d) + z.C0.MulByNonResidue(&b).Add(&z.C0, &a) + + return z +} + +// MulBy34 multiplication by sparse element (1,0,0,c3,c4,0) +func (z *E12) MulBy34(c3, c4 *E2) *E12 { + + var a, b, d E6 + + a.Set(&z.C0) + + b.Set(&z.C1) + b.MulBy01(c3, c4) + + var d0 E2 + d0.SetOne().Add(&d0, c3) + d.Add(&z.C0, &z.C1) + d.MulBy01(&d0, c4) z.C1.Add(&a, &b).Neg(&z.C1).Add(&z.C1, &d) z.C0.MulByNonResidue(&b).Add(&z.C0, &a) @@ -180,6 +202,26 @@ func Mul034By034(d0, d3, d4, c0, c3, c4 *E2) [5]E2 { return [5]E2{z00, x3, x34, x03, x04} } +// Mul34By34 multiplication of sparse element (1,0,0,c3,c4,0) by sparse element (1,0,0,d3,d4,0) +func Mul34By34(d3, d4, c3, c4 *E2) [5]E2 { + var z00, tmp, x0, x3, x4, x04, x03, x34 E2 + x3.Mul(c3, d3) + x4.Mul(c4, d4) + x04.Add(c4, d4) + x03.Add(c3, d3) + tmp.Add(c3, c4) + x34.Add(d3, d4). + Mul(&x34, &tmp). + Sub(&x34, &x3). + Sub(&x34, &x4) + + x0.SetOne() + z00.MulByNonResidue(&x4). + Add(&z00, &x0) + + return [5]E2{z00, x3, x34, x03, x04} +} + // MulBy01234 multiplies z by an E12 sparse element of the form (x0, x1, x2, x3, x4, 0) func (z *E12) MulBy01234(x *[5]E2) *E12 { var c1, a, b, c, z0, z1 E6 diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e2.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e2.go index 8c16efc93..75c9de264 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e2.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e2.go @@ -1,16 +1,5 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -101,11 +90,20 @@ func (z *E2) SetRandom() (*E2, error) { return z, nil } -// IsZero returns true if the two elements are equal, false otherwise +// MustSetRandom sets a0 and a1 to random values. +// It panics if reading form crypto/rand fails +func (z *E2) MustSetRandom() { + if _, err := z.SetRandom(); err != nil { + panic(err) + } +} + +// IsZero returns true if z is zero, false otherwise func (z *E2) IsZero() bool { return z.A0.IsZero() && z.A1.IsZero() } +// IsOne returns true if z is one, false otherwise func (z *E2) IsOne() bool { return z.A0.IsOne() && z.A1.IsZero() } @@ -116,7 +114,7 @@ func (z *E2) Add(x, y *E2) *E2 { return z } -// Sub two elements of E2 +// Sub subtracts two elements of E2 func (z *E2) Sub(x, y *E2) *E2 { subE2(z, x, y) return z @@ -155,7 +153,7 @@ func (z *E2) Conjugate(x *E2) *E2 { return z } -// Halve sets z = z / 2 +// Halve sets z to z / 2 func (z *E2) Halve() { z.A0.Halve() z.A1.Halve() @@ -213,7 +211,7 @@ func init() { var sqrtExp1, sqrtExp2 big.Int -// Sqrt sets z to the square root of and returns z +// Sqrt sets z to the square root of x and returns z // The function does not test whether the square root // exists or not, it's up to the caller to call // Legendre beforehand. @@ -243,8 +241,8 @@ func (z *E2) Sqrt(x *E2) *E2 { return z } -// BatchInvertE2 returns a new slice with every element inverted. -// Uses Montgomery batch inversion trick +// BatchInvertE2 returns a new slice with every element in a inverted. +// It uses Montgomery batch inversion trick. // // if a[i] == 0, returns result[i] = a[i] func BatchInvertE2(a []E2) []E2 { @@ -279,6 +277,8 @@ func BatchInvertE2(a []E2) []E2 { return res } +// Select is conditional move. +// If cond = 0, it sets z to caseZ and returns it. otherwise caseNz. func (z *E2) Select(cond int, caseZ *E2, caseNz *E2) *E2 { //Might be able to save a nanosecond or two by an aggregate implementation @@ -288,6 +288,7 @@ func (z *E2) Select(cond int, caseZ *E2, caseNz *E2) *E2 { return z } +// Div divides an element in E2 by an element in E2 func (z *E2) Div(x *E2, y *E2) *E2 { var r E2 r.Inverse(y).Mul(x, &r) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e2_amd64.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e2_amd64.go index 259609bd8..17873820c 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e2_amd64.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e2_amd64.go @@ -1,21 +1,33 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT package fptower +import ( + "github.com/consensys/gnark-crypto/ecc/bn254/fp" +) + +// q + r'.r = 1, i.e., qInvNeg = - q⁻¹ mod r +// used for Montgomery reduction +const qInvNeg uint64 = 9786893198990664585 + +// Field modulus q (Fp) +const ( + q0 uint64 = 4332616871279656263 + q1 uint64 = 10917124144477883021 + q2 uint64 = 13281191951274694749 + q3 uint64 = 3486998266802970665 +) + +var qElement = fp.Element{ + q0, + q1, + q2, + q3, +} + //go:noescape func addE2(res, x, y *E2) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e2_amd64.s b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e2_amd64.s index 43ffb7f16..3c0677fe2 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e2_amd64.s +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e2_amd64.s @@ -1,223 +1,78 @@ -// Copyright 2020 ConsenSys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. #include "textflag.h" #include "funcdata.h" - -// modulus q -DATA q<>+0(SB)/8, $0x3c208c16d87cfd47 -DATA q<>+8(SB)/8, $0x97816a916871ca8d -DATA q<>+16(SB)/8, $0xb85045b68181585d -DATA q<>+24(SB)/8, $0x30644e72e131a029 -GLOBL q<>(SB), (RODATA+NOPTR), $32 - -// qInv0 q'[0] -DATA qInv0<>(SB)/8, $0x87d20782e4866389 -GLOBL qInv0<>(SB), (RODATA+NOPTR), $8 - -#define REDUCE(ra0, ra1, ra2, ra3, rb0, rb1, rb2, rb3) \ - MOVQ ra0, rb0; \ - SUBQ q<>(SB), ra0; \ - MOVQ ra1, rb1; \ - SBBQ q<>+8(SB), ra1; \ - MOVQ ra2, rb2; \ - SBBQ q<>+16(SB), ra2; \ - MOVQ ra3, rb3; \ - SBBQ q<>+24(SB), ra3; \ - CMOVQCS rb0, ra0; \ - CMOVQCS rb1, ra1; \ - CMOVQCS rb2, ra2; \ - CMOVQCS rb3, ra3; \ - -// this code is generated and identical to fp.Mul(...) -#define MUL() \ - XORQ AX, AX; \ - MOVQ SI, DX; \ - MULXQ R14, R10, R11; \ - MULXQ R15, AX, R12; \ - ADOXQ AX, R11; \ - MULXQ CX, AX, R13; \ - ADOXQ AX, R12; \ - MULXQ BX, AX, BP; \ - ADOXQ AX, R13; \ - MOVQ $0, AX; \ - ADOXQ AX, BP; \ - PUSHQ BP; \ - MOVQ qInv0<>(SB), DX; \ - IMULQ R10, DX; \ - XORQ AX, AX; \ - MULXQ q<>+0(SB), AX, BP; \ - ADCXQ R10, AX; \ - MOVQ BP, R10; \ - POPQ BP; \ - ADCXQ R11, R10; \ - MULXQ q<>+8(SB), AX, R11; \ - ADOXQ AX, R10; \ - ADCXQ R12, R11; \ - MULXQ q<>+16(SB), AX, R12; \ - ADOXQ AX, R11; \ - ADCXQ R13, R12; \ - MULXQ q<>+24(SB), AX, R13; \ - ADOXQ AX, R12; \ - MOVQ $0, AX; \ - ADCXQ AX, R13; \ - ADOXQ BP, R13; \ - XORQ AX, AX; \ - MOVQ DI, DX; \ - MULXQ R14, AX, BP; \ - ADOXQ AX, R10; \ - ADCXQ BP, R11; \ - MULXQ R15, AX, BP; \ - ADOXQ AX, R11; \ - ADCXQ BP, R12; \ - MULXQ CX, AX, BP; \ - ADOXQ AX, R12; \ - ADCXQ BP, R13; \ - MULXQ BX, AX, BP; \ - ADOXQ AX, R13; \ - MOVQ $0, AX; \ - ADCXQ AX, BP; \ - ADOXQ AX, BP; \ - PUSHQ BP; \ - MOVQ qInv0<>(SB), DX; \ - IMULQ R10, DX; \ - XORQ AX, AX; \ - MULXQ q<>+0(SB), AX, BP; \ - ADCXQ R10, AX; \ - MOVQ BP, R10; \ - POPQ BP; \ - ADCXQ R11, R10; \ - MULXQ q<>+8(SB), AX, R11; \ - ADOXQ AX, R10; \ - ADCXQ R12, R11; \ - MULXQ q<>+16(SB), AX, R12; \ - ADOXQ AX, R11; \ - ADCXQ R13, R12; \ - MULXQ q<>+24(SB), AX, R13; \ - ADOXQ AX, R12; \ - MOVQ $0, AX; \ - ADCXQ AX, R13; \ - ADOXQ BP, R13; \ - XORQ AX, AX; \ - MOVQ R8, DX; \ - MULXQ R14, AX, BP; \ - ADOXQ AX, R10; \ - ADCXQ BP, R11; \ - MULXQ R15, AX, BP; \ - ADOXQ AX, R11; \ - ADCXQ BP, R12; \ - MULXQ CX, AX, BP; \ - ADOXQ AX, R12; \ - ADCXQ BP, R13; \ - MULXQ BX, AX, BP; \ - ADOXQ AX, R13; \ - MOVQ $0, AX; \ - ADCXQ AX, BP; \ - ADOXQ AX, BP; \ - PUSHQ BP; \ - MOVQ qInv0<>(SB), DX; \ - IMULQ R10, DX; \ - XORQ AX, AX; \ - MULXQ q<>+0(SB), AX, BP; \ - ADCXQ R10, AX; \ - MOVQ BP, R10; \ - POPQ BP; \ - ADCXQ R11, R10; \ - MULXQ q<>+8(SB), AX, R11; \ - ADOXQ AX, R10; \ - ADCXQ R12, R11; \ - MULXQ q<>+16(SB), AX, R12; \ - ADOXQ AX, R11; \ - ADCXQ R13, R12; \ - MULXQ q<>+24(SB), AX, R13; \ - ADOXQ AX, R12; \ - MOVQ $0, AX; \ - ADCXQ AX, R13; \ - ADOXQ BP, R13; \ - XORQ AX, AX; \ - MOVQ R9, DX; \ - MULXQ R14, AX, BP; \ - ADOXQ AX, R10; \ - ADCXQ BP, R11; \ - MULXQ R15, AX, BP; \ - ADOXQ AX, R11; \ - ADCXQ BP, R12; \ - MULXQ CX, AX, BP; \ - ADOXQ AX, R12; \ - ADCXQ BP, R13; \ - MULXQ BX, AX, BP; \ - ADOXQ AX, R13; \ - MOVQ $0, AX; \ - ADCXQ AX, BP; \ - ADOXQ AX, BP; \ - PUSHQ BP; \ - MOVQ qInv0<>(SB), DX; \ - IMULQ R10, DX; \ - XORQ AX, AX; \ - MULXQ q<>+0(SB), AX, BP; \ - ADCXQ R10, AX; \ - MOVQ BP, R10; \ - POPQ BP; \ - ADCXQ R11, R10; \ - MULXQ q<>+8(SB), AX, R11; \ - ADOXQ AX, R10; \ - ADCXQ R12, R11; \ - MULXQ q<>+16(SB), AX, R12; \ - ADOXQ AX, R11; \ - ADCXQ R13, R12; \ - MULXQ q<>+24(SB), AX, R13; \ - ADOXQ AX, R12; \ - MOVQ $0, AX; \ - ADCXQ AX, R13; \ - ADOXQ BP, R13; \ +#include "go_asm.h" + +#define REDUCE(ra0, ra1, ra2, ra3, rb0, rb1, rb2, rb3, q0, q1, q2, q3) \ + MOVQ ra0, rb0; \ + SUBQ q0, ra0; \ + MOVQ ra1, rb1; \ + SBBQ q1, ra1; \ + MOVQ ra2, rb2; \ + SBBQ q2, ra2; \ + MOVQ ra3, rb3; \ + SBBQ q3, ra3; \ + CMOVQCS rb0, ra0; \ + CMOVQCS rb1, ra1; \ + CMOVQCS rb2, ra2; \ + CMOVQCS rb3, ra3; \ + +#define REDUCE_NOGLOBAL(ra0, ra1, ra2, ra3, rb0, rb1, rb2, rb3, scratch0) \ + MOVQ ra0, rb0; \ + MOVQ $const_q0, scratch0; \ + SUBQ scratch0, ra0; \ + MOVQ ra1, rb1; \ + MOVQ $const_q1, scratch0; \ + SBBQ scratch0, ra1; \ + MOVQ ra2, rb2; \ + MOVQ $const_q2, scratch0; \ + SBBQ scratch0, ra2; \ + MOVQ ra3, rb3; \ + MOVQ $const_q3, scratch0; \ + SBBQ scratch0, ra3; \ + CMOVQCS rb0, ra0; \ + CMOVQCS rb1, ra1; \ + CMOVQCS rb2, ra2; \ + CMOVQCS rb3, ra3; \ TEXT ·addE2(SB), NOSPLIT, $0-24 MOVQ x+8(FP), AX - MOVQ 0(AX), BX - MOVQ 8(AX), SI - MOVQ 16(AX), DI - MOVQ 24(AX), R8 + MOVQ 0(AX), CX + MOVQ 8(AX), BX + MOVQ 16(AX), SI + MOVQ 24(AX), DI MOVQ y+16(FP), DX - ADDQ 0(DX), BX - ADCQ 8(DX), SI - ADCQ 16(DX), DI - ADCQ 24(DX), R8 - - // reduce element(BX,SI,DI,R8) using temp registers (R9,R10,R11,R12) - REDUCE(BX,SI,DI,R8,R9,R10,R11,R12) - - MOVQ res+0(FP), CX - MOVQ BX, 0(CX) - MOVQ SI, 8(CX) - MOVQ DI, 16(CX) - MOVQ R8, 24(CX) - MOVQ 32(AX), BX - MOVQ 40(AX), SI - MOVQ 48(AX), DI - MOVQ 56(AX), R8 - ADDQ 32(DX), BX - ADCQ 40(DX), SI - ADCQ 48(DX), DI - ADCQ 56(DX), R8 - - // reduce element(BX,SI,DI,R8) using temp registers (R13,R14,R15,R9) - REDUCE(BX,SI,DI,R8,R13,R14,R15,R9) - - MOVQ BX, 32(CX) - MOVQ SI, 40(CX) - MOVQ DI, 48(CX) - MOVQ R8, 56(CX) + ADDQ 0(DX), CX + ADCQ 8(DX), BX + ADCQ 16(DX), SI + ADCQ 24(DX), DI + + // reduce element(CX,BX,SI,DI,) using temp registers (R9,R10,R11,R12,R8) + REDUCE_NOGLOBAL(CX,BX,SI,DI,R9,R10,R11,R12,R8) + + MOVQ res+0(FP), R13 + MOVQ CX, 0(R13) + MOVQ BX, 8(R13) + MOVQ SI, 16(R13) + MOVQ DI, 24(R13) + MOVQ 32(AX), CX + MOVQ 40(AX), BX + MOVQ 48(AX), SI + MOVQ 56(AX), DI + ADDQ 32(DX), CX + ADCQ 40(DX), BX + ADCQ 48(DX), SI + ADCQ 56(DX), DI + + // reduce element(CX,BX,SI,DI,) using temp registers (R15,R9,R10,R11,R14) + REDUCE_NOGLOBAL(CX,BX,SI,DI,R15,R9,R10,R11,R14) + + MOVQ CX, 32(R13) + MOVQ BX, 40(R13) + MOVQ SI, 48(R13) + MOVQ DI, 56(R13) RET TEXT ·doubleE2(SB), NOSPLIT, $0-16 @@ -232,8 +87,8 @@ TEXT ·doubleE2(SB), NOSPLIT, $0-16 ADCQ SI, SI ADCQ DI, DI - // reduce element(CX,BX,SI,DI) using temp registers (R8,R9,R10,R11) - REDUCE(CX,BX,SI,DI,R8,R9,R10,R11) + // reduce element(CX,BX,SI,DI,) using temp registers (R9,R10,R11,R12,R8) + REDUCE_NOGLOBAL(CX,BX,SI,DI,R9,R10,R11,R12,R8) MOVQ CX, 0(DX) MOVQ BX, 8(DX) @@ -248,8 +103,8 @@ TEXT ·doubleE2(SB), NOSPLIT, $0-16 ADCQ SI, SI ADCQ DI, DI - // reduce element(CX,BX,SI,DI) using temp registers (R12,R13,R14,R15) - REDUCE(CX,BX,SI,DI,R12,R13,R14,R15) + // reduce element(CX,BX,SI,DI,) using temp registers (R14,R15,R9,R10,R13) + REDUCE_NOGLOBAL(CX,BX,SI,DI,R14,R15,R9,R10,R13) MOVQ CX, 32(DX) MOVQ BX, 40(DX) @@ -258,7 +113,7 @@ TEXT ·doubleE2(SB), NOSPLIT, $0-16 RET TEXT ·subE2(SB), NOSPLIT, $0-24 - XORQ DI, DI + XORQ R15, R15 MOVQ x+8(FP), SI MOVQ 0(SI), AX MOVQ 8(SI), DX @@ -270,23 +125,23 @@ TEXT ·subE2(SB), NOSPLIT, $0-24 SBBQ 16(SI), CX SBBQ 24(SI), BX MOVQ x+8(FP), SI - MOVQ $0x3c208c16d87cfd47, R8 - MOVQ $0x97816a916871ca8d, R9 - MOVQ $0xb85045b68181585d, R10 - MOVQ $0x30644e72e131a029, R11 - CMOVQCC DI, R8 - CMOVQCC DI, R9 - CMOVQCC DI, R10 - CMOVQCC DI, R11 - ADDQ R8, AX - ADCQ R9, DX - ADCQ R10, CX - ADCQ R11, BX - MOVQ res+0(FP), R12 - MOVQ AX, 0(R12) - MOVQ DX, 8(R12) - MOVQ CX, 16(R12) - MOVQ BX, 24(R12) + MOVQ $0x3c208c16d87cfd47, DI + MOVQ $0x97816a916871ca8d, R8 + MOVQ $0xb85045b68181585d, R9 + MOVQ $0x30644e72e131a029, R10 + CMOVQCC R15, DI + CMOVQCC R15, R8 + CMOVQCC R15, R9 + CMOVQCC R15, R10 + ADDQ DI, AX + ADCQ R8, DX + ADCQ R9, CX + ADCQ R10, BX + MOVQ res+0(FP), R11 + MOVQ AX, 0(R11) + MOVQ DX, 8(R11) + MOVQ CX, 16(R11) + MOVQ BX, 24(R11) MOVQ 32(SI), AX MOVQ 40(SI), DX MOVQ 48(SI), CX @@ -296,18 +151,18 @@ TEXT ·subE2(SB), NOSPLIT, $0-24 SBBQ 40(SI), DX SBBQ 48(SI), CX SBBQ 56(SI), BX - MOVQ $0x3c208c16d87cfd47, R13 - MOVQ $0x97816a916871ca8d, R14 - MOVQ $0xb85045b68181585d, R15 - MOVQ $0x30644e72e131a029, R8 - CMOVQCC DI, R13 - CMOVQCC DI, R14 - CMOVQCC DI, R15 - CMOVQCC DI, R8 - ADDQ R13, AX - ADCQ R14, DX - ADCQ R15, CX - ADCQ R8, BX + MOVQ $0x3c208c16d87cfd47, R12 + MOVQ $0x97816a916871ca8d, R13 + MOVQ $0xb85045b68181585d, R14 + MOVQ $0x30644e72e131a029, DI + CMOVQCC R15, R12 + CMOVQCC R15, R13 + CMOVQCC R15, R14 + CMOVQCC R15, DI + ADDQ R12, AX + ADCQ R13, DX + ADCQ R14, CX + ADCQ DI, BX MOVQ res+0(FP), SI MOVQ AX, 32(SI) MOVQ DX, 40(SI) @@ -393,68 +248,68 @@ TEXT ·mulNonResE2(SB), NOSPLIT, $0-16 ADCQ BX, BX // reduce element(AX,DX,CX,BX) using temp registers (R11,R12,R13,R14) - REDUCE(AX,DX,CX,BX,R11,R12,R13,R14) + REDUCE(AX,DX,CX,BX,R11,R12,R13,R14,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB)) ADDQ AX, AX ADCQ DX, DX ADCQ CX, CX ADCQ BX, BX - // reduce element(AX,DX,CX,BX) using temp registers (R15,R11,R12,R13) - REDUCE(AX,DX,CX,BX,R15,R11,R12,R13) + // reduce element(AX,DX,CX,BX) using temp registers (R11,R12,R13,R14) + REDUCE(AX,DX,CX,BX,R11,R12,R13,R14,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB)) ADDQ AX, AX ADCQ DX, DX ADCQ CX, CX ADCQ BX, BX - // reduce element(AX,DX,CX,BX) using temp registers (R14,R15,R11,R12) - REDUCE(AX,DX,CX,BX,R14,R15,R11,R12) + // reduce element(AX,DX,CX,BX) using temp registers (R11,R12,R13,R14) + REDUCE(AX,DX,CX,BX,R11,R12,R13,R14,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB)) ADDQ 0(R10), AX ADCQ 8(R10), DX ADCQ 16(R10), CX ADCQ 24(R10), BX - // reduce element(AX,DX,CX,BX) using temp registers (R13,R14,R15,R11) - REDUCE(AX,DX,CX,BX,R13,R14,R15,R11) + // reduce element(AX,DX,CX,BX) using temp registers (R11,R12,R13,R14) + REDUCE(AX,DX,CX,BX,R11,R12,R13,R14,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB)) MOVQ 32(R10), SI MOVQ 40(R10), DI MOVQ 48(R10), R8 MOVQ 56(R10), R9 - XORQ R12, R12 + XORQ R15, R15 SUBQ SI, AX SBBQ DI, DX SBBQ R8, CX SBBQ R9, BX - MOVQ $0x3c208c16d87cfd47, R13 - MOVQ $0x97816a916871ca8d, R14 - MOVQ $0xb85045b68181585d, R15 - MOVQ $0x30644e72e131a029, R11 - CMOVQCC R12, R13 - CMOVQCC R12, R14 - CMOVQCC R12, R15 - CMOVQCC R12, R11 - ADDQ R13, AX - ADCQ R14, DX - ADCQ R15, CX - ADCQ R11, BX + MOVQ $0x3c208c16d87cfd47, R11 + MOVQ $0x97816a916871ca8d, R12 + MOVQ $0xb85045b68181585d, R13 + MOVQ $0x30644e72e131a029, R14 + CMOVQCC R15, R11 + CMOVQCC R15, R12 + CMOVQCC R15, R13 + CMOVQCC R15, R14 + ADDQ R11, AX + ADCQ R12, DX + ADCQ R13, CX + ADCQ R14, BX ADDQ SI, SI ADCQ DI, DI ADCQ R8, R8 ADCQ R9, R9 - // reduce element(SI,DI,R8,R9) using temp registers (R13,R14,R15,R11) - REDUCE(SI,DI,R8,R9,R13,R14,R15,R11) + // reduce element(SI,DI,R8,R9) using temp registers (R11,R12,R13,R14) + REDUCE(SI,DI,R8,R9,R11,R12,R13,R14,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB)) ADDQ SI, SI ADCQ DI, DI ADCQ R8, R8 ADCQ R9, R9 - // reduce element(SI,DI,R8,R9) using temp registers (R12,R13,R14,R15) - REDUCE(SI,DI,R8,R9,R12,R13,R14,R15) + // reduce element(SI,DI,R8,R9) using temp registers (R11,R12,R13,R14) + REDUCE(SI,DI,R8,R9,R11,R12,R13,R14,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB)) ADDQ SI, SI ADCQ DI, DI @@ -462,23 +317,23 @@ TEXT ·mulNonResE2(SB), NOSPLIT, $0-16 ADCQ R9, R9 // reduce element(SI,DI,R8,R9) using temp registers (R11,R12,R13,R14) - REDUCE(SI,DI,R8,R9,R11,R12,R13,R14) + REDUCE(SI,DI,R8,R9,R11,R12,R13,R14,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB)) ADDQ 32(R10), SI ADCQ 40(R10), DI ADCQ 48(R10), R8 ADCQ 56(R10), R9 - // reduce element(SI,DI,R8,R9) using temp registers (R15,R11,R12,R13) - REDUCE(SI,DI,R8,R9,R15,R11,R12,R13) + // reduce element(SI,DI,R8,R9) using temp registers (R11,R12,R13,R14) + REDUCE(SI,DI,R8,R9,R11,R12,R13,R14,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB)) ADDQ 0(R10), SI ADCQ 8(R10), DI ADCQ 16(R10), R8 ADCQ 24(R10), R9 - // reduce element(SI,DI,R8,R9) using temp registers (R14,R15,R11,R12) - REDUCE(SI,DI,R8,R9,R14,R15,R11,R12) + // reduce element(SI,DI,R8,R9) using temp registers (R11,R12,R13,R14) + REDUCE(SI,DI,R8,R9,R11,R12,R13,R14,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB)) MOVQ res+0(FP), R10 MOVQ AX, 0(R10) @@ -491,8 +346,10 @@ TEXT ·mulNonResE2(SB), NOSPLIT, $0-16 MOVQ R9, 56(R10) RET -TEXT ·mulAdxE2(SB), $64-24 +TEXT ·mulAdxE2(SB), $48-24 NO_LOCAL_POINTERS + CMPB ·supportAdx(SB), $1 + JNE l4 // var a, b, c fp.Element // a.Add(&x.A0, &x.A1) @@ -503,80 +360,168 @@ TEXT ·mulAdxE2(SB), $64-24 // z.A1.Sub(&a, &b).Sub(&z.A1, &c) // z.A0.Sub(&b, &c) - CMPB ·supportAdx(SB), $1 - JNE l4 MOVQ x+8(FP), AX - MOVQ y+16(FP), DX - MOVQ 32(AX), R14 - MOVQ 40(AX), R15 + MOVQ 32(AX), R13 + MOVQ 40(AX), R14 MOVQ 48(AX), CX MOVQ 56(AX), BX - MOVQ 32(DX), SI - MOVQ 40(DX), DI - MOVQ 48(DX), R8 - MOVQ 56(DX), R9 - // mul (R14,R15,CX,BX) with (SI,DI,R8,R9) into (R10,R11,R12,R13) - MUL() + // A -> BP + // t[0] -> SI + // t[1] -> DI + // t[2] -> R8 + // t[3] -> R9 +#define MACC(in0, in1, in2) \ + ADCXQ in0, in1 \ + MULXQ in2, AX, in0 \ + ADOXQ AX, in1 \ + +#define DIV_SHIFT() \ + MOVQ $const_qInvNeg, DX \ + IMULQ SI, DX \ + XORQ AX, AX \ + MULXQ ·qElement+0(SB), AX, R10 \ + ADCXQ SI, AX \ + MOVQ R10, SI \ + MACC(DI, SI, ·qElement+8(SB)) \ + MACC(R8, DI, ·qElement+16(SB)) \ + MACC(R9, R8, ·qElement+24(SB)) \ + MOVQ $0, AX \ + ADCXQ AX, R9 \ + ADOXQ BP, R9 \ + +#define MUL_WORD_0() \ + XORQ AX, AX \ + MULXQ R13, SI, DI \ + MULXQ R14, AX, R8 \ + ADOXQ AX, DI \ + MULXQ CX, AX, R9 \ + ADOXQ AX, R8 \ + MULXQ BX, AX, BP \ + ADOXQ AX, R9 \ + MOVQ $0, AX \ + ADOXQ AX, BP \ + DIV_SHIFT() \ + +#define MUL_WORD_N() \ + XORQ AX, AX \ + MULXQ R13, AX, BP \ + ADOXQ AX, SI \ + MACC(BP, DI, R14) \ + MACC(BP, R8, CX) \ + MACC(BP, R9, BX) \ + MOVQ $0, AX \ + ADCXQ AX, BP \ + ADOXQ AX, BP \ + DIV_SHIFT() \ + + // mul body + MOVQ y+16(FP), DX + MOVQ 32(DX), DX + MUL_WORD_0() + MOVQ y+16(FP), DX + MOVQ 40(DX), DX + MUL_WORD_N() + MOVQ y+16(FP), DX + MOVQ 48(DX), DX + MUL_WORD_N() + MOVQ y+16(FP), DX + MOVQ 56(DX), DX + MUL_WORD_N() - // reduce element(R10,R11,R12,R13) using temp registers (SI,DI,R8,R9) - REDUCE(R10,R11,R12,R13,SI,DI,R8,R9) + // reduce element(SI,DI,R8,R9) using temp registers (R13,R14,CX,BX) + REDUCE(SI,DI,R8,R9,R13,R14,CX,BX,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB)) - MOVQ R10, s4-40(SP) - MOVQ R11, s5-48(SP) - MOVQ R12, s6-56(SP) - MOVQ R13, s7-64(SP) + MOVQ SI, s2-24(SP) + MOVQ DI, s3-32(SP) + MOVQ R8, s4-40(SP) + MOVQ R9, s5-48(SP) MOVQ x+8(FP), AX MOVQ y+16(FP), DX - ADDQ 0(AX), R14 - ADCQ 8(AX), R15 + MOVQ 32(AX), R13 + MOVQ 40(AX), R14 + MOVQ 48(AX), CX + MOVQ 56(AX), BX + ADDQ 0(AX), R13 + ADCQ 8(AX), R14 ADCQ 16(AX), CX ADCQ 24(AX), BX - MOVQ 0(DX), SI - MOVQ 8(DX), DI - MOVQ 16(DX), R8 - MOVQ 24(DX), R9 - ADDQ 32(DX), SI - ADCQ 40(DX), DI - ADCQ 48(DX), R8 - ADCQ 56(DX), R9 - - // mul (R14,R15,CX,BX) with (SI,DI,R8,R9) into (R10,R11,R12,R13) - MUL() - - // reduce element(R10,R11,R12,R13) using temp registers (SI,DI,R8,R9) - REDUCE(R10,R11,R12,R13,SI,DI,R8,R9) - - MOVQ R10, s0-8(SP) - MOVQ R11, s1-16(SP) - MOVQ R12, s2-24(SP) - MOVQ R13, s3-32(SP) + MOVQ R13, R11 + MOVQ R14, R12 + MOVQ CX, s0-8(SP) + MOVQ BX, s1-16(SP) + MOVQ 0(DX), R13 + MOVQ 8(DX), R14 + MOVQ 16(DX), CX + MOVQ 24(DX), BX + ADDQ 32(DX), R13 + ADCQ 40(DX), R14 + ADCQ 48(DX), CX + ADCQ 56(DX), BX + + // A -> BP + // t[0] -> SI + // t[1] -> DI + // t[2] -> R8 + // t[3] -> R9 + // mul body + MOVQ R11, DX + MUL_WORD_0() + MOVQ R12, DX + MUL_WORD_N() + MOVQ s0-8(SP), DX + MUL_WORD_N() + MOVQ s1-16(SP), DX + MUL_WORD_N() + + // reduce element(SI,DI,R8,R9) using temp registers (R13,R14,CX,BX) + REDUCE(SI,DI,R8,R9,R13,R14,CX,BX,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB)) + + MOVQ SI, R11 + MOVQ DI, R12 + MOVQ R8, s0-8(SP) + MOVQ R9, s1-16(SP) MOVQ x+8(FP), AX - MOVQ y+16(FP), DX - MOVQ 0(AX), R14 - MOVQ 8(AX), R15 + MOVQ 0(AX), R13 + MOVQ 8(AX), R14 MOVQ 16(AX), CX MOVQ 24(AX), BX - MOVQ 0(DX), SI - MOVQ 8(DX), DI - MOVQ 16(DX), R8 - MOVQ 24(DX), R9 - // mul (R14,R15,CX,BX) with (SI,DI,R8,R9) into (R10,R11,R12,R13) - MUL() + // A -> BP + // t[0] -> SI + // t[1] -> DI + // t[2] -> R8 + // t[3] -> R9 + // mul body + MOVQ y+16(FP), DX + MOVQ 0(DX), DX + MUL_WORD_0() + MOVQ y+16(FP), DX + MOVQ 8(DX), DX + MUL_WORD_N() + MOVQ y+16(FP), DX + MOVQ 16(DX), DX + MUL_WORD_N() + MOVQ y+16(FP), DX + MOVQ 24(DX), DX + MUL_WORD_N() - // reduce element(R10,R11,R12,R13) using temp registers (SI,DI,R8,R9) - REDUCE(R10,R11,R12,R13,SI,DI,R8,R9) + // reduce element(SI,DI,R8,R9) using temp registers (R13,R14,CX,BX) + REDUCE(SI,DI,R8,R9,R13,R14,CX,BX,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB)) XORQ DX, DX - MOVQ s0-8(SP), R14 - MOVQ s1-16(SP), R15 - MOVQ s2-24(SP), CX - MOVQ s3-32(SP), BX - SUBQ R10, R14 - SBBQ R11, R15 - SBBQ R12, CX - SBBQ R13, BX + MOVQ R11, R13 + MOVQ R12, R14 + MOVQ s0-8(SP), CX + MOVQ s1-16(SP), BX + SUBQ SI, R13 + SBBQ DI, R14 + SBBQ R8, CX + SBBQ R9, BX + MOVQ SI, R11 + MOVQ DI, R12 + MOVQ R8, s0-8(SP) + MOVQ R9, s1-16(SP) MOVQ $0x3c208c16d87cfd47, SI MOVQ $0x97816a916871ca8d, DI MOVQ $0xb85045b68181585d, R8 @@ -585,14 +530,14 @@ TEXT ·mulAdxE2(SB), $64-24 CMOVQCC DX, DI CMOVQCC DX, R8 CMOVQCC DX, R9 - ADDQ SI, R14 - ADCQ DI, R15 + ADDQ SI, R13 + ADCQ DI, R14 ADCQ R8, CX ADCQ R9, BX - SUBQ s4-40(SP), R14 - SBBQ s5-48(SP), R15 - SBBQ s6-56(SP), CX - SBBQ s7-64(SP), BX + SUBQ s2-24(SP), R13 + SBBQ s3-32(SP), R14 + SBBQ s4-40(SP), CX + SBBQ s5-48(SP), BX MOVQ $0x3c208c16d87cfd47, SI MOVQ $0x97816a916871ca8d, DI MOVQ $0xb85045b68181585d, R8 @@ -601,39 +546,39 @@ TEXT ·mulAdxE2(SB), $64-24 CMOVQCC DX, DI CMOVQCC DX, R8 CMOVQCC DX, R9 - ADDQ SI, R14 - ADCQ DI, R15 + ADDQ SI, R13 + ADCQ DI, R14 ADCQ R8, CX ADCQ R9, BX MOVQ res+0(FP), AX - MOVQ R14, 32(AX) - MOVQ R15, 40(AX) + MOVQ R13, 32(AX) + MOVQ R14, 40(AX) MOVQ CX, 48(AX) MOVQ BX, 56(AX) - MOVQ s4-40(SP), SI - MOVQ s5-48(SP), DI - MOVQ s6-56(SP), R8 - MOVQ s7-64(SP), R9 - SUBQ SI, R10 - SBBQ DI, R11 - SBBQ R8, R12 - SBBQ R9, R13 - MOVQ $0x3c208c16d87cfd47, R14 - MOVQ $0x97816a916871ca8d, R15 + MOVQ R11, SI + MOVQ R12, DI + MOVQ s0-8(SP), R8 + MOVQ s1-16(SP), R9 + SUBQ s2-24(SP), SI + SBBQ s3-32(SP), DI + SBBQ s4-40(SP), R8 + SBBQ s5-48(SP), R9 + MOVQ $0x3c208c16d87cfd47, R13 + MOVQ $0x97816a916871ca8d, R14 MOVQ $0xb85045b68181585d, CX MOVQ $0x30644e72e131a029, BX + CMOVQCC DX, R13 CMOVQCC DX, R14 - CMOVQCC DX, R15 CMOVQCC DX, CX CMOVQCC DX, BX - ADDQ R14, R10 - ADCQ R15, R11 - ADCQ CX, R12 - ADCQ BX, R13 - MOVQ R10, 0(AX) - MOVQ R11, 8(AX) - MOVQ R12, 16(AX) - MOVQ R13, 24(AX) + ADDQ R13, SI + ADCQ R14, DI + ADCQ CX, R8 + ADCQ BX, R9 + MOVQ SI, 0(AX) + MOVQ DI, 8(AX) + MOVQ R8, 16(AX) + MOVQ R9, 24(AX) RET l4: @@ -646,102 +591,137 @@ l4: CALL ·mulGenericE2(SB) RET -TEXT ·squareAdxE2(SB), $16-16 +TEXT ·squareAdxE2(SB), $64-16 NO_LOCAL_POINTERS + CMPB ·supportAdx(SB), $1 + JNE l5 // z.A0 = (x.A0 + x.A1) * (x.A0 - x.A1) // z.A1 = 2 * x.A0 * x.A1 - CMPB ·supportAdx(SB), $1 - JNE l5 + MOVQ $const_q0, AX + MOVQ AX, s0-8(SP) + MOVQ $const_q1, AX + MOVQ AX, s1-16(SP) + MOVQ $const_q2, AX + MOVQ AX, s2-24(SP) + MOVQ $const_q3, AX + MOVQ AX, s3-32(SP) // 2 * x.A0 * x.A1 MOVQ x+8(FP), AX - // x.A0[0] -> SI - // x.A0[1] -> DI - // x.A0[2] -> R8 - // x.A0[3] -> R9 - MOVQ 0(AX), SI - MOVQ 8(AX), DI - MOVQ 16(AX), R8 - MOVQ 24(AX), R9 - - // 2 * x.A1[0] -> R14 - // 2 * x.A1[1] -> R15 + // 2 * x.A1[0] -> R13 + // 2 * x.A1[1] -> R14 // 2 * x.A1[2] -> CX // 2 * x.A1[3] -> BX - MOVQ 32(AX), R14 - MOVQ 40(AX), R15 + MOVQ 32(AX), R13 + MOVQ 40(AX), R14 MOVQ 48(AX), CX MOVQ 56(AX), BX - ADDQ R14, R14 - ADCQ R15, R15 + ADDQ R13, R13 + ADCQ R14, R14 ADCQ CX, CX ADCQ BX, BX - // mul (R14,R15,CX,BX) with (SI,DI,R8,R9) into (R10,R11,R12,R13) - MUL() - - // reduce element(R10,R11,R12,R13) using temp registers (R14,R15,CX,BX) - REDUCE(R10,R11,R12,R13,R14,R15,CX,BX) + // A -> BP + // t[0] -> SI + // t[1] -> DI + // t[2] -> R8 + // t[3] -> R9 + // mul body + MOVQ x+8(FP), DX + MOVQ 0(DX), DX + MUL_WORD_0() + MOVQ x+8(FP), DX + MOVQ 8(DX), DX + MUL_WORD_N() + MOVQ x+8(FP), DX + MOVQ 16(DX), DX + MUL_WORD_N() + MOVQ x+8(FP), DX + MOVQ 24(DX), DX + MUL_WORD_N() + + // reduce element(SI,DI,R8,R9) using temp registers (R13,R14,CX,BX) + REDUCE(SI,DI,R8,R9,R13,R14,CX,BX,s0-8(SP),s1-16(SP),s2-24(SP),s3-32(SP)) MOVQ x+8(FP), AX - // x.A1[0] -> R14 - // x.A1[1] -> R15 + // x.A1[0] -> R13 + // x.A1[1] -> R14 // x.A1[2] -> CX // x.A1[3] -> BX - MOVQ 32(AX), R14 - MOVQ 40(AX), R15 + MOVQ 32(AX), R13 + MOVQ 40(AX), R14 MOVQ 48(AX), CX MOVQ 56(AX), BX MOVQ res+0(FP), DX - MOVQ R10, 32(DX) - MOVQ R11, 40(DX) - MOVQ R12, 48(DX) - MOVQ R13, 56(DX) - MOVQ R14, R10 - MOVQ R15, R11 - MOVQ CX, R12 - MOVQ BX, R13 + MOVQ SI, 32(DX) + MOVQ DI, 40(DX) + MOVQ R8, 48(DX) + MOVQ R9, 56(DX) + MOVQ R13, SI + MOVQ R14, DI + MOVQ CX, R8 + MOVQ BX, R9 // Add(&x.A0, &x.A1) - ADDQ SI, R14 - ADCQ DI, R15 - ADCQ R8, CX - ADCQ R9, BX - XORQ BP, BP + ADDQ 0(AX), R13 + ADCQ 8(AX), R14 + ADCQ 16(AX), CX + ADCQ 24(AX), BX + MOVQ R13, s4-40(SP) + MOVQ R14, s5-48(SP) + MOVQ CX, s6-56(SP) + MOVQ BX, s7-64(SP) + XORQ DX, DX // Sub(&x.A0, &x.A1) - SUBQ R10, SI - SBBQ R11, DI - SBBQ R12, R8 - SBBQ R13, R9 - MOVQ $0x3c208c16d87cfd47, R10 - MOVQ $0x97816a916871ca8d, R11 - MOVQ $0xb85045b68181585d, R12 - MOVQ $0x30644e72e131a029, R13 - CMOVQCC BP, R10 - CMOVQCC BP, R11 - CMOVQCC BP, R12 - CMOVQCC BP, R13 - ADDQ R10, SI - ADCQ R11, DI - ADCQ R12, R8 - ADCQ R13, R9 - - // mul (R14,R15,CX,BX) with (SI,DI,R8,R9) into (R10,R11,R12,R13) - MUL() - - // reduce element(R10,R11,R12,R13) using temp registers (R14,R15,CX,BX) - REDUCE(R10,R11,R12,R13,R14,R15,CX,BX) + MOVQ 0(AX), R13 + MOVQ 8(AX), R14 + MOVQ 16(AX), CX + MOVQ 24(AX), BX + SUBQ SI, R13 + SBBQ DI, R14 + SBBQ R8, CX + SBBQ R9, BX + MOVQ $0x3c208c16d87cfd47, SI + MOVQ $0x97816a916871ca8d, DI + MOVQ $0xb85045b68181585d, R8 + MOVQ $0x30644e72e131a029, R9 + CMOVQCC DX, SI + CMOVQCC DX, DI + CMOVQCC DX, R8 + CMOVQCC DX, R9 + ADDQ SI, R13 + ADCQ DI, R14 + ADCQ R8, CX + ADCQ R9, BX + + // A -> BP + // t[0] -> SI + // t[1] -> DI + // t[2] -> R8 + // t[3] -> R9 + // mul body + MOVQ s4-40(SP), DX + MUL_WORD_0() + MOVQ s5-48(SP), DX + MUL_WORD_N() + MOVQ s6-56(SP), DX + MUL_WORD_N() + MOVQ s7-64(SP), DX + MUL_WORD_N() + + // reduce element(SI,DI,R8,R9) using temp registers (R13,R14,CX,BX) + REDUCE(SI,DI,R8,R9,R13,R14,CX,BX,s0-8(SP),s1-16(SP),s2-24(SP),s3-32(SP)) MOVQ res+0(FP), AX - MOVQ R10, 0(AX) - MOVQ R11, 8(AX) - MOVQ R12, 16(AX) - MOVQ R13, 24(AX) + MOVQ SI, 0(AX) + MOVQ DI, 8(AX) + MOVQ R8, 16(AX) + MOVQ R9, 24(AX) RET l5: diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e2_bn254.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e2_bn254.go index 87ab9d1ca..ea5152b69 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e2_bn254.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e2_bn254.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys AG -// -// 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. package fptower diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e2_bn254_fallback.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e2_bn254_fallback.go index 467a96f77..3d58d737a 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e2_bn254_fallback.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e2_bn254_fallback.go @@ -1,19 +1,8 @@ //go:build !amd64 // +build !amd64 -// Copyright 2020 ConsenSys AG -// -// 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. package fptower diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e2_fallback.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e2_fallback.go index 6fe47c411..7a2461ec5 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e2_fallback.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e2_fallback.go @@ -1,19 +1,7 @@ //go:build !amd64 -// +build !amd64 -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e6.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e6.go index 128007df2..4c932208b 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e6.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/e6.go @@ -1,16 +1,5 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -63,11 +52,20 @@ func (z *E6) SetRandom() (*E6, error) { return z, nil } -// IsZero returns true if the two elements are equal, false otherwise +// MustSetRandom sets a0 and a1 to random values. +// It panics if reading form crypto/rand fails +func (z *E6) MustSetRandom() { + if _, err := z.SetRandom(); err != nil { + panic(err) + } +} + +// IsZero returns true if z is zero, false otherwise func (z *E6) IsZero() bool { return z.B0.IsZero() && z.B1.IsZero() && z.B2.IsZero() } +// IsOne returns true if z is one, false otherwise func (z *E6) IsOne() bool { return z.B0.IsOne() && z.B1.IsZero() && z.B2.IsZero() } @@ -88,7 +86,7 @@ func (z *E6) Neg(x *E6) *E6 { return z } -// Sub two elements of E6 +// Sub subtracts two elements of E6 func (z *E6) Sub(x, y *E6) *E6 { z.B0.Sub(&x.B0, &y.B0) z.B1.Sub(&x.B1, &y.B1) @@ -286,8 +284,8 @@ func (z *E6) Inverse(x *E6) *E6 { return z } -// BatchInvertE6 returns a new slice with every element inverted. -// Uses Montgomery batch inversion trick +// BatchInvertE6 returns a new slice with every element in a inverted. +// It uses Montgomery batch inversion trick. // // if a[i] == 0, returns result[i] = a[i] func BatchInvertE6(a []E6) []E6 { @@ -322,6 +320,8 @@ func BatchInvertE6(a []E6) []E6 { return res } +// Select is conditional move. +// If cond = 0, it sets z to caseZ and returns it. otherwise caseNz. func (z *E6) Select(cond int, caseZ *E6, caseNz *E6) *E6 { //Might be able to save a nanosecond or two by an aggregate implementation @@ -332,6 +332,7 @@ func (z *E6) Select(cond int, caseZ *E6, caseNz *E6) *E6 { return z } +// Div divides an element in E6 by an element in E6 func (z *E6) Div(x *E6, y *E6) *E6 { var r E6 r.Inverse(y).Mul(x, &r) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/frobenius.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/frobenius.go index 18d8fef96..4aaf9b5d0 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/frobenius.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/frobenius.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys AG -// -// 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. package fptower diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/parameters.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/parameters.go index 3859aeac7..2778dd994 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/parameters.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower/parameters.go @@ -1,16 +1,5 @@ -// Copyright 2020 ConsenSys AG -// -// 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. package fptower diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/marshal.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/marshal.go index d4a6f6eea..697854d62 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/marshal.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/marshal.go @@ -1,16 +1,5 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -166,6 +155,26 @@ func (dec *Decoder) Decode(v interface{}) (err error) { dec.n += read64 } return + case *[][][]fr.Element: + if sliceLen, err = dec.readUint32(); err != nil { + return + } + if len(*t) != int(sliceLen) { + *t = make([][][]fr.Element, sliceLen) + } + for i := range *t { + if sliceLen, err = dec.readUint32(); err != nil { + return + } + if len((*t)[i]) != int(sliceLen) { + (*t)[i] = make([][]fr.Element, sliceLen) + } + for j := range (*t)[i] { + read64, err = (*fr.Vector)(&(*t)[i][j]).ReadFrom(dec.r) + dec.n += read64 + } + } + return case *G1Affine: // we start by reading compressed point size, if metadata tells us it is uncompressed, we read more. read, err = io.ReadFull(dec.r, buf[:SizeOfG1AffineCompressed]) @@ -370,7 +379,7 @@ func (dec *Decoder) readUint64() (r uint64, err error) { func isCompressed(msb byte) bool { mData := msb & mMask - return !(mData == mUncompressed) + return mData != mUncompressed } // NewEncoder returns a binary encoder supporting curve bn254 objects @@ -391,7 +400,7 @@ func NewEncoder(w io.Writer, options ...func(*Encoder)) *Encoder { } // Encode writes the binary encoding of v to the stream -// type must be uint64, *fr.Element, *fp.Element, *G1Affine, *G2Affine, []G1Affine or []G2Affine +// type must be uint64, *fr.Element, *fp.Element, *G1Affine, *G2Affine, []G1Affine, []G2Affine, *[]G1Affine or *[]G2Affine func (enc *Encoder) Encode(v interface{}) (err error) { if enc.raw { return enc.encodeRaw(v) @@ -502,6 +511,27 @@ func (enc *Encoder) encode(v interface{}) (err error) { enc.n += written64 } return + case [][][]fr.Element: + // number of collections + if err = binary.Write(enc.w, binary.BigEndian, uint32(len(t))); err != nil { + return + } + enc.n += 4 + for i := range t { + // size of current collection + if err = binary.Write(enc.w, binary.BigEndian, uint32(len(t[i]))); err != nil { + return + } + enc.n += 4 + // write each vector of the current collection + for j := range t[i] { + written64, err = (*fr.Vector)(&t[i][j]).WriteTo(enc.w) + enc.n += written64 + } + } + return + case *[]G1Affine: + return enc.encode(*t) case []G1Affine: // write slice length err = binary.Write(enc.w, binary.BigEndian, uint32(len(t))) @@ -521,6 +551,8 @@ func (enc *Encoder) encode(v interface{}) (err error) { } } return nil + case *[]G2Affine: + return enc.encode(*t) case []G2Affine: // write slice length err = binary.Write(enc.w, binary.BigEndian, uint32(len(t))) @@ -620,6 +652,27 @@ func (enc *Encoder) encodeRaw(v interface{}) (err error) { enc.n += written64 } return + case [][][]fr.Element: + // number of collections + if err = binary.Write(enc.w, binary.BigEndian, uint32(len(t))); err != nil { + return + } + enc.n += 4 + for i := range t { + // size of current collection + if err = binary.Write(enc.w, binary.BigEndian, uint32(len(t[i]))); err != nil { + return + } + enc.n += 4 + // write each vector of the current collection + for j := range t[i] { + written64, err = (*fr.Vector)(&t[i][j]).WriteTo(enc.w) + enc.n += written64 + } + } + return + case *[]G1Affine: + return enc.encodeRaw(*t) case []G1Affine: // write slice length err = binary.Write(enc.w, binary.BigEndian, uint32(len(t))) @@ -639,6 +692,8 @@ func (enc *Encoder) encodeRaw(v interface{}) (err error) { } } return nil + case *[]G2Affine: + return enc.encodeRaw(*t) case []G2Affine: // write slice length err = binary.Write(enc.w, binary.BigEndian, uint32(len(t))) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/multiexp.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/multiexp.go index 9d1b71278..9bb0a8d48 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/multiexp.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/multiexp.go @@ -1,16 +1,5 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -325,6 +314,31 @@ func msmReduceChunkG1Affine(p *G1Jac, c int, chChunks []chan g1JacExtended) *G1J return p.unsafeFromJacExtended(&_p) } +// Fold computes the multi-exponentiation \sum_{i=0}^{len(points)-1} points[i] * +// combinationCoeff^i and stores the result in p. It returns error in case +// configuration is invalid. +func (p *G1Affine) Fold(points []G1Affine, combinationCoeff fr.Element, config ecc.MultiExpConfig) (*G1Affine, error) { + var _p G1Jac + if _, err := _p.Fold(points, combinationCoeff, config); err != nil { + return nil, err + } + p.FromJacobian(&_p) + return p, nil +} + +// Fold computes the multi-exponentiation \sum_{i=0}^{len(points)-1} points[i] * +// combinationCoeff^i and stores the result in p. It returns error in case +// configuration is invalid. +func (p *G1Jac) Fold(points []G1Affine, combinationCoeff fr.Element, config ecc.MultiExpConfig) (*G1Jac, error) { + scalars := make([]fr.Element, len(points)) + scalar := fr.NewElement(1) + for i := 0; i < len(points); i++ { + scalars[i].Set(&scalar) + scalar.Mul(&scalar, &combinationCoeff) + } + return p.MultiExp(points, scalars, config) +} + // MultiExp implements section 4 of https://eprint.iacr.org/2012/549.pdf // // This call return an error if len(scalars) != len(points) or if provided config is invalid. @@ -625,6 +639,31 @@ func msmReduceChunkG2Affine(p *G2Jac, c int, chChunks []chan g2JacExtended) *G2J return p.unsafeFromJacExtended(&_p) } +// Fold computes the multi-exponentiation \sum_{i=0}^{len(points)-1} points[i] * +// combinationCoeff^i and stores the result in p. It returns error in case +// configuration is invalid. +func (p *G2Affine) Fold(points []G2Affine, combinationCoeff fr.Element, config ecc.MultiExpConfig) (*G2Affine, error) { + var _p G2Jac + if _, err := _p.Fold(points, combinationCoeff, config); err != nil { + return nil, err + } + p.FromJacobian(&_p) + return p, nil +} + +// Fold computes the multi-exponentiation \sum_{i=0}^{len(points)-1} points[i] * +// combinationCoeff^i and stores the result in p. It returns error in case +// configuration is invalid. +func (p *G2Jac) Fold(points []G2Affine, combinationCoeff fr.Element, config ecc.MultiExpConfig) (*G2Jac, error) { + scalars := make([]fr.Element, len(points)) + scalar := fr.NewElement(1) + for i := 0; i < len(points); i++ { + scalars[i].Set(&scalar) + scalar.Mul(&scalar, &combinationCoeff) + } + return p.MultiExp(points, scalars, config) +} + // selector stores the index, mask and shifts needed to select bits from a scalar // it is used during the multiExp algorithm or the batch scalar multiplication type selector struct { diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/multiexp_affine.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/multiexp_affine.go index 0958526ea..0e198cbe8 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/multiexp_affine.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/multiexp_affine.go @@ -1,16 +1,5 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -30,7 +19,7 @@ type batchOpG1Affine struct { // using affine coordinates for the buckets. To amortize the cost of the inverse in the affine addition // we use a batch affine addition. // -// this is derived from a PR by 0x0ece : https://github.com/ConsenSys/gnark-crypto/pull/249 +// this is derived from a PR by 0x0ece : https://github.com/Consensys/gnark-crypto/pull/249 // See Section 5.3: ia.cr/2022/1396 func processChunkG1BatchAffine[BJE ibg1JacExtended, B ibG1Affine, BS bitSet, TP pG1Affine, TPP ppG1Affine, TQ qOpsG1Affine, TC cG1Affine]( chunk uint64, @@ -60,11 +49,10 @@ func processChunkG1BatchAffine[BJE ibg1JacExtended, B ibG1Affine, BS bitSet, TP // note that we have 2 sets of buckets // 1 in G1Affine used with the batch affine additions // 1 in g1JacExtended used in case the queue of conflicting points - var buckets B + var buckets B // in G1Affine coordinates, infinity point is represented as (0,0), no need to init var bucketsJE BJE for i := 0; i < len(buckets); i++ { - buckets[i].setInfinity() - bucketsJE[i].setInfinity() + bucketsJE[i].SetInfinity() } // setup for the batch affine; @@ -107,7 +95,7 @@ func processChunkG1BatchAffine[BJE ibg1JacExtended, B ibG1Affine, BS bitSet, TP bucketsJE[op.bucketID].addMixed(&op.point) return } - BK.setInfinity() + BK.SetInfinity() return } @@ -135,12 +123,12 @@ func processChunkG1BatchAffine[BJE ibg1JacExtended, B ibG1Affine, BS bitSet, TP if isAdd { bucketsJE[bucketID].addMixed(PP) } else { - BK.setInfinity() + BK.SetInfinity() } return } if isAdd { - BK.setInfinity() + BK.SetInfinity() } else { bucketsJE[bucketID].subMixed(PP) } @@ -222,11 +210,11 @@ func processChunkG1BatchAffine[BJE ibg1JacExtended, B ibG1Affine, BS bitSet, TP // reduce buckets into total // total = bucket[0] + 2*bucket[1] + 3*bucket[2] ... + n*bucket[n-1] var runningSum, total g1JacExtended - runningSum.setInfinity() - total.setInfinity() + runningSum.SetInfinity() + total.SetInfinity() for k := len(buckets) - 1; k >= 0; k-- { runningSum.addMixed(&buckets[k]) - if !bucketsJE[k].IsZero() { + if !bucketsJE[k].IsInfinity() { runningSum.add(&bucketsJE[k]) } total.add(&runningSum) @@ -358,7 +346,7 @@ type batchOpG2Affine struct { // using affine coordinates for the buckets. To amortize the cost of the inverse in the affine addition // we use a batch affine addition. // -// this is derived from a PR by 0x0ece : https://github.com/ConsenSys/gnark-crypto/pull/249 +// this is derived from a PR by 0x0ece : https://github.com/Consensys/gnark-crypto/pull/249 // See Section 5.3: ia.cr/2022/1396 func processChunkG2BatchAffine[BJE ibg2JacExtended, B ibG2Affine, BS bitSet, TP pG2Affine, TPP ppG2Affine, TQ qOpsG2Affine, TC cG2Affine]( chunk uint64, @@ -388,11 +376,10 @@ func processChunkG2BatchAffine[BJE ibg2JacExtended, B ibG2Affine, BS bitSet, TP // note that we have 2 sets of buckets // 1 in G2Affine used with the batch affine additions // 1 in g2JacExtended used in case the queue of conflicting points - var buckets B + var buckets B // in G2Affine coordinates, infinity point is represented as (0,0), no need to init var bucketsJE BJE for i := 0; i < len(buckets); i++ { - buckets[i].setInfinity() - bucketsJE[i].setInfinity() + bucketsJE[i].SetInfinity() } // setup for the batch affine; @@ -435,7 +422,7 @@ func processChunkG2BatchAffine[BJE ibg2JacExtended, B ibG2Affine, BS bitSet, TP bucketsJE[op.bucketID].addMixed(&op.point) return } - BK.setInfinity() + BK.SetInfinity() return } @@ -463,12 +450,12 @@ func processChunkG2BatchAffine[BJE ibg2JacExtended, B ibG2Affine, BS bitSet, TP if isAdd { bucketsJE[bucketID].addMixed(PP) } else { - BK.setInfinity() + BK.SetInfinity() } return } if isAdd { - BK.setInfinity() + BK.SetInfinity() } else { bucketsJE[bucketID].subMixed(PP) } @@ -550,11 +537,11 @@ func processChunkG2BatchAffine[BJE ibg2JacExtended, B ibG2Affine, BS bitSet, TP // reduce buckets into total // total = bucket[0] + 2*bucket[1] + 3*bucket[2] ... + n*bucket[n-1] var runningSum, total g2JacExtended - runningSum.setInfinity() - total.setInfinity() + runningSum.SetInfinity() + total.SetInfinity() for k := len(buckets) - 1; k >= 0; k-- { runningSum.addMixed(&buckets[k]) - if !bucketsJE[k].IsZero() { + if !bucketsJE[k].IsInfinity() { runningSum.add(&bucketsJE[k]) } total.add(&runningSum) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/multiexp_jacobian.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/multiexp_jacobian.go index 32f728fc0..b13a9ddce 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/multiexp_jacobian.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/multiexp_jacobian.go @@ -1,16 +1,5 @@ -// Copyright 2020 Consensys Software 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. // Code generated by consensys/gnark-crypto DO NOT EDIT @@ -30,7 +19,7 @@ func processChunkG1Jacobian[B ibg1JacExtended](chunk uint64, var buckets B for i := 0; i < len(buckets); i++ { - buckets[i].setInfinity() + buckets[i].SetInfinity() } // for each scalars, get the digit corresponding to the chunk we're processing. @@ -53,10 +42,10 @@ func processChunkG1Jacobian[B ibg1JacExtended](chunk uint64, // total = bucket[0] + 2*bucket[1] + 3*bucket[2] ... + n*bucket[n-1] var runningSum, total g1JacExtended - runningSum.setInfinity() - total.setInfinity() + runningSum.SetInfinity() + total.SetInfinity() for k := len(buckets) - 1; k >= 0; k-- { - if !buckets[k].IsZero() { + if !buckets[k].IsInfinity() { runningSum.add(&buckets[k]) } total.add(&runningSum) @@ -121,7 +110,7 @@ func processChunkG2Jacobian[B ibg2JacExtended](chunk uint64, var buckets B for i := 0; i < len(buckets); i++ { - buckets[i].setInfinity() + buckets[i].SetInfinity() } // for each scalars, get the digit corresponding to the chunk we're processing. @@ -144,10 +133,10 @@ func processChunkG2Jacobian[B ibg2JacExtended](chunk uint64, // total = bucket[0] + 2*bucket[1] + 3*bucket[2] ... + n*bucket[n-1] var runningSum, total g2JacExtended - runningSum.setInfinity() - total.setInfinity() + runningSum.SetInfinity() + total.SetInfinity() for k := len(buckets) - 1; k >= 0; k-- { - if !buckets[k].IsZero() { + if !buckets[k].IsInfinity() { runningSum.add(&buckets[k]) } total.add(&runningSum) diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/pairing.go b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/pairing.go index ec342fe80..080db40f8 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/bn254/pairing.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/bn254/pairing.go @@ -1,22 +1,12 @@ -// Copyright 2020 ConsenSys AG -// -// 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. +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. package bn254 import ( "errors" + "github.com/consensys/gnark-crypto/ecc/bn254/fp" "github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower" ) @@ -154,7 +144,7 @@ func MillerLoop(P []G1Affine, Q []G2Affine) (GT, error) { if n >= 1 { // i = 64, separately to avoid an E12 Square // (Square(res) = 1² = 1) - // loopCounter[64] = 0 + // LoopCounter[64] = 0 // k = 0, separately to avoid MulBy034 (res × ℓ) // (assign line to res) @@ -195,7 +185,7 @@ func MillerLoop(P []G1Affine, Q []G2Affine) (GT, error) { result.MulBy034(&l1.r0, &l1.r1, &l1.r2) } - // i = 63, separately to avoid a doubleStep (loopCounter[63]=-1) + // i = 63, separately to avoid a doubleStep (LoopCounter[63]=-1) // (at this point qProj = 2Q, so 2qProj-Q=3Q is equivalent to qProj+Q=3Q // this means doubleStep followed by an addMixedStep is equivalent to an // addMixedStep here) @@ -221,7 +211,7 @@ func MillerLoop(P []G1Affine, Q []G2Affine) (GT, error) { } // i <= 62 - for i := len(loopCounter) - 4; i >= 0; i-- { + for i := len(LoopCounter) - 4; i >= 0; i-- { // mutualize the square among n Miller loops // (∏ᵢfᵢ)² result.Square(&result) @@ -233,7 +223,8 @@ func MillerLoop(P []G1Affine, Q []G2Affine) (GT, error) { l1.r0.MulByElement(&l1.r0, &p[k].Y) l1.r1.MulByElement(&l1.r1, &p[k].X) - if loopCounter[i] == 1 { + switch LoopCounter[i] { + case 1: // qProj[k] ← qProj[k]+Q[k] and // l2 the line ℓ passing qProj[k] and Q[k] qProj[k].addMixedStep(&l2, &q[k]) @@ -244,8 +235,7 @@ func MillerLoop(P []G1Affine, Q []G2Affine) (GT, error) { prodLines = fptower.Mul034By034(&l1.r0, &l1.r1, &l1.r2, &l2.r0, &l2.r1, &l2.r2) // (ℓ × ℓ) × res result.MulBy01234(&prodLines) - - } else if loopCounter[i] == -1 { + case -1: // qProj[k] ← qProj[k]-Q[k] and // l2 the line ℓ passing qProj[k] and -Q[k] qProj[k].addMixedStep(&l2, &qNeg[k]) @@ -256,7 +246,7 @@ func MillerLoop(P []G1Affine, Q []G2Affine) (GT, error) { prodLines = fptower.Mul034By034(&l1.r0, &l1.r1, &l1.r2, &l2.r0, &l2.r1, &l2.r2) // (ℓ × ℓ) × res result.MulBy01234(&prodLines) - } else { + default: // ℓ × res result.MulBy034(&l1.r0, &l1.r1, &l1.r2) } @@ -394,3 +384,329 @@ func (p *g2Proj) lineCompute(evaluations *lineEvaluation, a *G2Affine) { evaluations.r1.Neg(&O) evaluations.r2.Set(&J) } + +// ---------------------- +// Fixed-argument pairing +// ---------------------- + +type LineEvaluationAff struct { + R0 fptower.E2 + R1 fptower.E2 +} + +// PairFixedQ calculates the reduced pairing for a set of points +// ∏ᵢ e(Pᵢ, Qᵢ) where Q are fixed points in G2. +// +// This function doesn't check that the inputs are in the correct subgroup. See IsInSubGroup. +func PairFixedQ(P []G1Affine, lines [][2][len(LoopCounter)]LineEvaluationAff) (GT, error) { + f, err := MillerLoopFixedQ(P, lines) + if err != nil { + return GT{}, err + } + return FinalExponentiation(&f), nil +} + +// PairingCheckFixedQ calculates the reduced pairing for a set of points and returns True if the result is One +// ∏ᵢ e(Pᵢ, Qᵢ) =? 1 where Q are fixed points in G2. +// +// This function doesn't check that the inputs are in the correct subgroup. See IsInSubGroup. +func PairingCheckFixedQ(P []G1Affine, lines [][2][len(LoopCounter)]LineEvaluationAff) (bool, error) { + f, err := PairFixedQ(P, lines) + if err != nil { + return false, err + } + var one GT + one.SetOne() + return f.Equal(&one), nil +} + +// PrecomputeLines precomputes the lines for the fixed-argument Miller loop +func PrecomputeLines(Q G2Affine) (PrecomputedLines [2][len(LoopCounter)]LineEvaluationAff) { + var accQ, negQ G2Affine + accQ.Set(&Q) + negQ.Neg(&Q) + + n := len(LoopCounter) + for i := n - 2; i >= 0; i-- { + switch LoopCounter[i] { + case 0: + accQ.doubleStep(&PrecomputedLines[0][i]) + case 1: + accQ.doubleAndAddStep(&PrecomputedLines[0][i], &PrecomputedLines[1][i], &Q) + case -1: + accQ.doubleAndAddStep(&PrecomputedLines[0][i], &PrecomputedLines[1][i], &negQ) + default: + return [2][len(LoopCounter)]LineEvaluationAff{} + } + } + + var psiQ, phiQ G2Affine + phiQ.X.Conjugate(&Q.X).MulByNonResidue1Power2(&phiQ.X) + phiQ.Y.Conjugate(&Q.Y).MulByNonResidue1Power3(&phiQ.Y) + psiQ.X.MulByNonResidue2Power2(&Q.X) + psiQ.Y.MulByNonResidue2Power3(&Q.Y).Neg(&psiQ.Y) + + accQ.addStep(&PrecomputedLines[1][n-1], &phiQ) + accQ.addStep(&PrecomputedLines[0][n-1], &psiQ) + + return PrecomputedLines +} + +// MillerLoopFixedQ computes the multi-Miller loop as in MillerLoop +// but Qᵢ are fixed points in G2 known in advance. +func MillerLoopFixedQ(P []G1Affine, lines [][2][len(LoopCounter)]LineEvaluationAff) (GT, error) { + n := len(P) + if n == 0 || n != len(lines) { + return GT{}, errors.New("invalid inputs sizes") + } + + // no need to filter infinity points: + // 1. if Pᵢ=(0,0) then -x/y=1/y=0 by gnark-crypto convention and so + // lines R0 and R1 are 0. At the end it happens that result will stay + // 1 through the Miller loop because MulBy34(1,0,0)==1 + // Mul34By34(1,0,0,1,0,0)==1 and MulBy01234(1,0,0,0,0)==1. + // + // 2. if Qᵢ=(0,0) then PrecomputeLines(Qᵢ) will return lines R0 and R1 + // that are 0 because of gnark-convention (*/0==0) in doubleStep and + // addStep. Similarly to Pᵢ=(0,0) it happens that result stays 1 + // throughout the MillerLoop. + + // precomputations + yInv := make([]fp.Element, n) + xNegOverY := make([]fp.Element, n) + for k := 0; k < n; k++ { + yInv[k].Set(&P[k].Y) + } + yInv = fp.BatchInvert(yInv) + for k := 0; k < n; k++ { + xNegOverY[k].Mul(&P[k].X, &yInv[k]). + Neg(&xNegOverY[k]) + } + + var result GT + result.SetOne() + var prodLines [5]E2 + + // Compute ∏ᵢ { fᵢ_{6x₀+2,Q}(P) } + if n >= 1 { + // i = 64, separately to avoid an E12 Square + // (Square(res) = 1² = 1) + // LoopCounter[64] = 0 + // k = 0, separately to avoid MulBy34 (res × ℓ) + // (assign line to res) + + // line evaluation at P[0] (assign) + result.C1.B0.MulByElement(&lines[0][0][64].R0, &xNegOverY[0]) + result.C1.B1.MulByElement(&lines[0][0][64].R1, &yInv[0]) + // the coefficient which MulBy34 sets to 1 happens to be already 1 (result = 1) + } + + if n >= 2 { + // k = 1, separately to avoid MulBy34 (res × ℓ) + // (res is also a line at this point, so we use Mul34By34 ℓ × ℓ) + // line evaluation at P[1] + lines[1][0][64].R0.MulByElement(&lines[1][0][64].R0, &xNegOverY[1]) + lines[1][0][64].R1.MulByElement(&lines[1][0][64].R1, &yInv[1]) + // ℓ × res + prodLines = fptower.Mul34By34(&lines[1][0][64].R0, &lines[1][0][64].R1, &result.C1.B0, &result.C1.B1) + result.C0.B0 = prodLines[0] + result.C0.B1 = prodLines[1] + result.C0.B2 = prodLines[2] + result.C1.B0 = prodLines[3] + result.C1.B1 = prodLines[4] + } + + // k >= 2 + for k := 2; k < n; k++ { + // line evaluation at P[k] + lines[k][0][64].R0.MulByElement(&lines[k][0][64].R0, &xNegOverY[k]) + lines[k][0][64].R1.MulByElement(&lines[k][0][64].R1, &yInv[k]) + // ℓ × res + result.MulBy34( + &lines[k][0][64].R0, + &lines[k][0][64].R1, + ) + } + + for i := len(LoopCounter) - 3; i >= 0; i-- { + // mutualize the square among n Miller loops + // (∏ᵢfᵢ)² + result.Square(&result) + + for k := 0; k < n; k++ { + // line evaluation at P[k] + lines[k][0][i].R0. + MulByElement( + &lines[k][0][i].R0, + &xNegOverY[k], + ) + lines[k][0][i].R1. + MulByElement( + &lines[k][0][i].R1, + &yInv[k], + ) + + if LoopCounter[i] == 0 { + // ℓ × res + result.MulBy34( + &lines[k][0][i].R0, + &lines[k][0][i].R1, + ) + } else { + // line evaluation at P[k] + lines[k][1][i].R0. + MulByElement( + &lines[k][1][i].R0, + &xNegOverY[k], + ) + lines[k][1][i].R1. + MulByElement( + &lines[k][1][i].R1, + &yInv[k], + ) + // ℓ × ℓ + prodLines = fptower.Mul34By34( + &lines[k][0][i].R0, &lines[k][0][i].R1, + &lines[k][1][i].R0, &lines[k][1][i].R1, + ) + // (ℓ × ℓ) × res + result.MulBy01234(&prodLines) + } + } + } + + // Compute ∏ᵢ { ℓᵢ_{[6x₀+2]Q,π(Q)}(P) · ℓᵢ_{[6x₀+2]Q+π(Q),-π²(Q)}(P) } + for k := 0; k < n; k++ { + // line evaluation at P[k] + lines[k][1][65].R0. + MulByElement( + &lines[k][1][65].R0, + &xNegOverY[k], + ) + lines[k][1][65].R1. + MulByElement( + &lines[k][1][65].R1, + &yInv[k], + ) + // line evaluation at P[k] + lines[k][0][65].R0. + MulByElement( + &lines[k][0][65].R0, + &xNegOverY[k], + ) + lines[k][0][65].R1. + MulByElement( + &lines[k][0][65].R1, + &yInv[k], + ) + // ℓ × ℓ + prodLines = fptower.Mul34By34( + &lines[k][1][65].R0, &lines[k][1][65].R1, + &lines[k][0][65].R0, &lines[k][0][65].R1, + ) + // (ℓ × ℓ) × res + result.MulBy01234(&prodLines) + } + + return result, nil +} + +func (p *G2Affine) doubleStep(evaluations *LineEvaluationAff) { + + var n, d, λ, xr, yr fptower.E2 + // λ = 3x²/2y + n.Square(&p.X) + λ.Double(&n). + Add(&λ, &n) + d.Double(&p.Y) + λ.Div(&λ, &d) + + // xr = λ²-2x + xr.Square(&λ). + Sub(&xr, &p.X). + Sub(&xr, &p.X) + + // yr = λ(x-xr)-y + yr.Sub(&p.X, &xr). + Mul(&yr, &λ). + Sub(&yr, &p.Y) + + evaluations.R0.Set(&λ) + evaluations.R1.Mul(&λ, &p.X). + Sub(&evaluations.R1, &p.Y) + + p.X.Set(&xr) + p.Y.Set(&yr) +} + +func (p *G2Affine) addStep(evaluations *LineEvaluationAff, a *G2Affine) { + var n, d, λ, λλ, xr, yr fptower.E2 + + // compute λ = (y2-y1)/(x2-x1) + n.Sub(&a.Y, &p.Y) + d.Sub(&a.X, &p.X) + λ.Div(&n, &d) + + // xr = λ²-x1-x2 + λλ.Square(&λ) + n.Add(&p.X, &a.X) + xr.Sub(&λλ, &n) + + // yr = λ(x1-xr) - y1 + yr.Sub(&p.X, &xr). + Mul(&yr, &λ). + Sub(&yr, &p.Y) + + evaluations.R0.Set(&λ) + evaluations.R1.Mul(&λ, &p.X). + Sub(&evaluations.R1, &p.Y) + + p.X.Set(&xr) + p.Y.Set(&yr) +} + +func (p *G2Affine) doubleAndAddStep(evaluations1, evaluations2 *LineEvaluationAff, a *G2Affine) { + var n, d, l1, x3, l2, x4, y4 fptower.E2 + + // compute λ1 = (y2-y1)/(x2-x1) + n.Sub(&p.Y, &a.Y) + d.Sub(&p.X, &a.X) + l1.Div(&n, &d) + + // compute x3 =λ1²-x1-x2 + x3.Square(&l1) + x3.Sub(&x3, &p.X) + x3.Sub(&x3, &a.X) + + // omit y3 computation + + // compute line1 + evaluations1.R0.Set(&l1) + evaluations1.R1.Mul(&l1, &p.X) + evaluations1.R1.Sub(&evaluations1.R1, &p.Y) + + // compute λ2 = -λ1-2y1/(x3-x1) + n.Double(&p.Y) + d.Sub(&x3, &p.X) + l2.Div(&n, &d) + l2.Add(&l2, &l1) + l2.Neg(&l2) + + // compute x4 = λ2²-x1-x3 + x4.Square(&l2) + x4.Sub(&x4, &p.X) + x4.Sub(&x4, &x3) + + // compute y4 = λ2(x1 - x4)-y1 + y4.Sub(&p.X, &x4) + y4.Mul(&l2, &y4) + y4.Sub(&y4, &p.Y) + + // compute line2 + evaluations2.R0.Set(&l2) + evaluations2.R1.Mul(&l2, &p.X) + evaluations2.R1.Sub(&evaluations2.R1, &p.Y) + + p.X.Set(&x4) + p.Y.Set(&y4) +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/ecc.go b/vendor/github.com/consensys/gnark-crypto/ecc/ecc.go index 5fa1bd961..fb4dc0918 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/ecc.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/ecc.go @@ -1,20 +1,7 @@ -/* -Copyright © 2020 ConsenSys +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. -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 ecc provides bls12-381, bls12-377, bls12-378, bn254, bw6-761, bls24-315, bls24-317, bw6-633, bls12-378, bw6-756, secp256k1 and stark-curve elliptic curves implementation (+pairing). +// Package ecc provides bls12-381, bls12-377, bn254, bw6-761, bls24-315, bls24-317, bw6-633, secp256k1 and stark-curve elliptic curves implementation (+pairing). // // Also // @@ -26,13 +13,6 @@ limitations under the License. // - EdDSA (on the "companion" twisted edwards curves) package ecc -import ( - "math/big" - "strings" - - "github.com/consensys/gnark-crypto/internal/generator/config" -) - // ID represent a unique ID for a curve type ID uint16 @@ -41,78 +21,16 @@ const ( UNKNOWN ID = iota BN254 BLS12_377 - BLS12_378 BLS12_381 BLS24_315 BLS24_317 BW6_761 BW6_633 - BW6_756 STARK_CURVE SECP256K1 + GRUMPKIN ) -// Implemented return the list of curves fully implemented in gnark-crypto -func Implemented() []ID { - return []ID{BN254, BLS12_377, BLS12_381, BW6_761, BLS24_315, BW6_633, BLS12_378, BW6_756, BLS24_317, STARK_CURVE, SECP256K1} -} - -func (id ID) String() string { - cfg := id.config() - return strings.ToLower(cfg.EnumID) -} - -// ScalarField returns the scalar field of the curve -func (id ID) ScalarField() *big.Int { - cfg := id.config() - return modulus(cfg, true) -} - -// BaseField returns the base field of the curve -func (id ID) BaseField() *big.Int { - cfg := id.config() - return modulus(cfg, false) -} - -func (id ID) config() *config.Curve { - // note to avoid circular dependency these are hard coded - // values are checked for non regression in code generation - switch id { - case BLS12_377: - return &config.BLS12_377 - case BLS12_378: - return &config.BLS12_378 - case BLS12_381: - return &config.BLS12_381 - case BN254: - return &config.BN254 - case BW6_761: - return &config.BW6_761 - case BW6_633: - return &config.BW6_633 - case BLS24_315: - return &config.BLS24_315 - case BLS24_317: - return &config.BLS24_317 - case BW6_756: - return &config.BW6_756 - case STARK_CURVE: - return &config.STARK_CURVE - case SECP256K1: - return &config.SECP256K1 - default: - panic("unimplemented ecc ID") - } -} - -func modulus(c *config.Curve, scalarField bool) *big.Int { - if scalarField { - return new(big.Int).Set(c.FrInfo.Modulus()) - } - - return new(big.Int).Set(c.FpInfo.Modulus()) -} - // MultiExpConfig enables to set optional configuration attribute to a call to MultiExp type MultiExpConfig struct { NbTasks int // go routines to be used in the multiexp. can be larger than num cpus. diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/ecc.md b/vendor/github.com/consensys/gnark-crypto/ecc/ecc.md index f4508d761..b0be48033 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/ecc.md +++ b/vendor/github.com/consensys/gnark-crypto/ecc/ecc.md @@ -2,16 +2,16 @@ * BLS12-381 (Zcash) * BN254 (Ethereum) +* GRUMPKIN (2-cycle with BN254) * BLS12-377 (ZEXE) -* BW6-761 (EC supporting pairing on BLS12-377 field of definition) +* BW6-761 (2-chain with BLS12-377) * BLS24-315 -* BW6-633 (EC supporting pairing on BLS24-315 field of definition) -* BLS12-378 (GT-strong SNARK-friendly) -* BW6-756 (EC supporting pairing on BLS12-378 field of definition) +* BW6-633 (2-chain with BLS24-315) +* BLS24-317 * STARK (STARK curve for ECDSA) ### Twisted edwards curves -Each of these curve has a `twistededwards` sub-package with its companion curve. In particular, BLS12-381 comapnion curve is known as [Jubjub](https://z.cash/technology/jubjub/) and BN254's [Baby-Jubjub](https://iden3-docs.readthedocs.io/en/latest/_downloads/33717d75ab84e11313cc0d8a090b636f/Baby-Jubjub.pdf). +Each of these curve has a `twistededwards` sub-package with its companion curve. In particular, BLS12-381 companion curve is known as [Jubjub](https://z.cash/technology/jubjub/) and BN254's [Baby-Jubjub](https://iden3-docs.readthedocs.io/en/latest/_downloads/33717d75ab84e11313cc0d8a090b636f/Baby-Jubjub.pdf). They are of particular interest as they allow efficient elliptic curve cryptography inside zkSNARK circuits. diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/ecc_field.go b/vendor/github.com/consensys/gnark-crypto/ecc/ecc_field.go new file mode 100644 index 000000000..5f9179e31 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/ecc/ecc_field.go @@ -0,0 +1,123 @@ +// Copyright 2020-2025 Consensys Software Inc. +// Licensed under the Apache License, Version 2.0. See the LICENSE file for details. + +// Code generated by consensys/gnark-crypto DO NOT EDIT + +package ecc + +import ( + "errors" + "math/big" + "strings" +) + +var mID = map[string]ID{ + "bls12_377": BLS12_377, + "bls12_381": BLS12_381, + "bls24_315": BLS24_315, + "bls24_317": BLS24_317, + "bn254": BN254, + "bw6_633": BW6_633, + "bw6_761": BW6_761, + "grumpkin": GRUMPKIN, + "secp256k1": SECP256K1, + "stark_curve": STARK_CURVE, +} + +// ScalarField returns the scalar field of the curve +func (id ID) ScalarField() *big.Int { + f := new(big.Int) + switch id { + case BLS12_377: + f.SetString("8444461749428370424248824938781546531375899335154063827935233455917409239041", 10) + case BLS12_381: + f.SetString("52435875175126190479447740508185965837690552500527637822603658699938581184513", 10) + case BLS24_315: + f.SetString("11502027791375260645628074404575422495959608200132055716665986169834464870401", 10) + case BLS24_317: + f.SetString("30869589236456844204538189757527902584594726589286811523515204428962673459201", 10) + case BN254: + f.SetString("21888242871839275222246405745257275088548364400416034343698204186575808495617", 10) + case BW6_633: + f.SetString("39705142709513438335025689890408969744933502416914749335064285505637884093126342347073617133569", 10) + case BW6_761: + f.SetString("258664426012969094010652733694893533536393512754914660539884262666720468348340822774968888139573360124440321458177", 10) + case GRUMPKIN: + f.SetString("21888242871839275222246405745257275088696311157297823662689037894645226208583", 10) + case SECP256K1: + f.SetString("115792089237316195423570985008687907852837564279074904382605163141518161494337", 10) + case STARK_CURVE: + f.SetString("3618502788666131213697322783095070105526743751716087489154079457884512865583", 10) + default: + panic("unimplemented ecc ID") + } + return f +} + +// BaseField returns the base field of the curve +func (id ID) BaseField() *big.Int { + f := new(big.Int) + switch id { + case BLS12_377: + f.SetString("258664426012969094010652733694893533536393512754914660539884262666720468348340822774968888139573360124440321458177", 10) + case BLS12_381: + f.SetString("4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787", 10) + case BLS24_315: + f.SetString("39705142709513438335025689890408969744933502416914749335064285505637884093126342347073617133569", 10) + case BLS24_317: + f.SetString("136393071104295911515099765908274057061945112121419593977210139303905973197232025618026156731051", 10) + case BN254: + f.SetString("21888242871839275222246405745257275088696311157297823662689037894645226208583", 10) + case BW6_633: + f.SetString("20494478644167774678813387386538961497669590920908778075528754551012016751717791778743535050360001387419576570244406805463255765034468441182772056330021723098661967429339971741066259394985997", 10) + case BW6_761: + f.SetString("6891450384315732539396789682275657542479668912536150109513790160209623422243491736087683183289411687640864567753786613451161759120554247759349511699125301598951605099378508850372543631423596795951899700429969112842764913119068299", 10) + case GRUMPKIN: + f.SetString("21888242871839275222246405745257275088548364400416034343698204186575808495617", 10) + case SECP256K1: + f.SetString("115792089237316195423570985008687907853269984665640564039457584007908834671663", 10) + case STARK_CURVE: + f.SetString("3618502788666131213697322783095070105623107215331596699973092056135872020481", 10) + default: + panic("unimplemented ecc ID") + } + return f +} + +// String returns the string representation of the ID +func (id ID) String() string { + switch id { + case BLS12_377: + return "bls12_377" + case BLS12_381: + return "bls12_381" + case BLS24_315: + return "bls24_315" + case BLS24_317: + return "bls24_317" + case BN254: + return "bn254" + case BW6_633: + return "bw6_633" + case BW6_761: + return "bw6_761" + case GRUMPKIN: + return "grumpkin" + case SECP256K1: + return "secp256k1" + case STARK_CURVE: + return "stark_curve" + default: + panic("unimplemented ecc ID") + } +} + +// IDFromString returns the ID corresponding to the string representation of the curve ID. +// It returns UNKNOWN if the string does not match any known curve ID. +func IDFromString(s string) (ID, error) { + s = strings.ToLower(s) + if id, ok := mID[s]; ok { + return id, nil + } + return UNKNOWN, errors.New("unknown curve ID") +} diff --git a/vendor/github.com/consensys/gnark-crypto/ecc/utils.go b/vendor/github.com/consensys/gnark-crypto/ecc/utils.go index 78126fc1c..c86c6295e 100644 --- a/vendor/github.com/consensys/gnark-crypto/ecc/utils.go +++ b/vendor/github.com/consensys/gnark-crypto/ecc/utils.go @@ -178,7 +178,8 @@ func getVector(l *Lattice, a, b *big.Int) [2]big.Int { return res } -// NextPowerOfTwo returns the next power of 2 of n +// NextPowerOfTwo(n) = 2^⌈log₂(n)⌉ +// or 2ᵏ where 2ᵏ⁻¹ < n ≤ 2ᵏ func NextPowerOfTwo(n uint64) uint64 { c := bits.OnesCount64(n) if c == 0 { diff --git a/vendor/github.com/consensys/gnark-crypto/field/asm/element_4w/asm.go b/vendor/github.com/consensys/gnark-crypto/field/asm/element_4w/asm.go new file mode 100644 index 000000000..f912791ea --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/field/asm/element_4w/asm.go @@ -0,0 +1,12 @@ +// Package asm is a workaround to force go mod vendor to include the asm files +// see https://github.com/Consensys/gnark-crypto/issues/619 +package asm + +const DUMMY = 0 +const qInvNeg = 0 +const mu = 0 +const q = 0 +const q0 = 0 +const q1 = 0 +const q2 = 0 +const q3 = 0 diff --git a/vendor/github.com/consensys/gnark-crypto/field/asm/element_4w/element_4w_amd64.s b/vendor/github.com/consensys/gnark-crypto/field/asm/element_4w/element_4w_amd64.s new file mode 100644 index 000000000..efb02187e --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/field/asm/element_4w/element_4w_amd64.s @@ -0,0 +1,2488 @@ +// Code generated by gnark-crypto/generator. DO NOT EDIT. +#include "textflag.h" +#include "funcdata.h" +#include "go_asm.h" + +#define REDUCE(ra0, ra1, ra2, ra3, rb0, rb1, rb2, rb3, q0, q1, q2, q3) \ + MOVQ ra0, rb0; \ + SUBQ q0, ra0; \ + MOVQ ra1, rb1; \ + SBBQ q1, ra1; \ + MOVQ ra2, rb2; \ + SBBQ q2, ra2; \ + MOVQ ra3, rb3; \ + SBBQ q3, ra3; \ + CMOVQCS rb0, ra0; \ + CMOVQCS rb1, ra1; \ + CMOVQCS rb2, ra2; \ + CMOVQCS rb3, ra3; \ + +TEXT ·reduce(SB), NOSPLIT, $0-8 + MOVQ res+0(FP), AX + MOVQ 0(AX), DX + MOVQ 8(AX), CX + MOVQ 16(AX), BX + MOVQ 24(AX), SI + + // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) + REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB)) + + MOVQ DX, 0(AX) + MOVQ CX, 8(AX) + MOVQ BX, 16(AX) + MOVQ SI, 24(AX) + RET + +// MulBy3(x *Element) +TEXT ·MulBy3(SB), NOSPLIT, $0-8 + MOVQ x+0(FP), AX + MOVQ 0(AX), DX + MOVQ 8(AX), CX + MOVQ 16(AX), BX + MOVQ 24(AX), SI + ADDQ DX, DX + ADCQ CX, CX + ADCQ BX, BX + ADCQ SI, SI + + // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) + REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB)) + + ADDQ 0(AX), DX + ADCQ 8(AX), CX + ADCQ 16(AX), BX + ADCQ 24(AX), SI + + // reduce element(DX,CX,BX,SI) using temp registers (R11,R12,R13,R14) + REDUCE(DX,CX,BX,SI,R11,R12,R13,R14,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB)) + + MOVQ DX, 0(AX) + MOVQ CX, 8(AX) + MOVQ BX, 16(AX) + MOVQ SI, 24(AX) + RET + +// MulBy5(x *Element) +TEXT ·MulBy5(SB), NOSPLIT, $0-8 + MOVQ x+0(FP), AX + MOVQ 0(AX), DX + MOVQ 8(AX), CX + MOVQ 16(AX), BX + MOVQ 24(AX), SI + ADDQ DX, DX + ADCQ CX, CX + ADCQ BX, BX + ADCQ SI, SI + + // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) + REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB)) + + ADDQ DX, DX + ADCQ CX, CX + ADCQ BX, BX + ADCQ SI, SI + + // reduce element(DX,CX,BX,SI) using temp registers (R11,R12,R13,R14) + REDUCE(DX,CX,BX,SI,R11,R12,R13,R14,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB)) + + ADDQ 0(AX), DX + ADCQ 8(AX), CX + ADCQ 16(AX), BX + ADCQ 24(AX), SI + + // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) + REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB)) + + MOVQ DX, 0(AX) + MOVQ CX, 8(AX) + MOVQ BX, 16(AX) + MOVQ SI, 24(AX) + RET + +// MulBy13(x *Element) +TEXT ·MulBy13(SB), NOSPLIT, $0-8 + MOVQ x+0(FP), AX + MOVQ 0(AX), DX + MOVQ 8(AX), CX + MOVQ 16(AX), BX + MOVQ 24(AX), SI + ADDQ DX, DX + ADCQ CX, CX + ADCQ BX, BX + ADCQ SI, SI + + // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) + REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB)) + + ADDQ DX, DX + ADCQ CX, CX + ADCQ BX, BX + ADCQ SI, SI + + // reduce element(DX,CX,BX,SI) using temp registers (R11,R12,R13,R14) + REDUCE(DX,CX,BX,SI,R11,R12,R13,R14,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB)) + + MOVQ DX, R11 + MOVQ CX, R12 + MOVQ BX, R13 + MOVQ SI, R14 + ADDQ DX, DX + ADCQ CX, CX + ADCQ BX, BX + ADCQ SI, SI + + // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) + REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB)) + + ADDQ R11, DX + ADCQ R12, CX + ADCQ R13, BX + ADCQ R14, SI + + // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) + REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB)) + + ADDQ 0(AX), DX + ADCQ 8(AX), CX + ADCQ 16(AX), BX + ADCQ 24(AX), SI + + // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) + REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB)) + + MOVQ DX, 0(AX) + MOVQ CX, 8(AX) + MOVQ BX, 16(AX) + MOVQ SI, 24(AX) + RET + +// Butterfly(a, b *Element) sets a = a + b; b = a - b +TEXT ·Butterfly(SB), NOSPLIT, $0-16 + MOVQ a+0(FP), R15 + MOVQ 0(R15), DX + MOVQ 8(R15), CX + MOVQ 16(R15), BX + MOVQ 24(R15), SI + MOVQ DX, DI + MOVQ CX, R8 + MOVQ BX, R9 + MOVQ SI, R10 + XORQ R15, R15 + MOVQ b+8(FP), AX + ADDQ 0(AX), DX + ADCQ 8(AX), CX + ADCQ 16(AX), BX + ADCQ 24(AX), SI + SUBQ 0(AX), DI + SBBQ 8(AX), R8 + SBBQ 16(AX), R9 + SBBQ 24(AX), R10 + MOVQ $const_q0, R11 + MOVQ $const_q1, R12 + MOVQ $const_q2, R13 + MOVQ $const_q3, R14 + CMOVQCC R15, R11 + CMOVQCC R15, R12 + CMOVQCC R15, R13 + CMOVQCC R15, R14 + ADDQ R11, DI + ADCQ R12, R8 + ADCQ R13, R9 + ADCQ R14, R10 + MOVQ DI, 0(AX) + MOVQ R8, 8(AX) + MOVQ R9, 16(AX) + MOVQ R10, 24(AX) + + // reduce element(DX,CX,BX,SI) using temp registers (DI,R8,R9,R10) + REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB)) + + MOVQ a+0(FP), R15 + MOVQ DX, 0(R15) + MOVQ CX, 8(R15) + MOVQ BX, 16(R15) + MOVQ SI, 24(R15) + RET + +// mul(res, x, y *Element) +TEXT ·mul(SB), $24-24 + + // Algorithm 2 of "Faster Montgomery Multiplication and Multi-Scalar-Multiplication for SNARKS" + // by Y. El Housni and G. Botrel https://doi.org/10.46586/tches.v2023.i3.504-521 + // See github.com/Consensys/gnark-crypto/field/generator for more comments. + + NO_LOCAL_POINTERS + CMPB ·supportAdx(SB), $1 + JNE noAdx_1 + MOVQ x+8(FP), SI + + // x[0] -> DI + // x[1] -> R8 + // x[2] -> R9 + // x[3] -> R10 + MOVQ 0(SI), DI + MOVQ 8(SI), R8 + MOVQ 16(SI), R9 + MOVQ 24(SI), R10 + MOVQ y+16(FP), R11 + + // A -> BP + // t[0] -> R14 + // t[1] -> R13 + // t[2] -> CX + // t[3] -> BX +#define MACC(in0, in1, in2) \ + ADCXQ in0, in1 \ + MULXQ in2, AX, in0 \ + ADOXQ AX, in1 \ + +#define DIV_SHIFT() \ + MOVQ $const_qInvNeg, DX \ + IMULQ R14, DX \ + XORQ AX, AX \ + MULXQ ·qElement+0(SB), AX, R12 \ + ADCXQ R14, AX \ + MOVQ R12, R14 \ + MACC(R13, R14, ·qElement+8(SB)) \ + MACC(CX, R13, ·qElement+16(SB)) \ + MACC(BX, CX, ·qElement+24(SB)) \ + MOVQ $0, AX \ + ADCXQ AX, BX \ + ADOXQ BP, BX \ + +#define MUL_WORD_0() \ + XORQ AX, AX \ + MULXQ DI, R14, R13 \ + MULXQ R8, AX, CX \ + ADOXQ AX, R13 \ + MULXQ R9, AX, BX \ + ADOXQ AX, CX \ + MULXQ R10, AX, BP \ + ADOXQ AX, BX \ + MOVQ $0, AX \ + ADOXQ AX, BP \ + DIV_SHIFT() \ + +#define MUL_WORD_N() \ + XORQ AX, AX \ + MULXQ DI, AX, BP \ + ADOXQ AX, R14 \ + MACC(BP, R13, R8) \ + MACC(BP, CX, R9) \ + MACC(BP, BX, R10) \ + MOVQ $0, AX \ + ADCXQ AX, BP \ + ADOXQ AX, BP \ + DIV_SHIFT() \ + + // mul body + MOVQ 0(R11), DX + MUL_WORD_0() + MOVQ 8(R11), DX + MUL_WORD_N() + MOVQ 16(R11), DX + MUL_WORD_N() + MOVQ 24(R11), DX + MUL_WORD_N() + + // reduce element(R14,R13,CX,BX) using temp registers (SI,R12,R11,DI) + REDUCE(R14,R13,CX,BX,SI,R12,R11,DI,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB)) + + MOVQ res+0(FP), AX + MOVQ R14, 0(AX) + MOVQ R13, 8(AX) + MOVQ CX, 16(AX) + MOVQ BX, 24(AX) + RET + +noAdx_1: + MOVQ res+0(FP), AX + MOVQ AX, (SP) + MOVQ x+8(FP), AX + MOVQ AX, 8(SP) + MOVQ y+16(FP), AX + MOVQ AX, 16(SP) + CALL ·_mulGeneric(SB) + RET + +TEXT ·fromMont(SB), $8-8 + NO_LOCAL_POINTERS + + // Algorithm 2 of "Faster Montgomery Multiplication and Multi-Scalar-Multiplication for SNARKS" + // by Y. El Housni and G. Botrel https://doi.org/10.46586/tches.v2023.i3.504-521 + // when y = 1 we have: + // for i=0 to N-1 + // t[i] = x[i] + // for i=0 to N-1 + // m := t[0]*q'[0] mod W + // C,_ := t[0] + m*q[0] + // for j=1 to N-1 + // (C,t[j-1]) := t[j] + m*q[j] + C + // t[N-1] = C + CMPB ·supportAdx(SB), $1 + JNE noAdx_2 + MOVQ res+0(FP), DX + MOVQ 0(DX), R13 + MOVQ 8(DX), R14 + MOVQ 16(DX), CX + MOVQ 24(DX), BX + XORQ DX, DX + + // m := t[0]*q'[0] mod W + MOVQ $const_qInvNeg, DX + IMULQ R13, DX + XORQ AX, AX + + // C,_ := t[0] + m*q[0] + MULXQ ·qElement+0(SB), AX, BP + ADCXQ R13, AX + MOVQ BP, R13 + + // (C,t[0]) := t[1] + m*q[1] + C + ADCXQ R14, R13 + MULXQ ·qElement+8(SB), AX, R14 + ADOXQ AX, R13 + + // (C,t[1]) := t[2] + m*q[2] + C + ADCXQ CX, R14 + MULXQ ·qElement+16(SB), AX, CX + ADOXQ AX, R14 + + // (C,t[2]) := t[3] + m*q[3] + C + ADCXQ BX, CX + MULXQ ·qElement+24(SB), AX, BX + ADOXQ AX, CX + MOVQ $0, AX + ADCXQ AX, BX + ADOXQ AX, BX + XORQ DX, DX + + // m := t[0]*q'[0] mod W + MOVQ $const_qInvNeg, DX + IMULQ R13, DX + XORQ AX, AX + + // C,_ := t[0] + m*q[0] + MULXQ ·qElement+0(SB), AX, BP + ADCXQ R13, AX + MOVQ BP, R13 + + // (C,t[0]) := t[1] + m*q[1] + C + ADCXQ R14, R13 + MULXQ ·qElement+8(SB), AX, R14 + ADOXQ AX, R13 + + // (C,t[1]) := t[2] + m*q[2] + C + ADCXQ CX, R14 + MULXQ ·qElement+16(SB), AX, CX + ADOXQ AX, R14 + + // (C,t[2]) := t[3] + m*q[3] + C + ADCXQ BX, CX + MULXQ ·qElement+24(SB), AX, BX + ADOXQ AX, CX + MOVQ $0, AX + ADCXQ AX, BX + ADOXQ AX, BX + XORQ DX, DX + + // m := t[0]*q'[0] mod W + MOVQ $const_qInvNeg, DX + IMULQ R13, DX + XORQ AX, AX + + // C,_ := t[0] + m*q[0] + MULXQ ·qElement+0(SB), AX, BP + ADCXQ R13, AX + MOVQ BP, R13 + + // (C,t[0]) := t[1] + m*q[1] + C + ADCXQ R14, R13 + MULXQ ·qElement+8(SB), AX, R14 + ADOXQ AX, R13 + + // (C,t[1]) := t[2] + m*q[2] + C + ADCXQ CX, R14 + MULXQ ·qElement+16(SB), AX, CX + ADOXQ AX, R14 + + // (C,t[2]) := t[3] + m*q[3] + C + ADCXQ BX, CX + MULXQ ·qElement+24(SB), AX, BX + ADOXQ AX, CX + MOVQ $0, AX + ADCXQ AX, BX + ADOXQ AX, BX + XORQ DX, DX + + // m := t[0]*q'[0] mod W + MOVQ $const_qInvNeg, DX + IMULQ R13, DX + XORQ AX, AX + + // C,_ := t[0] + m*q[0] + MULXQ ·qElement+0(SB), AX, BP + ADCXQ R13, AX + MOVQ BP, R13 + + // (C,t[0]) := t[1] + m*q[1] + C + ADCXQ R14, R13 + MULXQ ·qElement+8(SB), AX, R14 + ADOXQ AX, R13 + + // (C,t[1]) := t[2] + m*q[2] + C + ADCXQ CX, R14 + MULXQ ·qElement+16(SB), AX, CX + ADOXQ AX, R14 + + // (C,t[2]) := t[3] + m*q[3] + C + ADCXQ BX, CX + MULXQ ·qElement+24(SB), AX, BX + ADOXQ AX, CX + MOVQ $0, AX + ADCXQ AX, BX + ADOXQ AX, BX + + // reduce element(R13,R14,CX,BX) using temp registers (SI,DI,R8,R9) + REDUCE(R13,R14,CX,BX,SI,DI,R8,R9,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB)) + + MOVQ res+0(FP), AX + MOVQ R13, 0(AX) + MOVQ R14, 8(AX) + MOVQ CX, 16(AX) + MOVQ BX, 24(AX) + RET + +noAdx_2: + MOVQ res+0(FP), AX + MOVQ AX, (SP) + CALL ·_fromMontGeneric(SB) + RET + +// Vector operations are partially derived from Dag Arne Osvik's work in github.com/a16z/vectorized-fields + +// addVec(res, a, b *Element, n uint64) res[0...n] = a[0...n] + b[0...n] +TEXT ·addVec(SB), NOSPLIT, $0-32 + MOVQ res+0(FP), CX + MOVQ a+8(FP), AX + MOVQ b+16(FP), DX + MOVQ n+24(FP), BX + +loop_3: + TESTQ BX, BX + JEQ done_4 // n == 0, we are done + + // a[0] -> SI + // a[1] -> DI + // a[2] -> R8 + // a[3] -> R9 + MOVQ 0(AX), SI + MOVQ 8(AX), DI + MOVQ 16(AX), R8 + MOVQ 24(AX), R9 + ADDQ 0(DX), SI + ADCQ 8(DX), DI + ADCQ 16(DX), R8 + ADCQ 24(DX), R9 + PREFETCHT0 2048(AX) + PREFETCHT0 2048(DX) + + // reduce element(SI,DI,R8,R9) using temp registers (R10,R11,R12,R13) + REDUCE(SI,DI,R8,R9,R10,R11,R12,R13,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB)) + + MOVQ SI, 0(CX) + MOVQ DI, 8(CX) + MOVQ R8, 16(CX) + MOVQ R9, 24(CX) + + // increment pointers to visit next element + ADDQ $32, AX + ADDQ $32, DX + ADDQ $32, CX + DECQ BX // decrement n + JMP loop_3 + +done_4: + RET + +// subVec(res, a, b *Element, n uint64) res[0...n] = a[0...n] - b[0...n] +TEXT ·subVec(SB), NOSPLIT, $0-32 + MOVQ res+0(FP), CX + MOVQ a+8(FP), AX + MOVQ b+16(FP), DX + MOVQ n+24(FP), BX + XORQ SI, SI + +loop_5: + TESTQ BX, BX + JEQ done_6 // n == 0, we are done + + // a[0] -> DI + // a[1] -> R8 + // a[2] -> R9 + // a[3] -> R10 + MOVQ 0(AX), DI + MOVQ 8(AX), R8 + MOVQ 16(AX), R9 + MOVQ 24(AX), R10 + SUBQ 0(DX), DI + SBBQ 8(DX), R8 + SBBQ 16(DX), R9 + SBBQ 24(DX), R10 + PREFETCHT0 2048(AX) + PREFETCHT0 2048(DX) + + // reduce (a-b) mod q + // q[0] -> R11 + // q[1] -> R12 + // q[2] -> R13 + // q[3] -> R14 + MOVQ $const_q0, R11 + MOVQ $const_q1, R12 + MOVQ $const_q2, R13 + MOVQ $const_q3, R14 + CMOVQCC SI, R11 + CMOVQCC SI, R12 + CMOVQCC SI, R13 + CMOVQCC SI, R14 + + // add registers (q or 0) to a, and set to result + ADDQ R11, DI + ADCQ R12, R8 + ADCQ R13, R9 + ADCQ R14, R10 + MOVQ DI, 0(CX) + MOVQ R8, 8(CX) + MOVQ R9, 16(CX) + MOVQ R10, 24(CX) + + // increment pointers to visit next element + ADDQ $32, AX + ADDQ $32, DX + ADDQ $32, CX + DECQ BX // decrement n + JMP loop_5 + +done_6: + RET + +// sumVec(res, a *Element, n uint64) res = sum(a[0...n]) +TEXT ·sumVec(SB), $8-24 + + // Derived from https://github.com/a16z/vectorized-fields + // The idea is to use Z registers to accumulate the sum of elements, 8 by 8 + // first, we handle the case where n % 8 != 0 + // then, we loop over the elements 8 by 8 and accumulate the sum in the Z registers + // finally, we reduce the sum and store it in res + // + // when we move an element of a into a Z register, we use VPMOVZXDQ + // let's note w0...w3 the 4 64bits words of ai: w0 = ai[0], w1 = ai[1], w2 = ai[2], w3 = ai[3] + // VPMOVZXDQ(ai, Z0) will result in + // Z0= [hi(w3), lo(w3), hi(w2), lo(w2), hi(w1), lo(w1), hi(w0), lo(w0)] + // with hi(wi) the high 32 bits of wi and lo(wi) the low 32 bits of wi + // we can safely add 2^32+1 times Z registers constructed this way without overflow + // since each of this lo/hi bits are moved into a "64bits" slot + // N = 2^64-1 / 2^32-1 = 2^32+1 + // + // we then propagate the carry using ADOXQ and ADCXQ + // r0 = w0l + lo(woh) + // r1 = carry + hi(woh) + w1l + lo(w1h) + // r2 = carry + hi(w1h) + w2l + lo(w2h) + // r3 = carry + hi(w2h) + w3l + lo(w3h) + // r4 = carry + hi(w3h) + // we then reduce the sum using a single-word Barrett reduction + // we pick mu = 2^288 / q; which correspond to 4.5 words max. + // meaning we must guarantee that r4 fits in 32bits. + // To do so, we reduce N to 2^32-1 (since r4 receives 2 carries max) + + MOVQ a+8(FP), R13 + MOVQ n+16(FP), R14 + + // initialize accumulators Z0, Z1, Z2, Z3, Z4, Z5, Z6, Z7 + VXORPS Z0, Z0, Z0 + VMOVDQA64 Z0, Z1 + VMOVDQA64 Z0, Z2 + VMOVDQA64 Z0, Z3 + VMOVDQA64 Z0, Z4 + VMOVDQA64 Z0, Z5 + VMOVDQA64 Z0, Z6 + VMOVDQA64 Z0, Z7 + + // n % 8 -> CX + // n / 8 -> R14 + MOVQ R14, CX + ANDQ $7, CX + SHRQ $3, R14 + +loop_single_9: + TESTQ CX, CX + JEQ loop8by8_7 // n % 8 == 0, we are going to loop over 8 by 8 + VPMOVZXDQ 0(R13), Z8 + VPADDQ Z8, Z0, Z0 + ADDQ $32, R13 + DECQ CX // decrement nMod8 + JMP loop_single_9 + +loop8by8_7: + TESTQ R14, R14 + JEQ accumulate_10 // n == 0, we are going to accumulate + VPMOVZXDQ 0*32(R13), Z8 + VPMOVZXDQ 1*32(R13), Z9 + VPMOVZXDQ 2*32(R13), Z10 + VPMOVZXDQ 3*32(R13), Z11 + VPMOVZXDQ 4*32(R13), Z12 + VPMOVZXDQ 5*32(R13), Z13 + VPMOVZXDQ 6*32(R13), Z14 + VPMOVZXDQ 7*32(R13), Z15 + PREFETCHT0 4096(R13) + VPADDQ Z8, Z0, Z0 + VPADDQ Z9, Z1, Z1 + VPADDQ Z10, Z2, Z2 + VPADDQ Z11, Z3, Z3 + VPADDQ Z12, Z4, Z4 + VPADDQ Z13, Z5, Z5 + VPADDQ Z14, Z6, Z6 + VPADDQ Z15, Z7, Z7 + + // increment pointers to visit next 8 elements + ADDQ $256, R13 + DECQ R14 // decrement n + JMP loop8by8_7 + +accumulate_10: + // accumulate the 8 Z registers into Z0 + VPADDQ Z7, Z6, Z6 + VPADDQ Z6, Z5, Z5 + VPADDQ Z5, Z4, Z4 + VPADDQ Z4, Z3, Z3 + VPADDQ Z3, Z2, Z2 + VPADDQ Z2, Z1, Z1 + VPADDQ Z1, Z0, Z0 + + // carry propagation + // lo(w0) -> BX + // hi(w0) -> SI + // lo(w1) -> DI + // hi(w1) -> R8 + // lo(w2) -> R9 + // hi(w2) -> R10 + // lo(w3) -> R11 + // hi(w3) -> R12 + VMOVQ X0, BX + VALIGNQ $1, Z0, Z0, Z0 + VMOVQ X0, SI + VALIGNQ $1, Z0, Z0, Z0 + VMOVQ X0, DI + VALIGNQ $1, Z0, Z0, Z0 + VMOVQ X0, R8 + VALIGNQ $1, Z0, Z0, Z0 + VMOVQ X0, R9 + VALIGNQ $1, Z0, Z0, Z0 + VMOVQ X0, R10 + VALIGNQ $1, Z0, Z0, Z0 + VMOVQ X0, R11 + VALIGNQ $1, Z0, Z0, Z0 + VMOVQ X0, R12 + + // lo(hi(wo)) -> CX + // lo(hi(w1)) -> R14 + // lo(hi(w2)) -> R13 + // lo(hi(w3)) -> s0-8(SP) +#define SPLIT_LO_HI(in0, in1) \ + MOVQ in1, in0 \ + ANDQ $0xffffffff, in0 \ + SHLQ $32, in0 \ + SHRQ $32, in1 \ + + SPLIT_LO_HI(CX, SI) + SPLIT_LO_HI(R14, R8) + SPLIT_LO_HI(R13, R10) + SPLIT_LO_HI(s0-8(SP), R12) + + // r0 = w0l + lo(woh) + // r1 = carry + hi(woh) + w1l + lo(w1h) + // r2 = carry + hi(w1h) + w2l + lo(w2h) + // r3 = carry + hi(w2h) + w3l + lo(w3h) + // r4 = carry + hi(w3h) + + XORQ AX, AX // clear the flags + ADOXQ CX, BX + ADOXQ R14, DI + ADCXQ SI, DI + ADOXQ R13, R9 + ADCXQ R8, R9 + ADOXQ s0-8(SP), R11 + ADCXQ R10, R11 + ADOXQ AX, R12 + ADCXQ AX, R12 + + // r[0] -> BX + // r[1] -> DI + // r[2] -> R9 + // r[3] -> R11 + // r[4] -> R12 + // reduce using single-word Barrett + // see see Handbook of Applied Cryptography, Algorithm 14.42. + // mu=2^288 / q -> SI + MOVQ $const_mu, SI + MOVQ R11, AX + SHRQ $32, R12, AX + MULQ SI // high bits of res stored in DX + MULXQ ·qElement+0(SB), AX, SI + SUBQ AX, BX + SBBQ SI, DI + MULXQ ·qElement+16(SB), AX, SI + SBBQ AX, R9 + SBBQ SI, R11 + SBBQ $0, R12 + MULXQ ·qElement+8(SB), AX, SI + SUBQ AX, DI + SBBQ SI, R9 + MULXQ ·qElement+24(SB), AX, SI + SBBQ AX, R11 + SBBQ SI, R12 + MOVQ BX, R8 + MOVQ DI, R10 + MOVQ R9, CX + MOVQ R11, R14 + SUBQ ·qElement+0(SB), BX + SBBQ ·qElement+8(SB), DI + SBBQ ·qElement+16(SB), R9 + SBBQ ·qElement+24(SB), R11 + SBBQ $0, R12 + JCS modReduced_11 + MOVQ BX, R8 + MOVQ DI, R10 + MOVQ R9, CX + MOVQ R11, R14 + SUBQ ·qElement+0(SB), BX + SBBQ ·qElement+8(SB), DI + SBBQ ·qElement+16(SB), R9 + SBBQ ·qElement+24(SB), R11 + SBBQ $0, R12 + JCS modReduced_11 + MOVQ BX, R8 + MOVQ DI, R10 + MOVQ R9, CX + MOVQ R11, R14 + +modReduced_11: + MOVQ res+0(FP), SI + MOVQ R8, 0(SI) + MOVQ R10, 8(SI) + MOVQ CX, 16(SI) + MOVQ R14, 24(SI) + +done_8: + RET + +// innerProdVec(res, a,b *Element, n uint64) res = sum(a[0...n] * b[0...n]) +TEXT ·innerProdVec(SB), NOSPLIT, $0-32 + MOVQ a+8(FP), R13 + MOVQ b+16(FP), R14 + MOVQ n+24(FP), CX + + // Create mask for low dword in each qword + VPCMPEQB Y0, Y0, Y0 + VPMOVZXDQ Y0, Z5 + VPXORQ Z16, Z16, Z16 + VMOVDQA64 Z16, Z17 + VMOVDQA64 Z16, Z18 + VMOVDQA64 Z16, Z19 + VMOVDQA64 Z16, Z20 + VMOVDQA64 Z16, Z21 + VMOVDQA64 Z16, Z22 + VMOVDQA64 Z16, Z23 + VMOVDQA64 Z16, Z24 + VMOVDQA64 Z16, Z25 + VMOVDQA64 Z16, Z26 + VMOVDQA64 Z16, Z27 + VMOVDQA64 Z16, Z28 + VMOVDQA64 Z16, Z29 + VMOVDQA64 Z16, Z30 + VMOVDQA64 Z16, Z31 + TESTQ CX, CX + JEQ done_13 // n == 0, we are done + +loop_12: + TESTQ CX, CX + JEQ accumulate_14 // n == 0 we can accumulate + VPMOVZXDQ (R14), Z4 + ADDQ $32, R14 + + // we multiply and accumulate partial products of 4 bytes * 32 bytes +#define MAC(in0, in1, in2) \ + VPMULUDQ.BCST in0, Z4, Z2 \ + VPSRLQ $32, Z2, Z3 \ + VPANDQ Z5, Z2, Z2 \ + VPADDQ Z2, in1, in1 \ + VPADDQ Z3, in2, in2 \ + + MAC(0*4(R13), Z16, Z24) + MAC(1*4(R13), Z17, Z25) + MAC(2*4(R13), Z18, Z26) + MAC(3*4(R13), Z19, Z27) + MAC(4*4(R13), Z20, Z28) + MAC(5*4(R13), Z21, Z29) + MAC(6*4(R13), Z22, Z30) + MAC(7*4(R13), Z23, Z31) + ADDQ $32, R13 + DECQ CX // decrement n + JMP loop_12 + +accumulate_14: + // we accumulate the partial products into 544bits in Z1:Z0 + MOVQ $0x0000000000001555, AX + KMOVD AX, K1 + MOVQ $1, AX + KMOVD AX, K2 + + // store the least significant 32 bits of ACC (starts with A0L) in Z0 + VALIGND.Z $16, Z16, Z16, K2, Z0 + KSHIFTLW $1, K2, K2 + VPSRLQ $32, Z16, Z2 + VALIGND.Z $2, Z16, Z16, K1, Z16 + VPADDQ Z2, Z16, Z16 + VPANDQ Z5, Z24, Z2 + VPADDQ Z2, Z16, Z16 + VPANDQ Z5, Z17, Z2 + VPADDQ Z2, Z16, Z16 + VALIGND $15, Z16, Z16, K2, Z0 + KSHIFTLW $1, K2, K2 + + // macro to add partial products and store the result in Z0 +#define ADDPP(in0, in1, in2, in3, in4) \ + VPSRLQ $32, Z16, Z2 \ + VALIGND.Z $2, Z16, Z16, K1, Z16 \ + VPADDQ Z2, Z16, Z16 \ + VPSRLQ $32, in0, in0 \ + VPADDQ in0, Z16, Z16 \ + VPSRLQ $32, in1, in1 \ + VPADDQ in1, Z16, Z16 \ + VPANDQ Z5, in2, Z2 \ + VPADDQ Z2, Z16, Z16 \ + VPANDQ Z5, in3, Z2 \ + VPADDQ Z2, Z16, Z16 \ + VALIGND $16-in4, Z16, Z16, K2, Z0 \ + KADDW K2, K2, K2 \ + + ADDPP(Z24, Z17, Z25, Z18, 2) + ADDPP(Z25, Z18, Z26, Z19, 3) + ADDPP(Z26, Z19, Z27, Z20, 4) + ADDPP(Z27, Z20, Z28, Z21, 5) + ADDPP(Z28, Z21, Z29, Z22, 6) + ADDPP(Z29, Z22, Z30, Z23, 7) + VPSRLQ $32, Z16, Z2 + VALIGND.Z $2, Z16, Z16, K1, Z16 + VPADDQ Z2, Z16, Z16 + VPSRLQ $32, Z30, Z30 + VPADDQ Z30, Z16, Z16 + VPSRLQ $32, Z23, Z23 + VPADDQ Z23, Z16, Z16 + VPANDQ Z5, Z31, Z2 + VPADDQ Z2, Z16, Z16 + VALIGND $16-8, Z16, Z16, K2, Z0 + KSHIFTLW $1, K2, K2 + VPSRLQ $32, Z16, Z2 + VALIGND.Z $2, Z16, Z16, K1, Z16 + VPADDQ Z2, Z16, Z16 + VPSRLQ $32, Z31, Z31 + VPADDQ Z31, Z16, Z16 + VALIGND $16-9, Z16, Z16, K2, Z0 + KSHIFTLW $1, K2, K2 + +#define ADDPP2(in0) \ + VPSRLQ $32, Z16, Z2 \ + VALIGND.Z $2, Z16, Z16, K1, Z16 \ + VPADDQ Z2, Z16, Z16 \ + VALIGND $16-in0, Z16, Z16, K2, Z0 \ + KSHIFTLW $1, K2, K2 \ + + ADDPP2(10) + ADDPP2(11) + ADDPP2(12) + ADDPP2(13) + ADDPP2(14) + ADDPP2(15) + VPSRLQ $32, Z16, Z2 + VALIGND.Z $2, Z16, Z16, K1, Z16 + VPADDQ Z2, Z16, Z16 + VMOVDQA64.Z Z16, K1, Z1 + + // Extract the 4 least significant qwords of Z0 + VMOVQ X0, SI + VALIGNQ $1, Z0, Z1, Z0 + VMOVQ X0, DI + VALIGNQ $1, Z0, Z0, Z0 + VMOVQ X0, R8 + VALIGNQ $1, Z0, Z0, Z0 + VMOVQ X0, R9 + VALIGNQ $1, Z0, Z0, Z0 + XORQ BX, BX + MOVQ $const_qInvNeg, DX + MULXQ SI, DX, R10 + MULXQ ·qElement+0(SB), AX, R10 + ADDQ AX, SI + ADCQ R10, DI + MULXQ ·qElement+16(SB), AX, R10 + ADCQ AX, R8 + ADCQ R10, R9 + ADCQ $0, BX + MULXQ ·qElement+8(SB), AX, R10 + ADDQ AX, DI + ADCQ R10, R8 + MULXQ ·qElement+24(SB), AX, R10 + ADCQ AX, R9 + ADCQ R10, BX + ADCQ $0, SI + MOVQ $const_qInvNeg, DX + MULXQ DI, DX, R10 + MULXQ ·qElement+0(SB), AX, R10 + ADDQ AX, DI + ADCQ R10, R8 + MULXQ ·qElement+16(SB), AX, R10 + ADCQ AX, R9 + ADCQ R10, BX + ADCQ $0, SI + MULXQ ·qElement+8(SB), AX, R10 + ADDQ AX, R8 + ADCQ R10, R9 + MULXQ ·qElement+24(SB), AX, R10 + ADCQ AX, BX + ADCQ R10, SI + ADCQ $0, DI + MOVQ $const_qInvNeg, DX + MULXQ R8, DX, R10 + MULXQ ·qElement+0(SB), AX, R10 + ADDQ AX, R8 + ADCQ R10, R9 + MULXQ ·qElement+16(SB), AX, R10 + ADCQ AX, BX + ADCQ R10, SI + ADCQ $0, DI + MULXQ ·qElement+8(SB), AX, R10 + ADDQ AX, R9 + ADCQ R10, BX + MULXQ ·qElement+24(SB), AX, R10 + ADCQ AX, SI + ADCQ R10, DI + ADCQ $0, R8 + MOVQ $const_qInvNeg, DX + MULXQ R9, DX, R10 + MULXQ ·qElement+0(SB), AX, R10 + ADDQ AX, R9 + ADCQ R10, BX + MULXQ ·qElement+16(SB), AX, R10 + ADCQ AX, SI + ADCQ R10, DI + ADCQ $0, R8 + MULXQ ·qElement+8(SB), AX, R10 + ADDQ AX, BX + ADCQ R10, SI + MULXQ ·qElement+24(SB), AX, R10 + ADCQ AX, DI + ADCQ R10, R8 + ADCQ $0, R9 + VMOVQ X0, AX + ADDQ AX, BX + VALIGNQ $1, Z0, Z0, Z0 + VMOVQ X0, AX + ADCQ AX, SI + VALIGNQ $1, Z0, Z0, Z0 + VMOVQ X0, AX + ADCQ AX, DI + VALIGNQ $1, Z0, Z0, Z0 + VMOVQ X0, AX + ADCQ AX, R8 + VALIGNQ $1, Z0, Z0, Z0 + VMOVQ X0, AX + ADCQ AX, R9 + + // Barrett reduction; see Handbook of Applied Cryptography, Algorithm 14.42. + MOVQ R8, AX + SHRQ $32, R9, AX + MOVQ $const_mu, DX + MULQ DX + MULXQ ·qElement+0(SB), AX, R10 + SUBQ AX, BX + SBBQ R10, SI + MULXQ ·qElement+16(SB), AX, R10 + SBBQ AX, DI + SBBQ R10, R8 + SBBQ $0, R9 + MULXQ ·qElement+8(SB), AX, R10 + SUBQ AX, SI + SBBQ R10, DI + MULXQ ·qElement+24(SB), AX, R10 + SBBQ AX, R8 + SBBQ R10, R9 + + // we need up to 2 conditional substractions to be < q + MOVQ res+0(FP), R11 + MOVQ BX, 0(R11) + MOVQ SI, 8(R11) + MOVQ DI, 16(R11) + MOVQ R8, 24(R11) + SUBQ ·qElement+0(SB), BX + SBBQ ·qElement+8(SB), SI + SBBQ ·qElement+16(SB), DI + SBBQ ·qElement+24(SB), R8 + SBBQ $0, R9 + JCS done_13 + MOVQ BX, 0(R11) + MOVQ SI, 8(R11) + MOVQ DI, 16(R11) + MOVQ R8, 24(R11) + SUBQ ·qElement+0(SB), BX + SBBQ ·qElement+8(SB), SI + SBBQ ·qElement+16(SB), DI + SBBQ ·qElement+24(SB), R8 + SBBQ $0, R9 + JCS done_13 + MOVQ BX, 0(R11) + MOVQ SI, 8(R11) + MOVQ DI, 16(R11) + MOVQ R8, 24(R11) + +done_13: + RET + +TEXT ·scalarMulVec(SB), $40-48 + MOVQ $const_q0, AX + MOVQ AX, s1-16(SP) + MOVQ $const_q1, AX + MOVQ AX, s2-24(SP) + MOVQ $const_q2, AX + MOVQ AX, s3-32(SP) + MOVQ $const_q3, AX + MOVQ AX, s4-40(SP) + +#define AVX_MUL_Q_LO() \ + VPMULUDQ.BCST s10-16(SP), Z9, Z10 \ + VPADDQ Z10, Z0, Z0 \ + VPMULUDQ.BCST s11-12(SP), Z9, Z11 \ + VPADDQ Z11, Z1, Z1 \ + VPMULUDQ.BCST s20-24(SP), Z9, Z12 \ + VPADDQ Z12, Z2, Z2 \ + VPMULUDQ.BCST s21-20(SP), Z9, Z13 \ + VPADDQ Z13, Z3, Z3 \ + +#define AVX_MUL_Q_HI() \ + VPMULUDQ.BCST s30-32(SP), Z9, Z14 \ + VPADDQ Z14, Z4, Z4 \ + VPMULUDQ.BCST s31-28(SP), Z9, Z15 \ + VPADDQ Z15, Z5, Z5 \ + VPMULUDQ.BCST s40-40(SP), Z9, Z16 \ + VPADDQ Z16, Z6, Z6 \ + VPMULUDQ.BCST s41-36(SP), Z9, Z17 \ + VPADDQ Z17, Z7, Z7 \ + +#define SHIFT_ADD_AND(in0, in1, in2, in3) \ + VPSRLQ $32, in0, in1 \ + VPADDQ in1, in2, in2 \ + VPANDQ in3, in2, in0 \ + +#define CARRY1() \ + SHIFT_ADD_AND(Z0, Z10, Z1, Z8) \ + SHIFT_ADD_AND(Z1, Z11, Z2, Z8) \ + SHIFT_ADD_AND(Z2, Z12, Z3, Z8) \ + SHIFT_ADD_AND(Z3, Z13, Z4, Z8) \ + +#define CARRY2() \ + SHIFT_ADD_AND(Z4, Z14, Z5, Z8) \ + SHIFT_ADD_AND(Z5, Z15, Z6, Z8) \ + SHIFT_ADD_AND(Z6, Z16, Z7, Z8) \ + VPSRLQ $32, Z7, Z7 \ + +#define CARRY3() \ + VPSRLQ $32, Z0, Z10 \ + VPANDQ Z8, Z0, Z0 \ + VPADDQ Z10, Z1, Z1 \ + VPSRLQ $32, Z1, Z11 \ + VPANDQ Z8, Z1, Z1 \ + VPADDQ Z11, Z2, Z2 \ + VPSRLQ $32, Z2, Z12 \ + VPANDQ Z8, Z2, Z2 \ + VPADDQ Z12, Z3, Z3 \ + VPSRLQ $32, Z3, Z13 \ + VPANDQ Z8, Z3, Z3 \ + VPADDQ Z13, Z4, Z4 \ + +#define CARRY4() \ + VPSRLQ $32, Z4, Z14 \ + VPANDQ Z8, Z4, Z4 \ + VPADDQ Z14, Z5, Z5 \ + VPSRLQ $32, Z5, Z15 \ + VPANDQ Z8, Z5, Z5 \ + VPADDQ Z15, Z6, Z6 \ + VPSRLQ $32, Z6, Z16 \ + VPANDQ Z8, Z6, Z6 \ + VPADDQ Z16, Z7, Z7 \ + +#define DIV_SHIFT_VEC() \ + MOVQ $const_qInvNeg, DX \ + IMULQ BX, DX \ + XORQ AX, AX \ + MULXQ s1-16(SP), AX, R15 \ + ADCXQ BX, AX \ + MOVQ R15, BX \ + MACC(SI, BX, s2-24(SP)) \ + MACC(DI, SI, s3-32(SP)) \ + MACC(R8, DI, s4-40(SP)) \ + MOVQ $0, AX \ + ADCXQ AX, R8 \ + ADOXQ BP, R8 \ + +#define MUL_WORD_0_VEC() \ + XORQ AX, AX \ + MULXQ R9, BX, SI \ + MULXQ R10, AX, DI \ + ADOXQ AX, SI \ + MULXQ R11, AX, R8 \ + ADOXQ AX, DI \ + MULXQ R12, AX, BP \ + ADOXQ AX, R8 \ + MOVQ $0, AX \ + ADOXQ AX, BP \ + DIV_SHIFT_VEC() \ + +#define MUL_WORD_N_VEC() \ + XORQ AX, AX \ + MULXQ R9, AX, BP \ + ADOXQ AX, BX \ + MACC(BP, SI, R10) \ + MACC(BP, DI, R11) \ + MACC(BP, R8, R12) \ + MOVQ $0, AX \ + ADCXQ AX, BP \ + ADOXQ AX, BP \ + DIV_SHIFT_VEC() \ + + MOVQ res+0(FP), R14 + MOVQ a+8(FP), R13 + MOVQ b+16(FP), CX + MOVQ n+24(FP), R15 + MOVQ 0(CX), R9 + MOVQ 8(CX), R10 + MOVQ 16(CX), R11 + MOVQ 24(CX), R12 + MOVQ R15, s0-8(SP) + + // Create mask for low dword in each qword + VPCMPEQB Y8, Y8, Y8 + VPMOVZXDQ Y8, Z8 + MOVQ $0x5555, DX + KMOVD DX, K1 + +loop_16: + TESTQ R15, R15 + JEQ done_15 // n == 0, we are done + MOVQ 0(R13), DX + VMOVDQU64 256+0*64(R13), Z16 + VMOVDQU64 256+1*64(R13), Z17 + VMOVDQU64 256+2*64(R13), Z18 + VMOVDQU64 256+3*64(R13), Z19 + VMOVDQU64 0(CX), Z24 + VMOVDQU64 0(CX), Z25 + VMOVDQU64 0(CX), Z26 + VMOVDQU64 0(CX), Z27 + + // Transpose and expand x and y + VSHUFI64X2 $0x88, Z17, Z16, Z20 + VSHUFI64X2 $0xdd, Z17, Z16, Z22 + VSHUFI64X2 $0x88, Z19, Z18, Z21 + VSHUFI64X2 $0xdd, Z19, Z18, Z23 + VSHUFI64X2 $0x88, Z25, Z24, Z28 + VSHUFI64X2 $0xdd, Z25, Z24, Z30 + VSHUFI64X2 $0x88, Z27, Z26, Z29 + VSHUFI64X2 $0xdd, Z27, Z26, Z31 + VPERMQ $0xd8, Z20, Z20 + VPERMQ $0xd8, Z21, Z21 + VPERMQ $0xd8, Z22, Z22 + VPERMQ $0xd8, Z23, Z23 + + // z[0] -> y * x[0] + MUL_WORD_0_VEC() + VPERMQ $0xd8, Z28, Z28 + VPERMQ $0xd8, Z29, Z29 + VPERMQ $0xd8, Z30, Z30 + VPERMQ $0xd8, Z31, Z31 + VSHUFI64X2 $0xd8, Z20, Z20, Z20 + VSHUFI64X2 $0xd8, Z21, Z21, Z21 + VSHUFI64X2 $0xd8, Z22, Z22, Z22 + VSHUFI64X2 $0xd8, Z23, Z23, Z23 + + // z[0] -> y * x[1] + MOVQ 8(R13), DX + MUL_WORD_N_VEC() + VSHUFI64X2 $0xd8, Z28, Z28, Z28 + VSHUFI64X2 $0xd8, Z29, Z29, Z29 + VSHUFI64X2 $0xd8, Z30, Z30, Z30 + VSHUFI64X2 $0xd8, Z31, Z31, Z31 + VSHUFI64X2 $0x44, Z21, Z20, Z16 + VSHUFI64X2 $0xee, Z21, Z20, Z18 + VSHUFI64X2 $0x44, Z23, Z22, Z20 + VSHUFI64X2 $0xee, Z23, Z22, Z22 + + // z[0] -> y * x[2] + MOVQ 16(R13), DX + MUL_WORD_N_VEC() + VSHUFI64X2 $0x44, Z29, Z28, Z24 + VSHUFI64X2 $0xee, Z29, Z28, Z26 + VSHUFI64X2 $0x44, Z31, Z30, Z28 + VSHUFI64X2 $0xee, Z31, Z30, Z30 + PREFETCHT0 1024(R13) + VPSRLQ $32, Z16, Z17 + VPSRLQ $32, Z18, Z19 + VPSRLQ $32, Z20, Z21 + VPSRLQ $32, Z22, Z23 + VPSRLQ $32, Z24, Z25 + VPSRLQ $32, Z26, Z27 + VPSRLQ $32, Z28, Z29 + VPSRLQ $32, Z30, Z31 + + // z[0] -> y * x[3] + MOVQ 24(R13), DX + MUL_WORD_N_VEC() + VPANDQ Z8, Z16, Z16 + VPANDQ Z8, Z18, Z18 + VPANDQ Z8, Z20, Z20 + VPANDQ Z8, Z22, Z22 + VPANDQ Z8, Z24, Z24 + VPANDQ Z8, Z26, Z26 + VPANDQ Z8, Z28, Z28 + VPANDQ Z8, Z30, Z30 + + // reduce element(BX,SI,DI,R8) using temp registers (BP,R15,AX,DX) + REDUCE(BX,SI,DI,R8,BP,R15,AX,DX,s1-16(SP),s2-24(SP),s3-32(SP),s4-40(SP)) + + // store output z[0] + MOVQ BX, 0(R14) + MOVQ SI, 8(R14) + MOVQ DI, 16(R14) + MOVQ R8, 24(R14) + ADDQ $32, R13 + MOVQ 0(R13), DX + + // For each 256-bit input value, each zmm register now represents a 32-bit input word zero-extended to 64 bits. + // Multiply y by doubleword 0 of x + VPMULUDQ Z16, Z24, Z0 + VPMULUDQ Z16, Z25, Z1 + VPMULUDQ Z16, Z26, Z2 + VPMULUDQ Z16, Z27, Z3 + VPMULUDQ Z16, Z28, Z4 + VPMULUDQ Z16, Z29, Z5 + VPMULUDQ Z16, Z30, Z6 + VPMULUDQ Z16, Z31, Z7 + VPMULUDQ.BCST qInvNeg+32(FP), Z0, Z9 + VPSRLQ $32, Z0, Z10 + VPANDQ Z8, Z0, Z0 + VPADDQ Z10, Z1, Z1 + VPSRLQ $32, Z1, Z11 + VPANDQ Z8, Z1, Z1 + VPADDQ Z11, Z2, Z2 + VPSRLQ $32, Z2, Z12 + VPANDQ Z8, Z2, Z2 + VPADDQ Z12, Z3, Z3 + VPSRLQ $32, Z3, Z13 + VPANDQ Z8, Z3, Z3 + VPADDQ Z13, Z4, Z4 + + // z[1] -> y * x[0] + MUL_WORD_0_VEC() + VPSRLQ $32, Z4, Z14 + VPANDQ Z8, Z4, Z4 + VPADDQ Z14, Z5, Z5 + VPSRLQ $32, Z5, Z15 + VPANDQ Z8, Z5, Z5 + VPADDQ Z15, Z6, Z6 + VPSRLQ $32, Z6, Z16 + VPANDQ Z8, Z6, Z6 + VPADDQ Z16, Z7, Z7 + VPMULUDQ.BCST s10-16(SP), Z9, Z10 + VPADDQ Z10, Z0, Z0 + VPMULUDQ.BCST s11-12(SP), Z9, Z11 + VPADDQ Z11, Z1, Z1 + VPMULUDQ.BCST s20-24(SP), Z9, Z12 + VPADDQ Z12, Z2, Z2 + VPMULUDQ.BCST s21-20(SP), Z9, Z13 + VPADDQ Z13, Z3, Z3 + + // z[1] -> y * x[1] + MOVQ 8(R13), DX + MUL_WORD_N_VEC() + VPMULUDQ.BCST s30-32(SP), Z9, Z14 + VPADDQ Z14, Z4, Z4 + VPMULUDQ.BCST s31-28(SP), Z9, Z15 + VPADDQ Z15, Z5, Z5 + VPMULUDQ.BCST s40-40(SP), Z9, Z16 + VPADDQ Z16, Z6, Z6 + VPMULUDQ.BCST s41-36(SP), Z9, Z10 + VPADDQ Z10, Z7, Z7 + CARRY1() + + // z[1] -> y * x[2] + MOVQ 16(R13), DX + MUL_WORD_N_VEC() + SHIFT_ADD_AND(Z4, Z14, Z5, Z8) + SHIFT_ADD_AND(Z5, Z15, Z6, Z8) + SHIFT_ADD_AND(Z6, Z16, Z7, Z8) + VPSRLQ $32, Z7, Z7 + + // Process doubleword 1 of x + VPMULUDQ Z17, Z24, Z10 + VPADDQ Z10, Z0, Z0 + VPMULUDQ Z17, Z25, Z11 + VPADDQ Z11, Z1, Z1 + VPMULUDQ Z17, Z26, Z12 + VPADDQ Z12, Z2, Z2 + VPMULUDQ Z17, Z27, Z13 + VPADDQ Z13, Z3, Z3 + + // z[1] -> y * x[3] + MOVQ 24(R13), DX + MUL_WORD_N_VEC() + VPMULUDQ Z17, Z28, Z14 + VPADDQ Z14, Z4, Z4 + VPMULUDQ Z17, Z29, Z15 + VPADDQ Z15, Z5, Z5 + VPMULUDQ Z17, Z30, Z16 + VPADDQ Z16, Z6, Z6 + VPMULUDQ Z17, Z31, Z17 + VPADDQ Z17, Z7, Z7 + VPMULUDQ.BCST qInvNeg+32(FP), Z0, Z9 + + // reduce element(BX,SI,DI,R8) using temp registers (BP,R15,AX,DX) + REDUCE(BX,SI,DI,R8,BP,R15,AX,DX,s1-16(SP),s2-24(SP),s3-32(SP),s4-40(SP)) + + // store output z[1] + MOVQ BX, 32(R14) + MOVQ SI, 40(R14) + MOVQ DI, 48(R14) + MOVQ R8, 56(R14) + ADDQ $32, R13 + MOVQ 0(R13), DX + + // Move high dwords to zmm10-16, add each to the corresponding low dword (propagate 32-bit carries) + VPSRLQ $32, Z0, Z10 + VPANDQ Z8, Z0, Z0 + VPADDQ Z10, Z1, Z1 + VPSRLQ $32, Z1, Z11 + VPANDQ Z8, Z1, Z1 + VPADDQ Z11, Z2, Z2 + VPSRLQ $32, Z2, Z12 + VPANDQ Z8, Z2, Z2 + VPADDQ Z12, Z3, Z3 + VPSRLQ $32, Z3, Z13 + VPANDQ Z8, Z3, Z3 + VPADDQ Z13, Z4, Z4 + CARRY4() + + // z[2] -> y * x[0] + MUL_WORD_0_VEC() + AVX_MUL_Q_LO() + AVX_MUL_Q_HI() + + // z[2] -> y * x[1] + MOVQ 8(R13), DX + MUL_WORD_N_VEC() + CARRY1() + CARRY2() + + // z[2] -> y * x[2] + MOVQ 16(R13), DX + MUL_WORD_N_VEC() + + // Process doubleword 2 of x + VPMULUDQ Z18, Z24, Z10 + VPADDQ Z10, Z0, Z0 + VPMULUDQ Z18, Z25, Z11 + VPADDQ Z11, Z1, Z1 + VPMULUDQ Z18, Z26, Z12 + VPADDQ Z12, Z2, Z2 + VPMULUDQ Z18, Z27, Z13 + VPADDQ Z13, Z3, Z3 + VPMULUDQ Z18, Z28, Z14 + VPADDQ Z14, Z4, Z4 + VPMULUDQ Z18, Z29, Z15 + VPADDQ Z15, Z5, Z5 + VPMULUDQ Z18, Z30, Z16 + VPADDQ Z16, Z6, Z6 + VPMULUDQ Z18, Z31, Z17 + VPADDQ Z17, Z7, Z7 + VPMULUDQ.BCST qInvNeg+32(FP), Z0, Z9 + + // z[2] -> y * x[3] + MOVQ 24(R13), DX + MUL_WORD_N_VEC() + + // Move high dwords to zmm10-16, add each to the corresponding low dword (propagate 32-bit carries) + CARRY3() + + // reduce element(BX,SI,DI,R8) using temp registers (BP,R15,AX,DX) + REDUCE(BX,SI,DI,R8,BP,R15,AX,DX,s1-16(SP),s2-24(SP),s3-32(SP),s4-40(SP)) + + // store output z[2] + MOVQ BX, 64(R14) + MOVQ SI, 72(R14) + MOVQ DI, 80(R14) + MOVQ R8, 88(R14) + ADDQ $32, R13 + MOVQ 0(R13), DX + CARRY4() + AVX_MUL_Q_LO() + + // z[3] -> y * x[0] + MUL_WORD_0_VEC() + AVX_MUL_Q_HI() + CARRY1() + CARRY2() + + // Process doubleword 3 of x + VPMULUDQ Z19, Z24, Z10 + VPADDQ Z10, Z0, Z0 + VPMULUDQ Z19, Z25, Z11 + VPADDQ Z11, Z1, Z1 + VPMULUDQ Z19, Z26, Z12 + VPADDQ Z12, Z2, Z2 + VPMULUDQ Z19, Z27, Z13 + VPADDQ Z13, Z3, Z3 + + // z[3] -> y * x[1] + MOVQ 8(R13), DX + MUL_WORD_N_VEC() + VPMULUDQ Z19, Z28, Z14 + VPADDQ Z14, Z4, Z4 + VPMULUDQ Z19, Z29, Z15 + VPADDQ Z15, Z5, Z5 + VPMULUDQ Z19, Z30, Z16 + VPADDQ Z16, Z6, Z6 + VPMULUDQ Z19, Z31, Z17 + VPADDQ Z17, Z7, Z7 + + // z[3] -> y * x[2] + MOVQ 16(R13), DX + MUL_WORD_N_VEC() + VPMULUDQ.BCST qInvNeg+32(FP), Z0, Z9 + CARRY3() + CARRY4() + + // z[3] -> y * x[3] + MOVQ 24(R13), DX + MUL_WORD_N_VEC() + AVX_MUL_Q_LO() + AVX_MUL_Q_HI() + + // reduce element(BX,SI,DI,R8) using temp registers (BP,R15,AX,DX) + REDUCE(BX,SI,DI,R8,BP,R15,AX,DX,s1-16(SP),s2-24(SP),s3-32(SP),s4-40(SP)) + + // store output z[3] + MOVQ BX, 96(R14) + MOVQ SI, 104(R14) + MOVQ DI, 112(R14) + MOVQ R8, 120(R14) + ADDQ $32, R13 + MOVQ 0(R13), DX + + // Propagate carries and shift down by one dword + CARRY1() + CARRY2() + + // Process doubleword 4 of x + VPMULUDQ Z20, Z24, Z10 + VPADDQ Z10, Z0, Z0 + VPMULUDQ Z20, Z25, Z11 + VPADDQ Z11, Z1, Z1 + VPMULUDQ Z20, Z26, Z12 + VPADDQ Z12, Z2, Z2 + VPMULUDQ Z20, Z27, Z13 + VPADDQ Z13, Z3, Z3 + + // z[4] -> y * x[0] + MUL_WORD_0_VEC() + VPMULUDQ Z20, Z28, Z14 + VPADDQ Z14, Z4, Z4 + VPMULUDQ Z20, Z29, Z15 + VPADDQ Z15, Z5, Z5 + VPMULUDQ Z20, Z30, Z16 + VPADDQ Z16, Z6, Z6 + VPMULUDQ Z20, Z31, Z17 + VPADDQ Z17, Z7, Z7 + VPMULUDQ.BCST qInvNeg+32(FP), Z0, Z9 + + // z[4] -> y * x[1] + MOVQ 8(R13), DX + MUL_WORD_N_VEC() + + // Move high dwords to zmm10-16, add each to the corresponding low dword (propagate 32-bit carries) + CARRY3() + CARRY4() + + // z[4] -> y * x[2] + MOVQ 16(R13), DX + MUL_WORD_N_VEC() + + // zmm7 keeps all 64 bits + AVX_MUL_Q_LO() + AVX_MUL_Q_HI() + + // z[4] -> y * x[3] + MOVQ 24(R13), DX + MUL_WORD_N_VEC() + + // Propagate carries and shift down by one dword + CARRY1() + CARRY2() + + // reduce element(BX,SI,DI,R8) using temp registers (BP,R15,AX,DX) + REDUCE(BX,SI,DI,R8,BP,R15,AX,DX,s1-16(SP),s2-24(SP),s3-32(SP),s4-40(SP)) + + // store output z[4] + MOVQ BX, 128(R14) + MOVQ SI, 136(R14) + MOVQ DI, 144(R14) + MOVQ R8, 152(R14) + ADDQ $32, R13 + MOVQ 0(R13), DX + + // Process doubleword 5 of x + VPMULUDQ Z21, Z24, Z10 + VPADDQ Z10, Z0, Z0 + VPMULUDQ Z21, Z25, Z11 + VPADDQ Z11, Z1, Z1 + VPMULUDQ Z21, Z26, Z12 + VPADDQ Z12, Z2, Z2 + VPMULUDQ Z21, Z27, Z13 + VPADDQ Z13, Z3, Z3 + VPMULUDQ Z21, Z28, Z14 + VPADDQ Z14, Z4, Z4 + VPMULUDQ Z21, Z29, Z15 + VPADDQ Z15, Z5, Z5 + VPMULUDQ Z21, Z30, Z16 + VPADDQ Z16, Z6, Z6 + VPMULUDQ Z21, Z31, Z17 + VPADDQ Z17, Z7, Z7 + + // z[5] -> y * x[0] + MUL_WORD_0_VEC() + VPMULUDQ.BCST qInvNeg+32(FP), Z0, Z9 + + // Move high dwords to zmm10-16, add each to the corresponding low dword (propagate 32-bit carries) + CARRY3() + CARRY4() + + // z[5] -> y * x[1] + MOVQ 8(R13), DX + MUL_WORD_N_VEC() + AVX_MUL_Q_LO() + AVX_MUL_Q_HI() + + // z[5] -> y * x[2] + MOVQ 16(R13), DX + MUL_WORD_N_VEC() + CARRY1() + CARRY2() + + // z[5] -> y * x[3] + MOVQ 24(R13), DX + MUL_WORD_N_VEC() + + // Process doubleword 6 of x + VPMULUDQ Z22, Z24, Z10 + VPADDQ Z10, Z0, Z0 + VPMULUDQ Z22, Z25, Z11 + VPADDQ Z11, Z1, Z1 + VPMULUDQ Z22, Z26, Z12 + VPADDQ Z12, Z2, Z2 + VPMULUDQ Z22, Z27, Z13 + VPADDQ Z13, Z3, Z3 + VPMULUDQ Z22, Z28, Z14 + VPADDQ Z14, Z4, Z4 + VPMULUDQ Z22, Z29, Z15 + VPADDQ Z15, Z5, Z5 + VPMULUDQ Z22, Z30, Z16 + VPADDQ Z16, Z6, Z6 + VPMULUDQ Z22, Z31, Z17 + VPADDQ Z17, Z7, Z7 + VPMULUDQ.BCST qInvNeg+32(FP), Z0, Z9 + + // reduce element(BX,SI,DI,R8) using temp registers (BP,R15,AX,DX) + REDUCE(BX,SI,DI,R8,BP,R15,AX,DX,s1-16(SP),s2-24(SP),s3-32(SP),s4-40(SP)) + + // store output z[5] + MOVQ BX, 160(R14) + MOVQ SI, 168(R14) + MOVQ DI, 176(R14) + MOVQ R8, 184(R14) + ADDQ $32, R13 + MOVQ 0(R13), DX + + // Move high dwords to zmm10-16, add each to the corresponding low dword (propagate 32-bit carries) + CARRY3() + CARRY4() + + // z[6] -> y * x[0] + MUL_WORD_0_VEC() + AVX_MUL_Q_LO() + AVX_MUL_Q_HI() + + // z[6] -> y * x[1] + MOVQ 8(R13), DX + MUL_WORD_N_VEC() + CARRY1() + CARRY2() + + // z[6] -> y * x[2] + MOVQ 16(R13), DX + MUL_WORD_N_VEC() + + // Process doubleword 7 of x + VPMULUDQ Z23, Z24, Z10 + VPADDQ Z10, Z0, Z0 + VPMULUDQ Z23, Z25, Z11 + VPADDQ Z11, Z1, Z1 + VPMULUDQ Z23, Z26, Z12 + VPADDQ Z12, Z2, Z2 + VPMULUDQ Z23, Z27, Z13 + VPADDQ Z13, Z3, Z3 + VPMULUDQ Z23, Z28, Z14 + VPADDQ Z14, Z4, Z4 + VPMULUDQ Z23, Z29, Z15 + VPADDQ Z15, Z5, Z5 + VPMULUDQ Z23, Z30, Z16 + VPADDQ Z16, Z6, Z6 + VPMULUDQ Z23, Z31, Z17 + VPADDQ Z17, Z7, Z7 + VPMULUDQ.BCST qInvNeg+32(FP), Z0, Z9 + + // z[6] -> y * x[3] + MOVQ 24(R13), DX + MUL_WORD_N_VEC() + CARRY3() + + // reduce element(BX,SI,DI,R8) using temp registers (BP,R15,AX,DX) + REDUCE(BX,SI,DI,R8,BP,R15,AX,DX,s1-16(SP),s2-24(SP),s3-32(SP),s4-40(SP)) + + // store output z[6] + MOVQ BX, 192(R14) + MOVQ SI, 200(R14) + MOVQ DI, 208(R14) + MOVQ R8, 216(R14) + ADDQ $32, R13 + MOVQ 0(R13), DX + CARRY4() + AVX_MUL_Q_LO() + AVX_MUL_Q_HI() + + // z[7] -> y * x[0] + MUL_WORD_0_VEC() + CARRY1() + CARRY2() + + // z[7] -> y * x[1] + MOVQ 8(R13), DX + MUL_WORD_N_VEC() + + // Conditional subtraction of the modulus + VPERMD.BCST.Z s10-16(SP), Z8, K1, Z10 + VPERMD.BCST.Z s11-12(SP), Z8, K1, Z11 + VPERMD.BCST.Z s20-24(SP), Z8, K1, Z12 + VPERMD.BCST.Z s21-20(SP), Z8, K1, Z13 + VPERMD.BCST.Z s30-32(SP), Z8, K1, Z14 + VPERMD.BCST.Z s31-28(SP), Z8, K1, Z15 + VPERMD.BCST.Z s40-40(SP), Z8, K1, Z16 + VPERMD.BCST.Z s41-36(SP), Z8, K1, Z17 + VPSUBQ Z10, Z0, Z10 + VPSRLQ $63, Z10, Z20 + VPANDQ Z8, Z10, Z10 + VPSUBQ Z11, Z1, Z11 + VPSUBQ Z20, Z11, Z11 + VPSRLQ $63, Z11, Z21 + VPANDQ Z8, Z11, Z11 + VPSUBQ Z12, Z2, Z12 + VPSUBQ Z21, Z12, Z12 + VPSRLQ $63, Z12, Z22 + VPANDQ Z8, Z12, Z12 + VPSUBQ Z13, Z3, Z13 + VPSUBQ Z22, Z13, Z13 + VPSRLQ $63, Z13, Z23 + VPANDQ Z8, Z13, Z13 + VPSUBQ Z14, Z4, Z14 + VPSUBQ Z23, Z14, Z14 + VPSRLQ $63, Z14, Z24 + VPANDQ Z8, Z14, Z14 + VPSUBQ Z15, Z5, Z15 + VPSUBQ Z24, Z15, Z15 + VPSRLQ $63, Z15, Z25 + VPANDQ Z8, Z15, Z15 + VPSUBQ Z16, Z6, Z16 + VPSUBQ Z25, Z16, Z16 + VPSRLQ $63, Z16, Z26 + VPANDQ Z8, Z16, Z16 + VPSUBQ Z17, Z7, Z17 + VPSUBQ Z26, Z17, Z17 + VPMOVQ2M Z17, K2 + KNOTB K2, K2 + VMOVDQU64 Z10, K2, Z0 + VMOVDQU64 Z11, K2, Z1 + VMOVDQU64 Z12, K2, Z2 + VMOVDQU64 Z13, K2, Z3 + VMOVDQU64 Z14, K2, Z4 + + // z[7] -> y * x[2] + MOVQ 16(R13), DX + MUL_WORD_N_VEC() + VMOVDQU64 Z15, K2, Z5 + VMOVDQU64 Z16, K2, Z6 + VMOVDQU64 Z17, K2, Z7 + + // Transpose results back + MOVQ patterns+40(FP), AX + VMOVDQU64 0(AX), Z15 + VALIGND $0, Z15, Z11, Z11 + VMOVDQU64 64(AX), Z15 + VALIGND $0, Z15, Z12, Z12 + VMOVDQU64 128(AX), Z15 + VALIGND $0, Z15, Z13, Z13 + VMOVDQU64 192(AX), Z15 + VALIGND $0, Z15, Z14, Z14 + VPSLLQ $32, Z1, Z1 + VPORQ Z1, Z0, Z0 + VPSLLQ $32, Z3, Z3 + VPORQ Z3, Z2, Z1 + VPSLLQ $32, Z5, Z5 + VPORQ Z5, Z4, Z2 + VPSLLQ $32, Z7, Z7 + VPORQ Z7, Z6, Z3 + VMOVDQU64 Z0, Z4 + VMOVDQU64 Z2, Z6 + + // z[7] -> y * x[3] + MOVQ 24(R13), DX + MUL_WORD_N_VEC() + VPERMT2Q Z1, Z11, Z0 + VPERMT2Q Z4, Z12, Z1 + VPERMT2Q Z3, Z11, Z2 + VPERMT2Q Z6, Z12, Z3 + + // reduce element(BX,SI,DI,R8) using temp registers (BP,R15,AX,DX) + REDUCE(BX,SI,DI,R8,BP,R15,AX,DX,s1-16(SP),s2-24(SP),s3-32(SP),s4-40(SP)) + + // store output z[7] + MOVQ BX, 224(R14) + MOVQ SI, 232(R14) + MOVQ DI, 240(R14) + MOVQ R8, 248(R14) + ADDQ $288, R13 + VMOVDQU64 Z0, Z4 + VMOVDQU64 Z1, Z5 + VPERMT2Q Z2, Z13, Z0 + VPERMT2Q Z4, Z14, Z2 + VPERMT2Q Z3, Z13, Z1 + VPERMT2Q Z5, Z14, Z3 + + // Save AVX-512 results + VMOVDQU64 Z0, 256+0*64(R14) + VMOVDQU64 Z2, 256+1*64(R14) + VMOVDQU64 Z1, 256+2*64(R14) + VMOVDQU64 Z3, 256+3*64(R14) + ADDQ $512, R14 + MOVQ s0-8(SP), R15 + DECQ R15 // decrement n + MOVQ R15, s0-8(SP) + JMP loop_16 + +done_15: + RET + +TEXT ·mulVec(SB), $40-48 + MOVQ $const_q0, AX + MOVQ AX, s1-16(SP) + MOVQ $const_q1, AX + MOVQ AX, s2-24(SP) + MOVQ $const_q2, AX + MOVQ AX, s3-32(SP) + MOVQ $const_q3, AX + MOVQ AX, s4-40(SP) + MOVQ res+0(FP), R14 + MOVQ a+8(FP), R13 + MOVQ b+16(FP), CX + MOVQ n+24(FP), R15 + MOVQ R15, s0-8(SP) + + // Create mask for low dword in each qword + VPCMPEQB Y8, Y8, Y8 + VPMOVZXDQ Y8, Z8 + MOVQ $0x5555, DX + KMOVD DX, K1 + +loop_18: + TESTQ R15, R15 + JEQ done_17 // n == 0, we are done + MOVQ 0(R13), DX + VMOVDQU64 256+0*64(R13), Z16 + VMOVDQU64 256+1*64(R13), Z17 + VMOVDQU64 256+2*64(R13), Z18 + VMOVDQU64 256+3*64(R13), Z19 + + // load input y[0] + MOVQ 0(CX), R9 + MOVQ 8(CX), R10 + MOVQ 16(CX), R11 + MOVQ 24(CX), R12 + VMOVDQU64 256+0*64(CX), Z24 + VMOVDQU64 256+1*64(CX), Z25 + VMOVDQU64 256+2*64(CX), Z26 + VMOVDQU64 256+3*64(CX), Z27 + + // Transpose and expand x and y + VSHUFI64X2 $0x88, Z17, Z16, Z20 + VSHUFI64X2 $0xdd, Z17, Z16, Z22 + VSHUFI64X2 $0x88, Z19, Z18, Z21 + VSHUFI64X2 $0xdd, Z19, Z18, Z23 + VSHUFI64X2 $0x88, Z25, Z24, Z28 + VSHUFI64X2 $0xdd, Z25, Z24, Z30 + VSHUFI64X2 $0x88, Z27, Z26, Z29 + VSHUFI64X2 $0xdd, Z27, Z26, Z31 + VPERMQ $0xd8, Z20, Z20 + VPERMQ $0xd8, Z21, Z21 + VPERMQ $0xd8, Z22, Z22 + VPERMQ $0xd8, Z23, Z23 + + // z[0] -> y * x[0] + MUL_WORD_0_VEC() + VPERMQ $0xd8, Z28, Z28 + VPERMQ $0xd8, Z29, Z29 + VPERMQ $0xd8, Z30, Z30 + VPERMQ $0xd8, Z31, Z31 + VSHUFI64X2 $0xd8, Z20, Z20, Z20 + VSHUFI64X2 $0xd8, Z21, Z21, Z21 + VSHUFI64X2 $0xd8, Z22, Z22, Z22 + VSHUFI64X2 $0xd8, Z23, Z23, Z23 + + // z[0] -> y * x[1] + MOVQ 8(R13), DX + MUL_WORD_N_VEC() + VSHUFI64X2 $0xd8, Z28, Z28, Z28 + VSHUFI64X2 $0xd8, Z29, Z29, Z29 + VSHUFI64X2 $0xd8, Z30, Z30, Z30 + VSHUFI64X2 $0xd8, Z31, Z31, Z31 + VSHUFI64X2 $0x44, Z21, Z20, Z16 + VSHUFI64X2 $0xee, Z21, Z20, Z18 + VSHUFI64X2 $0x44, Z23, Z22, Z20 + VSHUFI64X2 $0xee, Z23, Z22, Z22 + + // z[0] -> y * x[2] + MOVQ 16(R13), DX + MUL_WORD_N_VEC() + VSHUFI64X2 $0x44, Z29, Z28, Z24 + VSHUFI64X2 $0xee, Z29, Z28, Z26 + VSHUFI64X2 $0x44, Z31, Z30, Z28 + VSHUFI64X2 $0xee, Z31, Z30, Z30 + PREFETCHT0 1024(R13) + VPSRLQ $32, Z16, Z17 + VPSRLQ $32, Z18, Z19 + VPSRLQ $32, Z20, Z21 + VPSRLQ $32, Z22, Z23 + VPSRLQ $32, Z24, Z25 + VPSRLQ $32, Z26, Z27 + VPSRLQ $32, Z28, Z29 + VPSRLQ $32, Z30, Z31 + + // z[0] -> y * x[3] + MOVQ 24(R13), DX + MUL_WORD_N_VEC() + VPANDQ Z8, Z16, Z16 + VPANDQ Z8, Z18, Z18 + VPANDQ Z8, Z20, Z20 + VPANDQ Z8, Z22, Z22 + VPANDQ Z8, Z24, Z24 + VPANDQ Z8, Z26, Z26 + VPANDQ Z8, Z28, Z28 + VPANDQ Z8, Z30, Z30 + + // reduce element(BX,SI,DI,R8) using temp registers (BP,R15,AX,DX) + REDUCE(BX,SI,DI,R8,BP,R15,AX,DX,s1-16(SP),s2-24(SP),s3-32(SP),s4-40(SP)) + + // store output z[0] + MOVQ BX, 0(R14) + MOVQ SI, 8(R14) + MOVQ DI, 16(R14) + MOVQ R8, 24(R14) + ADDQ $32, R13 + MOVQ 0(R13), DX + + // For each 256-bit input value, each zmm register now represents a 32-bit input word zero-extended to 64 bits. + // Multiply y by doubleword 0 of x + VPMULUDQ Z16, Z24, Z0 + VPMULUDQ Z16, Z25, Z1 + VPMULUDQ Z16, Z26, Z2 + VPMULUDQ Z16, Z27, Z3 + VPMULUDQ Z16, Z28, Z4 + PREFETCHT0 1024(CX) + VPMULUDQ Z16, Z29, Z5 + VPMULUDQ Z16, Z30, Z6 + VPMULUDQ Z16, Z31, Z7 + + // load input y[1] + MOVQ 32(CX), R9 + MOVQ 40(CX), R10 + MOVQ 48(CX), R11 + MOVQ 56(CX), R12 + VPMULUDQ.BCST qInvNeg+32(FP), Z0, Z9 + VPSRLQ $32, Z0, Z10 + VPANDQ Z8, Z0, Z0 + VPADDQ Z10, Z1, Z1 + VPSRLQ $32, Z1, Z11 + VPANDQ Z8, Z1, Z1 + VPADDQ Z11, Z2, Z2 + VPSRLQ $32, Z2, Z12 + VPANDQ Z8, Z2, Z2 + VPADDQ Z12, Z3, Z3 + VPSRLQ $32, Z3, Z13 + VPANDQ Z8, Z3, Z3 + VPADDQ Z13, Z4, Z4 + + // z[1] -> y * x[0] + MUL_WORD_0_VEC() + VPSRLQ $32, Z4, Z14 + VPANDQ Z8, Z4, Z4 + VPADDQ Z14, Z5, Z5 + VPSRLQ $32, Z5, Z15 + VPANDQ Z8, Z5, Z5 + VPADDQ Z15, Z6, Z6 + VPSRLQ $32, Z6, Z16 + VPANDQ Z8, Z6, Z6 + VPADDQ Z16, Z7, Z7 + VPMULUDQ.BCST s10-16(SP), Z9, Z10 + VPADDQ Z10, Z0, Z0 + VPMULUDQ.BCST s11-12(SP), Z9, Z11 + VPADDQ Z11, Z1, Z1 + VPMULUDQ.BCST s20-24(SP), Z9, Z12 + VPADDQ Z12, Z2, Z2 + VPMULUDQ.BCST s21-20(SP), Z9, Z13 + VPADDQ Z13, Z3, Z3 + + // z[1] -> y * x[1] + MOVQ 8(R13), DX + MUL_WORD_N_VEC() + VPMULUDQ.BCST s30-32(SP), Z9, Z14 + VPADDQ Z14, Z4, Z4 + VPMULUDQ.BCST s31-28(SP), Z9, Z15 + VPADDQ Z15, Z5, Z5 + VPMULUDQ.BCST s40-40(SP), Z9, Z16 + VPADDQ Z16, Z6, Z6 + VPMULUDQ.BCST s41-36(SP), Z9, Z10 + VPADDQ Z10, Z7, Z7 + CARRY1() + + // z[1] -> y * x[2] + MOVQ 16(R13), DX + MUL_WORD_N_VEC() + SHIFT_ADD_AND(Z4, Z14, Z5, Z8) + SHIFT_ADD_AND(Z5, Z15, Z6, Z8) + SHIFT_ADD_AND(Z6, Z16, Z7, Z8) + VPSRLQ $32, Z7, Z7 + + // Process doubleword 1 of x + VPMULUDQ Z17, Z24, Z10 + VPADDQ Z10, Z0, Z0 + VPMULUDQ Z17, Z25, Z11 + VPADDQ Z11, Z1, Z1 + VPMULUDQ Z17, Z26, Z12 + VPADDQ Z12, Z2, Z2 + VPMULUDQ Z17, Z27, Z13 + VPADDQ Z13, Z3, Z3 + + // z[1] -> y * x[3] + MOVQ 24(R13), DX + MUL_WORD_N_VEC() + VPMULUDQ Z17, Z28, Z14 + VPADDQ Z14, Z4, Z4 + VPMULUDQ Z17, Z29, Z15 + VPADDQ Z15, Z5, Z5 + VPMULUDQ Z17, Z30, Z16 + VPADDQ Z16, Z6, Z6 + VPMULUDQ Z17, Z31, Z17 + VPADDQ Z17, Z7, Z7 + VPMULUDQ.BCST qInvNeg+32(FP), Z0, Z9 + + // reduce element(BX,SI,DI,R8) using temp registers (BP,R15,AX,DX) + REDUCE(BX,SI,DI,R8,BP,R15,AX,DX,s1-16(SP),s2-24(SP),s3-32(SP),s4-40(SP)) + + // store output z[1] + MOVQ BX, 32(R14) + MOVQ SI, 40(R14) + MOVQ DI, 48(R14) + MOVQ R8, 56(R14) + ADDQ $32, R13 + MOVQ 0(R13), DX + + // Move high dwords to zmm10-16, add each to the corresponding low dword (propagate 32-bit carries) + VPSRLQ $32, Z0, Z10 + VPANDQ Z8, Z0, Z0 + VPADDQ Z10, Z1, Z1 + VPSRLQ $32, Z1, Z11 + VPANDQ Z8, Z1, Z1 + VPADDQ Z11, Z2, Z2 + VPSRLQ $32, Z2, Z12 + VPANDQ Z8, Z2, Z2 + VPADDQ Z12, Z3, Z3 + + // load input y[2] + MOVQ 64(CX), R9 + MOVQ 72(CX), R10 + MOVQ 80(CX), R11 + MOVQ 88(CX), R12 + VPSRLQ $32, Z3, Z13 + VPANDQ Z8, Z3, Z3 + VPADDQ Z13, Z4, Z4 + CARRY4() + + // z[2] -> y * x[0] + MUL_WORD_0_VEC() + AVX_MUL_Q_LO() + AVX_MUL_Q_HI() + + // z[2] -> y * x[1] + MOVQ 8(R13), DX + MUL_WORD_N_VEC() + CARRY1() + CARRY2() + + // z[2] -> y * x[2] + MOVQ 16(R13), DX + MUL_WORD_N_VEC() + + // Process doubleword 2 of x + VPMULUDQ Z18, Z24, Z10 + VPADDQ Z10, Z0, Z0 + VPMULUDQ Z18, Z25, Z11 + VPADDQ Z11, Z1, Z1 + VPMULUDQ Z18, Z26, Z12 + VPADDQ Z12, Z2, Z2 + VPMULUDQ Z18, Z27, Z13 + VPADDQ Z13, Z3, Z3 + VPMULUDQ Z18, Z28, Z14 + VPADDQ Z14, Z4, Z4 + VPMULUDQ Z18, Z29, Z15 + VPADDQ Z15, Z5, Z5 + VPMULUDQ Z18, Z30, Z16 + VPADDQ Z16, Z6, Z6 + VPMULUDQ Z18, Z31, Z17 + VPADDQ Z17, Z7, Z7 + VPMULUDQ.BCST qInvNeg+32(FP), Z0, Z9 + + // z[2] -> y * x[3] + MOVQ 24(R13), DX + MUL_WORD_N_VEC() + + // Move high dwords to zmm10-16, add each to the corresponding low dword (propagate 32-bit carries) + CARRY3() + + // reduce element(BX,SI,DI,R8) using temp registers (BP,R15,AX,DX) + REDUCE(BX,SI,DI,R8,BP,R15,AX,DX,s1-16(SP),s2-24(SP),s3-32(SP),s4-40(SP)) + + // store output z[2] + MOVQ BX, 64(R14) + MOVQ SI, 72(R14) + MOVQ DI, 80(R14) + MOVQ R8, 88(R14) + ADDQ $32, R13 + MOVQ 0(R13), DX + + // load input y[3] + MOVQ 96(CX), R9 + MOVQ 104(CX), R10 + MOVQ 112(CX), R11 + MOVQ 120(CX), R12 + CARRY4() + AVX_MUL_Q_LO() + + // z[3] -> y * x[0] + MUL_WORD_0_VEC() + AVX_MUL_Q_HI() + CARRY1() + CARRY2() + + // Process doubleword 3 of x + VPMULUDQ Z19, Z24, Z10 + VPADDQ Z10, Z0, Z0 + VPMULUDQ Z19, Z25, Z11 + VPADDQ Z11, Z1, Z1 + VPMULUDQ Z19, Z26, Z12 + VPADDQ Z12, Z2, Z2 + VPMULUDQ Z19, Z27, Z13 + VPADDQ Z13, Z3, Z3 + + // z[3] -> y * x[1] + MOVQ 8(R13), DX + MUL_WORD_N_VEC() + VPMULUDQ Z19, Z28, Z14 + VPADDQ Z14, Z4, Z4 + VPMULUDQ Z19, Z29, Z15 + VPADDQ Z15, Z5, Z5 + VPMULUDQ Z19, Z30, Z16 + VPADDQ Z16, Z6, Z6 + VPMULUDQ Z19, Z31, Z17 + VPADDQ Z17, Z7, Z7 + + // z[3] -> y * x[2] + MOVQ 16(R13), DX + MUL_WORD_N_VEC() + VPMULUDQ.BCST qInvNeg+32(FP), Z0, Z9 + CARRY3() + CARRY4() + + // z[3] -> y * x[3] + MOVQ 24(R13), DX + MUL_WORD_N_VEC() + AVX_MUL_Q_LO() + AVX_MUL_Q_HI() + + // reduce element(BX,SI,DI,R8) using temp registers (BP,R15,AX,DX) + REDUCE(BX,SI,DI,R8,BP,R15,AX,DX,s1-16(SP),s2-24(SP),s3-32(SP),s4-40(SP)) + + // store output z[3] + MOVQ BX, 96(R14) + MOVQ SI, 104(R14) + MOVQ DI, 112(R14) + MOVQ R8, 120(R14) + ADDQ $32, R13 + MOVQ 0(R13), DX + + // Propagate carries and shift down by one dword + CARRY1() + CARRY2() + + // load input y[4] + MOVQ 128(CX), R9 + MOVQ 136(CX), R10 + MOVQ 144(CX), R11 + MOVQ 152(CX), R12 + + // Process doubleword 4 of x + VPMULUDQ Z20, Z24, Z10 + VPADDQ Z10, Z0, Z0 + VPMULUDQ Z20, Z25, Z11 + VPADDQ Z11, Z1, Z1 + VPMULUDQ Z20, Z26, Z12 + VPADDQ Z12, Z2, Z2 + VPMULUDQ Z20, Z27, Z13 + VPADDQ Z13, Z3, Z3 + + // z[4] -> y * x[0] + MUL_WORD_0_VEC() + VPMULUDQ Z20, Z28, Z14 + VPADDQ Z14, Z4, Z4 + VPMULUDQ Z20, Z29, Z15 + VPADDQ Z15, Z5, Z5 + VPMULUDQ Z20, Z30, Z16 + VPADDQ Z16, Z6, Z6 + VPMULUDQ Z20, Z31, Z17 + VPADDQ Z17, Z7, Z7 + VPMULUDQ.BCST qInvNeg+32(FP), Z0, Z9 + + // z[4] -> y * x[1] + MOVQ 8(R13), DX + MUL_WORD_N_VEC() + + // Move high dwords to zmm10-16, add each to the corresponding low dword (propagate 32-bit carries) + CARRY3() + CARRY4() + + // z[4] -> y * x[2] + MOVQ 16(R13), DX + MUL_WORD_N_VEC() + + // zmm7 keeps all 64 bits + AVX_MUL_Q_LO() + AVX_MUL_Q_HI() + + // z[4] -> y * x[3] + MOVQ 24(R13), DX + MUL_WORD_N_VEC() + + // Propagate carries and shift down by one dword + CARRY1() + CARRY2() + + // reduce element(BX,SI,DI,R8) using temp registers (BP,R15,AX,DX) + REDUCE(BX,SI,DI,R8,BP,R15,AX,DX,s1-16(SP),s2-24(SP),s3-32(SP),s4-40(SP)) + + // store output z[4] + MOVQ BX, 128(R14) + MOVQ SI, 136(R14) + MOVQ DI, 144(R14) + MOVQ R8, 152(R14) + ADDQ $32, R13 + MOVQ 0(R13), DX + + // Process doubleword 5 of x + VPMULUDQ Z21, Z24, Z10 + VPADDQ Z10, Z0, Z0 + VPMULUDQ Z21, Z25, Z11 + VPADDQ Z11, Z1, Z1 + VPMULUDQ Z21, Z26, Z12 + VPADDQ Z12, Z2, Z2 + VPMULUDQ Z21, Z27, Z13 + VPADDQ Z13, Z3, Z3 + + // load input y[5] + MOVQ 160(CX), R9 + MOVQ 168(CX), R10 + MOVQ 176(CX), R11 + MOVQ 184(CX), R12 + VPMULUDQ Z21, Z28, Z14 + VPADDQ Z14, Z4, Z4 + VPMULUDQ Z21, Z29, Z15 + VPADDQ Z15, Z5, Z5 + VPMULUDQ Z21, Z30, Z16 + VPADDQ Z16, Z6, Z6 + VPMULUDQ Z21, Z31, Z17 + VPADDQ Z17, Z7, Z7 + + // z[5] -> y * x[0] + MUL_WORD_0_VEC() + VPMULUDQ.BCST qInvNeg+32(FP), Z0, Z9 + + // Move high dwords to zmm10-16, add each to the corresponding low dword (propagate 32-bit carries) + CARRY3() + CARRY4() + + // z[5] -> y * x[1] + MOVQ 8(R13), DX + MUL_WORD_N_VEC() + AVX_MUL_Q_LO() + AVX_MUL_Q_HI() + + // z[5] -> y * x[2] + MOVQ 16(R13), DX + MUL_WORD_N_VEC() + CARRY1() + CARRY2() + + // z[5] -> y * x[3] + MOVQ 24(R13), DX + MUL_WORD_N_VEC() + + // Process doubleword 6 of x + VPMULUDQ Z22, Z24, Z10 + VPADDQ Z10, Z0, Z0 + VPMULUDQ Z22, Z25, Z11 + VPADDQ Z11, Z1, Z1 + VPMULUDQ Z22, Z26, Z12 + VPADDQ Z12, Z2, Z2 + VPMULUDQ Z22, Z27, Z13 + VPADDQ Z13, Z3, Z3 + VPMULUDQ Z22, Z28, Z14 + VPADDQ Z14, Z4, Z4 + VPMULUDQ Z22, Z29, Z15 + VPADDQ Z15, Z5, Z5 + VPMULUDQ Z22, Z30, Z16 + VPADDQ Z16, Z6, Z6 + VPMULUDQ Z22, Z31, Z17 + VPADDQ Z17, Z7, Z7 + VPMULUDQ.BCST qInvNeg+32(FP), Z0, Z9 + + // reduce element(BX,SI,DI,R8) using temp registers (BP,R15,AX,DX) + REDUCE(BX,SI,DI,R8,BP,R15,AX,DX,s1-16(SP),s2-24(SP),s3-32(SP),s4-40(SP)) + + // store output z[5] + MOVQ BX, 160(R14) + MOVQ SI, 168(R14) + MOVQ DI, 176(R14) + MOVQ R8, 184(R14) + ADDQ $32, R13 + MOVQ 0(R13), DX + + // Move high dwords to zmm10-16, add each to the corresponding low dword (propagate 32-bit carries) + CARRY3() + + // load input y[6] + MOVQ 192(CX), R9 + MOVQ 200(CX), R10 + MOVQ 208(CX), R11 + MOVQ 216(CX), R12 + CARRY4() + + // z[6] -> y * x[0] + MUL_WORD_0_VEC() + AVX_MUL_Q_LO() + AVX_MUL_Q_HI() + + // z[6] -> y * x[1] + MOVQ 8(R13), DX + MUL_WORD_N_VEC() + CARRY1() + CARRY2() + + // z[6] -> y * x[2] + MOVQ 16(R13), DX + MUL_WORD_N_VEC() + + // Process doubleword 7 of x + VPMULUDQ Z23, Z24, Z10 + VPADDQ Z10, Z0, Z0 + VPMULUDQ Z23, Z25, Z11 + VPADDQ Z11, Z1, Z1 + VPMULUDQ Z23, Z26, Z12 + VPADDQ Z12, Z2, Z2 + VPMULUDQ Z23, Z27, Z13 + VPADDQ Z13, Z3, Z3 + VPMULUDQ Z23, Z28, Z14 + VPADDQ Z14, Z4, Z4 + VPMULUDQ Z23, Z29, Z15 + VPADDQ Z15, Z5, Z5 + VPMULUDQ Z23, Z30, Z16 + VPADDQ Z16, Z6, Z6 + VPMULUDQ Z23, Z31, Z17 + VPADDQ Z17, Z7, Z7 + VPMULUDQ.BCST qInvNeg+32(FP), Z0, Z9 + + // z[6] -> y * x[3] + MOVQ 24(R13), DX + MUL_WORD_N_VEC() + CARRY3() + + // reduce element(BX,SI,DI,R8) using temp registers (BP,R15,AX,DX) + REDUCE(BX,SI,DI,R8,BP,R15,AX,DX,s1-16(SP),s2-24(SP),s3-32(SP),s4-40(SP)) + + // store output z[6] + MOVQ BX, 192(R14) + MOVQ SI, 200(R14) + MOVQ DI, 208(R14) + MOVQ R8, 216(R14) + ADDQ $32, R13 + MOVQ 0(R13), DX + CARRY4() + + // load input y[7] + MOVQ 224(CX), R9 + MOVQ 232(CX), R10 + MOVQ 240(CX), R11 + MOVQ 248(CX), R12 + AVX_MUL_Q_LO() + AVX_MUL_Q_HI() + + // z[7] -> y * x[0] + MUL_WORD_0_VEC() + CARRY1() + CARRY2() + + // z[7] -> y * x[1] + MOVQ 8(R13), DX + MUL_WORD_N_VEC() + + // Conditional subtraction of the modulus + VPERMD.BCST.Z s10-16(SP), Z8, K1, Z10 + VPERMD.BCST.Z s11-12(SP), Z8, K1, Z11 + VPERMD.BCST.Z s20-24(SP), Z8, K1, Z12 + VPERMD.BCST.Z s21-20(SP), Z8, K1, Z13 + VPERMD.BCST.Z s30-32(SP), Z8, K1, Z14 + VPERMD.BCST.Z s31-28(SP), Z8, K1, Z15 + VPERMD.BCST.Z s40-40(SP), Z8, K1, Z16 + VPERMD.BCST.Z s41-36(SP), Z8, K1, Z17 + VPSUBQ Z10, Z0, Z10 + VPSRLQ $63, Z10, Z20 + VPANDQ Z8, Z10, Z10 + VPSUBQ Z11, Z1, Z11 + VPSUBQ Z20, Z11, Z11 + VPSRLQ $63, Z11, Z21 + VPANDQ Z8, Z11, Z11 + VPSUBQ Z12, Z2, Z12 + VPSUBQ Z21, Z12, Z12 + VPSRLQ $63, Z12, Z22 + VPANDQ Z8, Z12, Z12 + VPSUBQ Z13, Z3, Z13 + VPSUBQ Z22, Z13, Z13 + VPSRLQ $63, Z13, Z23 + VPANDQ Z8, Z13, Z13 + VPSUBQ Z14, Z4, Z14 + VPSUBQ Z23, Z14, Z14 + VPSRLQ $63, Z14, Z24 + VPANDQ Z8, Z14, Z14 + VPSUBQ Z15, Z5, Z15 + VPSUBQ Z24, Z15, Z15 + VPSRLQ $63, Z15, Z25 + VPANDQ Z8, Z15, Z15 + VPSUBQ Z16, Z6, Z16 + VPSUBQ Z25, Z16, Z16 + VPSRLQ $63, Z16, Z26 + VPANDQ Z8, Z16, Z16 + VPSUBQ Z17, Z7, Z17 + VPSUBQ Z26, Z17, Z17 + VPMOVQ2M Z17, K2 + KNOTB K2, K2 + VMOVDQU64 Z10, K2, Z0 + VMOVDQU64 Z11, K2, Z1 + VMOVDQU64 Z12, K2, Z2 + VMOVDQU64 Z13, K2, Z3 + VMOVDQU64 Z14, K2, Z4 + + // z[7] -> y * x[2] + MOVQ 16(R13), DX + MUL_WORD_N_VEC() + VMOVDQU64 Z15, K2, Z5 + VMOVDQU64 Z16, K2, Z6 + VMOVDQU64 Z17, K2, Z7 + + // Transpose results back + MOVQ patterns+40(FP), AX + VMOVDQU64 0(AX), Z15 + VALIGND $0, Z15, Z11, Z11 + VMOVDQU64 64(AX), Z15 + VALIGND $0, Z15, Z12, Z12 + VMOVDQU64 128(AX), Z15 + VALIGND $0, Z15, Z13, Z13 + VMOVDQU64 192(AX), Z15 + VALIGND $0, Z15, Z14, Z14 + VPSLLQ $32, Z1, Z1 + VPORQ Z1, Z0, Z0 + VPSLLQ $32, Z3, Z3 + VPORQ Z3, Z2, Z1 + VPSLLQ $32, Z5, Z5 + VPORQ Z5, Z4, Z2 + VPSLLQ $32, Z7, Z7 + VPORQ Z7, Z6, Z3 + VMOVDQU64 Z0, Z4 + VMOVDQU64 Z2, Z6 + + // z[7] -> y * x[3] + MOVQ 24(R13), DX + MUL_WORD_N_VEC() + VPERMT2Q Z1, Z11, Z0 + VPERMT2Q Z4, Z12, Z1 + VPERMT2Q Z3, Z11, Z2 + VPERMT2Q Z6, Z12, Z3 + + // reduce element(BX,SI,DI,R8) using temp registers (BP,R15,AX,DX) + REDUCE(BX,SI,DI,R8,BP,R15,AX,DX,s1-16(SP),s2-24(SP),s3-32(SP),s4-40(SP)) + + // store output z[7] + MOVQ BX, 224(R14) + MOVQ SI, 232(R14) + MOVQ DI, 240(R14) + MOVQ R8, 248(R14) + ADDQ $288, R13 + VMOVDQU64 Z0, Z4 + VMOVDQU64 Z1, Z5 + VPERMT2Q Z2, Z13, Z0 + VPERMT2Q Z4, Z14, Z2 + VPERMT2Q Z3, Z13, Z1 + VPERMT2Q Z5, Z14, Z3 + + // Save AVX-512 results + VMOVDQU64 Z0, 256+0*64(R14) + VMOVDQU64 Z2, 256+1*64(R14) + VMOVDQU64 Z1, 256+2*64(R14) + VMOVDQU64 Z3, 256+3*64(R14) + ADDQ $512, R14 + ADDQ $512, CX + MOVQ s0-8(SP), R15 + DECQ R15 // decrement n + MOVQ R15, s0-8(SP) + JMP loop_18 + +done_17: + RET diff --git a/vendor/github.com/consensys/gnark-crypto/field/asm/element_4w/element_4w_arm64.s b/vendor/github.com/consensys/gnark-crypto/field/asm/element_4w/element_4w_arm64.s new file mode 100644 index 000000000..fce96e300 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/field/asm/element_4w/element_4w_arm64.s @@ -0,0 +1,163 @@ +// Code generated by gnark-crypto/generator. DO NOT EDIT. +#include "textflag.h" +#include "funcdata.h" +#include "go_asm.h" + +// butterfly(a, b *Element) +// a, b = a+b, a-b +TEXT ·Butterfly(SB), NOFRAME|NOSPLIT, $0-16 + LDP x+0(FP), (R16, R17) + LDP 0(R16), (R0, R1) + LDP 16(R16), (R2, R3) + LDP 0(R17), (R4, R5) + LDP 16(R17), (R6, R7) + ADDS R0, R4, R8 + ADCS R1, R5, R9 + ADCS R2, R6, R10 + ADC R3, R7, R11 + SUBS R4, R0, R4 + SBCS R5, R1, R5 + SBCS R6, R2, R6 + SBCS R7, R3, R7 + LDP ·qElement+0(SB), (R0, R1) + CSEL CS, ZR, R0, R12 + CSEL CS, ZR, R1, R13 + LDP ·qElement+16(SB), (R2, R3) + CSEL CS, ZR, R2, R14 + CSEL CS, ZR, R3, R15 + + // add q if underflow, 0 if not + ADDS R4, R12, R4 + ADCS R5, R13, R5 + STP (R4, R5), 0(R17) + ADCS R6, R14, R6 + ADC R7, R15, R7 + STP (R6, R7), 16(R17) + + // q = t - q + SUBS R0, R8, R0 + SBCS R1, R9, R1 + SBCS R2, R10, R2 + SBCS R3, R11, R3 + + // if no borrow, return q, else return t + CSEL CS, R0, R8, R8 + CSEL CS, R1, R9, R9 + STP (R8, R9), 0(R16) + CSEL CS, R2, R10, R10 + CSEL CS, R3, R11, R11 + STP (R10, R11), 16(R16) + RET + +// mul(res, x, y *Element) +// Algorithm 2 of Faster Montgomery Multiplication and Multi-Scalar-Multiplication for SNARKS +// by Y. El Housni and G. Botrel https://doi.org/10.46586/tches.v2023.i3.504-521 +TEXT ·mul(SB), NOFRAME|NOSPLIT, $0-24 +#define DIVSHIFT() \ + MUL R13, R12, R0 \ + ADDS R0, R6, R6 \ + MUL R14, R12, R0 \ + ADCS R0, R7, R7 \ + MUL R15, R12, R0 \ + ADCS R0, R8, R8 \ + MUL R16, R12, R0 \ + ADCS R0, R9, R9 \ + ADC R10, ZR, R10 \ + UMULH R13, R12, R0 \ + ADDS R0, R7, R6 \ + UMULH R14, R12, R0 \ + ADCS R0, R8, R7 \ + UMULH R15, R12, R0 \ + ADCS R0, R9, R8 \ + UMULH R16, R12, R0 \ + ADCS R0, R10, R9 \ + +#define MUL_WORD_N() \ + MUL R2, R1, R0 \ + ADDS R0, R6, R6 \ + MUL R6, R11, R12 \ + MUL R3, R1, R0 \ + ADCS R0, R7, R7 \ + MUL R4, R1, R0 \ + ADCS R0, R8, R8 \ + MUL R5, R1, R0 \ + ADCS R0, R9, R9 \ + ADC ZR, ZR, R10 \ + UMULH R2, R1, R0 \ + ADDS R0, R7, R7 \ + UMULH R3, R1, R0 \ + ADCS R0, R8, R8 \ + UMULH R4, R1, R0 \ + ADCS R0, R9, R9 \ + UMULH R5, R1, R0 \ + ADC R0, R10, R10 \ + DIVSHIFT() \ + +#define MUL_WORD_0() \ + MUL R2, R1, R6 \ + MUL R3, R1, R7 \ + MUL R4, R1, R8 \ + MUL R5, R1, R9 \ + UMULH R2, R1, R0 \ + ADDS R0, R7, R7 \ + UMULH R3, R1, R0 \ + ADCS R0, R8, R8 \ + UMULH R4, R1, R0 \ + ADCS R0, R9, R9 \ + UMULH R5, R1, R0 \ + ADC R0, ZR, R10 \ + MUL R6, R11, R12 \ + DIVSHIFT() \ + + MOVD y+16(FP), R17 + MOVD x+8(FP), R0 + LDP 0(R0), (R2, R3) + LDP 16(R0), (R4, R5) + MOVD 0(R17), R1 + MOVD $const_qInvNeg, R11 + LDP ·qElement+0(SB), (R13, R14) + LDP ·qElement+16(SB), (R15, R16) + MUL_WORD_0() + MOVD 8(R17), R1 + MUL_WORD_N() + MOVD 16(R17), R1 + MUL_WORD_N() + MOVD 24(R17), R1 + MUL_WORD_N() + + // reduce if necessary + SUBS R13, R6, R13 + SBCS R14, R7, R14 + SBCS R15, R8, R15 + SBCS R16, R9, R16 + MOVD res+0(FP), R0 + CSEL CS, R13, R6, R6 + CSEL CS, R14, R7, R7 + STP (R6, R7), 0(R0) + CSEL CS, R15, R8, R8 + CSEL CS, R16, R9, R9 + STP (R8, R9), 16(R0) + RET + +// reduce(res *Element) +TEXT ·reduce(SB), NOFRAME|NOSPLIT, $0-8 + LDP ·qElement+0(SB), (R4, R5) + LDP ·qElement+16(SB), (R6, R7) + MOVD res+0(FP), R8 + LDP 0(R8), (R0, R1) + LDP 16(R8), (R2, R3) + + // q = t - q + SUBS R4, R0, R4 + SBCS R5, R1, R5 + SBCS R6, R2, R6 + SBCS R7, R3, R7 + + // if no borrow, return q, else return t + CSEL CS, R4, R0, R0 + CSEL CS, R5, R1, R1 + STP (R0, R1), 0(R8) + CSEL CS, R6, R2, R2 + CSEL CS, R7, R3, R3 + STP (R2, R3), 16(R8) + RET diff --git a/vendor/github.com/consensys/gnark-crypto/field/asm/element_6w/asm.go b/vendor/github.com/consensys/gnark-crypto/field/asm/element_6w/asm.go new file mode 100644 index 000000000..ab3498404 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/field/asm/element_6w/asm.go @@ -0,0 +1,14 @@ +// Package asm is a workaround to force go mod vendor to include the asm files +// see https://github.com/Consensys/gnark-crypto/issues/619 +package asm + +const DUMMY = 0 +const qInvNeg = 0 +const mu = 0 +const q = 0 +const q0 = 0 +const q1 = 0 +const q2 = 0 +const q3 = 0 +const q4 = 0 +const q5 = 0 diff --git a/vendor/github.com/consensys/gnark-crypto/field/asm/element_6w/element_6w_amd64.s b/vendor/github.com/consensys/gnark-crypto/field/asm/element_6w/element_6w_amd64.s new file mode 100644 index 000000000..fb907aee1 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/field/asm/element_6w/element_6w_amd64.s @@ -0,0 +1,668 @@ +// Code generated by gnark-crypto/generator. DO NOT EDIT. +#include "textflag.h" +#include "funcdata.h" +#include "go_asm.h" + +#define REDUCE(ra0, ra1, ra2, ra3, ra4, ra5, rb0, rb1, rb2, rb3, rb4, rb5, q0, q1, q2, q3, q4, q5) \ + MOVQ ra0, rb0; \ + SUBQ q0, ra0; \ + MOVQ ra1, rb1; \ + SBBQ q1, ra1; \ + MOVQ ra2, rb2; \ + SBBQ q2, ra2; \ + MOVQ ra3, rb3; \ + SBBQ q3, ra3; \ + MOVQ ra4, rb4; \ + SBBQ q4, ra4; \ + MOVQ ra5, rb5; \ + SBBQ q5, ra5; \ + CMOVQCS rb0, ra0; \ + CMOVQCS rb1, ra1; \ + CMOVQCS rb2, ra2; \ + CMOVQCS rb3, ra3; \ + CMOVQCS rb4, ra4; \ + CMOVQCS rb5, ra5; \ + +TEXT ·reduce(SB), NOSPLIT, $0-8 + MOVQ res+0(FP), AX + MOVQ 0(AX), DX + MOVQ 8(AX), CX + MOVQ 16(AX), BX + MOVQ 24(AX), SI + MOVQ 32(AX), DI + MOVQ 40(AX), R8 + + // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R9,R10,R11,R12,R13,R14) + REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB),·qElement+32(SB),·qElement+40(SB)) + + MOVQ DX, 0(AX) + MOVQ CX, 8(AX) + MOVQ BX, 16(AX) + MOVQ SI, 24(AX) + MOVQ DI, 32(AX) + MOVQ R8, 40(AX) + RET + +// MulBy3(x *Element) +TEXT ·MulBy3(SB), NOSPLIT, $0-8 + MOVQ x+0(FP), AX + MOVQ 0(AX), DX + MOVQ 8(AX), CX + MOVQ 16(AX), BX + MOVQ 24(AX), SI + MOVQ 32(AX), DI + MOVQ 40(AX), R8 + ADDQ DX, DX + ADCQ CX, CX + ADCQ BX, BX + ADCQ SI, SI + ADCQ DI, DI + ADCQ R8, R8 + + // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R9,R10,R11,R12,R13,R14) + REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB),·qElement+32(SB),·qElement+40(SB)) + + ADDQ 0(AX), DX + ADCQ 8(AX), CX + ADCQ 16(AX), BX + ADCQ 24(AX), SI + ADCQ 32(AX), DI + ADCQ 40(AX), R8 + + // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R9,R10,R11,R12,R13,R14) + REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB),·qElement+32(SB),·qElement+40(SB)) + + MOVQ DX, 0(AX) + MOVQ CX, 8(AX) + MOVQ BX, 16(AX) + MOVQ SI, 24(AX) + MOVQ DI, 32(AX) + MOVQ R8, 40(AX) + RET + +// MulBy5(x *Element) +TEXT ·MulBy5(SB), NOSPLIT, $0-8 + MOVQ x+0(FP), AX + MOVQ 0(AX), DX + MOVQ 8(AX), CX + MOVQ 16(AX), BX + MOVQ 24(AX), SI + MOVQ 32(AX), DI + MOVQ 40(AX), R8 + ADDQ DX, DX + ADCQ CX, CX + ADCQ BX, BX + ADCQ SI, SI + ADCQ DI, DI + ADCQ R8, R8 + + // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R9,R10,R11,R12,R13,R14) + REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB),·qElement+32(SB),·qElement+40(SB)) + + ADDQ DX, DX + ADCQ CX, CX + ADCQ BX, BX + ADCQ SI, SI + ADCQ DI, DI + ADCQ R8, R8 + + // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R9,R10,R11,R12,R13,R14) + REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB),·qElement+32(SB),·qElement+40(SB)) + + ADDQ 0(AX), DX + ADCQ 8(AX), CX + ADCQ 16(AX), BX + ADCQ 24(AX), SI + ADCQ 32(AX), DI + ADCQ 40(AX), R8 + + // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R9,R10,R11,R12,R13,R14) + REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB),·qElement+32(SB),·qElement+40(SB)) + + MOVQ DX, 0(AX) + MOVQ CX, 8(AX) + MOVQ BX, 16(AX) + MOVQ SI, 24(AX) + MOVQ DI, 32(AX) + MOVQ R8, 40(AX) + RET + +// MulBy13(x *Element) +TEXT ·MulBy13(SB), $48-8 + MOVQ x+0(FP), AX + MOVQ 0(AX), DX + MOVQ 8(AX), CX + MOVQ 16(AX), BX + MOVQ 24(AX), SI + MOVQ 32(AX), DI + MOVQ 40(AX), R8 + ADDQ DX, DX + ADCQ CX, CX + ADCQ BX, BX + ADCQ SI, SI + ADCQ DI, DI + ADCQ R8, R8 + + // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R9,R10,R11,R12,R13,R14) + REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB),·qElement+32(SB),·qElement+40(SB)) + + ADDQ DX, DX + ADCQ CX, CX + ADCQ BX, BX + ADCQ SI, SI + ADCQ DI, DI + ADCQ R8, R8 + + // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (s0-8(SP),s1-16(SP),s2-24(SP),s3-32(SP),s4-40(SP),s5-48(SP)) + REDUCE(DX,CX,BX,SI,DI,R8,s0-8(SP),s1-16(SP),s2-24(SP),s3-32(SP),s4-40(SP),s5-48(SP),·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB),·qElement+32(SB),·qElement+40(SB)) + + MOVQ DX, s0-8(SP) + MOVQ CX, s1-16(SP) + MOVQ BX, s2-24(SP) + MOVQ SI, s3-32(SP) + MOVQ DI, s4-40(SP) + MOVQ R8, s5-48(SP) + ADDQ DX, DX + ADCQ CX, CX + ADCQ BX, BX + ADCQ SI, SI + ADCQ DI, DI + ADCQ R8, R8 + + // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R9,R10,R11,R12,R13,R14) + REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB),·qElement+32(SB),·qElement+40(SB)) + + ADDQ s0-8(SP), DX + ADCQ s1-16(SP), CX + ADCQ s2-24(SP), BX + ADCQ s3-32(SP), SI + ADCQ s4-40(SP), DI + ADCQ s5-48(SP), R8 + + // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R9,R10,R11,R12,R13,R14) + REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB),·qElement+32(SB),·qElement+40(SB)) + + ADDQ 0(AX), DX + ADCQ 8(AX), CX + ADCQ 16(AX), BX + ADCQ 24(AX), SI + ADCQ 32(AX), DI + ADCQ 40(AX), R8 + + // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R9,R10,R11,R12,R13,R14) + REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB),·qElement+32(SB),·qElement+40(SB)) + + MOVQ DX, 0(AX) + MOVQ CX, 8(AX) + MOVQ BX, 16(AX) + MOVQ SI, 24(AX) + MOVQ DI, 32(AX) + MOVQ R8, 40(AX) + RET + +// Butterfly(a, b *Element) sets a = a + b; b = a - b +TEXT ·Butterfly(SB), $48-16 + MOVQ a+0(FP), R15 + MOVQ 0(R15), DX + MOVQ 8(R15), CX + MOVQ 16(R15), BX + MOVQ 24(R15), SI + MOVQ 32(R15), DI + MOVQ 40(R15), R8 + MOVQ DX, R9 + MOVQ CX, R10 + MOVQ BX, R11 + MOVQ SI, R12 + MOVQ DI, R13 + MOVQ R8, R14 + XORQ R15, R15 + MOVQ b+8(FP), AX + ADDQ 0(AX), DX + ADCQ 8(AX), CX + ADCQ 16(AX), BX + ADCQ 24(AX), SI + ADCQ 32(AX), DI + ADCQ 40(AX), R8 + SUBQ 0(AX), R9 + SBBQ 8(AX), R10 + SBBQ 16(AX), R11 + SBBQ 24(AX), R12 + SBBQ 32(AX), R13 + SBBQ 40(AX), R14 + MOVQ DX, s0-8(SP) + MOVQ CX, s1-16(SP) + MOVQ BX, s2-24(SP) + MOVQ SI, s3-32(SP) + MOVQ DI, s4-40(SP) + MOVQ R8, s5-48(SP) + MOVQ $const_q0, DX + MOVQ $const_q1, CX + MOVQ $const_q2, BX + MOVQ $const_q3, SI + MOVQ $const_q4, DI + MOVQ $const_q5, R8 + CMOVQCC R15, DX + CMOVQCC R15, CX + CMOVQCC R15, BX + CMOVQCC R15, SI + CMOVQCC R15, DI + CMOVQCC R15, R8 + ADDQ DX, R9 + ADCQ CX, R10 + ADCQ BX, R11 + ADCQ SI, R12 + ADCQ DI, R13 + ADCQ R8, R14 + MOVQ s0-8(SP), DX + MOVQ s1-16(SP), CX + MOVQ s2-24(SP), BX + MOVQ s3-32(SP), SI + MOVQ s4-40(SP), DI + MOVQ s5-48(SP), R8 + MOVQ R9, 0(AX) + MOVQ R10, 8(AX) + MOVQ R11, 16(AX) + MOVQ R12, 24(AX) + MOVQ R13, 32(AX) + MOVQ R14, 40(AX) + + // reduce element(DX,CX,BX,SI,DI,R8) using temp registers (R9,R10,R11,R12,R13,R14) + REDUCE(DX,CX,BX,SI,DI,R8,R9,R10,R11,R12,R13,R14,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB),·qElement+32(SB),·qElement+40(SB)) + + MOVQ a+0(FP), R15 + MOVQ DX, 0(R15) + MOVQ CX, 8(R15) + MOVQ BX, 16(R15) + MOVQ SI, 24(R15) + MOVQ DI, 32(R15) + MOVQ R8, 40(R15) + RET + +// mul(res, x, y *Element) +TEXT ·mul(SB), $24-24 + + // Algorithm 2 of "Faster Montgomery Multiplication and Multi-Scalar-Multiplication for SNARKS" + // by Y. El Housni and G. Botrel https://doi.org/10.46586/tches.v2023.i3.504-521 + // See github.com/Consensys/gnark-crypto/field/generator for more comments. + + NO_LOCAL_POINTERS + CMPB ·supportAdx(SB), $1 + JNE noAdx_1 + MOVQ x+8(FP), R8 + + // x[0] -> R10 + // x[1] -> R11 + MOVQ 0(R8), R10 + MOVQ 8(R8), R11 + MOVQ y+16(FP), R12 + + // A -> BP + // t[0] -> R14 + // t[1] -> R13 + // t[2] -> CX + // t[3] -> BX + // t[4] -> SI + // t[5] -> DI +#define MACC(in0, in1, in2) \ + ADCXQ in0, in1 \ + MULXQ in2, AX, in0 \ + ADOXQ AX, in1 \ + +#define DIV_SHIFT() \ + MOVQ $const_qInvNeg, DX \ + IMULQ R14, DX \ + XORQ AX, AX \ + MULXQ ·qElement+0(SB), AX, R9 \ + ADCXQ R14, AX \ + MOVQ R9, R14 \ + MACC(R13, R14, ·qElement+8(SB)) \ + MACC(CX, R13, ·qElement+16(SB)) \ + MACC(BX, CX, ·qElement+24(SB)) \ + MACC(SI, BX, ·qElement+32(SB)) \ + MACC(DI, SI, ·qElement+40(SB)) \ + MOVQ $0, AX \ + ADCXQ AX, DI \ + ADOXQ BP, DI \ + +#define MUL_WORD_0() \ + XORQ AX, AX \ + MULXQ R10, R14, R13 \ + MULXQ R11, AX, CX \ + ADOXQ AX, R13 \ + MULXQ 16(R8), AX, BX \ + ADOXQ AX, CX \ + MULXQ 24(R8), AX, SI \ + ADOXQ AX, BX \ + MULXQ 32(R8), AX, DI \ + ADOXQ AX, SI \ + MULXQ 40(R8), AX, BP \ + ADOXQ AX, DI \ + MOVQ $0, AX \ + ADOXQ AX, BP \ + DIV_SHIFT() \ + +#define MUL_WORD_N() \ + XORQ AX, AX \ + MULXQ R10, AX, BP \ + ADOXQ AX, R14 \ + MACC(BP, R13, R11) \ + MACC(BP, CX, 16(R8)) \ + MACC(BP, BX, 24(R8)) \ + MACC(BP, SI, 32(R8)) \ + MACC(BP, DI, 40(R8)) \ + MOVQ $0, AX \ + ADCXQ AX, BP \ + ADOXQ AX, BP \ + DIV_SHIFT() \ + + // mul body + MOVQ 0(R12), DX + MUL_WORD_0() + MOVQ 8(R12), DX + MUL_WORD_N() + MOVQ 16(R12), DX + MUL_WORD_N() + MOVQ 24(R12), DX + MUL_WORD_N() + MOVQ 32(R12), DX + MUL_WORD_N() + MOVQ 40(R12), DX + MUL_WORD_N() + + // reduce element(R14,R13,CX,BX,SI,DI) using temp registers (R9,R8,R12,R10,R11,AX) + REDUCE(R14,R13,CX,BX,SI,DI,R9,R8,R12,R10,R11,AX,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB),·qElement+32(SB),·qElement+40(SB)) + + MOVQ res+0(FP), AX + MOVQ R14, 0(AX) + MOVQ R13, 8(AX) + MOVQ CX, 16(AX) + MOVQ BX, 24(AX) + MOVQ SI, 32(AX) + MOVQ DI, 40(AX) + RET + +noAdx_1: + MOVQ res+0(FP), AX + MOVQ AX, (SP) + MOVQ x+8(FP), AX + MOVQ AX, 8(SP) + MOVQ y+16(FP), AX + MOVQ AX, 16(SP) + CALL ·_mulGeneric(SB) + RET + +TEXT ·fromMont(SB), $8-8 + NO_LOCAL_POINTERS + + // Algorithm 2 of "Faster Montgomery Multiplication and Multi-Scalar-Multiplication for SNARKS" + // by Y. El Housni and G. Botrel https://doi.org/10.46586/tches.v2023.i3.504-521 + // when y = 1 we have: + // for i=0 to N-1 + // t[i] = x[i] + // for i=0 to N-1 + // m := t[0]*q'[0] mod W + // C,_ := t[0] + m*q[0] + // for j=1 to N-1 + // (C,t[j-1]) := t[j] + m*q[j] + C + // t[N-1] = C + CMPB ·supportAdx(SB), $1 + JNE noAdx_2 + MOVQ res+0(FP), DX + MOVQ 0(DX), R13 + MOVQ 8(DX), R14 + MOVQ 16(DX), CX + MOVQ 24(DX), BX + MOVQ 32(DX), SI + MOVQ 40(DX), DI + XORQ DX, DX + + // m := t[0]*q'[0] mod W + MOVQ $const_qInvNeg, DX + IMULQ R13, DX + XORQ AX, AX + + // C,_ := t[0] + m*q[0] + MULXQ ·qElement+0(SB), AX, BP + ADCXQ R13, AX + MOVQ BP, R13 + + // (C,t[0]) := t[1] + m*q[1] + C + ADCXQ R14, R13 + MULXQ ·qElement+8(SB), AX, R14 + ADOXQ AX, R13 + + // (C,t[1]) := t[2] + m*q[2] + C + ADCXQ CX, R14 + MULXQ ·qElement+16(SB), AX, CX + ADOXQ AX, R14 + + // (C,t[2]) := t[3] + m*q[3] + C + ADCXQ BX, CX + MULXQ ·qElement+24(SB), AX, BX + ADOXQ AX, CX + + // (C,t[3]) := t[4] + m*q[4] + C + ADCXQ SI, BX + MULXQ ·qElement+32(SB), AX, SI + ADOXQ AX, BX + + // (C,t[4]) := t[5] + m*q[5] + C + ADCXQ DI, SI + MULXQ ·qElement+40(SB), AX, DI + ADOXQ AX, SI + MOVQ $0, AX + ADCXQ AX, DI + ADOXQ AX, DI + XORQ DX, DX + + // m := t[0]*q'[0] mod W + MOVQ $const_qInvNeg, DX + IMULQ R13, DX + XORQ AX, AX + + // C,_ := t[0] + m*q[0] + MULXQ ·qElement+0(SB), AX, BP + ADCXQ R13, AX + MOVQ BP, R13 + + // (C,t[0]) := t[1] + m*q[1] + C + ADCXQ R14, R13 + MULXQ ·qElement+8(SB), AX, R14 + ADOXQ AX, R13 + + // (C,t[1]) := t[2] + m*q[2] + C + ADCXQ CX, R14 + MULXQ ·qElement+16(SB), AX, CX + ADOXQ AX, R14 + + // (C,t[2]) := t[3] + m*q[3] + C + ADCXQ BX, CX + MULXQ ·qElement+24(SB), AX, BX + ADOXQ AX, CX + + // (C,t[3]) := t[4] + m*q[4] + C + ADCXQ SI, BX + MULXQ ·qElement+32(SB), AX, SI + ADOXQ AX, BX + + // (C,t[4]) := t[5] + m*q[5] + C + ADCXQ DI, SI + MULXQ ·qElement+40(SB), AX, DI + ADOXQ AX, SI + MOVQ $0, AX + ADCXQ AX, DI + ADOXQ AX, DI + XORQ DX, DX + + // m := t[0]*q'[0] mod W + MOVQ $const_qInvNeg, DX + IMULQ R13, DX + XORQ AX, AX + + // C,_ := t[0] + m*q[0] + MULXQ ·qElement+0(SB), AX, BP + ADCXQ R13, AX + MOVQ BP, R13 + + // (C,t[0]) := t[1] + m*q[1] + C + ADCXQ R14, R13 + MULXQ ·qElement+8(SB), AX, R14 + ADOXQ AX, R13 + + // (C,t[1]) := t[2] + m*q[2] + C + ADCXQ CX, R14 + MULXQ ·qElement+16(SB), AX, CX + ADOXQ AX, R14 + + // (C,t[2]) := t[3] + m*q[3] + C + ADCXQ BX, CX + MULXQ ·qElement+24(SB), AX, BX + ADOXQ AX, CX + + // (C,t[3]) := t[4] + m*q[4] + C + ADCXQ SI, BX + MULXQ ·qElement+32(SB), AX, SI + ADOXQ AX, BX + + // (C,t[4]) := t[5] + m*q[5] + C + ADCXQ DI, SI + MULXQ ·qElement+40(SB), AX, DI + ADOXQ AX, SI + MOVQ $0, AX + ADCXQ AX, DI + ADOXQ AX, DI + XORQ DX, DX + + // m := t[0]*q'[0] mod W + MOVQ $const_qInvNeg, DX + IMULQ R13, DX + XORQ AX, AX + + // C,_ := t[0] + m*q[0] + MULXQ ·qElement+0(SB), AX, BP + ADCXQ R13, AX + MOVQ BP, R13 + + // (C,t[0]) := t[1] + m*q[1] + C + ADCXQ R14, R13 + MULXQ ·qElement+8(SB), AX, R14 + ADOXQ AX, R13 + + // (C,t[1]) := t[2] + m*q[2] + C + ADCXQ CX, R14 + MULXQ ·qElement+16(SB), AX, CX + ADOXQ AX, R14 + + // (C,t[2]) := t[3] + m*q[3] + C + ADCXQ BX, CX + MULXQ ·qElement+24(SB), AX, BX + ADOXQ AX, CX + + // (C,t[3]) := t[4] + m*q[4] + C + ADCXQ SI, BX + MULXQ ·qElement+32(SB), AX, SI + ADOXQ AX, BX + + // (C,t[4]) := t[5] + m*q[5] + C + ADCXQ DI, SI + MULXQ ·qElement+40(SB), AX, DI + ADOXQ AX, SI + MOVQ $0, AX + ADCXQ AX, DI + ADOXQ AX, DI + XORQ DX, DX + + // m := t[0]*q'[0] mod W + MOVQ $const_qInvNeg, DX + IMULQ R13, DX + XORQ AX, AX + + // C,_ := t[0] + m*q[0] + MULXQ ·qElement+0(SB), AX, BP + ADCXQ R13, AX + MOVQ BP, R13 + + // (C,t[0]) := t[1] + m*q[1] + C + ADCXQ R14, R13 + MULXQ ·qElement+8(SB), AX, R14 + ADOXQ AX, R13 + + // (C,t[1]) := t[2] + m*q[2] + C + ADCXQ CX, R14 + MULXQ ·qElement+16(SB), AX, CX + ADOXQ AX, R14 + + // (C,t[2]) := t[3] + m*q[3] + C + ADCXQ BX, CX + MULXQ ·qElement+24(SB), AX, BX + ADOXQ AX, CX + + // (C,t[3]) := t[4] + m*q[4] + C + ADCXQ SI, BX + MULXQ ·qElement+32(SB), AX, SI + ADOXQ AX, BX + + // (C,t[4]) := t[5] + m*q[5] + C + ADCXQ DI, SI + MULXQ ·qElement+40(SB), AX, DI + ADOXQ AX, SI + MOVQ $0, AX + ADCXQ AX, DI + ADOXQ AX, DI + XORQ DX, DX + + // m := t[0]*q'[0] mod W + MOVQ $const_qInvNeg, DX + IMULQ R13, DX + XORQ AX, AX + + // C,_ := t[0] + m*q[0] + MULXQ ·qElement+0(SB), AX, BP + ADCXQ R13, AX + MOVQ BP, R13 + + // (C,t[0]) := t[1] + m*q[1] + C + ADCXQ R14, R13 + MULXQ ·qElement+8(SB), AX, R14 + ADOXQ AX, R13 + + // (C,t[1]) := t[2] + m*q[2] + C + ADCXQ CX, R14 + MULXQ ·qElement+16(SB), AX, CX + ADOXQ AX, R14 + + // (C,t[2]) := t[3] + m*q[3] + C + ADCXQ BX, CX + MULXQ ·qElement+24(SB), AX, BX + ADOXQ AX, CX + + // (C,t[3]) := t[4] + m*q[4] + C + ADCXQ SI, BX + MULXQ ·qElement+32(SB), AX, SI + ADOXQ AX, BX + + // (C,t[4]) := t[5] + m*q[5] + C + ADCXQ DI, SI + MULXQ ·qElement+40(SB), AX, DI + ADOXQ AX, SI + MOVQ $0, AX + ADCXQ AX, DI + ADOXQ AX, DI + + // reduce element(R13,R14,CX,BX,SI,DI) using temp registers (R8,R9,R10,R11,R12,DX) + REDUCE(R13,R14,CX,BX,SI,DI,R8,R9,R10,R11,R12,DX,·qElement+0(SB),·qElement+8(SB),·qElement+16(SB),·qElement+24(SB),·qElement+32(SB),·qElement+40(SB)) + + MOVQ res+0(FP), AX + MOVQ R13, 0(AX) + MOVQ R14, 8(AX) + MOVQ CX, 16(AX) + MOVQ BX, 24(AX) + MOVQ SI, 32(AX) + MOVQ DI, 40(AX) + RET + +noAdx_2: + MOVQ res+0(FP), AX + MOVQ AX, (SP) + CALL ·_fromMontGeneric(SB) + RET diff --git a/vendor/github.com/consensys/gnark-crypto/field/asm/element_6w/element_6w_arm64.s b/vendor/github.com/consensys/gnark-crypto/field/asm/element_6w/element_6w_arm64.s new file mode 100644 index 000000000..7dbd7ecaf --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/field/asm/element_6w/element_6w_arm64.s @@ -0,0 +1,220 @@ +// Code generated by gnark-crypto/generator. DO NOT EDIT. +#include "textflag.h" +#include "funcdata.h" +#include "go_asm.h" + +// butterfly(a, b *Element) +// a, b = a+b, a-b +TEXT ·Butterfly(SB), NOFRAME|NOSPLIT, $0-16 + LDP x+0(FP), (R25, R26) + LDP 0(R25), (R0, R1) + LDP 16(R25), (R2, R3) + LDP 32(R25), (R4, R5) + LDP 0(R26), (R6, R7) + LDP 16(R26), (R8, R9) + LDP 32(R26), (R10, R11) + ADDS R0, R6, R12 + ADCS R1, R7, R13 + ADCS R2, R8, R14 + ADCS R3, R9, R15 + ADCS R4, R10, R16 + ADC R5, R11, R17 + SUBS R6, R0, R6 + SBCS R7, R1, R7 + SBCS R8, R2, R8 + SBCS R9, R3, R9 + SBCS R10, R4, R10 + SBCS R11, R5, R11 + LDP ·qElement+0(SB), (R0, R1) + CSEL CS, ZR, R0, R19 + CSEL CS, ZR, R1, R20 + LDP ·qElement+16(SB), (R2, R3) + CSEL CS, ZR, R2, R21 + CSEL CS, ZR, R3, R22 + LDP ·qElement+32(SB), (R4, R5) + CSEL CS, ZR, R4, R23 + CSEL CS, ZR, R5, R24 + + // add q if underflow, 0 if not + ADDS R6, R19, R6 + ADCS R7, R20, R7 + STP (R6, R7), 0(R26) + ADCS R8, R21, R8 + ADCS R9, R22, R9 + STP (R8, R9), 16(R26) + ADCS R10, R23, R10 + ADC R11, R24, R11 + STP (R10, R11), 32(R26) + + // q = t - q + SUBS R0, R12, R0 + SBCS R1, R13, R1 + SBCS R2, R14, R2 + SBCS R3, R15, R3 + SBCS R4, R16, R4 + SBCS R5, R17, R5 + + // if no borrow, return q, else return t + CSEL CS, R0, R12, R12 + CSEL CS, R1, R13, R13 + STP (R12, R13), 0(R25) + CSEL CS, R2, R14, R14 + CSEL CS, R3, R15, R15 + STP (R14, R15), 16(R25) + CSEL CS, R4, R16, R16 + CSEL CS, R5, R17, R17 + STP (R16, R17), 32(R25) + RET + +// mul(res, x, y *Element) +// Algorithm 2 of Faster Montgomery Multiplication and Multi-Scalar-Multiplication for SNARKS +// by Y. El Housni and G. Botrel https://doi.org/10.46586/tches.v2023.i3.504-521 +TEXT ·mul(SB), NOFRAME|NOSPLIT, $0-24 +#define DIVSHIFT() \ + MUL R17, R16, R0 \ + ADDS R0, R8, R8 \ + MUL R19, R16, R0 \ + ADCS R0, R9, R9 \ + MUL R20, R16, R0 \ + ADCS R0, R10, R10 \ + MUL R21, R16, R0 \ + ADCS R0, R11, R11 \ + MUL R22, R16, R0 \ + ADCS R0, R12, R12 \ + MUL R23, R16, R0 \ + ADCS R0, R13, R13 \ + ADC R14, ZR, R14 \ + UMULH R17, R16, R0 \ + ADDS R0, R9, R8 \ + UMULH R19, R16, R0 \ + ADCS R0, R10, R9 \ + UMULH R20, R16, R0 \ + ADCS R0, R11, R10 \ + UMULH R21, R16, R0 \ + ADCS R0, R12, R11 \ + UMULH R22, R16, R0 \ + ADCS R0, R13, R12 \ + UMULH R23, R16, R0 \ + ADCS R0, R14, R13 \ + +#define MUL_WORD_N() \ + MUL R2, R1, R0 \ + ADDS R0, R8, R8 \ + MUL R8, R15, R16 \ + MUL R3, R1, R0 \ + ADCS R0, R9, R9 \ + MUL R4, R1, R0 \ + ADCS R0, R10, R10 \ + MUL R5, R1, R0 \ + ADCS R0, R11, R11 \ + MUL R6, R1, R0 \ + ADCS R0, R12, R12 \ + MUL R7, R1, R0 \ + ADCS R0, R13, R13 \ + ADC ZR, ZR, R14 \ + UMULH R2, R1, R0 \ + ADDS R0, R9, R9 \ + UMULH R3, R1, R0 \ + ADCS R0, R10, R10 \ + UMULH R4, R1, R0 \ + ADCS R0, R11, R11 \ + UMULH R5, R1, R0 \ + ADCS R0, R12, R12 \ + UMULH R6, R1, R0 \ + ADCS R0, R13, R13 \ + UMULH R7, R1, R0 \ + ADC R0, R14, R14 \ + DIVSHIFT() \ + +#define MUL_WORD_0() \ + MUL R2, R1, R8 \ + MUL R3, R1, R9 \ + MUL R4, R1, R10 \ + MUL R5, R1, R11 \ + MUL R6, R1, R12 \ + MUL R7, R1, R13 \ + UMULH R2, R1, R0 \ + ADDS R0, R9, R9 \ + UMULH R3, R1, R0 \ + ADCS R0, R10, R10 \ + UMULH R4, R1, R0 \ + ADCS R0, R11, R11 \ + UMULH R5, R1, R0 \ + ADCS R0, R12, R12 \ + UMULH R6, R1, R0 \ + ADCS R0, R13, R13 \ + UMULH R7, R1, R0 \ + ADC R0, ZR, R14 \ + MUL R8, R15, R16 \ + DIVSHIFT() \ + + MOVD y+16(FP), R24 + MOVD x+8(FP), R0 + LDP 0(R0), (R2, R3) + LDP 16(R0), (R4, R5) + LDP 32(R0), (R6, R7) + MOVD 0(R24), R1 + MOVD $const_qInvNeg, R15 + LDP ·qElement+0(SB), (R17, R19) + LDP ·qElement+16(SB), (R20, R21) + LDP ·qElement+32(SB), (R22, R23) + MUL_WORD_0() + MOVD 8(R24), R1 + MUL_WORD_N() + MOVD 16(R24), R1 + MUL_WORD_N() + MOVD 24(R24), R1 + MUL_WORD_N() + MOVD 32(R24), R1 + MUL_WORD_N() + MOVD 40(R24), R1 + MUL_WORD_N() + + // reduce if necessary + SUBS R17, R8, R17 + SBCS R19, R9, R19 + SBCS R20, R10, R20 + SBCS R21, R11, R21 + SBCS R22, R12, R22 + SBCS R23, R13, R23 + MOVD res+0(FP), R0 + CSEL CS, R17, R8, R8 + CSEL CS, R19, R9, R9 + STP (R8, R9), 0(R0) + CSEL CS, R20, R10, R10 + CSEL CS, R21, R11, R11 + STP (R10, R11), 16(R0) + CSEL CS, R22, R12, R12 + CSEL CS, R23, R13, R13 + STP (R12, R13), 32(R0) + RET + +// reduce(res *Element) +TEXT ·reduce(SB), NOFRAME|NOSPLIT, $0-8 + LDP ·qElement+0(SB), (R6, R7) + LDP ·qElement+16(SB), (R8, R9) + LDP ·qElement+32(SB), (R10, R11) + MOVD res+0(FP), R12 + LDP 0(R12), (R0, R1) + LDP 16(R12), (R2, R3) + LDP 32(R12), (R4, R5) + + // q = t - q + SUBS R6, R0, R6 + SBCS R7, R1, R7 + SBCS R8, R2, R8 + SBCS R9, R3, R9 + SBCS R10, R4, R10 + SBCS R11, R5, R11 + + // if no borrow, return q, else return t + CSEL CS, R6, R0, R0 + CSEL CS, R7, R1, R1 + STP (R0, R1), 0(R12) + CSEL CS, R8, R2, R2 + CSEL CS, R9, R3, R3 + STP (R2, R3), 16(R12) + CSEL CS, R10, R4, R4 + CSEL CS, R11, R5, R5 + STP (R4, R5), 32(R12) + RET diff --git a/vendor/github.com/consensys/gnark-crypto/field/generator/config/extension.go b/vendor/github.com/consensys/gnark-crypto/field/generator/config/extension.go deleted file mode 100644 index 53221f89c..000000000 --- a/vendor/github.com/consensys/gnark-crypto/field/generator/config/extension.go +++ /dev/null @@ -1,244 +0,0 @@ -package config - -import "math/big" - -type Element []big.Int - -// Extension is a simple radical extension, obtained by adjoining ⁿ√α to Fp -type Extension struct { - Base *FieldConfig //Fp - Size big.Int //q - Degree int //n such that q = pⁿ TODO: Make uint8 so forced to be positive and small - RootOf int64 //α -} - -func NewTower(base *FieldConfig, degree uint8, rootOf int64) Extension { - ret := Extension{ - Degree: int(degree), - RootOf: rootOf, - Base: base, - } - ret.Size.Exp(base.ModulusBig, big.NewInt(int64(degree)), nil) - return ret -} - -func (f *Extension) FromInt64(i ...int64) Element { - z := make(Element, f.Degree) - for n := 0; n < len(i) && n < int(f.Degree); n++ { - z[n].SetInt64(i[n]) - } - return z -} - -func (f *Extension) Neg(x Element) Element { - z := make(Element, len(x)) - for n := 0; n < len(x); n++ { - z[n].Neg(&x[n]) - } - return z -} - -func max(x int, y int) int { - if x > y { - return x - } - return y -} - -func (f *Extension) Add(x Element, y Element) Element { - z := make(Element, f.Degree) - - for i := 0; i < f.Degree; i++ { - z[i]. - Add(&x[i], &y[i]). - Mod(&z[i], f.Base.ModulusBig) - } - return z -} - -func (f *Extension) Mul(x Element, y Element) Element { - z := make(Element, f.Degree) - maxP := len(x) + len(y) - 2 - alpha := big.NewInt(f.RootOf) - - for p := maxP; p >= 0; p-- { - - var rp big.Int - - for m := max(p-(len(y)-1), 0); m < len(x) && m <= p; m++ { - n := p - m - var prod big.Int - prod.Mul(&x[m], &y[n]) - rp.Add(&rp, &prod) - } - - rI := p % int(f.Degree) //reduced index - - z[rI].Add(&z[rI], &rp).Mod(&z[rI], f.Base.ModulusBig) - - if p >= int(f.Degree) { - z[rI].Mul(&z[rI], alpha) - } - } - - return z -} - -func (f *Extension) MulScalar(c *big.Int, x Element) Element { - z := make(Element, len(x)) - for i := 0; i < len(x); i++ { - f.Base.Mul(&z[i], c, &x[i]) - } - return z -} - -func (f *Extension) Halve(z Element) { - for i := 0; i < len(z); i++ { - if z[i].Bit(0) != 0 { - z[i].Add(&z[i], f.Base.ModulusBig) - } - z[i].Rsh(&z[i], 1) - } -} - -func (f *Extension) reduce(z Element) { - for i := 0; i < len(z); i++ { - z[i].Mod(&z[i], f.Base.ModulusBig) - } -} - -// Sqrt returning √ x, or nil if x is not qr. -func (f *Extension) Sqrt(x Element) Element { - - z := make(Element, f.Degree) - switch f.Degree { - case 1: - if z[0].ModSqrt(&x[0], f.Base.ModulusBig) == nil { - return nil - } - case 2: - // z = z₀ + z₁ i - - if x[0].BitLen() == 0 { - z[1].ModInverse(big.NewInt(f.RootOf), f.Base.ModulusBig).Mul(&z[1], &x[1]) - } - - var discriminant big.Int - z[0].Mul(&x[0], &x[0]) - z[1].Mul(&x[1], &x[1]).Mul(&z[1], big.NewInt(-f.RootOf)) - z[0].Sub(&z[0], &z[1]) - if discriminant.ModSqrt(&z[0], f.Base.ModulusBig) == nil { - return nil - } - z[0].Add(&x[0], &discriminant) - f.Base.halve(&z[0], &z[0]) - if z[0].ModSqrt(&z[0], f.Base.ModulusBig) == nil { - z[0].Sub(&z[0], &discriminant) - if z[0].ModSqrt(&z[0], f.Base.ModulusBig) == nil { - return nil - } - } - z[1].Lsh(&z[0], 1).ModInverse(&z[1], f.Base.ModulusBig).Mul(&z[1], &x[1]) - - default: - panic("only degrees 1 and 2 are supported") - } - - f.reduce(z) - return z -} - -func (f *Extension) ToMont(x Element) Element { - z := make([]big.Int, len(x)) - for i := 0; i < len(x); i++ { - z[i] = f.Base.ToMont(x[i]) - } - return z -} - -func (f *Extension) Equal(x Element, y Element) bool { - if len(x) != len(y) { - return false - } - for i := 0; i < len(x); i++ { - var diff big.Int - if diff.Sub(&x[i], &y[i]).Mod(&diff, f.Base.ModulusBig).BitLen() != 0 { - return false - } - } - return true -} - -func (f *Extension) norm(z *big.Int, x Element) *Extension { - if f.Degree != 2 { - panic("only degree 2 supported") - } - var x0Sq big.Int - - x0Sq.Mul(&x[0], &x[0]) - - res := big.NewInt(-f.RootOf) - res.Mul(res, &x[1]).Mul(res, &x[1]).Add(res, &x0Sq) - - z.Set(res) - - return f -} - -func (f *Extension) Inverse(x Element) Element { - z := make(Element, f.Degree) - switch f.Degree { - case 1: - z[0].ModInverse(&x[0], f.Base.ModulusBig) - case 2: - var normInv big.Int - f.norm(&normInv, x) - normInv.ModInverse(&normInv, f.Base.ModulusBig) - z[0].Mul(&x[0], &normInv) - - z[1].Neg(&x[1]).Mul(&z[1], &normInv) - default: - panic("can't invert in extensions of degree > 2") - } - return z -} - -func (f *Extension) Exp(x Element, exp *big.Int) Element { - - if exp.BitLen() == 0 { - return f.FromInt64(1) - } - - z := x - - for i := exp.BitLen() - 2; i >= 0; i-- { - z = f.Mul(z, z) - if exp.Bit(i) == 1 { - z = f.Mul(z, x) - } - } - - return z -} - -// Div returns u/v -func (f *Extension) Div(u, v Element) Element { - return f.Mul(u, f.Inverse(v)) -} - -func (f *Extension) IsZero(u Element) bool { - for i := 0; i < len(u); i++ { - if u[i].BitLen() != 0 { - return false - } - } - return true -} - -func NewElement(s []string) []big.Int { - res := make([]big.Int, len(s)) - for i, S := range s { - res[i].SetString(S, 0) - } - return res -} diff --git a/vendor/github.com/consensys/gnark-crypto/field/generator/config/field_config.go b/vendor/github.com/consensys/gnark-crypto/field/generator/config/field_config.go deleted file mode 100644 index 457a89d7d..000000000 --- a/vendor/github.com/consensys/gnark-crypto/field/generator/config/field_config.go +++ /dev/null @@ -1,434 +0,0 @@ -// Copyright 2020 ConsenSys Software 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 config provides Golang code generation for efficient field arithmetic operations. -package config - -import ( - "errors" - "fmt" - "math" - "math/big" - "strconv" - "strings" - - "github.com/consensys/bavard" - "github.com/consensys/gnark-crypto/field/generator/internal/addchain" -) - -var ( - errParseModulus = errors.New("can't parse modulus") -) - -// FieldConfig precomputed values used in template for code generation of field element APIs -type FieldConfig struct { - PackageName string - ElementName string - ModulusBig *big.Int - Modulus string - ModulusHex string - NbWords int - NbBits int - NbBytes int - NbWordsLastIndex int - NbWordsIndexesNoZero []int - NbWordsIndexesFull []int - P20InversionCorrectiveFac []uint64 - P20InversionNbIterations int - UsingP20Inverse bool - IsMSWSaturated bool // indicates if the most significant word is 0xFFFFF...FFFF - Q []uint64 - QInverse []uint64 - QMinusOneHalvedP []uint64 // ((q-1) / 2 ) + 1 - ASM bool - RSquare []uint64 - One, Thirteen []uint64 - LegendreExponent string // big.Int to base16 string - NoCarry bool - NoCarrySquare bool // used if NoCarry is set, but some op may overflow in square optimization - SqrtQ3Mod4 bool - SqrtAtkin bool - SqrtTonelliShanks bool - SqrtE uint64 - SqrtS []uint64 - SqrtAtkinExponent string // big.Int to base16 string - SqrtSMinusOneOver2 string // big.Int to base16 string - SqrtQ3Mod4Exponent string // big.Int to base16 string - SqrtG []uint64 // NonResidue ^ SqrtR (montgomery form) - NonResidue big.Int // (montgomery form) - LegendreExponentData *addchain.AddChainData - SqrtAtkinExponentData *addchain.AddChainData - SqrtSMinusOneOver2Data *addchain.AddChainData - SqrtQ3Mod4ExponentData *addchain.AddChainData - UseAddChain bool -} - -// NewFieldConfig returns a data structure with needed information to generate apis for field element -// -// See field/generator package -func NewFieldConfig(packageName, elementName, modulus string, useAddChain bool) (*FieldConfig, error) { - // parse modulus - var bModulus big.Int - if _, ok := bModulus.SetString(modulus, 0); !ok { - return nil, errParseModulus - } - - // field info - F := &FieldConfig{ - PackageName: packageName, - ElementName: elementName, - Modulus: bModulus.Text(10), - ModulusHex: bModulus.Text(16), - ModulusBig: new(big.Int).Set(&bModulus), - UseAddChain: useAddChain, - } - // pre compute field constants - F.NbBits = bModulus.BitLen() - F.NbWords = len(bModulus.Bits()) - F.NbBytes = F.NbWords * 8 // (F.NbBits + 7) / 8 - - F.NbWordsLastIndex = F.NbWords - 1 - - // set q from big int repr - F.Q = toUint64Slice(&bModulus) - F.IsMSWSaturated = F.Q[len(F.Q)-1] == math.MaxUint64 - _qHalved := big.NewInt(0) - bOne := new(big.Int).SetUint64(1) - _qHalved.Sub(&bModulus, bOne).Rsh(_qHalved, 1).Add(_qHalved, bOne) - F.QMinusOneHalvedP = toUint64Slice(_qHalved, F.NbWords) - - // setting qInverse - _r := big.NewInt(1) - _r.Lsh(_r, uint(F.NbWords)*64) - _rInv := big.NewInt(1) - _qInv := big.NewInt(0) - extendedEuclideanAlgo(_r, &bModulus, _rInv, _qInv) - _qInv.Mod(_qInv, _r) - F.QInverse = toUint64Slice(_qInv, F.NbWords) - - // Pornin20 inversion correction factors - k := 32 // Optimized for 64 bit machines, still works for 32 - - p20InvInnerLoopNbIterations := 2*F.NbBits - 1 - // if constant time inversion then p20InvInnerLoopNbIterations-- (among other changes) - F.P20InversionNbIterations = (p20InvInnerLoopNbIterations-1)/(k-1) + 1 // ⌈ (2 * field size - 1) / (k-1) ⌉ - F.P20InversionNbIterations += F.P20InversionNbIterations % 2 // "round up" to a multiple of 2 - - kLimbs := k * F.NbWords - p20InversionCorrectiveFacPower := kLimbs*6 + F.P20InversionNbIterations*(kLimbs-k+1) - p20InversionCorrectiveFac := big.NewInt(1) - p20InversionCorrectiveFac.Lsh(p20InversionCorrectiveFac, uint(p20InversionCorrectiveFacPower)) - p20InversionCorrectiveFac.Mod(p20InversionCorrectiveFac, &bModulus) - F.P20InversionCorrectiveFac = toUint64Slice(p20InversionCorrectiveFac, F.NbWords) - - { - c := F.NbWords * 64 - F.UsingP20Inverse = F.NbWords > 1 && F.NbBits < c - } - - // rsquare - _rSquare := big.NewInt(2) - exponent := big.NewInt(int64(F.NbWords) * 64 * 2) - _rSquare.Exp(_rSquare, exponent, &bModulus) - F.RSquare = toUint64Slice(_rSquare, F.NbWords) - - var one big.Int - one.SetUint64(1) - one.Lsh(&one, uint(F.NbWords)*64).Mod(&one, &bModulus) - F.One = toUint64Slice(&one, F.NbWords) - - { - var n big.Int - n.SetUint64(13) - n.Lsh(&n, uint(F.NbWords)*64).Mod(&n, &bModulus) - F.Thirteen = toUint64Slice(&n, F.NbWords) - } - - // indexes (template helpers) - F.NbWordsIndexesFull = make([]int, F.NbWords) - F.NbWordsIndexesNoZero = make([]int, F.NbWords-1) - for i := 0; i < F.NbWords; i++ { - F.NbWordsIndexesFull[i] = i - if i > 0 { - F.NbWordsIndexesNoZero[i-1] = i - } - } - - // See https://hackmd.io/@gnark/modular_multiplication - // if the last word of the modulus is smaller or equal to B, - // we can simplify the montgomery multiplication - const B = (^uint64(0) >> 1) - 1 - F.NoCarry = (F.Q[len(F.Q)-1] <= B) && F.NbWords <= 12 - const BSquare = ^uint64(0) >> 2 - F.NoCarrySquare = F.Q[len(F.Q)-1] <= BSquare - - // Legendre exponent (p-1)/2 - var legendreExponent big.Int - legendreExponent.SetUint64(1) - legendreExponent.Sub(&bModulus, &legendreExponent) - legendreExponent.Rsh(&legendreExponent, 1) - F.LegendreExponent = legendreExponent.Text(16) - if F.UseAddChain { - F.LegendreExponentData = addchain.GetAddChain(&legendreExponent) - } - - // Sqrt pre computes - var qMod big.Int - qMod.SetUint64(4) - if qMod.Mod(&bModulus, &qMod).Cmp(new(big.Int).SetUint64(3)) == 0 { - // q ≡ 3 (mod 4) - // using z ≡ ± x^((p+1)/4) (mod q) - F.SqrtQ3Mod4 = true - var sqrtExponent big.Int - sqrtExponent.SetUint64(1) - sqrtExponent.Add(&bModulus, &sqrtExponent) - sqrtExponent.Rsh(&sqrtExponent, 2) - F.SqrtQ3Mod4Exponent = sqrtExponent.Text(16) - - // add chain stuff - if F.UseAddChain { - F.SqrtQ3Mod4ExponentData = addchain.GetAddChain(&sqrtExponent) - } - - } else { - // q ≡ 1 (mod 4) - qMod.SetUint64(8) - if qMod.Mod(&bModulus, &qMod).Cmp(new(big.Int).SetUint64(5)) == 0 { - // q ≡ 5 (mod 8) - // use Atkin's algorithm - // see modSqrt5Mod8Prime in math/big/int.go - F.SqrtAtkin = true - e := new(big.Int).Rsh(&bModulus, 3) // e = (q - 5) / 8 - F.SqrtAtkinExponent = e.Text(16) - if F.UseAddChain { - F.SqrtAtkinExponentData = addchain.GetAddChain(e) - } - } else { - // use Tonelli-Shanks - F.SqrtTonelliShanks = true - - // Write q-1 =2ᵉ * s , s odd - var s big.Int - one.SetUint64(1) - s.Sub(&bModulus, &one) - - e := s.TrailingZeroBits() - s.Rsh(&s, e) - F.SqrtE = uint64(e) - F.SqrtS = toUint64Slice(&s) - - // find non residue - var nonResidue big.Int - nonResidue.SetInt64(2) - one.SetUint64(1) - for big.Jacobi(&nonResidue, &bModulus) != -1 { - nonResidue.Add(&nonResidue, &one) - } - - // g = nonresidue ^ s - var g big.Int - g.Exp(&nonResidue, &s, &bModulus) - // store g in montgomery form - g.Lsh(&g, uint(F.NbWords)*64).Mod(&g, &bModulus) - F.SqrtG = toUint64Slice(&g, F.NbWords) - - // store non residue in montgomery form - F.NonResidue = F.ToMont(nonResidue) - - // (s+1) /2 - s.Sub(&s, &one).Rsh(&s, 1) - F.SqrtSMinusOneOver2 = s.Text(16) - - if F.UseAddChain { - F.SqrtSMinusOneOver2Data = addchain.GetAddChain(&s) - } - } - } - - // note: to simplify output files generated, we generated ASM code only for - // moduli that meet the condition F.NoCarry - // asm code generation for moduli with more than 6 words can be optimized further - F.ASM = F.NoCarry && F.NbWords <= 12 && F.NbWords > 1 - - return F, nil -} - -func toUint64Slice(b *big.Int, nbWords ...int) (s []uint64) { - if len(nbWords) > 0 && nbWords[0] > len(b.Bits()) { - s = make([]uint64, nbWords[0]) - } else { - s = make([]uint64, len(b.Bits())) - } - - for i, v := range b.Bits() { - s[i] = (uint64)(v) - } - return -} - -// https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm -// r > q, modifies rinv and qinv such that rinv.r - qinv.q = 1 -func extendedEuclideanAlgo(r, q, rInv, qInv *big.Int) { - var s1, s2, t1, t2, qi, tmpMuls, riPlusOne, tmpMult, a, b big.Int - t1.SetUint64(1) - rInv.Set(big.NewInt(1)) - qInv.Set(big.NewInt(0)) - a.Set(r) - b.Set(q) - - // r_i+1 = r_i-1 - q_i.r_i - // s_i+1 = s_i-1 - q_i.s_i - // t_i+1 = t_i-1 - q_i.s_i - for b.Sign() > 0 { - qi.Div(&a, &b) - riPlusOne.Mod(&a, &b) - - tmpMuls.Mul(&s1, &qi) - tmpMult.Mul(&t1, &qi) - - s2.Set(&s1) - t2.Set(&t1) - - s1.Sub(rInv, &tmpMuls) - t1.Sub(qInv, &tmpMult) - rInv.Set(&s2) - qInv.Set(&t2) - - a.Set(&b) - b.Set(&riPlusOne) - } - qInv.Neg(qInv) -} - -// StringToMont takes an element written in string form, and returns it in Montgomery form -// Useful for hard-coding in implementation field elements from standards documents -func (f *FieldConfig) StringToMont(str string) big.Int { - - var i big.Int - i.SetString(str, 0) - i = f.ToMont(i) - - return i -} - -func (f *FieldConfig) ToMont(nonMont big.Int) big.Int { - var mont big.Int - mont.Lsh(&nonMont, uint(f.NbWords)*64) - mont.Mod(&mont, f.ModulusBig) - return mont -} - -func (f *FieldConfig) FromMont(nonMont *big.Int, mont *big.Int) *FieldConfig { - - if f.NbWords == 0 { - nonMont.SetInt64(0) - return f - } - f.halve(nonMont, mont) - for i := 1; i < f.NbWords*64; i++ { - f.halve(nonMont, nonMont) - } - - return f -} - -func (f *FieldConfig) Exp(res *big.Int, x *big.Int, pow *big.Int) *FieldConfig { - res.SetInt64(1) - - for i := pow.BitLen() - 1; ; { - - if pow.Bit(i) == 1 { - res.Mul(res, x) - } - - if i == 0 { - break - } - i-- - - res.Mul(res, res).Mod(res, f.ModulusBig) - } - - res.Mod(res, f.ModulusBig) - return f -} - -func (f *FieldConfig) halve(res *big.Int, x *big.Int) { - var z big.Int - if x.Bit(0) == 0 { - z.Set(x) - } else { - z.Add(x, f.ModulusBig) - } - res.Rsh(&z, 1) -} - -func (f *FieldConfig) Mul(z *big.Int, x *big.Int, y *big.Int) *FieldConfig { - z.Mul(x, y).Mod(z, f.ModulusBig) - return f -} - -func (f *FieldConfig) Add(z *big.Int, x *big.Int, y *big.Int) *FieldConfig { - z.Add(x, y).Mod(z, f.ModulusBig) - return f -} - -func (f *FieldConfig) ToMontSlice(x []big.Int) []big.Int { - z := make(Element, len(x)) - for i := 0; i < len(x); i++ { - z[i] = f.ToMont(x[i]) - } - return z -} - -// TODO: Spaghetti Alert: Okay to have codegen functions here? -func CoordNameForExtensionDegree(degree uint8) string { - switch degree { - case 1: - return "" - case 2: - return "A" - case 6: - return "B" - case 12: - return "C" - } - panic(fmt.Sprint("unknown extension degree", degree)) -} - -func (f *FieldConfig) WriteElement(element Element) string { - var builder strings.Builder - - builder.WriteString("{") - length := len(element) - var subElementNames string - if length > 1 { - builder.WriteString("\n") - subElementNames = CoordNameForExtensionDegree(uint8(length)) - } - for i, e := range element { - if length > 1 { - builder.WriteString(subElementNames) - builder.WriteString(strconv.Itoa(i)) - builder.WriteString(": fp.Element{") - } - mont := f.ToMont(e) - bavard.WriteBigIntAsUint64Slice(&builder, &mont) - if length > 1 { - builder.WriteString("},\n") - } - } - builder.WriteString("}") - return builder.String() -} diff --git a/vendor/github.com/consensys/gnark-crypto/field/generator/internal/addchain/addchain.go b/vendor/github.com/consensys/gnark-crypto/field/generator/internal/addchain/addchain.go deleted file mode 100644 index 7dd42b183..000000000 --- a/vendor/github.com/consensys/gnark-crypto/field/generator/internal/addchain/addchain.go +++ /dev/null @@ -1,327 +0,0 @@ -// Original copyright : -// BSD 3-Clause License - -// Copyright (c) 2019, Michael McLoughlin -// All rights reserved. - -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: - -// 1. Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. - -// 2. Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. - -// 3. Neither the name of the copyright holder 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 addchain is derived from github.com/mmcloughlin/addchain internal packages or examples -package addchain - -import ( - "bufio" - "encoding/gob" - "log" - "math/big" - "os" - "path/filepath" - "reflect" - "strings" - "sync" - - "github.com/mmcloughlin/addchain" - "github.com/mmcloughlin/addchain/acc" - "github.com/mmcloughlin/addchain/acc/ast" - "github.com/mmcloughlin/addchain/acc/ir" - "github.com/mmcloughlin/addchain/acc/pass" - "github.com/mmcloughlin/addchain/acc/printer" - "github.com/mmcloughlin/addchain/alg/ensemble" - "github.com/mmcloughlin/addchain/alg/exec" - "github.com/mmcloughlin/addchain/meta" -) - -// most of these functions are derived from github.com/mmcloughlin/addchain internal packages or examples - -var ( - once sync.Once - addChainDir string - mAddchains map[string]*AddChainData // key is big.Int.Text(16) -) - -// GetAddChain returns template data of a short addition chain for given big.Int -func GetAddChain(n *big.Int) *AddChainData { - - // init the cache only once. - once.Do(initCache) - - key := n.Text(16) - if r, ok := mAddchains[key]; ok { - return r - } - - // Default ensemble of algorithms. - algorithms := ensemble.Ensemble() - - // Use parallel executor. - ex := exec.NewParallel() - results := ex.Execute(n, algorithms) - - // Output best result. - best := 0 - for i, r := range results { - if r.Err != nil { - log.Fatal(r.Err) - } - if len(results[i].Program) < len(results[best].Program) { - best = i - } - } - r := results[best] - data := processSearchResult(r.Program, key) - - mAddchains[key] = data - // gob encode - file := filepath.Join(addChainDir, key) - log.Println("saving addchain", file) - f, err := os.Create(file) - if err != nil { - log.Fatal(err) - } - enc := gob.NewEncoder(f) - - if err := enc.Encode(r.Program); err != nil { - _ = f.Close() - log.Fatal(err) - } - _ = f.Close() - - return data -} - -func processSearchResult(_p addchain.Program, n string) *AddChainData { - p, err := acc.Decompile(_p) - if err != nil { - log.Fatal(err) - } - chain, err := acc.Build(p) - if err != nil { - log.Fatal(err) - } - - data, err := prepareAddChainData(chain, n) - if err != nil { - log.Fatal(err) - } - return data -} - -// Data provided to templates. -type AddChainData struct { - // Chain is the addition chain as a list of integers. - Chain addchain.Chain - - // Ops is the complete sequence of addition operations required to compute - // the addition chain. - Ops addchain.Program - - // Script is the condensed representation of the addition chain computation - // in the "addition chain calculator" language. - Script *ast.Chain - - // Program is the intermediate representation of the addition chain - // computation. This representation is likely the most convenient for code - // generation. It contains a sequence of add, double and shift (repeated - // doubling) instructions required to compute the chain. Temporary variable - // allocation has been performed and the list of required temporaries - // populated. - Program *ir.Program - - // Metadata about the addchain project and the specific release parameters. - // Please use this to include a reference or citation back to the addchain - // project in your generated output. - Meta *meta.Properties - - N string // base 16 value of the value -} - -// PrepareData builds input template data for the given addition chain script. -func prepareAddChainData(s *ast.Chain, n string) (*AddChainData, error) { - // Prepare template data. - allocator := pass.Allocator{ - Input: "x", - Output: "z", - Format: "t%d", - } - // Translate to IR. - p, err := acc.Translate(s) - if err != nil { - return nil, err - } - - // Apply processing passes: temporary variable allocation, and computing the - // full addition chain sequence and operations. - if err := pass.Exec(p, allocator, pass.Func(pass.Eval)); err != nil { - return nil, err - } - - return &AddChainData{ - Chain: p.Chain, - Ops: p.Program, - Script: s, - Program: p, - Meta: meta.Meta, - N: n, - }, nil -} - -// Function is a function provided to templates. -type Function struct { - Name string - Description string - Func interface{} -} - -// Signature returns the function signature. -func (f *Function) Signature() string { - return reflect.ValueOf(f.Func).Type().String() -} - -// Functions is the list of functions provided to templates. -var Functions = []*Function{ - { - Name: "add_", - Description: "If the input operation is an `ir.Add` then return it, otherwise return `nil`", - Func: func(op ir.Op) ir.Op { - if a, ok := op.(ir.Add); ok { - return a - } - return nil - }, - }, - { - Name: "double_", - Description: "If the input operation is an `ir.Double` then return it, otherwise return `nil`", - Func: func(op ir.Op) ir.Op { - if d, ok := op.(ir.Double); ok { - return d - } - return nil - }, - }, - { - Name: "shift_", - Description: "If the input operation is an `ir.Shift` then return it, otherwise return `nil`", - Func: func(op ir.Op) ir.Op { - if s, ok := op.(ir.Shift); ok { - return s - } - return nil - }, - }, - { - Name: "inc_", - Description: "Increment an integer", - Func: func(n int) int { return n + 1 }, - }, - { - Name: "format_", - Description: "Formats an addition chain script (`*ast.Chain`) as a string", - Func: printer.String, - }, - { - Name: "split_", - Description: "Calls `strings.Split`", - Func: strings.Split, - }, - { - Name: "join_", - Description: "Calls `strings.Join`", - Func: strings.Join, - }, - { - Name: "lines_", - Description: "Split input string into lines", - Func: func(s string) []string { - var lines []string - scanner := bufio.NewScanner(strings.NewReader(s)) - for scanner.Scan() { - lines = append(lines, scanner.Text()) - } - return lines - }, - }, - { - Name: "ptr_", - Description: "adds & if it's a value", - Func: func(s *ir.Operand) string { - if s.String() == "x" { - return "&" - } - return "" - }, - }, - { - Name: "last_", - Func: func(x int, a interface{}) bool { - return x == reflect.ValueOf(a).Len()-1 - }, - }, -} - -// to speed up code generation, we cache addchain search results on disk -func initCache() { - mAddchains = make(map[string]*AddChainData) - - // read existing files in addchain directory - path, err := os.Getwd() - if err != nil { - log.Fatal(err) - } - addChainDir = filepath.Join(path, "addchain") - _ = os.Mkdir(addChainDir, 0700) - files, err := os.ReadDir(addChainDir) - if err != nil { - log.Fatal(err) - } - - // preload pre-computed add chains - for _, entry := range files { - if entry.IsDir() { - continue - } - f, err := os.Open(filepath.Join(addChainDir, entry.Name())) - if err != nil { - log.Fatal(err) - } - - // decode the addchain.Program - dec := gob.NewDecoder(f) - var p addchain.Program - err = dec.Decode(&p) - _ = f.Close() - if err != nil { - log.Fatal(err) - } - data := processSearchResult(p, filepath.Base(f.Name())) - log.Println("read", filepath.Base(f.Name())) - - // save the data - mAddchains[filepath.Base(f.Name())] = data - - } - -} diff --git a/vendor/github.com/consensys/gnark-crypto/field/hash/hashutils.go b/vendor/github.com/consensys/gnark-crypto/field/hash/hashutils.go index db7cff3e1..7c3b97068 100644 --- a/vendor/github.com/consensys/gnark-crypto/field/hash/hashutils.go +++ b/vendor/github.com/consensys/gnark-crypto/field/hash/hashutils.go @@ -6,8 +6,8 @@ import ( ) // ExpandMsgXmd expands msg to a slice of lenInBytes bytes. -// https://tools.ietf.org/html/draft-irtf-cfrg-hash-to-curve-06#section-5 -// https://tools.ietf.org/html/rfc8017#section-4.1 (I2OSP/O2ISP) +// https://datatracker.ietf.org/doc/html/rfc9380#name-expand_message_xmd +// https://datatracker.ietf.org/doc/html/rfc9380#name-utility-functions (I2OSP/O2ISP) func ExpandMsgXmd(msg, dst []byte, lenInBytes int) ([]byte, error) { h := sha256.New() @@ -22,7 +22,7 @@ func ExpandMsgXmd(msg, dst []byte, lenInBytes int) ([]byte, error) { // Z_pad = I2OSP(0, r_in_bytes) // l_i_b_str = I2OSP(len_in_bytes, 2) - // DST_prime = I2OSP(len(DST), 1) ∥ DST + // DST_prime = DST ∥ I2OSP(len(DST), 1) // b₀ = H(Z_pad ∥ msg ∥ l_i_b_str ∥ I2OSP(0, 1) ∥ DST_prime) h.Reset() if _, err := h.Write(make([]byte, h.BlockSize())); err != nil { diff --git a/vendor/github.com/consensys/gnark-crypto/field/pool/pool.go b/vendor/github.com/consensys/gnark-crypto/field/pool/pool.go index 6bb10bdbd..373610588 100644 --- a/vendor/github.com/consensys/gnark-crypto/field/pool/pool.go +++ b/vendor/github.com/consensys/gnark-crypto/field/pool/pool.go @@ -22,7 +22,7 @@ func (bigIntPool) Get() *big.Int { func (bigIntPool) Put(v *big.Int) { if v == nil { - return // see https://github.com/ConsenSys/gnark-crypto/issues/316 + return // see https://github.com/Consensys/gnark-crypto/issues/316 } _bigIntPool.Put(v) } diff --git a/vendor/github.com/consensys/gnark-crypto/internal/generator/config/bls12-377.go b/vendor/github.com/consensys/gnark-crypto/internal/generator/config/bls12-377.go deleted file mode 100644 index 62bb79b07..000000000 --- a/vendor/github.com/consensys/gnark-crypto/internal/generator/config/bls12-377.go +++ /dev/null @@ -1,322 +0,0 @@ -package config - -var BLS12_377 = Curve{ - Name: "bls12-377", - CurvePackage: "bls12377", - EnumID: "BLS12_377", - FrModulus: "8444461749428370424248824938781546531375899335154063827935233455917409239041", - FpModulus: "258664426012969094010652733694893533536393512754914660539884262666720468348340822774968888139573360124440321458177", - G1: Point{ - CoordType: "fp.Element", - CoordExtDegree: 1, - PointName: "g1", - GLV: true, - CofactorCleaning: true, - CRange: defaultCRange(), - }, - G2: Point{ - CoordType: "fptower.E2", - CoordExtDegree: 2, - CoordExtRoot: -5, - PointName: "g2", - GLV: true, - CofactorCleaning: true, - CRange: defaultCRange(), - Projective: true, - }, - // 2-isogeny - HashE1: &HashSuiteSswu{ - A: []string{"0x1ae3a4617c510ea34b3c4687866d1616212919cefb9b37e860f40fde03873fc0a0bf847bffffff8b9857ffffffffff2"}, - B: []string{"0x16"}, - Z: []int{5}, - Isogeny: &Isogeny{ - XMap: RationalPolynomial{ - Num: [][]string{ - {"0x142abb491d3ccb00d65810beba93dbb0a661fd85974d6aa82c4bb2e1a3c84ffdd6ef419b80000000000000000000000"}, - {"0x4d9d782ee8a7b7630cd57be9a2ca555e2f689a3cb86f60022910be6480000004284600000000001"}, - {"0x142abb491d3ccb014ac44505178f6ec539a237640b7ceab573689a3cb86f600114885f32400000063c6900000000001"}, - }, - Den: [][]string{ - {"0x13675e0bba29edd8c3355efa68b295578bda268f2e1bd8008a442f99200000010a11800000000004"}, - }, - }, - YMap: RationalPolynomial{ - Num: [][]string{ - {"0x142abb491d3ccb014ac44505178f6ec539a237640b7ceab573689a3cb86f600114885f32400000063c68fffffffffff"}, - {"0x35c748c2f8a21d6af848e30c1b78229a46644922460e73f6faf06c327b438084815848140000010a11800000000002"}, - {"0xd71d230be288756a6446249c205dced645709767bd81c863eb7f8d8e4f15003f5f407b84000000a64af00000000002"}, - {"0x17872fd54cc6ecd6d73a5085f0d2013b6de7eb4a0d6711d3b14f5e9c2c81f001429f19baa0000007467a80000000001"}, - }, - Den: [][]string{ - {"0x1ae3a4617c510eac63b05c06ca1493b1a22d9f300f5138f1ef3622fba094800170b5d44300000008508bffffffffff9"}, - {"0x746c34465cfb9314934039de742f800d471ce75b14a710033d991d96c00000063c6900000000000c"}, - {"0x3a361a232e7dc98a49a01cef3a17c006a38e73ad8a5388019ecc8ecb600000031e3480000000000c"}, - }, - }, - }, - }, - - // 23-isogeny - HashE2: &HashSuiteSswu{ - A: []string{"0x152964189f4c623685ae0423eb10294ce6458c064f093208504005b37d04d5d336dc9d66a97093f84d62e778f8c82be", "0x735c455387ab435839e5a5dbc1a30510070300f4becac797642fe56985064e95f7d6521a1a6e71004047f835c1f957"}, - B: []string{"0x19e38372e0d4bf401d2fa5f2261e1e3fc95d51a3857fc23b1385d51ea9c973a89c22148a93dff96447700bf1c3aebac", "0x1579ddb5c1c595b7c08c3a3cef5626143c25757c6b67d0a2677b22fc0c890d8b2b1a17895d047a98c49047069f725"}, - Z: []int{12, 1}, - Isogeny: &Isogeny{ - XMap: RationalPolynomial{ - Num: [][]string{ - {"0x113b0abb7ba48832ffb7aaaa7ce085078312d4bf0bf8882e8f4a0a6e24d91b535b6c81277ad9369cacc733de5cf86d9", - "0x11e62d211119d8108bbf13b3b4b79a1aabbe2d6004858109139667b300e5097370015d42782ca1bf7652dba1d4cac3c"}, - {"0x51a19546efd3c582ec16ee049bafb8ccbdd87d98f753e654e0b93ae62a627a6f610b30f76016baa8d18dc4677dc401", - "0xddc3aac50aa5af86f8c1d31db787f4b6ac0262a8ea40c07d61389c2a70b06c51fb59520394e05c55c72e363b9607a1"}, - {"0x93198927f09c55a596756ab909a06ab3c0127be6538fb275f2b7b5bfaa1ab85b12a45ef345d628d5c6e69effd7e76a", - "0x2c02fb38b1440c7b2d4fae061763cd734c40b1eddf1ca9552554d2859906f8d6290038a485a655f8178f99b1fe43e1"}, - {"0x19091208a40d61bd9a55359da28b532617da69a58addac35288930ccd5083166d791cc7dd3c6533e01f786000c532f7", - "0xcf913d369130273a81f982f469bc8fd98a8983af247d28845d76729468a777836e1d3cdf1e1adea6b08566db5b514f"}, - {"0x181a36b975099a83b4773c6e62d93365d5fd3787c2b62d0a315245f6226ab13cd462f731b73a436a598b34dc0ec58d0", - "0xdeebd58f0234fa272439c69d9f0ed559b955d416256645c2ab1857d988b49109ff460206e2b978d877fc9274fe4840"}, - {"0x10cd4f85b581fa9bbd614f001a2e64839a4635373187b57373f17f77e11ea30ce505e6ebab860ee2aa46c9e6b327add", - "0xc1f11111a68f3346dfeb807985c61491498efd3439c5c7a0b77e9d819a48be950e43c9f30cd21e5e439815a2ab6a9a"}, - {"0x1813ccf2b39896b88561d57592c5e7d7594146f9eb341852cdbc192e88792058059bd79b248c5b8c415d6149d51130a", - "0xeb958c5ed40e2b75a170536e42368207df82fcc26518f6f83f40cea65efdd81dcc248290c660107e0a2d650a38d526"}, - {"0xa143ff2d94ba2d2322d63cb3769874b17c00fe76fff4b53fb5fa4744da3114899adaca240bde7d88357aa80b144bb1", - "0xa25054cd91b2b06cdad439cdf86265929d35738f09e759a56164861f45586602c630ef182e9262f0413374b154dd20"}, - {"0x1f0a897c94b01589c9eb5cdd999c580c284f39c6fa6f2ad0c569c3b219cc245484ed7310b858f980b2917508d94f59", - "0x5c56eb37beca858c993f39fbf09b73efbd98934b5b1d8de0c21fc75d20075e6d7720601832565b1823339bffc17a6d"}, - {"0x13a21ac110c90240e49de23070e86bcb64b8c500d8f9d792095a0a7f9133f4d8d94c518f9eb1359c8c82926e41d004c", - "0x18471a982b5d8d7756ff4971fbba3945be37cea5cda74e17674b76cbf527f8ae51a27236a95d815a4f36a2461df5b67"}, - {"0x380e386dce2ad72755e1d21461a3d33ce275b036c2a11a755df7e948161f3318531311b8dfaad26a2b6af699e42f07", - "0xc86f279fd500d0594160f87a462ff89f4b0db7b7fe6bc809871f11183f13235d343e0a8bae13c9f5791a2821ce8bf"}, - {"0xd73c34c8f904e327cd1fc22e8a90e04bed13e46eb98e3d47d18cde142b9e0f3a03eaac69214acac03042aa9b9b6495", - "0x76ea3cf6b7185d7d6e3e73ac03a21b645e5aaee7a99dccecc485620fdf64e7486c7b1e4f8b6e069240b7a1e76b0609"}, - {"0xca983f9f6ea728c5b4bb9a6dc72d24ecab7833e1a8242bf1a84140deb996176a8f7c7d6fe34fdb4660afd6dfa5fd74", - "0x7e4badbdba86487f1b87daccf8d14f62bcb01bca058d8e318ad40ae8343a47d40f6b18af1e0bf9860eeb32db4f02aa"}, - {"0x1552beaa2371b711181b528b4ea3e801e3a71c2bc0bde70a2babef6d5702ff12af4f5f2823599093d5485b94c873d36", - "0x11783b91dc5ce3d03283278116bb901408dc61ef8bad40991144de2f3509787d83b566820fd315b558ccd76c9debd5d"}, - {"0x175374ccff26ce81965dce12856efd5cb587251e70a588e2e4633110d65bf17f2991df664e727ebc65b42d74a938e4b", - "0xe75b2e26120b6428e51285251602a89ca9f865d444853ac3527b940d7b218df89806e725ec52e75b92dfcf63616483"}, - {"0xecfa3729a48226a477e72d4067aa372a29fa8943324495f2f39f754bd1d114fc2d9c62453fde06e3272bf09faea06f", - "0xe95c673c49bda6dacee18f07327cee3902582326fbe658d3e8cb15b40327b8b7c1b04e0160071f1e8c617361754705"}, - {"0x155dd556a15b55b766cc98f3455788f3ca450ac5c613b2e1464b53f0e5412a626e423cf9dd5127edaa6deeaa5638f93", - "0x15ac434170f220d28273b44c48eca01f2cfaae20e2342429ca6f3668e0825821a3d7f1227db23b1a7a36e7f8abf89e"}, - {"0xe785dde291472723e95d737c7bc0bb72a8125cfbd91b122beedd3f45dedefc1480e9350bbfb6a5ca2fb9ec905573fa", - "0xe01e2c8ab4ddf439c8d4028ccc68b13de8099e3aa7d5120867366605682a4db4ec308cf07e043cf7256e35c23ecbc7"}, - {"0x4e2c05f403fa31d03e91053fb52a3fc12ae58977575f53cd8a52b53d1067cc61de65daada7c7c1bf5bdb07f3719b14", - "0x18de34a92f81eba3a57d55a9d4bd5cf7da7b1794a0f9ece37abd537ddcdb29edbb01aa88baef416408d34a227874c33"}, - {"0xe4a28f5d9cdcb181099868140cf3064cd573f892aceb79e3df63546686df19a3164efedc851333bbe232be84e3e627", - "0xd31f8027ef5f6b916364d998dbc4640196191cf0ca44e2c2c4825bf4babd706351d21f1f6177ee4c3f5d16928d059b"}, - {"0x602985c2bf7472638e59af721dc3e635d08ede15ad23084d54441a493d515ab9d727832a06110b8a5e4cdf978980d1", - "0x159cb19fac8df89c704efce7423d8965e1477606471d21f77988cd744d0ea0938a85eb4a21d41a34c97d64a409f7314"}, - {"0x12f6020b2f6dc691f96e6a7c5e42a221a861c1b27223e30adbb75022ff42f318e8d96e0a964dfcb9dd0d20fd3a7c247", - "0x1766ffa6c449787005d03e90251c271190a3c8e6db8383ce2925b91c87ae29c989d503705ed7566fe5c7bfefb6902c6"}, - {"0x471dda72677bf4df7027fff15bb88083362b56b41dbbeb3e3f9afed6c7fd9b8e03a7b66f7dde784cdb94ef12714ed1", - "0xb95429ba2726547f58f812d8516a9c7545fb43d2080d1b154e4e8aaa689a378141fd28ad946cf12fef100e180c9762"}, - {"0x1ac99df3bf98db5235d2892b0f00a86db204cc8f367535d37ff878fd945bcd6f4991d08e3d7598788e2f860c950d110", - "0x0"}, - }, - Den: [][]string{ - {"0x146e50faa64a7651c3b0b61836501a66805927dcb051b32662d0d261c3b5458776918917726e7ab20050fb3f1e9d32c", - "0xb1ea777f7008d8bcafa4799bac2e33475d6b287b6c831af5c06bb778507412d8aa8d347a14ea074b7983518d668616"}, - {"0x79f0dba8c34b89c8d1fd2363421e1f97f7f12579ab42f520b86c9e7b44e822fadf62f6e98bfebed3065ef7e6d873e2", - "0x40dd9ff7e21f5f6802ef1e47c240880f84fbe0232f659145f22f9c842736890572e9a0018ff427005b45140ad2597d"}, - {"0xde82c1e45e55039d5d8ae4684e278f230e94285b4bc97eae01f84acf258e9be8888a96dd0fdccde825922ec5517ec5", - "0x101b161db02dadd38c1b219d253f01728d2b3ba65e3dc05ebf102ff9fab2f2ef1cc95047570148228b4915820b0301d"}, - {"0x19c6b7b7a90b244a9cc8e9cf77c1fc40ffeae17efe57efaad45c6b85105effe955b8aec25cd5a33b5fe1b403099cc87", - "0x1658235a28d3dcd62a783eb6e135a65f19ee1ded96bf717f26fb9e81763b6d1d0d32ef686998776504a5c6426ba2ddc"}, - {"0x1374e714d24649d3de48ea7e809ed20ba8de79a7a95b59e26babe22856e57c5f9e6667da8107e27b1215afe2846471", - "0x9fa434f0a714ff9b2bb5ea51856efce45659377666fe4377774d04ca63a1ae957c5cc11376defad113c94ae6ce4652"}, - {"0x11796b770f7504fb0a25336ae91aca083bb600d5523a27885e44f3bedff57966411346d44cce4bbaf50770a210445b7", - "0xa5dc732bb3f95325df484711467e89dc69a7986d2439a692fb9667c22512d87f968d452c1a7a4af94629d6fbfab126"}, - {"0x36fc8fd543e00229e3e56ca9655db01cb161ad493c35d5225acea1924f2673890b0981feb9170a2b73e1ed5852276a", - "0x11e47853a548367d9473b4251c2641a1a05ded1721fb74dfd4455bb41894cd35ffa77ac1a1dda4171e8e3c598cc0cf"}, - {"0xec3aecb4916b2621d73c22adf37fd2bd067cfcd09f38cfa7060c1dc08573f6e6da62ae459d00c719b153b23eb30380", - "0x33b7e5c5174d637291e17246bd01864eaf2b12d27ab74b84e029ed82c9cf3551faa44b79bdbb079a9f57f598e8c35"}, - {"0x14d8b5c3fe739ff9bca51db2433814bd39a0ba8f082801125801599b81682fe51896aeed82936cfc3d7850d2f9622a3", - "0x7adf53096d8b637caa65a6703d654842a9b7d4d82a1ebd6ae4eb4cf7df07912638d359dbfe6f8443fcae492cb150c5"}, - {"0x16e8eda7dfd1927fe1dc22dacaa78237dfa0714315f535e804649326acfe5c67a86dcbee4d78a5d662ff122b8580245", - "0x40de374242af4c470b0952cc13dae780d77d43729e9598ba3173ac586624ebe305c8c9e6e5e7245f98a970af1ee60d"}, - {"0x16c94723b3eacaa13fef87169f4eca0959eecf2184d6a7468da9d8f32acb6a36c5254bf31d733f5b1c053dd88e54282", - "0x19c508401f6e0cdcf9e2b694c12550eba4247c85c52b8aba5991f9aeecbefee61355271663b842b0b23c0de66bcb8f1"}, - {"0xf3ffd87f27eee739719fa368e3d9bebdb8f06a192b5ae980b629ad78421034b2f919d658fbcd1490fc7692e1e916ce", - "0x1468f37ed6477c421170d67235b0370aa3388db7e4c0cb3dbcf1fef55b2c7cd6989451199b411d7aaf8a5b24436f6e3"}, - {"0x1035e4ec93dc6bc358f961e7dc4c82087605cbe2bfdbe713fa5e7b21d75c1ad45088bdbc6daaa2e12d1f0bcfb4b84f7", - "0x11e842bd544d0bbee76808f0a1ba264be31aedda57ceb64330b587d5a89d03598cdb8d2b528fe56a02dbfd48e8aaa83"}, - {"0xe57bf7b799080766c07fa8b997f65da74043a005d785b60215c0875d8d80a2a55de8c81dc081ee75cafdcb6d9f5bab", - "0x4f2c024aca0ee3f8be88ed1450ac2448d3bd8b540d7cb9b5d93d68eedc20119213d260c02c7dbaa180aa008407b0dc"}, - {"0xe0b435cad88cfd17508b5b3da274b76521f715b9129c3141f70a3c7dd22e14c3fe58a5db7c168f47c673d91a05c02f", - "0x16ba8b632d08a5abe396f990cfc790f6d29725220c89e7dacb3be59699757c6245bc0793bfeb5b2f917508cdd949a79"}, - {"0x17c5e37674a25c3385908a02be0a23c1623eb710deb01632301277cb968ae2bccd3e5b38e144e424a9da459c4b8600a", - "0x503556d7e47b59d5888f787cb7cec46d917d02f8118e01a63ffc3b01398260d7c722dc26c7cd03d7c05e1a996e5471"}, - {"0x890e4e58ded34996cf252dc184d7aec1c1866ad2da0b50ffc208a1ef31dd9e277b3f5e2fd1f3cf9422b81c526bbd0d", - "0x108938787e3377815ba98065f7c57b955fb7bc2247a21fd516fcad09652e92819c4bd34cf9be483e261639e540ce577"}, - {"0x665b1acc1e271d15bf9416f014ae1ddc76838a60230be0cd17cc7505d6b5f7cb01037545fd2c3b9997b0745ad8ad9c", - "0x1ae0fc9e185ac85323228f01780e30ba86767c59cc90d2d05ddbba8d6cf35bbd737b7fcd09b3850af513ebb6fc3ced9"}, - {"0x16db2dd779c2cc1699abf727df65339443007994b70c43a8d9767e265dfe45809093cc631ba5b79f1280236ac93fddf", - "0x43671e62ee377b90bbd80c91a3dc1eb53ed37ea8ae6ccc0154e2f1cf498198acc92b2ce3c07e292b2b5f038c6c04c9"}, - {"0x93b2b87c160c52f6b056e4c085930add9aeb706709ee013eb54ca60bc820b0da42fbca8e9c9a579585bdb8af77acbe", - "0xcb5381cf50932ff1dd7fed460732ae9311b24ab543d98304b80963cf706598ef147c2b047d6c2e49357f5704e568ba"}, - {"0x731b19b58014b17a0be1915dfee088ceb8ca7964deed74d985adfbe0e9aa99cac1453ae4210abf949afc9c7425f2b6", - "0x3f906b21602c1254dc293fbddc3974f24bef13d0291760083c7a125c8ad5c49ed9ba755743e9344387d1e712d7ede2"}, - {"0xbee29453de653858b3b37cd3b85e7941177c94de27ab781cb8ea619a1b9668a0b0ddd01318b6699bc582051c23dd8a", - "0x1793e129728346d60828550ad395de628b4f4ab2952bd0e95003c382bebd49daa486d981fb51dee163ded1fb204d09f"}, - }, - }, - YMap: RationalPolynomial{ - Num: [][]string{ - {"0x19474819a519191689e0816c7f84b2a58a6a5aaf5adfd7fb0204d8623f67c19e9a64d522ce4c963e32de8edfd367284", - "0x100e238102de877617418a44564d9379372b6f69c721b205c60af2e298bfa546a7c7a39883e433f947601b24266a306"}, - {"0xb58b352e8f9bc6162e40b4ab27f066cb71ed844e9b5e376cdef8e8be14e38d2f13392f19da19ca1faa758bbb083dc6", - "0x3293cacae9e6251abad8ac4d8263754f1301062d54ff721d183d201f9133db07341cd48c721d8b9ec40e41d4bd0db0"}, - {"0xdfec4d8ecb1cb0adbe13f68ccb2e070bcbf5ee3ee8328cb6613a63a543c252ef4ecb525fbf65ca12f33b425da04d5", - "0x177fa15abb4e47ced85ae0765a6aef971131743de887073556fe92f142b83a8355edc8544530ed7296a3e21c4f9828a"}, - {"0x17bbcf8bf3802b3f868ec94dcbb32a8b0cfd5f62daa2079cf8370b487cf440c664863e710ffeafc40cf374a58263139", - "0x16f6e49903922180e44d4bc45aeb65f093fe4fad10cf29583c3664cfbd76b9ca5b9a7ef2337a62cb2e45623cee7ced3"}, - {"0xc1fa03051d6150ed02ce658113c5b9de9232db80782740741c13e95afb61ddc78d32e0af5fa67e2df4203ea7c7f720", - "0x1a20dfca20c821fa263e1b04009e6e0f5a373e665afe7f603f0bb9703ce6864cc9ce09aa1e2d694a16082973591eed7"}, - {"0xed3c8528803a2e8ea1d51fbc40888c93aacdbabaf485d5a8a037472849450ed254f2bf0876516c81b466d03adc0b37", - "0xe0b3c359ae53e4901f777b107add779bd384d8da8a46c02f044cbeb099743b6888cc191d97bd035de9136783ac7866"}, - {"0x108e5399fb0e462641e346430020b47260782a557c8476b06aff3fa95b6251bfbd40dec8c213b3355c50a24b96d95d5", - "0x1aa7ad61ba7c96aaf8b72db59b48309bd72b50ec5781988ba9a55a43b4e4a595e36aceec3a51a1804a788848e9f96cb"}, - {"0xb16e02b02354b93cbf74b3551a94aabd0acfea5d6f20c56eb2f46433003d2dc4225912600eda79dc7e3adf0702e763", - "0xec85210b0e638ec662fc76335f470cbe21a165a66aad036058932f6d52e77f1b6e3269cce0432e1404b0810c053c2c"}, - {"0xc0b22a4dda3741b4fcd5b6c2abb9d2e8481ebd442e00d81865d70c8717d4c6c78a41e6f85c97b10fd010d8a966cbaa", - "0x1396ca7d90b82b12adcfcc5d81a850203097d56d9ef35381dc666cbaf594b4e033e6a525460e4ff6ba10bbf1afd94ce"}, - {"0x14c78f774a2896fa64a052004df6fb736bf806e662e9d7097f589b0df03fee5aee9609407005296ea99b879fa0ab8ac", - "0xcd6467d031974a892ff5ecff9f2f8d46a53e674500111351806a15432a6cf8744725b9c101161d59c792807b253a3e"}, - {"0x1526589e372650ab85ccf35382db0e7cf5d02f0de09e848caa73396338a01b9f6064695efe06eabef61098ea1c0c638", - "0x68acae9cd1355b5c9781656519838b804fbeeb960df4bff77dd2477ef674d7240676b62cb03a51326f8f47f14377e"}, - {"0x167a5b9940feddfc5ea3bae9c03a52e10fdb3b7055e547d27fa804baab5c74796d2f1cf56675c664229ecd622f32ed3", - "0x44f0cdf3744beae8718ae72373f6a01838b210bf23bbc13d3522d5595f45980057324c394fdd5f4a588716b2c0cf2e"}, - {"0x1511bd492587501195e9a7df7360c8e8fe72d53b57cec62eed296b202b156724087121691d7e7ac6d80656b40604602", - "0x51219c71bb96909a005e363c5ec60f36c77e407fcc05e801c3962f83566d18ae9ff4a658d0dd08e1d90de6c758bbe3"}, - {"0x48208860fc71ea0cb4a266e00c3ba02f8c272902831fc7d0a26d4734eb1fde8d496dec19ef8b076fde5c77b534f4ff", - "0x6707d246dda7a0a59b2b054307653dca9144172aa6281893bc9f681368f71325baca1eba0229dc19f9a7853088ca8c"}, - {"0x32a1895b110a91f8fb9e1bd01a312d28281131018a0ad9470c3c3ea1952f63ce90112b8d5ea7bc933d4f1cb426abe", - "0x6fced059c7cb1819994a13bcb3d805cb1170eb16e35561c90c1454c4af849c5eff11b66554ee507fec5c0ebc4eebf0"}, - {"0x182a668115cbca00c180b580798d261e58b4d2c140ccb68342ee5a859b51af3076e871060c103c2a0b4ca8a80a43a08", - "0x458656746821dc18aacaf7533ef33077889590c4eb36a545e120d40c812dad8bf3c8b3425a427a0f58e49460a4f7f0"}, - {"0x1371823e71e71d670cd8509978788f70e4aa0ad9e88dd3983c8b52a688c11865b8d1a183a82c866cebeaa40f4f87295", - "0x3fafdb6deb055c9eaa8a59bb2fafee94632d4c538c8837cca7743fec86a8f9ce24bdbf3e34595d1bb9e43571cf2370"}, - {"0xda0900c121f7a9a289faa9bd55ceaffe9d93a38a2b0890875289abe4a4491757eb96eebf7c2babb6169994d7eb414", - "0xfaa7103de621a04fad6afeb3e1334e1fe69a19029bf77e32833684a5e6c9f1a9fd6cbd6efdb6496b95fa4b20521f9"}, - {"0xdf001ab5b668caa34f373dea333476adfb1243e35453af80a6e66dabd825256f185763cb22112686723a50c47acaba", - "0xffdc67df2a8983f611da939f6b81abc4db37ecbbdb4409abf9e1eb6f763aaa51fce86f4ea92e4500079313a249d7a3"}, - {"0x2967da20443829494af8becbaac23650aab235202a7a20e64e52e0bfa17d045a066167931e3dbd41d55eb956d2ed10", - "0xc7f02fdee5f78a0a03e3abe964cb50d03313df2c8fe42b99d16f3af8a2a0bcc1a88449924ebe0acd21bd3ce63128fe"}, - {"0x13cac271335756e85815b2d299b18f25f34c16d33b8ff67e923b74f5c468196cc31ab24a3a7ee56ab9e4e10676fc0eb", - "0x18a1b7092e497c2b1ce9e73f447618dcb50b43e20f6115931833d0d1e79da6f3d728e4a1b651c0ff536cf2549919282"}, - {"0xd4ec1a90744458ece499140238ae77c1de76f242a8a05f1482eb221783eead306e1ee6c15da37f4363df82b6cbfd56", - "0x7eee2877ada79fb65b13e1af4d49a98ac24dbe7965a7dd9d4150274a31032ceb4a3a0aff0369ce7b15235d91cbbc25"}, - {"0x2b277ffeee377436109a9f871027362a333ae2d49c65c7452be93c50a2220673b21006879b1fa9b10c5c5f0d933f38", - "0x9b2ffda579da5430137b22b26fdaa13f52ff11c13f4f88fac0bfa0c30b5c1bb190d8728a60153ec7986dcd7dc5640b"}, - {"0x949aedd81f20923b0b0e5f5cbfc2c0cf7ba155ed488e756404f6adf9ad0c85e8bbe102a83693e805aff42b7f21617d", - "0x176910539df9c32d55b92b8f843c668db490d8905e108f18d1b136d45989a2d2ef4cfae817975c2729cc92032d905eb"}, - {"0xdd974b42d37d78da2e8761e99596fd113add085fc115b9ca57a94c218b278addb80c8430bab38b8d53738fbb33b75c", - "0x163fb82f31df72b309c3422ad404ce953f5fb5292fe68cb61b73100bc262a987e46299e183fc582cca8bc848dd7c621"}, - {"0x15d0fae7eabe20ca577fc60964b17e021e699c1f8ad28ecae4f3766dfcc924a5a89dfc48fa0945e9e650c45980affc3", - "0x16d1223b7d1b6311f2462306650b490d11b3772de34b66fd06810fd3dc56e90d15382767477c4952d25d0da2656d6e1"}, - {"0xb34a5e0ece8efa676afb297e8a81b8c5af019a878bee197bc4ecfabfbdaa46da1ed1a51cf3b0f1ed90691dcfd2d594", - "0x164c4047b6cc6e62f7c7a00c215157206c7b50adfc52435469ca2846701fd8857ca14c5ce17fde980afdf2b8ea58d2d"}, - {"0x167fdf7ff361330674041cc850f227daa736a1b450928a621273de03cb104998d76a529c84a9cd93a91ccde3cb4623d", - "0x18a6f2eb4840007bb2157cd6809ac05f522ae2e4047f77f4de06732445c7f03290de120acdbfe3d4590edf09ac3d0c"}, - {"0xf8649870cd6866641205263c10df90d9ba3c8b56d8ceb178c4897ead46bc3be88ef7e0e31952dd1396ac6f7905b8c7", - "0x9a05a5b1cba4d191bc5098efa547c070297e57748416d8386d72875a5cc5127d3a9109b88bb74bd7552b4eb3106175"}, - {"0x1378329c9fadb2e63f34a6f55ab5335ff1b5d913c2d7edbbba48295caa230f00150d65d25dd44880cb562ca912495c9", - "0xe5f0b2d55f8713e807c8fb1f96f13e0b5caa3de8607f04bd93a7260e3d8810a48860a9626c7b4a424bdaad21741308"}, - {"0x11386a65a011fb28d612fbc7d0f76b2dec1330512b504f541d09517a0cc00f0f49b6fc1fa52a8725965385dbae1f4b8", - "0x170632bca9a590287a0ffac955344cc8f15e59118f03adbf86e07bb82f5bb76cfb7fbf1e42a1eb384ff9c11f21b910c"}, - {"0xded86746533417ce10e14535b4811d2246eae38429763e4427ffa9dd12120df30c8c36497d089a06066626724c6cac", - "0x40ad9ca1fa683544a978c718fae74751b37a5dac2b57dcac813479f9ebb387e9ac1eafb90b12483b5282391738f286"}, - {"0xdfda607fa565d6becc5842deda97367bbf14db84a0cae4783dfb89d2ea2ccedefca2ec5883577294bba68a29815d6", - "0x137601d38808323444ab0018632b9e567be332256b624b8ce929756c42eab72fca278590b52071b38b711be22f5b0d5"}, - {"0x13dec721e4606cc9691488c3d003366a1462ba6a713277de0503f1131d1d61fab5c79cba5bb7332c6abc80435464be0", - "0x0"}, - }, - Den: [][]string{ - {"0x126e7ae82b984bc44d0e37b08e50643a99f06396f1ae9e20117c4bd86b9b1939fd92c3d95ebd307fce9080a95674e4f", - "0x18561a650deca0ad7df837e9ffaa27f0b8e85ff347362f1259d3b1e529e892327aa7c6ccf4a3ad6e365226b8d875fe1"}, - {"0x1a9963059b91cc5aab175a23fb536129d851da9e2f8c5bb7165e05937bdca1db1508e98843f1f62c047ce3d6ec8fc60", - "0x1fb73b0a8e121906f51d20eec7cb8491cb61bbb3b3ecaded3df7283d9128fc3635307f3c3ca133af720d9775729e91"}, - {"0x8b9ff20c9eba7b3dc948e79ce661704cf236ce6bd8361d146491031d3fc9e58b338a67ddc8548f4a36460fb5dceb40", - "0x3c27d81172a310833e5ab3bf81225b01c4068b13026ca1deeebad80a558665100bad779466ea0bc4ccf4c4ba3d9c7d"}, - {"0x1642ab99157e12e44ad3e54b1fa7a4ec2d80b545653fa336b5aa5deb0452f3d47824cdc51de8d83775d658426e24e3e", - "0x7d42c28d3d9fae9c3286c2dcb8826e91d7b36fc45468e8f64b8a029c91863cebd4add2412ee5f3bd090bcccda03ab6"}, - {"0xb233cdfc79172767df7df3731177932ce335fcff5e0b1579c01cf6d34d3747bebe1bfe3b111ef9176fbbba581e459e", - "0xbe45fabc97a7c23a215db4b2aae647fa5749ad332d9a66eccdcd7195a412def4d28ecb256f45d5879cb6b4e6e1d396"}, - {"0x4684f66af9512c51edcd89002de77e666b71ff7151c341319a44095d8113addf41f718b54842a7c29432ea9e2b8b88", - "0x88b603e95e15fff2d8bd1f77ceaf19ee06b7a9301faf29d983a8962bf7969a6b3ddbdfea1ee16f30cfb81cf7e21715"}, - {"0x354c69013ae211b621a899ca7a65f4bcbea4d39ea633002758cb777ba71f570995d52adceb2fc931d92a12398eb12c", - "0x175ca20c6e2e1b0b8305dc90cced8b1e4c3f4493d341e46e39b6e33741b604f1ae9f8b2be59f4a9a52e948c802a108c"}, - {"0x58a2ae5eeb2f349aa139ef3ddffd1df269c2cf99e23d6f64ed7ee9bd2cbfde0027449827b1e2b116da86ec051e0f07", - "0x47776d799a1f49c7bfa7feebaf8012282bb0dbc4b1ce41448474e41e53f64a098c71c79ecf21bece5867750a030982"}, - {"0x1a0a1098c733a0ba9c9ed018ecb794dfb3b84b048ad03850b46e6cfd1e1018fd25ecd9924e4cc4f61e490d92fe1ed89", - "0xdb1cc6b3b535c13494ba5c4ce330f401298118fb2c774b057daf91e1919b84ea0982828f8a07fa58cb3ea8f0201cfa"}, - {"0x1a19656718399a35e838587e3ca3aad4337c715ec6baf72f3c7e3fca08fce3651140c73a45031117e9e0ab0f7496b3c", - "0x11d225e689b1c5533a4da5615ccfd27032d2a33de261bc8c83e1d938637efe7b0612df05f42d2d858376b499c652d75"}, - {"0x1a97aec63b6f352e2a2494186b69f0276247a857d82f7879e7d6c01e4a38f6e9d97e347e87ce507a5b94f2b3773eac6", - "0x8256cc2663dc6938ae7605931d1a8f441ef85d2cef47445416cb593d2860d2eefcfd9a3c35d76d25d17109a764ebce"}, - {"0x9deeddd201ebe394bc84236d884b755378a169e31bb81e389ed375576782cb5fd30a4cbbcecabdacb808eab7c6d4fe", - "0x174a2760a9f8253d0539dec3d626f269841b51a989ce5205fcc09366eebf6535bab520fc56d623cd04fcde78d685a0b"}, - {"0x1e3c14cdeaa4ed3e266a36616cd141dcb32072e63e4b9c1b19eefc2d6b490397977352e865b5016f148f74d1234df6", - "0x5d1a7ce417ff6c955a2d06c4c840b541f386fe4a4370228afae2be534e2a5417fade1ead66031d64458270725699d6"}, - {"0xb44bcb83f10d65248dcf486aa2bdfbedc610b3f42aaea5a4581cacaad83d83a5bc9af704bbfd377d916268ed5be0ca", - "0x154a6f2aebf4c09b1e69a0a4d435958eab0b85a6f405246a1c6af4a4432e13ba0ae3e631b4cbb9958962a2bc05dadce"}, - {"0x43ec129619c24c903d1e8ced9e08af5e09deaaad2f85f5ff1a65a070055bda662d6b0ec13b2a12dce07dca1ca0d34e", - "0xc696b6c3b4b65ba99f95b0419f35d9f5a13e81f259173b4babc0bf290a0e2d9979511b5a6e1122aa7a572eb04c937b"}, - {"0x5f8d9df1cd3ea471f926003dae6e4cbe4eac8676d97693f76b082468922496ab47cf0a6fdbab2717328446ddecdc17", - "0x588223c67657eb350a8aba1f5ac04ccee4c02ab4a5c7d038c8a3eb8c8ebc0233950f6c7f12cdbb6fa6a423e97cd661"}, - {"0xe23936ef578d86d6e629e2146599905c9a3cfc4d158bb35f4513ade1031830de7ca355bfb3ec74c487f7e91dbaeb22", - "0x1168faccfe32c916ceece34bd697bfa7aad4048bf1ef00409f0c7ad20564f46eac4e7710083011e85e8543b1b8b3c3e"}, - {"0xce947ebe5063aafb2a3e9796bf3677237ecd980026889351d1120fa73b24a1a04e971deab8ad4c7f189e9559b0d1b1", - "0x156b554c56db14b68a4ed5367a442fac6d95d2714fc59e9eaa235dba01a804277302625ce66f99e4eead7b7c7137a90"}, - {"0xeb0854aaaa2035ec173a3419093ef828c51df43b492dfad54fa62fcdcf40621c21d040f678a3eab5831e12e4a0d02f", - "0x380b52ae6bdef0a4cfeab3cbef0efd4017286319f2e1dd8022fd896cb0cb8be986c4abb1ec2bd6aa90c45b1a61b6aa"}, - {"0x19cee627a52ee5d83bfba584b81e8da3e9fee36a4785cc5e277a0635ad178c03863d708258214e80851cec3bab077b0", - "0x19a62cec87d6fa62a59d35af20772f84611a11d62e573e008cf6cc4e6e473a93a89b0b2b4579827b835109ffae07696"}, - {"0x193224b2c9149c504131017f21f51adb859b41abcf51ad61eca54273f7962d47bbe4c33a96e0938b31d4d475e20c472", - "0x17c9844cbfaebc9866e792216a887a4efe3c85a55891e1f8e0f0c5bcd1276e607087e9a67b9ca05b30577a70e0b9cd3"}, - {"0x1a381bff3a99144474ed68d432a55cc7a87a77ec8ef9ec7dc8207bebe95d55bda2ec40d34992be5e68691717ad25e87", - "0x1998a69751dae99d28fafd96b81cc341482051957408078e8ea74617fba8242075a8f8b079f1e18a274a9defcf12cf9"}, - {"0x1436817e660a5107b3d259cb3f2af5d373b951ad6a54ad6831ff9d7053cd857ae5abcdf0e44bb1a45dc4dc43be82a24", - "0x7d2fe1f55c31673b19f9fc000ffa74819d7001a3f1bfcd87bad06d6642b6ebd2d69836d88e9e43fa6af8225a380ed6"}, - {"0x321b8a5f187405be1d90830e71a287eadc2722bc45bb9f5e84a921331835127361f4544d86b4ace8ceed8886063f02", - "0x58cd6cd7c128e53ec5f4b55e8cb0356e36b4f4673890bd57600018e658100e9ebe25311b6c0a9b21b95a6414a88ad1"}, - {"0xa88afc381c5826291bd27ee2a6d88bbf10068154b09f1df0b3cbe9478e2f2f835133d5486b0797d9ade242e0d442c7", - "0xf76768c2ed3f4e85913f870de4ef972299114025ab5bd97a70dff551d3fdb6e780876e8d5979631e170590f104b3c6"}, - {"0x6bca067bf3c3fda8fe8060531d6f5550fef83c2769c7686682abf9585ca3fc04d64a75061c9965a8782864126167f9", - "0xa0e802a11d90c37cd105a8c597cb844efb81706dedf9a6a19254dc7db8b0bec5127ab383370ddf3ea8426be5d2d9d"}, - {"0x46d4e78de408979012bcc8d12b78d6d85d8beca1b7700c410fa6a3b78de2b181a3b2d464d3d1745f5a4f722bcf667c", - "0xdcb51648143fc79a24093a797cda524c95512a51d521ec38321e624b1cbcdb9dd278c71eb0fa345eb67639e9563dd8"}, - {"0x1620bcb2404787ee39cae59ba2c85a2062aed25694677b198fed619d6558b859da3aaad5d38e773ca645cd710379803", - "0x10620b57ed7f896194775ed566c2e01276e4f7bcdf233a23ad1d3e9b77c3fa0cdf84c564c1021f5e584458ab26bd8b8"}, - {"0x6dabe74a1d15321e50aabfd662991b784c84a9b72e3340eee8efe520e68624376814038f2d1d683df0cc4f81c37a3", - "0x130be04e20fed0aabac1be1a13614e262414e7492e8701816e89b9982a435e2cf80b11474358c9bf758393f8fe05022"}, - {"0x83889427d535bd6411a28c2a0ac1d40396ee0e686f0052f0bf59abb62bd3004f1ff3a76bf93b70926638b5c05f0a3c", - "0x131b916656d906aeda904a98d7664ed693a9a793a051a824c4ed8c815835eed2bcf1d686414c859af676f850e3dfd71"}, - {"0x160c9ea53e9e85745773c4faccea8a4bc12d558b01068c2f3d88ca4d43b6f5e338a0ab7230fb044757ec2666f769dbb", - "0xb40e44b0581a642829ebdc74a3579c83018737cb432db5f3d692411082f2139753f6122e53566737d4ef53ac06ad1"}, - {"0x186657fc77b2f47a24d4ce9ff9978c8b856ebb1d23e75468ac95d73168cdd6f7ae9ed767ad52bc9a3ea835a37c34aa3", - "0xa216aa737f6a614825bc46fbbcd767235927731a2c14c71ac6e2a38da8479785028a30559d92f544c2cf5d24b542fd"}, - {"0x11e53de7dcd97d4850d8d3b3d948db5e1a33adf4d3b81342b155f926729619cf1094cb81ca5119e69a84307aa35cc4f", - "0x15ebff8d6d9c62eada64518cd85683baffe02073d8191ce5006a93c64dd1aec73e6f5c2178face4ded883af8b0738ee"}, - }, - }, - }, - }, -} - -var tBLS12_77 = TwistedEdwardsCurve{ - Name: BLS12_377.Name, - Package: "twistededwards", - EnumID: BLS12_377.EnumID, - A: "-1", - D: "3021", - Cofactor: "4", - Order: "2111115437357092606062206234695386632838870926408408195193685246394721360383", - BaseX: "717051916204163000937139483451426116831771857428389560441264442629694842243", - BaseY: "882565546457454111605105352482086902132191855952243170543452705048019814192", -} - -func init() { - addCurve(&BLS12_377) - addTwistedEdwardCurve(&tBLS12_77) -} diff --git a/vendor/github.com/consensys/gnark-crypto/internal/generator/config/bls12-378.go b/vendor/github.com/consensys/gnark-crypto/internal/generator/config/bls12-378.go deleted file mode 100644 index b30d9b059..000000000 --- a/vendor/github.com/consensys/gnark-crypto/internal/generator/config/bls12-378.go +++ /dev/null @@ -1,74 +0,0 @@ -package config - -var BLS12_378 = Curve{ - Name: "bls12-378", - CurvePackage: "bls12378", - EnumID: "BLS12_378", - FrModulus: "14883435066912132899950318861128167269793560281114003360875131245101026639873", - FpModulus: "605248206075306171733248481581800960739847691770924913753520744034740935903401304776283802348837311170974282940417", - G1: Point{ - CoordType: "fp.Element", - CoordExtDegree: 1, - PointName: "g1", - GLV: true, - CofactorCleaning: true, - CRange: defaultCRange(), - }, - G2: Point{ - CoordType: "fptower.E2", - CoordExtDegree: 2, - PointName: "g2", - GLV: true, - CofactorCleaning: true, - CRange: defaultCRange(), - Projective: true, - }, - // 2-isogeny - HashE1: &HashSuiteSswu{ - A: []string{"0x3eeb0416684d18f2c41f0ac56b4172c97877b1f2170ca6f42387dd67a2cc5c175e179b1a06ffff79e0723fffffffff2"}, - B: []string{"0x16"}, - Z: []int{11}, - Isogeny: &Isogeny{ - XMap: RationalPolynomial{ - Num: [][]string{ - {"0x2f304310ce39d2c3011a6d50eb4ece730cab541269dbc53c7594241b1c244eff01c0ce03cbe00000000000000000000"}, - {"0x9d9ea03fd9a908c76d1012fb4743eb0c720b5849c7b761ff1e3f31fc34200004ca4510000000001"}, - {"0x2f304310ce39d2c3ed885db0b1cc5b9e3043708b54c1a5cf20a52889c7b761fdaf1f98fe1a1000072f6798000000001"}, - }, - Den: [][]string{ - {"0x2767a80ff66a4231db4404bed1d0fac31c82d61271edd87fc78fcc7f0d0800013291440000000004"}, - }, - }, - YMap: RationalPolynomial{ - Num: [][]string{ - {"0x2f304310ce39d2c3ed885db0b1cc5b9e3043708b54c1a5cf20a52889c7b761fdaf1f98fe1a1000072f6797fffffffff"}, - {"0x7dd6082cd09a322f6a993378ddbf030e107849ad95ef7bbdbc611d64e38ea7c4e9cea46c7d00013291440000000002"}, - {"0x1f75820b34268c838ac8d9803d05ca3f43c5122b2366f9c76b7f1f7530b7fefd221e864e5f90000bf9aca8000000002"}, - {"0x370da3939b4375e4951f17f8cf6e6ae3384eadf7e2e1ec1c50c0af4b69009cfd4c4f87d31e68000861f8dc000000001"}, - }, - Den: [][]string{ - {"0x3eeb0416684d19053cb5d240ed107a284059eb647102326980dc360d0a49d7fce97f76a822c00009948a1fffffffff9"}, - {"0xec6df05fc67d8d2b23981c78eae5e092ab11046eab9312fead5ecafa4e3000072f6798000000000c"}, - {"0x7636f82fe33ec69591cc0e3c7572f0495588823755c9897f56af657d2718000397b3cc000000000c"}, - }, - }, - }, - }, -} - -var tBLS12_78 = TwistedEdwardsCurve{ - Name: BLS12_378.Name, - Package: "twistededwards", - EnumID: BLS12_378.EnumID, - A: "16249", - D: "826857503717340716663906603396009292766308904506333520048618402505612607353", - Cofactor: "8", - Order: "1860429383364016612493789857641020908721690454530426945748883177201355593303", - BaseX: "6772953896463446981848394912418300623023000177913479948380771331313783560843", - BaseY: "9922290044608088599966879240752111513195706854076002240583420830067351093249", -} - -func init() { - addCurve(&BLS12_378) - addTwistedEdwardCurve(&tBLS12_78) -} diff --git a/vendor/github.com/consensys/gnark-crypto/internal/generator/config/bls12-381.go b/vendor/github.com/consensys/gnark-crypto/internal/generator/config/bls12-381.go deleted file mode 100644 index 15d5c3f4b..000000000 --- a/vendor/github.com/consensys/gnark-crypto/internal/generator/config/bls12-381.go +++ /dev/null @@ -1,168 +0,0 @@ -package config - -var BLS12_381 = Curve{ - Name: "bls12-381", - CurvePackage: "bls12381", - EnumID: "BLS12_381", - FrModulus: "52435875175126190479447740508185965837690552500527637822603658699938581184513", - FpModulus: "4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787", - G1: Point{ - CoordType: "fp.Element", - CoordExtDegree: 1, - PointName: "g1", - GLV: true, - CofactorCleaning: true, - CRange: defaultCRange(), - }, - G2: Point{ - CoordType: "fptower.E2", - CoordExtDegree: 2, - CoordExtRoot: -1, - PointName: "g2", - GLV: true, - CofactorCleaning: true, - CRange: defaultCRange(), - Projective: true, - }, - // 11-isogeny - HashE1: &HashSuiteSswu{ - A: []string{"0x144698a3b8e9433d693a02c96d4982b0ea985383ee66a8d8e8981aefd881ac98936f8da0e0f97f5cf428082d584c1d"}, - B: []string{"0x12e2908d11688030018b12e8753eee3b2016c1f0f24f4070a0b9c14fcef35ef55a23215a316ceaa5d1cc48e98e172be0"}, - Z: []int{11}, - Isogeny: &Isogeny{ - XMap: RationalPolynomial{ - Num: [][]string{ - {"0x11a05f2b1e833340b809101dd99815856b303e88a2d7005ff2627b56cdb4e2c85610c2d5f2e62d6eaeac1662734649b7"}, - {"0x17294ed3e943ab2f0588bab22147a81c7c17e75b2f6a8417f565e33c70d1e86b4838f2a6f318c356e834eef1b3cb83bb"}, - {"0xd54005db97678ec1d1048c5d10a9a1bce032473295983e56878e501ec68e25c958c3e3d2a09729fe0179f9dac9edcb0"}, - {"0x1778e7166fcc6db74e0609d307e55412d7f5e4656a8dbf25f1b33289f1b330835336e25ce3107193c5b388641d9b6861"}, - {"0xe99726a3199f4436642b4b3e4118e5499db995a1257fb3f086eeb65982fac18985a286f301e77c451154ce9ac8895d9"}, - {"0x1630c3250d7313ff01d1201bf7a74ab5db3cb17dd952799b9ed3ab9097e68f90a0870d2dcae73d19cd13c1c66f652983"}, - {"0xd6ed6553fe44d296a3726c38ae652bfb11586264f0f8ce19008e218f9c86b2a8da25128c1052ecaddd7f225a139ed84"}, - {"0x17b81e7701abdbe2e8743884d1117e53356de5ab275b4db1a682c62ef0f2753339b7c8f8c8f475af9ccb5618e3f0c88e"}, - {"0x80d3cf1f9a78fc47b90b33563be990dc43b756ce79f5574a2c596c928c5d1de4fa295f296b74e956d71986a8497e317"}, - {"0x169b1f8e1bcfa7c42e0c37515d138f22dd2ecb803a0c5c99676314baf4bb1b7fa3190b2edc0327797f241067be390c9e"}, - {"0x10321da079ce07e272d8ec09d2565b0dfa7dccdde6787f96d50af36003b14866f69b771f8c285decca67df3f1605fb7b"}, - {"0x6e08c248e260e70bd1e962381edee3d31d79d7e22c837bc23c0bf1bc24c6b68c24b1b80b64d391fa9c8ba2e8ba2d229"}, - }, - Den: [][]string{ - {"0x8ca8d548cff19ae18b2e62f4bd3fa6f01d5ef4ba35b48ba9c9588617fc8ac62b558d681be343df8993cf9fa40d21b1c"}, - {"0x12561a5deb559c4348b4711298e536367041e8ca0cf0800c0126c2588c48bf5713daa8846cb026e9e5c8276ec82b3bff"}, - {"0xb2962fe57a3225e8137e629bff2991f6f89416f5a718cd1fca64e00b11aceacd6a3d0967c94fedcfcc239ba5cb83e19"}, - {"0x3425581a58ae2fec83aafef7c40eb545b08243f16b1655154cca8abc28d6fd04976d5243eecf5c4130de8938dc62cd8"}, - {"0x13a8e162022914a80a6f1d5f43e7a07dffdfc759a12062bb8d6b44e833b306da9bd29ba81f35781d539d395b3532a21e"}, - {"0xe7355f8e4e667b955390f7f0506c6e9395735e9ce9cad4d0a43bcef24b8982f7400d24bc4228f11c02df9a29f6304a5"}, - {"0x772caacf16936190f3e0c63e0596721570f5799af53a1894e2e073062aede9cea73b3538f0de06cec2574496ee84a3a"}, - {"0x14a7ac2a9d64a8b230b3f5b074cf01996e7f63c21bca68a81996e1cdf9822c580fa5b9489d11e2d311f7d99bbdcc5a5e"}, - {"0xa10ecf6ada54f825e920b3dafc7a3cce07f8d1d7161366b74100da67f39883503826692abba43704776ec3a79a1d641"}, - {"0x95fc13ab9e92ad4476d6e3eb3a56680f682b4ee96f7d03776df533978f31c1593174e4b4b7865002d6384d168ecdd0a"}, - }, - }, - YMap: RationalPolynomial{ - Num: [][]string{ - {"0x90d97c81ba24ee0259d1f094980dcfa11ad138e48a869522b52af6c956543d3cd0c7aee9b3ba3c2be9845719707bb33"}, - {"0x134996a104ee5811d51036d776fb46831223e96c254f383d0f906343eb67ad34d6c56711962fa8bfe097e75a2e41c696"}, - {"0xcc786baa966e66f4a384c86a3b49942552e2d658a31ce2c344be4b91400da7d26d521628b00523b8dfe240c72de1f6"}, - {"0x1f86376e8981c217898751ad8746757d42aa7b90eeb791c09e4a3ec03251cf9de405aba9ec61deca6355c77b0e5f4cb"}, - {"0x8cc03fdefe0ff135caf4fe2a21529c4195536fbe3ce50b879833fd221351adc2ee7f8dc099040a841b6daecf2e8fedb"}, - {"0x16603fca40634b6a2211e11db8f0a6a074a7d0d4afadb7bd76505c3d3ad5544e203f6326c95a807299b23ab13633a5f0"}, - {"0x4ab0b9bcfac1bbcb2c977d027796b3ce75bb8ca2be184cb5231413c4d634f3747a87ac2460f415ec961f8855fe9d6f2"}, - {"0x987c8d5333ab86fde9926bd2ca6c674170a05bfe3bdd81ffd038da6c26c842642f64550fedfe935a15e4ca31870fb29"}, - {"0x9fc4018bd96684be88c9e221e4da1bb8f3abd16679dc26c1e8b6e6a1f20cabe69d65201c78607a360370e577bdba587"}, - {"0xe1bba7a1186bdb5223abde7ada14a23c42a0ca7915af6fe06985e7ed1e4d43b9b3f7055dd4eba6f2bafaaebca731c30"}, - {"0x19713e47937cd1be0dfd0b8f1d43fb93cd2fcbcb6caf493fd1183e416389e61031bf3a5cce3fbafce813711ad011c132"}, - {"0x18b46a908f36f6deb918c143fed2edcc523559b8aaf0c2462e6bfe7f911f643249d9cdf41b44d606ce07c8a4d0074d8e"}, - {"0xb182cac101b9399d155096004f53f447aa7b12a3426b08ec02710e807b4633f06c851c1919211f20d4c04f00b971ef8"}, - {"0x245a394ad1eca9b72fc00ae7be315dc757b3b080d4c158013e6632d3c40659cc6cf90ad1c232a6442d9d3f5db980133"}, - {"0x5c129645e44cf1102a159f748c4a3fc5e673d81d7e86568d9ab0f5d396a7ce46ba1049b6579afb7866b1e715475224b"}, - {"0x15e6be4e990f03ce4ea50b3b42df2eb5cb181d8f84965a3957add4fa95af01b2b665027efec01c7704b456be69c8b604"}, - }, - Den: [][]string{ - {"0x16112c4c3a9c98b252181140fad0eae9601a6de578980be6eec3232b5be72e7a07f3688ef60c206d01479253b03663c1"}, - {"0x1962d75c2381201e1a0cbd6c43c348b885c84ff731c4d59ca4a10356f453e01f78a4260763529e3532f6102c2e49a03d"}, - {"0x58df3306640da276faaae7d6e8eb15778c4855551ae7f310c35a5dd279cd2eca6757cd636f96f891e2538b53dbf67f2"}, - {"0x16b7d288798e5395f20d23bf89edb4d1d115c5dbddbcd30e123da489e726af41727364f2c28297ada8d26d98445f5416"}, - {"0xbe0e079545f43e4b00cc912f8228ddcc6d19c9f0f69bbb0542eda0fc9dec916a20b15dc0fd2ededda39142311a5001d"}, - {"0x8d9e5297186db2d9fb266eaac783182b70152c65550d881c5ecd87b6f0f5a6449f38db9dfa9cce202c6477faaf9b7ac"}, - {"0x166007c08a99db2fc3ba8734ace9824b5eecfdfa8d0cf8ef5dd365bc400a0051d5fa9c01a58b1fb93d1a1399126a775c"}, - {"0x16a3ef08be3ea7ea03bcddfabba6ff6ee5a4375efa1f4fd7feb34fd206357132b920f5b00801dee460ee415a15812ed9"}, - {"0x1866c8ed336c61231a1be54fd1d74cc4f9fb0ce4c6af5920abc5750c4bf39b4852cfe2f7bb9248836b233d9d55535d4a"}, - {"0x167a55cda70a6e1cea820597d94a84903216f763e13d87bb5308592e7ea7d4fbc7385ea3d529b35e346ef48bb8913f55"}, - {"0x4d2f259eea405bd48f010a01ad2911d9c6dd039bb61a6290e591b36e636a5c871a5c29f4f83060400f8b49cba8f6aa8"}, - {"0xaccbb67481d033ff5852c1e48c50c477f94ff8aefce42d28c0f9a88cea7913516f968986f7ebbea9684b529e2561092"}, - {"0xad6b9514c767fe3c3613144b45f1496543346d98adf02267d5ceef9a00d9b8693000763e3b90ac11e99b138573345cc"}, - {"0x2660400eb2e4f3b628bdd0d53cd76f2bf565b94e72927c1cb748df27942480e420517bd8714cc80d1fadc1326ed06f7"}, - {"0xe0fa1d816ddc03e6b24255e0d7819c171c40f65e273b853324efcd6356caa205ca2f570f13497804415473a1d634b8f"}, - }, - }, - }, - }, - - // 3-isogeny - HashE2: &HashSuiteSswu{ - A: []string{"0", "240"}, // A = 240 * I - B: []string{"1012", "1012"}, // B = 1012 * (I+1) - Z: []int{-2, -1}, // Z = -(2+I) - Isogeny: &Isogeny{ - XMap: RationalPolynomial{ - Num: [][]string{ - {"0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97d6", "0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97d6"}, - {"0x0", "0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71a"}, - {"0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71e", "0x8ab05f8bdd54cde190937e76bc3e447cc27c3d6fbd7063fcd104635a790520c0a395554e5c6aaaa9354ffffffffe38d"}, - {"0x171d6541fa38ccfaed6dea691f5fb614cb14b4e7f4e810aa22d6108f142b85757098e38d0f671c7188e2aaaaaaaa5ed1", "0x0"}, - }, - Den: [][]string{ - {"0x0", "0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa63"}, - {"0xc", "0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa9f"}, - }, - }, - YMap: RationalPolynomial{ - Num: [][]string{ - {"0x1530477c7ab4113b59a4c18b076d11930f7da5d4a07f649bf54439d87d27e500fc8c25ebf8c92f6812cfc71c71c6d706", "0x1530477c7ab4113b59a4c18b076d11930f7da5d4a07f649bf54439d87d27e500fc8c25ebf8c92f6812cfc71c71c6d706"}, - {"0x0", "0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97be"}, - {"0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71c", "0x8ab05f8bdd54cde190937e76bc3e447cc27c3d6fbd7063fcd104635a790520c0a395554e5c6aaaa9354ffffffffe38f"}, - {"0x124c9ad43b6cf79bfbf7043de3811ad0761b0f37a1e26286b0e977c69aa274524e79097a56dc4bd9e1b371c71c718b10", "0x0"}, - }, - Den: [][]string{ - {"0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa8fb", "0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa8fb"}, - {"0x0", "0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa9d3"}, - {"0x12", "0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa99"}, - }, - }, - }, - }, -} - -var tBLS12_381 = TwistedEdwardsCurve{ - Name: BLS12_381.Name, - Package: "twistededwards", - EnumID: BLS12_381.EnumID, - A: "-1", - D: "19257038036680949359750312669786877991949435402254120286184196891950884077233", - Cofactor: "8", - Order: "6554484396890773809930967563523245729705921265872317281365359162392183254199", - BaseX: "23426137002068529236790192115758361610982344002369094106619281483467893291614", - BaseY: "39325435222430376843701388596190331198052476467368316772266670064146548432123", -} - -var bandersnatch = TwistedEdwardsCurve{ - Name: BLS12_381.Name, - Package: "bandersnatch", - EnumID: BLS12_381.EnumID, - A: "-5", - D: "45022363124591815672509500913686876175488063829319466900776701791074614335719", - Cofactor: "4", - Order: "13108968793781547619861935127046491459309155893440570251786403306729687672801", - BaseX: "18886178867200960497001835917649091219057080094937609519140440539760939937304", - BaseY: "19188667384257783945677642223292697773471335439753913231509108946878080696678", - HasEndomorphism: true, - Endo0: "37446463827641770816307242315180085052603635617490163568005256780843403514036", - Endo1: "49199877423542878313146170939139662862850515542392585932876811575731455068989", - Lambda: "8913659658109529928382530854484400854125314752504019737736543920008458395397", -} - -func init() { - addCurve(&BLS12_381) - addTwistedEdwardCurve(&tBLS12_381) - addTwistedEdwardCurve(&bandersnatch) -} diff --git a/vendor/github.com/consensys/gnark-crypto/internal/generator/config/bls24-315.go b/vendor/github.com/consensys/gnark-crypto/internal/generator/config/bls24-315.go deleted file mode 100644 index 835e01ee9..000000000 --- a/vendor/github.com/consensys/gnark-crypto/internal/generator/config/bls24-315.go +++ /dev/null @@ -1,74 +0,0 @@ -package config - -var BLS24_315 = Curve{ - Name: "bls24-315", - CurvePackage: "bls24315", - EnumID: "BLS24_315", - FrModulus: "11502027791375260645628074404575422495959608200132055716665986169834464870401", - FpModulus: "39705142709513438335025689890408969744933502416914749335064285505637884093126342347073617133569", - G1: Point{ - CoordType: "fp.Element", - CoordExtDegree: 1, - PointName: "g1", - GLV: true, - CofactorCleaning: true, - CRange: defaultCRange(), - }, - G2: Point{ - CoordType: "fptower.E4", - CoordExtDegree: 4, - PointName: "g2", - GLV: true, - CofactorCleaning: true, - CRange: defaultCRange(), - Projective: true, - }, - // 2-isogeny - HashE1: &HashSuiteSswu{ - A: []string{"0x4c23a0197b9ca68541a4cef14af4cfe81cc324cac5626d9ff4ee66df9ea2678877910f40300001f"}, - B: []string{"0x16"}, - Z: []int{13}, - Isogeny: &Isogeny{ - XMap: RationalPolynomial{ - Num: [][]string{ - {"0x2611d014c792a8ffd30982483b3ee757787d35c9e880e096a850c8e24edf5c71f880eff103c0002"}, - {"0x2611d01644a40e35d2dad31956fafeee9f1a0831db5b7b49ac10c81d6ff9afd483bf88000000000"}, - {"0x391ab82082520bc9ef97728ef1d4703e7115c13f9db942831972c63be0e6bc1d3ee023f70240001"}, - }, - Den: [][]string{ - {"0x261b56ebccc821ae82c6025bea42e1d731e2a911e6c66652b682a1f0411fdc017f9ffffe"}, - }, - }, - YMap: RationalPolynomial{ - Num: [][]string{ - {"0x391ab82082520bc9ef97728ef1d4703e7115c13f9db942831972c63be0e6bc1d3ee023f7023ffff"}, - {"0x391ab822bdec239aef516bc89b6e93a12b00fcdb8a012a8f9f12c514928e39310fbe080d7c9fffd"}, - {"0x391ab82166f61550bc483ca602787e65eea70c4ac90938ee82192c2c27f687bec59f4c000000000"}, - {"0x429f2c25ed5fb86b978605a6c4cd2d9e2e996174e2ad78439db091f0866286221eb029f582a0001"}, - }, - Den: [][]string{ - {"0x4c23a02b586d650d3f7498be97c5eafdec1d01aa27a1ae0421ee5da52bde5026fe802ff402ffff9"}, - {"0xe4a40986ccb0ca1710a40e277d914b0b2b4ff66b68a665f0470fcba186bf2808fdbfffe8"}, - {"0x725204c36658650b88520713bec8a58595a7fb35b45332f82387e5d0c35f94047edffffa"}, - }, - }, - }, - }, -} - -var tBLS24_315 = TwistedEdwardsCurve{ - Name: BLS24_315.Name, - Package: "twistededwards", - EnumID: BLS24_315.EnumID, - A: "-1", - D: "8771873785799030510227956919069912715983412030268481769609515223557738569779", - Cofactor: "8", - Order: "1437753473921907580703509300571927811987591765799164617677716990775193563777", - BaseX: "750878639751052675245442739791837325424717022593512121860796337974109802674", - BaseY: "1210739767513185331118744674165833946943116652645479549122735386298364723201", -} - -func init() { - addCurve(&BLS24_315) - addTwistedEdwardCurve(&tBLS24_315) -} diff --git a/vendor/github.com/consensys/gnark-crypto/internal/generator/config/bls24-317.go b/vendor/github.com/consensys/gnark-crypto/internal/generator/config/bls24-317.go deleted file mode 100644 index 2c5a3f896..000000000 --- a/vendor/github.com/consensys/gnark-crypto/internal/generator/config/bls24-317.go +++ /dev/null @@ -1,86 +0,0 @@ -package config - -var BLS24_317 = Curve{ - Name: "bls24-317", - CurvePackage: "bls24317", - EnumID: "BLS24_317", - FrModulus: "30869589236456844204538189757527902584594726589286811523515204428962673459201", - FpModulus: "136393071104295911515099765908274057061945112121419593977210139303905973197232025618026156731051", - G1: Point{ - CoordType: "fp.Element", - CoordExtDegree: 1, - PointName: "g1", - GLV: true, - CofactorCleaning: true, - CRange: defaultCRange(), - }, - G2: Point{ - CoordType: "fptower.E4", - CoordExtDegree: 4, - PointName: "g2", - GLV: true, - CofactorCleaning: true, - CRange: defaultCRange(), - Projective: true, - }, - // 5-isogeny - HashE1: &HashSuiteSswu{ - A: []string{"0x8e4edadd82ff003e6762cff9b559b8cd0f3f6c9311276a6d560dcce30e697a982e1866e3e7c28d5"}, - B: []string{"0x2064f87ea0196ecbb9b075804c613d4776224e78064823a8568e30f5ad5af3bb70ee17723af3a0d"}, - Z: []int{8}, - Isogeny: &Isogeny{ - XMap: RationalPolynomial{ - Num: [][]string{ - {"0x236b5fd9cca05871bd84a4837633e369779c83cdd8e57f5e6c225b947983cf102a89412ca193804"}, - {"0xbd5fdd72856b15e73452512781cb8a44afc43fd20722b37bf41b260fcb6b2a53697eaaf34dd4055"}, - {"0xe48ccd9c11799e37b9f9713ad4c23c792bfe9cce20bb64b953983bb7789d7a5d28b1cfdd29c6212"}, - {"0x3c02ee7a69adc553341746545c583c06a0d844f638330a35305f5e8e312457c0ab57bc2702dc270"}, - {"0xc836be99bb812fca77c672366482945f54dd793103efb9504eb992da7132416060b75c14fb7999e"}, - {"0xfb165e39e1f3c02308a056717044d039ad1a5aa191127f2160837936541ff83badd4b3430f63d71"}, - }, - Den: [][]string{ - {"0xac526aaa4ccfab9e20d1af55e1b46e59df4ccdf5efa58766d0c18ac6326551818ee9e90fa19a875"}, - {"0xd8ed9eb76dc3ca65e3c54629ff1dbc57619627e2efb082c3f4601ec65d293de69e57eb95404a6b1"}, - {"0x6fc49fca38657cde5fab7a027bf50b888cb23b6952698615ff744257a41fa35df7f708c34184a19"}, - {"0x23e8941f0cfac565a7a6787558193984724c940bb5db04b86f4a98572244fc21a180f77d539d5bd"}, - }, - }, - YMap: RationalPolynomial{ - Num: [][]string{ - {"0xff4f99c01dfcb3892a91fa883b348828de9460cb96389fb35ffb06434cdeef1ce46b03c5dd5d0f7"}, - {"0x81224ed3f6692419ae30d702d3eda4710053bdbae2d49fe1f4ae22ca850ba727e1ccf7e5701c164"}, - {"0x45054affadf894503d5833cfd9dbad5eb905a527a12b5e7dcabd0052793f9b49e64e957dd42da4"}, - {"0x18eeec003ff866c9fb04c7371fc3383d385a2be91d8a0433f6974c71a0ce405f122c83719f1393e"}, - {"0x31dd068a643f47a6596e317e958886ea2ac504968e1c5cf09c8d5776c6643ef4de74fbdd8c4a619"}, - {"0x2c8e3ae176f645fc860fce8de1b13b50c4000167d09963c6e1a9c672f88f4f8d0503c022726fc95"}, - {"0x9f05a21397a2e89eb8a9d058e93ca60265193966535883b745a89991576994ae547e2d441247c3f"}, - }, - Den: [][]string{ - {"0xd3e018c50c3942dd4d09a4ab202a25696610ba38204d026ecdaf526c2f6f7087e577ad578cd63a4"}, - {"0x8287e2ff37ee6fdebecdbb7847a885def88d0241d5cff2567cb4bc388b67da5687eb6031701f843"}, - {"0x59d82ad3a832a32188e27cac33b5e6c5598cb76c8ac13ef00b5d65852db61f05669c372e5dcc771"}, - {"0x56b84eb18c4f8eadcddfdda011cc2f7b5c06990035936f127ba77996f19017f4ff02c13009b3e70"}, - {"0x7d08817b694fb1681686e845fda634911d8d84dc73472bbe89ad038a351d9729f4e2626dc0ec353"}, - {"0xb8a32f420e7c71800ff7e1b5c3f4580f6045ed45b702294b5e89b3a4548d7626dccae5eeeac55f1"}, - }, - }, - }, - }, -} - -var tBLS24_317 = TwistedEdwardsCurve{ - Name: BLS24_317.Name, - Package: "twistededwards", - EnumID: BLS24_317.EnumID, - A: "-1", - D: "20748505950524021841644589704740731932416084248011369709738936344973878925081", - Cofactor: "8", - Order: "3858698654557105525567273719690987823069521430163883173133245580997415449969", - BaseX: "4348505656527095883506785370890963704100065639426869666063106978260788240233", - BaseY: "1929349327278552762783636859845493911537170411830425720219700276810167091201", -} - -func init() { - addCurve(&BLS24_317) - addTwistedEdwardCurve(&tBLS24_317) -} diff --git a/vendor/github.com/consensys/gnark-crypto/internal/generator/config/bn254.go b/vendor/github.com/consensys/gnark-crypto/internal/generator/config/bn254.go deleted file mode 100644 index c3c90748c..000000000 --- a/vendor/github.com/consensys/gnark-crypto/internal/generator/config/bn254.go +++ /dev/null @@ -1,72 +0,0 @@ -package config - -var BN254 = Curve{ - Name: "bn254", - CurvePackage: "bn254", - EnumID: "BN254", - FrModulus: "21888242871839275222246405745257275088548364400416034343698204186575808495617", - FpModulus: "21888242871839275222246405745257275088696311157297823662689037894645226208583", - G1: Point{ - CoordType: "fp.Element", - CoordExtDegree: 1, - PointName: "g1", - GLV: true, - CofactorCleaning: false, - CRange: defaultCRange(), - }, - G2: Point{ - CoordType: "fptower.E2", - CoordExtDegree: 2, - PointName: "g2", - GLV: true, - CofactorCleaning: true, - CRange: defaultCRange(), - Projective: true, - }, - HashE1: &HashSuiteSvdw{ - z: []string{"1"}, - c1: []string{"4"}, - c2: []string{"10944121435919637611123202872628637544348155578648911831344518947322613104291"}, - c3: []string{"8815841940592487685674414971303048083897117035520822607866"}, - c4: []string{"7296080957279758407415468581752425029565437052432607887563012631548408736189"}, - }, - HashE2: &HashSuiteSvdw{ - z: []string{ - "1", - "0", - }, - c1: []string{ - "19485874751759354771024239261021720505790618469301721065564631296452457478374", - "266929791119991161246907387137283842545076965332900288569378510910307636690", - }, - c2: []string{ - "10944121435919637611123202872628637544348155578648911831344518947322613104291", - "0", - }, - c3: []string{ - "18992192239972082890849143911285057164064277369389217330423471574879236301292", - "21819008332247140148575583693947636719449476128975323941588917397607662637108", - }, - c4: []string{ - "10499238450719652342378357227399831140106360636427411350395554762472100376473", - "6940174569119770192419592065569379906172001098655407502803841283667998553941", - }, - }, -} - -var tBN254 = TwistedEdwardsCurve{ - Name: BN254.Name, - Package: "twistededwards", - EnumID: BN254.EnumID, - A: "-1", - D: "12181644023421730124874158521699555681764249180949974110617291017600649128846", - Cofactor: "8", - Order: "2736030358979909402780800718157159386076813972158567259200215660948447373041", - BaseX: "9671717474070082183213120605117400219616337014328744928644933853176787189663", - BaseY: "16950150798460657717958625567821834550301663161624707787222815936182638968203", -} - -func init() { - addCurve(&BN254) - addTwistedEdwardCurve(&tBN254) -} diff --git a/vendor/github.com/consensys/gnark-crypto/internal/generator/config/bw6-633.go b/vendor/github.com/consensys/gnark-crypto/internal/generator/config/bw6-633.go deleted file mode 100644 index a0584e29e..000000000 --- a/vendor/github.com/consensys/gnark-crypto/internal/generator/config/bw6-633.go +++ /dev/null @@ -1,127 +0,0 @@ -package config - -var BW6_633 = Curve{ - Name: "bw6-633", - CurvePackage: "bw6633", - EnumID: "BW6_633", - FrModulus: "39705142709513438335025689890408969744933502416914749335064285505637884093126342347073617133569", - FpModulus: "20494478644167774678813387386538961497669590920908778075528754551012016751717791778743535050360001387419576570244406805463255765034468441182772056330021723098661967429339971741066259394985997", - G1: Point{ - CoordType: "fp.Element", - CoordExtDegree: 1, - PointName: "g1", - GLV: true, - CofactorCleaning: true, - CRange: []int{4, 5, 8, 16}, - Projective: true, - }, - G2: Point{ - CoordType: "fp.Element", - CoordExtDegree: 1, - PointName: "g2", - GLV: true, - CofactorCleaning: true, - CRange: []int{4, 5, 8, 16}, - }, - // 7-isogeny - HashE1: &HashSuiteSswu{ - A: []string{"0xb5b90ddda6922f2689cf6d2cd62fc7c093d1edbb9b9cb78ba3a6fbeb5740830110ea006288b01bc5c3ff21599bc76c3cc068855d91995e0a03f25ad67e9b0cb86f833df84de9affcac130e2de80208"}, - B: []string{"0xbb475f2945d16aae79792dd2f17748101c2558a952d4221e5a52bee6083040e779fc8d5e9c51ac35df601e0273b10c72f2b0d48da6bbc3859a3b185a7ee3060030e001265b3803227cb9d879f408d9"}, - Z: []int{11}, - Isogeny: &Isogeny{ - XMap: RationalPolynomial{ - Num: [][]string{ - {"0x172ae0280920320d5154453cfc38fb78e8f3cc1f3e35c38bfe870403008707ab1c9d324595b739426a3f8e03cc03f4d2e6a3b21c833c83d2c147adc9dd927523d2b556276090b4e6217d4125c656bc"}, - {"0x3ac72438aeb5851d31e592b661151b037c9a2aab88cd7a2da79158e39dddee35c360788859c6aa878660fba8caaa9f8ff6480a0abcb9f9122c929e9b673eb8cb8ea164ca1e9eddd03b4155f0ca87aa"}, - {"0x6f2cca97746292add854c01e5d06bfd8282d74cbcd0e7169e2e310ca27302cee61398208840e20a9d6ffe43db9c520799710059df25e8ce05c304f59d65d4e596cd1c587a7f6f1096e53656f93f1cc"}, - {"0xab5eb0567468008b2665f73dd0c7711c3166659434e0df8f5902de8acae5cccd4707d236e5af68f88a02aacae38e2a2bd3b5bf4442e127a36d13a47260eee3fc97ba5d9d5e15d105e256c0d86e9b96"}, - {"0xd6c992e6deb66a0d2cc1008c227fcbfdedcd136cca4dd9708cf0217e554124030fb2032803e9620d8af19f3aed51abf6d98ab2be038495edf761550d84fd1fc92f803661d045879877b8eeb2d62c3f"}, - {"0x5964f96bcd18903bd4385390d129f87d141bfa129dd9b10c1657e88b13aa4830591458fe69f1c5422f8a9c04dd9ae4dfc55d44546d129f4b4bc708af118b9ce685bd0b9480e21af262b9fdde470769"}, - {"0xdea100c7e48b278c46938a6636d0988eabab86cc555a2988cae5b7c5ec0c8e9090740796a622b4ba807360da51be9823c7844464113d8cf0d134409f68758d4500cdf13cf6bc705cbb3b26a6b91ffd"}, - {"0xcc44dbc9cd7135b427007ff6d3fe49ce12b5c3cdec0a6af272524c19b15decb7c66941fc70b0e1cea225709a41d8da2dac0afeaf69770aaa930ca8be861e392fb2f3f5b8662e2a3757495ea31eb1ab"}, - }, - Den: [][]string{ - {"0xdcedc9bc56dade3f84967eaab07772e6382d825c853b5f21b2aa334ece09ca419a918ad532943018c0af9c373d006d5a5db3dae9cacbac8e1f7ca091dbb63f6e6f6beaee1370beaea58439a6b07a79"}, - {"0x195b81736d1c96d7a634ccd1a30ce5322c4d511b000e0c45cbe40e4fc193787b0b60086e3e4d2eeaf56537fcc1d7dde1305f6f1f43da15fa5a860515b5ebd80a71de65dfa88d88b4dde8a70ebbe4d0"}, - {"0x7306846c2c81b999dc05637178c43d7bcaa8f060fa6118084a2a801ba72736fbd0a2af9da70982f1e36c1c2485775de607d049a5faf6494d4d3eedd3ff5a760faf17ed0596c1e1a8aee8112ae305ff"}, - {"0xf148e1a26098d0488ff6183b6455f5e6605c502a1eb3c11e32096d10f777563a99faa0dba8835bfea9529f125f36903c681c7d9dd0bc814a1786cf0813388a804eca85fbaa5bdd78f7d746269d6bba"}, - {"0xde8e351bd12bb3d5af8b63954d0f78bfb4bc60813ad171eb74cf3eba9f691dfb1dfe147ffef06b9aca6a77d845184de3d4ea5948fe12fccec2371477802f2f6e865c39af78f97e392a54f81cb069fb"}, - {"0x10795e5f91d91e69bcdf124c64c0f1e2507ffc99bacb24dbe7d3cb6a07de6bfab41b8f939edbacfafd0ce0b72a847fa1169d64cae412d7eac428a1e2a570a85c42e5ab2bd355b6a2460289e03f1d8c"}, - }, - }, - YMap: RationalPolynomial{ - Num: [][]string{ - {"0xc0e9192eb96da62a98ed351e9c479d437e885f7b173bc0e8b5e117be8f9bc0b8784293b4edd36184584c570f1bbacfa6390dfdab92c1102aff64793eba4e0ca54166b6ea37f041d97e17d6b8793f59"}, - {"0x2ad94cfbe3e7c1f6c73f4b7986081a8747e453a324f5fef697f4bcd681b93764606aea1c234fcc16f02941c568e7e0fc9c970db8891079fecbb13a701870973155097603fa2a95f3a9814d630920ce"}, - {"0x4fe83943570d36473c925cb80651566f48ed1a12583a0ba466a4002cd5d81324bedc2af4685ce69e8ac8c982eff0e88e8983860fc7c365efd617110a18f8d2cd2c5f5a764656d1f0acd219dfa36482"}, - {"0xb2169bd7a853b597c830c30e580e9a4d2e3c25dd81b72667ca4370b2a978cdeb7bc9812693ef630bc510a4151170ad8c0618c4a038608977391fd3d83479456ea6802236a0b3de82ce1017e1a8ca6d"}, - {"0x7f25b01ef9844f28aa0a93cffc07a16e1cc68544c7f6772babb491e4a268f152a38b8b45123c9b054de66169553ba6059e8af4dc33ee26093d08489f85450d8c5be80f1ba5aeb2c0d0afd9f92a9122"}, - {"0x566545c6ba909462ad89503f026cd53fa3d34c013226c353b14aa982fb2fb682901be8b4a6341ee81a65270009af992892249cef724bf97898b1c3fc17377d4432a23894970c6dcb3583b60c84fa24"}, - {"0x63e2ccd9a60b841370ac46210ce9788ae1562f251ffddbf6c1999647217f1fb641c6b28725006db4784cda2bb6149c5f7e8a0e1262cf65258d29f63eedcf4651d9cc6f36cf1754ac816f22fc61b9c7"}, - {"0x3f2fa1f528148f6695c61636ddc28b114cbe73a59ff01987fa09ce591615c9c3588f43eee553df2b678321a7348d1d9609316cb0a7a99d816beb08586b2c6f140dbef23f030253c0e4c06208d60788"}, - {"0xf607a90cc520cf3642e858f10134f611165201f1a19d8aa556830a8d119c70f050ade9579d2af2437e4daed7e8413b7eaa57066a4f1637a9eb355979a9069b53019d4f6a3b12bd11e65f30fb97928"}, - {"0xcdfc4b597b44fc122ba1d93dbe1c643d84e251481f80d31b34e546493c89bd3a651ed920fb518fce37f21fcd0850fe6e97f9e08e774242b04f71dff19a9b401ee3c8d55d71cb9849041ef6054c20e"}, - }, - Den: [][]string{ - {"0xecfc2a8f34b76242cf9989e6693e365112eac88902ea95115bccd5bb49a664d72b2eec54104241f9c5f1a68018d8eb3db2d854d09b081df9a369bd4312614d50899c909fbb2d2b52a7635c4d17f8b7"}, - {"0x742dda08c1fcb9436c2bc5f52af4d8189585537efd4b1a7f91fa77b5f737b8c6fabc388a01078294e7dd2198b8a32fa89354400dcec753d887b198f206ae05288915451a752ef75b75d8c360ea36bb"}, - {"0xc1d1190593e7a0686859a609ff1b46e11c0327a20872f72279a21b183a44281d0cee21d747715e9dc19f973b098c1dd3599593b70f85733addf045ea08642a6f840f99002986bec1f94bee017cd4f1"}, - {"0x97e05de3ca9556f56ecf4d1ea23a7e2d2712c0ae94ae9e446d965d7004b483b7422f99fed04fdddbc0c2d7fcc1145f04ad2f384637ed52da52a2fda64c67d29b756381ab78f85d74ec8086cfcb9179"}, - {"0x75ad4fd71ac6a390fe643f2d7e58ab8e47679afea937b2fa282221167c5e439b8d0b71d9d9c415aced0755ce72f558c6b966b4103521c4d576e232006e02ce0aea7d969d59bb6aa7fd0464bb753ee9"}, - {"0xaf031142ce65bb40b7b4a865ddf8b662e90c8f6496d6e4efd790353e79905de96971b0e90ecbe0ca95cb602145603cf7e33d79207c766500002418e725368fd15fef6ad5fd2d70dde8e192180d408b"}, - {"0x906c22013e788817b69f3c5705a7dbb9efeedabf5d8f091b518cde2891e351aa73cff16f909a2aeb160dc3e26f0ea78b07d327cc073494f8fa334f7b15c42f6454ec151ac079a3a0802d1f9eabbbc1"}, - {"0x9435c646c7573441604b5c0e0a53569e9440440e3e8df291c6ad158f942080d9a60829e933883e3bdbc574fc459c167608aa11e7b0ad4ec1c35e29c0cc81bf2b7481e35d0821b52e5ee02dde63ecf2"}, - {"0x18b60d8f5ac5ad9e9b4e9b7297216ad378bffae69830b749dbbdb11f0bcda1f80e29575d6e4983787b935112bfc6bf71a1ec1730561c43e0263cf2d3f828fc8a645880c1bd0091f36903ced05eac52"}, - }, - }, - }, - }, - // 2-isogeny - HashE2: &HashSuiteSswu{ - A: []string{"0x37406b7fa0e08ee1ffbb1ff2ff0ac49e29ba75a3caa8356b90991ae70b94d33807a85e57856205541ab2cb490d6980835d627d3d10b29e4d73a43caf3b5042cf1f7ab420fd005e2d747ffe14"}, - B: []string{"0xb0"}, - Z: []int{2}, - Isogeny: &Isogeny{ - XMap: RationalPolynomial{ - Num: [][]string{ - {"0x75c14b832491ee6015aa114d85d2ae69f27a247446da31831298835185ff04f44ee6dccb2179be43cf8cd0695188add97e49c08a2a617963eb40e8291283e4750d0e7862161f19fc5d41132e666653"}, - {"0x3ae0a5bf44ef27340179bf3c1b1d57bfae1f8ba310fd8743c24a07d811f3b8d9abeaa1653f0e462703b0da08e15133e1856a302131162f7bee2f30da626a15980dd9c8e5109d60f3a3f1f25d03333f"}, - {"0xdcca6d90b6878afd13917b416160083ebda295861b5e157ac318f4234ce3a3a0fdfd10bc26fb6c8aa3f786e2f81d371e8ae63cb24e3b05e1c85adc0a2b519bede8f4de4cf5f96da176d12fb414000a"}, - }, - Den: [][]string{ - {"0xeb8296fd13bc9cd005e6fcf06c755efeb87e2e8c43f61d0f09281f6047cee366afaa8594fc39189c0ec368238544cf8615a8c084c458bdefb8bcc36989a8566037672394427583ce8fc7c9740cccfc"}, - }, - }, - YMap: RationalPolynomial{ - Num: [][]string{ - {"0x126633cc0f35f63fc1a174f01d72ab5a8fcd8c75d79d2c74e59769ad9bbda2f8152a6c0fadea490b8da9f5e83f57c497e0e8850edbda407d7b5ce7ab839c2253d369bd31147f73cd74916ea456fffff"}, - {"0x93319e5991a24209f0f9cb40f4315c749d13cfe9859aaf2dd7b49ffacac9badf36b8f97c7a467d6bc10f04bea464bb9d5a14180b32825c49c49373ada8597cb731458fa4b4a51a4c047faf74280044"}, - {"0xeb8296ff61166ccc0f42465b14415e74039bb5235665ae8cd02a5930f8daad072b3352954de7b196f2d8f64f4cb7f2914f6370a8a8734b25c02e06a3b0803302b01496e03ce7afd91a7660ae3ccce5"}, - {"0x6e6536c85b43c57e89c8bda0b0b0041f5ed14ac30daf0abd618c7a11a671d1d07efe885e137db64551fbc3717c0e9b8f45731e59271d82f0e42d6e0515a8cdf6f47a6f267afcb6d0bb6897da0a0005"}, - }, - Den: [][]string{ - {"0x126633cc0f35f63fc1a174f01d72ab5a8fcd8c75d79d2c74e59769ad9bbda2f8152a6c0fadea490b8da9f5e83f57c497e0e8850edbda407d7b5ce7ab839c2253d369bd31147f73cd74916ea456fffcd"}, - {"0xb0a1f1145e7cd5e35c021434850010ffc24b2c49e7205af348b606dbc306fd4454217a29fee410d1018e8f069ddb24da811e2ddd8964a0a74496d8786c10bd5bad5b3f5795d10a1d2b8f34ffa99b2b"}, - {"0x75c14b7554770e77dd8658cd970ab1aa2fc8fce9d83cc890688b286d5fb84b3169b20ec937622862770b7b62a4d5db9623e99fb2d1c22a1fbe9954cc2974b8a638fdc49a377211bd1d2987d14666da"}, - }, - }, - }, - }, -} - -var tBW6_633 = TwistedEdwardsCurve{ - Name: BW6_633.Name, - Package: "twistededwards", - EnumID: BW6_633.EnumID, - A: "-1", - D: "37248940285811842784899494310834635440994424264352085037441815381151934266434102922992043546621", - Cofactor: "8", - Order: "4963142838689179791878211236301121218116687802119716497817028544854034649070444389864454748079", - BaseX: "37635937024655419978837220647164498012335808680404874556501960268316961933409049243153117555100", - BaseY: "23823085625708063001015413934245381846960101450148849601038571303382730455875805408244170280142", -} - -func init() { - addCurve(&BW6_633) - addTwistedEdwardCurve(&tBW6_633) -} diff --git a/vendor/github.com/consensys/gnark-crypto/internal/generator/config/bw6-756.go b/vendor/github.com/consensys/gnark-crypto/internal/generator/config/bw6-756.go deleted file mode 100644 index 4657c6cc4..000000000 --- a/vendor/github.com/consensys/gnark-crypto/internal/generator/config/bw6-756.go +++ /dev/null @@ -1,177 +0,0 @@ -package config - -var BW6_756 = Curve{ - Name: "bw6-756", - CurvePackage: "bw6756", - EnumID: "BW6_756", - FrModulus: "605248206075306171733248481581800960739847691770924913753520744034740935903401304776283802348837311170974282940417", - FpModulus: "366325390957376286590726555727219947825377821289246188278797409783441745356050456327989347160777465284190855125642086860525706497928518803244008749360363712553766506755227344593404398783886857865261088226271336335268413437902849", - G1: Point{ - CoordType: "fp.Element", - CoordExtDegree: 1, - PointName: "g1", - GLV: true, - CofactorCleaning: true, - CRange: []int{4, 5, 8, 16}, - Projective: true, - }, - G2: Point{ - CoordType: "fp.Element", - CoordExtDegree: 1, - PointName: "g2", - GLV: true, - CofactorCleaning: true, - CRange: []int{4, 5, 8, 16}, - }, - // 2-isogeny - HashE1: &HashSuiteSswu{ - A: []string{"0xf76adbb5bb98ade21e8fbe4eef81b6e9756798f2e64bff3cb65781179d6b076b17683f3cd5042655e16802b1a5b1b5b5e386e23e2731d24c843595d5c79ca4b8b9179cf10cb86e782d614a1f78930c25aeacdc30c0008fb417dfffffffff2"}, - B: []string{"0x16"}, - Z: []int{11}, - Isogeny: &Isogeny{ - XMap: RationalPolynomial{ - Num: [][]string{ - {"0xb99024c84cb2829c6f231ad6488f8ecbe73b35d177c03c95a1b5d4aff107d954726713be7dc02432d0d2d3f919a6b98b6ff46f95026f313a3f953d1776abdcc48d809cb0a92e2b7464ed6eab9312f612a13505b1d000072f6798000000000"}, - {"0x26bd1df0d7ae6c65ccce9c94a71497cd125c27c5fea6d502de92ee64cfe6161e0e05eb4aa16bb7f4c55960f84e03d6b986c05315e0dc296ea61a6ce0bfe7584381b90f97adb14083c7e63f8683ffffb35baf0000000001"}, - {"0xb99024c84cb282a010dde96a80e9b8571a99e3c121ae77cf5a598f3fd0abd199502d6d31fb5237042160e2f83bbff87df05586dc52cb529ee19d07248b4fbf241ffad1c2a6de71c88e46e4e3dbb1026d5ecafa4e300000000000000000001"}, - }, - Den: [][]string{ - {"0x9af477c35eb9b197333a72529c525f3449709f17fa9b540b7a4bb9933f9858783817ad2a85aedfd3156583e1380f5ae61b014c578370a5ba9869b382ff9d610e06e43e5eb6c5020f1f98fe1a0ffffecd6ebc0000000004"}, - }, - }, - YMap: RationalPolynomial{ - Num: [][]string{ - {"0xb99024c84cb282a010dde96a80e9b8571a99e3c121ae77cf5a598f3fd0abd199502d6d31fb5237042160e2f83bbff87df05586dc52cb529ee19d07248b4fbf241ffad1c2a6de71c88e46e4e3dbb1026d5ecafa4e2ffffffffffffffffffff"}, - {"0x1eed5b76b77315ce6c7800aef7b306952f8658ccae70a80831fd94f251e13a45b7ccc7290e7ae2e14ef34b51df3471733e5650ac56b2e140baada4fc20270074f385fcf816086d73d46b785d5a289f4a69c36293f7ffee097d04000000002"}, - {"0x7bb56ddaddcc5719024ebf85e3a0a46fefc545c5c0628b194a34c4ba6ac12eab1339f794cfc8e22966cea64f49ee8f4675ef712f878e58793870797ac6d90c77a7cc163e6cef3cd9dd88b97adb140df8fcc7f0d07ffff8d09868000000002"}, - {"0xd87d803f042598656902e5a6ebbb571049b389b6a74b8bc73ebdd1ca73731f32dd8a54ba4fdfeada26f108cc45b54c92edb91d566097e064073732fff7dd09aa254f4a0dc2ae2f69fb52b5b4804e82d4ee97795b380000000000000000001"}, - }, - Den: [][]string{ - {"0xf76adbb5bb98ae2ac127e1e3568cf5c978cd2fac2ce89fbf23221455163a6ccc6ae73c42a46d9eb02c812ea04faaa0a7eb1cb3d06e646e292cd15edb646a54302aa3c258de7ded0b685e868524ec033c7e63f8683fffffffffffffffffff9"}, - {"0x3a1bace94385a298b335eadefa9ee3b39b8a3ba8fdfa3f844ddc659737d9212d1508e0eff22193ef280611747505c2164a207ca0d14a3e25f927a3511fdb0465429597638489e0c5abd95f49c5ffff8d09868000000000c"}, - {"0x1d0dd674a1c2d14c599af56f7d4f71d9cdc51dd47efd1fc226ee32cb9bec90968a847077f910c9f7940308ba3a82e10b25103e5068a51f12fc93d1a88fed8232a14acbb1c244f062d5ecafa4e2ffffc684c34000000000c"}, - }, - }, - }, - }, - // 17-isogeny - HashE2: &HashSuiteSswu{ - A: []string{"0x2693fe3f93094f745f2f924da1a4260675024d398700e46db4678d6c77e732927310a52e43b73de56540c9dde1f7896d115a7661f0e25e7c54754324cb2ab353f985c8bdaccf0b3ae0e6ee49e40dd2b5d8aee87356b60e17f9de343033534"}, - B: []string{"0x4577fc0edab719863d99d99fa7737b795dd19e05021cf50e2bfaadf8d3cf9670ba09ab81773af807f37f714475a819c9dd47d9d9b93ec37c70f3b857252cd99cac4151e0b42eb00271779d66c0b0c79e7f450a1fd85b66a23256679146fcb"}, - Z: []int{11}, - Isogeny: &Isogeny{ - XMap: RationalPolynomial{ - Num: [][]string{ - {"0x57b49e22a638e7ce6fd84adb98fef2ee37a078dad5e6db136e00515b7db476b3092fe24c634db1c19b32784bd06db0e1bdbcc194bd2ea84b5485485423516adaf53426ca54ef27fe07de0370f3473b05fab20bba48a8ceeb8f39138734a79"}, - {"0x4eb16246adf77c244d7c96da07c828728ec8cf4f73b36f9d3b8638cd7d5f00932de546ce6d666b6c1c78a99b824336da2aa7cf8017843619aba11c4e20eed632ffbd4ed04676972f223e842b7d9f408585f879993e979cefce07f6b320f98"}, - {"0xb0fe2b7d5cc6757f09eb475d4ec4eb2892eec65ebb4d0b73dffe388dc8b625ae1094586e7d5f12d55eae19f405323e54346d6e75fe5e30ed86a66f3bd956f2e0cf3b68afc427260f3782828672bc312081de7f76b025cb18780f79ccbb931"}, - {"0x63ae87b32561b93fb20fe607e846b376b2db30eb8774a0c741bc2c2525053672f753b6ea1b420fc0817c91332c754ee91bbdf25a5e5fb852314dc28a26aef1a6fc6bae25a0285b8355a97b597283baeb152f6a0ff281a7a6029551336d19a"}, - {"0x8e95e735b9b8a53ec343d0960e4ee6f8d38aaadd78fb413533fb771a3be16d1dfb91d669d0fdf927aa93c60a147c23c6b26b66cab157b3b1381e64646aae66dfc53e2698852470de8fb92e17b4504bc43249a9a2e7330e3b5e25da416f46f"}, - {"0x5f0f6d5f0ff7ce8777840d1c4d25d85f9a63f04df2479c5b73f1a95a3caf20143e0bf4e9412a9d9d63de7b03be54cfe59522fa2405cd2b02340479f9c8776d6ea9fca2dea8d6d71f455162a6e9f40b76311257170313a8682db61095c7bb5"}, - {"0xce64c0bb237310b05120e54a6ce7ca932dc2d6411b9761463cf0c31e07d4caf5bac19db735631219b68c1dd00e79f19e2653d050137a01218f5b1371d9a276a8938dfd36a0565662a1c60e970b0ba6ca1e330ca446d4863f5c44cf57dfe70"}, - {"0x5c79bf1abe91cef7276af031994044074bd33da0fdde5d1356095b3d02fa2d46345e935838131a84e7408ef41afb492c5a5cf8256daa4be842a0c4e9056f1f3eae94b3d47a78956718cec82b21f3e51338e5e2dea165bb52ed3c3fef55e2 "}, - {"0x528d835a2e6a30781df335a708c54aeb2b71dea9a27564944950b4eb0d8298a44b86f039ac8815883395a340deb72664ce9ef1d01799fe56b8141ffa816ff7ce020b37944db6c438b78a9e78e96ccbc63cff0f7f7e9366ee17fcce48ded23"}, - {"0x778a6ab417356eb65d79c0a0a1cf6d67f3de72168b1ac6c13f3f619fbb33e1da96b6b4b7f07ab0d82d1702006321158b231b405cfbffe44d033ba590dd218224ea7c800dfa1f00dfc41bc8d4f7d6ae966107bf5589f8ba66cfa90c23216c3"}, - {"0x4147349d36fc97c1ff5e168c56d665d0b6f1a8a048eb903e134490eac3b6d62e9c4741b77e0290a585bfa7a1c0dc29fe0b8000728ae4d7f01a849fde08e5c268914f0dee8ed42612e1531f958cf84126358cd261871bded7381b133541604"}, - {"0xc471c9e9bbb09990d5e6c9f5017fe1382bcb0835464ce01b69391ec611babbeca074b376ad1d5ee9c49a2214a89824f408b8eb1dbf80b9851997a2d7f4fc288fb2ee7c3c4fa9d52283e977c924af4c360c5332fce61c340d6af7edef6cfff"}, - {"0x44d18369bb41e08dea957a700307d9929a58b5565bb4fc9b985b6e98047cf473b636f6afa8ddf5cbf053e02477a616339eaef3bdf402e782850a2dc76555e82e8e803f2aa39f76249929725c6ca5d292d4b10aee3535e3c9d9368f01216da"}, - {"0xd46505c4491681e80a79fca2f3899ddefc5c765972f1ff4f4d20c6b8b89b0be5decd3e700f31ca2a0a24759dab83fd694a850902b3e14d656e4864b6fc2bf1f4aac08ed4fd147884840cb0cea7f94b0f923fb94ce65f77b5992c71e1e5038"}, - {"0x6f9632f9f15470710c2004132ef3ad5f5600087a3195f06fa2a1e69c0aea80a94e43c427cd681cd23040668e3aef649d09455fa213ab6364c58327073c8c798963672d092a60943e08d17f05771a42e6abc0d30ef3f1ec16195ff2e6d455d"}, - {"0x9a51e637dd926867d26d4fea699ddbf56041fb4767c71b5cef365a2a944cb79879168c5a93b9fde6be4d414a4016b01b70c039253548cc08b8309388a1a511ebf1dc8f8b9c436cb21aa944c9240a0c1834fc199be1153717ea4ad6f5cf86 "}, - {"0x52852129f19b369553182b651e1a006b282bec349935ab9fd2b392c7e43de42da08efb80da828e5bdb508c3a396e6e22a4f596da57126b2c654700cca80014fab35dd74dabc755ea253556e3d6a77d3d93f85b80b56fa4d4011970a59dcc4"}, - {"0x1c4076fbf2dfd41be9c3e3c24375f6dc8ab18fa163e8f502566471ef2432f6472cfb668c7b4d2e7753eb5181083607b70cac77be553df58c3b26f757f1c70c45474e0c72ac735c9e176ee3f4a10142ce372df6465e1e1e1e1e1e1e1e1e1e2"}, - }, - Den: [][]string{ - {"0x67ca0a05ba18be2717328e9da3d366da18fe119dbf0c150dd6e49daa6ed4f8de92e85a04bc69f045366c80877116759af4bc0c2a6f49ec158f0a2ba5e118ba6d26ac9f2821aa917978d4a606d940397818481adb5ab3f2c9670d2faac21bf"}, - {"0x461d07431e8397832b6ae980dc75548271ce6a87465b5ea5292316b8b1eb078b69e551472f41df43806e24ad887fcb1f551938ec0efc00499f7c3ba5bf7d8ec6d63a4ddd274aad64d716307d11a0ddb9d1c0f40296317c29455075bffb2ba"}, - {"0x43635d242d3fb85cfd3a36bfa1e3628afb5e1e14ae9f67f5ab735f8f6723bc48ba9c507c50e703220244876a482f00f4d7f2d022eccac8301995542df93cc151c10b4a622565832b8793de295ab227054118d673efecd6c50fea7b111606e"}, - {"0x86095d084f72a9be4c483ccc2c746e6ef6e26720fe2700df898dd5a5b20d6a832e2025d2d00a8447279691db55bea69a97e63e4acff6b5bc3254c3fa00017cb0adf4980a85af177485637c02ccc568a182ae232f54eada9391e3d98ed5ffe"}, - {"0xb017fcf26b80fc4af09015d106339becd5762ccb32eae4554d8eac08772a9335ccb7a8a916bd84caf4bcd4d5e53ad1ddf931deda6d5bc04c2df1682d31c696bf2321a2f005e77db814de79b98353ea4625962b9e30e78311ec0d9825e1f61"}, - {"0x45fb599a0f0a1dc49bb19803f84cb2e31e0c7c36dbdd187ab5bd8f024061a702d3e9dea95dc499b77fc32f4824fbaf91d82433dafbec16e1c977b20efd359e1334357a6a5b2d4b5c9452e665fc212908db0d18cfc0b5a5f3706b47c8868d1"}, - {"0x6b33147c7484eee118a499d769e8cd5067e77bae02abf17f8a47b040d39891089ffc19052ed287404aa3e3d2eb7787cd08bb0bfcc1c990a73d649cbfeadd6c4cf9ae2580101c1a1f45a90d32b0ff13e02b5836642634c7e952b6486d29f8 "}, - {"0x387e570f75f5fa085d262c1cb47c27f872beec94798787b8ea11debe75533ea5b0031eb544968899daacb97792dc67039eabcb6e64559a202f2529af243b2d7f993cf4896d9cd1af66b9cdf2753e483999115c0caa96403d360aa9841aaae"}, - {"0x1257e076f478ad94029dfb12ae9d928ce4550151c5a02aac92329f2ecfbdbd0a41567dc38e5fe5a0d5d3adcee3d1d84639145de0de9644244c34c031bd5d564a483ca617084e2829bd8e898733dfb99cc3cb655161d5854f687d9592c67de"}, - {"0xcb293e9849238ea68db183154dd3318b7a97d2c8b5911164a377e42468284ac8f489f97435e2ae5587efc9390ec8fe2dd55a466388491e21b477cf483333fa4f481bade0f0a80dc35c4d967dad4a5aaa1864323a8ab11f376eb6ee6440cd5"}, - {"0xecfd07101cf66ec654369b1dab1bb19588285083358b3f41fbcfa9a8667bee9f2e009a65b4588590ba71ba35bfbf3f11e0e38cfc02bf8e01475be7ce2fce4a6fcc8aaa3aae1d4696fcf86deff15d543c992e08aa4ef0822fa2da7d3dd82b9"}, - {"0x505e4b45c2fd0610b6de37cee0cb9a6e5434fe87b45190ff65418b316e4852a031583c3b5c28b4f78e5cdebbd7ac1675f1bbabb6bbd07ffad253349ed13c6a1e605856fc83288739254e877b0cca8c895a2119d0c9371fc59deded45cb1b4"}, - {"0x4356cbf741137297e9995a239f126c8e69898333c8a0891ee9ae4acb9f66cd1fb8b5c550d54b3d3516d27fc5ebb31b938d50d18a5d1fd92c4fbc246ae3a12886bab0e3b38692d26b5cc13372389c7c65df91ba04dcb040f2c8356bfb78783"}, - {"0x2d30af585d5961e587be65e1b61869b980d0a9a66510b0013800455621c06ab17bbf7cdb49df67795dba802f4a5dc215300a3a409408de7801f2f0a8e5b3587d478f94c523087fda1b7d9fce00d99ad124ae782dd5a6033e14141ae7af925"}, - {"0x89ce51dbfa7cf438f4174452a0159618713a55916e86698c00023059f53812346d2e996cd2be2ce603938b6e28add4df16fac31411400aaab469b668d9fc0efe45b04c071a2e09243a6f1c24fd2927823ba1b82803796b4c5ee8d14b6eca "}, - {"0x60380c3366f74e8a5f5447e6867e4d6b0ca3c6d01e5ad7bfaff113c053f5cada2ab35379044733a1e57cd19cf5ae16240e7bde52e621adad86a454c400381cf47f872d5b7ccf190cddc4a5477a932bd4a5e22534d30913553db82af7238e4"}, - }, - }, - YMap: RationalPolynomial{ - Num: [][]string{ - {"0x9f93a11a37f333a5052a497f2ff8959bc7b3e69bd5f470445f01d6071d144dbe992d4ea3783f0fe7d017f5dcc1e6d2980590726773e6b4bd7bc10cd999e2c38c2aabb90c484462c378b64918c1a48e51921fb837ac5feba926c3f623c4160"}, - {"0x577ef753befab81d08fb0ce7402dc357e7dcd98cd569530135f3ad339845cfcceb84f041cab594864b56060469cc8e0cefa322613061cf50bb7f8b3adba1caa0a522a5df2481f64cc0fbde989a13c70a8168d6cd40a30a342c186f229597 "}, - {"0xa68f14dfeb538700dd4d74482406ffae6be6396e04519ff32a9d0962b7250cd4a6a14a17fbc36032b9a79cb3f79b06d9918b4a34b8302120baf4757568bd3987d5bad8222ea01116c54237a31599acdc600517d3f733f5150930c07a9b8ac"}, - {"0x62f40704a8cef5860a7c1a0e953d8ab65ae5e0cb6e49d58da6e2501eabf797a77b043818a3bfa545a51060e24c3b7c2773412e527e1b72acf2044d95548b72836851a635e50c4c24b35c5a769b985fe464d857d16cecf2f8060374067589b"}, - {"0x1930bec080bcf38ef774f04e675193fc123f266b80e62e1b294b0978abeb31b3afcb02e33f65309399d12e3803fa052098b473eea25be9b9064c8821c0bbb90d9eba711b1dfddf00c2ae407d79382ccad4c6df7d43c160ed257138fdbd403"}, - {"0x65e5a193d3016af59101e156a7a886a3d15bfebab72190e437dcd4ee1a42a17f739c140aead0cf987e922daaf716fb7b36b61e0996fe6abaa4656b8a7f5b87f41ab28135a032b51957e955ce8efb83242cc62fe08a71dd8065c66720c000d"}, - {"0x7efada35b7158ff27d88e0ebb8775bb5e3c7f4224e20a223bb2acc78e0176802b998265a7d6473b22171bc9a57bf3943ebf43f71fd0f9006e5a7af6e6e76f11b949e7adb6b7d252bb4c36338ad539a9a7c77cea84280e7cd2964e5591d226"}, - {"0x29eb281af9b44d21986ba03590afd087e477f3cad3234825f131a31eab2adb59ed830aeab5e5156f8c5de90f81c12d8231604c9e25c4b358501edef95ed2926a79bf118f22d9c4f6455c8c7e37d618c9bc16c46c974437daf821bbd839df9"}, - {"0x47e261e740726acbe699eac8c486186ec6492f0adc2b3dc99615e874b4b7e093bcdafe1075392c49bca1ed7d4d043e2798c971e73535be10e8f4d6aa23b3bed69de7e75a8d3a8373e8ab0621582fb7cc43d2643095843d47003dccbecfc7d"}, - {"0xbd7d4e63943690a235389a6bb5d448042414a1fd9dcf42116515f6f7e5dbaf168a9830e70255aefd2bc14ca35eeb922039ab85ba718d3e6d23d86b08381e413ce18ab5c378c43675af0695ee62eb42790c5d5f89c2d0db6460678d5d7d2ed"}, - {"0x41c2f299e34019cb40e2af5a6bded90f03c9e6e0cbdd853e783f4f3d95935d39ee31fbb61d17610387b84ba9519c16881183a72c59fe7383aa5ae217b42b7480f8f058ad146edf6b4a7549cccea967ded9fd28d150274cee458208907ced2"}, - {"0x405da38064d76408c3adde67a954882f3c8fd36eabe3201a9dfd75629c8f4036c1d63831453109f54cfbc4cc8b9e5f663d3db51eefcefbce9b533b82e005bd9ee7af344ca3dcc40775a3fd24231ad6aa8ec93782ca5005c54856f0d85c04a"}, - {"0x5bafa78c01429499eed6e25e9349a6ca3d2e0ac1267e137174d00a6c433c6095e3d1f312fef70a5703698371ddd1c06e302261b4f6069ec4b78ad4e3dcb37b5253c0787566ba225638b446092283e42cbe85907b5ebff3b33c270a868f0c "}, - {"0x39c152b20238115dd4e6df5508cab1e2c8a7ee9eefdc292f058b6f89586654c8b3586b6f76e713ba51824ca6e2e3ac7a381a8f1746d7d5e500312a7c8513c46a5736425da606f7b9d34fb95df8e54ba0e7cdaef0079df1eced56133412cd "}, - {"0xfeac73088d841e8e555bfc8117068298c2aa3b88c0172c8339c4c507dc212472eccc77267a6946c0c4c260135b4a5f0665194fdf129bc15fc9623987abc4b4d251feb6696737b390dd48da1ee8eae6123b350c4356ab64e534709643ac84 "}, - {"0x6a9a250e9bafa906b1ee1517ad74a816a62c5706d13b5a198fbefb1d2d3dbda735841e67a0adc0ad30495670bd2b83953c65b19aa017ee928b6d5d195b3d16590edf554767224c79b07e803db87acc6a54b60d71b15eb75702f9168c5181e"}, - {"0xe1aeadc4bbd21621ff33dcea2e0ec99a6ea667741cf62af0494afde045b4ccb713836169de252f3018df60a9b42972f3ce650e5fd93a8e06e4fc281fead12a631e834d5753f175a5d76c2c3582caf46cdce6228ce2e767d59573c748ffe55"}, - {"0x7ed20aa5207c66a812970c473f270e99e5974d86d49be1e1976f669388cd568cf799f5c57d9a251960bad6c97dd3fc335eb51b4852cca361a95fc3eff218be4b9b46bfebfc552521659092156b85da783cc46a24ba5d1c1af9ddf017443b0"}, - {"0x7235fb0eb41c06b940ccf7b11788831523a2347562d30c2b147b7381f37a4a63dbae4794c8bd7d0f681bf17aa86221277496fd257af5814f73c8303e1ba09fb80ecf6627b00d453dc712e67aec504f7ece5f39d54f49f6212e792ec1b67dc"}, - {"0xba8193a4d3130aa424d39453c76c8ed262b2e2e0d07f453061b253ce779e1ba0a03f90d00a58f8d08c681204aa771512b68cd12d2dd4e7ee320514a2d5f56a1b8dd2a33c1d4d60a503cade7e0eafd341d8ac667b1c8ccee77ee263808a2c0"}, - {"0xf58592db221a5b17116ecd2bf86c7cb449dd623e49bf58ccb63baaf1cfbaae68778caa8b2f5d9b9211636f79b7ef12b9aa2155c4ef99276190af85a5121b9beccd7c747e153187c668b1846a179312b7fdccb9fd8273ffd3b058c2a97e99f"}, - {"0x2fb957ed355d384286b2f6153caad9da4cd75da2f960d2b0162badab4e6bb653f08a4ba1c93813fd4bdc0ed7ff19073696c16685bc73c7924f3f094e19db49cdce7365a991e22911fe27b1ddf631c5f8775210eee3de31057c27f397c5db2"}, - {"0x9a597c03b1977869ca1a58b04c6c7b5a8136d673428d8077c01fef3fcf1b7661dd2c9a0a9f258d60ac5cddbaddb91dc17e171cb4a48d32d3eaf5be484430496052e4e835781bbdb2f52aa838da2b488143dc2266adbcc6dad98b7bc422c65"}, - {"0xe19735baa44196f6aa3be94274abd8e8669acdf6e9d985820bf1adf34d66305e0a9c697ae0996b67513553a1a5b6e2c465895925873497d56cb7796a3a3fb58bea27d51180a658bcd7d81c7a86577ed8ed84b61484b70703a5be7ae16fce5"}, - {"0x3be0b32a85b89ede867e519b45827587ac1c9b3201628e5a499574e5da2edccadf907d9f793c735da5ff0fc3e60d3550653e133c3d1b467b5951ac65f8ac41b50e3a2e76024288847449f0d35d73d783c6a1c167f67a3e01c5894d10d4986"}, - }, - Den: [][]string{ - {"0x6fce5ce514cee5debaed37973056b6a3edfe727211c6e6a1fab570eed4f2a508e96d6b081ff4a1b1a8acdf79fd0bd33c663045955b8cc064b8b92b7bbfd15fec96bb04be80bae195d8d9d51c240630f776a199d13ecad6bc53f75189d614d"}, - {"0xe0962cd218121ad29e5d7490bf192c86380cb1f4aa91a0e3a86aa73be92a1c3e8a440a35f0248ee807f47a4239a421000433a638d113dca21313ab532984ee2abf3b38d1170fc51c7ae131c57a7449c65cfdd78de9c937528723d0712be77"}, - {"0x1ccc8c1978c03d019911928c1fafaafbfd603ad5590c6854d54c3ea722f18a19020e256e2d2f66418fd103b42765a5195c910f10097fe452c4ba4b5d5ce5a67ee3adde1a6b2cdf3b7721da38f676e97788cc4c64e2e7962fb81bbdc0f28ba"}, - {"0xe22f7cbf189dff65136339d090ea28fc60f120cfa26dd8433c6960b418362be2336be5e929dcc61beb4412dcb232db75be87f17b02742c2206620c090b9799e3ed9d988b69316875970f19cf14388a4fde13f176355fd16b702a250a65024"}, - {"0xe8f52882ce0a0e52ca01be901b93d21fdffae3d31b385750e422cc08cf926c7958a67728e2d26aae7ebf673a840d9d1f8aeb9e58a379f690461f8100817b8185a3e87401b650d473bea9733277bd2166d9f1d7f6fbe6711012bb354d2e636"}, - {"0x875fe99541a3b4273eb0e06ca68021e7b484844fe1276a3dd6c1ca17fff7bfa81a7fe367de671cbfe1498baea048a898dfd77b2d7ffbd4bbf204f862d8771bd35197f0575f6ddaf2dd8915747726e2aae3ddd49c58e47d732e7dc74aaccfa"}, - {"0x4dfd80356811a35a65acb00c46d07a392658904a4fc0cbda29046c44a833a31ed9850230c5f4ed0c1e1e76576ad104d193292821897138fdb5700b90c70041f6f5570cba9b4f4d7def07d469b4c892e87d2ec709ba01068510b911e9e8ad3"}, - {"0xa7f230aa84f2547cbe501721f030ed5bc4376f897cc22d1df86da38d73b27c3903e3e44109d24de87f66a029b5cfd5f68fa440f57de9533515f9912fc130ee39f65d7fb8da98d707cbcb268a3f32cb3b40ab7dcac9128d916a20625e28985"}, - {"0x7f35f1b0caeeffdd8711317415c54cfc5a1a04ab3cd08e6b4415b78b5760ce5dc99acd7c5a4a4c1238c478461e7b79c4f09bc4b7c9c42468fabcfdf142db1403d5b01a4cd818594dfaf729a18514e62aeb7a3733765836d2a9d893325c7a9"}, - {"0x9bce845eb9ff707815ed7ed3fb74d199d492671d29a3bf2072594b9154f530a311514634ef4fb471e883c854dde519b85f679d07aea459f7c3870ba31b1bd2c3548152cc0ce70241c24572d7eb65069b1a97f2bd155a4185ef91ea5659b13"}, - {"0xf0e88310ee09722be8558b6ee541afb4441bc1e77ae82ebcd5d792f6330980c3d36914d73138f0da01be4580c0c2188c0e2a010746b596d80755e71d07028f78bc29af82e7e5be87fb3430b1696810ea95758f3924d846cc0192a1e4f6e10"}, - {"0x8237fb8a7d102cfa45e7020363d892aa7380d1b5ee84b792c65fc2b167552c67623578c416e9922772f3ec99fddaef25907d91bbf0c72b8f0a0070a4d635a1ccdc78a8c6d4a175ed00a68a1eb0e7b90a6a5f33c6555486c77d4aed026ebaa"}, - {"0xacc8c17e87078f38e1056204eea4bd9343903c88966d0ddc2ca5166a97a99db4b66f74480eaf6030d42f8f23f00f1e7a1a6d13f086a76f04f14e98f12917de8d7998089c48bd860301813a95f708c6bd0417acadf80cb9831ee34286cfea8"}, - {"0xa9c3c892d49a5c3e506bfa242431f2b9f3934c51c40045e40478e1f4120da439ba6f0cc154e80bf1ea7ced993b7310545b6af11a6b3bbab611e648afe77297a776ef9468f51706bfbf60a100b53571a0a7361cb592a4f3000a45c013c950f"}, - {"0xeeade4edfeeeef2bc9f34296787829c99b544f11722d55db8789550c5e005ae27d651137cbdf9cb95ca030e3d84544dd21d7dca37bcab9f0e1ddc4cf633b5986746b0371648bac79367a9512396e9789031acc705cbff8c6d15d828c6bdd8"}, - {"0x6b6c82e8a5d0faec7af39bbaa40d86ea47acaac61910aaf01c238d8ac0f2587e2f993835b77e0312a3d23a2da61cfe7d68c91af4d0e24dfa29d5ce2c470c29c5ff6d89f060a0c0546daa1287fa3ab18a20cc1666ad84e3343d25997269773"}, - {"0xdb9102798323f938aa773da2a56ebce58aee6da13e2b10b8a56bea0398ad2d5fa0585d35f7b8b0e9076577c6e36ccf6f9d12e9018bbc8424d38620b874e24d4265bbf27fe0940ddd713e2bf225f0cac7a82c92516c75fc6d88cdbbdd58ec0"}, - {"0x3ad0edad38f3ac9e11e7c078c6e80cf48879547ea9efe567d0fcf53151b71697643a4940c375e6593b96a3370c56964ea3fc16bb574197886c0d9da0064eeb7e4121296069a4509b10f97a4b4a4943d083dbe0a221465711128d1778f332 "}, - {"0xc23a66e6ae7cebc4e55e5a301aa0bb92932e809fc326fc2a9e5ca5711241c8c77313b93e8065e8ecfeb3765a53e2b48bbbd6e27b960e76d00dd5f212f51c2381f6571a0a2d1bdb232ae1fea083b5573ebc76b53c5e8c53434a3e0ba80c3e4"}, - {"0x9dea557e9d9328f93a7a014265d3e7bb51164ef0a4eee3dd1219b918c457f7f0818521d498b13552933f9ead5b0b48d6b3db282c72ec06d7ca1721d3732f3fb59c6c655f3526db0cc833984a0f4957f312abf88133767cad4485c2f9b9af2"}, - {"0x9497a4421814871b03a96cb5d6b294880db80435d857c2fe9f4e97d75b37c795a1728121d66ce742793f98090d0c894f715a7e81dce84f594369b8bb2b9be0d482436c1ceffdc50efae8d85be760beecec788b5f1b08180dfe69567a0c102"}, - {"0x9ca415b1068cafcb60219e17f1350a1ba427a276689247978356bc51e19fbc7bde4a260c33e175dfc83ab230d17ed24c88d8de8c145213227d443192eeb2e1e4c61b7be341bd88638d5b44cedf93d445b344552c004f4b02bcc04b4c235e5"}, - {"0x2a27787477dddb1679fedf03a1e406b8df8cee954e12fd31e027d2d20f5dd6ffe6dc92a5c9ab16be8f21439232809c6187cdae5a5c6fb2f48617d22f6f2a719c5fa6125df02e551fc5c88bf21ff67de5c3cae2f8553bea742fdb7cc29c9cd"}, - {"0x9054124d1a72f5cf8efe6bd9c9bd742092f5aa382d88439f87e99da07df0b047400cfd35866acd72d83b3a6b7085213615b9cd7c5932848449f67f2600542b6ebf4ac4093b36a5934ca6f7eb37dcc1bef8d337cf3c8d9cffdc944072b5556"}, - }, - }, - }, - }, -} - -var tBW6_756 = TwistedEdwardsCurve{ - Name: BW6_756.Name, - Package: "twistededwards", - EnumID: BW6_756.EnumID, - A: "35895", - D: "35894", - Cofactor: "8", - Order: "75656025759413271466656060197725120092480961471365614219134998880569790930794516726065877484428941069706901665493", - BaseX: "357240753431396842603421262238241571158569743053156052278371293545344505472364896271378029423975465332156840775830", - BaseY: "279345325880910540799960837653138904956852780817349960193932651092957355032339063742900216468694143617372745972501", -} - -func init() { - addCurve(&BW6_756) - addTwistedEdwardCurve(&tBW6_756) -} diff --git a/vendor/github.com/consensys/gnark-crypto/internal/generator/config/bw6-761.go b/vendor/github.com/consensys/gnark-crypto/internal/generator/config/bw6-761.go deleted file mode 100644 index 33f34ae69..000000000 --- a/vendor/github.com/consensys/gnark-crypto/internal/generator/config/bw6-761.go +++ /dev/null @@ -1,279 +0,0 @@ -package config - -var BW6_761 = Curve{ - Name: "bw6-761", - CurvePackage: "bw6761", - EnumID: "BW6_761", - FrModulus: "258664426012969094010652733694893533536393512754914660539884262666720468348340822774968888139573360124440321458177", - FpModulus: "6891450384315732539396789682275657542479668912536150109513790160209623422243491736087683183289411687640864567753786613451161759120554247759349511699125301598951605099378508850372543631423596795951899700429969112842764913119068299", - G1: Point{ - CoordType: "fp.Element", - CoordExtDegree: 1, - PointName: "g1", - GLV: true, - CofactorCleaning: true, - CRange: []int{4, 5, 8, 16}, - Projective: true, - }, - G2: Point{ - CoordType: "fp.Element", - CoordExtDegree: 1, - PointName: "g2", - GLV: true, - CofactorCleaning: true, - CRange: []int{4, 5, 8, 16}, - }, - // 2-isogeny - HashE1: &HashSuiteSswu{ - A: []string{"0x122e824fb83ce0ad187c94004faff3eb926186a81d14688528275ef8087be41707ba638e584e91903cebaff25b423048689c8ed12f9fd9071dcd3dc73ebff2e98a116c25667a8f8160cf8aeeaf0a437e6913e6870000082f49d00000000007c"}, - B: []string{"0x122e824fb83ce0ad187c94004faff3eb926186a81d14688528275ef8087be41707ba638e584e91903cebaff25b423048689c8ed12f9fd9071dcd3dc73ebff2e98a116c25667a8f8160cf8aeeaf0a437e6913e6870000082f49d000000000075"}, - Z: []int{2}, - Isogeny: &Isogeny{ - XMap: RationalPolynomial{ - Num: [][]string{ - {"0x48ba093ee0f382b461f250013ebfcfae49861aa07451a214a09d7be021ef905c1ee98e39613a4640f3aebfc96d08c121a2723b44be7f641c7734f71cfaffcba62845b09599ea3e05833e2bbabc290df9a44f9a1c000020bd27400000000022"}, - {"0x9174127dc1e70568c3e4a0027d7f9f5c930c3540e8a34429413af7c043df20b83dd31c72c2748c81e75d7f92da11824344e476897cfec838ee69ee39f5ff974c508b612b33d47c0b067c577578521bf3489f34380000417a4e800000000046"}, - {"0x48ba093ee0f382b461f250013ebfcfae49861aa07451a214a09d7be021ef905c1ee98e39613a4640f3aebfc96d08c121a2723b44be7f641c7734f71cfaffcba62845b09599ea3e05833e2bbabc290df9a44f9a1c000020bd27400000000023"}, - }, - Den: [][]string{ - {"2"}, - }, - }, - YMap: RationalPolynomial{ - Num: [][]string{ - {"0xda2e1bbca2da881d25d6f003bc3f6f0adc924fe15cf4e63de1d873a065ceb1145cbcaaac23aed2c2db0c3f5c471a4364e756b1ce3b7e2c55659ee556f0ff62f278d111c0cdbeba1089ba8330347b29ececeece540000623775c0000000006a"}, - {"0x6d170dde516d440e92eb7801de1fb7856e4927f0ae7a731ef0ec39d032e7588a2e5e555611d769616d861fae238d21b273ab58e71dbf162ab2cf72ab787fb1793c6888e066df5d0844dd41981a3d94f67677672a0000311bbae00000000036"}, - {"0xda2e1bbca2da881d25d6f003bc3f6f0adc924fe15cf4e63de1d873a065ceb1145cbcaaac23aed2c2db0c3f5c471a4364e756b1ce3b7e2c55659ee556f0ff62f278d111c0cdbeba1089ba8330347b29ececeece540000623775c00000000069"}, - {"0xb5d1171d3260c6c2f4ddc8031cdf8733b7cf429122cc15339189b5b054d6e8e64d47e38f7311afa26134df779095e2d4161d942bdc3e7a472a0469c8737f7d1f64ae397600c99b0dc81b6d52d666a2f01ac70146000051d8e2200000000057"}, - }, - Den: [][]string{ - {"8"}, - {"12"}, - {"6"}, - }, - }, - }, - }, - - // 37-isogeny - HashE2: &HashSuiteSswu{ - A: []string{"0x10f6a7725da2bcbd3df98cd57fb04b0378eb7ff3d8fa48869b2b9ddf31d3fc46fa7c4805b5d4a79e54f495b52586a15154dca22425367989fae305ea22f0b5a4f979aa9f1d46f7cad2f21696aab503eb53485d6ccbfdedca97936b7702a7d20"}, - B: []string{"0xe1c43bfe2767901cf467cf40adfb7afe484d0d477552a8570a117661033c8dce4d56ccf35850bb0a5c646e4433a9b0e43b8701384b604cf95ffbd668698f8bd2f2739baa20c154eb7c88974a36fb5487c4cd8a1eb00205769d93924cfb0ba0"}, - Z: []int{11}, - Isogeny: &Isogeny{ - - XMap: RationalPolynomial{ - Num: [][]string{ - {"0x25398befd780935a98ddee5ea60e4ee96dcc3cc7e2f9f2ce97adb5eee13f1f1d35eba83968f25cdff13be2d0446e1ee6e19d332712d7b1f63509e090425865b0383f77a43ec7c63055a6631892a33b84b81457257314d13bbfbcc995aa9def"}, - {"0xbf9fff0b23525e2cea97716a08dd64003da7fce131cc13876e7ae922718e7c7b8a219fde11b35b7442d2f97a46f689a9c48636800a987bbfb5878e89b551db4b37469c6d446d4d6b59255708ea4a3f127b3199065213283b886788a53960bb"}, - {"0x4eff3f1c655d2a87d2d8283ee2451dd85a772545d9213f5dbe1f3410d2e21ac1808ca7876eae1110b33a6fd2073d467ece168630a242486579def540c85a2d66fec67d057d6091b08e20aaf4c3900a8c9f901844d51d38ec5ef4abb1b0f811"}, - {"0x1e9c0bcdf00775a750d64d31305f42117cd59252c0a3ed281e6b08cc26c3503e7d05a200d062300d173f5bc69a0c0fed0be50d429b72ddefc9aebb14a47596d061f1bd6ecc6a303dfd9b3a47a35b12829b3c40eb8012f2b68c765be361f50e"}, - {"0x116276c9e850399fd7f4da35f933e4b185e5932d984665cfb821f13cbc8726a455e5efa50ccc596ccddfe93c3d9bb016f1b95e42631f82ba4207ccbc0c1aa33ba899a6c1bb9a54571ac158f417dcf0ad4eff05a3ba55e9b9dcb0e5b01bbf218"}, - {"0x5619dcaec9c5296187bd9bae9507ba8e6c764f581fcd92d618cd9a9246e7fc50fc7f9fc8b5ac87c1897dd329ce72a85b9194b010ac6877b5ff0e5fc60379ece4bffe6e7b08d3aaba9a2301aaa0a77ccc80e216f0a8bb8b4a261eb76080b1a0"}, - {"0xc6b516997dc93cdfa17c6218ac94a6a91248abd4c6f43fa5b4fc697fc3a51effd39e55b261bc89b4aa71955df8380a40b7dfc1ffa29a01e26df9ffad6e3f3d756cf5b0793b92846b66d18057e2cf6366e3030836caad9abe69b47472abe20"}, - {"0x4159773ff45be12f91af867bbc0af2809e340c244c1e4be605650a2d3c609120ceedba9b1808a1307ec320948f88df769d1b678fc9de1c010756fe9464e4b5e0d11010524bc0cc292cae038ff9590096b71194706660fa88f6a001f17e4148"}, - {"0xaa0ec8348732fa3c9a97761f624ea4478cf6d4419f0b2f9dd9a54f91c5a95df61a058d1be7bd5c791e5b7f3a662bff96ad246272e77d2955ac52b817e161e397d8ade57c4f1be9df28eab1ae49a7d53ab57fc1dd84dc967f8bfb768731e132"}, - {"0x5626a46d9768ffdae515e2f43220eb9bc29cad1e6793bc78b1f1be6d8f55cd60cdc4d6653c7fd12024398d4ab901d283ca67c9798e8a1b6983a8a07db5897134b381dc523cdf9799229e5aedfd6b680cd75083a78b24cc73f6b3e515a00fc5"}, - {"0x68dd735eddf59490dad172f6aa60ae8110aaadb1fd2e1b708a8d429feca6b81381225666854277c93a5275ba75045d83e407ddc6a763ae980dfefa0b2523cd61362d7a658c622b5766e55a1b1d054b7199a9e0ccfac1d6bcfee34dff34b476"}, - {"0xf4d4ce5273a64c3463d1f51ed0895d3e20ea073bd4ca22febba741c47b6f6883866e984d62de4976b2890d5541e63af463d3b0b96b17b8b5821149389544a0c7bad5736bbe9b58395827786cd4f06f2c7c882980b290e4e5d7799004039838"}, - {"0x7563caac9e1636456f2e72d9034a59342e3a863bcce6b762e1b683fd1f9d7851b192b15bc2e19ffeff8560621285497077cacf7a160b59a22f3c3db6aadec7f650a575732b62884994e454ec534c0e955a38c42bb24a748129f53becb91d3c"}, - {"0x8250dc5250d43ba6fd216c9b07c2a8553cf26f9486c053518e2ef1d3acb59f2413bbfa33967b4225c1e3beb6ddcd94465c6f5dc1486d70853b86f092fa65e0d1786a8c3fb2f2dd10b309a98fc123d556e30c14737e05ed4cc7cec012423f4a"}, - {"0x110eb883b84c0238f7acbb20d75f08db04da7ecdf1c7dd8ed99d8f75c923154e280a750318163921759043a5c88c1cc2ba425380bb8486f9c3a9f9d716cdb0f4c2f1dcf96686fe582d4a88fdf21727d4342d7183b1d58de15587a280e1b16ba"}, - {"0x12187cc667349a16a75bdaea33e2993f7cd21d582124bdb248d746264fdd53091cb92188d8da7ba18e5ae858f047724f0d088320747de67e34ceff1e0199fb760f49dd57670711a1be6d4b6898f568fa44b560463b95adc10267acc34419791"}, - {"0xc40934532a6e2559a91a4b56f795bb6d7ab621deac562916e0fac5082c42d6ad331b9b83d4b9741925518bb8d963fa934dd3ec288a062437669f25104de2110e4ce5fc21a60590e0cbda800df12e1900d474846c0276c9f11084032b75a610"}, - {"0x950b7a24e3005b05c4d6cff3719f15f292b33ab2b6b52f5e0f4562d44233fb554d53bfc048ebc9bb5fcd3c92a88824de5ffbb5c1eb887c0dbb4fc5c20663dca7f66b5cec7bd641f751e21af2136f5e8eeb5dedf9d0d5e866566fc73de38afe"}, - {"0xd9e2458632e3e1f2a102f36965e3130f9d5e5eb0dce8240464bf79d11cf57f41c8fe66c04d820811d9d2af9f9e09d0265070fccc415e0aabdc0fd0ad081e12a5290090f531562d4c717b411165d8e1eb1a4cbaf5f239fcb6581c1a75712a1c"}, - {"0x122bf1411d59559e306075c9a9e73edba1dcba34443b235a1f3942a0f8edbc955d9ea0d9af240d05809eb3c0ca980527fd545e5988e6dece2da9e35061a2f637bd9f1f35aed13871ae23e6283c7e18e7459971cdbfde54507f7f22f281b63e8"}, - {"0x87f8706b78c7434a1e7d3eb3bd363eebf95d01ad6872e8660a6946347699f965417b8fff42df607d4fb609f414ab8eec9c02a4eb0e9b887a1765aabacdb3c1dba24cd1834095e31d358be65cde6d7a498163678ba1bc763da43c538dacda43"}, - {"0x99598dd5d2443bac8cd6e5c3ecc45cc4aeacf527c1b3567d300698a2ad073f5568544c5b71529380fd88d628416643b95c1afc65436bd2d12bcb4072876e5117b0e5c841b35a019fdffa973882e72a6118c03201210f4161d8179a77fa96c1"}, - {"0x395ccb482186b0d3462ee62749d639e3c946f14379eb2adfae39a686af0d4f512da5e99d9af6022457a75ece4bbad3c805d8d4a74640e02abc3ad625ef7c5b763d0b6c1251f66c991e087a392b0beb82edf72225a85c8d6466b035edbf2627"}, - {"0x3770ad705bdb83b47be929dc5dbd908ea8d79598a767879033c5fc2a0c7b91722c960bc130c0efe87d53576e8c5584a26c62a0e740d13db50d1adb0312b21f33b91fa89dedb493a757ca9aeed1bc2a4dca12793197678cc8fc57fb2e6a56ac"}, - {"0xb257db251cd766a618b10b3eb05d4af66e0aea31f5b3ad460f9d2ee1692d5e8bee298b3ff61841b1706de0438fc9e2081e54ef4b70ab63a355cbf3e06dea5b41435f7b3882192ba5af9b9414da295a0f419f4b95b543208c06f7ecb2cee716"}, - {"0x7c600c60c02239ce8ebf41f0319bd21e2552cd6d452ac9e8aa6608a38158307eab1e9425d494bbea54615c07dfa0470939e3434510c0d1241407c57b28097da2b181d27d3886d4856fd784a1d2dc53001117ecc1f7fd1e581f192e17b098e4"}, - {"0x6045e5de1830a58673c025130d7e80ca97bdf40887772da41dfa549d9869292e1739c1a407e6beb8fe2b99199b4e942be609f5dff7996e0af243b4b11f95f1786c4a1ca576a1265de1e7c3b2546ffa8a5bedea1ca96dc7a81f84a5e4c77a04"}, - {"0x1116eaf37b6d0408ff038d49e29bbcbeb447cdbf49cc259e3f4d48a852ae1ab74c117ff277ca19f08fdc9e4216d315b3a9119460a4f60001dd6be6807db300b5ea9afdd5dc63959275c79bb59c4f32368ea77ec4a4d15a476cd0590165bfa10"}, - {"0x10c94d5d3bb80cf510755331b3761f7ec4df14992881bfca3bc7c43801a077bcb294c8186153487ac19f724a22735b8979e9b86fe34fb6c262367c41a8c76af62fc7da83db17f6ed4eca215750b6d12d2b278585c654ec29d0937b7788940cf"}, - {"0x1adc9be54368e5538aea2182f9892b6fc66405c9a6ee59731427aad5ca1d09ede3e3dd2bcbe7e04c582d8b2fac638d2a329bef768de78a149589710130f3bd407b9ed5535d7b45778b5c1a5ce3957fb462cfea58a7c29dc22c876bc3992eba"}, - {"0xf92aafea05c0b551ae26fc31b31a624c28d43b2633de8dffa690d627760fd04ecc01e0a43cd2e7969263d703cde2cf4dce88410004356d82e535ece5f3ad1a38cd9d787aed584380a438416810b4e3d756be29b52f16db58cb885b83891e8a"}, - {"0xf6e4a497e67292d3b2ed5800dc4c716545175e45f04fbe0e16c6a905e5d2bf099b5c6d989299fa31f11352a7b0423cce76646b492696aeb3a7e139b8e5caa737c3cd3513cff20173437870a9943d5bf1d6c6dc4732032256fdfae43caae4af"}, - {"0xef6b9dc12aff103afb6d8f85d712538920f39072ae840d58faa0774a7df1f5a17e3f741298e9e83ac88fee4b5105f489e0b72b470b5219bf21f8af05c1f8f848904da49371d8c95b5cc896bf727d0fe6b0ddf965c1e3dd973bf8bcb5b2d932"}, - {"0x37bd2a9eca40df6fb0a16dea501ffc6dbe8b455c21dc65f29692d9d31a98ca815a302e0d0b8bbcefe63b793e4c81bd825704414613e8457453e1be9bac8a7f7b282310f4f7e8a281c422256ceed512339ecb348bc9bab690ee7db0b90202c9"}, - {"0xa29355f9bb4369fe4ed85ef14ed5a3c7307701d32c7f31d71947530f8064d5ec499eb17ae6d82853c8ed14eca3b3bcc1cf7cf698b7364a7aa6e63a8ddf20d34757eb4f206648f43a009d6c9caa25290617164247c47dc48ff1743446f7b562"}, - {"0xc505e34288c6805efcec5bd0586564640e784560bca7cafccb08a8b0a53d7c8d646fb60288a071f5cf1e2454d1ee1866365f32535d94e4a8cd0a05c209dedcc42eabbc105c080a94185fc6bbb331d3b77382a663a40b36098c030d178e3021"}, - {"0x110e5f69e48a34b6f6fbbf1c7525e873245669b5fced30ad78975d61b872b5d5e91dab7f4cd23259d7e04c517730240eaec702f238c42fae550b64d4deb617b0b6fd1beb61403c45268912bf795ba2d35d9e292ea1add7e535361761270669a"}, - {"0x11d2b5f8809e696da7ce154a2b558753626d70bd7b5067f4698f205252bde384b7ba440c014b56084035045d969b63e08179de17ac29216aa5592e88f8e24f8c1c021e7750d2a67b1628c2e8dab61965aa233740750f8d5a4cd83d55d4fd9a3"}, - }, - Den: [][]string{ - {"0x83be65e9149262d3203a99fc9235079469fd8d9c911ccd0f38c12cfa4c622ce757f49b41f1ea4687b29ee8e01212e58d238c956a5b1649f1c477e1ff8a6a6bc1f109dfcad55d5a778c8fb21cb49743c66d8cb6619163d013bb217cfcd15e05"}, - {"0xaa517d92a19b280dbc13f7f29fa923a05e4e8bb01bc2e44c40a96c6af237ba313bae0ea41f64bf4fe6b7d864dfb1c747ef73e9a6dfc1b5b4d299b0826c99357c1676f61345c05f9d8a532ca415fabb4199a33cd0a482c684e3c8c259d78aa1"}, - {"0xe1629421ebe8e0a16cb1565702c894b7f3a2509d42812b8937a081006435279fc5e3243489c3ae9448f42e0cc419c63b57cb203c524bec8fd171c1866ac52b773ce80494d0e2637d4bec5faa81b7c2c2f21e91d8fbee3c7f16cb858eb70520"}, - {"0x57980339d02e07fff4324765c596e2799aae01736d752ced8e6086fda14d435dcb1297ff21ee6d272be5d2bd6fc2bfc3190ac40dfa02e83990d5fe9a026656f64c6d99261dfd05fba525230d034791591e40c7aa7e73b38cbf54f627495f04"}, - {"0x807a9d43baffb4c128a86c128170656322ef19ef433ef5111ebf61c6ffa11be2f2efe09bd80e833650c2c6387de30f62198c8e02b2e812bead3143f06ade297f06f14b1646dc66cf282ca33cf458990ac6f3c071503a7932c19b9c48043f7d"}, - {"0x4da51c8bf1b1c0bdbf2c7825ef3b1fdea3b7fe74d8f897a874b2c4ca00b378d789d36d51d1dd7da1d548867183f030b9670a67b481c8fc587e8d9b67f363a4a0185cef41f30caa824b6e9411dd28dad32434ed655c99623e00314350319ed7"}, - {"0xd678e47f25725d1140f98408eebb2bf4db0ea59317a2e77c4ffa7f5e9c346d01387f79c929418fda184a7276209c9b05ae0b9a176d9757100b3713e1098c0ab035ad8969adea919a6200a879e27f01d2e5f2637dafe1ab78e03ac41fe61f71"}, - {"0x5d25a1d2d6b36bce592661279a360506c0422e78491c50618be960b85a7754b3a2fc8773c11d48c73cce13c69c5779d336405c1e236474d499fc63f0200673c4de4ee42dd2f2f295dc48d093e671b13eb94bb2a9534bf739c4a19098760a7b"}, - {"0x4fc12158207d5bd8cce8d1ea3f5c39517edc59e368546db2527caa4d5435654fa55fe40851cbd6c51c0ea8a22fdc4a5c0c180b1849b078b708a83b0f58edce813c6fd60f8d55063343a94722d0185cd273db90cc68a8daa7b2e2031557671b"}, - {"0x31c9b9108620d96f550a9746df4c3d85583fdb9d2d0f68a5bece080110ee8014cebe83083d1faf3b9389969a2481ebb2a98a90b207abd3743414a7365368e689738bdf5ba4b922d15f5dd1e2c40fe9565ad6338b0799d81ed1399106858606"}, - {"0x1117948c172e353417c135bb8d8da0d60ad5c7a0134739917b9f4eac2962e531e85faaf3642bee15183c801da80af4ca79e14256eb769421adc15349fd7a64d945f2916a9e673fcb5bf70f115045a314aefc405e3d277514bba37e932c814df"}, - {"0x3c242e9ec4fbecd4bb2508c41d59c4b626cf707a0bcee49bbec0b8a4a2777c5763c1ac8a0fecb629123f4c9648b5ef86fc81d40ec29525105ab3852df29d4123e143f005ca3445d6a5bff17dfff186eb5f4e257790dde0f1a0b35b7c519b02"}, - {"0x12004baa7bf2797052c48564d94448af483b791a8a58bb0fdfac7206aa30d90a19c75fa26826f6c0e50883fb357d08a13eb13f7b5c64a4a25dcf61cd4c2c04de84df8239a04ec26af80bd483d5843ba5e761284263c974e3877bc21f1dbc197"}, - {"0x40fb8a400112da16c9c847085bd345e2ce2b11e484e5b3361e5e12b0e9b99eef6e1a527cdd123882805d27b8c39737634b9ba27e953a7f26e7bbbaf3a92eaf7cc3496b7505c67958ef08de00740cf7168bb49e7be687c65630847ec9cf64c9"}, - {"0xdb841e9665a8721fbe1361196f1abffbaaf8e61aa13128b8595719b3f8fb1cbdd3b350ca0de1c3188ef820ad8490998744bc8a5e177284ff0d43c84428deee9d41f7f1a042eefb03d02cdcef7653fc6be44f80826df6dc54146f14e3aec5cb"}, - {"0x86d23a6f45e1098d00b8ffec6b12be016250481227e1f2d81b90c3e1cda0ebd2f4efdf381c8bb523f227f275bb681f78a6c95523259720ac3723be36b282cf191288be453008a231c23b67db1eb959d0e149a8135000c5b44ffd1ca5c2439f"}, - {"0x109f5d1ef11a74270bc231cf7083d7278ba957f6d56fbfb3e8fde415ec551664198b8505ffffe1e15dd118b0a4331a8c17a3b98b50643e84dda3165037e42bb9c6019281a3f4be180a738fcb5168c9d76140a06e27d5089ba7f377b9132a05d"}, - {"0x1f274511e3255d4b4a9ad16cce613ed711a05c14758fc9493891cd2d7648807dd6e4556cad36a50945e3e31e4056d27cd49d3dd9ad86701305943bda400c3751bb082764aeda446723655be92a8100fe76f0c7933540daa8afabdc002806b4"}, - {"0x59843e330375000405b054eb5a19aa651450f2c5e26bfaa5032ad4778fbfad597a13691eb8576642f74dc05243b74750701ca40bd7308dae55746104e41cba2226d91cd70b541be8944e403b8930c835f8fc924f556f0274dc8c241c1b1fec"}, - {"0x171ec81a25db9e6028013ed9a5456bb33310e6d3198f21a8e7cf9ce447f30b8830709b9888078e38d676bef24209e26fc81cfd8b80a13d17461841767498fb47afd44ec6239c843f1312f26b0c8025f05f13e8f68db73bba437745b394b0aa"}, - {"0xd1b60042578201579ee9af7daf134f171ac865a3c7165f7a5732ad4a9f2bd301d10e4fee128e96037d468e035e418c46d3c9a11d00622b09d61761fb05f99f2aa2a9ce622cda95c2b321122e7e5c5a1f664e1c44fe46fc9db8a745eb0837af"}, - {"0x6bded64c75b35c01a8313a4bc6695d762020056e0fe4d87677e9088d5cf5585c8482facc8637ee4e619906637a26245ee4694f78d1afd6cb0071844e710d7498e924478db66d35e1f8eb480537873ace7d72c4cce9c5e409e93fd19cb4390f"}, - {"0x409e187b5c36bc9b744db93e60f4f26fe820f8f9ac1731a4ec4220adb0ad1d92b89b69bdabc9bd1db1b99d029c083a5345d9b8681866f3100a77a5e69a9616a7142416b98a84f701740c4f95de3cdda3a198e9861b6cec6e26255bbe772da2"}, - {"0x10366573a3c6655de24305051f27ed68efeec35822c0137e5e2b286cfb2c535c78ff42dc67539545ef780f8cbd8044e9f96e58387cc4f1ebcc1fe836cf359d02e71eb64eb313279edae20943c0642d57338e60b031adfd4bbb424dda4d2872d"}, - {"0x4146d8d1bb6cb1c43ded16f5c07010cb808fa767a0b59047519679124a5a1ab4a1f2cee179146460ff296440254807b842c968e364611b56d0ce862f3e4f79a9d3dc0d7f5c0a3aec81ace2208b3d6710fded09f7864d29bbef79886571cb09"}, - {"0x8f94d7b08b0685963d24fc8b9281d6c290a4124e987136973122a30db0749c48ffc8fdca733627914344dc1077e20be895e36ba93ced63e9792812913c9762277d8556ebc293c4cfe6f89c5f7358e9284b59c1fbdd37b0e066cd8bf282b1a9"}, - {"0xae19c1dd2ea2e1f7a7e0a05a24945897e533f3bd719347b3050acf6d68480a01d574f10498145d27d505bdeb3bcb9bcf931275c48c6e1a4f18a46b7c03d9c0bd458032e2198b4823371c9ced7c68826b05a1b94f09bcb2e16217baf4c9a2b7"}, - {"0x3937cfd56241d0c6ece2dbbba9fbf5b7e5e4432feb90c2641baa78ee87828a5c3659d9f06dc762dd5d91cb5fece510f4d29802513a25db34f734d4338a4e473fb50e4cd4617ed3a93f2f00f00d543522dc42a4255be811e68869ffcf502f13"}, - {"0xf056010b5a01c99c3eb8515f0c20cf81567cdfd453df66412443c4853dc34a994126d11fa6c1a59c5b3de3d5572c95cf0daebd76733cd1a61436adf73571077dfcd4ee452ef07acba0fd15371473f7c7127b4dc1f97da8227b87dad9530dfa"}, - {"0x1193e22533f0c5ea8a191ae0ae6055d62c68c59d05e3dd03eb343777b3615485da3ea5174759b34b9f486f97b6657580d810f573e57ed46c8649c002a6441c3666526fe8f7140b870760ca5be04a3339bdfc10d996752c61819e18d862f868c"}, - {"0x788926be987f1259c031ac18dd6771beef4ff0580dcb455bc125fe1385113df0cbff993559f55752ea1502a3e8e84087b4f9531a48e939cdf4f41f31a10198e9a82cb07f0d78e82deb8aa18cb2e3cee5319d4df2fe4f4bf69201e84fd2f575"}, - {"0x66be610c58e904d4b5827f9b746ea5fcdf60f2e66e1ab240fb5c65eafc982d5e3eec9134d29b991497cc387471e05462a1925828c6e296c6f1a965c209f33e48cba22997fb02d315c63aaaca45b6ef7c0beaa2a96da60e839cf4957d6bbcc9"}, - {"0x3487a8ea28fc7b67a089b3e70e5eb268ab99485f31d1c7d7f281853c4e0d1e7d9e0c9521839d7286e6e1729df7da275bc576bbcf8b1e00d1e2f996150fbc725b904bc0077173d29ffcfcf6e03469176987f60ba39a8f6ee0c29d448a7a750f"}, - {"0xc68234b4d6bd5a4a37d13151f8e0f13a90cb6ce91d72e9ae916b2a29837bd01e5d4ce2adb1d90e883a1f6b5ac9b25ff7a37cefb7d9e29fd88ec1e9f3578cda671ce824b3253bc69319490268f60bcb93de665904d44acf45dd4c19861070f7"}, - {"0xe84f9cfffdd42f1f808768789dbcfcc30a49ab979995fda69cdf696e4f6b8d453573937c1801d258fcfbb3836f79e39ffff9f88084f61369cba6ed1f84bdeda53f1d7615f2971ad92d6ca0aa810ee44e94c6c5df4aed9b849eac77e0ee83c0"}, - {"0x496a56f15bd023ff76aad9ec934a63320f3eb03b60d13cc7bfa0b88d00a6168dccec5cee5fd2b01e059a414a876a757f502701eb366739350845b04410654aa1027e22511ca88e182106cca0b8f36489af9fd429a7e7b8b57030689b11f45e"}, - }, - }, - YMap: RationalPolynomial{ - Num: [][]string{ - {"0x5d38ef6582e5d7a838009ac71ecc25a6c64fdd19f4bc0d74af29b637cf51a14f40aa1bfc18a0f412ee1275c5211795d5dabcb7f7512dd4444f8725595ab965db9a2a330376fd7467616cf35fb20d8f65c93d02c1ee651929bfef3a02010998"}, - {"0x4dc036c1f4c016a18f48ccaeee3d1fce48ead68ff10b5d267a4e8090ef866a3fbfc9c826b1794ee575247585a3ee598e23e636b0e4f8a54b1bd182ccae0edd530e76c56b88bf2af50ac380ae79d88debeef0b16ca39f174df39b08284a51bc"}, - {"0x3032bb517e9743a55bb8f645f20cc63ceb8e92584534d6b157d461483dc394441df9ffd30fa13a5bad96c22b1ba1c0bb6f88899d3133f4b56cb1fc503627425bfe13de5eed7f9819a9afc6944c7537df20aafc097ad6650d17ae743d1cee77"}, - {"0x971c6e281c15dd21949eebccdb904c1ce2ddb0e4b541c93acbea7528285822fc660b6fdda6b92cd4872bc83ee741775f2d9c3a5765d7e70ae7ba2de60c3c73a1a54ccafae655deebaab1c03efa9bea4f5f51a718088eefe57f0292b5b14798"}, - {"0x7ab3de0b6540aac0819b8e9e40d8ab1599106f942af09c137f4242c9c26ea921dd782682c76b266b6e44cbe3843b0ad523e02a80d2af69efa3eec5c39e58566df3cd8157a20ca4c7383eee7b2c32f2459464abd5b9ffd5351c3d881a41dcf6"}, - {"0xfaecdb4a216f5c7f32b59689f8faa85d747f95adb8920419474afb8d55def7b52682c26fba23bdea292ebe6076a67e9ff4740cd2c0d222dc90412eef46c7902dfde4eac64e1d7399d4e2fa756be80bccca12b9b64f0bd9ebb616458aa651af"}, - {"0x8397c87fe6e56393d59e832cc69bf1daa706aff0f68f038d9cc3049d41dce6557e412256d8cc41d57deeff92852eb959fd7d2e8bbc39a3bee17b956ba9645f05e5cfa1fc66ce57d80cdcc9ae937c26555f0c238f158150aa6aab8494457159"}, - {"0xfd13e17f5b33195a3e4c6d3ef8d0fa3de081bf635cc38b22101eebbc673ad40e5212a5cae0285df75c6769b83d84610f3ea9b5a93dd2081ceb23cf5834c7efb2e39153e8d40277887343b630410b7581b9629a92f85236e04d1aa471383f36"}, - {"0xd2a831f4ed31fc9f53cf9e502189be67bf2ef9a4f1a05187e18f2f0158c40e421e8e747c5fb1c706c7830f2fd8186e99bfc4ee25a2f5a2e9adb4509e98c131abdf595fea29a48cadf69d57c9b08d71fe6661c6b597dfb30d4c4d83cd504522"}, - {"0x10f83707440c9575bbfb5e4779d00f3adab570857d6b2811efc6a36563c05877d23b8aee98b99e041a5d5677a5da2d59e16d1b9918956f720339f140f4b09ee23748dcb557135e538413f14e78199b2a7f5cc106c644fcb2ea142dce8f1fd4b"}, - {"0xea00809253d1081f62d4bca37aa536bd29dfa9d57ff211e93bf7d291dba621af65fbc05fea7fbd771e330b360ac2ef1c86f267f7d790a4c49b3a35855de520fae53b016499e2e4d34572ddf22182f45e0427f4e2af38dabca89918101013a6"}, - {"0x7a484843420c7079e43d6ec50dc2f94949b813b16c3e517c61034acab7ff1d212d5a6599460cb97a848e98ff86b779b57b9230fafdcb310bce8bdff32facfb7e8ff5d5a6a141e9aff51d0638810bfad02b374b56b167e1ce274d752d80cec0"}, - {"0x549b03fc6497586f83bd2db5fe2657effee7d0e500b4e694f966895bffda5393c27db4075cde98805be3c10994e10de502ea076e860ddca3dcb79e63ce6bee9a1b6703bcb605c43087318f0d9036c301e7841d0c7b032de1661ccd715d16c4"}, - {"0x76b1f83abc358751cf969aad2c4e59899996d0dafddf76f497fb693264670c7a65a536aae27c30bb34d8511d64c396cea615ef78c116d62dd81eee16e9882159fe92c56df94c27eb7aaac74e5a8ba04244451552360419feee867f6cac723"}, - {"0xd92f770caca73c3505c3a4e58a7eae19c1851ef9db25f07a785cbb78e4f4aecedfa7a5a5046f4622f3179b37ba00c45cc4bdc6b1fe86ebe49c8e9fa4290d257bc319185c825b66e8b180472ab7f80ad3c71a1dce9938ede56e2d7ece900d05"}, - {"0xfd5ac3a657102e0a54acb58d0a04e488934116e5d876c58b86a4e35d3af411aa83627651dc8198133a4eebf14e19286ef5b491286e562465445f465b742f94cc23dd887057cbb808afd477ab63bc467215b1971ba490fa2827e0d81a108f04"}, - {"0x10d6bec8b4dc04bbec4fb4149db3eb29604aae9f7a45f258015e66821b85b690cebb16777021aa0cfa0fa34d3e1f85161d11bc16183faa6051d6f726d0d26d1e7772543c32487fe27d852626b42cbd04256b5f9f5929cce9e84ce3a35eca852"}, - {"0x10d36f163c2f08d03557ace6308c74b4985dda1228f121e4c469dc37fe80c9b15fb569f5620065425a517010c93c0957a3bfe5b960d77e28d9bbe429518b494ffd268084140d17ab534b79f2bc5cfa780e5cb6fd5857f00251437d184fc3f36"}, - {"0x94302fe280a10e8c5c6601016f8744495ca119f4195d4eaa219e74506a25e93030a47862ca125d213b260738ab01882fb14e1971bd92b5c59e8f29172ed2f4ae8c9cc142a1044b8d3219e9bb292ca5e7bb3f5c0294f64a67e33642c8cedebd"}, - {"0xf062482aea1a30b121edd74c39fc070f3981682f0566f5c9143c65ef8f33182291639e5ab1db19070742f6e39d7bf38f66171536a9f164d1e7a5b478bcc9638a908135644b4fdb979659c28be6bf01b89adf6dbe5108084824251a5eec8f4e"}, - {"0x867a161c059d9df42b5fd6674cd91ecf88204c3bd498d793b67baf81420007af8dcf3327ac0402d6a72ba8af92b62c55509e3fb37bf8ce4bf048104f61229f8b52ee9a4bb45d6dd2362173e276d6857d5adb961662cf301618899b2c8acee4"}, - {"0xbac156f5735f9db804c79b3be77614d0365928205198a8405fe744332cbe784d46a3754dff8864841a2095232a01803ff43459f8904e6158f003b6917075bc588ac2424bbb9546ed2a7df59247dec3675e3150a892d82d592a2dac11077577"}, - {"0x9db7d39ec19ee775c663f000d726ff2373d9355bc9bad384d0f297b0a5b5e3173f6ba8dda95db0e29f6440102e90ee524a30eec0be66e95780a25e43123ee678c407256a77ac16334bf85e2ec00871599facc241bb42e6e8aef8454bc2193c"}, - {"0x5d679b51a45e040c495721d309dc5d813db4670a1f71d020beeb499fd28e420b9c46edbd145d83fc514c5af80a70690b8ad616242723b732929ed3780050ed2802adc6bddaaf8180303c7ed3723c217acd225430db169b18377f482c9c67ed"}, - {"0x1083a6218e20e989bd3d5a8dc6b72927ee61b6f1ae6520d5058f8414abdae3dc928be29740397c34e7c47099981a6418227b692bd23e6d8e0f17c9ecdcac75fc71b9746675772b093583c55451077c29cfbcfc20f10cc3c33b6d3fa576fb798"}, - {"0x2a2684b5ed4c54325a36d5472a22ddb44e499780360ac833a0d88b5bc6ae75c58a7f62540701579c56d530f8d7681c8c784854e40a58816f5fbb6432eaa776534dd47b3611bec33b6e87464163f7e9e44d485b2e47d9a07e64ec57dd29cc4d"}, - {"0x47402b33b50d3ddcf4a15f745e0102d11be7528f1f5996e4042f107bd090237bf5d75cd37f0912d86e971ef9452cc46312b7428a952dcbbe959fa1d767ecca1a0b36e1e30a30e0f71dfc457c548a04390371a2221556232dae36edb8da064f"}, - {"0x11da53c9271b02c7158fb2ee86ebdae385da9ea1fbc07ffd9dbd8c3e8aa15ecda86d607469df1146982d7261aa35c97b7d74d09bb9ffb479f935e71c69f3c60005dbca5491a4954b01fb413b5e506092664ad2cfb727419b104acd72e036f7"}, - {"0x536cf5aa2222d8de443b557d093c9f29f4a16dfd168e6afc1382d9841697ffd7ddeba4d099d2bced00a1aa2285b1788db932d59fb3fa891ce97d2f74e9475927fd9616c5594b9152e99dd586d5ca8ae8be11cb213289ae895cbdd4b2fd465f"}, - {"0x1da860f7c3597b35726e87cb3bf0b209effb0ef9ff5b2f116098e644235ff06707de8383e4cedca3defa727819c6a7fa4574dcca3844096d8e55ec3405ea3036e724ad26480fc08be1d562c7db9a0e0795b37e337e09e16c7e5033546ee8f5"}, - {"0xd07de606072f1a8a527374c766ddbbf30dbcf9fcc9ef0dbee36409d153931702895dff106c34aec8d2f6b85c4e2b310c4a6df78a37e45b4cce27062ae58f9a7ab8b3e8d7b3b60585903ff5bb83b5861ad82d740046741b91f7b951a5dc3cbf"}, - {"0x2606343340db37698dead78d4cddcaf70a6850b005f27101986c5c402a6d7b86ebaab95f8345807c243ae39a51ad91df6b27ebd90b4aff85afec988b3889012caa8fffad0c621eee9993dcc69f370fc96b5e854cb8eee096061ae383c00b4c"}, - {"0x5eef4743e715650a29dfe5d51bd349b00d506292b178708638d69fb99ad660056b8b80f206e1d507b863f2b1b7a26f3a2c115ad138ad6aef6591d911993705da206b6107e5469f8cc1d7623bcc867c10fc3bf41c10b4104dadc1914da7a424"}, - {"0x76727dcb29badfdf33c34dbb80cddf85084d5def7241d7ac8b6b29fa04e1097c534b5272704c75de0b439d26ae3089a3db2899041e275f3bcdcf5364b8505ecd98cae322ff7b37fafba7a8c9f7b81bbead4e4831bfa37dce31ccd4c0ec0393"}, - {"0x1121863773817cea34fb74e529bb85fb5eedd5cd253a9b209f248b1095a79371ba0d58cc7ab19fe62fc91bff7d55b99a1c92b6f299a157d6abd061c56b99a40f4ae8f571ca8bae37cc46f7d72e31283358d089786ed293882489deb19f2fa5c"}, - {"0x380aa09030f5968743a51f91b9f4f2e76ffdfdf93c0c1e481db8f7ab2f12b6f1af4c65388b2283f4dafed85cbc94f02482426fb73d27c1f9bbb98fd1ee37baf2ff25c8d28160f91cb356679908cc289c5ddd7c3b0c10d70ce520877d6a5ed8"}, - {"0x3d32fd2068147a3f7da278555ed406ade542cf524e674563b2cf9b4e8bded523fe0c6cfa7ba4366049ef1853ec49dbec71308f9d9c07fb2c92669f403228ec339e9c0d854340e32a0d312366872b84850b002246a56dc42da0d78a794f82e0"}, - {"0x8d03083b6680f456a6ca2f12731aec4d9bc3047f1338dca3dface56f3e5dcaa248034a8008c1cb6e2103cb759d3ee7f9bf050ccf5fa589cf3da4fc83ad8abad35cadd716d51de0f823f8874aa7b1759c1265d7767ce44a23e0fa26cfede36b"}, - {"0xc153033cca117585a8e7e559a8b5afee72d31ac7c96ea9660856b636d26664619b0d16312f43c760798af878a41561ac18b87cb636c456d653b58d0343cc76cac997ca14928b935bf6c9b9912d6cd88ce3ad7b2525c09727dc2e15752ff950"}, - {"0x9e424fec6f5e28209f0dccf860a5bf271461173cb2f2c63922b520ea861c8b17876b00af0a926be498559104ab3701da59cde8972717093092fdcf0f4f1cf5ef798db7f5bb86db0db37c4ded8e979869c1a62aa3e84f2091906b0838a3822e"}, - {"0x1f7b0fd3b4c9a79f8302d026517b9018ec27da4cae421b702cf5e7c4923c438d89a24c946e473af82528298e92df34b54ec696ef86299d10c3fd8252b951b2b4dfd3b829a59c81c6ace17f6001df90e6be71bd5d68d42de866f3ab1a202423"}, - {"0x9402f37c7ba1e44be19ae14fe91a6545acef0b2a0a5e36b28179853b1f2c7f98e988945246a9d0bd433602ad0a75d66c4ccaad92800b997574767815e9ace78b11abe421571bf819ccdc2068accedae0e729315b2a1520c7bf579272dffd49"}, - {"0x331d1df12f90a78ef9e864e208ca152c9de1601075da588eeac25127988d0f04e16af1f2c817b2c33bfacf0c4696b86f5015b0f66c40cdb768aa2eec7bb555a17a245f7136ff01da8de4970bcba352e698e1f350dd17890e07447f13f2928b"}, - {"0xf6fe753cc6edfb75968c8f6b8cd121a06115ed350ee30dee74f5bf91816efa1a47d450f52febdbd8ebcb5483c9b169ceae1125e2f69f254cc91e9077d7e6e409b9e80ea5e76ec5e6d9a84a25bfda45ab2555314aa4a458243fe5c225c1d149"}, - {"0xc1034618a75481d52de528c17b76c6f30c350df5827accfe92a886055129790032d1cc01eac8727255e1ba03557cacd704ba2912a0737ed16a69f98bd196588d474d6cad779bb90d87f6743a87573f081a734090b05d1a591bcb6d4526c7c2"}, - {"0x19ecb6f5a4ad4557134ccbd3ebbbf4d3d0062a9a5d288da6f0e21bf98f2c04ec673033817c2ba1e808a23e96b99e945ce33a695884cacbdf15991bf2b9c4b3b9a5133888ae5f3947be1f9d499316f170f8218494d43536d883db4c24584adb"}, - {"0x32f37e3a71b888b9fe0a88c42666b32112b5444f24cbc4d7a805dc02b4538e0bf86cc74ac277acf8acb9dbf815605dc54a746ff5595cf472eabd6299597dd15d479dfb59307169b2b2f1e50c9c6d83d28eaedd5569d7f6f1f40657df2614c3"}, - {"0x107ee94600281e0d5b68e55349f03c7b886c4b2fc8a827b7a353fda767beabf06fccae229fc2bc576b49ab29263c7d21499172898b4757f3b44aa54fbe99015cc1b263d929c94b3a7019490d6e28b2c7475a7977d4822a065bdefc470912dc3"}, - {"0x3b4583aa3c1f1cdcbd1b268fecbd5c85c46d7ecac4cfa94d2ed766887ea79549a9580d8a0ce47039ff60bc4d3aa202435af74c97403c172ece712bf15c246650d6612baac5f7019cb0bdc7175840fe1d7c8c2e9d5c8663cd12a62501e9164d"}, - {"0xf6eab8fc5a94f484333df010d6f2c6b620520cdac1a40546769fa2b02f9d6e466724df638732a4eff5446436296dface1495dcaa6ad4e24b3a14a0c6c98364d2022406167ce327f82da7c59056962b5238085af38db3f39758e9d1bee007f6"}, - {"0x9157bcfa227476f05aae9ed56e79824236cb30f1f47dc82a9648703881f75342ea4dd3f208102bb034ad52f7c0a64d33806df1634fc233317e55e17c70abec3d1fc16cd473e7a1693dc312a5dc498709166bf78607b2726557f1dbfa3af42"}, - {"0x13e95f1b69c1bb059b35da52693903820813354d0c2a3ee18c0077aa967afc4b7115d0fb99e814c7b256acc47cc4f9995bb0df178a604f5ca838ace81cb080dbd40e67dd731e8c54ace47e999d79841e38881f52e8ba7eb82420e457069bc7"}, - {"0x5d6d5a496bda19771b6fcdf7cefd6dfbcaa8945fe445b5223cc538ac2ba0df97e495af83fd6f9c272e3e4914ebf9277380079d9290a356d9111bc382492cbc13ae4ddd0e0d7ba5a1f3c117569a2a8e96d169af588d1d4085d0d801a598d121"}, - {"0x12ed009e830c3052d44ec9cd6787457249084772a2cc3118ce49b1bf668dd1a977f524abcda366867cdbbbdbea655cb336d2a088df78456d3d21df942137d25b1343edd948cd5e3b49c76ad5937e25f032d00fb29262f071c5e4d0e512650a"}, - {"0xe3da5cd6c4e06d21025932bc0ef3fb4863115ec20420cb77b2f8017df249e00422a4d2dc652400c82dd4dea5de342e9d61fd2f1f842b9e5ac519eb62860061562526e56e1087eef9ce359a629824f703f5c1ea62cad6ae10980a7b6363064b"}, - }, - Den: [][]string{ - {"0xb35848a97889d06c9d137621e2f283fedffc9d4fc1a32da73338a90d0a46fb076bee393363f551ec5bc14317a92290831636fb97eb217a7dfa6e64ee0250a2f0ae408c60ad721aca20082b11124ed0af26b9b472706b58c8e258dec46457d6"}, - {"0x11bd48159d3f3f0a15e56f4758e253a1d2b3b14bc308c858f3837abb8e3868658920679627e8a93ad269631ef17b1b1693afc409afe41a71e49f64a1e2535fea30f085d24b7b6cf9aebcb322358f81a34b6599c88bc90b978d0218b755cf2c1"}, - {"0x1c14b675d0ee3fe6c012a5be16d84618112e7838d3621e79f62729f8c76dee05199cd66a64c52aa80351363fc91830a3e7eff500235ff5c69ff02823bc95ac6a89a3fd461e7921c71a8ccb57635f073f3a1b29a71071003fc0be48a5aa8990"}, - {"0xa40a04a2472305ed9478e4c4eb679c1cf87bad62fff861126ad8969c548ffa26543e86f1c1d27957a59aa160465d5ef918cd65e450a2973cd329b5480adf5911a750b83ec47ca6f60866eba9f5cb0f2c11b38e7caa549f970d2a3190a03dca"}, - {"0x1e0f2070926cb9da608e7a9daad66a92ea5236683edecabeb6fa27abf86c91f8007095f818b4581f306698731cda8328dbf7ec5526cd091746e7a9545a34f943ed863ba6982ce022f6f63d9102c7508f332dc3b5de64c22435f0937548c9a2"}, - {"0xc3a32f1093a2d37f26a614efc790a279c8284c321c191637dd146829dc90518ff37b4801cf7688fdbedf8984cd0292c99034198757d5b07e946c0f4aaf869d7613162bdb8c2b9f64e958a97391e099d0f12f032c6458e1213a0a44282225fa"}, - {"0xe02ea67182f3fe3d578b08f0d7928b7c6fdca2115b687ebf858dfa3ed273ed68a9853fa0675254cdbf5e038e2dff11fe6be1ac0acfb7e2d69713c9e5053107232558137964f4d8c75f9d499b5d1172c7c7c7ca17ba1552c181482c6fde568c"}, - {"0xb7bdc820045b8cb4750d2cf14442e75e71ff88850bb68c703a9d570b4ead2265e1433921511be60f0f494ef406d6ffab61439f2492902d06a47ab797611ed56a2db85dbc6ca66ea91fbded330d1607a8f0665333167eac5036e8809c424602"}, - {"0x4b874c4266a94c9645d7235482a22dc864d3a95f9123f6dd42ac37687a32fb96d6d078704623519d355e7d2942b96183761b60a96d86b24158041b2d27e0b6d83f524e2dfd36aa32c722dc52e6c8f90b372e4c69b8d57c400535580e741931"}, - {"0xed7683d3ed7bd7b795127161c1c3d283e2e5264b38ec25fff29cd620f0f35b50bae6134ca7c707fda9f21f1e5ed72dba00b4db93a2289a0ca3325006b7901fd25eb3112b01280113100c8c706e5cf754cfebdadea45bfb1bcad9b55b6a8bec"}, - {"0x798e60091f0baff46af8096d5d385c3ac834078bc68a5a0264b38d84d3e575383492076590dd1c78ce517c938bb2977a4a53c19a224ef3c06480ba9458bc3810382e54b052a61ea2a9eab88b7f2e4379616e835e8aaf9ceb8f7725c00e473b"}, - {"0xe25d6afa99d9845550da2d8be7e54972c881f60e60fc44e1aa4639a469895429c40ded2c5a915747487760917ba655e5bd70e760a60bce724ebe669a6f9a26e612a7e471c491eb901f086651f804b2e8ae65cbc30fbfecc3ab056254152e1e"}, - {"0xd3bd269478c18fe4ae906db51c2c61c8e8eba8c0ffeafee1a4590f0f771c420738c368e903c5bb0ab4ae5d764f1db9d32dd0941af5abdcb799a0a7868ab22b8066bb43409f5618113ee9dbd7095a1132467d7cf792c2edcee3f32fc76e377"}, - {"0x10d8abdaa3480b89ebfe1c4f750c43d1ebec7cfd63adfdcff0904e9b54b762843fc0dd9edb82ce3a6dab718b3805f8bf23d59fe0be8558d3168557f22e481614c83c08a53ef37d647faecda297e45535112f46edc37101ca78aa36db8baa52e"}, - {"0x73757c884a1e868d44f45a39a70be12ca5fbca1045af3c5dfce747238edd7926dc150df6bae0de22fe58a951f68e395e3c6b58285afb6e13d04f58f3be13f468f1d95d89be6973f4af4a03c854d956e4bb87cdb1e85aea019e5f0e2bca4543"}, - {"0x43b12c0a691c949e92b6c9de3f2fd57d511a8f558567437c329ea1602a4f9575c328c6ce9abe3a41d6977eef727257a82e1bbdc6cd86ef0176fbe891af806075e500c1f05f54880ec857442d6fdfe701cfac8e0bfed571913c10eb250e0022"}, - {"0x5dd753e576c5e17fdb31053f4583d11a7efc9842522012c64dcdf4fb1813de9e2342aca1ea200c8e8ea86c846041648ea1ab64d8286960d339fc3605f38472ebd8a8a371d7a6a99360c4a35173bbc8fea0433e13b00707ca26f29726c1201"}, - {"0xf9cb66cab40e4b021cb9ab0d6ecb29134a25c87261d856001610a3d7fcfc485c34c1acb355a69c9fb3e171b3e36814b50b1d58b14f86d2fd7eeed7fd1ab7785800dece186c33a4fab38104a0c5a8abd353622161daf40d37a6d072443c4d84"}, - {"0x11aa8006f5e3cf018df2a06234daddc183d82f632c47e1adfba4c1747e717c7bc6708aef8baaf81d65520bf3eb7543d6ba7267adac6c2b1fdaaada6f47d96485e0ae6a1a959da775932766eb8c044905d42d295e4609c41019d3215a0ecf1ce"}, - {"0x11cebd8fefc74f456542424a4260474172f2ea3de5ae199758cff05a90330816514c564a4ea7b56ff8173a10c9be915b4c4cbc6dacbfde9ae946a963ecfde2fff66ff267019fb3f6bb80f77aaea5a09d18b8fa6f0b9c4f730c41077a869ea60"}, - {"0x43816faa84ded72d8298e803ffd4500b0d6fc6e4fd2febb9f773a0b2b9a7d2d6e2737798e7a85433717d7c3df4cca47295c9763cd9a14a2a5efd2a535d7af007f795da423ddc4709a0fb39ef1159d316b9a072d30a28f62b79383ae61672c"}, - {"0xbd64fcab7189eba72da0f52543636cdf11c17cf200f39297021b4ddd528da640175c9e79cab502feda518f5643053e92672e569935848dde1411b4f9abf62875b4b0dae6f8a249a05f984d8e2cbe7bc8216896251fc9c801d232ee0a6ace1e"}, - {"0x11908b0ee96ce37dfa9655c3cf2417961b6890de361366d3c889cd33cf5d9726801f9db61f7a445bf3d30e5d2632d899a45da474ca5bc5257cdbeaefee742e5549975d293d3a211b0bff06206bd8da0d66a31684300aa30275ec98af2204fe"}, - {"0x7e3dd2299ac6f6c9b0ca812e5250a5a0a9ac696649ea44304efc9eb17873ba05758cc68535699b63a921dca0c065bc0c74f47dcf13eddfa9a49ade0dfcff10a185ad8a1ea9c0546fd04335ed21eb0c32813b8d98d38ac8444619053ab9e9db"}, - {"0xcecbd40f99ea98da90fa06c98dd11219e5e9dda72c183523827b1fc889ab4a306695fe674307047144468aef1f17993762be4b859483db87b27f442bddb107489d094a51ddf3b5dde5499d79a806e31528ecbebc9894584135547e9875dee7"}, - {"0x8fcd9b98a111fb0b88bc45e05c13e919903c015e73e51c79b1d76f351e36c5640624fcde3e60ad3a5949f9a35dae56bcc3a1886854433eeb48c3498b4b32a913b34b78220b02b0a1cbce157f236d37fb69ef96e98f07644e37c9abd1ceea1c"}, - {"0xbc6e2187eb737df544826df89d5279d06046a2b47664dbb87fce1ab6a3f7edba758835bf0810b4ec4237719e7f801e24e64247f3fec548baf27dbfd691eec0e490ac592e1e066480706aae437bd7bb3ee5c982a9c0ca1575b556005bbea58f"}, - {"0x12170c6c8cd5d3a968d03315342c1251b7e384f85fdfa0d3926b793bd740afa3dc0dc8a51eb829450218c01c0ac8b4eb6163ec1132283f4d366dfbc0582225a6b14163a15df63a27a2ffa2a5da74ee5845d71a8346187ca736714ccbd2b00ce"}, - {"0x1d8792a1d4b4411685a26918d785823cc142a0912ee9a8c1981586b35fb2581492b26b7150fdf1899f678b13789c48c28bae260fb93742507d0323f3f2c908a4b089a4e018ed7b351cf17d05cdca5d13c92201596045f7f89bb44c7e42e17f"}, - {"0x1b457948b6d5eab15ce534d9c997bc32978fce85a19025d325c1705231586ff07f2e334ea9bf39f572423f10f0938ddfb7b44ca8dc8d21317f5ab1c66248922f53126875ee0e35c060f413f4376c474938abc5b57a9ce17c15cdac17c7fce1"}, - {"0x509b78d33906267310fb5764df3a83af5e10b24b3d04ff9a64f1e87872403650d8f05e039b0bbfa50ac9a9a496f509541a5d1ae590acd31e0efea18f9f9b0eae82f2214364c91528dd297288a4a3e04cc82aea73b257947cba2d3c027f3b4e"}, - {"0x34c92249a79e2afe89113c83ff829e7376ebd2bd99f61023336e601144565a3060888f77f83071095752205b778702253fa2a187d9cc0f240fa1401be60298736dabcea50ba63065cc6aae3a089c3bb77dbceefc83fc029a2adf90289d5269"}, - {"0x6158d56b2f6902c287d980c970d8aca6f6d10072eb749afaabdd9a9d098bc6e7bcf07bd1bc8958cb79cbf53dcce6eb72bc34a5c2613384bcde79a64b340640e821855e49f71c073c715dd55768fbbb5a27397cf584fa639d927837ba9a52cf"}, - {"0x6e3c4990d0e48167ffd607fe2c5f4d5e22afdbd2c39113dfb8ff2583d930a9bfa6c2074eefb455bb8ee0618600768b2f85e634791a2f6465642268d8f46d3f10a38d980a60d05c71030b500691002cd7cd01a5497eda666bd77bf2498dfdcf"}, - {"0x2b15f6bcfe35e5d93d3c369fa9e283b137865559be088eb6dcc6e73eb50854b68943546f83849a34668275fa3292da90ea6941391738c9abdda4bdee838b80e7959ad5d72b9fafc33bd1526c7c993dadfed5a79b9bb119c277cef9c7a71dc"}, - {"0xdaf7f2929e35d0ba56ce2742d5d9cce74d572dac5882c678bd6b5f39d7c6d74ee3ec0e4c2e052c635a12ca1389bf62b147c6c85df6adba1b2c70ed3c60424c84dc6b5265e11ec4788ae277f04576101c11009182de27a8eb5953c1aab8e1e2"}, - {"0x4a1b0c9af273773fdf3bd29eae337f09acb8e1b10457187a5f7d43450a6de3b93d3cf86a298a6e99030c0cd203113c46a67fc1689dca1cfbbc663899b2ebf8781db80872c647934862ca898a564fa156b58c554786a7712fdea39d78a366fd"}, - {"0xe22946eb7bdbef6cf67b1b30ff0c6ff4a2d3108d338c55bc561b3ab50db2cb0826365f812464f2cdfd2940476d7fb7db692ce19e2f53bd3486412d1258f91ef75cc0a09b3d72955a6e867452e4e7aa2f1c496fec0b41ff2d5df172664683f0"}, - {"0xcaf9adb7a9fe17c553022cb9fa3ed693a6fe017b6c667b9b3fee7f904fe34ea15e1b671bda21c0e3b8bb07f3301bec8986d8ed48b1461666a88d1b1ec3d12a51b07930b81e544907804d14c5ed8834fc6edc7d660254d8491968ce6034642d"}, - {"0xdae7c72155f240753502352e5ef320d206adde735e9fdda0c6cea0bd48acc5eeca42e615e6a79bfe4f57a3c75816ec327b0fe017bdafda135db84ee4a5cadd38b6c3f32216f411f2a69a45daf35d5242c9ea218557aedfc0c241bef5c25d47"}, - {"0xa44e2a4243eb71846e0c033d0b508654b71ddcbf86b859adcfe48fc5330c4226986f8fe2b405a587c37fb51173e2f438759dd8250235b555a7f99915aba1961c0c1e4abaefcc9ba4d88d08254bef4b4ad5efdebb0f15586981614e65f5a262"}, - {"0x11d90321c1a5e68ce6aeb22eb2c666145d256b2541178474d03d8e918d8ad4fb6e584f004810f1d3e5ebf0ae73645bc8851cd382bb88abf2e65019ca263ce9f961956f03db70d927acff8a5ce8918f6ed96762782c5c78ae56ef3741eeec30e"}, - {"0x73067c544d14eb0fbe73111b96dc68c493c312a408bd3138e176ade7405d93b6553004d77e05da6cf32defa9e65e1267ffe94f6d971f8de118e3bc21fa8b59896ba9a3a1494f176e24195c65730b3fb2c3d0d048de7e13cbe64f64cff8a466"}, - {"0xea2438249db0c31564caec1d831128fe9688db01a3e9b017c68f007bf1dc6782d46226efc730bceb0a4b5d6413f7048bc5b704affb912aed0fdb9d26a3d0add40ebe02bf786a38e8e29e88c6143b9eb289b27fba11a6979905a0bae8c272ce"}, - {"0xb8998d5ec7393dedffe4f708881d1cc145104c8485261ab6df727bc0fa4a7b55dea1a7893791a93790e6af9d1bc0bf3ebe5feb40b340e9e89cee859bc443162e3dbdcda09f1680d74700f56f037e4388aa741daee7bbca5ac789d34210b9ac"}, - {"0x9db9607a944de0743644a01a2bbc68dd869d4df41655c78b91678efa6b297efa53ea116f68a0d01b696ba23cccc34a180d0e888c9d0cd6170b21c7cc47e7040193e605122d2487d0960d31f40fa0f9fb1979f3c9f070ae21d4987aa10635e6"}, - {"0x1064c0575f32e8a01dbb0902016549291db671757d01133b941f80b48ffc6cf6e97ca4112be781a452e4bdaf8188c3db4245c089a8cd9a20a9380970a2f583371a03a3306955b512b8c15992c2689ddd948200fefbd9a23b581426419bdd44a"}, - {"0xb38eb53f5c01ec437a38102c26e021ceab2096dbff88cf994a5e676c67b5e9e2aa0b7b8e5fbf481b9ebb1f2e1143c5d2331b4a7307543827f08ac9b085c9f763eace96795934aaececdb8d5667438f023bd0dcc10a1f53751b46aca1e1a0b3"}, - {"0xd3a1a4efb742aa1a15b063d6601a48f9119b6ad86d32432ed0d80e91fdd274b5a2fb4178cdb5cfadfa462775bed589a228c2974d988b40a7856b1e6f5b7a69201c7226f38239c0e4f57729b74a2a35d56876815defeff9019a4aeaec8ace2a"}, - {"0x890f6b8f09c172a9759a98d2992c4ec9a89e19af59dd9aabcd54dbae2c8bec58b63b35d8b2e0434532e8aea16ac6155c20c944777a8ca9003afa8dd3d6d6ba35ba41c8ea40710297a073dbf4f4b7e2828b20eeb168b3ed9513f7359f8fc075"}, - {"0xec2327808b9cd4a32bc9540933cb13b19057ddfb9d0815a9c3570d94158d5ffff7b1a837c905ea8515e45f571e080770a6d574c1735ec3000d79a494dbab3b2e7c463c8f518ab36199573c42837d74f7b42b001d232aa9847548b8d8c2e9c0"}, - {"0x3347dd7683ba2e167d3b718be720970c262bf6aac6783b7c0c56059a2e218e3983530c568d9666b9e7b1bfd947e1e321e1ef041fad5fdd9e7392055a45b9a13accfb5e13fa30a15f00355721459f71856aa768476a8ea9e0b18cade6ab4f49"}, - {"0x64a3e6bd3ee53dcd1ae4764d398d44760b5c5192d0745d71a452accbbfd3f0f9f106f9866b973d599c20c64ec4b9311f4ec1b991ab43b5b23e865875b56926456fe6399c3f69b7cf8d3bbf6254aef3c137e16a22792898bdf6265a4275368"}, - {"0x6e1f826a09b835ff320046e2dcef94cb16de08591139db2b9f7114d380f921d4b3628b658fbc082d086761efcb1fb03ef83a82e0d19ad5cf8c6888661897eff183bd3379aafcd524318a32f1156d16ce876fbe3e7bdb951028489ce89aee8d"}, - }, - }, - }, - }, -} - -var tBW6_761 = TwistedEdwardsCurve{ - Name: BW6_761.Name, - Package: "twistededwards", - EnumID: BW6_761.EnumID, - A: "-1", - D: "79743", - Cofactor: "8", - Order: "32333053251621136751331591711861691692049189094364332567435817881934511297123972799646723302813083835942624121493", - BaseX: "109887223397525145051017418760180386187632078445902299543670312117371514695798874370143656894667315818446285582389", - BaseY: "31146823455109675839494591101665406662142618451815824757336761504421066243585705807124836638254810186490790034654", -} - -func init() { - addCurve(&BW6_761) - addTwistedEdwardCurve(&tBW6_761) -} diff --git a/vendor/github.com/consensys/gnark-crypto/internal/generator/config/curve.go b/vendor/github.com/consensys/gnark-crypto/internal/generator/config/curve.go deleted file mode 100644 index 0c55a6a97..000000000 --- a/vendor/github.com/consensys/gnark-crypto/internal/generator/config/curve.go +++ /dev/null @@ -1,102 +0,0 @@ -package config - -import ( - "math/big" - - "github.com/consensys/gnark-crypto/field/generator/config" -) - -// Curve describes parameters of the curve useful for the template -type Curve struct { - Name string - CurvePackage string - Package string // current package being generated - EnumID string - FpModulus string - FrModulus string - - Fp *config.FieldConfig - Fr *config.FieldConfig - FpUnusedBits int - - FpInfo, FrInfo Field - G1 Point - G2 Point - - HashE1 HashSuite - HashE2 HashSuite -} - -type TwistedEdwardsCurve struct { - Name string - Package string - EnumID string - - A, D, Cofactor, Order, BaseX, BaseY string - - // set if endomorphism - HasEndomorphism bool - Endo0, Endo1 string - Lambda string -} - -type Field struct { - Bits int - Bytes int - Modulus func() *big.Int -} - -func (c Curve) Equal(other Curve) bool { - return c.Name == other.Name -} - -type Point struct { - CoordType string - CoordExtDegree uint8 // value n, such that q = pⁿ - CoordExtRoot int64 // value a, such that the field is Fp[X]/(Xⁿ - a) - PointName string - GLV bool // scalar multiplication using GLV - CofactorCleaning bool // flag telling if the Cofactor cleaning is available - CRange []int // multiexp bucket method: generate inner methods (with const arrays) for each c - Projective bool // generate projective coordinates - A []string //A linear coefficient in Weierstrass form - B []string //B constant term in Weierstrass form -} - -var Curves []Curve -var TwistedEdwardsCurves []TwistedEdwardsCurve - -func defaultCRange() []int { - // default range for C values in the multiExp - return []int{4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16} -} - -func addCurve(c *Curve) { - // init FpInfo and FrInfo - c.FpInfo = newFieldInfo(c.FpModulus) - c.FrInfo = newFieldInfo(c.FrModulus) - Curves = append(Curves, *c) -} - -func addTwistedEdwardCurve(c *TwistedEdwardsCurve) { - TwistedEdwardsCurves = append(TwistedEdwardsCurves, *c) -} - -func newFieldInfo(modulus string) Field { - var F Field - var bModulus big.Int - if _, ok := bModulus.SetString(modulus, 10); !ok { - panic("invalid modulus " + modulus) - } - - F.Bits = bModulus.BitLen() - F.Bytes = (F.Bits + 7) / 8 - F.Modulus = func() *big.Int { return new(big.Int).Set(&bModulus) } - return F -} - -type FieldDependency struct { - FieldPackagePath string - ElementType string - FieldPackageName string -} diff --git a/vendor/github.com/consensys/gnark-crypto/internal/generator/config/hash_to_curve.go b/vendor/github.com/consensys/gnark-crypto/internal/generator/config/hash_to_curve.go deleted file mode 100644 index cb7c5b914..000000000 --- a/vendor/github.com/consensys/gnark-crypto/internal/generator/config/hash_to_curve.go +++ /dev/null @@ -1,202 +0,0 @@ -package config - -import ( - "math/big" - - field "github.com/consensys/gnark-crypto/field/generator/config" -) - -type FieldElementToCurvePoint string - -const ( - SSWU FieldElementToCurvePoint = "SSWU" - SVDW FieldElementToCurvePoint = "SVDW" -) - -type Isogeny struct { - - //Isogeny to original curve - XMap RationalPolynomial - YMap RationalPolynomial // The y map is also evaluated on x. The result is multiplied by y. -} - -type RationalPolynomial struct { - Num [][]string //Num is stored - Den [][]string //Den is stored. It is also monic. The leading coefficient (1) is omitted. -} - -type HashSuite interface { - GetInfo(baseField *field.FieldConfig, g *Point, name string) HashSuiteInfo -} - -type HashSuiteSswu struct { - //TODO: Move into Isogeny - A []string // A is the Weierstrass curve coefficient of x in the isogenous curve over which the SSWU map is evaluated. - B []string // B is the Weierstrass curve constant term in the isogenous curve over which the SSWU map is evaluated. - - Z []int // z (or zeta) is a quadratic non-residue with //TODO: some extra nice properties, refer to WB19 - Isogeny *Isogeny -} - -func toBigIntSlice(z []int) []big.Int { - res := make([]big.Int, len(z)) - for i := 0; i < len(z); i++ { - res[i].SetInt64(int64(z[i])) - } - return res -} - -type HashSuiteSvdw struct { - z []string - c1 []string - c2 []string - c3 []string - c4 []string -} - -func (parameters *HashSuiteSvdw) GetInfo(baseField *field.FieldConfig, g *Point, name string) HashSuiteInfo { - f := field.NewTower(baseField, g.CoordExtDegree, g.CoordExtRoot) - c := []field.Element{ - field.NewElement(parameters.z), - field.NewElement(parameters.c1), - field.NewElement(parameters.c2), - field.NewElement(parameters.c3), - field.NewElement(parameters.c4), - } - return HashSuiteInfo{ - PrecomputedParams: c, - CofactorClearing: g.CofactorCleaning, - Point: g, - MappingAlgorithm: SVDW, - Name: name, - FieldCoordName: field.CoordNameForExtensionDegree(g.CoordExtDegree), - Field: &f, - } -} - -func (suite *HashSuiteSswu) GetInfo(baseField *field.FieldConfig, g *Point, name string) HashSuiteInfo { - - f := field.NewTower(baseField, g.CoordExtDegree, g.CoordExtRoot) - fieldSizeMod256 := uint8(f.Size.Bits()[0]) - - Z := toBigIntSlice(suite.Z) - var c []field.Element - - if fieldSizeMod256%4 == 3 { - c = make([]field.Element, 2) - c[0] = make([]big.Int, 1) - c[0][0].Rsh(&f.Size, 2) - - c[1] = f.Neg(Z) - c[1] = f.Sqrt(c[1]) - - } else if fieldSizeMod256%8 == 5 { - c = make([]field.Element, 3) - c[0] = make([]big.Int, 1) - c[0][0].Rsh(&f.Size, 3) - - c[1] = make([]big.Int, f.Degree) - c[1][0].SetInt64(-1) - c[1] = f.Sqrt(c[1]) - - c[2] = f.Inverse(c[1]) - c[2] = f.Mul(Z, c[2]) - c[2] = f.Sqrt(c[2]) - - } else if fieldSizeMod256%8 == 1 { - ONE := big.NewInt(1) - c = make([]field.Element, 3) - - c[0] = make([]big.Int, 5) - // c1 .. c5 stored as c[0][0] .. c[0][4] - c[0][0].Sub(&f.Size, big.NewInt(1)) - c1 := c[0][0].TrailingZeroBits() - c[0][0].SetUint64(uint64(c1)) - - var twoPowC1 big.Int - twoPowC1.Lsh(ONE, c1) - c[0][1].Rsh(&f.Size, c1) - c[0][2].Rsh(&c[0][1], 1) - c[0][3].Sub(&twoPowC1, ONE) - c[0][4].Rsh(&twoPowC1, 1) - - // c6, c7 stored as c[1], c[2] respectively - c[1] = f.Exp(Z, &c[0][1]) - - var c7Pow big.Int - c7Pow.Add(&c[0][1], ONE) - c7Pow.Rsh(&c7Pow, 1) - c[2] = f.Exp(Z, &c7Pow) - - } else { - panic("this is logically impossible") - } - - return HashSuiteInfo{ - A: field.NewElement(suite.A), - B: field.NewElement(suite.B), - Z: Z, - Point: g, - CofactorClearing: g.CofactorCleaning, - Name: name, - Isogeny: newIsogenousCurveInfoOptional(suite.Isogeny), - FieldSizeMod256: fieldSizeMod256, - PrecomputedParams: c, - Field: &f, - FieldCoordName: field.CoordNameForExtensionDegree(g.CoordExtDegree), - MappingAlgorithm: SSWU, - } -} - -func stringMatrixToIntMatrix(s [][]string) []field.Element { - res := make([]field.Element, len(s)) - for i, S := range s { - res[i] = field.NewElement(S) - } - return res -} - -func newIsogenousCurveInfoOptional(isogenousCurve *Isogeny) *IsogenyInfo { - if isogenousCurve == nil { - return nil - } - return &IsogenyInfo{ - XMap: RationalPolynomialInfo{ - stringMatrixToIntMatrix(isogenousCurve.XMap.Num), - stringMatrixToIntMatrix(isogenousCurve.XMap.Den), - }, - YMap: RationalPolynomialInfo{ - stringMatrixToIntMatrix(isogenousCurve.YMap.Num), - stringMatrixToIntMatrix(isogenousCurve.YMap.Den), - }, - } -} - -type IsogenyInfo struct { - XMap RationalPolynomialInfo - YMap RationalPolynomialInfo // The y map is also evaluated on x. The result is multiplied by y. -} - -type RationalPolynomialInfo struct { - Num []field.Element - Den []field.Element //denominator is monic. The leading coefficient (1) is omitted. -} - -type HashSuiteInfo struct { - //Isogeny to original curve - Isogeny *IsogenyInfo //pointer so it's nullable. - - A []big.Int //TODO: Move inside IsogenyInfo - B []big.Int - - Point *Point - Field *field.Extension - FieldCoordName string - Name string - FieldSizeMod256 uint8 - PrecomputedParams []field.Element // PrecomputedParams[0][n] correspond to integer cₙ₋₁ in std doc - // PrecomputedParams[n≥1] correspond to field element c_( len(PrecomputedParams[0]) + n - 1 ) in std doc - Z []big.Int // z (or zeta) is a quadratic non-residue with //TODO: some extra nice properties, refer to WB19 - CofactorClearing bool - MappingAlgorithm FieldElementToCurvePoint -} diff --git a/vendor/github.com/consensys/gnark-crypto/internal/generator/config/secp256k1.go b/vendor/github.com/consensys/gnark-crypto/internal/generator/config/secp256k1.go deleted file mode 100644 index 6c0d6b7d9..000000000 --- a/vendor/github.com/consensys/gnark-crypto/internal/generator/config/secp256k1.go +++ /dev/null @@ -1,28 +0,0 @@ -package config - -var SECP256K1 = Curve{ - Name: "secp256k1", - CurvePackage: "secp256k1", - EnumID: "SECP256k1", - FrModulus: "115792089237316195423570985008687907852837564279074904382605163141518161494337", - FpModulus: "115792089237316195423570985008687907853269984665640564039457584007908834671663", - G1: Point{ - CoordType: "fp.Element", - CoordExtDegree: 1, - PointName: "g1", - GLV: true, - CofactorCleaning: false, - CRange: []int{4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, - }, - HashE1: &HashSuiteSvdw{ - z: []string{"1"}, - c1: []string{"8"}, - c2: []string{"57896044618658097711785492504343953926634992332820282019728792003954417335831"}, - c3: []string{"10388779673325959979325452626823788324994718367665745800388075445979975427086"}, - c4: []string{"77194726158210796949047323339125271902179989777093709359638389338605889781098"}, - }, -} - -func init() { - addCurve(&SECP256K1) -} diff --git a/vendor/github.com/consensys/gnark-crypto/internal/generator/config/stark-curve.go b/vendor/github.com/consensys/gnark-crypto/internal/generator/config/stark-curve.go deleted file mode 100644 index 34c267d8b..000000000 --- a/vendor/github.com/consensys/gnark-crypto/internal/generator/config/stark-curve.go +++ /dev/null @@ -1,28 +0,0 @@ -package config - -var STARK_CURVE = Curve{ - Name: "stark-curve", - CurvePackage: "starkcurve", - EnumID: "STARK_CURVE", - FrModulus: "3618502788666131213697322783095070105526743751716087489154079457884512865583", - FpModulus: "3618502788666131213697322783095070105623107215331596699973092056135872020481", - G1: Point{ - CoordType: "fp.Element", - CoordExtDegree: 1, - PointName: "g1", - GLV: false, - CofactorCleaning: false, - CRange: defaultCRange(), - }, - HashE1: &HashSuiteSvdw{ - z: []string{"1"}, - c1: []string{"3141592653589793238462643383279502884197169399375105820974944592307816406667"}, - c2: []string{"1809251394333065606848661391547535052811553607665798349986546028067936010240"}, - c3: []string{"747120397548504753672821049844706693752799645928246271384591722031176001048"}, - c4: []string{"272520077186478842991245371323181269386250180546566216570369979330317493608"}, - }, -} - -func init() { - addCurve(&STARK_CURVE) -} diff --git a/vendor/github.com/consensys/gnark-crypto/utils/cpu/adx_amd64.go b/vendor/github.com/consensys/gnark-crypto/utils/cpu/adx_amd64.go new file mode 100644 index 000000000..4b0bac4dc --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/utils/cpu/adx_amd64.go @@ -0,0 +1,9 @@ +//go:build !noadx && !purego + +package cpu + +import "golang.org/x/sys/cpu" + +var ( + SupportADX = cpu.X86.HasADX && cpu.X86.HasBMI2 +) diff --git a/vendor/github.com/consensys/gnark-crypto/utils/cpu/adx_purego.go b/vendor/github.com/consensys/gnark-crypto/utils/cpu/adx_purego.go new file mode 100644 index 000000000..d4a070527 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/utils/cpu/adx_purego.go @@ -0,0 +1,5 @@ +//go:build noadx || purego || !amd64 + +package cpu + +const SupportADX = false diff --git a/vendor/github.com/consensys/gnark-crypto/utils/cpu/avx_amd64.go b/vendor/github.com/consensys/gnark-crypto/utils/cpu/avx_amd64.go new file mode 100644 index 000000000..cf8351706 --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/utils/cpu/avx_amd64.go @@ -0,0 +1,9 @@ +//go:build !noavx && !purego + +package cpu + +import "golang.org/x/sys/cpu" + +var ( + SupportAVX512 = SupportADX && cpu.X86.HasAVX512 && cpu.X86.HasAVX512DQ && cpu.X86.HasAVX512VBMI2 +) diff --git a/vendor/github.com/consensys/gnark-crypto/utils/cpu/avx_purego.go b/vendor/github.com/consensys/gnark-crypto/utils/cpu/avx_purego.go new file mode 100644 index 000000000..f2fe4de1e --- /dev/null +++ b/vendor/github.com/consensys/gnark-crypto/utils/cpu/avx_purego.go @@ -0,0 +1,5 @@ +//go:build noavx || purego || !amd64 + +package cpu + +const SupportAVX512 = false diff --git a/vendor/github.com/google/go-cmp/cmp/internal/function/func.go b/vendor/github.com/google/go-cmp/cmp/internal/function/func.go index d127d4362..def01a6be 100644 --- a/vendor/github.com/google/go-cmp/cmp/internal/function/func.go +++ b/vendor/github.com/google/go-cmp/cmp/internal/function/func.go @@ -19,6 +19,7 @@ const ( tbFunc // func(T) bool ttbFunc // func(T, T) bool + ttiFunc // func(T, T) int trbFunc // func(T, R) bool tibFunc // func(T, I) bool trFunc // func(T) R @@ -28,11 +29,13 @@ const ( Transformer = trFunc // func(T) R ValueFilter = ttbFunc // func(T, T) bool Less = ttbFunc // func(T, T) bool + Compare = ttiFunc // func(T, T) int ValuePredicate = tbFunc // func(T) bool KeyValuePredicate = trbFunc // func(T, R) bool ) var boolType = reflect.TypeOf(true) +var intType = reflect.TypeOf(0) // IsType reports whether the reflect.Type is of the specified function type. func IsType(t reflect.Type, ft funcType) bool { @@ -49,6 +52,10 @@ func IsType(t reflect.Type, ft funcType) bool { if ni == 2 && no == 1 && t.In(0) == t.In(1) && t.Out(0) == boolType { return true } + case ttiFunc: // func(T, T) int + if ni == 2 && no == 1 && t.In(0) == t.In(1) && t.Out(0) == intType { + return true + } case trbFunc: // func(T, R) bool if ni == 2 && no == 1 && t.Out(0) == boolType { return true diff --git a/vendor/github.com/google/go-cmp/cmp/options.go b/vendor/github.com/google/go-cmp/cmp/options.go index 754496f3b..ba3fce81f 100644 --- a/vendor/github.com/google/go-cmp/cmp/options.go +++ b/vendor/github.com/google/go-cmp/cmp/options.go @@ -232,7 +232,15 @@ func (validator) apply(s *state, vx, vy reflect.Value) { if t := s.curPath.Index(-2).Type(); t.Name() != "" { // Named type with unexported fields. name = fmt.Sprintf("%q.%v", t.PkgPath(), t.Name()) // e.g., "path/to/package".MyType - if _, ok := reflect.New(t).Interface().(error); ok { + isProtoMessage := func(t reflect.Type) bool { + m, ok := reflect.PointerTo(t).MethodByName("ProtoReflect") + return ok && m.Type.NumIn() == 1 && m.Type.NumOut() == 1 && + m.Type.Out(0).PkgPath() == "google.golang.org/protobuf/reflect/protoreflect" && + m.Type.Out(0).Name() == "Message" + } + if isProtoMessage(t) { + help = `consider using "google.golang.org/protobuf/testing/protocmp".Transform to compare proto.Message types` + } else if _, ok := reflect.New(t).Interface().(error); ok { help = "consider using cmpopts.EquateErrors to compare error values" } else if t.Comparable() { help = "consider using cmpopts.EquateComparable to compare comparable Go types" diff --git a/vendor/github.com/inconshreveable/mousetrap/LICENSE b/vendor/github.com/inconshreveable/mousetrap/LICENSE index 5f0d1fb6a..5f920e973 100644 --- a/vendor/github.com/inconshreveable/mousetrap/LICENSE +++ b/vendor/github.com/inconshreveable/mousetrap/LICENSE @@ -1,13 +1,201 @@ -Copyright 2014 Alan Shreve + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ -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 + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - http://www.apache.org/licenses/LICENSE-2.0 + 1. Definitions. -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. + "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 2022 Alan Shreve (@inconshreveable) + + 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/inconshreveable/mousetrap/trap_others.go b/vendor/github.com/inconshreveable/mousetrap/trap_others.go index 9d2d8a4ba..06a91f086 100644 --- a/vendor/github.com/inconshreveable/mousetrap/trap_others.go +++ b/vendor/github.com/inconshreveable/mousetrap/trap_others.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package mousetrap diff --git a/vendor/github.com/inconshreveable/mousetrap/trap_windows.go b/vendor/github.com/inconshreveable/mousetrap/trap_windows.go index 336142a5e..0c5688021 100644 --- a/vendor/github.com/inconshreveable/mousetrap/trap_windows.go +++ b/vendor/github.com/inconshreveable/mousetrap/trap_windows.go @@ -1,81 +1,32 @@ -// +build windows -// +build !go1.4 - package mousetrap import ( - "fmt" - "os" "syscall" "unsafe" ) -const ( - // defined by the Win32 API - th32cs_snapprocess uintptr = 0x2 -) - -var ( - kernel = syscall.MustLoadDLL("kernel32.dll") - CreateToolhelp32Snapshot = kernel.MustFindProc("CreateToolhelp32Snapshot") - Process32First = kernel.MustFindProc("Process32FirstW") - Process32Next = kernel.MustFindProc("Process32NextW") -) - -// ProcessEntry32 structure defined by the Win32 API -type processEntry32 struct { - dwSize uint32 - cntUsage uint32 - th32ProcessID uint32 - th32DefaultHeapID int - th32ModuleID uint32 - cntThreads uint32 - th32ParentProcessID uint32 - pcPriClassBase int32 - dwFlags uint32 - szExeFile [syscall.MAX_PATH]uint16 -} - -func getProcessEntry(pid int) (pe *processEntry32, err error) { - snapshot, _, e1 := CreateToolhelp32Snapshot.Call(th32cs_snapprocess, uintptr(0)) - if snapshot == uintptr(syscall.InvalidHandle) { - err = fmt.Errorf("CreateToolhelp32Snapshot: %v", e1) - return +func getProcessEntry(pid int) (*syscall.ProcessEntry32, error) { + snapshot, err := syscall.CreateToolhelp32Snapshot(syscall.TH32CS_SNAPPROCESS, 0) + if err != nil { + return nil, err } - defer syscall.CloseHandle(syscall.Handle(snapshot)) - - var processEntry processEntry32 - processEntry.dwSize = uint32(unsafe.Sizeof(processEntry)) - ok, _, e1 := Process32First.Call(snapshot, uintptr(unsafe.Pointer(&processEntry))) - if ok == 0 { - err = fmt.Errorf("Process32First: %v", e1) - return + defer syscall.CloseHandle(snapshot) + var procEntry syscall.ProcessEntry32 + procEntry.Size = uint32(unsafe.Sizeof(procEntry)) + if err = syscall.Process32First(snapshot, &procEntry); err != nil { + return nil, err } - for { - if processEntry.th32ProcessID == uint32(pid) { - pe = &processEntry - return + if procEntry.ProcessID == uint32(pid) { + return &procEntry, nil } - - ok, _, e1 = Process32Next.Call(snapshot, uintptr(unsafe.Pointer(&processEntry))) - if ok == 0 { - err = fmt.Errorf("Process32Next: %v", e1) - return + err = syscall.Process32Next(snapshot, &procEntry) + if err != nil { + return nil, err } } } -func getppid() (pid int, err error) { - pe, err := getProcessEntry(os.Getpid()) - if err != nil { - return - } - - pid = int(pe.th32ParentProcessID) - return -} - // StartedByExplorer returns true if the program was invoked by the user double-clicking // on the executable from explorer.exe // @@ -83,16 +34,9 @@ func getppid() (pid int, err error) { // It does not guarantee that the program was run from a terminal. It only can tell you // whether it was launched from explorer.exe func StartedByExplorer() bool { - ppid, err := getppid() + pe, err := getProcessEntry(syscall.Getppid()) if err != nil { return false } - - pe, err := getProcessEntry(ppid) - if err != nil { - return false - } - - name := syscall.UTF16ToString(pe.szExeFile[:]) - return name == "explorer.exe" + return "explorer.exe" == syscall.UTF16ToString(pe.ExeFile[:]) } diff --git a/vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go b/vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go deleted file mode 100644 index 9a28e57c3..000000000 --- a/vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go +++ /dev/null @@ -1,46 +0,0 @@ -// +build windows -// +build go1.4 - -package mousetrap - -import ( - "os" - "syscall" - "unsafe" -) - -func getProcessEntry(pid int) (*syscall.ProcessEntry32, error) { - snapshot, err := syscall.CreateToolhelp32Snapshot(syscall.TH32CS_SNAPPROCESS, 0) - if err != nil { - return nil, err - } - defer syscall.CloseHandle(snapshot) - var procEntry syscall.ProcessEntry32 - procEntry.Size = uint32(unsafe.Sizeof(procEntry)) - if err = syscall.Process32First(snapshot, &procEntry); err != nil { - return nil, err - } - for { - if procEntry.ProcessID == uint32(pid) { - return &procEntry, nil - } - err = syscall.Process32Next(snapshot, &procEntry) - if err != nil { - return nil, err - } - } -} - -// StartedByExplorer returns true if the program was invoked by the user double-clicking -// on the executable from explorer.exe -// -// It is conservative and returns false if any of the internal calls fail. -// It does not guarantee that the program was run from a terminal. It only can tell you -// whether it was launched from explorer.exe -func StartedByExplorer() bool { - pe, err := getProcessEntry(os.Getppid()) - if err != nil { - return false - } - return "explorer.exe" == syscall.UTF16ToString(pe.ExeFile[:]) -} diff --git a/vendor/github.com/mmcloughlin/addchain/.gitignore b/vendor/github.com/mmcloughlin/addchain/.gitignore deleted file mode 100644 index 849ddff3b..000000000 --- a/vendor/github.com/mmcloughlin/addchain/.gitignore +++ /dev/null @@ -1 +0,0 @@ -dist/ diff --git a/vendor/github.com/mmcloughlin/addchain/.golangci.yml b/vendor/github.com/mmcloughlin/addchain/.golangci.yml deleted file mode 100644 index 1a654ae74..000000000 --- a/vendor/github.com/mmcloughlin/addchain/.golangci.yml +++ /dev/null @@ -1,39 +0,0 @@ -linters: - enable-all: true - disable: - - cyclop - - exhaustivestruct - - forbidigo - - funlen - - gochecknoglobals - - gocognit - - goerr113 - - gomnd - - ifshort - - interfacer - - lll - - maligned - - nlreturn - - paralleltest - - prealloc - - predeclared - - revive - - testpackage - - thelper - - wastedassign - - wrapcheck - - wsl - -linters-settings: - gci: - local-prefixes: github.com/mmcloughlin/addchain - -issues: - exclude-use-default: false - exclude: - # gosec: G304: Potential file inclusion via variable. - - G304 - # gosec: G306: Expect WriteFile permissions to be 0600 or less - - G306 - # gosec: G404: Use of weak random number generator - - G404 diff --git a/vendor/github.com/mmcloughlin/addchain/.goreleaser.yml b/vendor/github.com/mmcloughlin/addchain/.goreleaser.yml deleted file mode 100644 index 4c1df74be..000000000 --- a/vendor/github.com/mmcloughlin/addchain/.goreleaser.yml +++ /dev/null @@ -1,28 +0,0 @@ -before: - hooks: - - go mod tidy -builds: - - main: ./cmd/addchain - env: - - CGO_ENABLED=0 - goos: - - linux - - windows - - darwin - goarch: - - amd64 - - arm64 - ldflags: - - -s -w - - -X github.com/mmcloughlin/addchain/meta.buildversion={{ .Version }} -archives: - - format_overrides: - - goos: windows - format: zip - files: - - LICENSE* - - CITATION* - - README* -release: - draft: true - prerelease: auto diff --git a/vendor/github.com/mmcloughlin/addchain/.zenodo.json b/vendor/github.com/mmcloughlin/addchain/.zenodo.json deleted file mode 100644 index 4501f173c..000000000 --- a/vendor/github.com/mmcloughlin/addchain/.zenodo.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "title": "mmcloughlin/addchain: v0.4.0", - "description": "Cryptographic Addition Chain Generation in Go", - "version": "0.4.0", - "publication_date": "2021-10-30", - "upload_type": "software", - "access_right": "open", - "license": "BSD-3-Clause", - "creators": [ - { - "name": "McLoughlin, Michael Ben", - "orcid": "0000-0003-2347-6258" - } - ], - "related_identifiers": [ - { - "identifier": "https://github.com/mmcloughlin/addchain/tree/v0.4.0", - "relation": "isSupplementTo", - "scheme": "url" - } - ], - "references": [ - "Adamu Muhammad Noma, Abdullah Muhammed, Mohamad Afendee Mohamed and Zuriati Ahmad Zulkarnain. A Review on Heuristics for Addition Chain Problem: Towards Efficient Public Key Cryptosystems. Journal of Computer Science. 2017. https://thescipub.com/pdf/10.3844/jcssp.2017.275.289.pdf", - "Diego F. Aranha, Paulo S. L. M. Barreto, Geovandro C. C. F. Pereira and Jefferson E. Ricardini. A note on high-security general-purpose elliptic curves. Cryptology ePrint Archive, Report 2013/647. 2013. https://eprint.iacr.org/2013/647", - "Bos, Jurjen and Coster, Matthijs. Addition Chain Heuristics. In Advances in Cryptology --- CRYPTO' 89 Proceedings, pages 400--407. 1990. https://link.springer.com/content/pdf/10.1007/0-387-34805-0_37.pdf", - "Martin Otto. Brauer addition-subtraction chains. PhD thesis, Universitat Paderborn. 2001. http://www.martin-otto.de/publications/docs/2001_MartinOtto_Diplom_BrauerAddition-SubtractionChains.pdf", - "F Bergeron, J Berstel, S Brlek and C Duboc. Addition chains using continued fractions. Journal of Algorithms. 1989. http://www-igm.univ-mlv.fr/~berstel/Articles/1989AdditionChainDuboc.pdf", - "Richard E. Crandall. Method and apparatus for public key exchange in a cryptographic system. US Patent 5,159,632. 1992. https://patents.google.com/patent/US5159632A", - "Bernstein, Daniel J. Curve25519: New Diffie-Hellman Speed Records. In Public Key Cryptography - PKC 2006, pages 207--228. 2006. https://cr.yp.to/ecdh/curve25519-20060209.pdf", - "Brian Smith. The Most Efficient Known Addition Chains for Field Element and Scalar Inversion for the Most Popular and Most Unpopular Elliptic Curves. 2017. https://briansmith.org/ecc-inversion-addition-chains-01 (accessed June 30, 2019)", - "Bergeron, F., Berstel, J. and Brlek, S. Efficient computation of addition chains. Journal de theorie des nombres de Bordeaux. 1994. http://www.numdam.org/item/JTNB_1994__6_1_21_0", - "Daniel J. Bernstein, Mike Hamburg, Anna Krasnova and Tanja Lange. Elligator: Elliptic-curve points indistinguishable from uniform random strings. Cryptology ePrint Archive, Report 2013/325. 2013. https://eprint.iacr.org/2013/325", - "NIST. Digital Signature Standard (DSS). Federal Information Processing Standards Publication 186-2. 2000. https://csrc.nist.gov/csrc/media/publications/fips/186/2/archive/2000-01-27/documents/fips186-2.pdf", - "Amadou Tall and Ali Yassin Sanghare. Efficient computation of addition-subtraction chains using generalized continued Fractions. Cryptology ePrint Archive, Report 2013/466. 2013. https://eprint.iacr.org/2013/466", - "Kunihiro, Noboru and Yamamoto, Hirosuke. New Methods for Generating Short Addition Chains. IEICE Transactions on Fundamentals of Electronics Communications and Computer Sciences. 2000. https://pdfs.semanticscholar.org/b398/d10faca35af9ce5a6026458b251fd0a5640c.pdf", - "Riad S. Wahby. kwantam/addchain. Github Repository. Apache License, Version 2.0. 2018. https://github.com/kwantam/addchain", - "Mike Hamburg. Ed448-Goldilocks, a new elliptic curve. Cryptology ePrint Archive, Report 2015/625. 2015. https://eprint.iacr.org/2015/625", - "Riad S. Wahby and Dan Boneh. Fast and simple constant-time hashing to the BLS12-381 elliptic curve. Cryptology ePrint Archive, Report 2019/403. 2019. https://eprint.iacr.org/2019/403", - "Christophe Doche. Exponentiation. Handbook of Elliptic and Hyperelliptic Curve Cryptography, chapter 9. 2006. http://koclab.cs.ucsb.edu/teaching/ecc/eccPapers/Doche-ch09.pdf", - "Knuth, Donald E. Evaluation of Powers. The Art of Computer Programming, Volume 2 (Third Edition): Seminumerical Algorithms, chapter 4.6.3. 1997. https://www-cs-faculty.stanford.edu/~knuth/taocp.html", - "Ayan Nandy. Modifications of Bos and Coster’s Heuristics in search of a shorter addition chain for faster exponentiation. Masters thesis, Indian Statistical Institute Kolkata. 2011. http://library.isical.ac.in:8080/jspui/bitstream/10263/6441/1/DISS-285.pdf", - "F. L. Ţiplea, S. Iftene, C. Hriţcu, I. Goriac, R. Gordân and E. Erbiceanu. MpNT: A Multi-Precision Number Theory Package, Number Theoretical Algorithms (I). Technical Report TR03-02, Faculty of Computer Science, \"Alexandru Ioan Cuza\" University, Iasi. 2003. https://profs.info.uaic.ro/~tr/tr03-02.pdf", - "Daniel J. Bernstein and Tanja Lange. Security dangers of the NIST curves. 2013. https://cr.yp.to/talks/2013.09.16/slides-djb-20130916-a4.pdf", - "Michael Scott, Naomi Benger, Manuel Charlemagne, Luis J. Dominguez Perez and Ezekiel J. Kachisa. On the final exponentiation for calculating pairings on ordinary elliptic curves. Cryptology ePrint Archive, Report 2008/490. 2008. https://eprint.iacr.org/2008/490", - "Daniel J. Bernstein and Tanja Lange. SafeCurves: choosing safe curves for elliptic-curve cryptography. https://safecurves.cr.yp.to", - "Certicom Research. SEC 2: Recommended Elliptic Curve Domain Parameters, Version 2.0. Standards for Efficient Cryptography 2. 2010. https://safecurves.cr.yp.to/www.secg.org/sec2-v2.pdf", - "Jerome A. Solinas. Generalized Mersenne Primes. Technical Report CORR 99-39, Centre for Applied Cryptographic Research (CACR) at the University of Waterloo. 1999. http://cacr.uwaterloo.ca/techreports/1999/corr99-39.pdf", - "Stam, Martijn. Speeding up subgroup cryptosystems. PhD thesis, Technische Universiteit Eindhoven. 2003. https://cr.yp.to/bib/2003/stam-thesis.pdf" - ] -} diff --git a/vendor/github.com/mmcloughlin/addchain/CITATION.bib b/vendor/github.com/mmcloughlin/addchain/CITATION.bib deleted file mode 100644 index 4bddef61f..000000000 --- a/vendor/github.com/mmcloughlin/addchain/CITATION.bib +++ /dev/null @@ -1,11 +0,0 @@ -@misc{addchain, - title = {addchain: Cryptographic Addition Chain Generation in Go}, - author = {Michael B. McLoughlin}, - year = 2021, - month = oct, - howpublished = {Repository \url{https://github.com/mmcloughlin/addchain}}, - version = {0.4.0}, - license = {BSD 3-Clause License}, - doi = {10.5281/zenodo.5622943}, - url = {https://doi.org/10.5281/zenodo.5622943}, -} diff --git a/vendor/github.com/mmcloughlin/addchain/CITATION.cff b/vendor/github.com/mmcloughlin/addchain/CITATION.cff deleted file mode 100644 index 252327d5e..000000000 --- a/vendor/github.com/mmcloughlin/addchain/CITATION.cff +++ /dev/null @@ -1,19 +0,0 @@ -cff-version: 1.2.0 -message: "If you use addchain in your work, a citation would be appreciated using the following metadata." -title: "addchain: Cryptographic Addition Chain Generation in Go" -authors: - - family-names: "McLoughlin" - given-names: "Michael Ben" - orcid: "https://orcid.org/0000-0003-2347-6258" -version: "0.4.0" -date-released: "2021-10-30" -license: BSD-3-Clause -repository-code: https://github.com/mmcloughlin/addchain -doi: "10.5281/zenodo.5622943" -identifiers: - - type: doi - value: "10.5281/zenodo.4625263" - description: "The concept DOI of the work." - - type: doi - value: "10.5281/zenodo.5622943" - description: "The versioned DOI for version 0.4.0 of the work." diff --git a/vendor/github.com/mmcloughlin/addchain/LICENSE b/vendor/github.com/mmcloughlin/addchain/LICENSE deleted file mode 100644 index bc3d0d510..000000000 --- a/vendor/github.com/mmcloughlin/addchain/LICENSE +++ /dev/null @@ -1,29 +0,0 @@ -BSD 3-Clause License - -Copyright (c) 2019, Michael McLoughlin -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder 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. diff --git a/vendor/github.com/mmcloughlin/addchain/README.md b/vendor/github.com/mmcloughlin/addchain/README.md deleted file mode 100644 index 6a1664df0..000000000 --- a/vendor/github.com/mmcloughlin/addchain/README.md +++ /dev/null @@ -1,402 +0,0 @@ -

- addchain -
- Build Status - go.dev - Go Report Card - DOI: 10.5281/zenodo.5622943 -

- -

Cryptographic Addition Chain Generation in Go

- -`addchain` generates short addition chains for exponents of cryptographic -interest with [results](#results) rivaling the best hand-optimized chains. -Intended as a building block in elliptic curve or other cryptographic code -generators. - -* Suite of algorithms from academic research: continued fractions, - dictionary-based and Bos-Coster heuristics -* Custom run-length techniques exploit structure of cryptographic exponents - with excellent results on Solinas primes -* Generic optimization methods eliminate redundant operations -* Simple domain-specific language for addition chain computations -* Command-line interface or library -* Code generation and templated output support - -## Table of Contents - -* [Background](#background) -* [Results](#results) -* [Usage](#usage) - * [Command-line Interface](#command-line-interface) - * [Library](#library) -* [Algorithms](#algorithms) - * [Binary](#binary) - * [Continued Fractions](#continued-fractions) - * [Bos-Coster Heuristics](#bos-coster-heuristics) - * [Dictionary](#dictionary) - * [Runs](#runs) - * [Optimization](#optimization) -* [Citing](#citing) -* [Thanks](#thanks) -* [Contributing](#contributing) -* [License](#license) - - -## Background - -An [_addition chain_](https://en.wikipedia.org/wiki/Addition_chain) for a -target integer _n_ is a sequence of numbers starting at 1 and ending at _n_ -such that every term is a sum of two numbers appearing earlier in the -sequence. For example, an addition chain for 29 is - -``` -1, 2, 4, 8, 9, 17, 25, 29 -``` - -Addition chains arise in the optimization of exponentiation algorithms with -fixed exponents. For example, the addition chain above corresponds to the -following sequence of multiplications to compute x29 - -
- x2 = x1 * x1
- x4 = x2 * x2
- x8 = x4 * x4
- x9 = x1 * x8
-x17 = x8 * x9
-x25 = x8 * x17
-x29 = x4 * x25
-
- -An exponentiation algorithm for a fixed exponent _n_ reduces to finding a -_minimal length addition chain_ for _n_. This is especially relevent in -cryptography where exponentiation by huge fixed exponents forms a -performance-critical component of finite-field arithmetic. In particular, -constant-time inversion modulo a prime _p_ is performed by computing -xp-2 (mod p), thanks to [Fermat's Little -Theorem](https://en.wikipedia.org/wiki/Fermat%27_little_theorem). Square root -also reduces to exponentiation for some prime moduli. Finding short addition -chains for these exponents is one important part of high-performance finite -field implementations required for elliptic curve cryptography or RSA. - -Minimal addition chain search is famously hard. No practical optimal -algorithm is known, especially for cryptographic exponents of size 256-bits -and up. Given its importance for the performance of cryptographic -implementations, implementers devote significant effort to hand-tune addition -chains. The goal of the `addchain` project is to match or exceed the best -hand-optimized addition chains using entirely automated approaches, building -on extensive academic research and applying new tweaks that exploit the -unique nature of cryptographic exponents. - -## Results - -The following table shows the results of the `addchain` library on popular -cryptographic exponents. For each one we also show the length of the [best -known hand-optimized addition chain](https://briansmith.org/ecc-inversion-addition-chains-01), and the -delta from the library result. - -| Name | This Library | Best Known | Delta | -| ---- | -----------: | ---------: | ----: | -| [Curve25519 Field Inversion](doc/results.md#curve25519-field-inversion) | 266 | 265 | +1 | -| [NIST P-256 Field Inversion](doc/results.md#nist-p-256-field-inversion) | 266 | 266 | **+0** | -| [NIST P-384 Field Inversion](doc/results.md#nist-p-384-field-inversion) | 397 | 396 | +1 | -| [secp256k1 (Bitcoin) Field Inversion](doc/results.md#secp256k1-bitcoin-field-inversion) | 269 | 269 | **+0** | -| [Curve25519 Scalar Inversion](doc/results.md#curve25519-scalar-inversion) | 283 | 284 | **-1** | -| [NIST P-256 Scalar Inversion](doc/results.md#nist-p-256-scalar-inversion) | 294 | 292 | +2 | -| [NIST P-384 Scalar Inversion](doc/results.md#nist-p-384-scalar-inversion) | 434 | 433 | +1 | -| [secp256k1 (Bitcoin) Scalar Inversion](doc/results.md#secp256k1-bitcoin-scalar-inversion) | 293 | 290 | +3 | - - -See [full results listing](doc/results.md) for more detail and -results for less common exponents. - -These results demonstrate that `addchain` is competitive with hand-optimized -chains, often with equivalent or better performance. Even when `addchain` is -slightly sub-optimal, it can still be considered valuable since it fully -automates a laborious manual process. As such, `addchain` can be trusted to -produce high quality results in an automated code generation tool. - -## Usage - -### Command-line Interface - -Install a pre-compiled [release -binary](https://github.com/mmcloughlin/addchain/releases): - -``` -curl -sSfL https://git.io/addchain | sh -s -- -b /usr/local/bin -``` - -Alternatively build from source: - -``` -go install github.com/mmcloughlin/addchain/cmd/addchain@latest -``` - -Search for a curve25519 field inversion addition chain with: - -```sh -addchain search '2^255 - 19 - 2' -``` - -Output: - -``` -addchain: expr: "2^255 - 19 - 2" -addchain: hex: 7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeb -addchain: dec: 57896044618658097711785492504343953926634992332820282019728792003956564819947 -addchain: best: opt(runs(continued_fractions(dichotomic))) -addchain: cost: 266 -_10 = 2*1 -_11 = 1 + _10 -_1100 = _11 << 2 -_1111 = _11 + _1100 -_11110000 = _1111 << 4 -_11111111 = _1111 + _11110000 -x10 = _11111111 << 2 + _11 -x20 = x10 << 10 + x10 -x30 = x20 << 10 + x10 -x60 = x30 << 30 + x30 -x120 = x60 << 60 + x60 -x240 = x120 << 120 + x120 -x250 = x240 << 10 + x10 -return (x250 << 2 + 1) << 3 + _11 -``` - -Next, you can [generate code from this addition chain](doc/gen.md). - -### Library - -Install: - -``` -go get -u github.com/mmcloughlin/addchain -``` - -Algorithms all conform to the [`alg.ChainAlgorithm`](https://pkg.go.dev/github.com/mmcloughlin/addchain/alg#ChainAlgorithm) or -[`alg.SequenceAlgorithm`](https://pkg.go.dev/github.com/mmcloughlin/addchain/alg#SequenceAlgorithm) interfaces and can be used directly. However the -most user-friendly method uses the [`alg/ensemble`](https://pkg.go.dev/github.com/mmcloughlin/addchain/alg/ensemble) package to -instantiate a sensible default set of algorithms and the [`alg/exec`](https://pkg.go.dev/github.com/mmcloughlin/addchain/alg/exec) -helper to execute them in parallel. The following code uses this method to -find an addition chain for curve25519 field inversion: - -```go -func Example() { - // Target number: 2²⁵⁵ - 21. - n := new(big.Int) - n.SetString("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeb", 16) - - // Default ensemble of algorithms. - algorithms := ensemble.Ensemble() - - // Use parallel executor. - ex := exec.NewParallel() - results := ex.Execute(n, algorithms) - - // Output best result. - best := 0 - for i, r := range results { - if r.Err != nil { - log.Fatal(r.Err) - } - if len(results[i].Program) < len(results[best].Program) { - best = i - } - } - r := results[best] - fmt.Printf("best: %d\n", len(r.Program)) - fmt.Printf("algorithm: %s\n", r.Algorithm) - - // Output: - // best: 266 - // algorithm: opt(runs(continued_fractions(dichotomic))) -} -``` - -## Algorithms - -This section summarizes the algorithms implemented by `addchain` along with -references to primary literature. See the [bibliography](doc/bibliography.md) -for the complete references list. - -### Binary - -The [`alg/binary`](https://pkg.go.dev/github.com/mmcloughlin/addchain/alg/binary) package implements the addition chain equivalent -of the basic [square-and-multiply exponentiation -method](https://en.wikipedia.org/wiki/Exponentiation_by_squaring). It is -included for completeness, but is almost always outperformed by more advanced -algorithms below. - -### Continued Fractions - -The [`alg/contfrac`](https://pkg.go.dev/github.com/mmcloughlin/addchain/alg/contfrac) package implements the continued fractions -methods for addition sequence search introduced by -Bergeron-Berstel-Brlek-Duboc in 1989 and later extended. This approach -utilizes a decomposition of an addition chain akin to continued fractions, -namely - -``` -(1,..., k,..., n) = (1,...,n mod k,..., k) ⊗ (1,..., n/k) ⊕ (n mod k). -``` - -for certain special operators ⊗ and ⊕. This -decomposition lends itself to a recursive algorithm for efficient addition -sequence search, with results dependent on the _strategy_ for choosing the -auxillary integer _k_. The [`alg/contfrac`](https://pkg.go.dev/github.com/mmcloughlin/addchain/alg/contfrac) package provides a -laundry list of strategies from the literature: binary, co-binary, -dichotomic, dyadic, fermat, square-root and total. - -#### References - -* F Bergeron, J Berstel, S Brlek and C Duboc. Addition chains using continued fractions. Journal of Algorithms. 1989. http://www-igm.univ-mlv.fr/~berstel/Articles/1989AdditionChainDuboc.pdf -* Bergeron, F., Berstel, J. and Brlek, S. Efficient computation of addition chains. Journal de theorie des nombres de Bordeaux. 1994. http://www.numdam.org/item/JTNB_1994__6_1_21_0 -* Amadou Tall and Ali Yassin Sanghare. Efficient computation of addition-subtraction chains using generalized continued Fractions. Cryptology ePrint Archive, Report 2013/466. 2013. https://eprint.iacr.org/2013/466 -* Christophe Doche. Exponentiation. Handbook of Elliptic and Hyperelliptic Curve Cryptography, chapter 9. 2006. http://koclab.cs.ucsb.edu/teaching/ecc/eccPapers/Doche-ch09.pdf - -### Bos-Coster Heuristics - -Bos and Coster described an iterative algorithm for efficient addition -sequence generation in which at each step a heuristic proposes new numbers -for the sequence in such a way that the _maximum_ number always decreases. -The [original Bos-Coster paper](https://link.springer.com/content/pdf/10.1007/0-387-34805-0_37.pdf) defined four -heuristics: Approximation, Divison, Halving and Lucas. Package -[`alg/heuristic`](https://pkg.go.dev/github.com/mmcloughlin/addchain/alg/heuristic) implements a variation on these heuristics: - -* **Approximation:** looks for two elements a, b in the current sequence with sum close to the largest element. -* **Halving:** applies when the target is at least twice as big as the next largest, and if so it will propose adding a sequence of doublings. -* **Delta Largest:** proposes adding the delta between the largest two entries in the current sequence. - -Divison and Lucas are not implemented due to disparities in the literature -about their precise definition and poor results from early experiments. -Furthermore, this library does not apply weights to the heuristics as -suggested in the paper, rather it simply uses the first that applies. However -both of these remain [possible avenues for -improvement](https://github.com/mmcloughlin/addchain/issues/26). - -#### References - -* Bos, Jurjen and Coster, Matthijs. Addition Chain Heuristics. In Advances in Cryptology --- CRYPTO' 89 Proceedings, pages 400--407. 1990. https://link.springer.com/content/pdf/10.1007/0-387-34805-0_37.pdf -* Riad S. Wahby. kwantam/addchain. Github Repository. Apache License, Version 2.0. 2018. https://github.com/kwantam/addchain -* Christophe Doche. Exponentiation. Handbook of Elliptic and Hyperelliptic Curve Cryptography, chapter 9. 2006. http://koclab.cs.ucsb.edu/teaching/ecc/eccPapers/Doche-ch09.pdf -* Ayan Nandy. Modifications of Bos and Coster’s Heuristics in search of a shorter addition chain for faster exponentiation. Masters thesis, Indian Statistical Institute Kolkata. 2011. http://library.isical.ac.in:8080/jspui/bitstream/10263/6441/1/DISS-285.pdf -* F. L. Ţiplea, S. Iftene, C. Hriţcu, I. Goriac, R. Gordân and E. Erbiceanu. MpNT: A Multi-Precision Number Theory Package, Number Theoretical Algorithms (I). Technical Report TR03-02, Faculty of Computer Science, "Alexandru Ioan Cuza" University, Iasi. 2003. https://profs.info.uaic.ro/~tr/tr03-02.pdf -* Stam, Martijn. Speeding up subgroup cryptosystems. PhD thesis, Technische Universiteit Eindhoven. 2003. https://cr.yp.to/bib/2003/stam-thesis.pdf - -### Dictionary - -Dictionary methods decompose the binary representation of a target integer _n_ into a set of dictionary _terms_, such that _n_ -may be written as a sum - -
-n = ∑ 2ei di
-
- -for exponents _e_ and elements _d_ from a dictionary _D_. Given such a decomposition we can construct an addition chain for _n_ by - -1. Find a short addition _sequence_ containing every element of the dictionary _D_. Continued fractions and Bos-Coster heuristics can be used here. -2. Build _n_ from the dictionary terms according to the sum decomposition. - -The efficiency of this approach boils down to the decomposition method. The [`alg/dict`](https://pkg.go.dev/github.com/mmcloughlin/addchain/alg/dict) package provides: - -* **Fixed Window:** binary representation of _n_ is broken into fixed _k_-bit windows -* **Sliding Window**: break _n_ into _k_-bit windows, skipping zeros where possible -* **Run Length**: decompose _n_ into runs of 1s up to a maximal length -* **Hybrid**: mix of sliding window and run length methods - -#### References - -* Martin Otto. Brauer addition-subtraction chains. PhD thesis, Universitat Paderborn. 2001. http://www.martin-otto.de/publications/docs/2001_MartinOtto_Diplom_BrauerAddition-SubtractionChains.pdf -* Kunihiro, Noboru and Yamamoto, Hirosuke. New Methods for Generating Short Addition Chains. IEICE Transactions on Fundamentals of Electronics Communications and Computer Sciences. 2000. https://pdfs.semanticscholar.org/b398/d10faca35af9ce5a6026458b251fd0a5640c.pdf -* Christophe Doche. Exponentiation. Handbook of Elliptic and Hyperelliptic Curve Cryptography, chapter 9. 2006. http://koclab.cs.ucsb.edu/teaching/ecc/eccPapers/Doche-ch09.pdf - -### Runs - -The runs algorithm is a custom variant of the dictionary approach that -decomposes a target into runs of ones. It leverages the observation that -building a dictionary consisting of runs of 1s of lengths -l1, l2, ..., lk can itself be -reduced to: - -1. Find an addition sequence containing the run lengths - li. As with dictionary approaches we can use - Bos-Coster heuristics and continued fractions here. However here we have the - advantage that the li are typically very _small_, - meaning that a wider range of algorithms can be brought to bear. -2. Use the addition sequence for the run lengths li - to build an addition sequence for the runs themselves - r(li) where r(e) = 2e-1. See - [`dict.RunsChain`](https://pkg.go.dev/github.com/mmcloughlin/addchain/alg/dict#RunsChain). - -This approach has proved highly effective against cryptographic exponents -which frequently exhibit binary structure, such as those derived from -[Solinas primes](https://en.wikipedia.org/wiki/Solinas_prime). - -> I have not seen this method discussed in the literature. Please help me find references to prior art if you know any. - -### Optimization - -Close inspection of addition chains produced by other algorithms revealed -cases of redundant computation. This motivated a final optimization pass over -addition chains to remove unecessary steps. The [`alg/opt`](https://pkg.go.dev/github.com/mmcloughlin/addchain/alg/opt) package -implements the following optimization: - -1. Determine _all possible_ ways each element can be computed from those prior. -2. Count how many times each element is used where it is the _only possible_ way of computing that entry. -3. Prune elements that are always used in computations that have an alternative. - -These micro-optimizations were vital in closing the gap between `addchain`'s -automated approaches and hand-optimized chains. This technique is reminiscent -of basic passes in optimizing compilers, raising the question of whether -other [compiler optimizations could apply to addition -chains](https://github.com/mmcloughlin/addchain/issues/24)? - -> I have not seen this method discussed in the literature. Please help me find references to prior art if you know any. - -## Citing - -If you use `addchain` in your research a citation would be appreciated. -Citing a specific release is preferred, since they are [archived on -Zenodo](https://doi.org/10.5281/zenodo.4625263) and assigned a DOI. Please use the -following BibTeX to cite the most recent [0.4.0 -release](https://github.com/mmcloughlin/addchain/releases/tag/v0.4.0). - -```bib -@misc{addchain, - title = {addchain: Cryptographic Addition Chain Generation in Go}, - author = {Michael B. McLoughlin}, - year = 2021, - month = oct, - howpublished = {Repository \url{https://github.com/mmcloughlin/addchain}}, - version = {0.4.0}, - license = {BSD 3-Clause License}, - doi = {10.5281/zenodo.5622943}, - url = {https://doi.org/10.5281/zenodo.5622943}, -} -``` - -If you need to cite a currently unreleased version please consider [filing an -issue](https://github.com/mmcloughlin/addchain/issues/new) to request a new -release, or to discuss an appropriate format for the citation. - -## Thanks - -Thank you to [Tom Dean](https://web.stanford.edu/~trdean/), [Riad -Wahby](https://wahby.org/), [Brian Smith](https://briansmith.org/) and -[str4d](https://github.com/str4d) for advice and encouragement. Thanks also to -[Damian Gryski](https://github.com/dgryski) and [Martin -Glancy](https://twitter.com/mglancy) for review. - -## Contributing - -Contributions to `addchain` are welcome: - -* [Submit bug reports](https://github.com/mmcloughlin/addchain/issues/new) to - the issues page. -* Suggest [test cases](https://github.com/mmcloughlin/addchain/blob/e6c070065205efcaa02627ab1b23e8ce6aeea1db/internal/results/results.go#L62) - or update best-known hand-optimized results. -* Pull requests accepted. Please discuss in the [issues section](https://github.com/mmcloughlin/addchain/issues) - before starting significant work. - -## License - -`addchain` is available under the [BSD 3-Clause License](LICENSE). diff --git a/vendor/github.com/mmcloughlin/addchain/acc/acc.go b/vendor/github.com/mmcloughlin/addchain/acc/acc.go deleted file mode 100644 index 6963ff443..000000000 --- a/vendor/github.com/mmcloughlin/addchain/acc/acc.go +++ /dev/null @@ -1,91 +0,0 @@ -// Package acc implements the "addition chain calculator" language: a -// domain-specific language (DSL) for addition chain computation. -package acc - -import ( - "bytes" - "io" - "os" - "strings" - - "github.com/mmcloughlin/addchain/acc/ir" - "github.com/mmcloughlin/addchain/acc/parse" - "github.com/mmcloughlin/addchain/acc/pass" - "github.com/mmcloughlin/addchain/acc/printer" - "github.com/mmcloughlin/addchain/internal/errutil" -) - -// LoadFile is a convenience for loading an addition chain script from a file. -func LoadFile(filename string) (p *ir.Program, err error) { - f, err := os.Open(filename) - if err != nil { - return nil, err - } - defer errutil.CheckClose(&err, f) - return LoadReader(filename, f) -} - -// LoadString is a convenience for loading and evaluating an addition chain -// script from a string. -func LoadString(src string) (*ir.Program, error) { - return LoadReader("string", strings.NewReader(src)) -} - -// LoadReader is a convenience for loading and evaluating an addition chain -// script. -func LoadReader(filename string, r io.Reader) (*ir.Program, error) { - // Parse to AST. - s, err := parse.Reader(filename, r) - if err != nil { - return nil, err - } - - // Translate to IR. - p, err := Translate(s) - if err != nil { - return nil, err - } - - // Evaluate the program. - if err := pass.Eval(p); err != nil { - return nil, err - } - - return p, nil -} - -// Write is a convenience for writing a program as an addition chain script. -func Write(w io.Writer, p *ir.Program) error { - // Build AST. - s, err := Build(p) - if err != nil { - return err - } - - // Print. - if err := printer.Fprint(w, s); err != nil { - return err - } - - return nil -} - -// Save is a convenience for writing a program to a file. -func Save(filename string, p *ir.Program) (err error) { - f, err := os.Create(filename) - if err != nil { - return err - } - defer errutil.CheckClose(&err, f) - return Write(f, p) -} - -// String is a convenience for obtaining a program as an addition chain script -// in string form. -func String(p *ir.Program) (string, error) { - var buf bytes.Buffer - if err := Write(&buf, p); err != nil { - return "", err - } - return buf.String(), nil -} diff --git a/vendor/github.com/mmcloughlin/addchain/acc/ast/ast.go b/vendor/github.com/mmcloughlin/addchain/acc/ast/ast.go deleted file mode 100644 index 28948f558..000000000 --- a/vendor/github.com/mmcloughlin/addchain/acc/ast/ast.go +++ /dev/null @@ -1,71 +0,0 @@ -// Package ast declares abstract syntax tree types for acc programs. -package ast - -// Chain represents a sequence of acc statements for an addition chain -// computation. -type Chain struct { - Statements []Statement -} - -// Statement assigns the result of an expression to a variable. -type Statement struct { - Name Identifier - Expr Expr -} - -// Operator precedence range. -const ( - LowestPrec = 0 - HighestPrec = 4 -) - -// Expr is an expression. -type Expr interface { - Precedence() int -} - -// Operand is an index into an addition chain. -type Operand int - -// Precedence of this expression type. -func (Operand) Precedence() int { return HighestPrec } - -// Identifier is a variable reference. -type Identifier string - -// Precedence of this expression type. -func (Identifier) Precedence() int { return HighestPrec } - -// Add expression. -type Add struct { - X, Y Expr -} - -// Precedence of this expression type. -func (Add) Precedence() int { return 1 } - -// Shift (repeated doubling) expression. -type Shift struct { - X Expr - S uint -} - -// Precedence of this expression type. -func (Shift) Precedence() int { return 2 } - -// Double expression. -type Double struct { - X Expr -} - -// Precedence of this expression type. -func (Double) Precedence() int { return 3 } - -// IsOp reports whether the expression is the result of an operator. -func IsOp(e Expr) bool { - switch e.(type) { - case Add, Shift, Double: - return true - } - return false -} diff --git a/vendor/github.com/mmcloughlin/addchain/acc/ast/print.go b/vendor/github.com/mmcloughlin/addchain/acc/ast/print.go deleted file mode 100644 index 4c4fcfea3..000000000 --- a/vendor/github.com/mmcloughlin/addchain/acc/ast/print.go +++ /dev/null @@ -1,101 +0,0 @@ -package ast - -import ( - "io" - "os" - - "github.com/mmcloughlin/addchain/internal/errutil" - "github.com/mmcloughlin/addchain/internal/print" -) - -// Print an AST node to standard out. -func Print(n interface{}) error { - return Fprint(os.Stdout, n) -} - -// Fprint writes the AST node n to w. -func Fprint(w io.Writer, n interface{}) error { - p := newprinter(w) - p.node(n) - return p.Error() -} - -type printer struct { - print.Printer -} - -func newprinter(w io.Writer) *printer { - p := &printer{ - Printer: print.New(w), - } - p.SetIndentString(". ") - return p -} - -func (p *printer) node(n interface{}) { - switch n := n.(type) { - case *Chain: - p.enter("chain") - for _, stmt := range n.Statements { - p.statement(stmt) - } - p.leave() - case Statement: - p.statement(n) - case Operand: - p.Linef("operand(%d)", n) - case Identifier: - p.Linef("identifier(%q)", n) - case Add: - p.add(n) - case Double: - p.double(n) - case Shift: - p.shift(n) - default: - p.SetError(errutil.UnexpectedType(n)) - } -} - -func (p *printer) statement(stmt Statement) { - p.enter("statement") - p.Printf("name = ") - p.node(stmt.Name) - p.Printf("expr = ") - p.node(stmt.Expr) - p.leave() -} - -func (p *printer) add(a Add) { - p.enter("add") - p.Printf("x = ") - p.node(a.X) - p.Printf("y = ") - p.node(a.Y) - p.leave() -} - -func (p *printer) double(d Double) { - p.enter("double") - p.Printf("x = ") - p.node(d.X) - p.leave() -} - -func (p *printer) shift(s Shift) { - p.enter("shift") - p.Linef("s = %d", s.S) - p.Printf("x = ") - p.node(s.X) - p.leave() -} - -func (p *printer) enter(name string) { - p.Linef("%s {", name) - p.Indent() -} - -func (p *printer) leave() { - p.Dedent() - p.Linef("}") -} diff --git a/vendor/github.com/mmcloughlin/addchain/acc/build.go b/vendor/github.com/mmcloughlin/addchain/acc/build.go deleted file mode 100644 index 38adda349..000000000 --- a/vendor/github.com/mmcloughlin/addchain/acc/build.go +++ /dev/null @@ -1,158 +0,0 @@ -package acc - -import ( - "fmt" - - "github.com/mmcloughlin/addchain/acc/ast" - "github.com/mmcloughlin/addchain/acc/ir" - "github.com/mmcloughlin/addchain/acc/pass" - "github.com/mmcloughlin/addchain/internal/errutil" -) - -// complexitylimit is the maximum number of operators the builder will allow an -// expression to have. -const complexitylimit = 5 - -// Build AST from a program in intermediate representation. -func Build(p *ir.Program) (*ast.Chain, error) { - // Run some analysis passes first. - err := pass.Exec(p, - pass.Func(pass.ReadCounts), - pass.NameByteValues, - pass.NameXRuns, - ) - if err != nil { - return nil, err - } - - // Delegate to builder. - b := newbuilder(p) - if err := b.process(); err != nil { - return nil, err - } - - return b.chain, nil -} - -type builder struct { - chain *ast.Chain - prog *ir.Program - expr map[int]ast.Expr -} - -func newbuilder(p *ir.Program) *builder { - return &builder{ - chain: &ast.Chain{}, - prog: p, - expr: map[int]ast.Expr{}, - } -} - -func (b *builder) process() error { - insts := b.prog.Instructions - n := len(insts) - complexity := 0 - for i := 0; i < n; i++ { - complexity++ - inst := insts[i] - out := inst.Output - - // Build expression for the result of this instruction. - e, err := b.operator(inst.Op) - if err != nil { - return err - } - - b.expr[out.Index] = e - - // If this output is read only by the following instruction, we don't need to - // commit it to a variable. - anon := out.Identifier == "" - usedonce := b.prog.ReadCount[out.Index] == 1 - usednext := i+1 < n && ir.HasInput(insts[i+1].Op, out.Index) - if anon && usedonce && usednext && complexity < complexitylimit { - continue - } - - // Otherwise write a statement for it. - b.commit(inst.Output) - complexity = 0 - } - - // Clear the name of the final statement. - b.chain.Statements[len(b.chain.Statements)-1].Name = "" - - return nil -} - -func (b *builder) operator(op ir.Op) (ast.Expr, error) { - switch o := op.(type) { - case ir.Add: - return b.add(o) - case ir.Double: - return ast.Double{ - X: b.operand(o.X), - }, nil - case ir.Shift: - return ast.Shift{ - X: b.operand(o.X), - S: o.S, - }, nil - default: - return nil, errutil.UnexpectedType(op) - } -} - -func (b *builder) add(a ir.Add) (ast.Expr, error) { - // Addition operator construction is slightly delcate, since operand order - // determines ordering of execution. By the design of instruction processing - // above, the only way we can have multi-operator expressions is with a - // sequence of operands that are used only once and in the following - // instruction. This implies that only one of x and y can be an operator - // expression. In order to preserve execution order, whichever one that is - // needs to be the first operand. - - x := b.operand(a.X) - y := b.operand(a.Y) - - switch { - case ast.IsOp(x) && ast.IsOp(y): - return nil, errutil.AssertionFailure("only one of x and y should be an operator expression") - case ast.IsOp(y): - x, y = y, x - case ast.IsOp(x): - // Nothing, it's already the first operand. - } - - return ast.Add{ - X: x, - Y: y, - }, nil -} - -func (b *builder) commit(op *ir.Operand) { - name := ast.Identifier(b.name(op)) - stmt := ast.Statement{ - Name: name, - Expr: b.operand(op), - } - b.chain.Statements = append(b.chain.Statements, stmt) - b.expr[op.Index] = name -} - -// name returns the name for this operand. This is the identifier if available, -// otherwise a sensible default based on the index. -func (b *builder) name(op *ir.Operand) string { - if op.Identifier != "" { - return op.Identifier - } - return fmt.Sprintf("i%d", op.Index) -} - -func (b *builder) operand(op *ir.Operand) ast.Expr { - e, ok := b.expr[op.Index] - if !ok { - return ast.Operand(op.Index) - } - return e -} diff --git a/vendor/github.com/mmcloughlin/addchain/acc/decompile.go b/vendor/github.com/mmcloughlin/addchain/acc/decompile.go deleted file mode 100644 index da05ed932..000000000 --- a/vendor/github.com/mmcloughlin/addchain/acc/decompile.go +++ /dev/null @@ -1,58 +0,0 @@ -package acc - -import ( - "github.com/mmcloughlin/addchain" - "github.com/mmcloughlin/addchain/acc/ir" -) - -// Decompile an unrolled program into concise intermediate representation. -func Decompile(p addchain.Program) (*ir.Program, error) { - numreads := p.ReadCounts() - r := &ir.Program{} - for i := 0; i < len(p); i++ { - op := p[i] - - // Regular addition. - if !op.IsDouble() { - r.AddInstruction(&ir.Instruction{ - Output: ir.Index(i + 1), - Op: ir.Add{ - X: ir.Index(op.I), - Y: ir.Index(op.J), - }, - }) - continue - } - - // We have a double. Look ahead to see if this is a chain of doublings, which - // can be encoded as a shift. Note we can only follow the the doublings as - // long as the intermediate values are not required anywhere else later in the - // program. - j := i + 1 - for ; j < len(p) && numreads[j] == 1 && p[j].I == j && p[j].J == j; j++ { - } - - s := j - i - - // Shift size 1 encoded as a double. - if s == 1 { - r.AddInstruction(&ir.Instruction{ - Output: ir.Index(i + 1), - Op: ir.Double{ - X: ir.Index(op.I), - }, - }) - continue - } - - i = j - 1 - r.AddInstruction(&ir.Instruction{ - Output: ir.Index(i + 1), - Op: ir.Shift{ - X: ir.Index(op.I), - S: uint(s), - }, - }) - } - return r, nil -} diff --git a/vendor/github.com/mmcloughlin/addchain/acc/ir/ir.go b/vendor/github.com/mmcloughlin/addchain/acc/ir/ir.go deleted file mode 100644 index 5f54fec82..000000000 --- a/vendor/github.com/mmcloughlin/addchain/acc/ir/ir.go +++ /dev/null @@ -1,193 +0,0 @@ -// Package ir declares an intermediate representation for acc programs. -package ir - -import ( - "fmt" - "strings" - - "github.com/mmcloughlin/addchain" -) - -// Program is a sequence of acc instructions. -type Program struct { - Instructions []*Instruction - - // Pass/analysis results. - Operands map[int]*Operand - ReadCount map[int]int - Program addchain.Program - Chain addchain.Chain - Temporaries []string -} - -// AddInstruction appends an instruction to the program. -func (p *Program) AddInstruction(i *Instruction) { - p.Instructions = append(p.Instructions, i) -} - -// Output returns the output of the last instruction. -func (p Program) Output() *Operand { - last := len(p.Instructions) - 1 - return p.Instructions[last].Output -} - -// Clone returns a copy of p. Pass results are not copied and would need to be -// rerun on the clone. -func (p Program) Clone() *Program { - c := &Program{} - for _, inst := range p.Instructions { - c.Instructions = append(c.Instructions, inst.Clone()) - } - return c -} - -func (p Program) String() string { - var b strings.Builder - for _, i := range p.Instructions { - fmt.Fprintln(&b, i) - } - return b.String() -} - -// Operand represents an element of an addition chain, with an optional -// identifier. -type Operand struct { - Identifier string - Index int -} - -// NewOperand builds a named operand for index i. -func NewOperand(name string, i int) *Operand { - return &Operand{ - Identifier: name, - Index: i, - } -} - -// Index builds an unnamed operand for index i. -func Index(i int) *Operand { - return NewOperand("", i) -} - -// One is the first element in the addition chain, which by definition always -// has the value 1. -var One = Index(0) - -// Clone returns a copy of the operand. -func (o Operand) Clone() *Operand { - clone := o - return &clone -} - -func (o Operand) String() string { - if len(o.Identifier) > 0 { - return o.Identifier - } - return fmt.Sprintf("[%d]", o.Index) -} - -// Instruction assigns the result of an operation to an operand. -type Instruction struct { - Output *Operand - Op Op -} - -// Operands returns the input and output operands. -func (i Instruction) Operands() []*Operand { - return append(i.Op.Inputs(), i.Output) -} - -// Clone returns a copy of the instruction. -func (i Instruction) Clone() *Instruction { - return &Instruction{ - Output: i.Output.Clone(), - Op: i.Op.Clone(), - } -} - -func (i Instruction) String() string { - return fmt.Sprintf("%s \u2190 %s", i.Output, i.Op) -} - -// Op is an operation. -type Op interface { - Inputs() []*Operand - Clone() Op - String() string -} - -// Add is an addition operation. -type Add struct { - X, Y *Operand -} - -// Inputs returns the addends. -func (a Add) Inputs() []*Operand { - return []*Operand{a.X, a.Y} -} - -// Clone returns a copy of the operation. -func (a Add) Clone() Op { - return Add{ - X: a.X.Clone(), - Y: a.Y.Clone(), - } -} - -func (a Add) String() string { - return fmt.Sprintf("%s + %s", a.X, a.Y) -} - -// Double is a double operation. -type Double struct { - X *Operand -} - -// Inputs returns the operand. -func (d Double) Inputs() []*Operand { - return []*Operand{d.X} -} - -// Clone returns a copy of the operation. -func (d Double) Clone() Op { - return Double{ - X: d.X.Clone(), - } -} - -func (d Double) String() string { - return fmt.Sprintf("2 * %s", d.X) -} - -// Shift represents a shift-left operation, equivalent to repeat doubling. -type Shift struct { - X *Operand - S uint -} - -// Inputs returns the operand to be shifted. -func (s Shift) Inputs() []*Operand { - return []*Operand{s.X} -} - -// Clone returns a copy of the operation. -func (s Shift) Clone() Op { - return Shift{ - X: s.X.Clone(), - S: s.S, - } -} - -func (s Shift) String() string { - return fmt.Sprintf("%s \u226a %d", s.X, s.S) -} - -// HasInput reports whether the given operation takes idx as an input. -func HasInput(op Op, idx int) bool { - for _, input := range op.Inputs() { - if input.Index == idx { - return true - } - } - return false -} diff --git a/vendor/github.com/mmcloughlin/addchain/acc/parse/acc.peg b/vendor/github.com/mmcloughlin/addchain/acc/parse/acc.peg deleted file mode 100644 index bd80d7e57..000000000 --- a/vendor/github.com/mmcloughlin/addchain/acc/parse/acc.peg +++ /dev/null @@ -1,131 +0,0 @@ -{ - -package parser - -func exprs(first, rest interface{}) []ast.Expr { - es := []ast.Expr{first.(ast.Expr)} - if rest == nil { - return es - } - for _, i := range rest.([]interface{}) { - es = append(es, i.([]interface{})[3].(ast.Expr)) - } - return es -} - -} - -// Chain - -Chain <- as:Assignment* r:Return _ EOF { - ch := &ast.Chain{} - for _, a := range as.([]interface{}) { - ch.Statements = append(ch.Statements, a.(ast.Statement)) - } - ch.Statements = append(ch.Statements, r.(ast.Statement)) - return ch, nil -} - -// Statements - -Assignment <- _ n:Identifier _ '=' _ e:Expr _ EOL { - return ast.Statement{ - Name: n.(ast.Identifier), - Expr: e.(ast.Expr), - }, nil -} - -Return <- _ ("return" __)? e:Expr _ EOL? { - return ast.Statement{ - Name: "", - Expr: e.(ast.Expr), - }, nil -} - -// Expressions - -Expr <- e:AddExpr { - return e, nil -} - -AddExpr <- _ x:ShiftExpr rest:(_ AddOperator _ ShiftExpr)* _ { - es := exprs(x, rest) - r := es[0] - for _, e := range es[1:] { - r = ast.Add{ - X: r, - Y: e, - } - } - return r, nil -} - -ShiftExpr <- _ x:BaseExpr _ ShiftOperator _ s:UintLiteral _ { - return ast.Shift{ - X: x.(ast.Expr), - S: s.(uint), - }, nil -} / _ DoubleOperator _ x:BaseExpr { - return ast.Double{ - X: x.(ast.Expr), - }, nil -} / BaseExpr - -BaseExpr <- ParenExpr / Operand - -ParenExpr <- '(' _ e:Expr _ ')' { - return e, nil -} - -// Operators - -AddOperator <- '+' / "add" - -ShiftOperator <- "<<" / "shl" - -DoubleOperator <- '2' _ '*' / "dbl" - -// Operands - -Operand <- op:( One / Index / Identifier ) { - return op, nil -} - -One <- '1' { - return ast.Operand(0), nil -} - -Index <- '[' _ idx:UintLiteral _ ']' { - return ast.Operand(idx.(uint)), nil -} - -// Identifiers - -Identifier <- [a-zA-Z_] [a-zA-Z0-9_]* { - return ast.Identifier(c.text), nil -} - -// Primitives - -UintLiteral <- u64:Uint64Literal { - return uint(u64.(uint64)), nil -} - -Uint64Literal <- (HexUintLiteral / OctalUintLiteral / DecimalUintLiteral) { - return strconv.ParseUint(string(c.text), 0, 64) -} - -DecimalUintLiteral <- [0-9]+ - -HexUintLiteral <- "0x" [0-9a-fA-F]+ - -OctalUintLiteral <- '0' [0-7]+ - -// Character classes - -__ <- Whitespace+ -_ <- Whitespace* - -Whitespace <- [ \t\r] -EOL <- '\n' -EOF <- !. diff --git a/vendor/github.com/mmcloughlin/addchain/acc/parse/internal/parser/zparser.go b/vendor/github.com/mmcloughlin/addchain/acc/parse/internal/parser/zparser.go deleted file mode 100644 index 88ce3a8f6..000000000 --- a/vendor/github.com/mmcloughlin/addchain/acc/parse/internal/parser/zparser.go +++ /dev/null @@ -1,2203 +0,0 @@ -// Code generated by pigeon; DO NOT EDIT. - -package parser - -import ( - "bytes" - "errors" - "fmt" - "io" - "io/ioutil" - "math" - "os" - "sort" - "strconv" - "strings" - "sync" - "unicode" - "unicode/utf8" - - "github.com/mmcloughlin/addchain/acc/ast" -) - -func exprs(first, rest interface{}) []ast.Expr { - es := []ast.Expr{first.(ast.Expr)} - if rest == nil { - return es - } - for _, i := range rest.([]interface{}) { - es = append(es, i.([]interface{})[3].(ast.Expr)) - } - return es -} - -var g = &grammar{ - rules: []*rule{ - { - name: "Chain", - pos: position{line: 20, col: 1, offset: 290}, - expr: &actionExpr{ - pos: position{line: 20, col: 10, offset: 299}, - run: (*parser).callonChain1, - expr: &seqExpr{ - pos: position{line: 20, col: 10, offset: 299}, - exprs: []interface{}{ - &labeledExpr{ - pos: position{line: 20, col: 10, offset: 299}, - label: "as", - expr: &zeroOrMoreExpr{ - pos: position{line: 20, col: 13, offset: 302}, - expr: &ruleRefExpr{ - pos: position{line: 20, col: 13, offset: 302}, - name: "Assignment", - }, - }, - }, - &labeledExpr{ - pos: position{line: 20, col: 25, offset: 314}, - label: "r", - expr: &ruleRefExpr{ - pos: position{line: 20, col: 27, offset: 316}, - name: "Return", - }, - }, - &ruleRefExpr{ - pos: position{line: 20, col: 34, offset: 323}, - name: "_", - }, - &ruleRefExpr{ - pos: position{line: 20, col: 36, offset: 325}, - name: "EOF", - }, - }, - }, - }, - }, - { - name: "Assignment", - pos: position{line: 31, col: 1, offset: 566}, - expr: &actionExpr{ - pos: position{line: 31, col: 15, offset: 580}, - run: (*parser).callonAssignment1, - expr: &seqExpr{ - pos: position{line: 31, col: 15, offset: 580}, - exprs: []interface{}{ - &ruleRefExpr{ - pos: position{line: 31, col: 15, offset: 580}, - name: "_", - }, - &labeledExpr{ - pos: position{line: 31, col: 17, offset: 582}, - label: "n", - expr: &ruleRefExpr{ - pos: position{line: 31, col: 19, offset: 584}, - name: "Identifier", - }, - }, - &ruleRefExpr{ - pos: position{line: 31, col: 30, offset: 595}, - name: "_", - }, - &litMatcher{ - pos: position{line: 31, col: 32, offset: 597}, - val: "=", - ignoreCase: false, - want: "\"=\"", - }, - &ruleRefExpr{ - pos: position{line: 31, col: 36, offset: 601}, - name: "_", - }, - &labeledExpr{ - pos: position{line: 31, col: 38, offset: 603}, - label: "e", - expr: &ruleRefExpr{ - pos: position{line: 31, col: 40, offset: 605}, - name: "Expr", - }, - }, - &ruleRefExpr{ - pos: position{line: 31, col: 45, offset: 610}, - name: "_", - }, - &ruleRefExpr{ - pos: position{line: 31, col: 47, offset: 612}, - name: "EOL", - }, - }, - }, - }, - }, - { - name: "Return", - pos: position{line: 38, col: 1, offset: 720}, - expr: &actionExpr{ - pos: position{line: 38, col: 11, offset: 730}, - run: (*parser).callonReturn1, - expr: &seqExpr{ - pos: position{line: 38, col: 11, offset: 730}, - exprs: []interface{}{ - &ruleRefExpr{ - pos: position{line: 38, col: 11, offset: 730}, - name: "_", - }, - &zeroOrOneExpr{ - pos: position{line: 38, col: 13, offset: 732}, - expr: &seqExpr{ - pos: position{line: 38, col: 14, offset: 733}, - exprs: []interface{}{ - &litMatcher{ - pos: position{line: 38, col: 14, offset: 733}, - val: "return", - ignoreCase: false, - want: "\"return\"", - }, - &ruleRefExpr{ - pos: position{line: 38, col: 23, offset: 742}, - name: "__", - }, - }, - }, - }, - &labeledExpr{ - pos: position{line: 38, col: 28, offset: 747}, - label: "e", - expr: &ruleRefExpr{ - pos: position{line: 38, col: 30, offset: 749}, - name: "Expr", - }, - }, - &ruleRefExpr{ - pos: position{line: 38, col: 35, offset: 754}, - name: "_", - }, - &zeroOrOneExpr{ - pos: position{line: 38, col: 37, offset: 756}, - expr: &ruleRefExpr{ - pos: position{line: 38, col: 37, offset: 756}, - name: "EOL", - }, - }, - }, - }, - }, - }, - { - name: "Expr", - pos: position{line: 47, col: 1, offset: 865}, - expr: &actionExpr{ - pos: position{line: 47, col: 9, offset: 873}, - run: (*parser).callonExpr1, - expr: &labeledExpr{ - pos: position{line: 47, col: 9, offset: 873}, - label: "e", - expr: &ruleRefExpr{ - pos: position{line: 47, col: 11, offset: 875}, - name: "AddExpr", - }, - }, - }, - }, - { - name: "AddExpr", - pos: position{line: 51, col: 1, offset: 906}, - expr: &actionExpr{ - pos: position{line: 51, col: 12, offset: 917}, - run: (*parser).callonAddExpr1, - expr: &seqExpr{ - pos: position{line: 51, col: 12, offset: 917}, - exprs: []interface{}{ - &ruleRefExpr{ - pos: position{line: 51, col: 12, offset: 917}, - name: "_", - }, - &labeledExpr{ - pos: position{line: 51, col: 14, offset: 919}, - label: "x", - expr: &ruleRefExpr{ - pos: position{line: 51, col: 16, offset: 921}, - name: "ShiftExpr", - }, - }, - &labeledExpr{ - pos: position{line: 51, col: 26, offset: 931}, - label: "rest", - expr: &zeroOrMoreExpr{ - pos: position{line: 51, col: 31, offset: 936}, - expr: &seqExpr{ - pos: position{line: 51, col: 32, offset: 937}, - exprs: []interface{}{ - &ruleRefExpr{ - pos: position{line: 51, col: 32, offset: 937}, - name: "_", - }, - &ruleRefExpr{ - pos: position{line: 51, col: 34, offset: 939}, - name: "AddOperator", - }, - &ruleRefExpr{ - pos: position{line: 51, col: 46, offset: 951}, - name: "_", - }, - &ruleRefExpr{ - pos: position{line: 51, col: 48, offset: 953}, - name: "ShiftExpr", - }, - }, - }, - }, - }, - &ruleRefExpr{ - pos: position{line: 51, col: 60, offset: 965}, - name: "_", - }, - }, - }, - }, - }, - { - name: "ShiftExpr", - pos: position{line: 63, col: 1, offset: 1134}, - expr: &choiceExpr{ - pos: position{line: 63, col: 14, offset: 1147}, - alternatives: []interface{}{ - &actionExpr{ - pos: position{line: 63, col: 14, offset: 1147}, - run: (*parser).callonShiftExpr2, - expr: &seqExpr{ - pos: position{line: 63, col: 14, offset: 1147}, - exprs: []interface{}{ - &ruleRefExpr{ - pos: position{line: 63, col: 14, offset: 1147}, - name: "_", - }, - &labeledExpr{ - pos: position{line: 63, col: 16, offset: 1149}, - label: "x", - expr: &ruleRefExpr{ - pos: position{line: 63, col: 18, offset: 1151}, - name: "BaseExpr", - }, - }, - &ruleRefExpr{ - pos: position{line: 63, col: 27, offset: 1160}, - name: "_", - }, - &ruleRefExpr{ - pos: position{line: 63, col: 29, offset: 1162}, - name: "ShiftOperator", - }, - &ruleRefExpr{ - pos: position{line: 63, col: 43, offset: 1176}, - name: "_", - }, - &labeledExpr{ - pos: position{line: 63, col: 45, offset: 1178}, - label: "s", - expr: &ruleRefExpr{ - pos: position{line: 63, col: 47, offset: 1180}, - name: "UintLiteral", - }, - }, - &ruleRefExpr{ - pos: position{line: 63, col: 59, offset: 1192}, - name: "_", - }, - }, - }, - }, - &actionExpr{ - pos: position{line: 68, col: 5, offset: 1279}, - run: (*parser).callonShiftExpr13, - expr: &seqExpr{ - pos: position{line: 68, col: 5, offset: 1279}, - exprs: []interface{}{ - &ruleRefExpr{ - pos: position{line: 68, col: 5, offset: 1279}, - name: "_", - }, - &ruleRefExpr{ - pos: position{line: 68, col: 7, offset: 1281}, - name: "DoubleOperator", - }, - &ruleRefExpr{ - pos: position{line: 68, col: 22, offset: 1296}, - name: "_", - }, - &labeledExpr{ - pos: position{line: 68, col: 24, offset: 1298}, - label: "x", - expr: &ruleRefExpr{ - pos: position{line: 68, col: 26, offset: 1300}, - name: "BaseExpr", - }, - }, - }, - }, - }, - &ruleRefExpr{ - pos: position{line: 72, col: 5, offset: 1374}, - name: "BaseExpr", - }, - }, - }, - }, - { - name: "BaseExpr", - pos: position{line: 74, col: 1, offset: 1384}, - expr: &choiceExpr{ - pos: position{line: 74, col: 13, offset: 1396}, - alternatives: []interface{}{ - &ruleRefExpr{ - pos: position{line: 74, col: 13, offset: 1396}, - name: "ParenExpr", - }, - &ruleRefExpr{ - pos: position{line: 74, col: 25, offset: 1408}, - name: "Operand", - }, - }, - }, - }, - { - name: "ParenExpr", - pos: position{line: 76, col: 1, offset: 1417}, - expr: &actionExpr{ - pos: position{line: 76, col: 14, offset: 1430}, - run: (*parser).callonParenExpr1, - expr: &seqExpr{ - pos: position{line: 76, col: 14, offset: 1430}, - exprs: []interface{}{ - &litMatcher{ - pos: position{line: 76, col: 14, offset: 1430}, - val: "(", - ignoreCase: false, - want: "\"(\"", - }, - &ruleRefExpr{ - pos: position{line: 76, col: 18, offset: 1434}, - name: "_", - }, - &labeledExpr{ - pos: position{line: 76, col: 20, offset: 1436}, - label: "e", - expr: &ruleRefExpr{ - pos: position{line: 76, col: 22, offset: 1438}, - name: "Expr", - }, - }, - &ruleRefExpr{ - pos: position{line: 76, col: 27, offset: 1443}, - name: "_", - }, - &litMatcher{ - pos: position{line: 76, col: 29, offset: 1445}, - val: ")", - ignoreCase: false, - want: "\")\"", - }, - }, - }, - }, - }, - { - name: "AddOperator", - pos: position{line: 82, col: 1, offset: 1486}, - expr: &choiceExpr{ - pos: position{line: 82, col: 16, offset: 1501}, - alternatives: []interface{}{ - &litMatcher{ - pos: position{line: 82, col: 16, offset: 1501}, - val: "+", - ignoreCase: false, - want: "\"+\"", - }, - &litMatcher{ - pos: position{line: 82, col: 22, offset: 1507}, - val: "add", - ignoreCase: false, - want: "\"add\"", - }, - }, - }, - }, - { - name: "ShiftOperator", - pos: position{line: 84, col: 1, offset: 1514}, - expr: &choiceExpr{ - pos: position{line: 84, col: 18, offset: 1531}, - alternatives: []interface{}{ - &litMatcher{ - pos: position{line: 84, col: 18, offset: 1531}, - val: "<<", - ignoreCase: false, - want: "\"<<\"", - }, - &litMatcher{ - pos: position{line: 84, col: 25, offset: 1538}, - val: "shl", - ignoreCase: false, - want: "\"shl\"", - }, - }, - }, - }, - { - name: "DoubleOperator", - pos: position{line: 86, col: 1, offset: 1545}, - expr: &choiceExpr{ - pos: position{line: 86, col: 19, offset: 1563}, - alternatives: []interface{}{ - &seqExpr{ - pos: position{line: 86, col: 19, offset: 1563}, - exprs: []interface{}{ - &litMatcher{ - pos: position{line: 86, col: 19, offset: 1563}, - val: "2", - ignoreCase: false, - want: "\"2\"", - }, - &ruleRefExpr{ - pos: position{line: 86, col: 23, offset: 1567}, - name: "_", - }, - &litMatcher{ - pos: position{line: 86, col: 25, offset: 1569}, - val: "*", - ignoreCase: false, - want: "\"*\"", - }, - }, - }, - &litMatcher{ - pos: position{line: 86, col: 31, offset: 1575}, - val: "dbl", - ignoreCase: false, - want: "\"dbl\"", - }, - }, - }, - }, - { - name: "Operand", - pos: position{line: 90, col: 1, offset: 1595}, - expr: &actionExpr{ - pos: position{line: 90, col: 12, offset: 1606}, - run: (*parser).callonOperand1, - expr: &labeledExpr{ - pos: position{line: 90, col: 12, offset: 1606}, - label: "op", - expr: &choiceExpr{ - pos: position{line: 90, col: 17, offset: 1611}, - alternatives: []interface{}{ - &ruleRefExpr{ - pos: position{line: 90, col: 17, offset: 1611}, - name: "One", - }, - &ruleRefExpr{ - pos: position{line: 90, col: 23, offset: 1617}, - name: "Index", - }, - &ruleRefExpr{ - pos: position{line: 90, col: 31, offset: 1625}, - name: "Identifier", - }, - }, - }, - }, - }, - }, - { - name: "One", - pos: position{line: 94, col: 1, offset: 1662}, - expr: &actionExpr{ - pos: position{line: 94, col: 8, offset: 1669}, - run: (*parser).callonOne1, - expr: &litMatcher{ - pos: position{line: 94, col: 8, offset: 1669}, - val: "1", - ignoreCase: false, - want: "\"1\"", - }, - }, - }, - { - name: "Index", - pos: position{line: 98, col: 1, offset: 1709}, - expr: &actionExpr{ - pos: position{line: 98, col: 10, offset: 1718}, - run: (*parser).callonIndex1, - expr: &seqExpr{ - pos: position{line: 98, col: 10, offset: 1718}, - exprs: []interface{}{ - &litMatcher{ - pos: position{line: 98, col: 10, offset: 1718}, - val: "[", - ignoreCase: false, - want: "\"[\"", - }, - &ruleRefExpr{ - pos: position{line: 98, col: 14, offset: 1722}, - name: "_", - }, - &labeledExpr{ - pos: position{line: 98, col: 16, offset: 1724}, - label: "idx", - expr: &ruleRefExpr{ - pos: position{line: 98, col: 20, offset: 1728}, - name: "UintLiteral", - }, - }, - &ruleRefExpr{ - pos: position{line: 98, col: 32, offset: 1740}, - name: "_", - }, - &litMatcher{ - pos: position{line: 98, col: 34, offset: 1742}, - val: "]", - ignoreCase: false, - want: "\"]\"", - }, - }, - }, - }, - }, - { - name: "Identifier", - pos: position{line: 104, col: 1, offset: 1807}, - expr: &actionExpr{ - pos: position{line: 104, col: 15, offset: 1821}, - run: (*parser).callonIdentifier1, - expr: &seqExpr{ - pos: position{line: 104, col: 15, offset: 1821}, - exprs: []interface{}{ - &charClassMatcher{ - pos: position{line: 104, col: 15, offset: 1821}, - val: "[a-zA-Z_]", - chars: []rune{'_'}, - ranges: []rune{'a', 'z', 'A', 'Z'}, - ignoreCase: false, - inverted: false, - }, - &zeroOrMoreExpr{ - pos: position{line: 104, col: 25, offset: 1831}, - expr: &charClassMatcher{ - pos: position{line: 104, col: 25, offset: 1831}, - val: "[a-zA-Z0-9_]", - chars: []rune{'_'}, - ranges: []rune{'a', 'z', 'A', 'Z', '0', '9'}, - ignoreCase: false, - inverted: false, - }, - }, - }, - }, - }, - }, - { - name: "UintLiteral", - pos: position{line: 110, col: 1, offset: 1904}, - expr: &actionExpr{ - pos: position{line: 110, col: 16, offset: 1919}, - run: (*parser).callonUintLiteral1, - expr: &labeledExpr{ - pos: position{line: 110, col: 16, offset: 1919}, - label: "u64", - expr: &ruleRefExpr{ - pos: position{line: 110, col: 20, offset: 1923}, - name: "Uint64Literal", - }, - }, - }, - }, - { - name: "Uint64Literal", - pos: position{line: 114, col: 1, offset: 1977}, - expr: &actionExpr{ - pos: position{line: 114, col: 18, offset: 1994}, - run: (*parser).callonUint64Literal1, - expr: &choiceExpr{ - pos: position{line: 114, col: 19, offset: 1995}, - alternatives: []interface{}{ - &ruleRefExpr{ - pos: position{line: 114, col: 19, offset: 1995}, - name: "HexUintLiteral", - }, - &ruleRefExpr{ - pos: position{line: 114, col: 36, offset: 2012}, - name: "OctalUintLiteral", - }, - &ruleRefExpr{ - pos: position{line: 114, col: 55, offset: 2031}, - name: "DecimalUintLiteral", - }, - }, - }, - }, - }, - { - name: "DecimalUintLiteral", - pos: position{line: 118, col: 1, offset: 2108}, - expr: &oneOrMoreExpr{ - pos: position{line: 118, col: 23, offset: 2130}, - expr: &charClassMatcher{ - pos: position{line: 118, col: 23, offset: 2130}, - val: "[0-9]", - ranges: []rune{'0', '9'}, - ignoreCase: false, - inverted: false, - }, - }, - }, - { - name: "HexUintLiteral", - pos: position{line: 120, col: 1, offset: 2138}, - expr: &seqExpr{ - pos: position{line: 120, col: 19, offset: 2156}, - exprs: []interface{}{ - &litMatcher{ - pos: position{line: 120, col: 19, offset: 2156}, - val: "0x", - ignoreCase: false, - want: "\"0x\"", - }, - &oneOrMoreExpr{ - pos: position{line: 120, col: 24, offset: 2161}, - expr: &charClassMatcher{ - pos: position{line: 120, col: 24, offset: 2161}, - val: "[0-9a-fA-F]", - ranges: []rune{'0', '9', 'a', 'f', 'A', 'F'}, - ignoreCase: false, - inverted: false, - }, - }, - }, - }, - }, - { - name: "OctalUintLiteral", - pos: position{line: 122, col: 1, offset: 2175}, - expr: &seqExpr{ - pos: position{line: 122, col: 21, offset: 2195}, - exprs: []interface{}{ - &litMatcher{ - pos: position{line: 122, col: 21, offset: 2195}, - val: "0", - ignoreCase: false, - want: "\"0\"", - }, - &oneOrMoreExpr{ - pos: position{line: 122, col: 25, offset: 2199}, - expr: &charClassMatcher{ - pos: position{line: 122, col: 25, offset: 2199}, - val: "[0-7]", - ranges: []rune{'0', '7'}, - ignoreCase: false, - inverted: false, - }, - }, - }, - }, - }, - { - name: "__", - pos: position{line: 126, col: 1, offset: 2229}, - expr: &oneOrMoreExpr{ - pos: position{line: 126, col: 7, offset: 2235}, - expr: &ruleRefExpr{ - pos: position{line: 126, col: 7, offset: 2235}, - name: "Whitespace", - }, - }, - }, - { - name: "_", - pos: position{line: 127, col: 1, offset: 2247}, - expr: &zeroOrMoreExpr{ - pos: position{line: 127, col: 6, offset: 2252}, - expr: &ruleRefExpr{ - pos: position{line: 127, col: 6, offset: 2252}, - name: "Whitespace", - }, - }, - }, - { - name: "Whitespace", - pos: position{line: 129, col: 1, offset: 2265}, - expr: &charClassMatcher{ - pos: position{line: 129, col: 15, offset: 2279}, - val: "[ \\t\\r]", - chars: []rune{' ', '\t', '\r'}, - ignoreCase: false, - inverted: false, - }, - }, - { - name: "EOL", - pos: position{line: 130, col: 1, offset: 2287}, - expr: &litMatcher{ - pos: position{line: 130, col: 8, offset: 2294}, - val: "\n", - ignoreCase: false, - want: "\"\\n\"", - }, - }, - { - name: "EOF", - pos: position{line: 131, col: 1, offset: 2299}, - expr: ¬Expr{ - pos: position{line: 131, col: 8, offset: 2306}, - expr: &anyMatcher{ - line: 131, col: 9, offset: 2307, - }, - }, - }, - }, -} - -func (c *current) onChain1(as, r interface{}) (interface{}, error) { - ch := &ast.Chain{} - for _, a := range as.([]interface{}) { - ch.Statements = append(ch.Statements, a.(ast.Statement)) - } - ch.Statements = append(ch.Statements, r.(ast.Statement)) - return ch, nil -} - -func (p *parser) callonChain1() (interface{}, error) { - stack := p.vstack[len(p.vstack)-1] - _ = stack - return p.cur.onChain1(stack["as"], stack["r"]) -} - -func (c *current) onAssignment1(n, e interface{}) (interface{}, error) { - return ast.Statement{ - Name: n.(ast.Identifier), - Expr: e.(ast.Expr), - }, nil -} - -func (p *parser) callonAssignment1() (interface{}, error) { - stack := p.vstack[len(p.vstack)-1] - _ = stack - return p.cur.onAssignment1(stack["n"], stack["e"]) -} - -func (c *current) onReturn1(e interface{}) (interface{}, error) { - return ast.Statement{ - Name: "", - Expr: e.(ast.Expr), - }, nil -} - -func (p *parser) callonReturn1() (interface{}, error) { - stack := p.vstack[len(p.vstack)-1] - _ = stack - return p.cur.onReturn1(stack["e"]) -} - -func (c *current) onExpr1(e interface{}) (interface{}, error) { - return e, nil -} - -func (p *parser) callonExpr1() (interface{}, error) { - stack := p.vstack[len(p.vstack)-1] - _ = stack - return p.cur.onExpr1(stack["e"]) -} - -func (c *current) onAddExpr1(x, rest interface{}) (interface{}, error) { - es := exprs(x, rest) - r := es[0] - for _, e := range es[1:] { - r = ast.Add{ - X: r, - Y: e, - } - } - return r, nil -} - -func (p *parser) callonAddExpr1() (interface{}, error) { - stack := p.vstack[len(p.vstack)-1] - _ = stack - return p.cur.onAddExpr1(stack["x"], stack["rest"]) -} - -func (c *current) onShiftExpr2(x, s interface{}) (interface{}, error) { - return ast.Shift{ - X: x.(ast.Expr), - S: s.(uint), - }, nil -} - -func (p *parser) callonShiftExpr2() (interface{}, error) { - stack := p.vstack[len(p.vstack)-1] - _ = stack - return p.cur.onShiftExpr2(stack["x"], stack["s"]) -} - -func (c *current) onShiftExpr13(x interface{}) (interface{}, error) { - return ast.Double{ - X: x.(ast.Expr), - }, nil -} - -func (p *parser) callonShiftExpr13() (interface{}, error) { - stack := p.vstack[len(p.vstack)-1] - _ = stack - return p.cur.onShiftExpr13(stack["x"]) -} - -func (c *current) onParenExpr1(e interface{}) (interface{}, error) { - return e, nil -} - -func (p *parser) callonParenExpr1() (interface{}, error) { - stack := p.vstack[len(p.vstack)-1] - _ = stack - return p.cur.onParenExpr1(stack["e"]) -} - -func (c *current) onOperand1(op interface{}) (interface{}, error) { - return op, nil -} - -func (p *parser) callonOperand1() (interface{}, error) { - stack := p.vstack[len(p.vstack)-1] - _ = stack - return p.cur.onOperand1(stack["op"]) -} - -func (c *current) onOne1() (interface{}, error) { - return ast.Operand(0), nil -} - -func (p *parser) callonOne1() (interface{}, error) { - stack := p.vstack[len(p.vstack)-1] - _ = stack - return p.cur.onOne1() -} - -func (c *current) onIndex1(idx interface{}) (interface{}, error) { - return ast.Operand(idx.(uint)), nil -} - -func (p *parser) callonIndex1() (interface{}, error) { - stack := p.vstack[len(p.vstack)-1] - _ = stack - return p.cur.onIndex1(stack["idx"]) -} - -func (c *current) onIdentifier1() (interface{}, error) { - return ast.Identifier(c.text), nil -} - -func (p *parser) callonIdentifier1() (interface{}, error) { - stack := p.vstack[len(p.vstack)-1] - _ = stack - return p.cur.onIdentifier1() -} - -func (c *current) onUintLiteral1(u64 interface{}) (interface{}, error) { - return uint(u64.(uint64)), nil -} - -func (p *parser) callonUintLiteral1() (interface{}, error) { - stack := p.vstack[len(p.vstack)-1] - _ = stack - return p.cur.onUintLiteral1(stack["u64"]) -} - -func (c *current) onUint64Literal1() (interface{}, error) { - return strconv.ParseUint(string(c.text), 0, 64) -} - -func (p *parser) callonUint64Literal1() (interface{}, error) { - stack := p.vstack[len(p.vstack)-1] - _ = stack - return p.cur.onUint64Literal1() -} - -var ( - // errNoRule is returned when the grammar to parse has no rule. - errNoRule = errors.New("grammar has no rule") - - // errInvalidEntrypoint is returned when the specified entrypoint rule - // does not exit. - errInvalidEntrypoint = errors.New("invalid entrypoint") - - // errInvalidEncoding is returned when the source is not properly - // utf8-encoded. - errInvalidEncoding = errors.New("invalid encoding") - - // errMaxExprCnt is used to signal that the maximum number of - // expressions have been parsed. - errMaxExprCnt = errors.New("max number of expresssions parsed") -) - -// Option is a function that can set an option on the parser. It returns -// the previous setting as an Option. -type Option func(*parser) Option - -// MaxExpressions creates an Option to stop parsing after the provided -// number of expressions have been parsed, if the value is 0 then the parser will -// parse for as many steps as needed (possibly an infinite number). -// -// The default for maxExprCnt is 0. -func MaxExpressions(maxExprCnt uint64) Option { - return func(p *parser) Option { - oldMaxExprCnt := p.maxExprCnt - p.maxExprCnt = maxExprCnt - return MaxExpressions(oldMaxExprCnt) - } -} - -// Entrypoint creates an Option to set the rule name to use as entrypoint. -// The rule name must have been specified in the -alternate-entrypoints -// if generating the parser with the -optimize-grammar flag, otherwise -// it may have been optimized out. Passing an empty string sets the -// entrypoint to the first rule in the grammar. -// -// The default is to start parsing at the first rule in the grammar. -func Entrypoint(ruleName string) Option { - return func(p *parser) Option { - oldEntrypoint := p.entrypoint - p.entrypoint = ruleName - if ruleName == "" { - p.entrypoint = g.rules[0].name - } - return Entrypoint(oldEntrypoint) - } -} - -// Statistics adds a user provided Stats struct to the parser to allow -// the user to process the results after the parsing has finished. -// Also the key for the "no match" counter is set. -// -// Example usage: -// -// input := "input" -// stats := Stats{} -// _, err := Parse("input-file", []byte(input), Statistics(&stats, "no match")) -// if err != nil { -// log.Panicln(err) -// } -// b, err := json.MarshalIndent(stats.ChoiceAltCnt, "", " ") -// if err != nil { -// log.Panicln(err) -// } -// fmt.Println(string(b)) -// -func Statistics(stats *Stats, choiceNoMatch string) Option { - return func(p *parser) Option { - oldStats := p.Stats - p.Stats = stats - oldChoiceNoMatch := p.choiceNoMatch - p.choiceNoMatch = choiceNoMatch - if p.Stats.ChoiceAltCnt == nil { - p.Stats.ChoiceAltCnt = make(map[string]map[string]int) - } - return Statistics(oldStats, oldChoiceNoMatch) - } -} - -// Debug creates an Option to set the debug flag to b. When set to true, -// debugging information is printed to stdout while parsing. -// -// The default is false. -func Debug(b bool) Option { - return func(p *parser) Option { - old := p.debug - p.debug = b - return Debug(old) - } -} - -// Memoize creates an Option to set the memoize flag to b. When set to true, -// the parser will cache all results so each expression is evaluated only -// once. This guarantees linear parsing time even for pathological cases, -// at the expense of more memory and slower times for typical cases. -// -// The default is false. -func Memoize(b bool) Option { - return func(p *parser) Option { - old := p.memoize - p.memoize = b - return Memoize(old) - } -} - -// AllowInvalidUTF8 creates an Option to allow invalid UTF-8 bytes. -// Every invalid UTF-8 byte is treated as a utf8.RuneError (U+FFFD) -// by character class matchers and is matched by the any matcher. -// The returned matched value, c.text and c.offset are NOT affected. -// -// The default is false. -func AllowInvalidUTF8(b bool) Option { - return func(p *parser) Option { - old := p.allowInvalidUTF8 - p.allowInvalidUTF8 = b - return AllowInvalidUTF8(old) - } -} - -// Recover creates an Option to set the recover flag to b. When set to -// true, this causes the parser to recover from panics and convert it -// to an error. Setting it to false can be useful while debugging to -// access the full stack trace. -// -// The default is true. -func Recover(b bool) Option { - return func(p *parser) Option { - old := p.recover - p.recover = b - return Recover(old) - } -} - -// GlobalStore creates an Option to set a key to a certain value in -// the globalStore. -func GlobalStore(key string, value interface{}) Option { - return func(p *parser) Option { - old := p.cur.globalStore[key] - p.cur.globalStore[key] = value - return GlobalStore(key, old) - } -} - -// InitState creates an Option to set a key to a certain value in -// the global "state" store. -func InitState(key string, value interface{}) Option { - return func(p *parser) Option { - old := p.cur.state[key] - p.cur.state[key] = value - return InitState(key, old) - } -} - -// ParseFile parses the file identified by filename. -func ParseFile(filename string, opts ...Option) (i interface{}, err error) { - f, err := os.Open(filename) - if err != nil { - return nil, err - } - defer func() { - if closeErr := f.Close(); closeErr != nil { - err = closeErr - } - }() - return ParseReader(filename, f, opts...) -} - -// ParseReader parses the data from r using filename as information in the -// error messages. -func ParseReader(filename string, r io.Reader, opts ...Option) (interface{}, error) { - b, err := ioutil.ReadAll(r) - if err != nil { - return nil, err - } - - return Parse(filename, b, opts...) -} - -// Parse parses the data from b using filename as information in the -// error messages. -func Parse(filename string, b []byte, opts ...Option) (interface{}, error) { - return newParser(filename, b, opts...).parse(g) -} - -// position records a position in the text. -type position struct { - line, col, offset int -} - -func (p position) String() string { - return strconv.Itoa(p.line) + ":" + strconv.Itoa(p.col) + " [" + strconv.Itoa(p.offset) + "]" -} - -// savepoint stores all state required to go back to this point in the -// parser. -type savepoint struct { - position - rn rune - w int -} - -type current struct { - pos position // start position of the match - text []byte // raw text of the match - - // state is a store for arbitrary key,value pairs that the user wants to be - // tied to the backtracking of the parser. - // This is always rolled back if a parsing rule fails. - state storeDict - - // globalStore is a general store for the user to store arbitrary key-value - // pairs that they need to manage and that they do not want tied to the - // backtracking of the parser. This is only modified by the user and never - // rolled back by the parser. It is always up to the user to keep this in a - // consistent state. - globalStore storeDict -} - -type storeDict map[string]interface{} - -// the AST types... - -type grammar struct { - pos position - rules []*rule -} - -type rule struct { - pos position - name string - displayName string - expr interface{} -} - -type choiceExpr struct { - pos position - alternatives []interface{} -} - -type actionExpr struct { - pos position - expr interface{} - run func(*parser) (interface{}, error) -} - -type recoveryExpr struct { - pos position - expr interface{} - recoverExpr interface{} - failureLabel []string -} - -type seqExpr struct { - pos position - exprs []interface{} -} - -type throwExpr struct { - pos position - label string -} - -type labeledExpr struct { - pos position - label string - expr interface{} -} - -type expr struct { - pos position - expr interface{} -} - -type andExpr expr -type notExpr expr -type zeroOrOneExpr expr -type zeroOrMoreExpr expr -type oneOrMoreExpr expr - -type ruleRefExpr struct { - pos position - name string -} - -type stateCodeExpr struct { - pos position - run func(*parser) error -} - -type andCodeExpr struct { - pos position - run func(*parser) (bool, error) -} - -type notCodeExpr struct { - pos position - run func(*parser) (bool, error) -} - -type litMatcher struct { - pos position - val string - ignoreCase bool - want string -} - -type charClassMatcher struct { - pos position - val string - basicLatinChars [128]bool - chars []rune - ranges []rune - classes []*unicode.RangeTable - ignoreCase bool - inverted bool -} - -type anyMatcher position - -// errList cumulates the errors found by the parser. -type errList []error - -func (e *errList) add(err error) { - *e = append(*e, err) -} - -func (e errList) err() error { - if len(e) == 0 { - return nil - } - e.dedupe() - return e -} - -func (e *errList) dedupe() { - var cleaned []error - set := make(map[string]bool) - for _, err := range *e { - if msg := err.Error(); !set[msg] { - set[msg] = true - cleaned = append(cleaned, err) - } - } - *e = cleaned -} - -func (e errList) Error() string { - switch len(e) { - case 0: - return "" - case 1: - return e[0].Error() - default: - var buf bytes.Buffer - - for i, err := range e { - if i > 0 { - buf.WriteRune('\n') - } - buf.WriteString(err.Error()) - } - return buf.String() - } -} - -// parserError wraps an error with a prefix indicating the rule in which -// the error occurred. The original error is stored in the Inner field. -type parserError struct { - Inner error - pos position - prefix string - expected []string -} - -// Error returns the error message. -func (p *parserError) Error() string { - return p.prefix + ": " + p.Inner.Error() -} - -// newParser creates a parser with the specified input source and options. -func newParser(filename string, b []byte, opts ...Option) *parser { - stats := Stats{ - ChoiceAltCnt: make(map[string]map[string]int), - } - - p := &parser{ - filename: filename, - errs: new(errList), - data: b, - pt: savepoint{position: position{line: 1}}, - recover: true, - cur: current{ - state: make(storeDict), - globalStore: make(storeDict), - }, - maxFailPos: position{col: 1, line: 1}, - maxFailExpected: make([]string, 0, 20), - Stats: &stats, - // start rule is rule [0] unless an alternate entrypoint is specified - entrypoint: g.rules[0].name, - } - p.setOptions(opts) - - if p.maxExprCnt == 0 { - p.maxExprCnt = math.MaxUint64 - } - - return p -} - -// setOptions applies the options to the parser. -func (p *parser) setOptions(opts []Option) { - for _, opt := range opts { - opt(p) - } -} - -type resultTuple struct { - v interface{} - b bool - end savepoint -} - -const choiceNoMatch = -1 - -// Stats stores some statistics, gathered during parsing -type Stats struct { - // ExprCnt counts the number of expressions processed during parsing - // This value is compared to the maximum number of expressions allowed - // (set by the MaxExpressions option). - ExprCnt uint64 - - // ChoiceAltCnt is used to count for each ordered choice expression, - // which alternative is used how may times. - // These numbers allow to optimize the order of the ordered choice expression - // to increase the performance of the parser - // - // The outer key of ChoiceAltCnt is composed of the name of the rule as well - // as the line and the column of the ordered choice. - // The inner key of ChoiceAltCnt is the number (one-based) of the matching alternative. - // For each alternative the number of matches are counted. If an ordered choice does not - // match, a special counter is incremented. The name of this counter is set with - // the parser option Statistics. - // For an alternative to be included in ChoiceAltCnt, it has to match at least once. - ChoiceAltCnt map[string]map[string]int -} - -type parser struct { - filename string - pt savepoint - cur current - - data []byte - errs *errList - - depth int - recover bool - debug bool - - memoize bool - // memoization table for the packrat algorithm: - // map[offset in source] map[expression or rule] {value, match} - memo map[int]map[interface{}]resultTuple - - // rules table, maps the rule identifier to the rule node - rules map[string]*rule - // variables stack, map of label to value - vstack []map[string]interface{} - // rule stack, allows identification of the current rule in errors - rstack []*rule - - // parse fail - maxFailPos position - maxFailExpected []string - maxFailInvertExpected bool - - // max number of expressions to be parsed - maxExprCnt uint64 - // entrypoint for the parser - entrypoint string - - allowInvalidUTF8 bool - - *Stats - - choiceNoMatch string - // recovery expression stack, keeps track of the currently available recovery expression, these are traversed in reverse - recoveryStack []map[string]interface{} -} - -// push a variable set on the vstack. -func (p *parser) pushV() { - if cap(p.vstack) == len(p.vstack) { - // create new empty slot in the stack - p.vstack = append(p.vstack, nil) - } else { - // slice to 1 more - p.vstack = p.vstack[:len(p.vstack)+1] - } - - // get the last args set - m := p.vstack[len(p.vstack)-1] - if m != nil && len(m) == 0 { - // empty map, all good - return - } - - m = make(map[string]interface{}) - p.vstack[len(p.vstack)-1] = m -} - -// pop a variable set from the vstack. -func (p *parser) popV() { - // if the map is not empty, clear it - m := p.vstack[len(p.vstack)-1] - if len(m) > 0 { - // GC that map - p.vstack[len(p.vstack)-1] = nil - } - p.vstack = p.vstack[:len(p.vstack)-1] -} - -// push a recovery expression with its labels to the recoveryStack -func (p *parser) pushRecovery(labels []string, expr interface{}) { - if cap(p.recoveryStack) == len(p.recoveryStack) { - // create new empty slot in the stack - p.recoveryStack = append(p.recoveryStack, nil) - } else { - // slice to 1 more - p.recoveryStack = p.recoveryStack[:len(p.recoveryStack)+1] - } - - m := make(map[string]interface{}, len(labels)) - for _, fl := range labels { - m[fl] = expr - } - p.recoveryStack[len(p.recoveryStack)-1] = m -} - -// pop a recovery expression from the recoveryStack -func (p *parser) popRecovery() { - // GC that map - p.recoveryStack[len(p.recoveryStack)-1] = nil - - p.recoveryStack = p.recoveryStack[:len(p.recoveryStack)-1] -} - -func (p *parser) print(prefix, s string) string { - if !p.debug { - return s - } - - fmt.Printf("%s %d:%d:%d: %s [%#U]\n", - prefix, p.pt.line, p.pt.col, p.pt.offset, s, p.pt.rn) - return s -} - -func (p *parser) in(s string) string { - p.depth++ - return p.print(strings.Repeat(" ", p.depth)+">", s) -} - -func (p *parser) out(s string) string { - p.depth-- - return p.print(strings.Repeat(" ", p.depth)+"<", s) -} - -func (p *parser) addErr(err error) { - p.addErrAt(err, p.pt.position, []string{}) -} - -func (p *parser) addErrAt(err error, pos position, expected []string) { - var buf bytes.Buffer - if p.filename != "" { - buf.WriteString(p.filename) - } - if buf.Len() > 0 { - buf.WriteString(":") - } - buf.WriteString(fmt.Sprintf("%d:%d (%d)", pos.line, pos.col, pos.offset)) - if len(p.rstack) > 0 { - if buf.Len() > 0 { - buf.WriteString(": ") - } - rule := p.rstack[len(p.rstack)-1] - if rule.displayName != "" { - buf.WriteString("rule " + rule.displayName) - } else { - buf.WriteString("rule " + rule.name) - } - } - pe := &parserError{Inner: err, pos: pos, prefix: buf.String(), expected: expected} - p.errs.add(pe) -} - -func (p *parser) failAt(fail bool, pos position, want string) { - // process fail if parsing fails and not inverted or parsing succeeds and invert is set - if fail == p.maxFailInvertExpected { - if pos.offset < p.maxFailPos.offset { - return - } - - if pos.offset > p.maxFailPos.offset { - p.maxFailPos = pos - p.maxFailExpected = p.maxFailExpected[:0] - } - - if p.maxFailInvertExpected { - want = "!" + want - } - p.maxFailExpected = append(p.maxFailExpected, want) - } -} - -// read advances the parser to the next rune. -func (p *parser) read() { - p.pt.offset += p.pt.w - rn, n := utf8.DecodeRune(p.data[p.pt.offset:]) - p.pt.rn = rn - p.pt.w = n - p.pt.col++ - if rn == '\n' { - p.pt.line++ - p.pt.col = 0 - } - - if rn == utf8.RuneError && n == 1 { // see utf8.DecodeRune - if !p.allowInvalidUTF8 { - p.addErr(errInvalidEncoding) - } - } -} - -// restore parser position to the savepoint pt. -func (p *parser) restore(pt savepoint) { - if p.debug { - defer p.out(p.in("restore")) - } - if pt.offset == p.pt.offset { - return - } - p.pt = pt -} - -// Cloner is implemented by any value that has a Clone method, which returns a -// copy of the value. This is mainly used for types which are not passed by -// value (e.g map, slice, chan) or structs that contain such types. -// -// This is used in conjunction with the global state feature to create proper -// copies of the state to allow the parser to properly restore the state in -// the case of backtracking. -type Cloner interface { - Clone() interface{} -} - -var statePool = &sync.Pool{ - New: func() interface{} { return make(storeDict) }, -} - -func (sd storeDict) Discard() { - for k := range sd { - delete(sd, k) - } - statePool.Put(sd) -} - -// clone and return parser current state. -func (p *parser) cloneState() storeDict { - if p.debug { - defer p.out(p.in("cloneState")) - } - - state := statePool.Get().(storeDict) - for k, v := range p.cur.state { - if c, ok := v.(Cloner); ok { - state[k] = c.Clone() - } else { - state[k] = v - } - } - return state -} - -// restore parser current state to the state storeDict. -// every restoreState should applied only one time for every cloned state -func (p *parser) restoreState(state storeDict) { - if p.debug { - defer p.out(p.in("restoreState")) - } - p.cur.state.Discard() - p.cur.state = state -} - -// get the slice of bytes from the savepoint start to the current position. -func (p *parser) sliceFrom(start savepoint) []byte { - return p.data[start.position.offset:p.pt.position.offset] -} - -func (p *parser) getMemoized(node interface{}) (resultTuple, bool) { - if len(p.memo) == 0 { - return resultTuple{}, false - } - m := p.memo[p.pt.offset] - if len(m) == 0 { - return resultTuple{}, false - } - res, ok := m[node] - return res, ok -} - -func (p *parser) setMemoized(pt savepoint, node interface{}, tuple resultTuple) { - if p.memo == nil { - p.memo = make(map[int]map[interface{}]resultTuple) - } - m := p.memo[pt.offset] - if m == nil { - m = make(map[interface{}]resultTuple) - p.memo[pt.offset] = m - } - m[node] = tuple -} - -func (p *parser) buildRulesTable(g *grammar) { - p.rules = make(map[string]*rule, len(g.rules)) - for _, r := range g.rules { - p.rules[r.name] = r - } -} - -func (p *parser) parse(g *grammar) (val interface{}, err error) { - if len(g.rules) == 0 { - p.addErr(errNoRule) - return nil, p.errs.err() - } - - // TODO : not super critical but this could be generated - p.buildRulesTable(g) - - if p.recover { - // panic can be used in action code to stop parsing immediately - // and return the panic as an error. - defer func() { - if e := recover(); e != nil { - if p.debug { - defer p.out(p.in("panic handler")) - } - val = nil - switch e := e.(type) { - case error: - p.addErr(e) - default: - p.addErr(fmt.Errorf("%v", e)) - } - err = p.errs.err() - } - }() - } - - startRule, ok := p.rules[p.entrypoint] - if !ok { - p.addErr(errInvalidEntrypoint) - return nil, p.errs.err() - } - - p.read() // advance to first rune - val, ok = p.parseRule(startRule) - if !ok { - if len(*p.errs) == 0 { - // If parsing fails, but no errors have been recorded, the expected values - // for the farthest parser position are returned as error. - maxFailExpectedMap := make(map[string]struct{}, len(p.maxFailExpected)) - for _, v := range p.maxFailExpected { - maxFailExpectedMap[v] = struct{}{} - } - expected := make([]string, 0, len(maxFailExpectedMap)) - eof := false - if _, ok := maxFailExpectedMap["!."]; ok { - delete(maxFailExpectedMap, "!.") - eof = true - } - for k := range maxFailExpectedMap { - expected = append(expected, k) - } - sort.Strings(expected) - if eof { - expected = append(expected, "EOF") - } - p.addErrAt(errors.New("no match found, expected: "+listJoin(expected, ", ", "or")), p.maxFailPos, expected) - } - - return nil, p.errs.err() - } - return val, p.errs.err() -} - -func listJoin(list []string, sep string, lastSep string) string { - switch len(list) { - case 0: - return "" - case 1: - return list[0] - default: - return strings.Join(list[:len(list)-1], sep) + " " + lastSep + " " + list[len(list)-1] - } -} - -func (p *parser) parseRule(rule *rule) (interface{}, bool) { - if p.debug { - defer p.out(p.in("parseRule " + rule.name)) - } - - if p.memoize { - res, ok := p.getMemoized(rule) - if ok { - p.restore(res.end) - return res.v, res.b - } - } - - start := p.pt - p.rstack = append(p.rstack, rule) - p.pushV() - val, ok := p.parseExpr(rule.expr) - p.popV() - p.rstack = p.rstack[:len(p.rstack)-1] - if ok && p.debug { - p.print(strings.Repeat(" ", p.depth)+"MATCH", string(p.sliceFrom(start))) - } - - if p.memoize { - p.setMemoized(start, rule, resultTuple{val, ok, p.pt}) - } - return val, ok -} - -func (p *parser) parseExpr(expr interface{}) (interface{}, bool) { - var pt savepoint - - if p.memoize { - res, ok := p.getMemoized(expr) - if ok { - p.restore(res.end) - return res.v, res.b - } - pt = p.pt - } - - p.ExprCnt++ - if p.ExprCnt > p.maxExprCnt { - panic(errMaxExprCnt) - } - - var val interface{} - var ok bool - switch expr := expr.(type) { - case *actionExpr: - val, ok = p.parseActionExpr(expr) - case *andCodeExpr: - val, ok = p.parseAndCodeExpr(expr) - case *andExpr: - val, ok = p.parseAndExpr(expr) - case *anyMatcher: - val, ok = p.parseAnyMatcher(expr) - case *charClassMatcher: - val, ok = p.parseCharClassMatcher(expr) - case *choiceExpr: - val, ok = p.parseChoiceExpr(expr) - case *labeledExpr: - val, ok = p.parseLabeledExpr(expr) - case *litMatcher: - val, ok = p.parseLitMatcher(expr) - case *notCodeExpr: - val, ok = p.parseNotCodeExpr(expr) - case *notExpr: - val, ok = p.parseNotExpr(expr) - case *oneOrMoreExpr: - val, ok = p.parseOneOrMoreExpr(expr) - case *recoveryExpr: - val, ok = p.parseRecoveryExpr(expr) - case *ruleRefExpr: - val, ok = p.parseRuleRefExpr(expr) - case *seqExpr: - val, ok = p.parseSeqExpr(expr) - case *stateCodeExpr: - val, ok = p.parseStateCodeExpr(expr) - case *throwExpr: - val, ok = p.parseThrowExpr(expr) - case *zeroOrMoreExpr: - val, ok = p.parseZeroOrMoreExpr(expr) - case *zeroOrOneExpr: - val, ok = p.parseZeroOrOneExpr(expr) - default: - panic(fmt.Sprintf("unknown expression type %T", expr)) - } - if p.memoize { - p.setMemoized(pt, expr, resultTuple{val, ok, p.pt}) - } - return val, ok -} - -func (p *parser) parseActionExpr(act *actionExpr) (interface{}, bool) { - if p.debug { - defer p.out(p.in("parseActionExpr")) - } - - start := p.pt - val, ok := p.parseExpr(act.expr) - if ok { - p.cur.pos = start.position - p.cur.text = p.sliceFrom(start) - state := p.cloneState() - actVal, err := act.run(p) - if err != nil { - p.addErrAt(err, start.position, []string{}) - } - p.restoreState(state) - - val = actVal - } - if ok && p.debug { - p.print(strings.Repeat(" ", p.depth)+"MATCH", string(p.sliceFrom(start))) - } - return val, ok -} - -func (p *parser) parseAndCodeExpr(and *andCodeExpr) (interface{}, bool) { - if p.debug { - defer p.out(p.in("parseAndCodeExpr")) - } - - state := p.cloneState() - - ok, err := and.run(p) - if err != nil { - p.addErr(err) - } - p.restoreState(state) - - return nil, ok -} - -func (p *parser) parseAndExpr(and *andExpr) (interface{}, bool) { - if p.debug { - defer p.out(p.in("parseAndExpr")) - } - - pt := p.pt - state := p.cloneState() - p.pushV() - _, ok := p.parseExpr(and.expr) - p.popV() - p.restoreState(state) - p.restore(pt) - - return nil, ok -} - -func (p *parser) parseAnyMatcher(any *anyMatcher) (interface{}, bool) { - if p.debug { - defer p.out(p.in("parseAnyMatcher")) - } - - if p.pt.rn == utf8.RuneError && p.pt.w == 0 { - // EOF - see utf8.DecodeRune - p.failAt(false, p.pt.position, ".") - return nil, false - } - start := p.pt - p.read() - p.failAt(true, start.position, ".") - return p.sliceFrom(start), true -} - -func (p *parser) parseCharClassMatcher(chr *charClassMatcher) (interface{}, bool) { - if p.debug { - defer p.out(p.in("parseCharClassMatcher")) - } - - cur := p.pt.rn - start := p.pt - - // can't match EOF - if cur == utf8.RuneError && p.pt.w == 0 { // see utf8.DecodeRune - p.failAt(false, start.position, chr.val) - return nil, false - } - - if chr.ignoreCase { - cur = unicode.ToLower(cur) - } - - // try to match in the list of available chars - for _, rn := range chr.chars { - if rn == cur { - if chr.inverted { - p.failAt(false, start.position, chr.val) - return nil, false - } - p.read() - p.failAt(true, start.position, chr.val) - return p.sliceFrom(start), true - } - } - - // try to match in the list of ranges - for i := 0; i < len(chr.ranges); i += 2 { - if cur >= chr.ranges[i] && cur <= chr.ranges[i+1] { - if chr.inverted { - p.failAt(false, start.position, chr.val) - return nil, false - } - p.read() - p.failAt(true, start.position, chr.val) - return p.sliceFrom(start), true - } - } - - // try to match in the list of Unicode classes - for _, cl := range chr.classes { - if unicode.Is(cl, cur) { - if chr.inverted { - p.failAt(false, start.position, chr.val) - return nil, false - } - p.read() - p.failAt(true, start.position, chr.val) - return p.sliceFrom(start), true - } - } - - if chr.inverted { - p.read() - p.failAt(true, start.position, chr.val) - return p.sliceFrom(start), true - } - p.failAt(false, start.position, chr.val) - return nil, false -} - -func (p *parser) incChoiceAltCnt(ch *choiceExpr, altI int) { - choiceIdent := fmt.Sprintf("%s %d:%d", p.rstack[len(p.rstack)-1].name, ch.pos.line, ch.pos.col) - m := p.ChoiceAltCnt[choiceIdent] - if m == nil { - m = make(map[string]int) - p.ChoiceAltCnt[choiceIdent] = m - } - // We increment altI by 1, so the keys do not start at 0 - alt := strconv.Itoa(altI + 1) - if altI == choiceNoMatch { - alt = p.choiceNoMatch - } - m[alt]++ -} - -func (p *parser) parseChoiceExpr(ch *choiceExpr) (interface{}, bool) { - if p.debug { - defer p.out(p.in("parseChoiceExpr")) - } - - for altI, alt := range ch.alternatives { - // dummy assignment to prevent compile error if optimized - _ = altI - - state := p.cloneState() - - p.pushV() - val, ok := p.parseExpr(alt) - p.popV() - if ok { - p.incChoiceAltCnt(ch, altI) - return val, ok - } - p.restoreState(state) - } - p.incChoiceAltCnt(ch, choiceNoMatch) - return nil, false -} - -func (p *parser) parseLabeledExpr(lab *labeledExpr) (interface{}, bool) { - if p.debug { - defer p.out(p.in("parseLabeledExpr")) - } - - p.pushV() - val, ok := p.parseExpr(lab.expr) - p.popV() - if ok && lab.label != "" { - m := p.vstack[len(p.vstack)-1] - m[lab.label] = val - } - return val, ok -} - -func (p *parser) parseLitMatcher(lit *litMatcher) (interface{}, bool) { - if p.debug { - defer p.out(p.in("parseLitMatcher")) - } - - start := p.pt - for _, want := range lit.val { - cur := p.pt.rn - if lit.ignoreCase { - cur = unicode.ToLower(cur) - } - if cur != want { - p.failAt(false, start.position, lit.want) - p.restore(start) - return nil, false - } - p.read() - } - p.failAt(true, start.position, lit.want) - return p.sliceFrom(start), true -} - -func (p *parser) parseNotCodeExpr(not *notCodeExpr) (interface{}, bool) { - if p.debug { - defer p.out(p.in("parseNotCodeExpr")) - } - - state := p.cloneState() - - ok, err := not.run(p) - if err != nil { - p.addErr(err) - } - p.restoreState(state) - - return nil, !ok -} - -func (p *parser) parseNotExpr(not *notExpr) (interface{}, bool) { - if p.debug { - defer p.out(p.in("parseNotExpr")) - } - - pt := p.pt - state := p.cloneState() - p.pushV() - p.maxFailInvertExpected = !p.maxFailInvertExpected - _, ok := p.parseExpr(not.expr) - p.maxFailInvertExpected = !p.maxFailInvertExpected - p.popV() - p.restoreState(state) - p.restore(pt) - - return nil, !ok -} - -func (p *parser) parseOneOrMoreExpr(expr *oneOrMoreExpr) (interface{}, bool) { - if p.debug { - defer p.out(p.in("parseOneOrMoreExpr")) - } - - var vals []interface{} - - for { - p.pushV() - val, ok := p.parseExpr(expr.expr) - p.popV() - if !ok { - if len(vals) == 0 { - // did not match once, no match - return nil, false - } - return vals, true - } - vals = append(vals, val) - } -} - -func (p *parser) parseRecoveryExpr(recover *recoveryExpr) (interface{}, bool) { - if p.debug { - defer p.out(p.in("parseRecoveryExpr (" + strings.Join(recover.failureLabel, ",") + ")")) - } - - p.pushRecovery(recover.failureLabel, recover.recoverExpr) - val, ok := p.parseExpr(recover.expr) - p.popRecovery() - - return val, ok -} - -func (p *parser) parseRuleRefExpr(ref *ruleRefExpr) (interface{}, bool) { - if p.debug { - defer p.out(p.in("parseRuleRefExpr " + ref.name)) - } - - if ref.name == "" { - panic(fmt.Sprintf("%s: invalid rule: missing name", ref.pos)) - } - - rule := p.rules[ref.name] - if rule == nil { - p.addErr(fmt.Errorf("undefined rule: %s", ref.name)) - return nil, false - } - return p.parseRule(rule) -} - -func (p *parser) parseSeqExpr(seq *seqExpr) (interface{}, bool) { - if p.debug { - defer p.out(p.in("parseSeqExpr")) - } - - vals := make([]interface{}, 0, len(seq.exprs)) - - pt := p.pt - state := p.cloneState() - for _, expr := range seq.exprs { - val, ok := p.parseExpr(expr) - if !ok { - p.restoreState(state) - p.restore(pt) - return nil, false - } - vals = append(vals, val) - } - return vals, true -} - -func (p *parser) parseStateCodeExpr(state *stateCodeExpr) (interface{}, bool) { - if p.debug { - defer p.out(p.in("parseStateCodeExpr")) - } - - err := state.run(p) - if err != nil { - p.addErr(err) - } - return nil, true -} - -func (p *parser) parseThrowExpr(expr *throwExpr) (interface{}, bool) { - if p.debug { - defer p.out(p.in("parseThrowExpr")) - } - - for i := len(p.recoveryStack) - 1; i >= 0; i-- { - if recoverExpr, ok := p.recoveryStack[i][expr.label]; ok { - if val, ok := p.parseExpr(recoverExpr); ok { - return val, ok - } - } - } - - return nil, false -} - -func (p *parser) parseZeroOrMoreExpr(expr *zeroOrMoreExpr) (interface{}, bool) { - if p.debug { - defer p.out(p.in("parseZeroOrMoreExpr")) - } - - var vals []interface{} - - for { - p.pushV() - val, ok := p.parseExpr(expr.expr) - p.popV() - if !ok { - return vals, true - } - vals = append(vals, val) - } -} - -func (p *parser) parseZeroOrOneExpr(expr *zeroOrOneExpr) (interface{}, bool) { - if p.debug { - defer p.out(p.in("parseZeroOrOneExpr")) - } - - p.pushV() - val, _ := p.parseExpr(expr.expr) - p.popV() - // whether it matched or not, consider it a match - return val, true -} diff --git a/vendor/github.com/mmcloughlin/addchain/acc/parse/parse.go b/vendor/github.com/mmcloughlin/addchain/acc/parse/parse.go deleted file mode 100644 index 8523e1469..000000000 --- a/vendor/github.com/mmcloughlin/addchain/acc/parse/parse.go +++ /dev/null @@ -1,35 +0,0 @@ -// Package parse implements a parser for acc programs. -package parse - -import ( - "io" - "strings" - - "github.com/mmcloughlin/addchain/acc/ast" - "github.com/mmcloughlin/addchain/acc/parse/internal/parser" -) - -//go:generate pigeon -o internal/parser/zparser.go acc.peg - -// File parses filename. -func File(filename string) (*ast.Chain, error) { - return cast(parser.ParseFile(filename)) -} - -// Reader parses the data from r using filename as information in -// error messages. -func Reader(filename string, r io.Reader) (*ast.Chain, error) { - return cast(parser.ParseReader(filename, r)) -} - -// String parses s. -func String(s string) (*ast.Chain, error) { - return Reader("string", strings.NewReader(s)) -} - -func cast(i interface{}, err error) (*ast.Chain, error) { - if err != nil { - return nil, err - } - return i.(*ast.Chain), nil -} diff --git a/vendor/github.com/mmcloughlin/addchain/acc/pass/alloc.go b/vendor/github.com/mmcloughlin/addchain/acc/pass/alloc.go deleted file mode 100644 index 5c8e97d82..000000000 --- a/vendor/github.com/mmcloughlin/addchain/acc/pass/alloc.go +++ /dev/null @@ -1,98 +0,0 @@ -package pass - -import ( - "fmt" - - "github.com/mmcloughlin/addchain/acc/ir" - "github.com/mmcloughlin/addchain/internal/container/heap" - "github.com/mmcloughlin/addchain/internal/errutil" -) - -// Allocator pass assigns a minimal number of temporary variables to execute a program. -type Allocator struct { - // Input is the name of the input variable. Note this is index 0, or the - // identity element of the addition chain. - Input string - - // Output is the name to give to the final output of the addition chain. This - // variable may itself be used as a temporary during execution. - Output string - - // Format defines how to format any temporary variables. This format string - // must accept one integer value. For example "t%d" would be a reasonable - // choice. - Format string -} - -// Execute performs temporary variable allocation. -func (a Allocator) Execute(p *ir.Program) error { - // Canonicalize operands and delete all names. - if err := Exec(p, Func(CanonicalizeOperands), Func(ClearNames)); err != nil { - return err - } - - // Initialize allocation. This maps operand index to variable index. The - // inidicies 0 and 1 are special, reserved for the input and output - // respectively. Any indicies above that are temporaries. - out := p.Output() - allocation := map[int]int{ - 0: 0, - out.Index: 1, - } - n := 2 - - // Keep a heap of available indicies. Initially none. - available := heap.NewMinInts() - - // Process instructions in reverse. - for i := len(p.Instructions) - 1; i >= 0; i-- { - inst := p.Instructions[i] - - // The output operand variable now becomes available. - v, ok := allocation[inst.Output.Index] - if !ok { - return errutil.AssertionFailure("output operand %d missing allocation", inst.Output.Index) - } - available.Push(v) - - // Inputs may need variables, if they are not already live. - for _, input := range inst.Op.Inputs() { - _, ok := allocation[input.Index] - if ok { - continue - } - - // If there's nothing available, we'll need one more temporary. - if available.Empty() { - available.Push(n) - n++ - } - - allocation[input.Index] = available.Pop() - } - } - - // Record allocation. - for _, op := range p.Operands { - op.Identifier = a.name(allocation[op.Index]) - } - - temps := []string{} - for i := 2; i < n; i++ { - temps = append(temps, a.name(i)) - } - p.Temporaries = temps - - return nil -} - -func (a Allocator) name(v int) string { - switch v { - case 0: - return a.Input - case 1: - return a.Output - default: - return fmt.Sprintf(a.Format, v-2) - } -} diff --git a/vendor/github.com/mmcloughlin/addchain/acc/pass/eval.go b/vendor/github.com/mmcloughlin/addchain/acc/pass/eval.go deleted file mode 100644 index 2dd85b1dd..000000000 --- a/vendor/github.com/mmcloughlin/addchain/acc/pass/eval.go +++ /dev/null @@ -1,57 +0,0 @@ -package pass - -import ( - "errors" - - "github.com/mmcloughlin/addchain" - "github.com/mmcloughlin/addchain/acc/ir" - "github.com/mmcloughlin/addchain/internal/errutil" -) - -// Compile generates the fully unrolled sequence of additions. The result is -// stored in the Program field. -func Compile(p *ir.Program) error { - if p.Program != nil { - return nil - } - - p.Program = addchain.Program{} - for _, i := range p.Instructions { - var out int - var err error - - switch op := i.Op.(type) { - case ir.Add: - out, err = p.Program.Add(op.X.Index, op.Y.Index) - case ir.Double: - out, err = p.Program.Double(op.X.Index) - case ir.Shift: - out, err = p.Program.Shift(op.X.Index, op.S) - default: - return errutil.UnexpectedType(op) - } - - if err != nil { - return err - } - if out != i.Output.Index { - return errors.New("incorrect output index") - } - } - - return nil -} - -// Eval evaluates the program and places the result in the Chain field. -func Eval(p *ir.Program) error { - if p.Chain != nil { - return nil - } - - if err := Compile(p); err != nil { - return err - } - - p.Chain = p.Program.Evaluate() - return nil -} diff --git a/vendor/github.com/mmcloughlin/addchain/acc/pass/naming.go b/vendor/github.com/mmcloughlin/addchain/acc/pass/naming.go deleted file mode 100644 index e417ef1cf..000000000 --- a/vendor/github.com/mmcloughlin/addchain/acc/pass/naming.go +++ /dev/null @@ -1,89 +0,0 @@ -package pass - -import ( - "fmt" - "math/big" - - "github.com/mmcloughlin/addchain/acc/ir" - "github.com/mmcloughlin/addchain/internal/bigint" - "github.com/mmcloughlin/addchain/internal/errutil" -) - -// References: -// -// [curvechains] Brian Smith. The Most Efficient Known Addition Chains for Field Element and -// Scalar Inversion for the Most Popular and Most Unpopular Elliptic Curves. 2017. -// https://briansmith.org/ecc-inversion-addition-chains-01 (accessed June 30, 2019) - -// Naming conventions described in [curvechains]. -var ( - NameByteValues = NameBinaryValues(8, "_%b") - NameXRuns = NameBinaryRuns("x%d") -) - -// ClearNames deletes all operand names. -func ClearNames(p *ir.Program) error { - if err := CanonicalizeOperands(p); err != nil { - return err - } - - for _, operand := range p.Operands { - operand.Identifier = "" - } - - return nil -} - -// NameBinaryValues assigns variable names to operands with values less than 2ᵏ. -// The identifier is determined from the format string, which should expect to -// take one *big.Int argument. -func NameBinaryValues(k int, format string) Interface { - return NameOperands(func(_ int, x *big.Int) string { - if x.BitLen() > k { - return "" - } - return fmt.Sprintf(format, x) - }) -} - -// NameBinaryRuns assigns variable names to operands with values of the form 2ⁿ -// - 1. The identifier is determined from the format string, which takes the -// length of the run as a parameter. -func NameBinaryRuns(format string) Interface { - return NameOperands(func(_ int, x *big.Int) string { - n := uint(x.BitLen()) - if !bigint.Equal(x, bigint.Ones(n)) { - return "" - } - return fmt.Sprintf(format, n) - }) -} - -// NameOperands builds a pass that names operands according to the given scheme. -func NameOperands(name func(int, *big.Int) string) Interface { - return Func(func(p *ir.Program) error { - // We need canonical operands, and we need to know the chain values. - if err := Exec(p, Func(CanonicalizeOperands), Func(Eval)); err != nil { - return err - } - - for _, operand := range p.Operands { - // Skip if it already has a name. - if operand.Identifier != "" { - continue - } - - // Fetch referenced value. - idx := operand.Index - if idx >= len(p.Chain) { - return errutil.AssertionFailure("operand index %d out of bounds", idx) - } - x := p.Chain[idx] - - // Set name. - operand.Identifier = name(idx, x) - } - - return nil - }) -} diff --git a/vendor/github.com/mmcloughlin/addchain/acc/pass/pass.go b/vendor/github.com/mmcloughlin/addchain/acc/pass/pass.go deleted file mode 100644 index a9f1ee23d..000000000 --- a/vendor/github.com/mmcloughlin/addchain/acc/pass/pass.go +++ /dev/null @@ -1,117 +0,0 @@ -// Package pass implements analysis and processing passes on acc programs. -package pass - -import ( - "fmt" - - "github.com/mmcloughlin/addchain/acc/ir" - "github.com/mmcloughlin/addchain/internal/errutil" -) - -// Interface for a processing pass. -type Interface interface { - Execute(*ir.Program) error -} - -// Func adapts a function to the pass Interface. -type Func func(*ir.Program) error - -// Execute calls p. -func (f Func) Execute(p *ir.Program) error { - return f(p) -} - -// Concat returns a pass that executes the given passes in order, stopping on -// the first error. -func Concat(passes ...Interface) Interface { - return Func(func(p *ir.Program) error { - for _, pass := range passes { - if err := pass.Execute(p); err != nil { - return err - } - } - return nil - }) -} - -// Exec is a convenience for executing a list of passes on p. -func Exec(p *ir.Program, passes ...Interface) error { - return Concat(passes...).Execute(p) -} - -// CanonicalizeOperands ensures there is only one Operand object for each -// operand index in the program. In particular, this ensures there are not -// conflicting names for the same index. Populates the Operands field of the -// program. -func CanonicalizeOperands(p *ir.Program) error { - if p.Operands != nil { - return nil - } - - p.Operands = map[int]*ir.Operand{} - - // First pass through determines canonical operand for each index. - for _, i := range p.Instructions { - for _, operand := range i.Operands() { - // Look for an existing operand object for this index. - existing, found := p.Operands[operand.Index] - if !found { - p.Operands[operand.Index] = operand - continue - } - - if existing == operand { - continue - } - - // They're different objects. Check for a name conflict. - if existing.Identifier != "" && operand.Identifier != "" && existing.Identifier != operand.Identifier { - return fmt.Errorf("identifier conflict: index %d named %q and %q", operand.Index, operand.Identifier, existing.Identifier) - } - - if operand.Identifier != "" { - existing.Identifier = operand.Identifier - } - } - } - - // Second pass through replaces all operands with the canonical version. - for _, i := range p.Instructions { - switch op := i.Op.(type) { - case ir.Add: - i.Op = ir.Add{ - X: p.Operands[op.X.Index], - Y: p.Operands[op.Y.Index], - } - case ir.Double: - i.Op = ir.Double{ - X: p.Operands[op.X.Index], - } - case ir.Shift: - i.Op = ir.Shift{ - X: p.Operands[op.X.Index], - S: op.S, - } - default: - return errutil.UnexpectedType(op) - } - } - - return nil -} - -// ReadCounts computes how many times each index is read in the program. This -// populates the ReadCount field of the program. -func ReadCounts(p *ir.Program) error { - if p.ReadCount != nil { - return nil - } - - p.ReadCount = map[int]int{} - for _, i := range p.Instructions { - for _, input := range i.Op.Inputs() { - p.ReadCount[input.Index]++ - } - } - return nil -} diff --git a/vendor/github.com/mmcloughlin/addchain/acc/pass/validation.go b/vendor/github.com/mmcloughlin/addchain/acc/pass/validation.go deleted file mode 100644 index e93ba63c3..000000000 --- a/vendor/github.com/mmcloughlin/addchain/acc/pass/validation.go +++ /dev/null @@ -1,28 +0,0 @@ -package pass - -import ( - "fmt" - - "github.com/mmcloughlin/addchain/acc/ir" -) - -// Validate is a pass to sanity check an intermediate representation program. -var Validate = Func(CheckDanglingInputs) - -// CheckDanglingInputs looks for program inputs that have no instruction -// outputting them. Note this can happen and still be technically correct. For -// example a shift instruction produces many intermediate results, and one of -// these can later be referenced. The resulting program is still correct, but -// undesirable. -func CheckDanglingInputs(p *ir.Program) error { - outputset := map[int]bool{0: true} - for _, i := range p.Instructions { - for _, input := range i.Op.Inputs() { - if !outputset[input.Index] { - return fmt.Errorf("no output instruction for input index %d", input.Index) - } - } - outputset[i.Output.Index] = true - } - return nil -} diff --git a/vendor/github.com/mmcloughlin/addchain/acc/printer/printer.go b/vendor/github.com/mmcloughlin/addchain/acc/printer/printer.go deleted file mode 100644 index 96e8baa9f..000000000 --- a/vendor/github.com/mmcloughlin/addchain/acc/printer/printer.go +++ /dev/null @@ -1,131 +0,0 @@ -// Package printer implements printing of acc AST nodes. -package printer - -import ( - "bytes" - "io" - "os" - - "github.com/mmcloughlin/addchain/acc/ast" - "github.com/mmcloughlin/addchain/internal/errutil" - "github.com/mmcloughlin/addchain/internal/print" -) - -// String prints the AST and returns resulting string. -func String(n interface{}) (string, error) { - b, err := Bytes(n) - if err != nil { - return "", err - } - return string(b), nil -} - -// Bytes prints the AST and returns resulting bytes. -func Bytes(n interface{}) ([]byte, error) { - var buf bytes.Buffer - if err := Fprint(&buf, n); err != nil { - return nil, err - } - return buf.Bytes(), nil -} - -// Print an AST node to standard out. -func Print(n interface{}) error { - return Fprint(os.Stdout, n) -} - -// Fprint writes the AST node n to w. -func Fprint(w io.Writer, n interface{}) error { - p := newprinter(w) - p.node(n) - p.Flush() - return p.Error() -} - -type printer struct { - *print.TabWriter -} - -func newprinter(w io.Writer) *printer { - return &printer{ - TabWriter: print.NewTabWriter(w, 1, 4, 1, ' ', 0), - } -} - -func (p *printer) node(n interface{}) { - switch n := n.(type) { - case *ast.Chain: - for _, stmt := range n.Statements { - p.statement(stmt) - } - case ast.Statement: - p.statement(n) - case ast.Expr: - p.expr(n, nil) - default: - p.SetError(errutil.UnexpectedType(n)) - } -} - -func (p *printer) statement(stmt ast.Statement) { - if len(stmt.Name) > 0 { - p.Printf("%s\t=\t", stmt.Name) - } else { - p.Printf("return\t\t") - } - p.expr(stmt.Expr, nil) - p.NL() -} - -func (p *printer) expr(e, parent ast.Expr) { - // Parens required if the precence of this operator is less than its parent. - if parent != nil && e.Precedence() < parent.Precedence() { - p.Printf("(") - p.expr(e, nil) - p.Printf(")") - return - } - - switch e := e.(type) { - case ast.Operand: - p.operand(e) - case ast.Identifier: - p.identifier(e) - case ast.Add: - p.add(e) - case ast.Double: - p.double(e) - case ast.Shift: - p.shift(e) - default: - p.SetError(errutil.UnexpectedType(e)) - } -} - -func (p *printer) add(a ast.Add) { - p.expr(a.X, a) - p.Printf(" + ") - p.expr(a.Y, a) -} - -func (p *printer) double(d ast.Double) { - p.Printf("2*") - p.expr(d.X, d) -} - -func (p *printer) shift(s ast.Shift) { - p.expr(s.X, s) - p.Printf(" << %d", s.S) -} - -func (p *printer) identifier(name ast.Identifier) { - p.Printf("%s", name) -} - -func (p *printer) operand(op ast.Operand) { - if op == 0 { - p.Printf("1") - } else { - p.Printf("[%d]", op) - } -} diff --git a/vendor/github.com/mmcloughlin/addchain/acc/translate.go b/vendor/github.com/mmcloughlin/addchain/acc/translate.go deleted file mode 100644 index 91bfcf17e..000000000 --- a/vendor/github.com/mmcloughlin/addchain/acc/translate.go +++ /dev/null @@ -1,139 +0,0 @@ -package acc - -import ( - "fmt" - - "github.com/mmcloughlin/addchain/acc/ast" - "github.com/mmcloughlin/addchain/acc/ir" - "github.com/mmcloughlin/addchain/internal/errutil" -) - -// Translate converts an abstract syntax tree to an intermediate representation. -func Translate(c *ast.Chain) (*ir.Program, error) { - s := newstate() - for _, stmt := range c.Statements { - if err := s.statement(stmt); err != nil { - return nil, err - } - } - return s.prog, nil -} - -type state struct { - prog *ir.Program - n int - variable map[ast.Identifier]*ir.Operand -} - -func newstate() *state { - return &state{ - prog: &ir.Program{}, - n: 1, - variable: map[ast.Identifier]*ir.Operand{}, - } -} - -func (s *state) statement(stmt ast.Statement) error { - out, err := s.expr(stmt.Expr) - if err != nil { - return err - } - if err := s.define(stmt.Name, out); err != nil { - return err - } - return nil -} - -func (s *state) expr(expr ast.Expr) (*ir.Operand, error) { - switch e := expr.(type) { - case ast.Operand: - return &ir.Operand{Index: int(e)}, nil - case ast.Identifier: - return s.lookup(e) - case ast.Add: - return s.add(e) - case ast.Double: - return s.double(e) - case ast.Shift: - return s.shift(e) - default: - return nil, errutil.UnexpectedType(e) - } -} - -func (s *state) add(a ast.Add) (*ir.Operand, error) { - x, err := s.expr(a.X) - if err != nil { - return nil, err - } - - y, err := s.expr(a.Y) - if err != nil { - return nil, err - } - - if x.Index > y.Index { - x, y = y, x - } - - out := ir.Index(s.n) - inst := &ir.Instruction{ - Output: out, - Op: ir.Add{X: x, Y: y}, - } - s.prog.AddInstruction(inst) - s.n++ - - return out, nil -} - -func (s *state) double(d ast.Double) (*ir.Operand, error) { - x, err := s.expr(d.X) - if err != nil { - return nil, err - } - - out := ir.Index(s.n) - inst := &ir.Instruction{ - Output: out, - Op: ir.Double{X: x}, - } - s.prog.AddInstruction(inst) - s.n++ - - return out, nil -} - -func (s *state) shift(sh ast.Shift) (*ir.Operand, error) { - x, err := s.expr(sh.X) - if err != nil { - return nil, err - } - - s.n += int(sh.S) - out := ir.Index(s.n - 1) - inst := &ir.Instruction{ - Output: out, - Op: ir.Shift{X: x, S: sh.S}, - } - s.prog.AddInstruction(inst) - - return out, nil -} - -func (s *state) define(name ast.Identifier, op *ir.Operand) error { - if _, found := s.variable[name]; found { - return fmt.Errorf("cannot redefine %q", name) - } - op.Identifier = string(name) - s.variable[name] = op - return nil -} - -func (s state) lookup(name ast.Identifier) (*ir.Operand, error) { - operand, ok := s.variable[name] - if !ok { - return nil, fmt.Errorf("variable %q undefined", name) - } - return operand, nil -} diff --git a/vendor/github.com/mmcloughlin/addchain/alg/alg.go b/vendor/github.com/mmcloughlin/addchain/alg/alg.go deleted file mode 100644 index 0555dacb0..000000000 --- a/vendor/github.com/mmcloughlin/addchain/alg/alg.go +++ /dev/null @@ -1,43 +0,0 @@ -// Package alg provides base types for addition chain and addition sequence search algorithms. -package alg - -import ( - "math/big" - - "github.com/mmcloughlin/addchain" -) - -// ChainAlgorithm is a method of generating an addition chain for a target integer. -type ChainAlgorithm interface { - // FindChain generates an addition chain ending at target. - FindChain(target *big.Int) (addchain.Chain, error) - - // String returns a name for the algorithm. - String() string -} - -// SequenceAlgorithm is a method of generating an addition sequence for a set of -// target values. -type SequenceAlgorithm interface { - // FindSequence generates an addition chain containing every element of targets. - FindSequence(targets []*big.Int) (addchain.Chain, error) - - // String returns a name for the algorithm. - String() string -} - -// AsChainAlgorithm adapts a sequence algorithm to a chain algorithm. The -// resulting algorithm calls the sequence algorithm with a singleton list -// containing the target. -func AsChainAlgorithm(s SequenceAlgorithm) ChainAlgorithm { - return asChainAlgorithm{s} -} - -type asChainAlgorithm struct { - SequenceAlgorithm -} - -// FindChain calls FindSequence with a singleton list containing the target. -func (a asChainAlgorithm) FindChain(target *big.Int) (addchain.Chain, error) { - return a.FindSequence([]*big.Int{target}) -} diff --git a/vendor/github.com/mmcloughlin/addchain/alg/contfrac/contfrac.go b/vendor/github.com/mmcloughlin/addchain/alg/contfrac/contfrac.go deleted file mode 100644 index 3c31a5383..000000000 --- a/vendor/github.com/mmcloughlin/addchain/alg/contfrac/contfrac.go +++ /dev/null @@ -1,262 +0,0 @@ -// Package contfrac implements addition sequence algorithms based on continued-fraction expansions. -package contfrac - -import ( - "fmt" - "math/big" - - "github.com/mmcloughlin/addchain" - "github.com/mmcloughlin/addchain/internal/bigint" - "github.com/mmcloughlin/addchain/internal/bigints" -) - -// References: -// -// [contfrac] F Bergeron, J Berstel, S Brlek and C Duboc. Addition chains using continued -// fractions. Journal of Algorithms. 1989. -// http://www-igm.univ-mlv.fr/~berstel/Articles/1989AdditionChainDuboc.pdf -// [efficientcompaddchain] Bergeron, F., Berstel, J. and Brlek, S. Efficient computation of addition -// chains. Journal de theorie des nombres de Bordeaux. 1994. -// http://www.numdam.org/item/JTNB_1994__6_1_21_0 -// [gencontfrac] Amadou Tall and Ali Yassin Sanghare. Efficient computation of -// addition-subtraction chains using generalized continued Fractions. Cryptology -// ePrint Archive, Report 2013/466. 2013. https://eprint.iacr.org/2013/466 -// [hehcc:exp] Christophe Doche. Exponentiation. Handbook of Elliptic and Hyperelliptic Curve -// Cryptography, chapter 9. 2006. -// http://koclab.cs.ucsb.edu/teaching/ecc/eccPapers/Doche-ch09.pdf - -// Strategy is a method of choosing the auxiliary integer k in the continued -// fraction method outlined in [efficientcompaddchain]. -type Strategy interface { - // K returns values of k to try given n. - K(n *big.Int) []*big.Int - - // Singleton returns whether every call to K will return one value of k. This - // determines whether the resulting continued fractions sequence algorithm will - // be logarithmic, and therefore suitable for large inputs. - Singleton() bool - - // String returns a name for the strategy. - String() string -} - -// Strategies lists all available continued fraction strategies. -var Strategies = []Strategy{ - BinaryStrategy{}, - CoBinaryStrategy{}, - DichotomicStrategy{}, - SqrtStrategy{}, - TotalStrategy{}, - DyadicStrategy{}, - FermatStrategy{}, -} - -// Algorithm uses the continued fractions method for finding an addition chain -// [contfrac] [efficientcompaddchain]. -type Algorithm struct { - strategy Strategy -} - -// NewAlgorithm builds a continued fractions addition sequence algorithm using -// the provided strategy for selecting the auziallary integer k. -func NewAlgorithm(s Strategy) Algorithm { - return Algorithm{ - strategy: s, - } -} - -func (a Algorithm) String() string { - return fmt.Sprintf("continued_fractions(%s)", a.strategy) -} - -// FindSequence applies the continued fractions method to build a chain -// containing targets. -func (a Algorithm) FindSequence(targets []*big.Int) (addchain.Chain, error) { - bigints.Sort(targets) - return a.chain(targets), nil -} - -func (a Algorithm) minchain(n *big.Int) addchain.Chain { - if bigint.IsPow2(n) { - return bigint.Pow2UpTo(n) - } - - if bigint.EqualInt64(n, 3) { - return bigints.Int64s(1, 2, 3) - } - - var min addchain.Chain - for _, k := range a.strategy.K(n) { - c := a.chain([]*big.Int{k, n}) - if min == nil || len(c) < len(min) { - min = c - } - } - - return min -} - -// chain produces a continued fraction chain for the given values. The slice ns -// must be in ascending order. -func (a Algorithm) chain(ns []*big.Int) addchain.Chain { - k := len(ns) - if k == 1 || ns[k-2].Cmp(bigint.One()) <= 0 { - return a.minchain(ns[k-1]) - } - - q, r := new(big.Int), new(big.Int) - q.DivMod(ns[k-1], ns[k-2], r) - - cq := a.minchain(q) - remaining := bigints.Clone(ns[:k-1]) - - if bigint.IsZero(r) { - return addchain.Product(a.chain(remaining), cq) - } - - remaining = bigints.InsertSortedUnique(remaining, r) - return addchain.Plus(addchain.Product(a.chain(remaining), cq), r) -} - -// BinaryStrategy implements the binary strategy, which just sets k = floor(n/2). See [efficientcompaddchain] page 26. -// Since this is a singleton strategy it gives rise to a logarithmic sequence algoirithm that may not be optimal. -type BinaryStrategy struct{} - -func (BinaryStrategy) String() string { return "binary" } - -// Singleton returns true, since the binary strategy returns a single proposal -// for k. -func (BinaryStrategy) Singleton() bool { return true } - -// K returns floor(n/2). -func (BinaryStrategy) K(n *big.Int) []*big.Int { - k := new(big.Int).Rsh(n, 1) - return []*big.Int{k} -} - -// CoBinaryStrategy implements the co-binary strategy, also referred to as the -// "modified-binary" strategy. See [efficientcompaddchain] page 26 or -// [gencontfrac] page 6. Since this is a singleton strategy it gives rise to a -// logarithmic sequence algorithm that may not be optimal. -type CoBinaryStrategy struct{} - -func (CoBinaryStrategy) String() string { return "co_binary" } - -// Singleton returns true, since the co-binary strategy returns a single -// proposal for k. -func (CoBinaryStrategy) Singleton() bool { return true } - -// K returns floor(n/2) when n is even, or floor((n+1)/2) when n is odd. -func (CoBinaryStrategy) K(n *big.Int) []*big.Int { - k := bigint.Clone(n) - if k.Bit(0) == 1 { - k.Add(k, bigint.One()) - } - k.Rsh(k, 1) - return []*big.Int{k} -} - -// TotalStrategy returns all possible values of k less than n. This will result -// in the optimal continued fraction chain at a complexity of O(n² log²(n)). -// Note that the optimal continued fraction chain is not necessarily the optimal -// chain. Must not be used for large inputs. -type TotalStrategy struct{} - -func (TotalStrategy) String() string { return "total" } - -// Singleton returns false, since the total strategy returns more than once k. -func (TotalStrategy) Singleton() bool { return false } - -// K returns {2,, 3, ..., n-1}. -func (TotalStrategy) K(n *big.Int) []*big.Int { - ks := []*big.Int{} - k := big.NewInt(2) - one := bigint.One() - for k.Cmp(n) < 0 { - ks = append(ks, bigint.Clone(k)) - k.Add(k, one) - } - return ks -} - -// DyadicStrategy implements the Dyadic Strategy, defined in -// [efficientcompaddchain] page 28. This gives rise to a sequence algorithm with -// complexity O(n*log³(n)). Must not be used for large inputs. -type DyadicStrategy struct{} - -func (DyadicStrategy) String() string { return "dyadic" } - -// Singleton returns false, since the dyadic strategy returns more than once k. -func (DyadicStrategy) Singleton() bool { return false } - -// K returns floor( n / 2ʲ ) for all j. -func (DyadicStrategy) K(n *big.Int) []*big.Int { - ks := []*big.Int{} - k := new(big.Int).Rsh(n, 1) - one := bigint.One() - for k.Cmp(one) > 0 { - ks = append(ks, bigint.Clone(k)) - k.Rsh(k, 1) - } - return ks -} - -// FermatStrategy implements Fermat's Strategy, defined in -// [efficientcompaddchain] page 28. This returns a set of possible k of size -// O(log(log(n))), giving rise to a faster algorithm than the Dyadic strategy. -// This has been shown to be near optimal for small inputs. Must not be used for -// large inputs. -type FermatStrategy struct{} - -func (FermatStrategy) String() string { return "fermat" } - -// Singleton returns false, since Fermat's strategy returns more than once k. -func (FermatStrategy) Singleton() bool { return false } - -// K returns floor( n / 2^(2^j) ) for all j. -func (FermatStrategy) K(n *big.Int) []*big.Int { - ks := []*big.Int{} - k := new(big.Int).Rsh(n, 1) - one := bigint.One() - s := uint(1) - for k.Cmp(one) > 0 { - ks = append(ks, bigint.Clone(k)) - k.Rsh(k, s) - s *= 2 - } - return ks -} - -// DichotomicStrategy is a singleton strategy, defined in -// [efficientcompaddchain] page 28. This gives rise to a logarithmic sequence -// algorithm, but the result is not necessarily optimal. -type DichotomicStrategy struct{} - -func (DichotomicStrategy) String() string { return "dichotomic" } - -// Singleton returns true, since the dichotomic strategy suggests just one k. -func (DichotomicStrategy) Singleton() bool { return true } - -// K returns only one suggestion for k, namely floor( n / 2ʰ ) where h = log2(n)/2. -func (DichotomicStrategy) K(n *big.Int) []*big.Int { - l := n.BitLen() - h := uint(l) / 2 - k := new(big.Int).Div(n, bigint.Pow2(h)) - return []*big.Int{k} -} - -// SqrtStrategy chooses k to be floor(sqrt(n)). See [gencontfrac] page 6. Since -// this is a singleton strategy, it gives rise to a logarithmic sequence -// algorithm that's not necessarily optimal. -type SqrtStrategy struct{} - -func (SqrtStrategy) String() string { return "sqrt" } - -// Singleton returns true, since the square root strategy suggests just one k. -func (SqrtStrategy) Singleton() bool { return false } - -// K returns floor(sqrt(n)). -func (SqrtStrategy) K(n *big.Int) []*big.Int { - sqrt := new(big.Int).Sqrt(n) - return []*big.Int{sqrt} -} diff --git a/vendor/github.com/mmcloughlin/addchain/alg/dict/dict.go b/vendor/github.com/mmcloughlin/addchain/alg/dict/dict.go deleted file mode 100644 index 08a1fa0e0..000000000 --- a/vendor/github.com/mmcloughlin/addchain/alg/dict/dict.go +++ /dev/null @@ -1,434 +0,0 @@ -// Package dict implements dictionary and run-length addition chain algorithms. -package dict - -import ( - "errors" - "fmt" - "math/big" - "sort" - - "github.com/mmcloughlin/addchain" - "github.com/mmcloughlin/addchain/alg" - "github.com/mmcloughlin/addchain/internal/bigint" - "github.com/mmcloughlin/addchain/internal/bigints" - "github.com/mmcloughlin/addchain/internal/bigvector" -) - -// References: -// -// [braueraddsubchains] Martin Otto. Brauer addition-subtraction chains. PhD thesis, Universitat -// Paderborn. 2001. -// http://www.martin-otto.de/publications/docs/2001_MartinOtto_Diplom_BrauerAddition-SubtractionChains.pdf -// [genshortchains] Kunihiro, Noboru and Yamamoto, Hirosuke. New Methods for Generating Short -// Addition Chains. IEICE Transactions on Fundamentals of Electronics -// Communications and Computer Sciences. 2000. -// https://pdfs.semanticscholar.org/b398/d10faca35af9ce5a6026458b251fd0a5640c.pdf -// [hehcc:exp] Christophe Doche. Exponentiation. Handbook of Elliptic and Hyperelliptic Curve -// Cryptography, chapter 9. 2006. -// http://koclab.cs.ucsb.edu/teaching/ecc/eccPapers/Doche-ch09.pdf - -// Term represents the integer D * 2ᴱ. -type Term struct { - D *big.Int - E uint -} - -// Int converts the term to an integer. -func (t Term) Int() *big.Int { - return new(big.Int).Lsh(t.D, t.E) -} - -// Sum is the representation of an integer as a sum of dictionary terms. See -// [hehcc:exp] definition 9.34. -type Sum []Term - -// Int computes the dictionary sum as an integer. -func (s Sum) Int() *big.Int { - x := bigint.Zero() - for _, t := range s { - x.Add(x, t.Int()) - } - return x -} - -// SortByExponent sorts terms in ascending order of the exponent E. -func (s Sum) SortByExponent() { - sort.Slice(s, func(i, j int) bool { return s[i].E < s[j].E }) -} - -// Dictionary returns the distinct D values in the terms of this sum. The values -// are returned in ascending order. -func (s Sum) Dictionary() []*big.Int { - dict := make([]*big.Int, 0, len(s)) - for _, t := range s { - dict = append(dict, t.D) - } - bigints.Sort(dict) - return bigints.Unique(dict) -} - -// Decomposer is a method of breaking an integer into a dictionary sum. -type Decomposer interface { - Decompose(x *big.Int) Sum - String() string -} - -// FixedWindow breaks integers into k-bit windows. -type FixedWindow struct { - K uint // Window size. -} - -func (w FixedWindow) String() string { return fmt.Sprintf("fixed_window(%d)", w.K) } - -// Decompose represents x in terms of k-bit windows from left to right. -func (w FixedWindow) Decompose(x *big.Int) Sum { - sum := Sum{} - h := x.BitLen() - for h > 0 { - l := max(h-int(w.K), 0) - d := bigint.Extract(x, uint(l), uint(h)) - if bigint.IsNonZero(d) { - sum = append(sum, Term{D: d, E: uint(l)}) - } - h = l - } - sum.SortByExponent() - return sum -} - -// SlidingWindow breaks integers into k-bit windows, skipping runs of zeros -// where possible. See [hehcc:exp] section 9.1.3 or [braueraddsubchains] section -// 1.2.3. -type SlidingWindow struct { - K uint // Window size. -} - -func (w SlidingWindow) String() string { return fmt.Sprintf("sliding_window(%d)", w.K) } - -// Decompose represents x in base 2ᵏ. -func (w SlidingWindow) Decompose(x *big.Int) Sum { - sum := Sum{} - h := x.BitLen() - 1 - for h >= 0 { - // Find first 1. - for h >= 0 && x.Bit(h) == 0 { - h-- - } - - if h < 0 { - break - } - - // Look down k positions. - l := max(h-int(w.K)+1, 0) - - // Advance to the next 1. - for x.Bit(l) == 0 { - l++ - } - - sum = append(sum, Term{ - D: bigint.Extract(x, uint(l), uint(h+1)), - E: uint(l), - }) - - h = l - 1 - } - sum.SortByExponent() - return sum -} - -// RunLength decomposes integers in to runs of 1s up to a maximal length. See -// [genshortchains] Section 3.1. -type RunLength struct { - T uint // Maximal run length. Zero means no limit. -} - -func (r RunLength) String() string { return fmt.Sprintf("run_length(%d)", r.T) } - -// Decompose breaks x into runs of 1 bits. -func (r RunLength) Decompose(x *big.Int) Sum { - sum := Sum{} - i := x.BitLen() - 1 - for i >= 0 { - // Find first 1. - for i >= 0 && x.Bit(i) == 0 { - i-- - } - - if i < 0 { - break - } - - // Look for the end of the run. - s := i - for i >= 0 && x.Bit(i) == 1 && (r.T == 0 || uint(s-i) < r.T) { - i-- - } - - // We have a run from s to i+1. - sum = append(sum, Term{ - D: bigint.Ones(uint(s - i)), - E: uint(i + 1), - }) - } - sum.SortByExponent() - return sum -} - -// Hybrid is a mix of the sliding window and run length decomposition methods, -// similar to the "Hybrid Method" of [genshortchains] Section 3.3. -type Hybrid struct { - K uint // Window size. - T uint // Maximal run length. Zero means no limit. -} - -func (h Hybrid) String() string { return fmt.Sprintf("hybrid(%d,%d)", h.K, h.T) } - -// Decompose breaks x into k-bit sliding windows or runs of 1s up to length T. -func (h Hybrid) Decompose(x *big.Int) Sum { - sum := Sum{} - - // Clone since we'll be modifying it. - y := bigint.Clone(x) - - // Process runs of length at least K. - i := y.BitLen() - 1 - for i >= 0 { - // Find first 1. - for i >= 0 && y.Bit(i) == 0 { - i-- - } - - if i < 0 { - break - } - - // Look for the end of the run. - s := i - for i >= 0 && y.Bit(i) == 1 && (h.T == 0 || uint(s-i) < h.T) { - i-- - } - - // We have a run from s to i+1. Skip it if its short. - n := uint(s - i) - if n <= h.K { - continue - } - - // Add it to the sum and remove it from the integer. - sum = append(sum, Term{ - D: bigint.Ones(n), - E: uint(i + 1), - }) - - y.Xor(y, bigint.Mask(uint(i+1), uint(s+1))) - } - - // Process what remains with a sliding window. - w := SlidingWindow{K: h.K} - rem := w.Decompose(y) - - sum = append(sum, rem...) - sum.SortByExponent() - - return sum -} - -// Algorithm implements a general dictionary-based chain construction algorithm, -// as in [braueraddsubchains] Algorithm 1.26. This operates in three stages: -// decompose the target into a sum of dictionray terms, use a sequence algorithm -// to generate the dictionary, then construct the target from the dictionary -// terms. -type Algorithm struct { - decomp Decomposer - seqalg alg.SequenceAlgorithm -} - -// NewAlgorithm builds a dictionary algorithm that breaks up integers using the -// decomposer d and uses the sequence algorithm s to generate dictionary -// entries. -func NewAlgorithm(d Decomposer, a alg.SequenceAlgorithm) *Algorithm { - return &Algorithm{ - decomp: d, - seqalg: a, - } -} - -func (a Algorithm) String() string { - return fmt.Sprintf("dictionary(%s,%s)", a.decomp, a.seqalg) -} - -// FindChain builds an addition chain producing n. This works by using the -// configured Decomposer to represent n as a sum of dictionary terms, then -// delegating to the SequenceAlgorithm to build a chain producing the -// dictionary, and finally using the dictionary terms to construct n. See -// [genshortchains] Section 2 for a full description. -func (a Algorithm) FindChain(n *big.Int) (addchain.Chain, error) { - // Decompose the target. - sum := a.decomp.Decompose(n) - sum.SortByExponent() - - // Extract dictionary. - dict := sum.Dictionary() - - // Use the sequence algorithm to produce a chain for each element of the dictionary. - c, err := a.seqalg.FindSequence(dict) - if err != nil { - return nil, err - } - - // Reduce. - sum, c, err = primitive(sum, c) - if err != nil { - return nil, err - } - - // Build chain for n out of the dictionary. - dc := dictsumchain(sum) - c = append(c, dc...) - bigints.Sort(c) - c = addchain.Chain(bigints.Unique(c)) - - return c, nil -} - -// dictsumchain builds a chain for the integer represented by sum, assuming that -// all the terms of the sum are already present. Therefore this is intended to -// be appended to a chain that already contains the dictionary terms. -func dictsumchain(sum Sum) addchain.Chain { - c := addchain.Chain{} - k := len(sum) - 1 - cur := bigint.Clone(sum[k].D) - for ; k > 0; k-- { - // Shift until the next exponent. - for i := sum[k].E; i > sum[k-1].E; i-- { - cur.Lsh(cur, 1) - c.AppendClone(cur) - } - - // Add in the dictionary term at this position. - cur.Add(cur, sum[k-1].D) - c.AppendClone(cur) - } - - for i := sum[0].E; i > 0; i-- { - cur.Lsh(cur, 1) - c.AppendClone(cur) - } - - return c -} - -// primitive removes terms from the dictionary that are only required once. -// -// The general structure of dictionary based algorithm is to decompose the -// target into a sum of dictionary terms, then create a chain for the -// dictionary, and then create the target from that. In a case where a -// dictionary term is only required once in the target, this can cause extra -// work. In such a case, we will spend operations on creating the dictionary -// term independently, and then later add it into the result. Since it is only -// needed once, we can effectively construct the dictionary term "on the fly" as -// we build up the final target. -// -// This function looks for such opportunities. If it finds them it will produce -// an alternative dictionary sum that replaces that term with a sum of smaller -// terms. -func primitive(sum Sum, c addchain.Chain) (Sum, addchain.Chain, error) { - // This optimization cannot apply if the sum has only one term. - if len(sum) == 1 { - return sum, c, nil - } - - n := len(c) - - // We'll need a mapping from chain elements to where they appear in the chain. - idx := map[string]int{} - for i, x := range c { - idx[x.String()] = i - } - - // Build program for the chain. - p, err := c.Program() - if err != nil { - return nil, nil, err - } - - // How many times is each index read during construction, and during its use in the dictionary chain. - reads := p.ReadCounts() - - for _, t := range sum { - i := idx[t.D.String()] - reads[i]++ - } - - // Now, the primitive dictionary elements are those that are read at least twice, and their dependencies. - deps := p.Dependencies() - primitive := make([]bool, n) - - for i, numreads := range reads { - if numreads < 2 { - continue - } - primitive[i] = true - for _, j := range bigint.BitsSet(deps[i]) { - primitive[j] = true - } - } - - // Express every position in the chain as a linear combination of dictionary - // terms that are used more than once. - vc := []bigvector.Vector{bigvector.NewBasis(n, 0)} - for i, op := range p { - var next bigvector.Vector - if primitive[i+1] { - next = bigvector.NewBasis(n, i+1) - } else { - next = bigvector.Add(vc[op.I], vc[op.J]) - } - vc = append(vc, next) - } - - // Now express the target sum in terms that are used more than once. - v := bigvector.New(n) - for _, t := range sum { - i := idx[t.D.String()] - v = bigvector.Add(v, bigvector.Lsh(vc[i], t.E)) - } - - // Rebuild this into a dictionary sum. - out := Sum{} - for i := 0; i < v.Len(); i++ { - for _, e := range bigint.BitsSet(v.Idx(i)) { - out = append(out, Term{ - D: c[i], - E: uint(e), - }) - } - } - - out.SortByExponent() - - // We should have not changed the sum. - if !bigint.Equal(out.Int(), sum.Int()) { - return nil, nil, errors.New("reconstruction does not match") - } - - // Prune any elements of the chain that are used only once. - pruned := addchain.Chain{} - for i, x := range c { - if primitive[i] { - pruned = append(pruned, x) - } - } - - return out, pruned, nil -} - -// max returns the maximum of a and b. -func max(a, b int) int { - if a > b { - return a - } - return b -} diff --git a/vendor/github.com/mmcloughlin/addchain/alg/dict/runs.go b/vendor/github.com/mmcloughlin/addchain/alg/dict/runs.go deleted file mode 100644 index 5277be476..000000000 --- a/vendor/github.com/mmcloughlin/addchain/alg/dict/runs.go +++ /dev/null @@ -1,108 +0,0 @@ -package dict - -import ( - "errors" - "fmt" - "math/big" - - "github.com/mmcloughlin/addchain" - "github.com/mmcloughlin/addchain/alg" - "github.com/mmcloughlin/addchain/internal/bigint" - "github.com/mmcloughlin/addchain/internal/bigints" -) - -// RunsAlgorithm is a custom variant of the dictionary approach that decomposes -// a target into runs of ones. It leverages the observation that building a -// dictionary consisting of runs of 1s of lengths l₁, l₂, ..., l_k can itself -// be reduced to first finding an addition chain for the run lengths. Then from -// this chain we can build a chain for the runs themselves. -type RunsAlgorithm struct { - seqalg alg.SequenceAlgorithm -} - -// NewRunsAlgorithm constructs a RunsAlgorithm using the given sequence -// algorithm to generate addition sequences for run lengths. Note that since run -// lengths are far smaller than the integers themselves, this sequence algorithm -// does not need to be able to handle large integers. -func NewRunsAlgorithm(a alg.SequenceAlgorithm) *RunsAlgorithm { - return &RunsAlgorithm{ - seqalg: a, - } -} - -func (a RunsAlgorithm) String() string { - return fmt.Sprintf("runs(%s)", a.seqalg) -} - -// FindChain uses the run lengths method to find a chain for n. -func (a RunsAlgorithm) FindChain(n *big.Int) (addchain.Chain, error) { - // Find the runs in n. - d := RunLength{T: 0} - sum := d.Decompose(n) - runs := sum.Dictionary() - - // Treat the run lengths themselves as a sequence to be solved. - lengths := []*big.Int{} - for _, run := range runs { - length := int64(run.BitLen()) - lengths = append(lengths, big.NewInt(length)) - } - - // Delegate to the sequence algorithm for a solution. - lc, err := a.seqalg.FindSequence(lengths) - if err != nil { - return nil, err - } - - // Build a dictionary chain from this. - c, err := RunsChain(lc) - if err != nil { - return nil, err - } - - // Reduce. - sum, c, err = primitive(sum, c) - if err != nil { - return nil, err - } - - // Build chain for n out of the dictionary. - dc := dictsumchain(sum) - c = append(c, dc...) - bigints.Sort(c) - c = addchain.Chain(bigints.Unique(c)) - - return c, nil -} - -// RunsChain takes a chain for the run lengths and generates a chain for the -// runs themselves. That is, if the provided chain is l₁, l₂, ..., l_k then -// the result will contain r(l₁), r(l₂), ..., r(l_k) where r(n) = 2ⁿ - 1. -func RunsChain(lc addchain.Chain) (addchain.Chain, error) { - p, err := lc.Program() - if err != nil { - return nil, err - } - - c := addchain.New() - s := map[uint]uint{} // current largest shift of each run length - for _, op := range p { - a, b := bigint.MinMax(lc[op.I], lc[op.J]) - if !a.IsUint64() || !b.IsUint64() { - return nil, errors.New("values in lengths chain are far too large") - } - - la := uint(a.Uint64()) - lb := uint(b.Uint64()) - - rb := bigint.Ones(lb) - for ; s[lb] < la; s[lb]++ { - shift := new(big.Int).Lsh(rb, s[lb]+1) - c = append(c, shift) - } - - c = append(c, bigint.Ones(la+lb)) - } - - return c, nil -} diff --git a/vendor/github.com/mmcloughlin/addchain/alg/ensemble/ensemble.go b/vendor/github.com/mmcloughlin/addchain/alg/ensemble/ensemble.go deleted file mode 100644 index f84a26267..000000000 --- a/vendor/github.com/mmcloughlin/addchain/alg/ensemble/ensemble.go +++ /dev/null @@ -1,71 +0,0 @@ -// Package ensemble provides a collection of addition chain algorithms intended -// for target integers of cryptographic interest. -package ensemble - -import ( - "github.com/mmcloughlin/addchain/alg" - "github.com/mmcloughlin/addchain/alg/contfrac" - "github.com/mmcloughlin/addchain/alg/dict" - "github.com/mmcloughlin/addchain/alg/heuristic" - "github.com/mmcloughlin/addchain/alg/opt" -) - -// Ensemble is a convenience for building an ensemble of chain algorithms intended for large integers. -func Ensemble() []alg.ChainAlgorithm { - // Choose sequence algorithms. - seqalgs := []alg.SequenceAlgorithm{ - heuristic.NewAlgorithm(heuristic.UseFirst( - heuristic.Halving{}, - heuristic.DeltaLargest{}, - )), - heuristic.NewAlgorithm(heuristic.UseFirst( - heuristic.Halving{}, - heuristic.Approximation{}, - )), - } - - for _, strategy := range contfrac.Strategies { - if strategy.Singleton() { - seqalgs = append(seqalgs, contfrac.NewAlgorithm(strategy)) - } - } - - // Build decomposers. - decomposers := []dict.Decomposer{} - for k := uint(4); k <= 128; k *= 2 { - decomposers = append(decomposers, dict.SlidingWindow{K: k}) - } - - decomposers = append(decomposers, dict.RunLength{T: 0}) - for t := uint(16); t <= 128; t *= 2 { - decomposers = append(decomposers, dict.RunLength{T: t}) - } - - for k := uint(2); k <= 8; k++ { - decomposers = append(decomposers, dict.Hybrid{K: k, T: 0}) - for t := uint(16); t <= 64; t *= 2 { - decomposers = append(decomposers, dict.Hybrid{K: k, T: t}) - } - } - - // Build dictionary algorithms for every combination. - as := []alg.ChainAlgorithm{} - for _, decomp := range decomposers { - for _, seqalg := range seqalgs { - a := dict.NewAlgorithm(decomp, seqalg) - as = append(as, a) - } - } - - // Add the runs algorithms. - for _, seqalg := range seqalgs { - as = append(as, dict.NewRunsAlgorithm(seqalg)) - } - - // Wrap in an optimization layer. - for i, a := range as { - as[i] = opt.Algorithm{Algorithm: a} - } - - return as -} diff --git a/vendor/github.com/mmcloughlin/addchain/alg/exec/exec.go b/vendor/github.com/mmcloughlin/addchain/alg/exec/exec.go deleted file mode 100644 index 731aa29e1..000000000 --- a/vendor/github.com/mmcloughlin/addchain/alg/exec/exec.go +++ /dev/null @@ -1,99 +0,0 @@ -// Package exec implements addition chain algorithm execution. -package exec - -import ( - "errors" - "io/ioutil" - "log" - "math/big" - "runtime" - - "github.com/mmcloughlin/addchain" - "github.com/mmcloughlin/addchain/alg" - "github.com/mmcloughlin/addchain/internal/bigint" -) - -// Result from applying an algorithm to a target. -type Result struct { - Target *big.Int - Algorithm alg.ChainAlgorithm - Err error - Chain addchain.Chain - Program addchain.Program -} - -// Execute the algorithm on the target number n. -func Execute(n *big.Int, a alg.ChainAlgorithm) Result { - r := Result{ - Target: n, - Algorithm: a, - } - - r.Chain, r.Err = a.FindChain(n) - if r.Err != nil { - return r - } - - // Note this also performs validation. - r.Program, r.Err = r.Chain.Program() - if r.Err != nil { - return r - } - - // Still, verify that it produced what we wanted. - if !bigint.Equal(r.Chain.End(), n) { - r.Err = errors.New("did not produce the required value") - } - - return r -} - -// Parallel executes multiple algorithms in parallel. -type Parallel struct { - limit int - logger *log.Logger -} - -// NewParallel builds a new parallel executor. -func NewParallel() *Parallel { - return &Parallel{ - limit: runtime.NumCPU(), - logger: log.New(ioutil.Discard, "", 0), - } -} - -// SetConcurrency sets the number of algorithms that may be run in parallel. -func (p *Parallel) SetConcurrency(limit int) { - p.limit = limit -} - -// SetLogger sets logging output. -func (p *Parallel) SetLogger(l *log.Logger) { - p.logger = l -} - -// Execute all algorithms against the provided target. -func (p Parallel) Execute(n *big.Int, as []alg.ChainAlgorithm) []Result { - rs := make([]Result, len(as)) - - // Use buffered channel to limit concurrency. - type token struct{} - sem := make(chan token, p.limit) - - for i, a := range as { - sem <- token{} - go func(i int, a alg.ChainAlgorithm) { - p.logger.Printf("start: %s", a) - rs[i] = Execute(n, a) - p.logger.Printf("done: %s", a) - <-sem - }(i, a) - } - - // Wait for completion. - for i := 0; i < p.limit; i++ { - sem <- token{} - } - - return rs -} diff --git a/vendor/github.com/mmcloughlin/addchain/alg/heuristic/heuristic.go b/vendor/github.com/mmcloughlin/addchain/alg/heuristic/heuristic.go deleted file mode 100644 index 94abb6400..000000000 --- a/vendor/github.com/mmcloughlin/addchain/alg/heuristic/heuristic.go +++ /dev/null @@ -1,234 +0,0 @@ -// Package heuristic implements heuristic-based addition sequence algorithms -// with the Bos-Coster Makesequence structure. -package heuristic - -import ( - "errors" - "fmt" - "math/big" - "strings" - - "github.com/mmcloughlin/addchain" - "github.com/mmcloughlin/addchain/internal/bigint" - "github.com/mmcloughlin/addchain/internal/bigints" -) - -// References: -// -// [boscoster] Bos, Jurjen and Coster, Matthijs. Addition Chain Heuristics. In Advances in -// Cryptology --- CRYPTO' 89 Proceedings, pages 400--407. 1990. -// https://link.springer.com/content/pdf/10.1007/0-387-34805-0_37.pdf -// [github:kwantam/addchain] Riad S. Wahby. kwantam/addchain. Github Repository. Apache License, Version 2.0. -// 2018. https://github.com/kwantam/addchain -// [hehcc:exp] Christophe Doche. Exponentiation. Handbook of Elliptic and Hyperelliptic Curve -// Cryptography, chapter 9. 2006. -// http://koclab.cs.ucsb.edu/teaching/ecc/eccPapers/Doche-ch09.pdf -// [modboscoster] Ayan Nandy. Modifications of Bos and Coster’s Heuristics in search of a -// shorter addition chain for faster exponentiation. Masters thesis, Indian -// Statistical Institute Kolkata. 2011. -// http://library.isical.ac.in:8080/jspui/bitstream/10263/6441/1/DISS-285.pdf -// [mpnt] F. L. Ţiplea, S. Iftene, C. Hriţcu, I. Goriac, R. Gordân and E. Erbiceanu. -// MpNT: A Multi-Precision Number Theory Package, Number Theoretical Algorithms -// (I). Technical Report TR03-02, Faculty of Computer Science, "Alexandru Ioan -// Cuza" University, Iasi. 2003. https://profs.info.uaic.ro/~tr/tr03-02.pdf -// [speedsubgroup] Stam, Martijn. Speeding up subgroup cryptosystems. PhD thesis, Technische -// Universiteit Eindhoven. 2003. https://cr.yp.to/bib/2003/stam-thesis.pdf - -// Heuristic suggests insertions given a current protosequence. -type Heuristic interface { - // Suggest insertions given a target and protosequence f. Protosequence must - // contain sorted distinct integers. - Suggest(f []*big.Int, target *big.Int) []*big.Int - - // String returns a name for the heuristic. - String() string -} - -// Algorithm searches for an addition sequence using a heuristic at each step. -// This implements the framework given in [mpnt], page 63, with the heuristic -// playing the role of the "newnumbers" function. -type Algorithm struct { - heuristic Heuristic -} - -// NewAlgorithm builds a heuristic algorithm. -func NewAlgorithm(h Heuristic) *Algorithm { - return &Algorithm{ - heuristic: h, - } -} - -func (h Algorithm) String() string { - return fmt.Sprintf("heuristic(%v)", h.heuristic) -} - -// FindSequence searches for an addition sequence for the given targets. -func (h Algorithm) FindSequence(targets []*big.Int) (addchain.Chain, error) { - // Skip the special case when targets is just {1}. - if len(targets) == 1 && bigint.EqualInt64(targets[0], 1) { - return targets, nil - } - - // Initialize protosequence. - leader := bigints.Int64s(1, 2) - proto := append(leader, targets...) - bigints.Sort(proto) - proto = bigints.Unique(proto) - c := []*big.Int{} - - for len(proto) > 2 { - // Pop the target element. - top := len(proto) - 1 - target := proto[top] - proto = proto[:top] - c = bigints.InsertSortedUnique(c, target) - - // Apply heuristic. - insert := h.heuristic.Suggest(proto, target) - if insert == nil { - return nil, errors.New("failed to find sequence") - } - - // Update protosequence. - proto = bigints.MergeUnique(proto, insert) - } - - // Prepare the chain to return. - c = bigints.MergeUnique(leader, c) - - return addchain.Chain(c), nil -} - -// DeltaLargest implements the simple heuristic of adding the delta between the -// largest two entries in the protosequence. -type DeltaLargest struct{} - -func (DeltaLargest) String() string { return "delta_largest" } - -// Suggest proposes inserting target-max(f). -func (DeltaLargest) Suggest(f []*big.Int, target *big.Int) []*big.Int { - n := len(f) - delta := new(big.Int).Sub(target, f[n-1]) - if delta.Sign() <= 0 { - panic("delta must be positive") - } - return []*big.Int{delta} -} - -// Approximation is the "Approximation" heuristic from [boscoster]. -type Approximation struct{} - -func (Approximation) String() string { return "approximation" } - -// Suggest applies the "Approximation" heuristic. This heuristic looks for two -// elements a, b in the list that sum to something close to the target element -// f. That is, we look for f-(a+b) = epsilon where a ⩽ b and epsilon is a -// "small" positive value. -func (Approximation) Suggest(f []*big.Int, target *big.Int) []*big.Int { - delta := new(big.Int) - insert := new(big.Int) - mindelta := new(big.Int) - best := new(big.Int) - first := true - - // Leverage the fact that f contains sorted distinct integers to apply a - // linear algorithm, similar to the 2-SUM problem. Maintain left and right - // pointers and adjust them based on whether the sum is above or below the - // target. - for l, r := 0, len(f)-1; l <= r; { - a, b := f[l], f[r] - - // Compute the delta f-(a+b). - delta.Add(a, b) - delta.Sub(target, delta) - if delta.Sign() < 0 { - // Sum exceeds target, decrement r for smaller b value. - r-- - continue - } - - // Proposed insertion is a+delta. - insert.Add(a, delta) - - // If it's actually in the sequence already, use it. - if bigints.ContainsSorted(insert, f) { - return []*big.Int{insert} - } - - // Keep it if its the closest we've seen. - if first || delta.Cmp(mindelta) < 0 { - mindelta.Set(delta) - best.Set(insert) - first = false - } - - // Advance to next a value. - l++ - } - - return []*big.Int{best} -} - -// Halving is the "Halving" heuristic from [boscoster]. -type Halving struct{} - -func (Halving) String() string { return "halving" } - -// Suggest applies when the target is at least twice as big as the next largest. -// If so it will return a sequence of doublings to insert. Otherwise it will -// return nil. -func (Halving) Suggest(f []*big.Int, target *big.Int) []*big.Int { - n := len(f) - max, next := target, f[n-1] - - // Check the condition f / f₁ ⩾ 2ᵘ - r := new(big.Int).Div(max, next) - if r.BitLen() < 2 { - return nil - } - u := r.BitLen() - 1 - - // Compute k = floor( f / 2ᵘ ). - k := new(big.Int).Rsh(max, uint(u)) - - // Proposal to insert: - // Delta d = f - k*2ᵘ - // Sequence k, 2*k, ..., k*2ᵘ - kshifts := []*big.Int{} - for e := 0; e <= u; e++ { - kshift := new(big.Int).Lsh(k, uint(e)) - kshifts = append(kshifts, kshift) - } - d := new(big.Int).Sub(max, kshifts[u]) - if bigint.IsZero(d) { - return kshifts[:u] - } - - return bigints.InsertSortedUnique(kshifts, d) -} - -// UseFirst builds a compositite heuristic that will make the first non-nil -// suggestion from the sub-heuristics. -func UseFirst(heuristics ...Heuristic) Heuristic { - return useFirst(heuristics) -} - -type useFirst []Heuristic - -func (h useFirst) String() string { - names := []string{} - for _, sub := range h { - names = append(names, sub.String()) - } - return "use_first(" + strings.Join(names, ",") + ")" -} - -// Suggest delegates to each sub-heuristic in turn and returns the first non-nil suggestion. -func (h useFirst) Suggest(f []*big.Int, target *big.Int) []*big.Int { - for _, heuristic := range h { - if insert := heuristic.Suggest(f, target); insert != nil { - return insert - } - } - return nil -} diff --git a/vendor/github.com/mmcloughlin/addchain/alg/opt/opt.go b/vendor/github.com/mmcloughlin/addchain/alg/opt/opt.go deleted file mode 100644 index bf28cb906..000000000 --- a/vendor/github.com/mmcloughlin/addchain/alg/opt/opt.go +++ /dev/null @@ -1,101 +0,0 @@ -// Package opt implements generic optimizations that remove redundancy from addition chains. -package opt - -import ( - "fmt" - "math/big" - - "github.com/mmcloughlin/addchain" - "github.com/mmcloughlin/addchain/alg" -) - -// Algorithm applies chain optimization to the result of a wrapped algorithm. -type Algorithm struct { - Algorithm alg.ChainAlgorithm -} - -func (a Algorithm) String() string { - return fmt.Sprintf("opt(%s)", a.Algorithm) -} - -// FindChain delegates to the wrapped algorithm, then runs Optimize on the result. -func (a Algorithm) FindChain(n *big.Int) (addchain.Chain, error) { - c, err := a.Algorithm.FindChain(n) - if err != nil { - return nil, err - } - - opt, err := Optimize(c) - if err != nil { - return nil, err - } - - return opt, nil -} - -// Optimize aims to remove redundancy from an addition chain. -func Optimize(c addchain.Chain) (addchain.Chain, error) { - // Build program for c with all possible options at each step. - ops := make([][]addchain.Op, len(c)) - for k := 1; k < len(c); k++ { - ops[k] = c.Ops(k) - } - - // Count how many times each index is used where it is the only available Op. - counts := make([]int, len(c)) - for k := 1; k < len(c); k++ { - if len(ops[k]) != 1 { - continue - } - for _, i := range ops[k][0].Operands() { - counts[i]++ - } - } - - // Now, try to remove the positions which are never the only available op. - remove := []int{} - for k := 1; k < len(c)-1; k++ { - if counts[k] > 0 { - continue - } - - // Prune places k is used. - for l := k + 1; l < len(c); l++ { - ops[l] = pruneuses(ops[l], k) - - // If this list now only has one element, the operands in it are now - // indispensable. - if len(ops[l]) == 1 { - for _, i := range ops[l][0].Operands() { - counts[i]++ - } - } - } - - // Mark k for deletion. - remove = append(remove, k) - } - - // Perform removals. - pruned := addchain.Chain{} - for i, x := range c { - if len(remove) > 0 && remove[0] == i { - remove = remove[1:] - continue - } - pruned = append(pruned, x) - } - - return pruned, nil -} - -// pruneuses removes any uses of i from the list of operations. -func pruneuses(ops []addchain.Op, i int) []addchain.Op { - filtered := ops[:0] - for _, op := range ops { - if !op.Uses(i) { - filtered = append(filtered, op) - } - } - return filtered -} diff --git a/vendor/github.com/mmcloughlin/addchain/chain.go b/vendor/github.com/mmcloughlin/addchain/chain.go deleted file mode 100644 index 3d41657eb..000000000 --- a/vendor/github.com/mmcloughlin/addchain/chain.go +++ /dev/null @@ -1,194 +0,0 @@ -// Package addchain provides addition chain types and operations on them. -package addchain - -import ( - "errors" - "fmt" - "math/big" - - "github.com/mmcloughlin/addchain/internal/bigint" - "github.com/mmcloughlin/addchain/internal/bigints" -) - -// References: -// -// [efficientcompaddchain] Bergeron, F., Berstel, J. and Brlek, S. Efficient computation of addition -// chains. Journal de theorie des nombres de Bordeaux. 1994. -// http://www.numdam.org/item/JTNB_1994__6_1_21_0 -// [knuth] Knuth, Donald E. Evaluation of Powers. The Art of Computer Programming, Volume 2 -// (Third Edition): Seminumerical Algorithms, chapter 4.6.3. 1997. -// https://www-cs-faculty.stanford.edu/~knuth/taocp.html - -// Chain is an addition chain. -type Chain []*big.Int - -// New constructs the minimal chain {1}. -func New() Chain { - return Chain{big.NewInt(1)} -} - -// Int64s builds a chain from the given int64 values. -func Int64s(xs ...int64) Chain { - return Chain(bigints.Int64s(xs...)) -} - -// Clone the chain. -func (c Chain) Clone() Chain { - return bigints.Clone(c) -} - -// AppendClone appends a copy of x to c. -func (c *Chain) AppendClone(x *big.Int) { - *c = append(*c, bigint.Clone(x)) -} - -// End returns the last element of the chain. -func (c Chain) End() *big.Int { - return c[len(c)-1] -} - -// Ops returns all operations that produce the kth position. This could be empty -// for an invalid chain. -func (c Chain) Ops(k int) []Op { - ops := []Op{} - s := new(big.Int) - - // If the prefix is ascending this can be done in linear time. - if c[:k].IsAscending() { - for l, r := 0, k-1; l <= r; { - s.Add(c[l], c[r]) - cmp := s.Cmp(c[k]) - if cmp == 0 { - ops = append(ops, Op{l, r}) - } - if cmp <= 0 { - l++ - } else { - r-- - } - } - return ops - } - - // Fallback to quadratic. - for i := 0; i < k; i++ { - for j := i; j < k; j++ { - s.Add(c[i], c[j]) - if s.Cmp(c[k]) == 0 { - ops = append(ops, Op{i, j}) - } - } - } - - return ops -} - -// Op returns an Op that produces the kth position. -func (c Chain) Op(k int) (Op, error) { - ops := c.Ops(k) - if len(ops) == 0 { - return Op{}, fmt.Errorf("position %d is not the sum of previous entries", k) - } - return ops[0], nil -} - -// Program produces a program that generates the chain. -func (c Chain) Program() (Program, error) { - // Sanity checks. - if len(c) == 0 { - return nil, errors.New("chain empty") - } - - if c[0].Cmp(big.NewInt(1)) != 0 { - return nil, errors.New("chain must start with 1") - } - - if bigints.Contains(bigint.Zero(), c) { - return nil, errors.New("chain contains zero") - } - - for i := 0; i < len(c); i++ { - for j := i + 1; j < len(c); j++ { - if bigint.Equal(c[i], c[j]) { - return nil, fmt.Errorf("chain contains duplicate: %v at positions %d and %d", c[i], i, j) - } - } - } - - // Produce the program. - p := Program{} - for k := 1; k < len(c); k++ { - op, err := c.Op(k) - if err != nil { - return nil, err - } - p = append(p, op) - } - - return p, nil -} - -// Validate checks that c is in fact an addition chain. -func (c Chain) Validate() error { - _, err := c.Program() - return err -} - -// Produces checks that c is a valid chain ending with target. -func (c Chain) Produces(target *big.Int) error { - if err := c.Validate(); err != nil { - return err - } - if c.End().Cmp(target) != 0 { - return errors.New("chain does not end with target") - } - return nil -} - -// Superset checks that c is a valid chain containing all the targets. -func (c Chain) Superset(targets []*big.Int) error { - if err := c.Validate(); err != nil { - return err - } - for _, target := range targets { - if !bigints.Contains(target, c) { - return fmt.Errorf("chain does not contain %v", target) - } - } - return nil -} - -// IsAscending reports whether the chain is ascending, that is if it's in sorted -// order without repeats, as defined in [knuth] Section 4.6.3 formula (11). -// Does not fully validate the chain, only that it is ascending. -func (c Chain) IsAscending() bool { - if len(c) == 0 || !bigint.EqualInt64(c[0], 1) { - return false - } - for i := 1; i < len(c); i++ { - if c[i-1].Cmp(c[i]) >= 0 { - return false - } - } - return true -} - -// Product computes the product of two addition chains. The is the "o times" -// operator defined in [efficientcompaddchain] Section 2. -func Product(a, b Chain) Chain { - c := a.Clone() - last := c.End() - for _, x := range b[1:] { - y := new(big.Int).Mul(last, x) - c = append(c, y) - } - return c -} - -// Plus adds x to the addition chain. This is the "o plus" operator defined in -// [efficientcompaddchain] Section 2. -func Plus(a Chain, x *big.Int) Chain { - c := a.Clone() - y := new(big.Int).Add(c.End(), x) - return append(c, y) -} diff --git a/vendor/github.com/mmcloughlin/addchain/codecov.yml b/vendor/github.com/mmcloughlin/addchain/codecov.yml deleted file mode 100644 index 35cde5cd5..000000000 --- a/vendor/github.com/mmcloughlin/addchain/codecov.yml +++ /dev/null @@ -1,4 +0,0 @@ -coverage: - status: - project: off - patch: off diff --git a/vendor/github.com/mmcloughlin/addchain/install.sh b/vendor/github.com/mmcloughlin/addchain/install.sh deleted file mode 100644 index 6ea84cbc9..000000000 --- a/vendor/github.com/mmcloughlin/addchain/install.sh +++ /dev/null @@ -1,378 +0,0 @@ -#!/bin/sh -set -e -# Code generated by godownloader. DO NOT EDIT. -# - -usage() { - this=$1 - cat </dev/null -} -echoerr() { - echo "$@" 1>&2 -} -log_prefix() { - echo "$0" -} -_logp=6 -log_set_priority() { - _logp="$1" -} -log_priority() { - if test -z "$1"; then - echo "$_logp" - return - fi - [ "$1" -le "$_logp" ] -} -log_tag() { - case $1 in - 0) echo "emerg" ;; - 1) echo "alert" ;; - 2) echo "crit" ;; - 3) echo "err" ;; - 4) echo "warning" ;; - 5) echo "notice" ;; - 6) echo "info" ;; - 7) echo "debug" ;; - *) echo "$1" ;; - esac -} -log_debug() { - log_priority 7 || return 0 - echoerr "$(log_prefix)" "$(log_tag 7)" "$@" -} -log_info() { - log_priority 6 || return 0 - echoerr "$(log_prefix)" "$(log_tag 6)" "$@" -} -log_err() { - log_priority 3 || return 0 - echoerr "$(log_prefix)" "$(log_tag 3)" "$@" -} -log_crit() { - log_priority 2 || return 0 - echoerr "$(log_prefix)" "$(log_tag 2)" "$@" -} -uname_os() { - os=$(uname -s | tr '[:upper:]' '[:lower:]') - case "$os" in - cygwin_nt*) os="windows" ;; - mingw*) os="windows" ;; - msys_nt*) os="windows" ;; - esac - echo "$os" -} -uname_arch() { - arch=$(uname -m) - case $arch in - x86_64) arch="amd64" ;; - x86) arch="386" ;; - i686) arch="386" ;; - i386) arch="386" ;; - aarch64) arch="arm64" ;; - armv5*) arch="armv5" ;; - armv6*) arch="armv6" ;; - armv7*) arch="armv7" ;; - esac - echo ${arch} -} -uname_os_check() { - os=$(uname_os) - case "$os" in - darwin) return 0 ;; - dragonfly) return 0 ;; - freebsd) return 0 ;; - linux) return 0 ;; - android) return 0 ;; - nacl) return 0 ;; - netbsd) return 0 ;; - openbsd) return 0 ;; - plan9) return 0 ;; - solaris) return 0 ;; - windows) return 0 ;; - esac - log_crit "uname_os_check '$(uname -s)' got converted to '$os' which is not a GOOS value. Please file bug at https://github.com/client9/shlib" - return 1 -} -uname_arch_check() { - arch=$(uname_arch) - case "$arch" in - 386) return 0 ;; - amd64) return 0 ;; - arm64) return 0 ;; - armv5) return 0 ;; - armv6) return 0 ;; - armv7) return 0 ;; - ppc64) return 0 ;; - ppc64le) return 0 ;; - mips) return 0 ;; - mipsle) return 0 ;; - mips64) return 0 ;; - mips64le) return 0 ;; - s390x) return 0 ;; - amd64p32) return 0 ;; - esac - log_crit "uname_arch_check '$(uname -m)' got converted to '$arch' which is not a GOARCH value. Please file bug report at https://github.com/client9/shlib" - return 1 -} -untar() { - tarball=$1 - case "${tarball}" in - *.tar.gz | *.tgz) tar --no-same-owner -xzf "${tarball}" ;; - *.tar) tar --no-same-owner -xf "${tarball}" ;; - *.zip) unzip "${tarball}" ;; - *) - log_err "untar unknown archive format for ${tarball}" - return 1 - ;; - esac -} -http_download_curl() { - local_file=$1 - source_url=$2 - header=$3 - if [ -z "$header" ]; then - code=$(curl -w '%{http_code}' -sL -o "$local_file" "$source_url") - else - code=$(curl -w '%{http_code}' -sL -H "$header" -o "$local_file" "$source_url") - fi - if [ "$code" != "200" ]; then - log_debug "http_download_curl received HTTP status $code" - return 1 - fi - return 0 -} -http_download_wget() { - local_file=$1 - source_url=$2 - header=$3 - if [ -z "$header" ]; then - wget -q -O "$local_file" "$source_url" - else - wget -q --header "$header" -O "$local_file" "$source_url" - fi -} -http_download() { - log_debug "http_download $2" - if is_command curl; then - http_download_curl "$@" - return - elif is_command wget; then - http_download_wget "$@" - return - fi - log_crit "http_download unable to find wget or curl" - return 1 -} -http_copy() { - tmp=$(mktemp) - http_download "${tmp}" "$1" "$2" || return 1 - body=$(cat "$tmp") - rm -f "${tmp}" - echo "$body" -} -github_release() { - owner_repo=$1 - version=$2 - test -z "$version" && version="latest" - giturl="https://github.com/${owner_repo}/releases/${version}" - json=$(http_copy "$giturl" "Accept:application/json") - test -z "$json" && return 1 - version=$(echo "$json" | tr -s '\n' ' ' | sed 's/.*"tag_name":"//' | sed 's/".*//') - test -z "$version" && return 1 - echo "$version" -} -hash_sha256() { - TARGET=${1:-/dev/stdin} - if is_command gsha256sum; then - hash=$(gsha256sum "$TARGET") || return 1 - echo "$hash" | cut -d ' ' -f 1 - elif is_command sha256sum; then - hash=$(sha256sum "$TARGET") || return 1 - echo "$hash" | cut -d ' ' -f 1 - elif is_command shasum; then - hash=$(shasum -a 256 "$TARGET" 2>/dev/null) || return 1 - echo "$hash" | cut -d ' ' -f 1 - elif is_command openssl; then - hash=$(openssl -dst openssl dgst -sha256 "$TARGET") || return 1 - echo "$hash" | cut -d ' ' -f a - else - log_crit "hash_sha256 unable to find command to compute sha-256 hash" - return 1 - fi -} -hash_sha256_verify() { - TARGET=$1 - checksums=$2 - if [ -z "$checksums" ]; then - log_err "hash_sha256_verify checksum file not specified in arg2" - return 1 - fi - BASENAME=${TARGET##*/} - want=$(grep "${BASENAME}" "${checksums}" 2>/dev/null | tr '\t' ' ' | cut -d ' ' -f 1) - if [ -z "$want" ]; then - log_err "hash_sha256_verify unable to find checksum for '${TARGET}' in '${checksums}'" - return 1 - fi - got=$(hash_sha256 "$TARGET") - if [ "$want" != "$got" ]; then - log_err "hash_sha256_verify checksum for '$TARGET' did not verify ${want} vs $got" - return 1 - fi -} -cat /dev/null <= 0 -} - -// ContainsSorted reports whether n is in xs, which is assumed to be sorted. -func ContainsSorted(n *big.Int, xs []*big.Int) bool { - i := sort.Search(len(xs), func(i int) bool { return xs[i].Cmp(n) >= 0 }) - return i < len(xs) && bigint.Equal(xs[i], n) -} - -// Clone a list of integers. -func Clone(xs []*big.Int) []*big.Int { - return append([]*big.Int{}, xs...) -} - -// Unique removes consecutive duplicates. -func Unique(xs []*big.Int) []*big.Int { - if len(xs) == 0 { - return []*big.Int{} - } - u := make([]*big.Int, 1, len(xs)) - u[0] = xs[0] - for _, x := range xs[1:] { - last := u[len(u)-1] - if !bigint.Equal(x, last) { - u = append(u, x) - } - } - return u -} - -// InsertSortedUnique inserts an integer into a slice of sorted distinct -// integers. -func InsertSortedUnique(xs []*big.Int, x *big.Int) []*big.Int { - return MergeUnique([]*big.Int{x}, xs) -} - -// MergeUnique merges two slices of sorted distinct integers. Elements in both -// slices are deduplicated. -func MergeUnique(xs, ys []*big.Int) []*big.Int { - r := make([]*big.Int, 0, len(xs)+len(ys)) - - for len(xs) > 0 && len(ys) > 0 { - switch xs[0].Cmp(ys[0]) { - case -1: - r = append(r, xs[0]) - xs = xs[1:] - case 0: - r = append(r, xs[0]) - xs = xs[1:] - ys = ys[1:] - case 1: - r = append(r, ys[0]) - ys = ys[1:] - } - } - - r = append(r, xs...) - r = append(r, ys...) - - return r -} diff --git a/vendor/github.com/mmcloughlin/addchain/internal/bigvector/bigvector.go b/vendor/github.com/mmcloughlin/addchain/internal/bigvector/bigvector.go deleted file mode 100644 index bac75bd5f..000000000 --- a/vendor/github.com/mmcloughlin/addchain/internal/bigvector/bigvector.go +++ /dev/null @@ -1,86 +0,0 @@ -// Package bigvector implements operations on vectors of immutable -// multi-precision integers. -package bigvector - -import ( - "math/big" - - "github.com/mmcloughlin/addchain/internal/bigint" -) - -// Vector of immutable multi-precision integers. -type Vector interface { - // Len returns vector length. - Len() int - - // Idx returns integer at index i. Returned integer must not be written to. - Idx(i int) *big.Int -} - -// New constructs an n-dimensional zero vector. -func New(n int) Vector { - return make(vector, n) -} - -type vector []big.Int - -func (v vector) Len() int { return len(v) } -func (v vector) Idx(i int) *big.Int { return &v[i] } - -// NewBasis constructs an n-dimensional basis vector with a 1 in position i. -func NewBasis(n, i int) Vector { - return basis{n: n, i: i} -} - -// Basis implementation saves allocations by returning pre-allocated zero and -// one integers based on the index requested. -var ( - zero = bigint.Zero() - one = bigint.One() -) - -type basis struct { - n int - i int -} - -func (b basis) Len() int { return b.n } - -func (b basis) Idx(i int) *big.Int { - switch { - case i >= b.n: - panic("bigvector: index out of range") - case i == b.i: - return one - default: - return zero - } -} - -// Add vectors. -func Add(u, v Vector) Vector { - assertsamelen(u, v) - n := u.Len() - w := make(vector, n) - for i := 0; i < n; i++ { - w[i].Add(u.Idx(i), v.Idx(i)) - } - return w -} - -// Lsh left shifts every element of the vector v. -func Lsh(v Vector, s uint) Vector { - n := v.Len() - w := make(vector, n) - for i := 0; i < n; i++ { - w[i].Lsh(v.Idx(i), s) - } - return w -} - -// assertsamelen panics if u and v are different lengths. -func assertsamelen(u, v Vector) { - if u.Len() != v.Len() { - panic("bigvector: length mismatch") - } -} diff --git a/vendor/github.com/mmcloughlin/addchain/internal/container/heap/heap.go b/vendor/github.com/mmcloughlin/addchain/internal/container/heap/heap.go deleted file mode 100644 index 9d396f50e..000000000 --- a/vendor/github.com/mmcloughlin/addchain/internal/container/heap/heap.go +++ /dev/null @@ -1,55 +0,0 @@ -// Package heap implements a heap on specific types. -package heap - -import "container/heap" - -// MinInts is a min-heap of integers. -type MinInts struct { - h *intheap -} - -// NewMinInts builds an empty integer min-heap. -func NewMinInts() *MinInts { - return &MinInts{ - h: &intheap{}, - } -} - -// Empty returns whether the heap is empty. -func (h *MinInts) Empty() bool { - return h.Len() == 0 -} - -// Len returns the number of elements in the heap. -func (h *MinInts) Len() int { - return h.h.Len() -} - -// Push x onto the heap. -func (h *MinInts) Push(x int) { - heap.Push(h.h, x) -} - -// Pop the min element from the heap. -func (h *MinInts) Pop() int { - return heap.Pop(h.h).(int) -} - -type intheap struct { - x []int -} - -func (h intheap) Len() int { return len(h.x) } -func (h intheap) Less(i, j int) bool { return h.x[i] < h.x[j] } -func (h intheap) Swap(i, j int) { h.x[i], h.x[j] = h.x[j], h.x[i] } - -func (h *intheap) Push(x interface{}) { - h.x = append(h.x, x.(int)) -} - -func (h *intheap) Pop() interface{} { - n := len(h.x) - x := h.x[n-1] - h.x = h.x[:n-1] - return x -} diff --git a/vendor/github.com/mmcloughlin/addchain/internal/errutil/errutil.go b/vendor/github.com/mmcloughlin/addchain/internal/errutil/errutil.go deleted file mode 100644 index 364724118..000000000 --- a/vendor/github.com/mmcloughlin/addchain/internal/errutil/errutil.go +++ /dev/null @@ -1,28 +0,0 @@ -// Package errutil implements common error types and helper functions. -package errutil - -import ( - "fmt" - "io" -) - -// AssertionFailure is used for an error resulting from the failure of an -// expected invariant. -func AssertionFailure(format string, args ...interface{}) error { - return fmt.Errorf("assertion failure: "+format, args...) -} - -// UnexpectedType builds an error for an unexpected type, typically in a type switch. -func UnexpectedType(t interface{}) error { - return AssertionFailure("unexpected type %T", t) -} - -// CheckClose closes c. If an error occurs it will be written to the error -// pointer errp, if it doesn't already reference an error. This is intended to -// allow you to properly check errors when defering a close call. In this case -// the error pointer should be the address of a named error return. -func CheckClose(errp *error, c io.Closer) { - if err := c.Close(); err != nil && *errp == nil { - *errp = err - } -} diff --git a/vendor/github.com/mmcloughlin/addchain/internal/print/printer.go b/vendor/github.com/mmcloughlin/addchain/internal/print/printer.go deleted file mode 100644 index 39bd49249..000000000 --- a/vendor/github.com/mmcloughlin/addchain/internal/print/printer.go +++ /dev/null @@ -1,104 +0,0 @@ -// Package print provides helpers for structured output printing. -package print - -import ( - "fmt" - "io" - "strings" - "text/tabwriter" -) - -// DefaultIndent is the default string for one level of indentation. -const DefaultIndent = "\t" - -// Printer provides convenience methods for structured output printing. -// Specifically it stores any errors encountered so error checking does not have -// to be done on every print call. Also provides helpers for managing indentation. -type Printer struct { - out io.Writer - level int // current indentation level - indent string // indentation string - pending bool // if there's a pending indentation - err error // saved error from printing -} - -// New builds a printer writing to w. -func New(w io.Writer) Printer { - return Printer{ - out: w, - indent: DefaultIndent, - } -} - -// SetIndentString configures the string used for one level of indentation. -func (p *Printer) SetIndentString(indent string) { - p.indent = indent -} - -// Indent by one level. -func (p *Printer) Indent() { - p.level++ -} - -// Dedent by one level. -func (p *Printer) Dedent() { - p.level-- -} - -// Linef prints a formatted line. -func (p *Printer) Linef(format string, args ...interface{}) { - p.Printf(format, args...) - p.NL() -} - -// NL prints a newline. -func (p *Printer) NL() { - p.Printf("\n") - p.pending = true -} - -// Printf prints formatted output. -func (p *Printer) Printf(format string, args ...interface{}) { - if p.err != nil { - return - } - if p.pending { - indent := strings.Repeat(p.indent, p.level) - format = indent + format - p.pending = false - } - _, err := fmt.Fprintf(p.out, format, args...) - p.SetError(err) -} - -// Error returns the first error that occurred so far, if any. -func (p *Printer) Error() error { - return p.err -} - -// SetError records a possible error. -func (p *Printer) SetError(err error) { - if p.err == nil { - p.err = err - } -} - -// TabWriter provides tabwriter.Writer functionality with the Printer interface. -type TabWriter struct { - tw *tabwriter.Writer - Printer -} - -// NewTabWriter builds a TabWriter. Arguments are the same as for tabwriter.NewWriter. -func NewTabWriter(w io.Writer, minwidth, tabwidth, padding int, padchar byte, flags uint) *TabWriter { - tw := tabwriter.NewWriter(w, minwidth, tabwidth, padding, padchar, flags) - return &TabWriter{ - tw: tw, - Printer: New(tw), - } -} - -// Flush the tabwriter. -func (p *TabWriter) Flush() { - p.SetError(p.tw.Flush()) -} diff --git a/vendor/github.com/mmcloughlin/addchain/logo.svg b/vendor/github.com/mmcloughlin/addchain/logo.svg deleted file mode 100644 index 0ab26295c..000000000 --- a/vendor/github.com/mmcloughlin/addchain/logo.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/vendor/github.com/mmcloughlin/addchain/meta/cite.go b/vendor/github.com/mmcloughlin/addchain/meta/cite.go deleted file mode 100644 index bfaae04c7..000000000 --- a/vendor/github.com/mmcloughlin/addchain/meta/cite.go +++ /dev/null @@ -1,61 +0,0 @@ -package meta - -import ( - "bytes" - "errors" - "fmt" - "io" - "strconv" - "strings" - - "github.com/mmcloughlin/addchain/internal/print" -) - -// CheckCitable checks whether a citation can be generated for this built -// version. -func (p *Properties) CheckCitable() error { - if !p.IsRelease() { - return errors.New("cannot cite non-release version") - } - return nil -} - -// WriteCitation writes BibTeX citation for the most recent release to the given -// writer. -func (p *Properties) WriteCitation(w io.Writer) error { - // Determine release time. - date, err := p.ReleaseTime() - if err != nil { - return fmt.Errorf("release date: %w", err) - } - - // Use tabwriter for field alignment. - tw := print.NewTabWriter(w, 1, 4, 1, ' ', 0) - - field := func(key, value string) { tw.Linef(" %s\t=\t%s,", key, value) } - str := func(key, value string) { field(key, "{"+value+"}") } - - tw.Linef("@misc{%s,", p.Name) - str("title", p.Title()) - str("author", "Michael B. McLoughlin") - field("year", strconv.Itoa(date.Year())) - field("month", strings.ToLower(date.Month().String()[:3])) - str("howpublished", "Repository \\url{"+p.RepositoryURL()+"}") - str("version", p.ReleaseVersion) - str("license", "BSD 3-Clause License") - str("doi", p.DOI) - str("url", p.DOIURL()) - tw.Linef("}") - tw.Flush() - - return tw.Error() -} - -// Citation returns a BibTeX citation for the most recent release. -func (p *Properties) Citation() (string, error) { - buf := bytes.NewBuffer(nil) - if err := p.WriteCitation(buf); err != nil { - return "", err - } - return buf.String(), nil -} diff --git a/vendor/github.com/mmcloughlin/addchain/meta/meta.go b/vendor/github.com/mmcloughlin/addchain/meta/meta.go deleted file mode 100644 index da8b0e2a9..000000000 --- a/vendor/github.com/mmcloughlin/addchain/meta/meta.go +++ /dev/null @@ -1,101 +0,0 @@ -// Package meta defines properties about this project. -package meta - -import ( - "fmt" - "path" - "time" -) - -// VersionTagPrefix is the prefix used on Git tags corresponding to semantic -// version releases. -const VersionTagPrefix = "v" - -// Properties about this software package. -type Properties struct { - // Name is the project name. - Name string - - // FullName is the "owner/name" identifier for the project. - FullName string - - // Description is the concise project headline. - Description string - - // BuildVersion is the version that was built. Typically populated at build - // time and will typically be empty for non-release builds. - BuildVersion string - - // ReleaseVersion is the version of the most recent release. - ReleaseVersion string - - // ReleaseDate is the date of the most recent release. (RFC3339 date format.) - ReleaseDate string - - // ConceptDOI is the DOI for all versions. - ConceptDOI string - - // DOI for the most recent release. - DOI string - - // ZenodoID is the Zenodo deposit ID for the most recent release. - ZenodoID string -} - -// Meta defines specific properties for the current version of this software. -var Meta = &Properties{ - Name: "addchain", - FullName: "mmcloughlin/addchain", - Description: "Cryptographic Addition Chain Generation in Go", - BuildVersion: buildversion, - ReleaseVersion: releaseversion, - ReleaseDate: releasedate, - ConceptDOI: conceptdoi, - DOI: doi, - ZenodoID: zenodoid, -} - -// Title is a full project title, suitable for a citation. -func (p *Properties) Title() string { - return fmt.Sprintf("%s: %s", p.Name, p.Description) -} - -// IsRelease reports whether the built version is a release. -func (p *Properties) IsRelease() bool { - return p.BuildVersion == p.ReleaseVersion -} - -// ReleaseTag returns the release tag corresponding to the most recent release. -func (p *Properties) ReleaseTag() string { - return VersionTagPrefix + p.ReleaseVersion -} - -// Module returns the Go module path. -func (p *Properties) Module() string { - return path.Join("github.com", p.FullName) -} - -// RepositoryURL returns a URL to the hosted repository. -func (p *Properties) RepositoryURL() string { - return "https://" + p.Module() -} - -// ReleaseURL returns the URL to the release page. -func (p *Properties) ReleaseURL() string { - return fmt.Sprintf("%s/releases/tag/%s", p.RepositoryURL(), p.ReleaseTag()) -} - -// ReleaseTime returns the release date as a time object. -func (p *Properties) ReleaseTime() (time.Time, error) { - return time.Parse("2006-01-02", p.ReleaseDate) -} - -// DOIURL returns the DOI URL corresponding to the most recent release. -func (p *Properties) DOIURL() string { return doiurl(p.DOI) } - -// ConceptDOIURL returns the DOI URL corresponding to the most recent release. -func (p *Properties) ConceptDOIURL() string { return doiurl(p.ConceptDOI) } - -func doiurl(doi string) string { - return "https://doi.org/" + doi -} diff --git a/vendor/github.com/mmcloughlin/addchain/meta/vars.go b/vendor/github.com/mmcloughlin/addchain/meta/vars.go deleted file mode 100644 index a034e8cd0..000000000 --- a/vendor/github.com/mmcloughlin/addchain/meta/vars.go +++ /dev/null @@ -1,10 +0,0 @@ -package meta - -var ( - buildversion = "" - releaseversion = "0.4.0" - releasedate = "2021-10-30" - conceptdoi = "10.5281/zenodo.4625263" - doi = "10.5281/zenodo.5622943" - zenodoid = "5622943" -) diff --git a/vendor/github.com/mmcloughlin/addchain/program.go b/vendor/github.com/mmcloughlin/addchain/program.go deleted file mode 100644 index 6449910b0..000000000 --- a/vendor/github.com/mmcloughlin/addchain/program.go +++ /dev/null @@ -1,133 +0,0 @@ -package addchain - -import ( - "fmt" - "math/big" - - "github.com/mmcloughlin/addchain/internal/bigint" -) - -// Op is an instruction to add positions I and J in a chain. -type Op struct{ I, J int } - -// IsDouble returns whether this operation is a doubling. -func (o Op) IsDouble() bool { return o.I == o.J } - -// Operands returns the indicies used in this operation. This will contain one -// or two entries depending on whether this is a doubling. -func (o Op) Operands() []int { - if o.IsDouble() { - return []int{o.I} - } - return []int{o.I, o.J} -} - -// Uses reports whether the given index is one of the operands. -func (o Op) Uses(i int) bool { - return o.I == i || o.J == i -} - -// Program is a sequence of operations. -type Program []Op - -// Shift appends a sequence of operations that bitwise shift index i left by s, -// equivalent to s double operations. Returns the index of the result. -func (p *Program) Shift(i int, s uint) (int, error) { - for ; s > 0; s-- { - next, err := p.Double(i) - if err != nil { - return 0, err - } - i = next - } - return i, nil -} - -// Double appends an operation that doubles index i. Returns the index of the -// result. -func (p *Program) Double(i int) (int, error) { - return p.Add(i, i) -} - -// Add appends an operation that adds indices i and j. Returns the index of the -// result. -func (p *Program) Add(i, j int) (int, error) { - if err := p.boundscheck(i); err != nil { - return 0, err - } - if err := p.boundscheck(j); err != nil { - return 0, err - } - *p = append(*p, Op{i, j}) - return len(*p), nil -} - -// boundscheck returns an error if i is out of bounds. -func (p Program) boundscheck(i int) error { - // Note the corresponding chain is one longer than the program. - n := len(p) - switch { - case i < 0: - return fmt.Errorf("negative index %d", i) - case i > n: - return fmt.Errorf("index %d out of bounds", i) - } - return nil -} - -// Doubles returns the number of doubles in the program. -func (p Program) Doubles() int { - doubles, _ := p.Count() - return doubles -} - -// Adds returns the number of adds in the program. -func (p Program) Adds() int { - _, adds := p.Count() - return adds -} - -// Count returns the number of doubles and adds in the program. -func (p Program) Count() (doubles, adds int) { - for _, op := range p { - if op.IsDouble() { - doubles++ - } else { - adds++ - } - } - return -} - -// Evaluate executes the program and returns the resulting chain. -func (p Program) Evaluate() Chain { - c := New() - for _, op := range p { - sum := new(big.Int).Add(c[op.I], c[op.J]) - c = append(c, sum) - } - return c -} - -// ReadCounts returns how many times each index is read in the program. -func (p Program) ReadCounts() []int { - reads := make([]int, len(p)+1) - for _, op := range p { - for _, i := range op.Operands() { - reads[i]++ - } - } - return reads -} - -// Dependencies returns an array of bitsets where each bitset contains the set -// of indicies that contributed to that position. -func (p Program) Dependencies() []*big.Int { - bitsets := []*big.Int{bigint.One()} - for i, op := range p { - bitset := new(big.Int).Or(bitsets[op.I], bitsets[op.J]) - bitset.SetBit(bitset, i+1, 1) - bitsets = append(bitsets, bitset) - } - return bitsets -} diff --git a/vendor/github.com/nxadm/tail/.gitignore b/vendor/github.com/nxadm/tail/.gitignore index fa81aa93a..35d9351d3 100644 --- a/vendor/github.com/nxadm/tail/.gitignore +++ b/vendor/github.com/nxadm/tail/.gitignore @@ -1,2 +1,3 @@ .idea/ -.test/ \ No newline at end of file +.test/ +examples/_* \ No newline at end of file diff --git a/vendor/github.com/nxadm/tail/.travis.yml b/vendor/github.com/nxadm/tail/.travis.yml deleted file mode 100644 index 95dd3bd78..000000000 --- a/vendor/github.com/nxadm/tail/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -language: go - -script: - - go test -race -v ./... - -go: - - "1.9" - - "1.10" - - "1.11" - - "1.12" - - "1.13" - - tip - -matrix: - allow_failures: - - go: tip diff --git a/vendor/github.com/nxadm/tail/CHANGES.md b/vendor/github.com/nxadm/tail/CHANGES.md index ef1b5fbed..224e54b44 100644 --- a/vendor/github.com/nxadm/tail/CHANGES.md +++ b/vendor/github.com/nxadm/tail/CHANGES.md @@ -1,4 +1,14 @@ -# Version v1.4.4 +# Version v1.4.7-v1.4.8 +* Documentation updates. +* Small linter cleanups. +* Added example in test. + +# Version v1.4.6 + +* Document the usage of Cleanup when re-reading a file (thanks to @lesovsky) for issue #18. +* Add example directories with example and tests for issues. + +# Version v1.4.4-v1.4.5 * Fix of checksum problem because of forced tag. No changes to the code. diff --git a/vendor/github.com/nxadm/tail/README.md b/vendor/github.com/nxadm/tail/README.md index dbb6c1727..f47939c74 100644 --- a/vendor/github.com/nxadm/tail/README.md +++ b/vendor/github.com/nxadm/tail/README.md @@ -1,36 +1,44 @@ -[![Build Status](https://travis-ci.org/nxadm/tail.svg?branch=master)](https://travis-ci.org/nxadm/tail) +![ci](https://github.com/nxadm/tail/workflows/ci/badge.svg)[![Go Reference](https://pkg.go.dev/badge/github.com/nxadm/tail.svg)](https://pkg.go.dev/github.com/nxadm/tail) -This is repo is forked from the dormant upstream repo at -[hpcloud](https://github.com/hpcloud/tail). This fork adds support for go -modules, updates the dependencies, adds features and fixes bugs. Go 1.9 is -the oldest compiler release supported. +# tail functionality in Go -# Go package for tail-ing files +nxadm/tail provides a Go library that emulates the features of the BSD `tail` +program. The library comes with full support for truncation/move detection as +it is designed to work with log rotation tools. The library works on all +operating systems supported by Go, including POSIX systems like Linux and +*BSD, and MS Windows. Go 1.9 is the oldest compiler release supported. -A Go package striving to emulate the features of the BSD `tail` program. +A simple example: ```Go -t, err := tail.TailFile("/var/log/nginx.log", tail.Config{Follow: true}) +// Create a tail +t, err := tail.TailFile( + "/var/log/nginx.log", tail.Config{Follow: true, ReOpen: true}) if err != nil { panic(err) } +// Print the text of each received line for line := range t.Lines { fmt.Println(line.Text) } ``` -See [API documentation](http://godoc.org/github.com/nxadm/tail). - -## Log rotation - -Tail comes with full support for truncation/move detection as it is -designed to work with log rotation tools. +See [API documentation](https://pkg.go.dev/github.com/nxadm/tail). ## Installing go get github.com/nxadm/tail/... -## Windows support +## History + +This project is an active, drop-in replacement for the +[abandoned](https://en.wikipedia.org/wiki/HPE_Helion) Go tail library at +[hpcloud](https://github.com/hpcloud/tail). Next to +[addressing open issues/PRs of the original project](https://github.com/nxadm/tail/issues/6), +nxadm/tail continues the development by keeping up to date with the Go toolchain +(e.g. go modules) and dependencies, completing the documentation, adding features +and fixing bugs. -This package [needs assistance](https://github.com/nxadm/tail/labels/Windows) for full Windows support. +## Examples +Examples, e.g. used to debug an issue, are kept in the [examples directory](/examples). \ No newline at end of file diff --git a/vendor/github.com/nxadm/tail/appveyor.yml b/vendor/github.com/nxadm/tail/appveyor.yml deleted file mode 100644 index e149bc62d..000000000 --- a/vendor/github.com/nxadm/tail/appveyor.yml +++ /dev/null @@ -1,11 +0,0 @@ -version: 0.{build} -skip_tags: true -cache: C:\Users\appveyor\AppData\Local\NuGet\Cache -build_script: -- SET GOPATH=c:\workspace -- go test -v -race ./... -test: off -clone_folder: c:\workspace\src\github.com\nxadm\tail -branches: - only: - - master diff --git a/vendor/github.com/nxadm/tail/tail.go b/vendor/github.com/nxadm/tail/tail.go index 58d3c4b95..37ea4411e 100644 --- a/vendor/github.com/nxadm/tail/tail.go +++ b/vendor/github.com/nxadm/tail/tail.go @@ -1,6 +1,12 @@ +// Copyright (c) 2019 FOSS contributors of https://github.com/nxadm/tail // Copyright (c) 2015 HPE Software Inc. All rights reserved. // Copyright (c) 2013 ActiveState Software Inc. All rights reserved. +//nxadm/tail provides a Go library that emulates the features of the BSD `tail` +//program. The library comes with full support for truncation/move detection as +//it is designed to work with log rotation tools. The library works on all +//operating systems supported by Go, including POSIX systems like Linux and +//*BSD, and MS Windows. Go 1.9 is the oldest compiler release supported. package tail import ( @@ -22,26 +28,31 @@ import ( ) var ( + // ErrStop is returned when the tail of a file has been marked to be stopped. ErrStop = errors.New("tail should now stop") ) type Line struct { - Text string - Num int - SeekInfo SeekInfo - Time time.Time - Err error // Error from tail + Text string // The contents of the file + Num int // The line number + SeekInfo SeekInfo // SeekInfo + Time time.Time // Present time + Err error // Error from tail } -// NewLine returns a Line with present time. +// Deprecated: this function is no longer used internally and it has little of no +// use in the API. As such, it will be removed from the API in a future major +// release. +// +// NewLine returns a * pointer to a Line struct. func NewLine(text string, lineNum int) *Line { return &Line{text, lineNum, SeekInfo{}, time.Now(), nil} } -// SeekInfo represents arguments to `io.Seek` +// SeekInfo represents arguments to io.Seek. See: https://golang.org/pkg/io/#SectionReader.Seek type SeekInfo struct { Offset int64 - Whence int // io.Seek* + Whence int } type logger interface { @@ -59,26 +70,28 @@ type logger interface { // Config is used to specify how a file must be tailed. type Config struct { // File-specifc - Location *SeekInfo // Seek to this location before tailing - ReOpen bool // Reopen recreated files (tail -F) - MustExist bool // Fail early if the file does not exist - Poll bool // Poll for file changes instead of using inotify - Pipe bool // Is a named pipe (mkfifo) - RateLimiter *ratelimiter.LeakyBucket + Location *SeekInfo // Tail from this location. If nil, start at the beginning of the file + ReOpen bool // Reopen recreated files (tail -F) + MustExist bool // Fail early if the file does not exist + Poll bool // Poll for file changes instead of using the default inotify + Pipe bool // The file is a named pipe (mkfifo) // Generic IO Follow bool // Continue looking for new lines (tail -f) MaxLineSize int // If non-zero, split longer lines into multiple lines - // Logger, when nil, is set to tail.DefaultLogger - // To disable logging: set field to tail.DiscardingLogger + // Optionally, use a ratelimiter (e.g. created by the ratelimiter/NewLeakyBucket function) + RateLimiter *ratelimiter.LeakyBucket + + // Optionally use a Logger. When nil, the Logger is set to tail.DefaultLogger. + // To disable logging, set it to tail.DiscardingLogger Logger logger } type Tail struct { - Filename string - Lines chan *Line - Config + Filename string // The filename + Lines chan *Line // A consumable channel of *Line + Config // Tail.Configuration file *os.File reader *bufio.Reader @@ -93,16 +106,17 @@ type Tail struct { } var ( - // DefaultLogger is used when Config.Logger == nil + // DefaultLogger logs to os.Stderr and it is used when Config.Logger == nil DefaultLogger = log.New(os.Stderr, "", log.LstdFlags) // DiscardingLogger can be used to disable logging output DiscardingLogger = log.New(ioutil.Discard, "", 0) ) -// TailFile begins tailing the file. Output stream is made available -// via the `Tail.Lines` channel. To handle errors during tailing, -// invoke the `Wait` or `Err` method after finishing reading from the -// `Lines` channel. +// TailFile begins tailing the file. And returns a pointer to a Tail struct +// and an error. An output stream is made available via the Tail.Lines +// channel (e.g. to be looped and printed). To handle errors during tailing, +// after finishing reading from the Lines channel, invoke the `Wait` or `Err` +// method on the returned *Tail. func TailFile(filename string, config Config) (*Tail, error) { if config.ReOpen && !config.Follow { util.Fatal("cannot set ReOpen without Follow.") @@ -138,10 +152,9 @@ func TailFile(filename string, config Config) (*Tail, error) { return t, nil } -// Tell returns the file's current position, like stdio's ftell(). -// But this value is not very accurate. -// One line from the chan(tail.Lines) may have been read, -// so it may have lost one line. +// Tell returns the file's current position, like stdio's ftell() and an error. +// Beware that this value may not be completely accurate because one line from +// the chan(tail.Lines) may have been read already. func (tail *Tail) Tell() (offset int64, err error) { if tail.file == nil { return @@ -167,7 +180,8 @@ func (tail *Tail) Stop() error { return tail.Wait() } -// StopAtEOF stops tailing as soon as the end of the file is reached. +// StopAtEOF stops tailing as soon as the end of the file is reached. The function +// returns an error, func (tail *Tail) StopAtEOF() error { tail.Kill(errStopAtEOF) return tail.Wait() @@ -435,6 +449,7 @@ func (tail *Tail) sendLine(line string) bool { // Cleanup removes inotify watches added by the tail package. This function is // meant to be invoked from a process's exit handler. Linux kernel may not // automatically remove inotify watches after the process exits. +// If you plan to re-read a file, don't call Cleanup in between. func (tail *Tail) Cleanup() { watch.Cleanup(tail.Filename) } diff --git a/vendor/github.com/nxadm/tail/tail_posix.go b/vendor/github.com/nxadm/tail/tail_posix.go index 1b94520ec..23e071dea 100644 --- a/vendor/github.com/nxadm/tail/tail_posix.go +++ b/vendor/github.com/nxadm/tail/tail_posix.go @@ -1,3 +1,4 @@ +// Copyright (c) 2019 FOSS contributors of https://github.com/nxadm/tail // +build !windows package tail @@ -6,6 +7,11 @@ import ( "os" ) +// Deprecated: this function is only useful internally and, as such, +// it will be removed from the API in a future major release. +// +// OpenFile proxies a os.Open call for a file so it can be correctly tailed +// on POSIX and non-POSIX OSes like MS Windows. func OpenFile(name string) (file *os.File, err error) { return os.Open(name) } diff --git a/vendor/github.com/nxadm/tail/tail_windows.go b/vendor/github.com/nxadm/tail/tail_windows.go index 4aaceea28..da0d2f39c 100644 --- a/vendor/github.com/nxadm/tail/tail_windows.go +++ b/vendor/github.com/nxadm/tail/tail_windows.go @@ -1,12 +1,19 @@ +// Copyright (c) 2019 FOSS contributors of https://github.com/nxadm/tail // +build windows package tail import ( - "github.com/nxadm/tail/winfile" "os" + + "github.com/nxadm/tail/winfile" ) +// Deprecated: this function is only useful internally and, as such, +// it will be removed from the API in a future major release. +// +// OpenFile proxies a os.Open call for a file so it can be correctly tailed +// on POSIX and non-POSIX OSes like MS Windows. func OpenFile(name string) (file *os.File, err error) { return winfile.OpenFile(name, os.O_RDONLY, 0) } diff --git a/vendor/github.com/nxadm/tail/util/util.go b/vendor/github.com/nxadm/tail/util/util.go index 2ba0ed71c..b64caa212 100644 --- a/vendor/github.com/nxadm/tail/util/util.go +++ b/vendor/github.com/nxadm/tail/util/util.go @@ -1,3 +1,4 @@ +// Copyright (c) 2019 FOSS contributors of https://github.com/nxadm/tail // Copyright (c) 2015 HPE Software Inc. All rights reserved. // Copyright (c) 2013 ActiveState Software Inc. All rights reserved. diff --git a/vendor/github.com/nxadm/tail/watch/filechanges.go b/vendor/github.com/nxadm/tail/watch/filechanges.go index f80aead9a..5b65f42ae 100644 --- a/vendor/github.com/nxadm/tail/watch/filechanges.go +++ b/vendor/github.com/nxadm/tail/watch/filechanges.go @@ -1,3 +1,4 @@ +// Copyright (c) 2019 FOSS contributors of https://github.com/nxadm/tail package watch type FileChanges struct { diff --git a/vendor/github.com/nxadm/tail/watch/inotify.go b/vendor/github.com/nxadm/tail/watch/inotify.go index 439921810..cbd11ad8d 100644 --- a/vendor/github.com/nxadm/tail/watch/inotify.go +++ b/vendor/github.com/nxadm/tail/watch/inotify.go @@ -1,3 +1,4 @@ +// Copyright (c) 2019 FOSS contributors of https://github.com/nxadm/tail // Copyright (c) 2015 HPE Software Inc. All rights reserved. // Copyright (c) 2013 ActiveState Software Inc. All rights reserved. diff --git a/vendor/github.com/nxadm/tail/watch/inotify_tracker.go b/vendor/github.com/nxadm/tail/watch/inotify_tracker.go index a94bcd4cb..cb9572a03 100644 --- a/vendor/github.com/nxadm/tail/watch/inotify_tracker.go +++ b/vendor/github.com/nxadm/tail/watch/inotify_tracker.go @@ -1,3 +1,4 @@ +// Copyright (c) 2019 FOSS contributors of https://github.com/nxadm/tail // Copyright (c) 2015 HPE Software Inc. All rights reserved. // Copyright (c) 2013 ActiveState Software Inc. All rights reserved. diff --git a/vendor/github.com/nxadm/tail/watch/polling.go b/vendor/github.com/nxadm/tail/watch/polling.go index fb1706908..74e10aa42 100644 --- a/vendor/github.com/nxadm/tail/watch/polling.go +++ b/vendor/github.com/nxadm/tail/watch/polling.go @@ -1,3 +1,4 @@ +// Copyright (c) 2019 FOSS contributors of https://github.com/nxadm/tail // Copyright (c) 2015 HPE Software Inc. All rights reserved. // Copyright (c) 2013 ActiveState Software Inc. All rights reserved. diff --git a/vendor/github.com/nxadm/tail/watch/watch.go b/vendor/github.com/nxadm/tail/watch/watch.go index 2e1783ef0..2b5112805 100644 --- a/vendor/github.com/nxadm/tail/watch/watch.go +++ b/vendor/github.com/nxadm/tail/watch/watch.go @@ -1,3 +1,4 @@ +// Copyright (c) 2019 FOSS contributors of https://github.com/nxadm/tail // Copyright (c) 2015 HPE Software Inc. All rights reserved. // Copyright (c) 2013 ActiveState Software Inc. All rights reserved. diff --git a/vendor/github.com/nxadm/tail/winfile/winfile.go b/vendor/github.com/nxadm/tail/winfile/winfile.go index aa7e7bc5d..4562ac7c2 100644 --- a/vendor/github.com/nxadm/tail/winfile/winfile.go +++ b/vendor/github.com/nxadm/tail/winfile/winfile.go @@ -1,3 +1,4 @@ +// Copyright (c) 2019 FOSS contributors of https://github.com/nxadm/tail // +build windows package winfile diff --git a/vendor/github.com/onsi/ginkgo/.travis.yml b/vendor/github.com/onsi/ginkgo/.travis.yml index 079af2431..ea0966d5b 100644 --- a/vendor/github.com/onsi/ginkgo/.travis.yml +++ b/vendor/github.com/onsi/ginkgo/.travis.yml @@ -1,8 +1,8 @@ language: go go: - - 1.13.x - - 1.14.x - tip + - 1.16.x + - 1.15.x cache: directories: @@ -16,10 +16,9 @@ install: - GO111MODULE="off" go get golang.org/x/tools/cmd/cover - GO111MODULE="off" go get github.com/onsi/gomega - GO111MODULE="off" go install github.com/onsi/ginkgo/ginkgo - - export PATH=$PATH:$HOME/gopath/bin + - export PATH=$GOPATH/bin:$PATH script: - - GO111MODULE="on" go mod tidy - - diff -u <(echo -n) <(git diff go.mod) - - diff -u <(echo -n) <(git diff go.sum) - - $HOME/gopath/bin/ginkgo -r --randomizeAllSpecs --randomizeSuites --race --trace && go vet + - GO111MODULE="on" go mod tidy && git diff --exit-code go.mod go.sum + - go vet + - ginkgo -r --randomizeAllSpecs --randomizeSuites --race --trace diff --git a/vendor/github.com/onsi/ginkgo/CHANGELOG.md b/vendor/github.com/onsi/ginkgo/CHANGELOG.md index a733f95fc..a26bc530f 100644 --- a/vendor/github.com/onsi/ginkgo/CHANGELOG.md +++ b/vendor/github.com/onsi/ginkgo/CHANGELOG.md @@ -1,3 +1,64 @@ +## 1.16.5 + +Ginkgo 2.0 now has a Release Candidate. 1.16.5 advertises the existence of the RC. +1.16.5 deprecates GinkgoParallelNode in favor of GinkgoParallelProcess + +You can silence the RC advertisement by setting an `ACK_GINKG_RC=true` environment variable or creating a file in your home directory called `.ack-ginkgo-rc` + +## 1.16.4 + +### Fixes +1.16.4 retracts 1.16.3. There are no code changes. The 1.16.3 tag was associated with the wrong commit and an attempt to change it after-the-fact has proven problematic. 1.16.4 retracts 1.16.3 in Ginkgo's go.mod and creates a new, correctly tagged, release. + +## 1.16.3 + +### Features +- Measure is now deprecated and emits a deprecation warning. + +## 1.16.2 + +### Fixes +- Deprecations can be suppressed by setting an `ACK_GINKGO_DEPRECATIONS=` environment variable. + +## 1.16.1 + +### Fixes +- Supress --stream deprecation warning on windows (#793) + +## 1.16.0 + +### Features +- Advertise Ginkgo 2.0. Introduce deprecations. [9ef1913] + - Update README.md to advertise that Ginkgo 2.0 is coming. + - Backport the 2.0 DeprecationTracker and start alerting users + about upcoming deprecations. + +- Add slim-sprig template functions to bootstrap/generate (#775) [9162b86] + +### Fixes +- Fix accidental reference to 1488 (#784) [9fb7fe4] + +## 1.15.2 + +### Fixes +- ignore blank `-focus` and `-skip` flags (#780) [e90a4a0] + +## 1.15.1 + +### Fixes +- reporters/junit: Use `system-out` element instead of `passed` (#769) [9eda305] + +## 1.15.0 + +### Features +- Adds 'outline' command to print the outline of specs/containers in a file (#754) [071c369] [6803cc3] [935b538] [06744e8] [0c40583] +- Add support for using template to generate tests (#752) [efb9e69] +- Add a Chinese Doc #755 (#756) [5207632] +- cli: allow multiple -focus and -skip flags (#736) [9a782fb] + +### Fixes +- Add _internal to filename of tests created with internal flag (#751) [43c12da] + ## 1.14.2 ### Fixes diff --git a/vendor/github.com/onsi/ginkgo/README.md b/vendor/github.com/onsi/ginkgo/README.md index 475e04994..a25ca5e03 100644 --- a/vendor/github.com/onsi/ginkgo/README.md +++ b/vendor/github.com/onsi/ginkgo/README.md @@ -1,11 +1,19 @@ ![Ginkgo: A Go BDD Testing Framework](https://onsi.github.io/ginkgo/images/ginkgo.png) -[![Build Status](https://travis-ci.org/onsi/ginkgo.svg?branch=master)](https://travis-ci.org/onsi/ginkgo) +[![test](https://github.com/onsi/ginkgo/workflows/test/badge.svg?branch=master)](https://github.com/onsi/ginkgo/actions?query=workflow%3Atest+branch%3Amaster) -Jump to the [docs](https://onsi.github.io/ginkgo/) to learn more. To start rolling your Ginkgo tests *now* [keep reading](#set-me-up)! +Jump to the [docs](https://onsi.github.io/ginkgo/) | [中文文档](https://ke-chain.github.io/ginkgodoc) to learn more. To start rolling your Ginkgo tests *now* [keep reading](#set-me-up)! If you have a question, comment, bug report, feature request, etc. please open a GitHub issue, or visit the [Ginkgo Slack channel](https://app.slack.com/client/T029RQSE6/CQQ50BBNW). +# Ginkgo 2.0 Release Candidate is available! + +An effort is underway to develop and deliver Ginkgo 2.0. The work is happening in the [ver2](https://github.com/onsi/ginkgo/tree/ver2) branch and a changelog and migration guide is being maintained on that branch [here](https://github.com/onsi/ginkgo/blob/ver2/docs/MIGRATING_TO_V2.md). Issue [#711](https://github.com/onsi/ginkgo/issues/711) is the central place for discussion. + +As described in the [changelog](https://github.com/onsi/ginkgo/blob/ver2/docs/MIGRATING_TO_V2.md) and [proposal](https://docs.google.com/document/d/1h28ZknXRsTLPNNiOjdHIO-F2toCzq4xoZDXbfYaBdoQ/edit#), Ginkgo 2.0 will clean up the Ginkgo codebase, deprecate and remove some v1 functionality, and add several new much-requested features. To help users get ready for the migration, Ginkgo v1 has started emitting deprecation warnings for features that will no longer be supported with links to documentation for how to migrate away from these features. If you have concerns or comments please chime in on [#711](https://github.com/onsi/ginkgo/issues/711). + +Please start exploring and using the V2 release! To get started follow the [Using the Release Candidate](https://github.com/onsi/ginkgo/blob/ver2/docs/MIGRATING_TO_V2.md#using-the-beta) directions in the migration guide. + ## TLDR Ginkgo builds on Go's `testing` package, allowing expressive [Behavior-Driven Development](https://en.wikipedia.org/wiki/Behavior-driven_development) ("BDD") style tests. It is typically (and optionally) paired with the [Gomega](https://github.com/onsi/gomega) matcher library. @@ -61,6 +69,8 @@ Describe("the strings package", func() { - [Completions for VSCode](https://github.com/onsi/vscode-ginkgo): just use VSCode's extension installer to install `vscode-ginkgo`. +- [Ginkgo tools for VSCode](https://marketplace.visualstudio.com/items?itemName=joselitofilho.ginkgotestexplorer): just use VSCode's extension installer to install `ginkgoTestExplorer`. + - Straightforward support for third-party testing libraries such as [Gomock](https://code.google.com/p/gomock/) and [Testify](https://github.com/stretchr/testify). Check out the [docs](https://onsi.github.io/ginkgo/#third-party-integrations) for details. - A modular architecture that lets you easily: diff --git a/vendor/github.com/onsi/ginkgo/RELEASING.md b/vendor/github.com/onsi/ginkgo/RELEASING.md index 1e298c2da..db3d234c1 100644 --- a/vendor/github.com/onsi/ginkgo/RELEASING.md +++ b/vendor/github.com/onsi/ginkgo/RELEASING.md @@ -8,7 +8,10 @@ A Ginkgo release is a tagged git sha and a GitHub release. To cut a release: - Fixes (fix version) - Maintenance (which in general should not be mentioned in `CHANGELOG.md` as they have no user impact) 1. Update `VERSION` in `config/config.go` -1. Create a commit with the version number as the commit message (e.g. `v1.3.0`) -1. Tag the commit with the version number as the tag name (e.g. `v1.3.0`) -1. Push the commit and tag to GitHub -1. Create a new [GitHub release](https://help.github.com/articles/creating-releases/) with the version number as the tag (e.g. `v1.3.0`). List the key changes in the release notes. +1. Commit, push, and release: + ``` + git commit -m "vM.m.p" + git push + gh release create "vM.m.p" + git fetch --tags origin master + ``` \ No newline at end of file diff --git a/vendor/github.com/onsi/ginkgo/config/config.go b/vendor/github.com/onsi/ginkgo/config/config.go index 3220c095c..3130c7789 100644 --- a/vendor/github.com/onsi/ginkgo/config/config.go +++ b/vendor/github.com/onsi/ginkgo/config/config.go @@ -20,14 +20,14 @@ import ( "fmt" ) -const VERSION = "1.14.2" +const VERSION = "1.16.5" type GinkgoConfigType struct { RandomSeed int64 RandomizeAllSpecs bool RegexScansFilePath bool - FocusString string - SkipString string + FocusStrings []string + SkipStrings []string SkipMeasurements bool FailOnPending bool FailFast bool @@ -65,6 +65,11 @@ func processPrefix(prefix string) string { return prefix } +type flagFunc func(string) + +func (f flagFunc) String() string { return "" } +func (f flagFunc) Set(s string) error { f(s); return nil } + func Flags(flagSet *flag.FlagSet, prefix string, includeParallelFlags bool) { prefix = processPrefix(prefix) flagSet.Int64Var(&(GinkgoConfig.RandomSeed), prefix+"seed", time.Now().Unix(), "The seed used to randomize the spec suite.") @@ -75,8 +80,8 @@ func Flags(flagSet *flag.FlagSet, prefix string, includeParallelFlags bool) { flagSet.BoolVar(&(GinkgoConfig.DryRun), prefix+"dryRun", false, "If set, ginkgo will walk the test hierarchy without actually running anything. Best paired with -v.") - flagSet.StringVar(&(GinkgoConfig.FocusString), prefix+"focus", "", "If set, ginkgo will only run specs that match this regular expression.") - flagSet.StringVar(&(GinkgoConfig.SkipString), prefix+"skip", "", "If set, ginkgo will only run specs that do not match this regular expression.") + flagSet.Var(flagFunc(flagFocus), prefix+"focus", "If set, ginkgo will only run specs that match this regular expression. Can be specified multiple times, values are ORed.") + flagSet.Var(flagFunc(flagSkip), prefix+"skip", "If set, ginkgo will only run specs that do not match this regular expression. Can be specified multiple times, values are ORed.") flagSet.BoolVar(&(GinkgoConfig.RegexScansFilePath), prefix+"regexScansFilePath", false, "If set, ginkgo regex matching also will look at the file path (code location).") @@ -133,12 +138,12 @@ func BuildFlagArgs(prefix string, ginkgo GinkgoConfigType, reporter DefaultRepor result = append(result, fmt.Sprintf("--%sdryRun", prefix)) } - if ginkgo.FocusString != "" { - result = append(result, fmt.Sprintf("--%sfocus=%s", prefix, ginkgo.FocusString)) + for _, s := range ginkgo.FocusStrings { + result = append(result, fmt.Sprintf("--%sfocus=%s", prefix, s)) } - if ginkgo.SkipString != "" { - result = append(result, fmt.Sprintf("--%sskip=%s", prefix, ginkgo.SkipString)) + for _, s := range ginkgo.SkipStrings { + result = append(result, fmt.Sprintf("--%sskip=%s", prefix, s)) } if ginkgo.FlakeAttempts > 1 { @@ -211,3 +216,17 @@ func BuildFlagArgs(prefix string, ginkgo GinkgoConfigType, reporter DefaultRepor return result } + +// flagFocus implements the -focus flag. +func flagFocus(arg string) { + if arg != "" { + GinkgoConfig.FocusStrings = append(GinkgoConfig.FocusStrings, arg) + } +} + +// flagSkip implements the -skip flag. +func flagSkip(arg string) { + if arg != "" { + GinkgoConfig.SkipStrings = append(GinkgoConfig.SkipStrings, arg) + } +} diff --git a/vendor/github.com/onsi/ginkgo/formatter/formatter.go b/vendor/github.com/onsi/ginkgo/formatter/formatter.go new file mode 100644 index 000000000..30d7cbe12 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/formatter/formatter.go @@ -0,0 +1,190 @@ +package formatter + +import ( + "fmt" + "regexp" + "strings" +) + +const COLS = 80 + +type ColorMode uint8 + +const ( + ColorModeNone ColorMode = iota + ColorModeTerminal + ColorModePassthrough +) + +var SingletonFormatter = New(ColorModeTerminal) + +func F(format string, args ...interface{}) string { + return SingletonFormatter.F(format, args...) +} + +func Fi(indentation uint, format string, args ...interface{}) string { + return SingletonFormatter.Fi(indentation, format, args...) +} + +func Fiw(indentation uint, maxWidth uint, format string, args ...interface{}) string { + return SingletonFormatter.Fiw(indentation, maxWidth, format, args...) +} + +type Formatter struct { + ColorMode ColorMode + colors map[string]string + styleRe *regexp.Regexp + preserveColorStylingTags bool +} + +func NewWithNoColorBool(noColor bool) Formatter { + if noColor { + return New(ColorModeNone) + } + return New(ColorModeTerminal) +} + +func New(colorMode ColorMode) Formatter { + f := Formatter{ + ColorMode: colorMode, + colors: map[string]string{ + "/": "\x1b[0m", + "bold": "\x1b[1m", + "underline": "\x1b[4m", + + "red": "\x1b[38;5;9m", + "orange": "\x1b[38;5;214m", + "coral": "\x1b[38;5;204m", + "magenta": "\x1b[38;5;13m", + "green": "\x1b[38;5;10m", + "dark-green": "\x1b[38;5;28m", + "yellow": "\x1b[38;5;11m", + "light-yellow": "\x1b[38;5;228m", + "cyan": "\x1b[38;5;14m", + "gray": "\x1b[38;5;243m", + "light-gray": "\x1b[38;5;246m", + "blue": "\x1b[38;5;12m", + }, + } + colors := []string{} + for color := range f.colors { + colors = append(colors, color) + } + f.styleRe = regexp.MustCompile("{{(" + strings.Join(colors, "|") + ")}}") + return f +} + +func (f Formatter) F(format string, args ...interface{}) string { + return f.Fi(0, format, args...) +} + +func (f Formatter) Fi(indentation uint, format string, args ...interface{}) string { + return f.Fiw(indentation, 0, format, args...) +} + +func (f Formatter) Fiw(indentation uint, maxWidth uint, format string, args ...interface{}) string { + out := fmt.Sprintf(f.style(format), args...) + + if indentation == 0 && maxWidth == 0 { + return out + } + + lines := strings.Split(out, "\n") + + if maxWidth != 0 { + outLines := []string{} + + maxWidth = maxWidth - indentation*2 + for _, line := range lines { + if f.length(line) <= maxWidth { + outLines = append(outLines, line) + continue + } + outWords := []string{} + length := uint(0) + words := strings.Split(line, " ") + for _, word := range words { + wordLength := f.length(word) + if length+wordLength <= maxWidth { + length += wordLength + outWords = append(outWords, word) + continue + } + outLines = append(outLines, strings.Join(outWords, " ")) + outWords = []string{word} + length = wordLength + } + if len(outWords) > 0 { + outLines = append(outLines, strings.Join(outWords, " ")) + } + } + + lines = outLines + } + + if indentation == 0 { + return strings.Join(lines, "\n") + } + + padding := strings.Repeat(" ", int(indentation)) + for i := range lines { + if lines[i] != "" { + lines[i] = padding + lines[i] + } + } + + return strings.Join(lines, "\n") +} + +func (f Formatter) length(styled string) uint { + n := uint(0) + inStyle := false + for _, b := range styled { + if inStyle { + if b == 'm' { + inStyle = false + } + continue + } + if b == '\x1b' { + inStyle = true + continue + } + n += 1 + } + return n +} + +func (f Formatter) CycleJoin(elements []string, joiner string, cycle []string) string { + if len(elements) == 0 { + return "" + } + n := len(cycle) + out := "" + for i, text := range elements { + out += cycle[i%n] + text + if i < len(elements)-1 { + out += joiner + } + } + out += "{{/}}" + return f.style(out) +} + +func (f Formatter) style(s string) string { + switch f.ColorMode { + case ColorModeNone: + return f.styleRe.ReplaceAllString(s, "") + case ColorModePassthrough: + return s + case ColorModeTerminal: + return f.styleRe.ReplaceAllStringFunc(s, func(match string) string { + if out, ok := f.colors[strings.Trim(match, "{}")]; ok { + return out + } + return match + }) + } + + return "" +} diff --git a/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go b/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go index 7e8a48708..ccd7685e3 100644 --- a/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go +++ b/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go @@ -17,6 +17,7 @@ import ( "io" "net/http" "os" + "reflect" "strings" "time" @@ -32,6 +33,8 @@ import ( "github.com/onsi/ginkgo/types" ) +var deprecationTracker = types.NewDeprecationTracker() + const GINKGO_VERSION = config.VERSION const GINKGO_PANIC = ` Your test failed. @@ -70,9 +73,15 @@ func GinkgoRandomSeed() int64 { return config.GinkgoConfig.RandomSeed } -//GinkgoParallelNode returns the parallel node number for the current ginkgo process -//The node number is 1-indexed +//GinkgoParallelNode is deprecated, use GinkgoParallelProcess instead func GinkgoParallelNode() int { + deprecationTracker.TrackDeprecation(types.Deprecations.ParallelNode(), codelocation.New(1)) + return GinkgoParallelProcess() +} + +//GinkgoParallelProcess returns the parallel process number for the current ginkgo process +//The process number is 1-indexed +func GinkgoParallelProcess() int { return config.GinkgoConfig.ParallelNode } @@ -106,6 +115,7 @@ func GinkgoT(optionalOffset ...int) GinkgoTInterface { //in the testing package's T. type GinkgoTInterface interface { Cleanup(func()) + Setenv(key, value string) Error(args ...interface{}) Errorf(format string, args ...interface{}) Fail() @@ -205,21 +215,27 @@ func RunSpecs(t GinkgoTestingT, description string) bool { if config.DefaultReporterConfig.ReportFile != "" { reportFile := config.DefaultReporterConfig.ReportFile specReporters[0] = reporters.NewJUnitReporter(reportFile) - return RunSpecsWithDefaultAndCustomReporters(t, description, specReporters) + specReporters = append(specReporters, buildDefaultReporter()) } - return RunSpecsWithCustomReporters(t, description, specReporters) + return runSpecsWithCustomReporters(t, description, specReporters) } //To run your tests with Ginkgo's default reporter and your custom reporter(s), replace //RunSpecs() with this method. func RunSpecsWithDefaultAndCustomReporters(t GinkgoTestingT, description string, specReporters []Reporter) bool { + deprecationTracker.TrackDeprecation(types.Deprecations.CustomReporter()) specReporters = append(specReporters, buildDefaultReporter()) - return RunSpecsWithCustomReporters(t, description, specReporters) + return runSpecsWithCustomReporters(t, description, specReporters) } //To run your tests with your custom reporter(s) (and *not* Ginkgo's default reporter), replace //RunSpecs() with this method. Note that parallel tests will not work correctly without the default reporter func RunSpecsWithCustomReporters(t GinkgoTestingT, description string, specReporters []Reporter) bool { + deprecationTracker.TrackDeprecation(types.Deprecations.CustomReporter()) + return runSpecsWithCustomReporters(t, description, specReporters) +} + +func runSpecsWithCustomReporters(t GinkgoTestingT, description string, specReporters []Reporter) bool { writer := GinkgoWriter.(*writer.Writer) writer.SetStream(config.DefaultReporterConfig.Verbose) reporters := make([]reporters.Reporter, len(specReporters)) @@ -227,6 +243,11 @@ func RunSpecsWithCustomReporters(t GinkgoTestingT, description string, specRepor reporters[i] = reporter } passed, hasFocusedTests := global.Suite.Run(t, description, reporters, writer, config.GinkgoConfig) + + if deprecationTracker.DidTrackDeprecations() { + fmt.Fprintln(colorable.NewColorableStderr(), deprecationTracker.DeprecationsReport()) + } + if passed && hasFocusedTests && strings.TrimSpace(os.Getenv("GINKGO_EDITOR_INTEGRATION")) == "" { fmt.Println("PASS | FOCUSED") os.Exit(types.GINKGO_FOCUS_EXIT_CODE) @@ -380,12 +401,14 @@ func XWhen(text string, body func()) bool { //Ginkgo will normally run It blocks synchronously. To perform asynchronous tests, pass a //function that accepts a Done channel. When you do this, you can also provide an optional timeout. func It(text string, body interface{}, timeout ...float64) bool { + validateBodyFunc(body, codelocation.New(1)) global.Suite.PushItNode(text, body, types.FlagTypeNone, codelocation.New(1), parseTimeout(timeout...)) return true } //You can focus individual Its using FIt func FIt(text string, body interface{}, timeout ...float64) bool { + validateBodyFunc(body, codelocation.New(1)) global.Suite.PushItNode(text, body, types.FlagTypeFocused, codelocation.New(1), parseTimeout(timeout...)) return true } @@ -406,12 +429,14 @@ func XIt(text string, _ ...interface{}) bool { //which "It" does not fit into a natural sentence flow. All the same protocols apply for Specify blocks //which apply to It blocks. func Specify(text string, body interface{}, timeout ...float64) bool { + validateBodyFunc(body, codelocation.New(1)) global.Suite.PushItNode(text, body, types.FlagTypeNone, codelocation.New(1), parseTimeout(timeout...)) return true } //You can focus individual Specifys using FSpecify func FSpecify(text string, body interface{}, timeout ...float64) bool { + validateBodyFunc(body, codelocation.New(1)) global.Suite.PushItNode(text, body, types.FlagTypeFocused, codelocation.New(1), parseTimeout(timeout...)) return true } @@ -455,24 +480,28 @@ func By(text string, callbacks ...func()) { //The body function must have the signature: // func(b Benchmarker) func Measure(text string, body interface{}, samples int) bool { + deprecationTracker.TrackDeprecation(types.Deprecations.Measure(), codelocation.New(1)) global.Suite.PushMeasureNode(text, body, types.FlagTypeNone, codelocation.New(1), samples) return true } //You can focus individual Measures using FMeasure func FMeasure(text string, body interface{}, samples int) bool { + deprecationTracker.TrackDeprecation(types.Deprecations.Measure(), codelocation.New(1)) global.Suite.PushMeasureNode(text, body, types.FlagTypeFocused, codelocation.New(1), samples) return true } //You can mark Measurements as pending using PMeasure func PMeasure(text string, _ ...interface{}) bool { + deprecationTracker.TrackDeprecation(types.Deprecations.Measure(), codelocation.New(1)) global.Suite.PushMeasureNode(text, func(b Benchmarker) {}, types.FlagTypePending, codelocation.New(1), 0) return true } //You can mark Measurements as pending using XMeasure func XMeasure(text string, _ ...interface{}) bool { + deprecationTracker.TrackDeprecation(types.Deprecations.Measure(), codelocation.New(1)) global.Suite.PushMeasureNode(text, func(b Benchmarker) {}, types.FlagTypePending, codelocation.New(1), 0) return true } @@ -484,6 +513,7 @@ func XMeasure(text string, _ ...interface{}) bool { // //You may only register *one* BeforeSuite handler per test suite. You typically do so in your bootstrap file at the top level. func BeforeSuite(body interface{}, timeout ...float64) bool { + validateBodyFunc(body, codelocation.New(1)) global.Suite.SetBeforeSuiteNode(body, codelocation.New(1), parseTimeout(timeout...)) return true } @@ -497,6 +527,7 @@ func BeforeSuite(body interface{}, timeout ...float64) bool { // //You may only register *one* AfterSuite handler per test suite. You typically do so in your bootstrap file at the top level. func AfterSuite(body interface{}, timeout ...float64) bool { + validateBodyFunc(body, codelocation.New(1)) global.Suite.SetAfterSuiteNode(body, codelocation.New(1), parseTimeout(timeout...)) return true } @@ -584,6 +615,7 @@ func SynchronizedAfterSuite(allNodesBody interface{}, node1Body interface{}, tim //Like It blocks, BeforeEach blocks can be made asynchronous by providing a body function that accepts //a Done channel func BeforeEach(body interface{}, timeout ...float64) bool { + validateBodyFunc(body, codelocation.New(1)) global.Suite.PushBeforeEachNode(body, codelocation.New(1), parseTimeout(timeout...)) return true } @@ -594,6 +626,7 @@ func BeforeEach(body interface{}, timeout ...float64) bool { //Like It blocks, BeforeEach blocks can be made asynchronous by providing a body function that accepts //a Done channel func JustBeforeEach(body interface{}, timeout ...float64) bool { + validateBodyFunc(body, codelocation.New(1)) global.Suite.PushJustBeforeEachNode(body, codelocation.New(1), parseTimeout(timeout...)) return true } @@ -604,6 +637,7 @@ func JustBeforeEach(body interface{}, timeout ...float64) bool { //Like It blocks, JustAfterEach blocks can be made asynchronous by providing a body function that accepts //a Done channel func JustAfterEach(body interface{}, timeout ...float64) bool { + validateBodyFunc(body, codelocation.New(1)) global.Suite.PushJustAfterEachNode(body, codelocation.New(1), parseTimeout(timeout...)) return true } @@ -614,10 +648,30 @@ func JustAfterEach(body interface{}, timeout ...float64) bool { //Like It blocks, AfterEach blocks can be made asynchronous by providing a body function that accepts //a Done channel func AfterEach(body interface{}, timeout ...float64) bool { + validateBodyFunc(body, codelocation.New(1)) global.Suite.PushAfterEachNode(body, codelocation.New(1), parseTimeout(timeout...)) return true } +func validateBodyFunc(body interface{}, cl types.CodeLocation) { + t := reflect.TypeOf(body) + if t.Kind() != reflect.Func { + return + } + + if t.NumOut() > 0 { + return + } + + if t.NumIn() == 0 { + return + } + + if t.In(0) == reflect.TypeOf(make(Done)) { + deprecationTracker.TrackDeprecation(types.Deprecations.Async(), cl) + } +} + func parseTimeout(timeout ...float64) time.Duration { if len(timeout) == 0 { return global.DefaultTimeout diff --git a/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_darwin.go b/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_darwin.go deleted file mode 100644 index e3d09eadb..000000000 --- a/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_darwin.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build darwin - -package remote - -import ( - "golang.org/x/sys/unix" -) - -func interceptorDupx(oldfd int, newfd int) { - unix.Dup2(oldfd, newfd) -} diff --git a/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_dragonfly.go b/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_dragonfly.go deleted file mode 100644 index 72d38686a..000000000 --- a/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_dragonfly.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build dragonfly - -package remote - -import ( - "golang.org/x/sys/unix" -) - -func interceptorDupx(oldfd int, newfd int) { - unix.Dup2(oldfd, newfd) -} diff --git a/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_freebsd.go b/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_freebsd.go deleted file mode 100644 index 497d548d9..000000000 --- a/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_freebsd.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build freebsd - -package remote - -import ( - "golang.org/x/sys/unix" -) - -func interceptorDupx(oldfd int, newfd int) { - unix.Dup2(oldfd, newfd) -} diff --git a/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_linux.go b/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_linux.go deleted file mode 100644 index 29add0d33..000000000 --- a/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_linux.go +++ /dev/null @@ -1,12 +0,0 @@ -// +build linux -// +build !mips64le - -package remote - -import ( - "golang.org/x/sys/unix" -) - -func interceptorDupx(oldfd int, newfd int) { - unix.Dup2(oldfd, newfd) -} diff --git a/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_linux_mips64le.go b/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_linux_mips64le.go deleted file mode 100644 index 09bd06260..000000000 --- a/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_linux_mips64le.go +++ /dev/null @@ -1,12 +0,0 @@ -// +build linux -// +build mips64le - -package remote - -import ( - "golang.org/x/sys/unix" -) - -func interceptorDupx(oldfd int, newfd int) { - unix.Dup3(oldfd, newfd, 0) -} diff --git a/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_netbsd.go b/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_netbsd.go deleted file mode 100644 index 16ad6aeb2..000000000 --- a/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_netbsd.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build netbsd - -package remote - -import ( - "golang.org/x/sys/unix" -) - -func interceptorDupx(oldfd int, newfd int) { - unix.Dup2(oldfd, newfd) -} diff --git a/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_openbsd.go b/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_openbsd.go deleted file mode 100644 index 4275f8421..000000000 --- a/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_openbsd.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build openbsd - -package remote - -import ( - "golang.org/x/sys/unix" -) - -func interceptorDupx(oldfd int, newfd int) { - unix.Dup2(oldfd, newfd) -} diff --git a/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_solaris.go b/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_solaris.go deleted file mode 100644 index 882a38a9e..000000000 --- a/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_solaris.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build solaris - -package remote - -import ( - "golang.org/x/sys/unix" -) - -func interceptorDupx(oldfd int, newfd int) { - unix.Dup2(oldfd, newfd) -} diff --git a/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_unix.go b/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_unix.go index 80614d0ce..774967db6 100644 --- a/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_unix.go +++ b/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_unix.go @@ -8,6 +8,7 @@ import ( "os" "github.com/nxadm/tail" + "golang.org/x/sys/unix" ) func NewOutputInterceptor() OutputInterceptor { @@ -35,8 +36,10 @@ func (interceptor *outputInterceptor) StartInterceptingOutput() error { return err } - interceptorDupx(int(interceptor.redirectFile.Fd()), 1) - interceptorDupx(int(interceptor.redirectFile.Fd()), 2) + // This might call Dup3 if the dup2 syscall is not available, e.g. on + // linux/arm64 or linux/riscv64 + unix.Dup2(int(interceptor.redirectFile.Fd()), 1) + unix.Dup2(int(interceptor.redirectFile.Fd()), 2) if interceptor.streamTarget != nil { interceptor.tailer, _ = tail.TailFile(interceptor.redirectFile.Name(), tail.Config{Follow: true}) diff --git a/vendor/github.com/onsi/ginkgo/internal/spec/specs.go b/vendor/github.com/onsi/ginkgo/internal/spec/specs.go index 8a2007137..0a24139fb 100644 --- a/vendor/github.com/onsi/ginkgo/internal/spec/specs.go +++ b/vendor/github.com/onsi/ginkgo/internal/spec/specs.go @@ -4,6 +4,7 @@ import ( "math/rand" "regexp" "sort" + "strings" ) type Specs struct { @@ -46,11 +47,11 @@ func (e *Specs) Shuffle(r *rand.Rand) { e.names = names } -func (e *Specs) ApplyFocus(description string, focusString string, skipString string) { - if focusString == "" && skipString == "" { +func (e *Specs) ApplyFocus(description string, focus, skip []string) { + if len(focus)+len(skip) == 0 { e.applyProgrammaticFocus() } else { - e.applyRegExpFocusAndSkip(description, focusString, skipString) + e.applyRegExpFocusAndSkip(description, focus, skip) } } @@ -90,14 +91,13 @@ func (e *Specs) toMatch(description string, i int) []byte { } } -func (e *Specs) applyRegExpFocusAndSkip(description string, focusString string, skipString string) { - var focusFilter *regexp.Regexp - if focusString != "" { - focusFilter = regexp.MustCompile(focusString) +func (e *Specs) applyRegExpFocusAndSkip(description string, focus, skip []string) { + var focusFilter, skipFilter *regexp.Regexp + if len(focus) > 0 { + focusFilter = regexp.MustCompile(strings.Join(focus, "|")) } - var skipFilter *regexp.Regexp - if skipString != "" { - skipFilter = regexp.MustCompile(skipString) + if len(skip) > 0 { + skipFilter = regexp.MustCompile(strings.Join(skip, "|")) } for i, spec := range e.specs { diff --git a/vendor/github.com/onsi/ginkgo/internal/suite/suite.go b/vendor/github.com/onsi/ginkgo/internal/suite/suite.go index e75da1f89..b4a83c432 100644 --- a/vendor/github.com/onsi/ginkgo/internal/suite/suite.go +++ b/vendor/github.com/onsi/ginkgo/internal/suite/suite.go @@ -97,7 +97,7 @@ func (suite *Suite) generateSpecsIterator(description string, config config.Gink specs.Shuffle(rand.New(rand.NewSource(config.RandomSeed))) } - specs.ApplyFocus(description, config.FocusString, config.SkipString) + specs.ApplyFocus(description, config.FocusStrings, config.SkipStrings) if config.SkipMeasurements { specs.SkipMeasurements() diff --git a/vendor/github.com/onsi/ginkgo/internal/testingtproxy/testing_t_proxy.go b/vendor/github.com/onsi/ginkgo/internal/testingtproxy/testing_t_proxy.go index d7bbb7a96..4dcfaf4cd 100644 --- a/vendor/github.com/onsi/ginkgo/internal/testingtproxy/testing_t_proxy.go +++ b/vendor/github.com/onsi/ginkgo/internal/testingtproxy/testing_t_proxy.go @@ -34,6 +34,11 @@ func (t *ginkgoTestingTProxy) Cleanup(func()) { // No-op } +func (t *ginkgoTestingTProxy) Setenv(kev, value string) { + fmt.Println("Setenv is a noop for Ginkgo at the moment but will be implemented in V2") + // No-op until Cleanup is implemented +} + func (t *ginkgoTestingTProxy) Error(args ...interface{}) { t.fail(fmt.Sprintln(args...), t.offset) } diff --git a/vendor/github.com/onsi/ginkgo/reporters/junit_reporter.go b/vendor/github.com/onsi/ginkgo/reporters/junit_reporter.go index 963caaaff..01ddca6e1 100644 --- a/vendor/github.com/onsi/ginkgo/reporters/junit_reporter.go +++ b/vendor/github.com/onsi/ginkgo/reporters/junit_reporter.go @@ -33,17 +33,12 @@ type JUnitTestSuite struct { type JUnitTestCase struct { Name string `xml:"name,attr"` ClassName string `xml:"classname,attr"` - PassedMessage *JUnitPassedMessage `xml:"passed,omitempty"` FailureMessage *JUnitFailureMessage `xml:"failure,omitempty"` Skipped *JUnitSkipped `xml:"skipped,omitempty"` Time float64 `xml:"time,attr"` SystemOut string `xml:"system-out,omitempty"` } -type JUnitPassedMessage struct { - Message string `xml:",chardata"` -} - type JUnitFailureMessage struct { Type string `xml:"type,attr"` Message string `xml:",chardata"` @@ -114,9 +109,7 @@ func (reporter *JUnitReporter) SpecDidComplete(specSummary *types.SpecSummary) { ClassName: reporter.testSuiteName, } if reporter.ReporterConfig.ReportPassed && specSummary.State == types.SpecStatePassed { - testCase.PassedMessage = &JUnitPassedMessage{ - Message: specSummary.CapturedOutput, - } + testCase.SystemOut = specSummary.CapturedOutput } if specSummary.State == types.SpecStateFailed || specSummary.State == types.SpecStateTimedOut || specSummary.State == types.SpecStatePanicked { testCase.FailureMessage = &JUnitFailureMessage{ diff --git a/vendor/github.com/onsi/ginkgo/types/deprecation_support.go b/vendor/github.com/onsi/ginkgo/types/deprecation_support.go new file mode 100644 index 000000000..d5a6658f3 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/types/deprecation_support.go @@ -0,0 +1,160 @@ +package types + +import ( + "os" + "strconv" + "strings" + "unicode" + + "github.com/onsi/ginkgo/config" + "github.com/onsi/ginkgo/formatter" +) + +type Deprecation struct { + Message string + DocLink string + Version string +} + +type deprecations struct{} + +var Deprecations = deprecations{} + +func (d deprecations) CustomReporter() Deprecation { + return Deprecation{ + Message: "You are using a custom reporter. Support for custom reporters will likely be removed in V2. Most users were using them to generate junit or teamcity reports and this functionality will be merged into the core reporter. In addition, Ginkgo 2.0 will support emitting a JSON-formatted report that users can then manipulate to generate custom reports.\n\n{{red}}{{bold}}If this change will be impactful to you please leave a comment on {{cyan}}{{underline}}https://github.com/onsi/ginkgo/issues/711{{/}}", + DocLink: "removed-custom-reporters", + Version: "1.16.0", + } +} + +func (d deprecations) V1Reporter() Deprecation { + return Deprecation{ + Message: "You are using a V1 Ginkgo Reporter. Please update your custom reporter to the new V2 Reporter interface.", + DocLink: "changed-reporter-interface", + Version: "1.16.0", + } +} + +func (d deprecations) Async() Deprecation { + return Deprecation{ + Message: "You are passing a Done channel to a test node to test asynchronous behavior. This is deprecated in Ginkgo V2. Your test will run synchronously and the timeout will be ignored.", + DocLink: "removed-async-testing", + Version: "1.16.0", + } +} + +func (d deprecations) Measure() Deprecation { + return Deprecation{ + Message: "Measure is deprecated and will be removed in Ginkgo V2. Please migrate to gomega/gmeasure.", + DocLink: "removed-measure", + Version: "1.16.3", + } +} + +func (d deprecations) ParallelNode() Deprecation { + return Deprecation{ + Message: "GinkgoParallelNode is deprecated and will be removed in Ginkgo V2. Please use GinkgoParallelProcess instead.", + DocLink: "renamed-ginkgoparallelnode", + Version: "1.16.5", + } +} + +func (d deprecations) Convert() Deprecation { + return Deprecation{ + Message: "The convert command is deprecated in Ginkgo V2", + DocLink: "removed-ginkgo-convert", + Version: "1.16.0", + } +} + +func (d deprecations) Blur() Deprecation { + return Deprecation{ + Message: "The blur command is deprecated in Ginkgo V2. Use 'ginkgo unfocus' instead.", + Version: "1.16.0", + } +} + +type DeprecationTracker struct { + deprecations map[Deprecation][]CodeLocation +} + +func NewDeprecationTracker() *DeprecationTracker { + return &DeprecationTracker{ + deprecations: map[Deprecation][]CodeLocation{}, + } +} + +func (d *DeprecationTracker) TrackDeprecation(deprecation Deprecation, cl ...CodeLocation) { + ackVersion := os.Getenv("ACK_GINKGO_DEPRECATIONS") + if deprecation.Version != "" && ackVersion != "" { + ack := ParseSemVer(ackVersion) + version := ParseSemVer(deprecation.Version) + if ack.GreaterThanOrEqualTo(version) { + return + } + } + + if len(cl) == 1 { + d.deprecations[deprecation] = append(d.deprecations[deprecation], cl[0]) + } else { + d.deprecations[deprecation] = []CodeLocation{} + } +} + +func (d *DeprecationTracker) DidTrackDeprecations() bool { + return len(d.deprecations) > 0 +} + +func (d *DeprecationTracker) DeprecationsReport() string { + out := formatter.F("\n{{light-yellow}}You're using deprecated Ginkgo functionality:{{/}}\n") + out += formatter.F("{{light-yellow}}============================================={{/}}\n") + out += formatter.F("{{bold}}{{green}}Ginkgo 2.0{{/}} is under active development and will introduce several new features, improvements, and a small handful of breaking changes.\n") + out += formatter.F("A release candidate for 2.0 is now available and 2.0 should GA in Fall 2021. {{bold}}Please give the RC a try and send us feedback!{{/}}\n") + out += formatter.F(" - To learn more, view the migration guide at {{cyan}}{{underline}}https://github.com/onsi/ginkgo/blob/ver2/docs/MIGRATING_TO_V2.md{{/}}\n") + out += formatter.F(" - For instructions on using the Release Candidate visit {{cyan}}{{underline}}https://github.com/onsi/ginkgo/blob/ver2/docs/MIGRATING_TO_V2.md#using-the-beta{{/}}\n") + out += formatter.F(" - To comment, chime in at {{cyan}}{{underline}}https://github.com/onsi/ginkgo/issues/711{{/}}\n\n") + + for deprecation, locations := range d.deprecations { + out += formatter.Fi(1, "{{yellow}}"+deprecation.Message+"{{/}}\n") + if deprecation.DocLink != "" { + out += formatter.Fi(1, "{{bold}}Learn more at:{{/}} {{cyan}}{{underline}}https://github.com/onsi/ginkgo/blob/ver2/docs/MIGRATING_TO_V2.md#%s{{/}}\n", deprecation.DocLink) + } + for _, location := range locations { + out += formatter.Fi(2, "{{gray}}%s{{/}}\n", location) + } + } + out += formatter.F("\n{{gray}}To silence deprecations that can be silenced set the following environment variable:{{/}}\n") + out += formatter.Fi(1, "{{gray}}ACK_GINKGO_DEPRECATIONS=%s{{/}}\n", config.VERSION) + return out +} + +type SemVer struct { + Major int + Minor int + Patch int +} + +func (s SemVer) GreaterThanOrEqualTo(o SemVer) bool { + return (s.Major > o.Major) || + (s.Major == o.Major && s.Minor > o.Minor) || + (s.Major == o.Major && s.Minor == o.Minor && s.Patch >= o.Patch) +} + +func ParseSemVer(semver string) SemVer { + out := SemVer{} + semver = strings.TrimFunc(semver, func(r rune) bool { + return !(unicode.IsNumber(r) || r == '.') + }) + components := strings.Split(semver, ".") + if len(components) > 0 { + out.Major, _ = strconv.Atoi(components[0]) + } + if len(components) > 1 { + out.Minor, _ = strconv.Atoi(components[1]) + } + if len(components) > 2 { + out.Patch, _ = strconv.Atoi(components[2]) + } + return out +} diff --git a/vendor/github.com/onsi/gomega/CHANGELOG.md b/vendor/github.com/onsi/gomega/CHANGELOG.md index fece58b11..b7d7309f3 100644 --- a/vendor/github.com/onsi/gomega/CHANGELOG.md +++ b/vendor/github.com/onsi/gomega/CHANGELOG.md @@ -1,3 +1,169 @@ +## 1.38.2 + +- roll back to go 1.23.0 [c404969] + +## 1.38.1 + +### Fixes + +Numerous minor fixes and dependency bumps + +## 1.38.0 + +### Features +- gstruct handles extra unexported fields [4ee7ed0] + +### Fixes +- support [] in IgnoringTopFunction function signatures (#851) [36bbf72] + +### Maintenance +- Bump golang.org/x/net from 0.40.0 to 0.41.0 (#846) [529d408] +- Fix typo [acd1f55] +- Bump google.golang.org/protobuf from 1.36.5 to 1.36.6 (#835) [bae65a0] +- Bump nokogiri from 1.18.4 to 1.18.8 in /docs (#842) [8dda91f] +- Bump golang.org/x/net from 0.39.0 to 0.40.0 (#843) [212d812] +- Bump github.com/onsi/ginkgo/v2 from 2.23.3 to 2.23.4 (#839) [59bd7f9] +- Bump nokogiri from 1.18.1 to 1.18.4 in /docs (#834) [328c729] +- Bump uri from 1.0.2 to 1.0.3 in /docs (#826) [9a798a1] +- Bump golang.org/x/net from 0.37.0 to 0.39.0 (#841) [04a72c6] + +## 1.37.0 + +### Features +- add To/ToNot/NotTo aliases for AsyncAssertion [5666f98] + +## 1.36.3 + +### Maintenance + +- bump all the things [adb8b49] +- chore: replace `interface{}` with `any` [7613216] +- Bump google.golang.org/protobuf from 1.36.1 to 1.36.5 (#822) [9fe5259] +- remove spurious "toolchain" from go.mod (#819) [a0e85b9] +- Bump golang.org/x/net from 0.33.0 to 0.35.0 (#823) [604a8b1] +- Bump activesupport from 6.0.6.1 to 6.1.7.5 in /docs (#772) [36fbc84] +- Bump github-pages from 231 to 232 in /docs (#778) [ced70d7] +- Bump rexml from 3.2.6 to 3.3.9 in /docs (#788) [c8b4a07] +- Bump github.com/onsi/ginkgo/v2 from 2.22.1 to 2.22.2 (#812) [06431b9] +- Bump webrick from 1.8.1 to 1.9.1 in /docs (#800) [b55a92d] +- Fix typos (#813) [a1d518b] + +## 1.36.2 + +### Maintenance +- Bump google.golang.org/protobuf from 1.35.1 to 1.36.1 (#810) [9a7609d] +- Bump golang.org/x/net from 0.30.0 to 0.33.0 (#807) [b6cb028] +- Bump github.com/onsi/ginkgo/v2 from 2.20.1 to 2.22.1 (#808) [5756529] +- Bump nokogiri from 1.16.3 to 1.16.5 in /docs (#757) [dabc12e] + +## 1.36.1 + +### Fixes +- Fix https://github.com/onsi/gomega/issues/803 [1c6c112] +- resolves onsi/gomega#696: make HaveField great on pointer receivers given only a non-addressable value [4feb9d7] + +## 1.36.0 + +### Features +- new: make collection-related matchers Go 1.23 iterator aware [4c964c6] + +### Maintenance +- Replace min/max helpers with built-in min/max [ece6872] +- Fix some typos in docs [8e924d7] + +## 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 +- Migrate github.com/golang/protobuf to google.golang.org/protobuf [436a197] + + This release drops the deprecated github.com/golang/protobuf and adopts google.golang.org/protobuf. Care was taken to ensure the release is backwards compatible (thanks @jbduncan !). Please open an issue if you run into one. + +- chore: test with Go 1.22 (#733) [32ef35e] +- Bump golang.org/x/net from 0.19.0 to 0.20.0 (#717) [a0d0387] +- Bump github-pages and jekyll-feed in /docs (#732) [b71e477] +- docs: fix typo and broken anchor link to gstruct [f460154] +- docs: fix HaveEach matcher signature [a2862e4] + +## 1.31.1 + +### Fixes +- Inverted arguments order of FailureMessage of BeComparableToMatcher [e0dd999] +- Update test in case keeping msg is desired [ad1a367] + +### Maintenance +- Show how to import the format sub package [24e958d] +- tidy up go.sum [26661b8] +- bump dependencies [bde8f7a] + ## 1.31.0 ### Features @@ -206,7 +372,7 @@ ### Features -Introducting [gcustom](https://onsi.github.io/gomega/#gcustom-a-convenient-mechanism-for-buildling-custom-matchers) - a convenient mechanism for building custom matchers. +Introducing [gcustom](https://onsi.github.io/gomega/#gcustom-a-convenient-mechanism-for-buildling-custom-matchers) - a convenient mechanism for building custom matchers. This is an RC release for `gcustom`. The external API may be tweaked in response to feedback however it is expected to remain mostly stable. @@ -345,7 +511,7 @@ These improvements are all documented in [Gomega's docs](https://onsi.github.io/ - Fix max number of samples in experiments on non-64-bit systems. (#528) [1c84497] - Remove dependency on ginkgo v1.16.4 (#530) [4dea8d5] - Fix for Go 1.18 (#532) [56d2a29] -- Document precendence of timeouts (#533) [b607941] +- Document precedence of timeouts (#533) [b607941] ## 1.18.1 @@ -362,7 +528,7 @@ These improvements are all documented in [Gomega's docs](https://onsi.github.io/ ## Fixes - Gomega now uses ioutil for Go 1.15 and lower (#492) - official support is only for the most recent two major versions of Go but this will unblock users who need to stay on older unsupported versions of Go. [c29c1c0] -## Maintenace +## Maintenance - Remove Travis workflow (#491) [72e6040] - Upgrade to Ginkgo 2.0.0 GA [f383637] - chore: fix description of HaveField matcher (#487) [2b4b2c0] @@ -610,7 +776,7 @@ Improvements: - Added `BeSent` which attempts to send a value down a channel and fails if the attempt blocks. Can be paired with `Eventually` to safely send a value down a channel with a timeout. - `Ω`, `Expect`, `Eventually`, and `Consistently` now immediately `panic` if there is no registered fail handler. This is always a mistake that can hide failing tests. -- `Receive()` no longer errors when passed a closed channel, it's perfectly fine to attempt to read from a closed channel so Ω(c).Should(Receive()) always fails and Ω(c).ShoudlNot(Receive()) always passes with a closed channel. +- `Receive()` no longer errors when passed a closed channel, it's perfectly fine to attempt to read from a closed channel so Ω(c).Should(Receive()) always fails and Ω(c).ShouldNot(Receive()) always passes with a closed channel. - Added `HavePrefix` and `HaveSuffix` matchers. - `ghttp` can now handle concurrent requests. - Added `Succeed` which allows one to write `Ω(MyFunction()).Should(Succeed())`. @@ -620,7 +786,7 @@ Improvements: - `ghttp` servers can take an `io.Writer`. `ghttp` will write a line to the writer when each request arrives. - Added `WithTransform` matcher to allow munging input data before feeding into the relevant matcher - Added boolean `And`, `Or`, and `Not` matchers to allow creating composite matchers -- Added `gbytes.TimeoutCloser`, `gbytes.TimeoutReader`, and `gbytes.TimeoutWriter` - these are convenience wrappers that timeout if the underlying Closer/Reader/Writer does not return within the alloted time. +- Added `gbytes.TimeoutCloser`, `gbytes.TimeoutReader`, and `gbytes.TimeoutWriter` - these are convenience wrappers that timeout if the underlying Closer/Reader/Writer does not return within the allotted time. - Added `gbytes.BufferReader` - this constructs a `gbytes.Buffer` that asynchronously reads the passed-in `io.Reader` into its buffer. Bug Fixes: @@ -665,7 +831,7 @@ New Matchers: Updated Matchers: -- `Receive` matcher can take a matcher as an argument and passes only if the channel under test receives an objet that satisfies the passed-in matcher. +- `Receive` matcher can take a matcher as an argument and passes only if the channel under test receives an object that satisfies the passed-in matcher. - Matchers that implement `MatchMayChangeInTheFuture(actual interface{}) bool` can inform `Eventually` and/or `Consistently` when a match has no chance of changing status in the future. For example, `Receive` returns `false` when a channel is closed. Misc: diff --git a/vendor/github.com/onsi/gomega/format/format.go b/vendor/github.com/onsi/gomega/format/format.go index 6c1680638..96f04b210 100644 --- a/vendor/github.com/onsi/gomega/format/format.go +++ b/vendor/github.com/onsi/gomega/format/format.go @@ -57,7 +57,7 @@ var Indent = " " var longFormThreshold = 20 -// GomegaStringer allows for custom formating of objects for gomega. +// GomegaStringer allows for custom formatting of objects for gomega. type GomegaStringer interface { // GomegaString will be used to custom format an object. // It does not follow UseStringerRepresentation value and will always be called regardless. @@ -73,7 +73,7 @@ If the CustomFormatter does not want to handle the object it should return ("", Strings returned by CustomFormatters are not truncated */ -type CustomFormatter func(value interface{}) (string, bool) +type CustomFormatter func(value any) (string, bool) type CustomFormatterKey uint var customFormatterKey CustomFormatterKey = 1 @@ -125,7 +125,7 @@ If expected is omitted, then the message looks like: */ -func Message(actual interface{}, message string, expected ...interface{}) string { +func Message(actual any, message string, expected ...any) string { if len(expected) == 0 { return fmt.Sprintf("Expected\n%s\n%s", Object(actual, 1), message) } @@ -255,7 +255,7 @@ recursing into the object. Set PrintContextObjects to true to print the content of objects implementing context.Context */ -func Object(object interface{}, indentation uint) string { +func Object(object any, indentation uint) string { indent := strings.Repeat(Indent, int(indentation)) value := reflect.ValueOf(object) commonRepresentation := "" @@ -392,7 +392,7 @@ func formatValue(value reflect.Value, indentation uint) string { } } -func formatString(object interface{}, indentation uint) string { +func formatString(object any, indentation uint) string { if indentation == 1 { s := fmt.Sprintf("%s", object) components := strings.Split(s, "\n") diff --git a/vendor/github.com/onsi/gomega/gbytes/buffer.go b/vendor/github.com/onsi/gomega/gbytes/buffer.go index 6f77b2371..df34e552c 100644 --- a/vendor/github.com/onsi/gomega/gbytes/buffer.go +++ b/vendor/github.com/onsi/gomega/gbytes/buffer.go @@ -7,7 +7,6 @@ Subsequent matches against the buffer will only operate against data that appear The read cursor is an opaque implementation detail that you cannot access. You should use the Say matcher to sift through the buffer. You can always access the entire buffer's contents with Contents(). - */ package gbytes @@ -29,7 +28,7 @@ type Buffer struct { contents []byte readCursor uint64 lock *sync.Mutex - detectCloser chan interface{} + detectCloser chan any closed bool } @@ -167,19 +166,25 @@ You could do something like: select { case <-buffer.Detect("You are not logged in"): + //log in + case <-buffer.Detect("Success"): + //carry on + case <-time.After(time.Second): - //welp -} + + //welp + } + buffer.CancelDetects() You should always call CancelDetects after using Detect. This will close any channels that have not detected and clean up the goroutines that were spawned to support them. Finally, you can pass detect a format string followed by variadic arguments. This will construct the regexp using fmt.Sprintf. */ -func (b *Buffer) Detect(desired string, args ...interface{}) chan bool { +func (b *Buffer) Detect(desired string, args ...any) chan bool { formattedRegexp := desired if len(args) > 0 { formattedRegexp = fmt.Sprintf(desired, args...) @@ -190,7 +195,7 @@ func (b *Buffer) Detect(desired string, args ...interface{}) chan bool { defer b.lock.Unlock() if b.detectCloser == nil { - b.detectCloser = make(chan interface{}) + b.detectCloser = make(chan any) } closer := b.detectCloser diff --git a/vendor/github.com/onsi/gomega/gbytes/say_matcher.go b/vendor/github.com/onsi/gomega/gbytes/say_matcher.go index 0763f5e2d..2861a9c20 100644 --- a/vendor/github.com/onsi/gomega/gbytes/say_matcher.go +++ b/vendor/github.com/onsi/gomega/gbytes/say_matcher.go @@ -9,7 +9,7 @@ import ( "github.com/onsi/gomega/format" ) -//Objects satisfying the BufferProvider can be used with the Say matcher. +// Objects satisfying the BufferProvider can be used with the Say matcher. type BufferProvider interface { Buffer() *Buffer } @@ -37,7 +37,7 @@ In such cases, Say simply operates on the *gbytes.Buffer returned by Buffer() If the buffer is closed, the Say matcher will tell Eventually to abort. */ -func Say(expected string, args ...interface{}) *sayMatcher { +func Say(expected string, args ...any) *sayMatcher { if len(args) > 0 { expected = fmt.Sprintf(expected, args...) } @@ -51,7 +51,7 @@ type sayMatcher struct { receivedSayings []byte } -func (m *sayMatcher) buffer(actual interface{}) (*Buffer, bool) { +func (m *sayMatcher) buffer(actual any) (*Buffer, bool) { var buffer *Buffer switch x := actual.(type) { @@ -66,7 +66,7 @@ func (m *sayMatcher) buffer(actual interface{}) (*Buffer, bool) { return buffer, true } -func (m *sayMatcher) Match(actual interface{}) (success bool, err error) { +func (m *sayMatcher) Match(actual any) (success bool, err error) { buffer, ok := m.buffer(actual) if !ok { return false, fmt.Errorf("Say must be passed a *gbytes.Buffer or BufferProvider. Got:\n%s", format.Object(actual, 1)) @@ -78,7 +78,7 @@ func (m *sayMatcher) Match(actual interface{}) (success bool, err error) { return didSay, nil } -func (m *sayMatcher) FailureMessage(actual interface{}) (message string) { +func (m *sayMatcher) FailureMessage(actual any) (message string) { return fmt.Sprintf( "Got stuck at:\n%s\nWaiting for:\n%s", format.IndentString(string(m.receivedSayings), 1), @@ -86,7 +86,7 @@ func (m *sayMatcher) FailureMessage(actual interface{}) (message string) { ) } -func (m *sayMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (m *sayMatcher) NegatedFailureMessage(actual any) (message string) { return fmt.Sprintf( "Saw:\n%s\nWhich matches the unexpected:\n%s", format.IndentString(string(m.receivedSayings), 1), @@ -94,7 +94,7 @@ func (m *sayMatcher) NegatedFailureMessage(actual interface{}) (message string) ) } -func (m *sayMatcher) MatchMayChangeInTheFuture(actual interface{}) bool { +func (m *sayMatcher) MatchMayChangeInTheFuture(actual any) bool { switch x := actual.(type) { case *Buffer: return !x.Closed() diff --git a/vendor/github.com/onsi/gomega/gomega_dsl.go b/vendor/github.com/onsi/gomega/gomega_dsl.go index 4f7ab2791..fdba34ee9 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.31.0" +const GOMEGA_VERSION = "1.38.2" 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(). @@ -178,7 +178,7 @@ func ensureDefaultGomegaIsConfigured() { // All subsequent arguments will be required to be nil/zero. // // This is convenient if you want to make an assertion on a method/function that returns -// a value and an error - a common patter in Go. +// a value and an error - a common pattern in Go. // // For example, given a function with signature: // @@ -191,7 +191,7 @@ func ensureDefaultGomegaIsConfigured() { // Will succeed only if `MyAmazingThing()` returns `(3, nil)` // // Ω and Expect are identical -func Ω(actual interface{}, extra ...interface{}) Assertion { +func Ω(actual any, extra ...any) Assertion { ensureDefaultGomegaIsConfigured() return Default.Ω(actual, extra...) } @@ -217,7 +217,7 @@ func Ω(actual interface{}, extra ...interface{}) Assertion { // Will succeed only if `MyAmazingThing()` returns `(3, nil)` // // Expect and Ω are identical -func Expect(actual interface{}, extra ...interface{}) Assertion { +func Expect(actual any, extra ...any) Assertion { ensureDefaultGomegaIsConfigured() return Default.Expect(actual, extra...) } @@ -233,7 +233,7 @@ func Expect(actual interface{}, extra ...interface{}) Assertion { // This is most useful in helper functions that make assertions. If you want Gomega's // error message to refer to the calling line in the test (as opposed to the line in the helper function) // set the first argument of `ExpectWithOffset` appropriately. -func ExpectWithOffset(offset int, actual interface{}, extra ...interface{}) Assertion { +func ExpectWithOffset(offset int, actual any, extra ...any) Assertion { ensureDefaultGomegaIsConfigured() return Default.ExpectWithOffset(offset, actual, extra...) } @@ -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 passed 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 cancellation 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 either the context is cancelled or the default timeout elapses. **Category 3: Making assertions _in_ the function passed into Eventually** @@ -372,13 +384,13 @@ 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 { +func Eventually(actualOrCtx any, args ...any) AsyncAssertion { ensureDefaultGomegaIsConfigured() return Default.Eventually(actualOrCtx, args...) } @@ -392,7 +404,7 @@ func Eventually(actualOrCtx interface{}, args ...interface{}) AsyncAssertion { // `EventuallyWithOffset` specifying a timeout interval (and an optional polling interval) are // the same as `Eventually(...).WithOffset(...).WithTimeout` or // `Eventually(...).WithOffset(...).WithTimeout(...).WithPolling`. -func EventuallyWithOffset(offset int, actualOrCtx interface{}, args ...interface{}) AsyncAssertion { +func EventuallyWithOffset(offset int, actualOrCtx any, args ...any) AsyncAssertion { ensureDefaultGomegaIsConfigured() return Default.EventuallyWithOffset(offset, actualOrCtx, args...) } @@ -412,7 +424,7 @@ Consistently is useful in cases where you want to assert that something *does no This will block for 200 milliseconds and repeatedly check the channel and ensure nothing has been received. */ -func Consistently(actualOrCtx interface{}, args ...interface{}) AsyncAssertion { +func Consistently(actualOrCtx any, args ...any) AsyncAssertion { ensureDefaultGomegaIsConfigured() return Default.Consistently(actualOrCtx, args...) } @@ -423,13 +435,13 @@ func Consistently(actualOrCtx interface{}, args ...interface{}) AsyncAssertion { // // `ConsistentlyWithOffset` is the same as `Consistently(...).WithOffset` and // optional `WithTimeout` and `WithPolling`. -func ConsistentlyWithOffset(offset int, actualOrCtx interface{}, args ...interface{}) AsyncAssertion { +func ConsistentlyWithOffset(offset int, actualOrCtx any, args ...any) AsyncAssertion { ensureDefaultGomegaIsConfigured() return Default.ConsistentlyWithOffset(offset, actualOrCtx, args...) } /* -StopTrying can be used to signal to Eventually and Consistentlythat they should abort and stop trying. This always results in a failure of the assertion - and the failure message is the content of the StopTrying signal. +StopTrying can be used to signal to Eventually and Consistently that they should abort and stop trying. This always results in a failure of the assertion - and the failure message is the content of the StopTrying signal. You can send the StopTrying signal by either returning StopTrying("message") as an error from your passed-in function _or_ by calling StopTrying("message").Now() to trigger a panic and end execution. @@ -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/assertion.go b/vendor/github.com/onsi/gomega/internal/assertion.go index 08356a610..cc846e7ce 100644 --- a/vendor/github.com/onsi/gomega/internal/assertion.go +++ b/vendor/github.com/onsi/gomega/internal/assertion.go @@ -9,19 +9,19 @@ import ( ) type Assertion struct { - actuals []interface{} // actual value plus all extra values - actualIndex int // value to pass to the matcher - vet vetinari // the vet to call before calling Gomega matcher + actuals []any // actual value plus all extra values + actualIndex int // value to pass to the matcher + vet vetinari // the vet to call before calling Gomega matcher offset int g *Gomega } // ...obligatory discworld reference, as "vetineer" doesn't sound ... quite right. -type vetinari func(assertion *Assertion, optionalDescription ...interface{}) bool +type vetinari func(assertion *Assertion, optionalDescription ...any) bool -func NewAssertion(actualInput interface{}, g *Gomega, offset int, extra ...interface{}) *Assertion { +func NewAssertion(actualInput any, g *Gomega, offset int, extra ...any) *Assertion { return &Assertion{ - actuals: append([]interface{}{actualInput}, extra...), + actuals: append([]any{actualInput}, extra...), actualIndex: 0, vet: (*Assertion).vetActuals, offset: offset, @@ -44,37 +44,37 @@ func (assertion *Assertion) Error() types.Assertion { } } -func (assertion *Assertion) Should(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool { +func (assertion *Assertion) Should(matcher types.GomegaMatcher, optionalDescription ...any) bool { assertion.g.THelper() vetOptionalDescription("Assertion", optionalDescription...) return assertion.vet(assertion, optionalDescription...) && assertion.match(matcher, true, optionalDescription...) } -func (assertion *Assertion) ShouldNot(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool { +func (assertion *Assertion) ShouldNot(matcher types.GomegaMatcher, optionalDescription ...any) bool { assertion.g.THelper() vetOptionalDescription("Assertion", optionalDescription...) return assertion.vet(assertion, optionalDescription...) && assertion.match(matcher, false, optionalDescription...) } -func (assertion *Assertion) To(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool { +func (assertion *Assertion) To(matcher types.GomegaMatcher, optionalDescription ...any) bool { assertion.g.THelper() vetOptionalDescription("Assertion", optionalDescription...) return assertion.vet(assertion, optionalDescription...) && assertion.match(matcher, true, optionalDescription...) } -func (assertion *Assertion) ToNot(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool { +func (assertion *Assertion) ToNot(matcher types.GomegaMatcher, optionalDescription ...any) bool { assertion.g.THelper() vetOptionalDescription("Assertion", optionalDescription...) return assertion.vet(assertion, optionalDescription...) && assertion.match(matcher, false, optionalDescription...) } -func (assertion *Assertion) NotTo(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool { +func (assertion *Assertion) NotTo(matcher types.GomegaMatcher, optionalDescription ...any) bool { assertion.g.THelper() vetOptionalDescription("Assertion", optionalDescription...) return assertion.vet(assertion, optionalDescription...) && assertion.match(matcher, false, optionalDescription...) } -func (assertion *Assertion) buildDescription(optionalDescription ...interface{}) string { +func (assertion *Assertion) buildDescription(optionalDescription ...any) string { switch len(optionalDescription) { case 0: return "" @@ -86,7 +86,7 @@ func (assertion *Assertion) buildDescription(optionalDescription ...interface{}) return fmt.Sprintf(optionalDescription[0].(string), optionalDescription[1:]...) + "\n" } -func (assertion *Assertion) match(matcher types.GomegaMatcher, desiredMatch bool, optionalDescription ...interface{}) bool { +func (assertion *Assertion) match(matcher types.GomegaMatcher, desiredMatch bool, optionalDescription ...any) bool { actualInput := assertion.actuals[assertion.actualIndex] matches, err := matcher.Match(actualInput) assertion.g.THelper() @@ -113,7 +113,7 @@ func (assertion *Assertion) match(matcher types.GomegaMatcher, desiredMatch bool // vetActuals vets the actual values, with the (optional) exception of a // specific value, such as the first value in case non-error assertions, or the // last value in case of Error()-based assertions. -func (assertion *Assertion) vetActuals(optionalDescription ...interface{}) bool { +func (assertion *Assertion) vetActuals(optionalDescription ...any) bool { success, message := vetActuals(assertion.actuals, assertion.actualIndex) if success { return true @@ -129,7 +129,7 @@ func (assertion *Assertion) vetActuals(optionalDescription ...interface{}) bool // the final error value is non-zero. Otherwise, it doesn't vet the actual // values, as these are allowed to take on any values unless there is a non-zero // error value. -func (assertion *Assertion) vetError(optionalDescription ...interface{}) bool { +func (assertion *Assertion) vetError(optionalDescription ...any) bool { if err := assertion.actuals[assertion.actualIndex]; err != nil { // Go error result idiom: all other actual values must be zero values. return assertion.vetActuals(optionalDescription...) @@ -139,7 +139,7 @@ func (assertion *Assertion) vetError(optionalDescription ...interface{}) bool { // vetActuals vets a slice of actual values, optionally skipping a particular // value slice element, such as the first or last value slice element. -func vetActuals(actuals []interface{}, skipIndex int) (bool, string) { +func vetActuals(actuals []any, skipIndex int) (bool, string) { for i, actual := range actuals { if i == skipIndex { continue diff --git a/vendor/github.com/onsi/gomega/internal/async_assertion.go b/vendor/github.com/onsi/gomega/internal/async_assertion.go index cde9e2ec8..4121505b6 100644 --- a/vendor/github.com/onsi/gomega/internal/async_assertion.go +++ b/vendor/github.com/onsi/gomega/internal/async_assertion.go @@ -69,8 +69,8 @@ type AsyncAssertion struct { asyncType AsyncAssertionType actualIsFunc bool - actual interface{} - argsToForward []interface{} + actual any + argsToForward []any timeoutInterval time.Duration pollingInterval time.Duration @@ -80,7 +80,7 @@ type AsyncAssertion struct { g *Gomega } -func NewAsyncAssertion(asyncType AsyncAssertionType, actualInput interface{}, g *Gomega, timeoutInterval time.Duration, pollingInterval time.Duration, mustPassRepeatedly int, ctx context.Context, offset int) *AsyncAssertion { +func NewAsyncAssertion(asyncType AsyncAssertionType, actualInput any, g *Gomega, timeoutInterval time.Duration, pollingInterval time.Duration, mustPassRepeatedly int, ctx context.Context, offset int) *AsyncAssertion { out := &AsyncAssertion{ asyncType: asyncType, timeoutInterval: timeoutInterval, @@ -129,7 +129,7 @@ func (assertion *AsyncAssertion) WithContext(ctx context.Context) types.AsyncAss return assertion } -func (assertion *AsyncAssertion) WithArguments(argsToForward ...interface{}) types.AsyncAssertion { +func (assertion *AsyncAssertion) WithArguments(argsToForward ...any) types.AsyncAssertion { assertion.argsToForward = argsToForward return assertion } @@ -139,19 +139,31 @@ func (assertion *AsyncAssertion) MustPassRepeatedly(count int) types.AsyncAssert return assertion } -func (assertion *AsyncAssertion) Should(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool { +func (assertion *AsyncAssertion) Should(matcher types.GomegaMatcher, optionalDescription ...any) bool { assertion.g.THelper() vetOptionalDescription("Asynchronous assertion", optionalDescription...) return assertion.match(matcher, true, optionalDescription...) } -func (assertion *AsyncAssertion) ShouldNot(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool { +func (assertion *AsyncAssertion) To(matcher types.GomegaMatcher, optionalDescription ...any) bool { + return assertion.Should(matcher, optionalDescription...) +} + +func (assertion *AsyncAssertion) ShouldNot(matcher types.GomegaMatcher, optionalDescription ...any) bool { assertion.g.THelper() vetOptionalDescription("Asynchronous assertion", optionalDescription...) return assertion.match(matcher, false, optionalDescription...) } -func (assertion *AsyncAssertion) buildDescription(optionalDescription ...interface{}) string { +func (assertion *AsyncAssertion) ToNot(matcher types.GomegaMatcher, optionalDescription ...any) bool { + return assertion.ShouldNot(matcher, optionalDescription...) +} + +func (assertion *AsyncAssertion) NotTo(matcher types.GomegaMatcher, optionalDescription ...any) bool { + return assertion.ShouldNot(matcher, optionalDescription...) +} + +func (assertion *AsyncAssertion) buildDescription(optionalDescription ...any) string { switch len(optionalDescription) { case 0: return "" @@ -163,7 +175,7 @@ func (assertion *AsyncAssertion) buildDescription(optionalDescription ...interfa return fmt.Sprintf(optionalDescription[0].(string), optionalDescription[1:]...) + "\n" } -func (assertion *AsyncAssertion) processReturnValues(values []reflect.Value) (interface{}, error) { +func (assertion *AsyncAssertion) processReturnValues(values []reflect.Value) (any, error) { if len(values) == 0 { return nil, &asyncPolledActualError{ message: fmt.Sprintf("The function passed to %s did not return any values", assertion.asyncType), @@ -224,7 +236,7 @@ func (assertion *AsyncAssertion) argumentMismatchError(t reflect.Type, numProvid if numProvided == 1 { have = "has" } - return fmt.Errorf(`The function passed to %s has signature %s takes %d arguments but %d %s been provided. Please use %s().WithArguments() to pass the corect set of arguments. + return fmt.Errorf(`The function passed to %s has signature %s takes %d arguments but %d %s been provided. Please use %s().WithArguments() to pass the correct set of arguments. You can learn more at https://onsi.github.io/gomega/#eventually `, assertion.asyncType, t, t.NumIn(), numProvided, have, assertion.asyncType) @@ -237,9 +249,9 @@ You can learn more at https://onsi.github.io/gomega/#eventually `, assertion.asyncType, reason) } -func (assertion *AsyncAssertion) buildActualPoller() (func() (interface{}, error), error) { +func (assertion *AsyncAssertion) buildActualPoller() (func() (any, error), error) { if !assertion.actualIsFunc { - return func() (interface{}, error) { return assertion.actual, nil }, nil + return func() (any, error) { return assertion.actual, nil }, nil } actualValue := reflect.ValueOf(assertion.actual) actualType := reflect.TypeOf(assertion.actual) @@ -301,7 +313,7 @@ func (assertion *AsyncAssertion) buildActualPoller() (func() (interface{}, error return nil, assertion.invalidMustPassRepeatedlyError("parameter can't be < 1") } - return func() (actual interface{}, err error) { + return func() (actual any, err error) { var values []reflect.Value assertionFailure = nil defer func() { @@ -335,7 +347,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 @@ -354,14 +366,14 @@ func (assertion *AsyncAssertion) afterPolling() <-chan time.Time { } } -func (assertion *AsyncAssertion) matcherSaysStopTrying(matcher types.GomegaMatcher, value interface{}) bool { +func (assertion *AsyncAssertion) matcherSaysStopTrying(matcher types.GomegaMatcher, value any) bool { if assertion.actualIsFunc || types.MatchMayChangeInTheFuture(matcher, value) { return false } return true } -func (assertion *AsyncAssertion) pollMatcher(matcher types.GomegaMatcher, value interface{}) (matches bool, err error) { +func (assertion *AsyncAssertion) pollMatcher(matcher types.GomegaMatcher, value any) (matches bool, err error) { defer func() { if e := recover(); e != nil { if _, isAsyncError := AsPollingSignalError(e); isAsyncError { @@ -377,13 +389,13 @@ func (assertion *AsyncAssertion) pollMatcher(matcher types.GomegaMatcher, value return } -func (assertion *AsyncAssertion) match(matcher types.GomegaMatcher, desiredMatch bool, optionalDescription ...interface{}) bool { +func (assertion *AsyncAssertion) match(matcher types.GomegaMatcher, desiredMatch bool, optionalDescription ...any) bool { timer := time.Now() timeout := assertion.afterTimeout() lock := sync.Mutex{} var matches, hasLastValidActual bool - var actual, lastValidActual interface{} + var actual, lastValidActual any var actualErr, matcherErr error var oracleMatcherSaysStop bool @@ -440,7 +452,7 @@ func (assertion *AsyncAssertion) match(matcher types.GomegaMatcher, desiredMatch } } else { var fgErr formattedGomegaError - if errors.As(actualErr, &fgErr) { + if errors.As(matcherErr, &fgErr) { message += fgErr.FormattedGomegaError() + "\n" } else { message += renderError(fmt.Sprintf("The matcher passed to %s returned the following error:", assertion.asyncType), matcherErr) @@ -496,7 +508,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..1019deb88 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, } } @@ -44,7 +49,7 @@ func durationFromEnv(key string, defaultDuration time.Duration) time.Duration { return duration } -func toDuration(input interface{}) (time.Duration, error) { +func toDuration(input any) (time.Duration, error) { duration, ok := input.(time.Duration) if ok { return duration, nil diff --git a/vendor/github.com/onsi/gomega/internal/gomega.go b/vendor/github.com/onsi/gomega/internal/gomega.go index de1f4f336..66dfe7d04 100644 --- a/vendor/github.com/onsi/gomega/internal/gomega.go +++ b/vendor/github.com/onsi/gomega/internal/gomega.go @@ -40,45 +40,45 @@ func (g *Gomega) ConfigureWithT(t types.GomegaTestingT) *Gomega { return g } -func (g *Gomega) Ω(actual interface{}, extra ...interface{}) types.Assertion { +func (g *Gomega) Ω(actual any, extra ...any) types.Assertion { return g.ExpectWithOffset(0, actual, extra...) } -func (g *Gomega) Expect(actual interface{}, extra ...interface{}) types.Assertion { +func (g *Gomega) Expect(actual any, extra ...any) types.Assertion { return g.ExpectWithOffset(0, actual, extra...) } -func (g *Gomega) ExpectWithOffset(offset int, actual interface{}, extra ...interface{}) types.Assertion { +func (g *Gomega) ExpectWithOffset(offset int, actual any, extra ...any) types.Assertion { return NewAssertion(actual, g, offset, extra...) } -func (g *Gomega) Eventually(actualOrCtx interface{}, args ...interface{}) types.AsyncAssertion { +func (g *Gomega) Eventually(actualOrCtx any, args ...any) types.AsyncAssertion { return g.makeAsyncAssertion(AsyncAssertionTypeEventually, 0, actualOrCtx, args...) } -func (g *Gomega) EventuallyWithOffset(offset int, actualOrCtx interface{}, args ...interface{}) types.AsyncAssertion { +func (g *Gomega) EventuallyWithOffset(offset int, actualOrCtx any, args ...any) types.AsyncAssertion { return g.makeAsyncAssertion(AsyncAssertionTypeEventually, offset, actualOrCtx, args...) } -func (g *Gomega) Consistently(actualOrCtx interface{}, args ...interface{}) types.AsyncAssertion { +func (g *Gomega) Consistently(actualOrCtx any, args ...any) types.AsyncAssertion { return g.makeAsyncAssertion(AsyncAssertionTypeConsistently, 0, actualOrCtx, args...) } -func (g *Gomega) ConsistentlyWithOffset(offset int, actualOrCtx interface{}, args ...interface{}) types.AsyncAssertion { +func (g *Gomega) ConsistentlyWithOffset(offset int, actualOrCtx any, args ...any) types.AsyncAssertion { return g.makeAsyncAssertion(AsyncAssertionTypeConsistently, offset, actualOrCtx, args...) } -func (g *Gomega) makeAsyncAssertion(asyncAssertionType AsyncAssertionType, offset int, actualOrCtx interface{}, args ...interface{}) types.AsyncAssertion { +func (g *Gomega) makeAsyncAssertion(asyncAssertionType AsyncAssertionType, offset int, actualOrCtx any, args ...any) types.AsyncAssertion { baseOffset := 3 timeoutInterval := -time.Duration(1) pollingInterval := -time.Duration(1) - intervals := []interface{}{} + intervals := []any{} var ctx context.Context actual := actualOrCtx startingIndex := 0 if _, isCtx := actualOrCtx.(context.Context); isCtx && len(args) > 0 { - // the first argument is a context, we should accept it as the context _only if_ it is **not** the only argumnent **and** the second argument is not a parseable duration + // the first argument is a context, we should accept it as the context _only if_ it is **not** the only argument **and** the second argument is not a parseable duration // this is due to an unfortunate ambiguity in early version of Gomega in which multi-type durations are allowed after the actual if _, err := toDuration(args[0]); err != nil { ctx = actualOrCtx.(context.Context) @@ -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..450c40333 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 } @@ -89,7 +100,7 @@ func (s *PollingSignalErrorImpl) TryAgainDuration() time.Duration { return s.duration } -func AsPollingSignalError(actual interface{}) (*PollingSignalErrorImpl, bool) { +func AsPollingSignalError(actual any) (*PollingSignalErrorImpl, bool) { if actual == nil { return nil, false } diff --git a/vendor/github.com/onsi/gomega/internal/vetoptdesc.go b/vendor/github.com/onsi/gomega/internal/vetoptdesc.go index f29587641..b748de41f 100644 --- a/vendor/github.com/onsi/gomega/internal/vetoptdesc.go +++ b/vendor/github.com/onsi/gomega/internal/vetoptdesc.go @@ -10,7 +10,7 @@ import ( // Gomega matcher at the beginning it panics. This allows for rendering Gomega // matchers as part of an optional Description, as long as they're not in the // first slot. -func vetOptionalDescription(assertion string, optionalDescription ...interface{}) { +func vetOptionalDescription(assertion string, optionalDescription ...any) { if len(optionalDescription) == 0 { return } diff --git a/vendor/github.com/onsi/gomega/matchers.go b/vendor/github.com/onsi/gomega/matchers.go index 8860d677f..10b6693fd 100644 --- a/vendor/github.com/onsi/gomega/matchers.go +++ b/vendor/github.com/onsi/gomega/matchers.go @@ -12,7 +12,7 @@ import ( // Equal uses reflect.DeepEqual to compare actual with expected. Equal is strict about // types when performing comparisons. // It is an error for both actual and expected to be nil. Use BeNil() instead. -func Equal(expected interface{}) types.GomegaMatcher { +func Equal(expected any) types.GomegaMatcher { return &matchers.EqualMatcher{ Expected: expected, } @@ -22,7 +22,7 @@ func Equal(expected interface{}) types.GomegaMatcher { // This is done by converting actual to have the type of expected before // attempting equality with reflect.DeepEqual. // It is an error for actual and expected to be nil. Use BeNil() instead. -func BeEquivalentTo(expected interface{}) types.GomegaMatcher { +func BeEquivalentTo(expected any) types.GomegaMatcher { return &matchers.BeEquivalentToMatcher{ Expected: expected, } @@ -31,7 +31,7 @@ func BeEquivalentTo(expected interface{}) types.GomegaMatcher { // BeComparableTo uses gocmp.Equal from github.com/google/go-cmp (instead of reflect.DeepEqual) to perform a deep comparison. // You can pass cmp.Option as options. // It is an error for actual and expected to be nil. Use BeNil() instead. -func BeComparableTo(expected interface{}, opts ...cmp.Option) types.GomegaMatcher { +func BeComparableTo(expected any, opts ...cmp.Option) types.GomegaMatcher { return &matchers.BeComparableToMatcher{ Expected: expected, Options: opts, @@ -41,7 +41,7 @@ func BeComparableTo(expected interface{}, opts ...cmp.Option) types.GomegaMatche // BeIdenticalTo uses the == operator to compare actual with expected. // BeIdenticalTo is strict about types when performing comparisons. // It is an error for both actual and expected to be nil. Use BeNil() instead. -func BeIdenticalTo(expected interface{}) types.GomegaMatcher { +func BeIdenticalTo(expected any) types.GomegaMatcher { return &matchers.BeIdenticalToMatcher{ Expected: expected, } @@ -139,7 +139,7 @@ func Succeed() types.GomegaMatcher { // Error interface // // The optional second argument is a description of the error function, if used. This is required when passing a function but is ignored in all other cases. -func MatchError(expected interface{}, functionErrorDescription ...any) types.GomegaMatcher { +func MatchError(expected any, functionErrorDescription ...any) types.GomegaMatcher { return &matchers.MatchErrorMatcher{ Expected: expected, FuncErrDescription: functionErrorDescription, @@ -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()) -func Receive(args ...interface{}) types.GomegaMatcher { - var arg interface{} - if len(args) > 0 { - arg = args[0] - } - +// +// 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 appropriate type first, and second a matcher: +// +// var myThing thing +// Eventually(thingChan).Should(Receive(&myThing, ContainSubstring("bar"))) +func Receive(args ...any) types.GomegaMatcher { return &matchers.ReceiveMatcher{ - Arg: arg, + Args: args, } } @@ -223,7 +224,7 @@ func Receive(args ...interface{}) types.GomegaMatcher { // // Of course, the value is actually sent to the channel. The point of `BeSent` is less to make an assertion about the availability of the channel (which is typically an implementation detail that your test should not be concerned with). // Rather, the point of `BeSent` is to make it possible to easily and expressively write tests that can timeout on blocked channel sends. -func BeSent(arg interface{}) types.GomegaMatcher { +func BeSent(arg any) types.GomegaMatcher { return &matchers.BeSentMatcher{ Arg: arg, } @@ -232,7 +233,7 @@ func BeSent(arg interface{}) types.GomegaMatcher { // MatchRegexp succeeds if actual is a string or stringer that matches the // passed-in regexp. Optional arguments can be provided to construct a regexp // via fmt.Sprintf(). -func MatchRegexp(regexp string, args ...interface{}) types.GomegaMatcher { +func MatchRegexp(regexp string, args ...any) types.GomegaMatcher { return &matchers.MatchRegexpMatcher{ Regexp: regexp, Args: args, @@ -242,7 +243,7 @@ func MatchRegexp(regexp string, args ...interface{}) types.GomegaMatcher { // ContainSubstring succeeds if actual is a string or stringer that contains the // passed-in substring. Optional arguments can be provided to construct the substring // via fmt.Sprintf(). -func ContainSubstring(substr string, args ...interface{}) types.GomegaMatcher { +func ContainSubstring(substr string, args ...any) types.GomegaMatcher { return &matchers.ContainSubstringMatcher{ Substr: substr, Args: args, @@ -252,7 +253,7 @@ func ContainSubstring(substr string, args ...interface{}) types.GomegaMatcher { // HavePrefix succeeds if actual is a string or stringer that contains the // passed-in string as a prefix. Optional arguments can be provided to construct // via fmt.Sprintf(). -func HavePrefix(prefix string, args ...interface{}) types.GomegaMatcher { +func HavePrefix(prefix string, args ...any) types.GomegaMatcher { return &matchers.HavePrefixMatcher{ Prefix: prefix, Args: args, @@ -262,7 +263,7 @@ func HavePrefix(prefix string, args ...interface{}) types.GomegaMatcher { // HaveSuffix succeeds if actual is a string or stringer that contains the // passed-in string as a suffix. Optional arguments can be provided to construct // via fmt.Sprintf(). -func HaveSuffix(suffix string, args ...interface{}) types.GomegaMatcher { +func HaveSuffix(suffix string, args ...any) types.GomegaMatcher { return &matchers.HaveSuffixMatcher{ Suffix: suffix, Args: args, @@ -272,7 +273,7 @@ func HaveSuffix(suffix string, args ...interface{}) types.GomegaMatcher { // MatchJSON succeeds if actual is a string or stringer of JSON that matches // the expected JSON. The JSONs are decoded and the resulting objects are compared via // reflect.DeepEqual so things like key-ordering and whitespace shouldn't matter. -func MatchJSON(json interface{}) types.GomegaMatcher { +func MatchJSON(json any) types.GomegaMatcher { return &matchers.MatchJSONMatcher{ JSONToMatch: json, } @@ -281,7 +282,7 @@ func MatchJSON(json interface{}) types.GomegaMatcher { // MatchXML succeeds if actual is a string or stringer of XML that matches // the expected XML. The XMLs are decoded and the resulting objects are compared via // reflect.DeepEqual so things like whitespaces shouldn't matter. -func MatchXML(xml interface{}) types.GomegaMatcher { +func MatchXML(xml any) types.GomegaMatcher { return &matchers.MatchXMLMatcher{ XMLToMatch: xml, } @@ -290,7 +291,7 @@ func MatchXML(xml interface{}) types.GomegaMatcher { // MatchYAML succeeds if actual is a string or stringer of YAML that matches // the expected YAML. The YAML's are decoded and the resulting objects are compared via // reflect.DeepEqual so things like key-ordering and whitespace shouldn't matter. -func MatchYAML(yaml interface{}) types.GomegaMatcher { +func MatchYAML(yaml any) types.GomegaMatcher { return &matchers.MatchYAMLMatcher{ YAMLToMatch: yaml, } @@ -337,7 +338,7 @@ func BeZero() types.GomegaMatcher { // // var findings []string // Expect([]string{"Foo", "FooBar"}).Should(ContainElement(ContainSubString("Bar", &findings))) -func ContainElement(element interface{}, result ...interface{}) types.GomegaMatcher { +func ContainElement(element any, result ...any) types.GomegaMatcher { return &matchers.ContainElementMatcher{ Element: element, Result: result, @@ -357,7 +358,7 @@ func ContainElement(element interface{}, result ...interface{}) types.GomegaMatc // Expect(2).Should(BeElementOf(1, 2)) // // Actual must be typed. -func BeElementOf(elements ...interface{}) types.GomegaMatcher { +func BeElementOf(elements ...any) types.GomegaMatcher { return &matchers.BeElementOfMatcher{ Elements: elements, } @@ -367,7 +368,7 @@ func BeElementOf(elements ...interface{}) types.GomegaMatcher { // BeKeyOf() always uses Equal() to perform the match between actual and the map keys. // // Expect("foo").Should(BeKeyOf(map[string]bool{"foo": true, "bar": false})) -func BeKeyOf(element interface{}) types.GomegaMatcher { +func BeKeyOf(element any) types.GomegaMatcher { return &matchers.BeKeyOfMatcher{ Map: element, } @@ -387,14 +388,14 @@ func BeKeyOf(element interface{}) types.GomegaMatcher { // // Expect([]string{"Foo", "FooBar"}).Should(ConsistOf([]string{"FooBar", "Foo"})) // -// Note that Go's type system does not allow you to write this as ConsistOf([]string{"FooBar", "Foo"}...) as []string and []interface{} are different types - hence the need for this special rule. -func ConsistOf(elements ...interface{}) types.GomegaMatcher { +// Note that Go's type system does not allow you to write this as ConsistOf([]string{"FooBar", "Foo"}...) as []string and []any are different types - hence the need for this special rule. +func ConsistOf(elements ...any) types.GomegaMatcher { return &matchers.ConsistOfMatcher{ Elements: elements, } } -// HaveExactElements succeeds if actual contains elements that precisely match the elemets passed into the matcher. The ordering of the elements does matter. +// HaveExactElements succeeds if actual contains elements that precisely match the elements passed into the matcher. The ordering of the elements does matter. // By default HaveExactElements() uses Equal() to match the elements, however custom matchers can be passed in instead. Here are some examples: // // Expect([]string{"Foo", "FooBar"}).Should(HaveExactElements("Foo", "FooBar")) @@ -402,7 +403,7 @@ func ConsistOf(elements ...interface{}) types.GomegaMatcher { // Expect([]string{"Foo", "FooBar"}).Should(HaveExactElements(ContainSubstring("Foo"), ContainSubstring("Foo"))) // // Actual must be an array or slice. -func HaveExactElements(elements ...interface{}) types.GomegaMatcher { +func HaveExactElements(elements ...any) types.GomegaMatcher { return &matchers.HaveExactElementsMatcher{ Elements: elements, } @@ -416,7 +417,7 @@ func HaveExactElements(elements ...interface{}) types.GomegaMatcher { // // Actual must be an array, slice or map. // For maps, ContainElements searches through the map's values. -func ContainElements(elements ...interface{}) types.GomegaMatcher { +func ContainElements(elements ...any) types.GomegaMatcher { return &matchers.ContainElementsMatcher{ Elements: elements, } @@ -431,7 +432,7 @@ func ContainElements(elements ...interface{}) types.GomegaMatcher { // // Actual must be an array, slice or map. // For maps, HaveEach searches through the map's values. -func HaveEach(element interface{}) types.GomegaMatcher { +func HaveEach(element any) types.GomegaMatcher { return &matchers.HaveEachMatcher{ Element: element, } @@ -442,7 +443,7 @@ func HaveEach(element interface{}) types.GomegaMatcher { // matcher can be passed in instead: // // Expect(map[string]string{"Foo": "Bar", "BazFoo": "Duck"}).Should(HaveKey(MatchRegexp(`.+Foo$`))) -func HaveKey(key interface{}) types.GomegaMatcher { +func HaveKey(key any) types.GomegaMatcher { return &matchers.HaveKeyMatcher{ Key: key, } @@ -454,7 +455,7 @@ func HaveKey(key interface{}) types.GomegaMatcher { // // Expect(map[string]string{"Foo": "Bar", "BazFoo": "Duck"}).Should(HaveKeyWithValue("Foo", "Bar")) // Expect(map[string]string{"Foo": "Bar", "BazFoo": "Duck"}).Should(HaveKeyWithValue(MatchRegexp(`.+Foo$`), "Bar")) -func HaveKeyWithValue(key interface{}, value interface{}) types.GomegaMatcher { +func HaveKeyWithValue(key any, value any) types.GomegaMatcher { return &matchers.HaveKeyWithValueMatcher{ Key: key, Value: value, @@ -482,7 +483,7 @@ func HaveKeyWithValue(key interface{}, value interface{}) types.GomegaMatcher { // Expect(book).To(HaveField("Title", ContainSubstring("Les")) // Expect(book).To(HaveField("Author.FirstName", Equal("Victor")) // Expect(book).To(HaveField("Author.DOB.Year()", BeNumerically("<", 1900)) -func HaveField(field string, expected interface{}) types.GomegaMatcher { +func HaveField(field string, expected any) types.GomegaMatcher { return &matchers.HaveFieldMatcher{ Field: field, Expected: expected, @@ -534,7 +535,7 @@ func HaveValue(matcher types.GomegaMatcher) types.GomegaMatcher { // Expect(1.0).Should(BeNumerically(">=", 1.0)) // Expect(1.0).Should(BeNumerically("<", 3)) // Expect(1.0).Should(BeNumerically("<=", 1.0)) -func BeNumerically(comparator string, compareTo ...interface{}) types.GomegaMatcher { +func BeNumerically(comparator string, compareTo ...any) types.GomegaMatcher { return &matchers.BeNumericallyMatcher{ Comparator: comparator, CompareTo: compareTo, @@ -561,7 +562,7 @@ func BeTemporally(comparator string, compareTo time.Time, threshold ...time.Dura // Expect(5).Should(BeAssignableToTypeOf(-1)) // different values same type // Expect("foo").Should(BeAssignableToTypeOf("bar")) // different values same type // Expect(struct{ Foo string }{}).Should(BeAssignableToTypeOf(struct{ Foo string }{})) -func BeAssignableToTypeOf(expected interface{}) types.GomegaMatcher { +func BeAssignableToTypeOf(expected any) types.GomegaMatcher { return &matchers.AssignableToTypeOfMatcher{ Expected: expected, } @@ -580,7 +581,7 @@ func Panic() types.GomegaMatcher { // matcher can be passed in instead: // // Expect(fn).Should(PanicWith(MatchRegexp(`.+Foo$`))) -func PanicWith(expected interface{}) types.GomegaMatcher { +func PanicWith(expected any) types.GomegaMatcher { return &matchers.PanicMatcher{Expected: expected} } @@ -609,7 +610,7 @@ func BeADirectory() types.GomegaMatcher { // Expect(resp).Should(HaveHTTPStatus(http.StatusOK)) // asserts that resp.StatusCode == 200 // Expect(resp).Should(HaveHTTPStatus("404 Not Found")) // asserts that resp.Status == "404 Not Found" // Expect(resp).Should(HaveHTTPStatus(http.StatusOK, http.StatusNoContent)) // asserts that resp.StatusCode == 200 || resp.StatusCode == 204 -func HaveHTTPStatus(expected ...interface{}) types.GomegaMatcher { +func HaveHTTPStatus(expected ...any) types.GomegaMatcher { return &matchers.HaveHTTPStatusMatcher{Expected: expected} } @@ -617,7 +618,7 @@ func HaveHTTPStatus(expected ...interface{}) types.GomegaMatcher { // Actual must be either a *http.Response or *httptest.ResponseRecorder. // Expected must be a string header name, followed by a header value which // can be a string, or another matcher. -func HaveHTTPHeaderWithValue(header string, value interface{}) types.GomegaMatcher { +func HaveHTTPHeaderWithValue(header string, value any) types.GomegaMatcher { return &matchers.HaveHTTPHeaderWithValueMatcher{ Header: header, Value: value, @@ -627,7 +628,7 @@ func HaveHTTPHeaderWithValue(header string, value interface{}) types.GomegaMatch // HaveHTTPBody matches if the body matches. // Actual must be either a *http.Response or *httptest.ResponseRecorder. // Expected must be either a string, []byte, or other matcher -func HaveHTTPBody(expected interface{}) types.GomegaMatcher { +func HaveHTTPBody(expected any) types.GomegaMatcher { return &matchers.HaveHTTPBodyMatcher{Expected: expected} } @@ -686,15 +687,15 @@ func Not(matcher types.GomegaMatcher) types.GomegaMatcher { // Expect(1).To(WithTransform(failingplus1, Equal(2))) // // And(), Or(), Not() and WithTransform() allow matchers to be composed into complex expressions. -func WithTransform(transform interface{}, matcher types.GomegaMatcher) types.GomegaMatcher { +func WithTransform(transform any, matcher types.GomegaMatcher) types.GomegaMatcher { return matchers.NewWithTransformMatcher(transform, matcher) } // Satisfy matches the actual value against the `predicate` function. -// The given predicate must be a function of one paramter that returns bool. +// The given predicate must be a function of one parameter that returns bool. // // var isEven = func(i int) bool { return i%2 == 0 } // Expect(2).To(Satisfy(isEven)) -func Satisfy(predicate interface{}) types.GomegaMatcher { +func Satisfy(predicate any) types.GomegaMatcher { return matchers.NewSatisfyMatcher(predicate) } diff --git a/vendor/github.com/onsi/gomega/matchers/and.go b/vendor/github.com/onsi/gomega/matchers/and.go index 6bd826adc..db48e90b3 100644 --- a/vendor/github.com/onsi/gomega/matchers/and.go +++ b/vendor/github.com/onsi/gomega/matchers/and.go @@ -14,7 +14,7 @@ type AndMatcher struct { firstFailedMatcher types.GomegaMatcher } -func (m *AndMatcher) Match(actual interface{}) (success bool, err error) { +func (m *AndMatcher) Match(actual any) (success bool, err error) { m.firstFailedMatcher = nil for _, matcher := range m.Matchers { success, err := matcher.Match(actual) @@ -26,16 +26,16 @@ func (m *AndMatcher) Match(actual interface{}) (success bool, err error) { return true, nil } -func (m *AndMatcher) FailureMessage(actual interface{}) (message string) { +func (m *AndMatcher) FailureMessage(actual any) (message string) { return m.firstFailedMatcher.FailureMessage(actual) } -func (m *AndMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (m *AndMatcher) NegatedFailureMessage(actual any) (message string) { // not the most beautiful list of matchers, but not bad either... return format.Message(actual, fmt.Sprintf("To not satisfy all of these matchers: %s", m.Matchers)) } -func (m *AndMatcher) MatchMayChangeInTheFuture(actual interface{}) bool { +func (m *AndMatcher) MatchMayChangeInTheFuture(actual any) bool { /* Example with 3 matchers: A, B, C diff --git a/vendor/github.com/onsi/gomega/matchers/assignable_to_type_of_matcher.go b/vendor/github.com/onsi/gomega/matchers/assignable_to_type_of_matcher.go index be4839520..a100e5c07 100644 --- a/vendor/github.com/onsi/gomega/matchers/assignable_to_type_of_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/assignable_to_type_of_matcher.go @@ -10,10 +10,10 @@ import ( ) type AssignableToTypeOfMatcher struct { - Expected interface{} + Expected any } -func (matcher *AssignableToTypeOfMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *AssignableToTypeOfMatcher) Match(actual any) (success bool, err error) { if actual == nil && matcher.Expected == nil { return false, fmt.Errorf("Refusing to compare to .\nBe explicit and use BeNil() instead. This is to avoid mistakes where both sides of an assertion are erroneously uninitialized.") } else if matcher.Expected == nil { @@ -28,10 +28,10 @@ func (matcher *AssignableToTypeOfMatcher) Match(actual interface{}) (success boo return actualType.AssignableTo(expectedType), nil } -func (matcher *AssignableToTypeOfMatcher) FailureMessage(actual interface{}) string { +func (matcher *AssignableToTypeOfMatcher) FailureMessage(actual any) string { return format.Message(actual, fmt.Sprintf("to be assignable to the type: %T", matcher.Expected)) } -func (matcher *AssignableToTypeOfMatcher) NegatedFailureMessage(actual interface{}) string { +func (matcher *AssignableToTypeOfMatcher) NegatedFailureMessage(actual any) string { return format.Message(actual, fmt.Sprintf("not to be assignable to the type: %T", matcher.Expected)) } diff --git a/vendor/github.com/onsi/gomega/matchers/be_a_directory.go b/vendor/github.com/onsi/gomega/matchers/be_a_directory.go index 93d4497c7..1d8236048 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_a_directory.go +++ b/vendor/github.com/onsi/gomega/matchers/be_a_directory.go @@ -24,11 +24,11 @@ func (t notADirectoryError) Error() string { } type BeADirectoryMatcher struct { - expected interface{} + expected any err error } -func (matcher *BeADirectoryMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *BeADirectoryMatcher) Match(actual any) (success bool, err error) { actualFilename, ok := actual.(string) if !ok { return false, fmt.Errorf("BeADirectoryMatcher matcher expects a file path") @@ -47,10 +47,10 @@ func (matcher *BeADirectoryMatcher) Match(actual interface{}) (success bool, err return true, nil } -func (matcher *BeADirectoryMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *BeADirectoryMatcher) FailureMessage(actual any) (message string) { return format.Message(actual, fmt.Sprintf("to be a directory: %s", matcher.err)) } -func (matcher *BeADirectoryMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *BeADirectoryMatcher) NegatedFailureMessage(actual any) (message string) { return format.Message(actual, "not be a directory") } diff --git a/vendor/github.com/onsi/gomega/matchers/be_a_regular_file.go b/vendor/github.com/onsi/gomega/matchers/be_a_regular_file.go index 8fefc4deb..3e53d6285 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_a_regular_file.go +++ b/vendor/github.com/onsi/gomega/matchers/be_a_regular_file.go @@ -24,11 +24,11 @@ func (t notARegularFileError) Error() string { } type BeARegularFileMatcher struct { - expected interface{} + expected any err error } -func (matcher *BeARegularFileMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *BeARegularFileMatcher) Match(actual any) (success bool, err error) { actualFilename, ok := actual.(string) if !ok { return false, fmt.Errorf("BeARegularFileMatcher matcher expects a file path") @@ -47,10 +47,10 @@ func (matcher *BeARegularFileMatcher) Match(actual interface{}) (success bool, e return true, nil } -func (matcher *BeARegularFileMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *BeARegularFileMatcher) FailureMessage(actual any) (message string) { return format.Message(actual, fmt.Sprintf("to be a regular file: %s", matcher.err)) } -func (matcher *BeARegularFileMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *BeARegularFileMatcher) NegatedFailureMessage(actual any) (message string) { return format.Message(actual, "not be a regular file") } diff --git a/vendor/github.com/onsi/gomega/matchers/be_an_existing_file.go b/vendor/github.com/onsi/gomega/matchers/be_an_existing_file.go index e2bdd2811..04f156db3 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_an_existing_file.go +++ b/vendor/github.com/onsi/gomega/matchers/be_an_existing_file.go @@ -10,10 +10,10 @@ import ( ) type BeAnExistingFileMatcher struct { - expected interface{} + expected any } -func (matcher *BeAnExistingFileMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *BeAnExistingFileMatcher) Match(actual any) (success bool, err error) { actualFilename, ok := actual.(string) if !ok { return false, fmt.Errorf("BeAnExistingFileMatcher matcher expects a file path") @@ -31,10 +31,10 @@ func (matcher *BeAnExistingFileMatcher) Match(actual interface{}) (success bool, return true, nil } -func (matcher *BeAnExistingFileMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *BeAnExistingFileMatcher) FailureMessage(actual any) (message string) { return format.Message(actual, "to exist") } -func (matcher *BeAnExistingFileMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *BeAnExistingFileMatcher) NegatedFailureMessage(actual any) (message string) { return format.Message(actual, "not to exist") } diff --git a/vendor/github.com/onsi/gomega/matchers/be_closed_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_closed_matcher.go index f13c24490..4319dde45 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_closed_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_closed_matcher.go @@ -12,7 +12,7 @@ import ( type BeClosedMatcher struct { } -func (matcher *BeClosedMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *BeClosedMatcher) Match(actual any) (success bool, err error) { if !isChan(actual) { return false, fmt.Errorf("BeClosed matcher expects a channel. Got:\n%s", format.Object(actual, 1)) } @@ -39,10 +39,10 @@ func (matcher *BeClosedMatcher) Match(actual interface{}) (success bool, err err return closed, nil } -func (matcher *BeClosedMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *BeClosedMatcher) FailureMessage(actual any) (message string) { return format.Message(actual, "to be closed") } -func (matcher *BeClosedMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *BeClosedMatcher) NegatedFailureMessage(actual any) (message string) { return format.Message(actual, "to be open") } diff --git a/vendor/github.com/onsi/gomega/matchers/be_comparable_to_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_comparable_to_matcher.go index 8ab4bb919..ce74eee4c 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_comparable_to_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_comparable_to_matcher.go @@ -2,6 +2,7 @@ package matchers import ( "bytes" + "errors" "fmt" "github.com/google/go-cmp/cmp" @@ -9,11 +10,11 @@ import ( ) type BeComparableToMatcher struct { - Expected interface{} + Expected any Options cmp.Options } -func (matcher *BeComparableToMatcher) Match(actual interface{}) (success bool, matchErr error) { +func (matcher *BeComparableToMatcher) Match(actual any) (success bool, matchErr error) { if actual == nil && matcher.Expected == nil { return false, fmt.Errorf("Refusing to compare to .\nBe explicit and use BeNil() instead. This is to avoid mistakes where both sides of an assertion are erroneously uninitialized.") } @@ -32,7 +33,7 @@ func (matcher *BeComparableToMatcher) Match(actual interface{}) (success bool, m if err, ok := r.(error); ok { matchErr = err } else if errMsg, ok := r.(string); ok { - matchErr = fmt.Errorf(errMsg) + matchErr = errors.New(errMsg) } } }() @@ -40,10 +41,10 @@ func (matcher *BeComparableToMatcher) Match(actual interface{}) (success bool, m return cmp.Equal(actual, matcher.Expected, matcher.Options...), nil } -func (matcher *BeComparableToMatcher) FailureMessage(actual interface{}) (message string) { - return cmp.Diff(matcher.Expected, actual, matcher.Options) +func (matcher *BeComparableToMatcher) FailureMessage(actual any) (message string) { + return fmt.Sprint("Expected object to be comparable, diff: ", cmp.Diff(actual, matcher.Expected, matcher.Options...)) } -func (matcher *BeComparableToMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, "not to equal", matcher.Expected) +func (matcher *BeComparableToMatcher) NegatedFailureMessage(actual any) (message string) { + return format.Message(actual, "not to be comparable to", matcher.Expected) } diff --git a/vendor/github.com/onsi/gomega/matchers/be_element_of_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_element_of_matcher.go index 9ee75a5d5..406fe5484 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_element_of_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_element_of_matcher.go @@ -10,10 +10,10 @@ import ( ) type BeElementOfMatcher struct { - Elements []interface{} + Elements []any } -func (matcher *BeElementOfMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *BeElementOfMatcher) Match(actual any) (success bool, err error) { if reflect.TypeOf(actual) == nil { return false, fmt.Errorf("BeElement matcher expects actual to be typed") } @@ -34,10 +34,10 @@ func (matcher *BeElementOfMatcher) Match(actual interface{}) (success bool, err return false, lastError } -func (matcher *BeElementOfMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *BeElementOfMatcher) FailureMessage(actual any) (message string) { return format.Message(actual, "to be an element of", presentable(matcher.Elements)) } -func (matcher *BeElementOfMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *BeElementOfMatcher) NegatedFailureMessage(actual any) (message string) { return format.Message(actual, "not to be an element of", presentable(matcher.Elements)) } diff --git a/vendor/github.com/onsi/gomega/matchers/be_empty_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_empty_matcher.go index 527c1a1c1..e9e0644f3 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_empty_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_empty_matcher.go @@ -4,26 +4,40 @@ package matchers import ( "fmt" + "reflect" "github.com/onsi/gomega/format" + "github.com/onsi/gomega/matchers/internal/miter" ) type BeEmptyMatcher struct { } -func (matcher *BeEmptyMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *BeEmptyMatcher) Match(actual any) (success bool, err error) { + // short-circuit the iterator case, as we only need to see the first + // element, if any. + if miter.IsIter(actual) { + var length int + if miter.IsSeq2(actual) { + miter.IterateKV(actual, func(k, v reflect.Value) bool { length++; return false }) + } else { + miter.IterateV(actual, func(v reflect.Value) bool { length++; return false }) + } + return length == 0, nil + } + length, ok := lengthOf(actual) if !ok { - return false, fmt.Errorf("BeEmpty matcher expects a string/array/map/channel/slice. Got:\n%s", format.Object(actual, 1)) + return false, fmt.Errorf("BeEmpty matcher expects a string/array/map/channel/slice/iterator. Got:\n%s", format.Object(actual, 1)) } return length == 0, nil } -func (matcher *BeEmptyMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *BeEmptyMatcher) FailureMessage(actual any) (message string) { return format.Message(actual, "to be empty") } -func (matcher *BeEmptyMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *BeEmptyMatcher) NegatedFailureMessage(actual any) (message string) { return format.Message(actual, "not to be empty") } diff --git a/vendor/github.com/onsi/gomega/matchers/be_equivalent_to_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_equivalent_to_matcher.go index 263627f40..37b3080ba 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_equivalent_to_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_equivalent_to_matcher.go @@ -10,10 +10,10 @@ import ( ) type BeEquivalentToMatcher struct { - Expected interface{} + Expected any } -func (matcher *BeEquivalentToMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *BeEquivalentToMatcher) Match(actual any) (success bool, err error) { if actual == nil && matcher.Expected == nil { return false, fmt.Errorf("Both actual and expected must not be nil.") } @@ -27,10 +27,10 @@ func (matcher *BeEquivalentToMatcher) Match(actual interface{}) (success bool, e return reflect.DeepEqual(convertedActual, matcher.Expected), nil } -func (matcher *BeEquivalentToMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *BeEquivalentToMatcher) FailureMessage(actual any) (message string) { return format.Message(actual, "to be equivalent to", matcher.Expected) } -func (matcher *BeEquivalentToMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *BeEquivalentToMatcher) NegatedFailureMessage(actual any) (message string) { return format.Message(actual, "not to be equivalent to", matcher.Expected) } diff --git a/vendor/github.com/onsi/gomega/matchers/be_false_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_false_matcher.go index 8ee2b1c51..55e869515 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_false_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_false_matcher.go @@ -12,7 +12,7 @@ type BeFalseMatcher struct { Reason string } -func (matcher *BeFalseMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *BeFalseMatcher) Match(actual any) (success bool, err error) { if !isBool(actual) { return false, fmt.Errorf("Expected a boolean. Got:\n%s", format.Object(actual, 1)) } @@ -20,7 +20,7 @@ func (matcher *BeFalseMatcher) Match(actual interface{}) (success bool, err erro return actual == false, nil } -func (matcher *BeFalseMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *BeFalseMatcher) FailureMessage(actual any) (message string) { if matcher.Reason == "" { return format.Message(actual, "to be false") } else { @@ -28,7 +28,7 @@ func (matcher *BeFalseMatcher) FailureMessage(actual interface{}) (message strin } } -func (matcher *BeFalseMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *BeFalseMatcher) NegatedFailureMessage(actual any) (message string) { if matcher.Reason == "" { return format.Message(actual, "not to be false") } else { diff --git a/vendor/github.com/onsi/gomega/matchers/be_identical_to.go b/vendor/github.com/onsi/gomega/matchers/be_identical_to.go index 631ce11e3..579aa41b3 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_identical_to.go +++ b/vendor/github.com/onsi/gomega/matchers/be_identical_to.go @@ -10,10 +10,10 @@ import ( ) type BeIdenticalToMatcher struct { - Expected interface{} + Expected any } -func (matcher *BeIdenticalToMatcher) Match(actual interface{}) (success bool, matchErr error) { +func (matcher *BeIdenticalToMatcher) Match(actual any) (success bool, matchErr error) { if actual == nil && matcher.Expected == nil { return false, fmt.Errorf("Refusing to compare to .\nBe explicit and use BeNil() instead. This is to avoid mistakes where both sides of an assertion are erroneously uninitialized.") } @@ -30,10 +30,10 @@ func (matcher *BeIdenticalToMatcher) Match(actual interface{}) (success bool, ma return actual == matcher.Expected, nil } -func (matcher *BeIdenticalToMatcher) FailureMessage(actual interface{}) string { +func (matcher *BeIdenticalToMatcher) FailureMessage(actual any) string { return format.Message(actual, "to be identical to", matcher.Expected) } -func (matcher *BeIdenticalToMatcher) NegatedFailureMessage(actual interface{}) string { +func (matcher *BeIdenticalToMatcher) NegatedFailureMessage(actual any) string { return format.Message(actual, "not to be identical to", matcher.Expected) } diff --git a/vendor/github.com/onsi/gomega/matchers/be_key_of_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_key_of_matcher.go index 449a291ef..3fff3df78 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_key_of_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_key_of_matcher.go @@ -8,10 +8,10 @@ import ( ) type BeKeyOfMatcher struct { - Map interface{} + Map any } -func (matcher *BeKeyOfMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *BeKeyOfMatcher) Match(actual any) (success bool, err error) { if !isMap(matcher.Map) { return false, fmt.Errorf("BeKeyOf matcher needs expected to be a map type") } @@ -36,10 +36,10 @@ func (matcher *BeKeyOfMatcher) Match(actual interface{}) (success bool, err erro return false, lastError } -func (matcher *BeKeyOfMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *BeKeyOfMatcher) FailureMessage(actual any) (message string) { return format.Message(actual, "to be a key of", presentable(valuesOf(matcher.Map))) } -func (matcher *BeKeyOfMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *BeKeyOfMatcher) NegatedFailureMessage(actual any) (message string) { return format.Message(actual, "not to be a key of", presentable(valuesOf(matcher.Map))) } diff --git a/vendor/github.com/onsi/gomega/matchers/be_nil_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_nil_matcher.go index 551d99d74..cab37f4f9 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_nil_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_nil_matcher.go @@ -7,14 +7,14 @@ import "github.com/onsi/gomega/format" type BeNilMatcher struct { } -func (matcher *BeNilMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *BeNilMatcher) Match(actual any) (success bool, err error) { return isNil(actual), nil } -func (matcher *BeNilMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *BeNilMatcher) FailureMessage(actual any) (message string) { return format.Message(actual, "to be nil") } -func (matcher *BeNilMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *BeNilMatcher) NegatedFailureMessage(actual any) (message string) { return format.Message(actual, "not to be nil") } diff --git a/vendor/github.com/onsi/gomega/matchers/be_numerically_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_numerically_matcher.go index 100735de3..7e6ce154e 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_numerically_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_numerically_matcher.go @@ -11,18 +11,18 @@ import ( type BeNumericallyMatcher struct { Comparator string - CompareTo []interface{} + CompareTo []any } -func (matcher *BeNumericallyMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *BeNumericallyMatcher) FailureMessage(actual any) (message string) { return matcher.FormatFailureMessage(actual, false) } -func (matcher *BeNumericallyMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *BeNumericallyMatcher) NegatedFailureMessage(actual any) (message string) { return matcher.FormatFailureMessage(actual, true) } -func (matcher *BeNumericallyMatcher) FormatFailureMessage(actual interface{}, negated bool) (message string) { +func (matcher *BeNumericallyMatcher) FormatFailureMessage(actual any, negated bool) (message string) { if len(matcher.CompareTo) == 1 { message = fmt.Sprintf("to be %s", matcher.Comparator) } else { @@ -34,7 +34,7 @@ func (matcher *BeNumericallyMatcher) FormatFailureMessage(actual interface{}, ne return format.Message(actual, message, matcher.CompareTo[0]) } -func (matcher *BeNumericallyMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *BeNumericallyMatcher) Match(actual any) (success bool, err error) { if len(matcher.CompareTo) == 0 || len(matcher.CompareTo) > 2 { return false, fmt.Errorf("BeNumerically requires 1 or 2 CompareTo arguments. Got:\n%s", format.Object(matcher.CompareTo, 1)) } diff --git a/vendor/github.com/onsi/gomega/matchers/be_sent_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_sent_matcher.go index cf582a3fc..14ffbf6c4 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_sent_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_sent_matcher.go @@ -10,11 +10,11 @@ import ( ) type BeSentMatcher struct { - Arg interface{} + Arg any channelClosed bool } -func (matcher *BeSentMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *BeSentMatcher) Match(actual any) (success bool, err error) { if !isChan(actual) { return false, fmt.Errorf("BeSent expects a channel. Got:\n%s", format.Object(actual, 1)) } @@ -56,15 +56,15 @@ func (matcher *BeSentMatcher) Match(actual interface{}) (success bool, err error return didSend, nil } -func (matcher *BeSentMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *BeSentMatcher) FailureMessage(actual any) (message string) { return format.Message(actual, "to send:", matcher.Arg) } -func (matcher *BeSentMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *BeSentMatcher) NegatedFailureMessage(actual any) (message string) { return format.Message(actual, "not to send:", matcher.Arg) } -func (matcher *BeSentMatcher) MatchMayChangeInTheFuture(actual interface{}) bool { +func (matcher *BeSentMatcher) MatchMayChangeInTheFuture(actual any) bool { if !isChan(actual) { return false } diff --git a/vendor/github.com/onsi/gomega/matchers/be_temporally_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_temporally_matcher.go index dec4db024..edb647c6f 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_temporally_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_temporally_matcher.go @@ -15,17 +15,17 @@ type BeTemporallyMatcher struct { Threshold []time.Duration } -func (matcher *BeTemporallyMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *BeTemporallyMatcher) FailureMessage(actual any) (message string) { return format.Message(actual, fmt.Sprintf("to be %s", matcher.Comparator), matcher.CompareTo) } -func (matcher *BeTemporallyMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *BeTemporallyMatcher) NegatedFailureMessage(actual any) (message string) { return format.Message(actual, fmt.Sprintf("not to be %s", matcher.Comparator), matcher.CompareTo) } -func (matcher *BeTemporallyMatcher) Match(actual interface{}) (bool, error) { +func (matcher *BeTemporallyMatcher) Match(actual any) (bool, error) { // predicate to test for time.Time type - isTime := func(t interface{}) bool { + isTime := func(t any) bool { _, ok := t.(time.Time) return ok } diff --git a/vendor/github.com/onsi/gomega/matchers/be_true_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_true_matcher.go index 3576aac88..a010bec5a 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_true_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_true_matcher.go @@ -12,7 +12,7 @@ type BeTrueMatcher struct { Reason string } -func (matcher *BeTrueMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *BeTrueMatcher) Match(actual any) (success bool, err error) { if !isBool(actual) { return false, fmt.Errorf("Expected a boolean. Got:\n%s", format.Object(actual, 1)) } @@ -20,7 +20,7 @@ func (matcher *BeTrueMatcher) Match(actual interface{}) (success bool, err error return actual.(bool), nil } -func (matcher *BeTrueMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *BeTrueMatcher) FailureMessage(actual any) (message string) { if matcher.Reason == "" { return format.Message(actual, "to be true") } else { @@ -28,7 +28,7 @@ func (matcher *BeTrueMatcher) FailureMessage(actual interface{}) (message string } } -func (matcher *BeTrueMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *BeTrueMatcher) NegatedFailureMessage(actual any) (message string) { if matcher.Reason == "" { return format.Message(actual, "not to be true") } else { diff --git a/vendor/github.com/onsi/gomega/matchers/be_zero_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_zero_matcher.go index 26196f168..f5f5d7f7d 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_zero_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_zero_matcher.go @@ -9,7 +9,7 @@ import ( type BeZeroMatcher struct { } -func (matcher *BeZeroMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *BeZeroMatcher) Match(actual any) (success bool, err error) { if actual == nil { return true, nil } @@ -19,10 +19,10 @@ func (matcher *BeZeroMatcher) Match(actual interface{}) (success bool, err error } -func (matcher *BeZeroMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *BeZeroMatcher) FailureMessage(actual any) (message string) { return format.Message(actual, "to be zero-valued") } -func (matcher *BeZeroMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *BeZeroMatcher) NegatedFailureMessage(actual any) (message string) { return format.Message(actual, "not to be zero-valued") } diff --git a/vendor/github.com/onsi/gomega/matchers/consist_of.go b/vendor/github.com/onsi/gomega/matchers/consist_of.go index f69037a4f..05c751b66 100644 --- a/vendor/github.com/onsi/gomega/matchers/consist_of.go +++ b/vendor/github.com/onsi/gomega/matchers/consist_of.go @@ -7,18 +7,19 @@ import ( "reflect" "github.com/onsi/gomega/format" + "github.com/onsi/gomega/matchers/internal/miter" "github.com/onsi/gomega/matchers/support/goraph/bipartitegraph" ) type ConsistOfMatcher struct { - Elements []interface{} - missingElements []interface{} - extraElements []interface{} + Elements []any + missingElements []any + extraElements []any } -func (matcher *ConsistOfMatcher) Match(actual interface{}) (success bool, err error) { - if !isArrayOrSlice(actual) && !isMap(actual) { - return false, fmt.Errorf("ConsistOf matcher expects an array/slice/map. Got:\n%s", format.Object(actual, 1)) +func (matcher *ConsistOfMatcher) Match(actual any) (success bool, err error) { + if !isArrayOrSlice(actual) && !isMap(actual) && !miter.IsIter(actual) { + return false, fmt.Errorf("ConsistOf matcher expects an array/slice/map/iter.Seq/iter.Seq2. Got:\n%s", format.Object(actual, 1)) } matchers := matchers(matcher.Elements) @@ -34,19 +35,19 @@ func (matcher *ConsistOfMatcher) Match(actual interface{}) (success bool, err er return true, nil } - var missingMatchers []interface{} + var missingMatchers []any matcher.extraElements, missingMatchers = bipartiteGraph.FreeLeftRight(edges) matcher.missingElements = equalMatchersToElements(missingMatchers) return false, nil } -func neighbours(value, matcher interface{}) (bool, error) { +func neighbours(value, matcher any) (bool, error) { match, err := matcher.(omegaMatcher).Match(value) return match && err == nil, nil } -func equalMatchersToElements(matchers []interface{}) (elements []interface{}) { +func equalMatchersToElements(matchers []any) (elements []any) { for _, matcher := range matchers { if equalMatcher, ok := matcher.(*EqualMatcher); ok { elements = append(elements, equalMatcher.Expected) @@ -59,20 +60,31 @@ func equalMatchersToElements(matchers []interface{}) (elements []interface{}) { return } -func flatten(elems []interface{}) []interface{} { - if len(elems) != 1 || !isArrayOrSlice(elems[0]) { +func flatten(elems []any) []any { + if len(elems) != 1 || + !(isArrayOrSlice(elems[0]) || + (miter.IsIter(elems[0]) && !miter.IsSeq2(elems[0]))) { return elems } + if miter.IsIter(elems[0]) { + flattened := []any{} + miter.IterateV(elems[0], func(v reflect.Value) bool { + flattened = append(flattened, v.Interface()) + return true + }) + return flattened + } + value := reflect.ValueOf(elems[0]) - flattened := make([]interface{}, value.Len()) + flattened := make([]any, value.Len()) for i := 0; i < value.Len(); i++ { flattened[i] = value.Index(i).Interface() } return flattened } -func matchers(expectedElems []interface{}) (matchers []interface{}) { +func matchers(expectedElems []any) (matchers []any) { for _, e := range flatten(expectedElems) { if e == nil { matchers = append(matchers, &BeNilMatcher{}) @@ -85,11 +97,11 @@ func matchers(expectedElems []interface{}) (matchers []interface{}) { return } -func presentable(elems []interface{}) interface{} { +func presentable(elems []any) any { elems = flatten(elems) if len(elems) == 0 { - return []interface{}{} + return []any{} } sv := reflect.ValueOf(elems) @@ -113,10 +125,22 @@ func presentable(elems []interface{}) interface{} { return ss.Interface() } -func valuesOf(actual interface{}) []interface{} { +func valuesOf(actual any) []any { value := reflect.ValueOf(actual) - values := []interface{}{} - if isMap(actual) { + values := []any{} + if miter.IsIter(actual) { + if miter.IsSeq2(actual) { + miter.IterateKV(actual, func(k, v reflect.Value) bool { + values = append(values, v.Interface()) + return true + }) + } else { + miter.IterateV(actual, func(v reflect.Value) bool { + values = append(values, v.Interface()) + return true + }) + } + } else if isMap(actual) { keys := value.MapKeys() for i := 0; i < value.Len(); i++ { values = append(values, value.MapIndex(keys[i]).Interface()) @@ -130,7 +154,7 @@ func valuesOf(actual interface{}) []interface{} { return values } -func (matcher *ConsistOfMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *ConsistOfMatcher) FailureMessage(actual any) (message string) { message = format.Message(actual, "to consist of", presentable(matcher.Elements)) message = appendMissingElements(message, matcher.missingElements) if len(matcher.extraElements) > 0 { @@ -140,7 +164,7 @@ func (matcher *ConsistOfMatcher) FailureMessage(actual interface{}) (message str return } -func appendMissingElements(message string, missingElements []interface{}) string { +func appendMissingElements(message string, missingElements []any) string { if len(missingElements) == 0 { return message } @@ -148,6 +172,6 @@ func appendMissingElements(message string, missingElements []interface{}) string format.Object(presentable(missingElements), 1)) } -func (matcher *ConsistOfMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *ConsistOfMatcher) NegatedFailureMessage(actual any) (message string) { return format.Message(actual, "not to consist of", presentable(matcher.Elements)) } diff --git a/vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go b/vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go index 3d45c9ebc..8337a5261 100644 --- a/vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go @@ -8,24 +8,27 @@ import ( "reflect" "github.com/onsi/gomega/format" + "github.com/onsi/gomega/matchers/internal/miter" ) type ContainElementMatcher struct { - Element interface{} - Result []interface{} + Element any + Result []any } -func (matcher *ContainElementMatcher) Match(actual interface{}) (success bool, err error) { - if !isArrayOrSlice(actual) && !isMap(actual) { - return false, fmt.Errorf("ContainElement matcher expects an array/slice/map. Got:\n%s", format.Object(actual, 1)) +func (matcher *ContainElementMatcher) Match(actual any) (success bool, err error) { + if !isArrayOrSlice(actual) && !isMap(actual) && !miter.IsIter(actual) { + return false, fmt.Errorf("ContainElement matcher expects an array/slice/map/iterator. Got:\n%s", format.Object(actual, 1)) } var actualT reflect.Type var result reflect.Value - switch l := len(matcher.Result); { - case l > 1: + switch numResultArgs := len(matcher.Result); { + case numResultArgs > 1: return false, errors.New("ContainElement matcher expects at most a single optional pointer to store its findings at") - case l == 1: + case numResultArgs == 1: + // Check the optional result arg to point to a single value/array/slice/map + // of a type compatible with the actual value. if reflect.ValueOf(matcher.Result[0]).Kind() != reflect.Ptr { return false, fmt.Errorf("ContainElement matcher expects a non-nil pointer to store its findings at. Got\n%s", format.Object(matcher.Result[0], 1)) @@ -34,93 +37,209 @@ func (matcher *ContainElementMatcher) Match(actual interface{}) (success bool, e resultReference := matcher.Result[0] result = reflect.ValueOf(resultReference).Elem() // what ResultReference points to, to stash away our findings switch result.Kind() { - case reflect.Array: + case reflect.Array: // result arrays are not supported, as they cannot be dynamically sized. + if miter.IsIter(actual) { + _, actualvT := miter.IterKVTypes(actual) + return false, fmt.Errorf("ContainElement cannot return findings. Need *%s, got *%s", + reflect.SliceOf(actualvT), result.Type().String()) + } return false, fmt.Errorf("ContainElement cannot return findings. Need *%s, got *%s", reflect.SliceOf(actualT.Elem()).String(), result.Type().String()) - case reflect.Slice: - if !isArrayOrSlice(actual) { + + case reflect.Slice: // result slice + // can we assign elements in actual to elements in what the result + // arg points to? + // - ✔ actual is an array or slice + // - ✔ actual is an iter.Seq producing "v" elements + // - ✔ actual is an iter.Seq2 producing "v" elements, ignoring + // the "k" elements. + switch { + case isArrayOrSlice(actual): + if !actualT.Elem().AssignableTo(result.Type().Elem()) { + return false, fmt.Errorf("ContainElement cannot return findings. Need *%s, got *%s", + actualT.String(), result.Type().String()) + } + + case miter.IsIter(actual): + _, actualvT := miter.IterKVTypes(actual) + if !actualvT.AssignableTo(result.Type().Elem()) { + return false, fmt.Errorf("ContainElement cannot return findings. Need *%s, got *%s", + actualvT.String(), result.Type().String()) + } + + default: // incompatible result reference return false, fmt.Errorf("ContainElement cannot return findings. Need *%s, got *%s", reflect.MapOf(actualT.Key(), actualT.Elem()).String(), result.Type().String()) } - if !actualT.Elem().AssignableTo(result.Type().Elem()) { - return false, fmt.Errorf("ContainElement cannot return findings. Need *%s, got *%s", - actualT.String(), result.Type().String()) - } - case reflect.Map: - if !isMap(actual) { - return false, fmt.Errorf("ContainElement cannot return findings. Need *%s, got *%s", - actualT.String(), result.Type().String()) - } - if !actualT.AssignableTo(result.Type()) { + + case reflect.Map: // result map + // can we assign elements in actual to elements in what the result + // arg points to? + // - ✔ actual is a map + // - ✔ actual is an iter.Seq2 (iter.Seq doesn't fit though) + switch { + case isMap(actual): + if !actualT.AssignableTo(result.Type()) { + return false, fmt.Errorf("ContainElement cannot return findings. Need *%s, got *%s", + actualT.String(), result.Type().String()) + } + + case miter.IsIter(actual): + actualkT, actualvT := miter.IterKVTypes(actual) + if actualkT == nil { + return false, fmt.Errorf("ContainElement cannot return findings. Need *%s, got *%s", + reflect.SliceOf(actualvT).String(), result.Type().String()) + } + if !reflect.MapOf(actualkT, actualvT).AssignableTo(result.Type()) { + return false, fmt.Errorf("ContainElement cannot return findings. Need *%s, got *%s", + reflect.MapOf(actualkT, actualvT), result.Type().String()) + } + + default: // incompatible result reference return false, fmt.Errorf("ContainElement cannot return findings. Need *%s, got *%s", actualT.String(), result.Type().String()) } + default: - if !actualT.Elem().AssignableTo(result.Type()) { - return false, fmt.Errorf("ContainElement cannot return findings. Need *%s, got *%s", - actualT.Elem().String(), result.Type().String()) + // can we assign a (single) element in actual to what the result arg + // points to? + switch { + case miter.IsIter(actual): + _, actualvT := miter.IterKVTypes(actual) + if !actualvT.AssignableTo(result.Type()) { + return false, fmt.Errorf("ContainElement cannot return findings. Need *%s, got *%s", + actualvT.String(), result.Type().String()) + } + default: + if !actualT.Elem().AssignableTo(result.Type()) { + return false, fmt.Errorf("ContainElement cannot return findings. Need *%s, got *%s", + actualT.Elem().String(), result.Type().String()) + } } } } + // If the supplied matcher isn't an Omega matcher, default to the Equal + // matcher. elemMatcher, elementIsMatcher := matcher.Element.(omegaMatcher) if !elementIsMatcher { elemMatcher = &EqualMatcher{Expected: matcher.Element} } value := reflect.ValueOf(actual) - var valueAt func(int) interface{} - var getFindings func() reflect.Value - var foundAt func(int) + var getFindings func() reflect.Value // abstracts how the findings are collected and stored + var lastError error - if isMap(actual) { - keys := value.MapKeys() - valueAt = func(i int) interface{} { - return value.MapIndex(keys[i]).Interface() + if !miter.IsIter(actual) { + var valueAt func(int) any + var foundAt func(int) + // We're dealing with an array/slice/map, so in all cases we can iterate + // over the elements in actual using indices (that can be considered + // keys in case of maps). + if isMap(actual) { + keys := value.MapKeys() + valueAt = func(i int) any { + return value.MapIndex(keys[i]).Interface() + } + if result.Kind() != reflect.Invalid { + fm := reflect.MakeMap(actualT) + getFindings = func() reflect.Value { return fm } + foundAt = func(i int) { + fm.SetMapIndex(keys[i], value.MapIndex(keys[i])) + } + } + } else { + valueAt = func(i int) any { + return value.Index(i).Interface() + } + if result.Kind() != reflect.Invalid { + var fsl reflect.Value + if result.Kind() == reflect.Slice { + fsl = reflect.MakeSlice(result.Type(), 0, 0) + } else { + fsl = reflect.MakeSlice(reflect.SliceOf(result.Type()), 0, 0) + } + getFindings = func() reflect.Value { return fsl } + foundAt = func(i int) { + fsl = reflect.Append(fsl, value.Index(i)) + } + } } - if result.Kind() != reflect.Invalid { - fm := reflect.MakeMap(actualT) - getFindings = func() reflect.Value { - return fm + + for i := 0; i < value.Len(); i++ { + elem := valueAt(i) + success, err := elemMatcher.Match(elem) + if err != nil { + lastError = err + continue } - foundAt = func(i int) { - fm.SetMapIndex(keys[i], value.MapIndex(keys[i])) + if success { + if result.Kind() == reflect.Invalid { + return true, nil + } + foundAt(i) } } } else { - valueAt = func(i int) interface{} { - return value.Index(i).Interface() - } + // We're dealing with an iterator as a first-class construct, so things + // are slightly different: there is no index defined as in case of + // arrays/slices/maps, just "ooooorder" + var found func(k, v reflect.Value) if result.Kind() != reflect.Invalid { - var f reflect.Value - if result.Kind() == reflect.Slice { - f = reflect.MakeSlice(result.Type(), 0, 0) + if result.Kind() == reflect.Map { + fm := reflect.MakeMap(result.Type()) + getFindings = func() reflect.Value { return fm } + found = func(k, v reflect.Value) { fm.SetMapIndex(k, v) } } else { - f = reflect.MakeSlice(reflect.SliceOf(result.Type()), 0, 0) - } - getFindings = func() reflect.Value { - return f - } - foundAt = func(i int) { - f = reflect.Append(f, value.Index(i)) + var fsl reflect.Value + if result.Kind() == reflect.Slice { + fsl = reflect.MakeSlice(result.Type(), 0, 0) + } else { + fsl = reflect.MakeSlice(reflect.SliceOf(result.Type()), 0, 0) + } + getFindings = func() reflect.Value { return fsl } + found = func(_, v reflect.Value) { fsl = reflect.Append(fsl, v) } } } - } - var lastError error - for i := 0; i < value.Len(); i++ { - elem := valueAt(i) - success, err := elemMatcher.Match(elem) - if err != nil { - lastError = err - continue + success := false + actualkT, _ := miter.IterKVTypes(actual) + if actualkT == nil { + miter.IterateV(actual, func(v reflect.Value) bool { + var err error + success, err = elemMatcher.Match(v.Interface()) + if err != nil { + lastError = err + return true // iterate on... + } + if success { + if result.Kind() == reflect.Invalid { + return false // a match and no result needed, so we're done + } + found(reflect.Value{}, v) + } + return true // iterate on... + }) + } else { + miter.IterateKV(actual, func(k, v reflect.Value) bool { + var err error + success, err = elemMatcher.Match(v.Interface()) + if err != nil { + lastError = err + return true // iterate on... + } + if success { + if result.Kind() == reflect.Invalid { + return false // a match and no result needed, so we're done + } + found(k, v) + } + return true // iterate on... + }) } - if success { - if result.Kind() == reflect.Invalid { - return true, nil - } - foundAt(i) + if success && result.Kind() == reflect.Invalid { + return true, nil } } @@ -132,7 +251,7 @@ func (matcher *ContainElementMatcher) Match(actual interface{}) (success bool, e } // pick up any findings the test is interested in as it specified a non-nil - // result reference. However, the expection always is that there are at + // result reference. However, the expectation always is that there are at // least one or multiple findings. So, if a result is expected, but we had // no findings, then this is an error. findings := getFindings() @@ -165,10 +284,10 @@ func (matcher *ContainElementMatcher) Match(actual interface{}) (success bool, e return true, nil } -func (matcher *ContainElementMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *ContainElementMatcher) FailureMessage(actual any) (message string) { return format.Message(actual, "to contain element matching", matcher.Element) } -func (matcher *ContainElementMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *ContainElementMatcher) NegatedFailureMessage(actual any) (message string) { return format.Message(actual, "not to contain element matching", matcher.Element) } diff --git a/vendor/github.com/onsi/gomega/matchers/contain_elements_matcher.go b/vendor/github.com/onsi/gomega/matchers/contain_elements_matcher.go index 946cd8bea..ce3041892 100644 --- a/vendor/github.com/onsi/gomega/matchers/contain_elements_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/contain_elements_matcher.go @@ -4,17 +4,18 @@ import ( "fmt" "github.com/onsi/gomega/format" + "github.com/onsi/gomega/matchers/internal/miter" "github.com/onsi/gomega/matchers/support/goraph/bipartitegraph" ) type ContainElementsMatcher struct { - Elements []interface{} - missingElements []interface{} + Elements []any + missingElements []any } -func (matcher *ContainElementsMatcher) Match(actual interface{}) (success bool, err error) { - if !isArrayOrSlice(actual) && !isMap(actual) { - return false, fmt.Errorf("ContainElements matcher expects an array/slice/map. Got:\n%s", format.Object(actual, 1)) +func (matcher *ContainElementsMatcher) Match(actual any) (success bool, err error) { + if !isArrayOrSlice(actual) && !isMap(actual) && !miter.IsIter(actual) { + return false, fmt.Errorf("ContainElements matcher expects an array/slice/map/iter.Seq/iter.Seq2. Got:\n%s", format.Object(actual, 1)) } matchers := matchers(matcher.Elements) @@ -34,11 +35,11 @@ func (matcher *ContainElementsMatcher) Match(actual interface{}) (success bool, return false, nil } -func (matcher *ContainElementsMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *ContainElementsMatcher) FailureMessage(actual any) (message string) { message = format.Message(actual, "to contain elements", presentable(matcher.Elements)) return appendMissingElements(message, matcher.missingElements) } -func (matcher *ContainElementsMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *ContainElementsMatcher) NegatedFailureMessage(actual any) (message string) { return format.Message(actual, "not to contain elements", presentable(matcher.Elements)) } diff --git a/vendor/github.com/onsi/gomega/matchers/contain_substring_matcher.go b/vendor/github.com/onsi/gomega/matchers/contain_substring_matcher.go index e725f8c27..d9980ee26 100644 --- a/vendor/github.com/onsi/gomega/matchers/contain_substring_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/contain_substring_matcher.go @@ -11,10 +11,10 @@ import ( type ContainSubstringMatcher struct { Substr string - Args []interface{} + Args []any } -func (matcher *ContainSubstringMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *ContainSubstringMatcher) Match(actual any) (success bool, err error) { actualString, ok := toString(actual) if !ok { return false, fmt.Errorf("ContainSubstring matcher requires a string or stringer. Got:\n%s", format.Object(actual, 1)) @@ -31,10 +31,10 @@ func (matcher *ContainSubstringMatcher) stringToMatch() string { return stringToMatch } -func (matcher *ContainSubstringMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *ContainSubstringMatcher) FailureMessage(actual any) (message string) { return format.Message(actual, "to contain substring", matcher.stringToMatch()) } -func (matcher *ContainSubstringMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *ContainSubstringMatcher) NegatedFailureMessage(actual any) (message string) { return format.Message(actual, "not to contain substring", matcher.stringToMatch()) } diff --git a/vendor/github.com/onsi/gomega/matchers/equal_matcher.go b/vendor/github.com/onsi/gomega/matchers/equal_matcher.go index befb7bdfd..4ad166157 100644 --- a/vendor/github.com/onsi/gomega/matchers/equal_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/equal_matcher.go @@ -9,10 +9,10 @@ import ( ) type EqualMatcher struct { - Expected interface{} + Expected any } -func (matcher *EqualMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *EqualMatcher) Match(actual any) (success bool, err error) { if actual == nil && matcher.Expected == nil { return false, fmt.Errorf("Refusing to compare to .\nBe explicit and use BeNil() instead. This is to avoid mistakes where both sides of an assertion are erroneously uninitialized.") } @@ -27,7 +27,7 @@ func (matcher *EqualMatcher) Match(actual interface{}) (success bool, err error) return reflect.DeepEqual(actual, matcher.Expected), nil } -func (matcher *EqualMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *EqualMatcher) FailureMessage(actual any) (message string) { actualString, actualOK := actual.(string) expectedString, expectedOK := matcher.Expected.(string) if actualOK && expectedOK { @@ -37,6 +37,6 @@ func (matcher *EqualMatcher) FailureMessage(actual interface{}) (message string) return format.Message(actual, "to equal", matcher.Expected) } -func (matcher *EqualMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *EqualMatcher) NegatedFailureMessage(actual any) (message string) { return format.Message(actual, "not to equal", matcher.Expected) } diff --git a/vendor/github.com/onsi/gomega/matchers/have_cap_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_cap_matcher.go index 9856752f1..a4fcfc425 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_cap_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_cap_matcher.go @@ -12,7 +12,7 @@ type HaveCapMatcher struct { Count int } -func (matcher *HaveCapMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *HaveCapMatcher) Match(actual any) (success bool, err error) { length, ok := capOf(actual) if !ok { return false, fmt.Errorf("HaveCap matcher expects a array/channel/slice. Got:\n%s", format.Object(actual, 1)) @@ -21,10 +21,10 @@ func (matcher *HaveCapMatcher) Match(actual interface{}) (success bool, err erro return length == matcher.Count, nil } -func (matcher *HaveCapMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *HaveCapMatcher) FailureMessage(actual any) (message string) { return fmt.Sprintf("Expected\n%s\nto have capacity %d", format.Object(actual, 1), matcher.Count) } -func (matcher *HaveCapMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *HaveCapMatcher) NegatedFailureMessage(actual any) (message string) { return fmt.Sprintf("Expected\n%s\nnot to have capacity %d", format.Object(actual, 1), matcher.Count) } diff --git a/vendor/github.com/onsi/gomega/matchers/have_each_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_each_matcher.go index 025b6e1ac..4c45063bd 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_each_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_each_matcher.go @@ -5,15 +5,16 @@ import ( "reflect" "github.com/onsi/gomega/format" + "github.com/onsi/gomega/matchers/internal/miter" ) type HaveEachMatcher struct { - Element interface{} + Element any } -func (matcher *HaveEachMatcher) Match(actual interface{}) (success bool, err error) { - if !isArrayOrSlice(actual) && !isMap(actual) { - return false, fmt.Errorf("HaveEach matcher expects an array/slice/map. Got:\n%s", +func (matcher *HaveEachMatcher) Match(actual any) (success bool, err error) { + if !isArrayOrSlice(actual) && !isMap(actual) && !miter.IsIter(actual) { + return false, fmt.Errorf("HaveEach matcher expects an array/slice/map/iter.Seq/iter.Seq2. Got:\n%s", format.Object(actual, 1)) } @@ -22,25 +23,58 @@ func (matcher *HaveEachMatcher) Match(actual interface{}) (success bool, err err elemMatcher = &EqualMatcher{Expected: matcher.Element} } + if miter.IsIter(actual) { + // rejecting the non-elements case works different for iterators as we + // don't want to fetch all elements into a slice first. + count := 0 + var success bool + var err error + if miter.IsSeq2(actual) { + miter.IterateKV(actual, func(k, v reflect.Value) bool { + count++ + success, err = elemMatcher.Match(v.Interface()) + if err != nil { + return false + } + return success + }) + } else { + miter.IterateV(actual, func(v reflect.Value) bool { + count++ + success, err = elemMatcher.Match(v.Interface()) + if err != nil { + return false + } + return success + }) + } + if count == 0 { + return false, fmt.Errorf("HaveEach matcher expects a non-empty iter.Seq/iter.Seq2. Got:\n%s", + format.Object(actual, 1)) + } + return success, err + } + value := reflect.ValueOf(actual) if value.Len() == 0 { return false, fmt.Errorf("HaveEach matcher expects a non-empty array/slice/map. Got:\n%s", format.Object(actual, 1)) } - var valueAt func(int) interface{} + var valueAt func(int) any if isMap(actual) { keys := value.MapKeys() - valueAt = func(i int) interface{} { + valueAt = func(i int) any { return value.MapIndex(keys[i]).Interface() } } else { - valueAt = func(i int) interface{} { + valueAt = func(i int) any { return value.Index(i).Interface() } } - // if there are no elements, then HaveEach will match. + // if we never failed then we succeed; the empty/nil cases have already been + // rejected above. for i := 0; i < value.Len(); i++ { success, err := elemMatcher.Match(valueAt(i)) if err != nil { @@ -55,11 +89,11 @@ func (matcher *HaveEachMatcher) Match(actual interface{}) (success bool, err err } // FailureMessage returns a suitable failure message. -func (matcher *HaveEachMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *HaveEachMatcher) FailureMessage(actual any) (message string) { return format.Message(actual, "to contain element matching", matcher.Element) } // NegatedFailureMessage returns a suitable negated failure message. -func (matcher *HaveEachMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *HaveEachMatcher) NegatedFailureMessage(actual any) (message string) { return format.Message(actual, "not to contain element matching", matcher.Element) } 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..8b2d297c5 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_exact_elements.go +++ b/vendor/github.com/onsi/gomega/matchers/have_exact_elements.go @@ -2,8 +2,10 @@ package matchers import ( "fmt" + "reflect" "github.com/onsi/gomega/format" + "github.com/onsi/gomega/matchers/internal/miter" ) type mismatchFailure struct { @@ -12,33 +14,77 @@ type mismatchFailure struct { } type HaveExactElementsMatcher struct { - Elements []interface{} + Elements []any mismatchFailures []mismatchFailure missingIndex int extraIndex int } -func (matcher *HaveExactElementsMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *HaveExactElementsMatcher) Match(actual any) (success bool, err error) { matcher.resetState() - if isMap(actual) { - return false, fmt.Errorf("error") + if isMap(actual) || miter.IsSeq2(actual) { + return false, fmt.Errorf("HaveExactElements matcher doesn't work on map or iter.Seq2. Got:\n%s", format.Object(actual, 1)) } matchers := matchers(matcher.Elements) - values := valuesOf(actual) - lenMatchers := len(matchers) + + success = true + + if miter.IsIter(actual) { + // In the worst case, we need to see everything before we can give our + // verdict. The only exception is fast fail. + i := 0 + miter.IterateV(actual, func(v reflect.Value) bool { + if i >= lenMatchers { + // the iterator produces more values than we got matchers: this + // is not good. + matcher.extraIndex = i + success = false + return false + } + + elemMatcher := matchers[i].(omegaMatcher) + match, err := elemMatcher.Match(v.Interface()) + if err != nil { + matcher.mismatchFailures = append(matcher.mismatchFailures, mismatchFailure{ + index: i, + failure: err.Error(), + }) + success = false + } else if !match { + matcher.mismatchFailures = append(matcher.mismatchFailures, mismatchFailure{ + index: i, + failure: elemMatcher.FailureMessage(v.Interface()), + }) + success = false + } + i++ + return true + }) + if i < len(matchers) { + // the iterator produced less values than we got matchers: this is + // no good, no no no. + matcher.missingIndex = i + success = false + } + return success, nil + } + + values := valuesOf(actual) lenValues := len(values) 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,18 +95,20 @@ 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) { +func (matcher *HaveExactElementsMatcher) FailureMessage(actual any) (message string) { message = format.Message(actual, "to have exact elements with", presentable(matcher.Elements)) if matcher.missingIndex > 0 { message = fmt.Sprintf("%s\nthe missing elements start from index %d", message, matcher.missingIndex) @@ -77,7 +125,7 @@ func (matcher *HaveExactElementsMatcher) FailureMessage(actual interface{}) (mes return } -func (matcher *HaveExactElementsMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *HaveExactElementsMatcher) NegatedFailureMessage(actual any) (message string) { return format.Message(actual, "not to contain elements", presentable(matcher.Elements)) } diff --git a/vendor/github.com/onsi/gomega/matchers/have_existing_field_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_existing_field_matcher.go index b57018745..a5a028e9a 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_existing_field_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_existing_field_matcher.go @@ -11,7 +11,7 @@ type HaveExistingFieldMatcher struct { Field string } -func (matcher *HaveExistingFieldMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *HaveExistingFieldMatcher) Match(actual any) (success bool, err error) { // we don't care about the field's actual value, just about any error in // trying to find the field (or method). _, err = extractField(actual, matcher.Field, "HaveExistingField") @@ -27,10 +27,10 @@ func (matcher *HaveExistingFieldMatcher) Match(actual interface{}) (success bool return false, err } -func (matcher *HaveExistingFieldMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *HaveExistingFieldMatcher) FailureMessage(actual any) (message string) { return fmt.Sprintf("Expected\n%s\nto have field '%s'", format.Object(actual, 1), matcher.Field) } -func (matcher *HaveExistingFieldMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *HaveExistingFieldMatcher) NegatedFailureMessage(actual any) (message string) { return fmt.Sprintf("Expected\n%s\nnot to have field '%s'", format.Object(actual, 1), matcher.Field) } diff --git a/vendor/github.com/onsi/gomega/matchers/have_field.go b/vendor/github.com/onsi/gomega/matchers/have_field.go index 6989f78c4..d9fbeaf75 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 any, field string, matchername string) (any, error) { fields := strings.SplitN(field, ".", 2) actualValue := reflect.ValueOf(actual) @@ -40,7 +40,12 @@ func extractField(actual interface{}, field string, matchername string) (interfa extractedValue = actualValue.Addr().MethodByName(strings.TrimSuffix(fields[0], "()")) } if extractedValue == (reflect.Value{}) { - return nil, missingFieldError(fmt.Sprintf("%s could not find method named '%s' in struct of type %T.", matchername, fields[0], actual)) + ptr := reflect.New(actualValue.Type()) + ptr.Elem().Set(actualValue) + extractedValue = ptr.MethodByName(strings.TrimSuffix(fields[0], "()")) + if extractedValue == (reflect.Value{}) { + return nil, missingFieldError(fmt.Sprintf("%s could not find method named '%s' in struct of type %T.", matchername, fields[0], actual)) + } } t := extractedValue.Type() if t.NumIn() != 0 || t.NumOut() != 1 { @@ -63,37 +68,47 @@ func extractField(actual interface{}, field string, matchername string) (interfa type HaveFieldMatcher struct { Field string - Expected interface{} + Expected any +} - 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") +func (matcher *HaveFieldMatcher) Match(actual any) (success bool, err error) { + 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) { +func (matcher *HaveFieldMatcher) FailureMessage(actual any) (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) { +func (matcher *HaveFieldMatcher) NegatedFailureMessage(actual any) (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/have_http_body_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_http_body_matcher.go index d14d9e5fc..2d561b9a2 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_http_body_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_http_body_matcher.go @@ -11,12 +11,12 @@ import ( ) type HaveHTTPBodyMatcher struct { - Expected interface{} - cachedResponse interface{} + Expected any + cachedResponse any cachedBody []byte } -func (matcher *HaveHTTPBodyMatcher) Match(actual interface{}) (bool, error) { +func (matcher *HaveHTTPBodyMatcher) Match(actual any) (bool, error) { body, err := matcher.body(actual) if err != nil { return false, err @@ -34,7 +34,7 @@ func (matcher *HaveHTTPBodyMatcher) Match(actual interface{}) (bool, error) { } } -func (matcher *HaveHTTPBodyMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *HaveHTTPBodyMatcher) FailureMessage(actual any) (message string) { body, err := matcher.body(actual) if err != nil { return fmt.Sprintf("failed to read body: %s", err) @@ -52,7 +52,7 @@ func (matcher *HaveHTTPBodyMatcher) FailureMessage(actual interface{}) (message } } -func (matcher *HaveHTTPBodyMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *HaveHTTPBodyMatcher) NegatedFailureMessage(actual any) (message string) { body, err := matcher.body(actual) if err != nil { return fmt.Sprintf("failed to read body: %s", err) @@ -73,7 +73,7 @@ func (matcher *HaveHTTPBodyMatcher) NegatedFailureMessage(actual interface{}) (m // body returns the body. It is cached because once we read it in Match() // the Reader is closed and it is not readable again in FailureMessage() // or NegatedFailureMessage() -func (matcher *HaveHTTPBodyMatcher) body(actual interface{}) ([]byte, error) { +func (matcher *HaveHTTPBodyMatcher) body(actual any) ([]byte, error) { if matcher.cachedResponse == actual && matcher.cachedBody != nil { return matcher.cachedBody, nil } diff --git a/vendor/github.com/onsi/gomega/matchers/have_http_header_with_value_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_http_header_with_value_matcher.go index c256f452e..756722659 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_http_header_with_value_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_http_header_with_value_matcher.go @@ -11,10 +11,10 @@ import ( type HaveHTTPHeaderWithValueMatcher struct { Header string - Value interface{} + Value any } -func (matcher *HaveHTTPHeaderWithValueMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *HaveHTTPHeaderWithValueMatcher) Match(actual any) (success bool, err error) { headerValue, err := matcher.extractHeader(actual) if err != nil { return false, err @@ -28,7 +28,7 @@ func (matcher *HaveHTTPHeaderWithValueMatcher) Match(actual interface{}) (succes return headerMatcher.Match(headerValue) } -func (matcher *HaveHTTPHeaderWithValueMatcher) FailureMessage(actual interface{}) string { +func (matcher *HaveHTTPHeaderWithValueMatcher) FailureMessage(actual any) string { headerValue, err := matcher.extractHeader(actual) if err != nil { panic(err) // protected by Match() @@ -43,7 +43,7 @@ func (matcher *HaveHTTPHeaderWithValueMatcher) FailureMessage(actual interface{} return fmt.Sprintf("HTTP header %q:\n%s", matcher.Header, diff) } -func (matcher *HaveHTTPHeaderWithValueMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *HaveHTTPHeaderWithValueMatcher) NegatedFailureMessage(actual any) (message string) { headerValue, err := matcher.extractHeader(actual) if err != nil { panic(err) // protected by Match() @@ -69,7 +69,7 @@ func (matcher *HaveHTTPHeaderWithValueMatcher) getSubMatcher() (types.GomegaMatc } } -func (matcher *HaveHTTPHeaderWithValueMatcher) extractHeader(actual interface{}) (string, error) { +func (matcher *HaveHTTPHeaderWithValueMatcher) extractHeader(actual any) (string, error) { switch r := actual.(type) { case *http.Response: return r.Header.Get(matcher.Header), nil diff --git a/vendor/github.com/onsi/gomega/matchers/have_http_status_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_http_status_matcher.go index 0f66e46ec..8b25b3a9f 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_http_status_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_http_status_matcher.go @@ -12,10 +12,10 @@ import ( ) type HaveHTTPStatusMatcher struct { - Expected []interface{} + Expected []any } -func (matcher *HaveHTTPStatusMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *HaveHTTPStatusMatcher) Match(actual any) (success bool, err error) { var resp *http.Response switch a := actual.(type) { case *http.Response: @@ -48,11 +48,11 @@ func (matcher *HaveHTTPStatusMatcher) Match(actual interface{}) (success bool, e return false, nil } -func (matcher *HaveHTTPStatusMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *HaveHTTPStatusMatcher) FailureMessage(actual any) (message string) { return fmt.Sprintf("Expected\n%s\n%s\n%s", formatHttpResponse(actual), "to have HTTP status", matcher.expectedString()) } -func (matcher *HaveHTTPStatusMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *HaveHTTPStatusMatcher) NegatedFailureMessage(actual any) (message string) { return fmt.Sprintf("Expected\n%s\n%s\n%s", formatHttpResponse(actual), "not to have HTTP status", matcher.expectedString()) } @@ -64,7 +64,7 @@ func (matcher *HaveHTTPStatusMatcher) expectedString() string { return strings.Join(lines, "\n") } -func formatHttpResponse(input interface{}) string { +func formatHttpResponse(input any) string { var resp *http.Response switch r := input.(type) { case *http.Response: diff --git a/vendor/github.com/onsi/gomega/matchers/have_key_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_key_matcher.go index 00cffec70..9e16dcf5d 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_key_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_key_matcher.go @@ -7,15 +7,16 @@ import ( "reflect" "github.com/onsi/gomega/format" + "github.com/onsi/gomega/matchers/internal/miter" ) type HaveKeyMatcher struct { - Key interface{} + Key any } -func (matcher *HaveKeyMatcher) Match(actual interface{}) (success bool, err error) { - if !isMap(actual) { - return false, fmt.Errorf("HaveKey matcher expects a map. Got:%s", format.Object(actual, 1)) +func (matcher *HaveKeyMatcher) Match(actual any) (success bool, err error) { + if !isMap(actual) && !miter.IsSeq2(actual) { + return false, fmt.Errorf("HaveKey matcher expects a map/iter.Seq2. Got:%s", format.Object(actual, 1)) } keyMatcher, keyIsMatcher := matcher.Key.(omegaMatcher) @@ -23,6 +24,20 @@ func (matcher *HaveKeyMatcher) Match(actual interface{}) (success bool, err erro keyMatcher = &EqualMatcher{Expected: matcher.Key} } + if miter.IsSeq2(actual) { + var success bool + var err error + miter.IterateKV(actual, func(k, v reflect.Value) bool { + success, err = keyMatcher.Match(k.Interface()) + if err != nil { + err = fmt.Errorf("HaveKey's key matcher failed with:\n%s%s", format.Indent, err.Error()) + return false + } + return !success + }) + return success, err + } + keys := reflect.ValueOf(actual).MapKeys() for i := 0; i < len(keys); i++ { success, err := keyMatcher.Match(keys[i].Interface()) @@ -37,7 +52,7 @@ func (matcher *HaveKeyMatcher) Match(actual interface{}) (success bool, err erro return false, nil } -func (matcher *HaveKeyMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *HaveKeyMatcher) FailureMessage(actual any) (message string) { switch matcher.Key.(type) { case omegaMatcher: return format.Message(actual, "to have key matching", matcher.Key) @@ -46,7 +61,7 @@ func (matcher *HaveKeyMatcher) FailureMessage(actual interface{}) (message strin } } -func (matcher *HaveKeyMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *HaveKeyMatcher) NegatedFailureMessage(actual any) (message string) { switch matcher.Key.(type) { case omegaMatcher: return format.Message(actual, "not to have key matching", matcher.Key) diff --git a/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go index 4c5916804..1c53f1e56 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go @@ -7,16 +7,17 @@ import ( "reflect" "github.com/onsi/gomega/format" + "github.com/onsi/gomega/matchers/internal/miter" ) type HaveKeyWithValueMatcher struct { - Key interface{} - Value interface{} + Key any + Value any } -func (matcher *HaveKeyWithValueMatcher) Match(actual interface{}) (success bool, err error) { - if !isMap(actual) { - return false, fmt.Errorf("HaveKeyWithValue matcher expects a map. Got:%s", format.Object(actual, 1)) +func (matcher *HaveKeyWithValueMatcher) Match(actual any) (success bool, err error) { + if !isMap(actual) && !miter.IsSeq2(actual) { + return false, fmt.Errorf("HaveKeyWithValue matcher expects a map/iter.Seq2. Got:%s", format.Object(actual, 1)) } keyMatcher, keyIsMatcher := matcher.Key.(omegaMatcher) @@ -29,6 +30,27 @@ func (matcher *HaveKeyWithValueMatcher) Match(actual interface{}) (success bool, valueMatcher = &EqualMatcher{Expected: matcher.Value} } + if miter.IsSeq2(actual) { + var success bool + var err error + miter.IterateKV(actual, func(k, v reflect.Value) bool { + success, err = keyMatcher.Match(k.Interface()) + if err != nil { + err = fmt.Errorf("HaveKey's key matcher failed with:\n%s%s", format.Indent, err.Error()) + return false + } + if success { + success, err = valueMatcher.Match(v.Interface()) + if err != nil { + err = fmt.Errorf("HaveKeyWithValue's value matcher failed with:\n%s%s", format.Indent, err.Error()) + return false + } + } + return !success + }) + return success, err + } + keys := reflect.ValueOf(actual).MapKeys() for i := 0; i < len(keys); i++ { success, err := keyMatcher.Match(keys[i].Interface()) @@ -48,7 +70,7 @@ func (matcher *HaveKeyWithValueMatcher) Match(actual interface{}) (success bool, return false, nil } -func (matcher *HaveKeyWithValueMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *HaveKeyWithValueMatcher) FailureMessage(actual any) (message string) { str := "to have {key: value}" if _, ok := matcher.Key.(omegaMatcher); ok { str += " matching" @@ -56,12 +78,12 @@ func (matcher *HaveKeyWithValueMatcher) FailureMessage(actual interface{}) (mess str += " matching" } - expect := make(map[interface{}]interface{}, 1) + expect := make(map[any]any, 1) expect[matcher.Key] = matcher.Value return format.Message(actual, str, expect) } -func (matcher *HaveKeyWithValueMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *HaveKeyWithValueMatcher) NegatedFailureMessage(actual any) (message string) { kStr := "not to have key" if _, ok := matcher.Key.(omegaMatcher); ok { kStr = "not to have key matching" diff --git a/vendor/github.com/onsi/gomega/matchers/have_len_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_len_matcher.go index ee4276189..c334d4c0a 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_len_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_len_matcher.go @@ -10,19 +10,19 @@ type HaveLenMatcher struct { Count int } -func (matcher *HaveLenMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *HaveLenMatcher) Match(actual any) (success bool, err error) { length, ok := lengthOf(actual) if !ok { - return false, fmt.Errorf("HaveLen matcher expects a string/array/map/channel/slice. Got:\n%s", format.Object(actual, 1)) + return false, fmt.Errorf("HaveLen matcher expects a string/array/map/channel/slice/iterator. Got:\n%s", format.Object(actual, 1)) } return length == matcher.Count, nil } -func (matcher *HaveLenMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *HaveLenMatcher) FailureMessage(actual any) (message string) { return fmt.Sprintf("Expected\n%s\nto have length %d", format.Object(actual, 1), matcher.Count) } -func (matcher *HaveLenMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *HaveLenMatcher) NegatedFailureMessage(actual any) (message string) { return fmt.Sprintf("Expected\n%s\nnot to have length %d", format.Object(actual, 1), matcher.Count) } diff --git a/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go index 22a1b6730..a240f1a1c 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go @@ -11,7 +11,7 @@ import ( type HaveOccurredMatcher struct { } -func (matcher *HaveOccurredMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *HaveOccurredMatcher) Match(actual any) (success bool, err error) { // is purely nil? if actual == nil { return false, nil @@ -26,10 +26,10 @@ func (matcher *HaveOccurredMatcher) Match(actual interface{}) (success bool, err return !isNil(actual), nil } -func (matcher *HaveOccurredMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *HaveOccurredMatcher) FailureMessage(actual any) (message string) { return fmt.Sprintf("Expected an error to have occurred. Got:\n%s", format.Object(actual, 1)) } -func (matcher *HaveOccurredMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *HaveOccurredMatcher) NegatedFailureMessage(actual any) (message string) { return fmt.Sprintf("Unexpected error:\n%s\n%s", format.Object(actual, 1), "occurred") } diff --git a/vendor/github.com/onsi/gomega/matchers/have_prefix_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_prefix_matcher.go index 1d8e80270..7987d41f7 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_prefix_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_prefix_matcher.go @@ -8,10 +8,10 @@ import ( type HavePrefixMatcher struct { Prefix string - Args []interface{} + Args []any } -func (matcher *HavePrefixMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *HavePrefixMatcher) Match(actual any) (success bool, err error) { actualString, ok := toString(actual) if !ok { return false, fmt.Errorf("HavePrefix matcher requires a string or stringer. Got:\n%s", format.Object(actual, 1)) @@ -27,10 +27,10 @@ func (matcher *HavePrefixMatcher) prefix() string { return matcher.Prefix } -func (matcher *HavePrefixMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *HavePrefixMatcher) FailureMessage(actual any) (message string) { return format.Message(actual, "to have prefix", matcher.prefix()) } -func (matcher *HavePrefixMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *HavePrefixMatcher) NegatedFailureMessage(actual any) (message string) { return format.Message(actual, "not to have prefix", matcher.prefix()) } diff --git a/vendor/github.com/onsi/gomega/matchers/have_suffix_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_suffix_matcher.go index 40a3526eb..2aa4ceacb 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_suffix_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_suffix_matcher.go @@ -8,10 +8,10 @@ import ( type HaveSuffixMatcher struct { Suffix string - Args []interface{} + Args []any } -func (matcher *HaveSuffixMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *HaveSuffixMatcher) Match(actual any) (success bool, err error) { actualString, ok := toString(actual) if !ok { return false, fmt.Errorf("HaveSuffix matcher requires a string or stringer. Got:\n%s", format.Object(actual, 1)) @@ -27,10 +27,10 @@ func (matcher *HaveSuffixMatcher) suffix() string { return matcher.Suffix } -func (matcher *HaveSuffixMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *HaveSuffixMatcher) FailureMessage(actual any) (message string) { return format.Message(actual, "to have suffix", matcher.suffix()) } -func (matcher *HaveSuffixMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *HaveSuffixMatcher) NegatedFailureMessage(actual any) (message string) { return format.Message(actual, "not to have suffix", matcher.suffix()) } diff --git a/vendor/github.com/onsi/gomega/matchers/have_value.go b/vendor/github.com/onsi/gomega/matchers/have_value.go index f67252835..4c39e0db0 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_value.go +++ b/vendor/github.com/onsi/gomega/matchers/have_value.go @@ -12,10 +12,10 @@ const maxIndirections = 31 type HaveValueMatcher struct { Matcher types.GomegaMatcher // the matcher to apply to the "resolved" actual value. - resolvedActual interface{} // the ("resolved") value. + resolvedActual any // the ("resolved") value. } -func (m *HaveValueMatcher) Match(actual interface{}) (bool, error) { +func (m *HaveValueMatcher) Match(actual any) (bool, error) { val := reflect.ValueOf(actual) for allowedIndirs := maxIndirections; allowedIndirs > 0; allowedIndirs-- { // return an error if value isn't valid. Please note that we cannot @@ -45,10 +45,10 @@ func (m *HaveValueMatcher) Match(actual interface{}) (bool, error) { return false, errors.New(format.Message(actual, "too many indirections")) } -func (m *HaveValueMatcher) FailureMessage(_ interface{}) (message string) { +func (m *HaveValueMatcher) FailureMessage(_ any) (message string) { return m.Matcher.FailureMessage(m.resolvedActual) } -func (m *HaveValueMatcher) NegatedFailureMessage(_ interface{}) (message string) { +func (m *HaveValueMatcher) NegatedFailureMessage(_ any) (message string) { return m.Matcher.NegatedFailureMessage(m.resolvedActual) } diff --git a/vendor/github.com/onsi/gomega/matchers/internal/miter/type_support_iter.go b/vendor/github.com/onsi/gomega/matchers/internal/miter/type_support_iter.go new file mode 100644 index 000000000..d8837a4d0 --- /dev/null +++ b/vendor/github.com/onsi/gomega/matchers/internal/miter/type_support_iter.go @@ -0,0 +1,128 @@ +//go:build go1.23 + +package miter + +import ( + "reflect" +) + +// HasIterators always returns false for Go versions before 1.23. +func HasIterators() bool { return true } + +// IsIter returns true if the specified value is a function type that can be +// range-d over, otherwise false. +// +// We don't use reflect's CanSeq and CanSeq2 directly, as these would return +// true also for other value types that are range-able, such as integers, +// slices, et cetera. Here, we aim only at range-able (iterator) functions. +func IsIter(it any) bool { + if it == nil { // on purpose we only test for untyped nil. + return false + } + // reject all non-iterator-func values, even if they're range-able. + t := reflect.TypeOf(it) + if t.Kind() != reflect.Func { + return false + } + return t.CanSeq() || t.CanSeq2() +} + +// IterKVTypes returns the reflection types of an iterator's yield function's K +// and optional V arguments, otherwise nil K and V reflection types. +func IterKVTypes(it any) (k, v reflect.Type) { + if it == nil { + return + } + // reject all non-iterator-func values, even if they're range-able. + t := reflect.TypeOf(it) + if t.Kind() != reflect.Func { + return + } + // get the reflection types for V, and where applicable, K. + switch { + case t.CanSeq(): + v = t. /*iterator fn*/ In(0). /*yield fn*/ In(0) + case t.CanSeq2(): + yieldfn := t. /*iterator fn*/ In(0) + k = yieldfn.In(0) + v = yieldfn.In(1) + } + return +} + +// IsSeq2 returns true if the passed iterator function is compatible with +// iter.Seq2, otherwise false. +// +// IsSeq2 hides the Go 1.23+ specific reflect.Type.CanSeq2 behind a facade which +// is empty for Go versions before 1.23. +func IsSeq2(it any) bool { + if it == nil { + return false + } + t := reflect.TypeOf(it) + return t.Kind() == reflect.Func && t.CanSeq2() +} + +// isNilly returns true if v is either an untyped nil, or is a nil function (not +// necessarily an iterator function). +func isNilly(v any) bool { + if v == nil { + return true + } + rv := reflect.ValueOf(v) + return rv.Kind() == reflect.Func && rv.IsNil() +} + +// IterateV loops over the elements produced by an iterator function, passing +// the elements to the specified yield function individually and stopping only +// when either the iterator function runs out of elements or the yield function +// tell us to stop it. +// +// IterateV works very much like reflect.Value.Seq but hides the Go 1.23+ +// specific parts behind a facade which is empty for Go versions before 1.23, in +// order to simplify code maintenance for matchers when using older Go versions. +func IterateV(it any, yield func(v reflect.Value) bool) { + if isNilly(it) { + return + } + // reject all non-iterator-func values, even if they're range-able. + t := reflect.TypeOf(it) + if t.Kind() != reflect.Func || !t.CanSeq() { + return + } + // Call the specified iterator function, handing it our adaptor to call the + // specified generic reflection yield function. + reflectedYield := reflect.MakeFunc( + t. /*iterator fn*/ In(0), + func(args []reflect.Value) []reflect.Value { + return []reflect.Value{reflect.ValueOf(yield(args[0]))} + }) + reflect.ValueOf(it).Call([]reflect.Value{reflectedYield}) +} + +// IterateKV loops over the key-value elements produced by an iterator function, +// passing the elements to the specified yield function individually and +// stopping only when either the iterator function runs out of elements or the +// yield function tell us to stop it. +// +// IterateKV works very much like reflect.Value.Seq2 but hides the Go 1.23+ +// specific parts behind a facade which is empty for Go versions before 1.23, in +// order to simplify code maintenance for matchers when using older Go versions. +func IterateKV(it any, yield func(k, v reflect.Value) bool) { + if isNilly(it) { + return + } + // reject all non-iterator-func values, even if they're range-able. + t := reflect.TypeOf(it) + if t.Kind() != reflect.Func || !t.CanSeq2() { + return + } + // Call the specified iterator function, handing it our adaptor to call the + // specified generic reflection yield function. + reflectedYield := reflect.MakeFunc( + t. /*iterator fn*/ In(0), + func(args []reflect.Value) []reflect.Value { + return []reflect.Value{reflect.ValueOf(yield(args[0], args[1]))} + }) + reflect.ValueOf(it).Call([]reflect.Value{reflectedYield}) +} diff --git a/vendor/github.com/onsi/gomega/matchers/internal/miter/type_support_noiter.go b/vendor/github.com/onsi/gomega/matchers/internal/miter/type_support_noiter.go new file mode 100644 index 000000000..4b8fcc55b --- /dev/null +++ b/vendor/github.com/onsi/gomega/matchers/internal/miter/type_support_noiter.go @@ -0,0 +1,44 @@ +//go:build !go1.23 + +/* +Gomega matchers + +This package implements the Gomega matchers and does not typically need to be imported. +See the docs for Gomega for documentation on the matchers + +http://onsi.github.io/gomega/ +*/ + +package miter + +import "reflect" + +// HasIterators always returns false for Go versions before 1.23. +func HasIterators() bool { return false } + +// IsIter always returns false for Go versions before 1.23 as there is no +// iterator (function) pattern defined yet; see also: +// https://tip.golang.org/blog/range-functions. +func IsIter(i any) bool { return false } + +// IsSeq2 always returns false for Go versions before 1.23 as there is no +// iterator (function) pattern defined yet; see also: +// https://tip.golang.org/blog/range-functions. +func IsSeq2(it any) bool { return false } + +// IterKVTypes always returns nil reflection types for Go versions before 1.23 +// as there is no iterator (function) pattern defined yet; see also: +// https://tip.golang.org/blog/range-functions. +func IterKVTypes(i any) (k, v reflect.Type) { + return +} + +// IterateV never loops over what has been passed to it as an iterator for Go +// versions before 1.23 as there is no iterator (function) pattern defined yet; +// see also: https://tip.golang.org/blog/range-functions. +func IterateV(it any, yield func(v reflect.Value) bool) {} + +// IterateKV never loops over what has been passed to it as an iterator for Go +// versions before 1.23 as there is no iterator (function) pattern defined yet; +// see also: https://tip.golang.org/blog/range-functions. +func IterateKV(it any, yield func(k, v reflect.Value) bool) {} diff --git a/vendor/github.com/onsi/gomega/matchers/match_error_matcher.go b/vendor/github.com/onsi/gomega/matchers/match_error_matcher.go index c539dd389..f9d313772 100644 --- a/vendor/github.com/onsi/gomega/matchers/match_error_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/match_error_matcher.go @@ -71,14 +71,14 @@ func (matcher *MatchErrorMatcher) Match(actual any) (success bool, err error) { format.Object(expected, 1)) } -func (matcher *MatchErrorMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *MatchErrorMatcher) FailureMessage(actual any) (message string) { if matcher.isFunc { return format.Message(actual, fmt.Sprintf("to match error function %s", matcher.FuncErrDescription[0])) } return format.Message(actual, "to match error", matcher.Expected) } -func (matcher *MatchErrorMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *MatchErrorMatcher) NegatedFailureMessage(actual any) (message string) { if matcher.isFunc { return format.Message(actual, fmt.Sprintf("not to match error function %s", matcher.FuncErrDescription[0])) } diff --git a/vendor/github.com/onsi/gomega/matchers/match_json_matcher.go b/vendor/github.com/onsi/gomega/matchers/match_json_matcher.go index f962f139f..331f289ab 100644 --- a/vendor/github.com/onsi/gomega/matchers/match_json_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/match_json_matcher.go @@ -9,18 +9,18 @@ import ( ) type MatchJSONMatcher struct { - JSONToMatch interface{} - firstFailurePath []interface{} + JSONToMatch any + firstFailurePath []any } -func (matcher *MatchJSONMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *MatchJSONMatcher) Match(actual any) (success bool, err error) { actualString, expectedString, err := matcher.prettyPrint(actual) if err != nil { return false, err } - var aval interface{} - var eval interface{} + var aval any + var eval any // this is guarded by prettyPrint json.Unmarshal([]byte(actualString), &aval) @@ -30,17 +30,17 @@ func (matcher *MatchJSONMatcher) Match(actual interface{}) (success bool, err er return equal, nil } -func (matcher *MatchJSONMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *MatchJSONMatcher) FailureMessage(actual any) (message string) { actualString, expectedString, _ := matcher.prettyPrint(actual) return formattedMessage(format.Message(actualString, "to match JSON of", expectedString), matcher.firstFailurePath) } -func (matcher *MatchJSONMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *MatchJSONMatcher) NegatedFailureMessage(actual any) (message string) { actualString, expectedString, _ := matcher.prettyPrint(actual) return formattedMessage(format.Message(actualString, "not to match JSON of", expectedString), matcher.firstFailurePath) } -func (matcher *MatchJSONMatcher) prettyPrint(actual interface{}) (actualFormatted, expectedFormatted string, err error) { +func (matcher *MatchJSONMatcher) prettyPrint(actual any) (actualFormatted, expectedFormatted string, err error) { actualString, ok := toString(actual) if !ok { return "", "", fmt.Errorf("MatchJSONMatcher matcher requires a string, stringer, or []byte. Got actual:\n%s", format.Object(actual, 1)) diff --git a/vendor/github.com/onsi/gomega/matchers/match_regexp_matcher.go b/vendor/github.com/onsi/gomega/matchers/match_regexp_matcher.go index adac5db6b..779be683e 100644 --- a/vendor/github.com/onsi/gomega/matchers/match_regexp_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/match_regexp_matcher.go @@ -9,10 +9,10 @@ import ( type MatchRegexpMatcher struct { Regexp string - Args []interface{} + Args []any } -func (matcher *MatchRegexpMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *MatchRegexpMatcher) Match(actual any) (success bool, err error) { actualString, ok := toString(actual) if !ok { return false, fmt.Errorf("RegExp matcher requires a string or stringer.\nGot:%s", format.Object(actual, 1)) @@ -26,11 +26,11 @@ func (matcher *MatchRegexpMatcher) Match(actual interface{}) (success bool, err return match, nil } -func (matcher *MatchRegexpMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *MatchRegexpMatcher) FailureMessage(actual any) (message string) { return format.Message(actual, "to match regular expression", matcher.regexp()) } -func (matcher *MatchRegexpMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *MatchRegexpMatcher) NegatedFailureMessage(actual any) (message string) { return format.Message(actual, "not to match regular expression", matcher.regexp()) } diff --git a/vendor/github.com/onsi/gomega/matchers/match_xml_matcher.go b/vendor/github.com/onsi/gomega/matchers/match_xml_matcher.go index 5c815f5af..f7dcaf6fd 100644 --- a/vendor/github.com/onsi/gomega/matchers/match_xml_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/match_xml_matcher.go @@ -15,10 +15,10 @@ import ( ) type MatchXMLMatcher struct { - XMLToMatch interface{} + XMLToMatch any } -func (matcher *MatchXMLMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *MatchXMLMatcher) Match(actual any) (success bool, err error) { actualString, expectedString, err := matcher.formattedPrint(actual) if err != nil { return false, err @@ -37,17 +37,17 @@ func (matcher *MatchXMLMatcher) Match(actual interface{}) (success bool, err err return reflect.DeepEqual(aval, eval), nil } -func (matcher *MatchXMLMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *MatchXMLMatcher) FailureMessage(actual any) (message string) { actualString, expectedString, _ := matcher.formattedPrint(actual) return fmt.Sprintf("Expected\n%s\nto match XML of\n%s", actualString, expectedString) } -func (matcher *MatchXMLMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *MatchXMLMatcher) NegatedFailureMessage(actual any) (message string) { actualString, expectedString, _ := matcher.formattedPrint(actual) return fmt.Sprintf("Expected\n%s\nnot to match XML of\n%s", actualString, expectedString) } -func (matcher *MatchXMLMatcher) formattedPrint(actual interface{}) (actualString, expectedString string, err error) { +func (matcher *MatchXMLMatcher) formattedPrint(actual any) (actualString, expectedString string, err error) { var ok bool actualString, ok = toString(actual) if !ok { diff --git a/vendor/github.com/onsi/gomega/matchers/match_yaml_matcher.go b/vendor/github.com/onsi/gomega/matchers/match_yaml_matcher.go index 2cb6b47db..c3da9bd48 100644 --- a/vendor/github.com/onsi/gomega/matchers/match_yaml_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/match_yaml_matcher.go @@ -5,22 +5,22 @@ import ( "strings" "github.com/onsi/gomega/format" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) type MatchYAMLMatcher struct { - YAMLToMatch interface{} - firstFailurePath []interface{} + YAMLToMatch any + firstFailurePath []any } -func (matcher *MatchYAMLMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *MatchYAMLMatcher) Match(actual any) (success bool, err error) { actualString, expectedString, err := matcher.toStrings(actual) if err != nil { return false, err } - var aval interface{} - var eval interface{} + var aval any + var eval any if err := yaml.Unmarshal([]byte(actualString), &aval); err != nil { return false, fmt.Errorf("Actual '%s' should be valid YAML, but it is not.\nUnderlying error:%s", actualString, err) @@ -34,23 +34,23 @@ func (matcher *MatchYAMLMatcher) Match(actual interface{}) (success bool, err er return equal, nil } -func (matcher *MatchYAMLMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *MatchYAMLMatcher) FailureMessage(actual any) (message string) { actualString, expectedString, _ := matcher.toNormalisedStrings(actual) return formattedMessage(format.Message(actualString, "to match YAML of", expectedString), matcher.firstFailurePath) } -func (matcher *MatchYAMLMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *MatchYAMLMatcher) NegatedFailureMessage(actual any) (message string) { actualString, expectedString, _ := matcher.toNormalisedStrings(actual) return formattedMessage(format.Message(actualString, "not to match YAML of", expectedString), matcher.firstFailurePath) } -func (matcher *MatchYAMLMatcher) toNormalisedStrings(actual interface{}) (actualFormatted, expectedFormatted string, err error) { +func (matcher *MatchYAMLMatcher) toNormalisedStrings(actual any) (actualFormatted, expectedFormatted string, err error) { actualString, expectedString, err := matcher.toStrings(actual) return normalise(actualString), normalise(expectedString), err } func normalise(input string) string { - var val interface{} + var val any err := yaml.Unmarshal([]byte(input), &val) if err != nil { panic(err) // unreachable since Match already calls Unmarshal @@ -62,7 +62,7 @@ func normalise(input string) string { return strings.TrimSpace(string(output)) } -func (matcher *MatchYAMLMatcher) toStrings(actual interface{}) (actualFormatted, expectedFormatted string, err error) { +func (matcher *MatchYAMLMatcher) toStrings(actual any) (actualFormatted, expectedFormatted string, err error) { actualString, ok := toString(actual) if !ok { return "", "", fmt.Errorf("MatchYAMLMatcher matcher requires a string, stringer, or []byte. Got actual:\n%s", format.Object(actual, 1)) diff --git a/vendor/github.com/onsi/gomega/matchers/not.go b/vendor/github.com/onsi/gomega/matchers/not.go index 78b71910d..c598b7899 100644 --- a/vendor/github.com/onsi/gomega/matchers/not.go +++ b/vendor/github.com/onsi/gomega/matchers/not.go @@ -8,7 +8,7 @@ type NotMatcher struct { Matcher types.GomegaMatcher } -func (m *NotMatcher) Match(actual interface{}) (bool, error) { +func (m *NotMatcher) Match(actual any) (bool, error) { success, err := m.Matcher.Match(actual) if err != nil { return false, err @@ -16,14 +16,14 @@ func (m *NotMatcher) Match(actual interface{}) (bool, error) { return !success, nil } -func (m *NotMatcher) FailureMessage(actual interface{}) (message string) { +func (m *NotMatcher) FailureMessage(actual any) (message string) { return m.Matcher.NegatedFailureMessage(actual) // works beautifully } -func (m *NotMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (m *NotMatcher) NegatedFailureMessage(actual any) (message string) { return m.Matcher.FailureMessage(actual) // works beautifully } -func (m *NotMatcher) MatchMayChangeInTheFuture(actual interface{}) bool { +func (m *NotMatcher) MatchMayChangeInTheFuture(actual any) bool { return types.MatchMayChangeInTheFuture(m.Matcher, actual) // just return m.Matcher's value } diff --git a/vendor/github.com/onsi/gomega/matchers/or.go b/vendor/github.com/onsi/gomega/matchers/or.go index 841ae26ab..6578404b0 100644 --- a/vendor/github.com/onsi/gomega/matchers/or.go +++ b/vendor/github.com/onsi/gomega/matchers/or.go @@ -14,7 +14,7 @@ type OrMatcher struct { firstSuccessfulMatcher types.GomegaMatcher } -func (m *OrMatcher) Match(actual interface{}) (success bool, err error) { +func (m *OrMatcher) Match(actual any) (success bool, err error) { m.firstSuccessfulMatcher = nil for _, matcher := range m.Matchers { success, err := matcher.Match(actual) @@ -29,16 +29,16 @@ func (m *OrMatcher) Match(actual interface{}) (success bool, err error) { return false, nil } -func (m *OrMatcher) FailureMessage(actual interface{}) (message string) { +func (m *OrMatcher) FailureMessage(actual any) (message string) { // not the most beautiful list of matchers, but not bad either... return format.Message(actual, fmt.Sprintf("To satisfy at least one of these matchers: %s", m.Matchers)) } -func (m *OrMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (m *OrMatcher) NegatedFailureMessage(actual any) (message string) { return m.firstSuccessfulMatcher.NegatedFailureMessage(actual) } -func (m *OrMatcher) MatchMayChangeInTheFuture(actual interface{}) bool { +func (m *OrMatcher) MatchMayChangeInTheFuture(actual any) bool { /* Example with 3 matchers: A, B, C diff --git a/vendor/github.com/onsi/gomega/matchers/panic_matcher.go b/vendor/github.com/onsi/gomega/matchers/panic_matcher.go index adc8cee63..8be5a7ccf 100644 --- a/vendor/github.com/onsi/gomega/matchers/panic_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/panic_matcher.go @@ -8,11 +8,11 @@ import ( ) type PanicMatcher struct { - Expected interface{} - object interface{} + Expected any + object any } -func (matcher *PanicMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *PanicMatcher) Match(actual any) (success bool, err error) { if actual == nil { return false, fmt.Errorf("PanicMatcher expects a non-nil actual.") } @@ -52,7 +52,7 @@ func (matcher *PanicMatcher) Match(actual interface{}) (success bool, err error) return } -func (matcher *PanicMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *PanicMatcher) FailureMessage(actual any) (message string) { if matcher.Expected == nil { // We wanted any panic to occur, but none did. return format.Message(actual, "to panic") @@ -91,7 +91,7 @@ func (matcher *PanicMatcher) FailureMessage(actual interface{}) (message string) } } -func (matcher *PanicMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *PanicMatcher) NegatedFailureMessage(actual any) (message string) { if matcher.Expected == nil { // We didn't want any panic to occur, but one did. return format.Message(actual, fmt.Sprintf("not to panic, but panicked with\n%s", format.Object(matcher.object, 1))) diff --git a/vendor/github.com/onsi/gomega/matchers/receive_matcher.go b/vendor/github.com/onsi/gomega/matchers/receive_matcher.go index 1936a2ba5..1d9f61d63 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,12 +11,12 @@ import ( ) type ReceiveMatcher struct { - Arg interface{} + Args []any receivedValue reflect.Value channelClosed bool } -func (matcher *ReceiveMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *ReceiveMatcher) Match(actual any) (success bool, err error) { if !isChan(actual) { return false, fmt.Errorf("ReceiveMatcher expects a channel. Got:\n%s", format.Object(actual, 1)) } @@ -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 any + + // 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)) } } @@ -87,8 +115,12 @@ func (matcher *ReceiveMatcher) Match(actual interface{}) (success bool, err erro return false, nil } -func (matcher *ReceiveMatcher) FailureMessage(actual interface{}) (message string) { - subMatcher, hasSubMatcher := (matcher.Arg).(omegaMatcher) +func (matcher *ReceiveMatcher) FailureMessage(actual any) (message string) { + var matcherArg any + if len(matcher.Args) > 0 { + matcherArg = matcher.Args[len(matcher.Args)-1] + } + subMatcher, hasSubMatcher := (matcherArg).(omegaMatcher) closedAddendum := "" if matcher.channelClosed { @@ -104,8 +136,12 @@ func (matcher *ReceiveMatcher) FailureMessage(actual interface{}) (message strin return format.Message(actual, "to receive something."+closedAddendum) } -func (matcher *ReceiveMatcher) NegatedFailureMessage(actual interface{}) (message string) { - subMatcher, hasSubMatcher := (matcher.Arg).(omegaMatcher) +func (matcher *ReceiveMatcher) NegatedFailureMessage(actual any) (message string) { + var matcherArg any + if len(matcher.Args) > 0 { + matcherArg = matcher.Args[len(matcher.Args)-1] + } + subMatcher, hasSubMatcher := (matcherArg).(omegaMatcher) closedAddendum := "" if matcher.channelClosed { @@ -121,7 +157,7 @@ func (matcher *ReceiveMatcher) NegatedFailureMessage(actual interface{}) (messag return format.Message(actual, "not to receive anything."+closedAddendum) } -func (matcher *ReceiveMatcher) MatchMayChangeInTheFuture(actual interface{}) bool { +func (matcher *ReceiveMatcher) MatchMayChangeInTheFuture(actual any) bool { if !isChan(actual) { return false } diff --git a/vendor/github.com/onsi/gomega/matchers/satisfy_matcher.go b/vendor/github.com/onsi/gomega/matchers/satisfy_matcher.go index ec68fe8b6..2adc4825a 100644 --- a/vendor/github.com/onsi/gomega/matchers/satisfy_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/satisfy_matcher.go @@ -8,13 +8,13 @@ import ( ) type SatisfyMatcher struct { - Predicate interface{} + Predicate any // cached type predicateArgType reflect.Type } -func NewSatisfyMatcher(predicate interface{}) *SatisfyMatcher { +func NewSatisfyMatcher(predicate any) *SatisfyMatcher { if predicate == nil { panic("predicate cannot be nil") } @@ -35,7 +35,7 @@ func NewSatisfyMatcher(predicate interface{}) *SatisfyMatcher { } } -func (m *SatisfyMatcher) Match(actual interface{}) (success bool, err error) { +func (m *SatisfyMatcher) Match(actual any) (success bool, err error) { // prepare a parameter to pass to the predicate var param reflect.Value if actual != nil && reflect.TypeOf(actual).AssignableTo(m.predicateArgType) { @@ -57,10 +57,10 @@ func (m *SatisfyMatcher) Match(actual interface{}) (success bool, err error) { return result[0].Bool(), nil } -func (m *SatisfyMatcher) FailureMessage(actual interface{}) (message string) { +func (m *SatisfyMatcher) FailureMessage(actual any) (message string) { return format.Message(actual, "to satisfy predicate", m.Predicate) } -func (m *SatisfyMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (m *SatisfyMatcher) NegatedFailureMessage(actual any) (message string) { return format.Message(actual, "to not satisfy predicate", m.Predicate) } diff --git a/vendor/github.com/onsi/gomega/matchers/semi_structured_data_support.go b/vendor/github.com/onsi/gomega/matchers/semi_structured_data_support.go index 1369c1e87..30dd58f4a 100644 --- a/vendor/github.com/onsi/gomega/matchers/semi_structured_data_support.go +++ b/vendor/github.com/onsi/gomega/matchers/semi_structured_data_support.go @@ -8,7 +8,7 @@ import ( "strings" ) -func formattedMessage(comparisonMessage string, failurePath []interface{}) string { +func formattedMessage(comparisonMessage string, failurePath []any) string { var diffMessage string if len(failurePath) == 0 { diffMessage = "" @@ -18,7 +18,7 @@ func formattedMessage(comparisonMessage string, failurePath []interface{}) strin return fmt.Sprintf("%s%s", comparisonMessage, diffMessage) } -func formattedFailurePath(failurePath []interface{}) string { +func formattedFailurePath(failurePath []any) string { formattedPaths := []string{} for i := len(failurePath) - 1; i >= 0; i-- { switch p := failurePath[i].(type) { @@ -34,33 +34,33 @@ func formattedFailurePath(failurePath []interface{}) string { return strings.Join(formattedPaths, "") } -func deepEqual(a interface{}, b interface{}) (bool, []interface{}) { - var errorPath []interface{} +func deepEqual(a any, b any) (bool, []any) { + var errorPath []any if reflect.TypeOf(a) != reflect.TypeOf(b) { return false, errorPath } switch a.(type) { - case []interface{}: - if len(a.([]interface{})) != len(b.([]interface{})) { + case []any: + if len(a.([]any)) != len(b.([]any)) { return false, errorPath } - for i, v := range a.([]interface{}) { - elementEqual, keyPath := deepEqual(v, b.([]interface{})[i]) + for i, v := range a.([]any) { + elementEqual, keyPath := deepEqual(v, b.([]any)[i]) if !elementEqual { return false, append(keyPath, i) } } return true, errorPath - case map[interface{}]interface{}: - if len(a.(map[interface{}]interface{})) != len(b.(map[interface{}]interface{})) { + case map[any]any: + if len(a.(map[any]any)) != len(b.(map[any]any)) { return false, errorPath } - for k, v1 := range a.(map[interface{}]interface{}) { - v2, ok := b.(map[interface{}]interface{})[k] + for k, v1 := range a.(map[any]any) { + v2, ok := b.(map[any]any)[k] if !ok { return false, errorPath } @@ -71,13 +71,13 @@ func deepEqual(a interface{}, b interface{}) (bool, []interface{}) { } return true, errorPath - case map[string]interface{}: - if len(a.(map[string]interface{})) != len(b.(map[string]interface{})) { + case map[string]any: + if len(a.(map[string]any)) != len(b.(map[string]any)) { return false, errorPath } - for k, v1 := range a.(map[string]interface{}) { - v2, ok := b.(map[string]interface{})[k] + for k, v1 := range a.(map[string]any) { + v2, ok := b.(map[string]any)[k] if !ok { return false, errorPath } diff --git a/vendor/github.com/onsi/gomega/matchers/succeed_matcher.go b/vendor/github.com/onsi/gomega/matchers/succeed_matcher.go index 327350f7b..f0b2c4aa6 100644 --- a/vendor/github.com/onsi/gomega/matchers/succeed_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/succeed_matcher.go @@ -14,7 +14,7 @@ type formattedGomegaError interface { type SucceedMatcher struct { } -func (matcher *SucceedMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *SucceedMatcher) Match(actual any) (success bool, err error) { // is purely nil? if actual == nil { return true, nil @@ -29,7 +29,7 @@ func (matcher *SucceedMatcher) Match(actual interface{}) (success bool, err erro return isNil(actual), nil } -func (matcher *SucceedMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *SucceedMatcher) FailureMessage(actual any) (message string) { var fgErr formattedGomegaError if errors.As(actual.(error), &fgErr) { return fgErr.FormattedGomegaError() @@ -37,6 +37,6 @@ func (matcher *SucceedMatcher) FailureMessage(actual interface{}) (message strin return fmt.Sprintf("Expected success, but got an error:\n%s", format.Object(actual, 1)) } -func (matcher *SucceedMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *SucceedMatcher) NegatedFailureMessage(actual any) (message string) { return "Expected failure, but got no error." } diff --git a/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraph.go b/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraph.go index 830e30827..0d78779d4 100644 --- a/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraph.go +++ b/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraph.go @@ -11,7 +11,7 @@ type BipartiteGraph struct { Edges EdgeSet } -func NewBipartiteGraph(leftValues, rightValues []interface{}, neighbours func(interface{}, interface{}) (bool, error)) (*BipartiteGraph, error) { +func NewBipartiteGraph(leftValues, rightValues []any, neighbours func(any, any) (bool, error)) (*BipartiteGraph, error) { left := NodeOrderedSet{} for i, v := range leftValues { left = append(left, Node{ID: i, Value: v}) @@ -41,7 +41,7 @@ func NewBipartiteGraph(leftValues, rightValues []interface{}, neighbours func(in // FreeLeftRight returns left node values and right node values // of the BipartiteGraph's nodes which are not part of the given edges. -func (bg *BipartiteGraph) FreeLeftRight(edges EdgeSet) (leftValues, rightValues []interface{}) { +func (bg *BipartiteGraph) FreeLeftRight(edges EdgeSet) (leftValues, rightValues []any) { for _, node := range bg.Left { if edges.Free(node) { leftValues = append(leftValues, node.Value) 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/matchers/support/goraph/node/node.go b/vendor/github.com/onsi/gomega/matchers/support/goraph/node/node.go index cd597a2f2..66d3578d5 100644 --- a/vendor/github.com/onsi/gomega/matchers/support/goraph/node/node.go +++ b/vendor/github.com/onsi/gomega/matchers/support/goraph/node/node.go @@ -2,7 +2,7 @@ package node type Node struct { ID int - Value interface{} + Value any } type NodeOrderedSet []Node diff --git a/vendor/github.com/onsi/gomega/matchers/type_support.go b/vendor/github.com/onsi/gomega/matchers/type_support.go index dced2419e..d020dedc3 100644 --- a/vendor/github.com/onsi/gomega/matchers/type_support.go +++ b/vendor/github.com/onsi/gomega/matchers/type_support.go @@ -15,19 +15,21 @@ import ( "encoding/json" "fmt" "reflect" + + "github.com/onsi/gomega/matchers/internal/miter" ) type omegaMatcher interface { - Match(actual interface{}) (success bool, err error) - FailureMessage(actual interface{}) (message string) - NegatedFailureMessage(actual interface{}) (message string) + Match(actual any) (success bool, err error) + FailureMessage(actual any) (message string) + NegatedFailureMessage(actual any) (message string) } -func isBool(a interface{}) bool { +func isBool(a any) bool { return reflect.TypeOf(a).Kind() == reflect.Bool } -func isNumber(a interface{}) bool { +func isNumber(a any) bool { if a == nil { return false } @@ -35,22 +37,22 @@ func isNumber(a interface{}) bool { return reflect.Int <= kind && kind <= reflect.Float64 } -func isInteger(a interface{}) bool { +func isInteger(a any) bool { kind := reflect.TypeOf(a).Kind() return reflect.Int <= kind && kind <= reflect.Int64 } -func isUnsignedInteger(a interface{}) bool { +func isUnsignedInteger(a any) bool { kind := reflect.TypeOf(a).Kind() return reflect.Uint <= kind && kind <= reflect.Uint64 } -func isFloat(a interface{}) bool { +func isFloat(a any) bool { kind := reflect.TypeOf(a).Kind() return reflect.Float32 <= kind && kind <= reflect.Float64 } -func toInteger(a interface{}) int64 { +func toInteger(a any) int64 { if isInteger(a) { return reflect.ValueOf(a).Int() } else if isUnsignedInteger(a) { @@ -61,7 +63,7 @@ func toInteger(a interface{}) int64 { panic(fmt.Sprintf("Expected a number! Got <%T> %#v", a, a)) } -func toUnsignedInteger(a interface{}) uint64 { +func toUnsignedInteger(a any) uint64 { if isInteger(a) { return uint64(reflect.ValueOf(a).Int()) } else if isUnsignedInteger(a) { @@ -72,7 +74,7 @@ func toUnsignedInteger(a interface{}) uint64 { panic(fmt.Sprintf("Expected a number! Got <%T> %#v", a, a)) } -func toFloat(a interface{}) float64 { +func toFloat(a any) float64 { if isInteger(a) { return float64(reflect.ValueOf(a).Int()) } else if isUnsignedInteger(a) { @@ -83,26 +85,26 @@ func toFloat(a interface{}) float64 { panic(fmt.Sprintf("Expected a number! Got <%T> %#v", a, a)) } -func isError(a interface{}) bool { +func isError(a any) bool { _, ok := a.(error) return ok } -func isChan(a interface{}) bool { +func isChan(a any) bool { if isNil(a) { return false } return reflect.TypeOf(a).Kind() == reflect.Chan } -func isMap(a interface{}) bool { +func isMap(a any) bool { if a == nil { return false } return reflect.TypeOf(a).Kind() == reflect.Map } -func isArrayOrSlice(a interface{}) bool { +func isArrayOrSlice(a any) bool { if a == nil { return false } @@ -114,14 +116,14 @@ func isArrayOrSlice(a interface{}) bool { } } -func isString(a interface{}) bool { +func isString(a any) bool { if a == nil { return false } return reflect.TypeOf(a).Kind() == reflect.String } -func toString(a interface{}) (string, bool) { +func toString(a any) (string, bool) { aString, isString := a.(string) if isString { return aString, true @@ -145,18 +147,29 @@ func toString(a interface{}) (string, bool) { return "", false } -func lengthOf(a interface{}) (int, bool) { +func lengthOf(a any) (int, bool) { if a == nil { return 0, false } switch reflect.TypeOf(a).Kind() { case reflect.Map, reflect.Array, reflect.String, reflect.Chan, reflect.Slice: return reflect.ValueOf(a).Len(), true + case reflect.Func: + if !miter.IsIter(a) { + return 0, false + } + var l int + if miter.IsSeq2(a) { + miter.IterateKV(a, func(k, v reflect.Value) bool { l++; return true }) + } else { + miter.IterateV(a, func(v reflect.Value) bool { l++; return true }) + } + return l, true default: return 0, false } } -func capOf(a interface{}) (int, bool) { +func capOf(a any) (int, bool) { if a == nil { return 0, false } @@ -168,7 +181,7 @@ func capOf(a interface{}) (int, bool) { } } -func isNil(a interface{}) bool { +func isNil(a any) bool { if a == nil { return true } diff --git a/vendor/github.com/onsi/gomega/matchers/with_transform.go b/vendor/github.com/onsi/gomega/matchers/with_transform.go index 6f743b1b3..6231c3b47 100644 --- a/vendor/github.com/onsi/gomega/matchers/with_transform.go +++ b/vendor/github.com/onsi/gomega/matchers/with_transform.go @@ -9,20 +9,20 @@ import ( type WithTransformMatcher struct { // input - Transform interface{} // must be a function of one parameter that returns one value and an optional error + Transform any // must be a function of one parameter that returns one value and an optional error Matcher types.GomegaMatcher // cached value transformArgType reflect.Type // state - transformedValue interface{} + transformedValue any } // reflect.Type for error var errorT = reflect.TypeOf((*error)(nil)).Elem() -func NewWithTransformMatcher(transform interface{}, matcher types.GomegaMatcher) *WithTransformMatcher { +func NewWithTransformMatcher(transform any, matcher types.GomegaMatcher) *WithTransformMatcher { if transform == nil { panic("transform function cannot be nil") } @@ -43,7 +43,7 @@ func NewWithTransformMatcher(transform interface{}, matcher types.GomegaMatcher) } } -func (m *WithTransformMatcher) Match(actual interface{}) (bool, error) { +func (m *WithTransformMatcher) Match(actual any) (bool, error) { // prepare a parameter to pass to the Transform function var param reflect.Value if actual != nil && reflect.TypeOf(actual).AssignableTo(m.transformArgType) { @@ -72,15 +72,15 @@ func (m *WithTransformMatcher) Match(actual interface{}) (bool, error) { return m.Matcher.Match(m.transformedValue) } -func (m *WithTransformMatcher) FailureMessage(_ interface{}) (message string) { +func (m *WithTransformMatcher) FailureMessage(_ any) (message string) { return m.Matcher.FailureMessage(m.transformedValue) } -func (m *WithTransformMatcher) NegatedFailureMessage(_ interface{}) (message string) { +func (m *WithTransformMatcher) NegatedFailureMessage(_ any) (message string) { return m.Matcher.NegatedFailureMessage(m.transformedValue) } -func (m *WithTransformMatcher) MatchMayChangeInTheFuture(_ interface{}) bool { +func (m *WithTransformMatcher) MatchMayChangeInTheFuture(_ any) bool { // TODO: Maybe this should always just return true? (Only an issue for non-deterministic transformers.) // // Querying the next matcher is fine if the transformer always will return the same value. diff --git a/vendor/github.com/onsi/gomega/types/types.go b/vendor/github.com/onsi/gomega/types/types.go index 7c7adb941..685a46f37 100644 --- a/vendor/github.com/onsi/gomega/types/types.go +++ b/vendor/github.com/onsi/gomega/types/types.go @@ -10,34 +10,36 @@ type GomegaFailHandler func(message string, callerSkip ...int) // A simple *testing.T interface wrapper type GomegaTestingT interface { Helper() - Fatalf(format string, args ...interface{}) + Fatalf(format string, args ...any) } -// Gomega represents an object that can perform synchronous and assynchronous assertions with Gomega matchers +// Gomega represents an object that can perform synchronous and asynchronous assertions with Gomega matchers type Gomega interface { - Ω(actual interface{}, extra ...interface{}) Assertion - Expect(actual interface{}, extra ...interface{}) Assertion - ExpectWithOffset(offset int, actual interface{}, extra ...interface{}) Assertion + Ω(actual any, extra ...any) Assertion + Expect(actual any, extra ...any) Assertion + ExpectWithOffset(offset int, actual any, extra ...any) Assertion - Eventually(actualOrCtx interface{}, args ...interface{}) AsyncAssertion - EventuallyWithOffset(offset int, actualOrCtx interface{}, args ...interface{}) AsyncAssertion + Eventually(actualOrCtx any, args ...any) AsyncAssertion + EventuallyWithOffset(offset int, actualOrCtx any, args ...any) AsyncAssertion - Consistently(actualOrCtx interface{}, args ...interface{}) AsyncAssertion - ConsistentlyWithOffset(offset int, actualOrCtx interface{}, args ...interface{}) AsyncAssertion + Consistently(actualOrCtx any, args ...any) AsyncAssertion + ConsistentlyWithOffset(offset int, actualOrCtx any, args ...any) AsyncAssertion SetDefaultEventuallyTimeout(time.Duration) SetDefaultEventuallyPollingInterval(time.Duration) SetDefaultConsistentlyDuration(time.Duration) SetDefaultConsistentlyPollingInterval(time.Duration) + EnforceDefaultTimeoutsWhenUsingContexts() + DisableDefaultTimeoutsWhenUsingContext() } // All Gomega matchers must implement the GomegaMatcher interface // // For details on writing custom matchers, check out: http://onsi.github.io/gomega/#adding-your-own-matchers type GomegaMatcher interface { - Match(actual interface{}) (success bool, err error) - FailureMessage(actual interface{}) (message string) - NegatedFailureMessage(actual interface{}) (message string) + Match(actual any) (success bool, err error) + FailureMessage(actual any) (message string) + NegatedFailureMessage(actual any) (message string) } /* @@ -50,10 +52,10 @@ For example, a process' exit code can never change. So, gexec's Exit matcher re for `MatchMayChangeInTheFuture` until the process exits, at which point it returns `false` forevermore. */ type OracleMatcher interface { - MatchMayChangeInTheFuture(actual interface{}) bool + MatchMayChangeInTheFuture(actual any) bool } -func MatchMayChangeInTheFuture(matcher GomegaMatcher, value interface{}) bool { +func MatchMayChangeInTheFuture(matcher GomegaMatcher, value any) bool { oracleMatcher, ok := matcher.(OracleMatcher) if !ok { return true @@ -65,8 +67,13 @@ func MatchMayChangeInTheFuture(matcher GomegaMatcher, value interface{}) bool { // AsyncAssertions are returned by Eventually and Consistently and enable matchers to be polled repeatedly to ensure // they are eventually satisfied type AsyncAssertion interface { - Should(matcher GomegaMatcher, optionalDescription ...interface{}) bool - ShouldNot(matcher GomegaMatcher, optionalDescription ...interface{}) bool + Should(matcher GomegaMatcher, optionalDescription ...any) bool + ShouldNot(matcher GomegaMatcher, optionalDescription ...any) bool + + // equivalent to above + To(matcher GomegaMatcher, optionalDescription ...any) bool + ToNot(matcher GomegaMatcher, optionalDescription ...any) bool + NotTo(matcher GomegaMatcher, optionalDescription ...any) bool WithOffset(offset int) AsyncAssertion WithTimeout(interval time.Duration) AsyncAssertion @@ -74,18 +81,18 @@ type AsyncAssertion interface { Within(timeout time.Duration) AsyncAssertion ProbeEvery(interval time.Duration) AsyncAssertion WithContext(ctx context.Context) AsyncAssertion - WithArguments(argsToForward ...interface{}) AsyncAssertion + WithArguments(argsToForward ...any) AsyncAssertion MustPassRepeatedly(count int) AsyncAssertion } // Assertions are returned by Ω and Expect and enable assertions against Gomega matchers type Assertion interface { - Should(matcher GomegaMatcher, optionalDescription ...interface{}) bool - ShouldNot(matcher GomegaMatcher, optionalDescription ...interface{}) bool + Should(matcher GomegaMatcher, optionalDescription ...any) bool + ShouldNot(matcher GomegaMatcher, optionalDescription ...any) bool - To(matcher GomegaMatcher, optionalDescription ...interface{}) bool - ToNot(matcher GomegaMatcher, optionalDescription ...interface{}) bool - NotTo(matcher GomegaMatcher, optionalDescription ...interface{}) bool + To(matcher GomegaMatcher, optionalDescription ...any) bool + ToNot(matcher GomegaMatcher, optionalDescription ...any) bool + NotTo(matcher GomegaMatcher, optionalDescription ...any) bool WithOffset(offset int) Assertion diff --git a/vendor/github.com/spf13/cobra/.golangci.yml b/vendor/github.com/spf13/cobra/.golangci.yml index 0d6e61793..2c8f4808c 100644 --- a/vendor/github.com/spf13/cobra/.golangci.yml +++ b/vendor/github.com/spf13/cobra/.golangci.yml @@ -1,3 +1,17 @@ +# Copyright 2013-2023 The Cobra 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. + run: deadline: 5m @@ -5,44 +19,39 @@ linters: disable-all: true enable: #- bodyclose - - deadcode + # - deadcode ! deprecated since v1.49.0; replaced by 'unused' #- depguard #- dogsled #- dupl - 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 - - structcheck - #- stylecheck + - staticcheck + #- structcheck ! deprecated since v1.49.0; replaced by 'unused' + - stylecheck #- typecheck - unconvert #- unparam - #- unused - - varcheck + - unused + # - varcheck ! deprecated since v1.49.0; replaced by 'unused' #- whitespace fast: false diff --git a/vendor/github.com/spf13/cobra/Makefile b/vendor/github.com/spf13/cobra/Makefile index 443ef1a98..0da8d7aa0 100644 --- a/vendor/github.com/spf13/cobra/Makefile +++ b/vendor/github.com/spf13/cobra/Makefile @@ -5,10 +5,6 @@ ifeq (, $(shell which golangci-lint)) $(warning "could not find golangci-lint in $(PATH), run: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh") endif -ifeq (, $(shell which richgo)) -$(warning "could not find richgo in $(PATH), run: go get github.com/kyoh86/richgo") -endif - .PHONY: fmt lint test install_deps clean default: all @@ -25,6 +21,10 @@ lint: test: install_deps $(info ******************** running tests ********************) + go test -v ./... + +richtest: install_deps + $(info ******************** running tests with kyoh86/richgo ********************) richgo test -v ./... install_deps: diff --git a/vendor/github.com/spf13/cobra/README.md b/vendor/github.com/spf13/cobra/README.md index 2bf152082..6444f4b7f 100644 --- a/vendor/github.com/spf13/cobra/README.md +++ b/vendor/github.com/spf13/cobra/README.md @@ -1,12 +1,12 @@ -![cobra logo](https://cloud.githubusercontent.com/assets/173412/10886352/ad566232-814f-11e5-9cd0-aa101788c117.png) +![cobra logo](assets/CobraMain.png) Cobra is a library for creating powerful modern CLI applications. Cobra is used in many Go projects such as [Kubernetes](https://kubernetes.io/), -[Hugo](https://gohugo.io), and [Github CLI](https://github.com/cli/cli) to -name a few. [This list](./projects_using_cobra.md) contains a more extensive list of projects using Cobra. +[Hugo](https://gohugo.io), and [GitHub CLI](https://github.com/cli/cli) to +name a few. [This list](site/content/projects_using_cobra.md) contains a more extensive list of projects using Cobra. -[![](https://img.shields.io/github/workflow/status/spf13/cobra/Test?longCache=tru&label=Test&logo=github%20actions&logoColor=fff)](https://github.com/spf13/cobra/actions?query=workflow%3ATest) +[![](https://img.shields.io/github/actions/workflow/status/spf13/cobra/test.yml?branch=main&longCache=true&label=Test&logo=github%20actions&logoColor=fff)](https://github.com/spf13/cobra/actions?query=workflow%3ATest) [![Go Reference](https://pkg.go.dev/badge/github.com/spf13/cobra.svg)](https://pkg.go.dev/github.com/spf13/cobra) [![Go Report Card](https://goreportcard.com/badge/github.com/spf13/cobra)](https://goreportcard.com/report/github.com/spf13/cobra) [![Slack](https://img.shields.io/badge/Slack-cobra-brightgreen)](https://gophers.slack.com/archives/CD3LP1199) @@ -23,6 +23,7 @@ Cobra provides: * Global, local and cascading flags * Intelligent suggestions (`app srver`... did you mean `app server`?) * Automatic help generation for commands and flags +* Grouping help for subcommands * Automatic help flag recognition of `-h`, `--help`, etc. * Automatically generated shell autocomplete for your application (bash, zsh, fish, powershell) * Automatically generated man pages for your application @@ -40,9 +41,9 @@ The best applications read like sentences when used, and as a result, users intuitively know how to interact with them. The pattern to follow is -`APPNAME VERB NOUN --ADJECTIVE.` +`APPNAME VERB NOUN --ADJECTIVE` or -`APPNAME COMMAND ARG --FLAG` +`APPNAME COMMAND ARG --FLAG`. A few good real world examples may better illustrate this point. @@ -79,7 +80,7 @@ which maintains the same interface while adding POSIX compliance. # Installing Using Cobra is easy. First, use `go get` to install the latest version -of the library. +of the library. ``` go get -u github.com/spf13/cobra@latest @@ -104,8 +105,8 @@ go install github.com/spf13/cobra-cli@latest For complete details on using the Cobra-CLI generator, please read [The Cobra Generator README](https://github.com/spf13/cobra-cli/blob/main/README.md) -For complete details on using the Cobra library, please read the [The Cobra User Guide](user_guide.md). +For complete details on using the Cobra library, please read the [The Cobra User Guide](site/content/user_guide.md). # License -Cobra is released under the Apache 2.0 license. See [LICENSE.txt](https://github.com/spf13/cobra/blob/master/LICENSE.txt) +Cobra is released under the Apache 2.0 license. See [LICENSE.txt](LICENSE.txt) diff --git a/vendor/github.com/spf13/cobra/active_help.go b/vendor/github.com/spf13/cobra/active_help.go index 0c631913d..25c30e3cc 100644 --- a/vendor/github.com/spf13/cobra/active_help.go +++ b/vendor/github.com/spf13/cobra/active_help.go @@ -1,17 +1,30 @@ +// Copyright 2013-2023 The Cobra 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 cobra import ( "fmt" "os" - "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" ) @@ -28,7 +41,7 @@ func AppendActiveHelp(compArray []string, activeHelpStr string) []string { // GetActiveHelpConfig returns the value of the ActiveHelp environment variable // _ACTIVE_HELP where is the name of the root command in upper -// case, with all - replaced by _. +// case, with all non-ASCII-alphanumeric characters replaced by `_`. // It will always return "0" if the global environment variable COBRA_ACTIVE_HELP // is set to "0". func GetActiveHelpConfig(cmd *Command) string { @@ -41,9 +54,7 @@ func GetActiveHelpConfig(cmd *Command) string { // activeHelpEnvVar returns the name of the program-specific ActiveHelp environment // variable. It has the format _ACTIVE_HELP where is the name of the -// root command in upper case, with all - replaced by _. +// 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)) - return strings.ReplaceAll(activeHelpEnvVar, "-", "_") + return configEnvVar(name, activeHelpEnvVarSuffix) } diff --git a/vendor/github.com/spf13/cobra/active_help.md b/vendor/github.com/spf13/cobra/active_help.md deleted file mode 100644 index 5e7f59af3..000000000 --- a/vendor/github.com/spf13/cobra/active_help.md +++ /dev/null @@ -1,157 +0,0 @@ -# Active Help - -Active Help is a framework provided by Cobra which allows a program to define messages (hints, warnings, etc) that will be printed during program usage. It aims to make it easier for your users to learn how to use your program. If configured by the program, Active Help is printed when the user triggers shell completion. - -For example, -``` -bash-5.1$ helm repo add [tab] -You must choose a name for the repo you are adding. - -bash-5.1$ bin/helm package [tab] -Please specify the path to the chart to package - -bash-5.1$ bin/helm package [tab][tab] -bin/ internal/ scripts/ pkg/ testdata/ -``` - -**Hint**: A good place to use Active Help messages is when the normal completion system does not provide any suggestions. In such cases, Active Help nicely supplements the normal shell completions to guide the user in knowing what is expected by the program. -## Supported shells - -Active Help is currently only supported for the following shells: -- Bash (using [bash completion V2](shell_completions.md#bash-completion-v2) only). Note that bash 4.4 or higher is required for the prompt to appear when an Active Help message is printed. -- Zsh - -## Adding Active Help messages - -As Active Help uses the shell completion system, the implementation of Active Help messages is done by enhancing custom dynamic completions. If you are not familiar with dynamic completions, please refer to [Shell Completions](shell_completions.md). - -Adding Active Help is done through the use of the `cobra.AppendActiveHelp(...)` function, where the program repeatedly adds Active Help messages to the list of completions. Keep reading for details. - -### Active Help for nouns - -Adding Active Help when completing a noun is done within the `ValidArgsFunction(...)` of a command. Please notice the use of `cobra.AppendActiveHelp(...)` in the following example: - -```go -cmd := &cobra.Command{ - Use: "add [NAME] [URL]", - Short: "add a chart repository", - Args: require.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - return addRepo(args) - }, - ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - var comps []string - if len(args) == 0 { - comps = cobra.AppendActiveHelp(comps, "You must choose a name for the repo you are adding") - } else if len(args) == 1 { - comps = cobra.AppendActiveHelp(comps, "You must specify the URL for the repo you are adding") - } else { - comps = cobra.AppendActiveHelp(comps, "This command does not take any more arguments") - } - return comps, cobra.ShellCompDirectiveNoFileComp - }, -} -``` -The example above defines the completions (none, in this specific example) as well as the Active Help messages for the `helm repo add` command. It yields the following behavior: -``` -bash-5.1$ helm repo add [tab] -You must choose a name for the repo you are adding - -bash-5.1$ helm repo add grafana [tab] -You must specify the URL for the repo you are adding - -bash-5.1$ helm repo add grafana https://grafana.github.io/helm-charts [tab] -This command does not take any more arguments -``` -**Hint**: As can be seen in the above example, a good place to use Active Help messages is when the normal completion system does not provide any suggestions. In such cases, Active Help nicely supplements the normal shell completions. - -### Active Help for flags - -Providing Active Help for flags is done in the same fashion as for nouns, but using the completion function registered for the flag. For example: -```go -_ = cmd.RegisterFlagCompletionFunc("version", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - if len(args) != 2 { - return cobra.AppendActiveHelp(nil, "You must first specify the chart to install before the --version flag can be completed"), cobra.ShellCompDirectiveNoFileComp - } - return compVersionFlag(args[1], toComplete) - }) -``` -The example above prints an Active Help message when not enough information was given by the user to complete the `--version` flag. -``` -bash-5.1$ bin/helm install myrelease --version 2.0.[tab] -You must first specify the chart to install before the --version flag can be completed - -bash-5.1$ bin/helm install myrelease bitnami/solr --version 2.0.[tab][tab] -2.0.1 2.0.2 2.0.3 -``` - -## User control of Active Help - -You may want to allow your users to disable Active Help or choose between different levels of Active Help. It is entirely up to the program to define the type of configurability of Active Help that it wants to offer, if any. -Allowing to configure Active Help is entirely optional; you can use Active Help in your program without doing anything about Active Help configuration. - -The way to configure Active Help is to use the program's Active Help environment -variable. That variable is named `_ACTIVE_HELP` where `` is the name of your -program in uppercase with any `-` replaced by an `_`. The variable should be set by the user to whatever -Active Help configuration values are supported by the program. - -For example, say `helm` has chosen to support three levels for Active Help: `on`, `off`, `local`. Then a user -would set the desired behavior to `local` by doing `export HELM_ACTIVE_HELP=local` in their shell. - -For simplicity, when in `cmd.ValidArgsFunction(...)` or a flag's completion function, the program should read the -Active Help configuration using the `cobra.GetActiveHelpConfig(cmd)` function and select what Active Help messages -should or should not be added (instead of reading the environment variable directly). - -For example: -```go -ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - activeHelpLevel := cobra.GetActiveHelpConfig(cmd) - - var comps []string - if len(args) == 0 { - if activeHelpLevel != "off" { - comps = cobra.AppendActiveHelp(comps, "You must choose a name for the repo you are adding") - } - } else if len(args) == 1 { - if activeHelpLevel != "off" { - comps = cobra.AppendActiveHelp(comps, "You must specify the URL for the repo you are adding") - } - } else { - if activeHelpLevel == "local" { - comps = cobra.AppendActiveHelp(comps, "This command does not take any more arguments") - } - } - return comps, cobra.ShellCompDirectiveNoFileComp -}, -``` -**Note 1**: If the `_ACTIVE_HELP` environment variable is set to the string "0", Cobra will automatically disable all Active Help output (even if some output was specified by the program using the `cobra.AppendActiveHelp(...)` function). Using "0" can simplify your code in situations where you want to blindly disable Active Help without having to call `cobra.GetActiveHelpConfig(cmd)` explicitly. - -**Note 2**: If a user wants to disable Active Help for every single program based on Cobra, she can set the environment variable `COBRA_ACTIVE_HELP` to "0". In this case `cobra.GetActiveHelpConfig(cmd)` will return "0" no matter what the variable `_ACTIVE_HELP` is set to. - -**Note 3**: If the user does not set `_ACTIVE_HELP` or `COBRA_ACTIVE_HELP` (which will be a common case), the default value for the Active Help configuration returned by `cobra.GetActiveHelpConfig(cmd)` will be the empty string. -## Active Help with Cobra's default completion command - -Cobra provides a default `completion` command for programs that wish to use it. -When using the default `completion` command, Active Help is configurable in the same -fashion as described above using environment variables. You may wish to document this in more -details for your users. - -## Debugging Active Help - -Debugging your Active Help code is done in the same way as debugging your dynamic completion code, which is with Cobra's hidden `__complete` command. Please refer to [debugging shell completion](shell_completions.md#debugging) for details. - -When debugging with the `__complete` command, if you want to specify different Active Help configurations, you should use the active help environment variable. That variable is named `_ACTIVE_HELP` where any `-` is replaced by an `_`. For example, we can test deactivating some Active Help as shown below: -``` -$ HELM_ACTIVE_HELP=1 bin/helm __complete install wordpress bitnami/h -bitnami/haproxy -bitnami/harbor -_activeHelp_ WARNING: cannot re-use a name that is still in use -:0 -Completion ended with directive: ShellCompDirectiveDefault - -$ HELM_ACTIVE_HELP=0 bin/helm __complete install wordpress bitnami/h -bitnami/haproxy -bitnami/harbor -:0 -Completion ended with directive: ShellCompDirectiveDefault -``` diff --git a/vendor/github.com/spf13/cobra/args.go b/vendor/github.com/spf13/cobra/args.go index 20a022b30..ed1e70cea 100644 --- a/vendor/github.com/spf13/cobra/args.go +++ b/vendor/github.com/spf13/cobra/args.go @@ -1,3 +1,17 @@ +// Copyright 2013-2023 The Cobra 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 cobra import ( @@ -7,7 +21,7 @@ import ( type PositionalArgs func(cmd *Command, args []string) error -// Legacy arg validation has the following behaviour: +// legacyArgs validation has the following behaviour: // - root commands with no subcommands can take arbitrary arguments // - root commands with subcommands will do subcommand validity checking // - subcommands will always accept arbitrary arguments @@ -32,16 +46,16 @@ func NoArgs(cmd *Command, args []string) error { return nil } -// OnlyValidArgs returns an error if any args are not in the list of ValidArgs. +// OnlyValidArgs returns an error if there are any positional args that are not in +// the `ValidArgs` field of `Command` 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) { return fmt.Errorf("invalid argument %q for %q%s", v, cmd.CommandPath(), cmd.findSuggestions(args[0])) @@ -86,18 +100,6 @@ func ExactArgs(n int) PositionalArgs { } } -// ExactValidArgs returns an error if -// there are not exactly N positional args OR -// there are any positional args that are not in the `ValidArgs` field of `Command` -func ExactValidArgs(n int) PositionalArgs { - return func(cmd *Command, args []string) error { - if err := ExactArgs(n)(cmd, args); err != nil { - return err - } - return OnlyValidArgs(cmd, args) - } -} - // RangeArgs returns an error if the number of args is not within the expected range. func RangeArgs(min int, max int) PositionalArgs { return func(cmd *Command, args []string) error { @@ -119,3 +121,11 @@ func MatchAll(pargs ...PositionalArgs) PositionalArgs { return nil } } + +// ExactValidArgs returns an error if there are not exactly N positional args OR +// there are any positional args that are not in the `ValidArgs` field of `Command` +// +// Deprecated: use MatchAll(ExactArgs(n), OnlyValidArgs) instead +func ExactValidArgs(n int) PositionalArgs { + return MatchAll(ExactArgs(n), OnlyValidArgs) +} diff --git a/vendor/github.com/spf13/cobra/bash_completions.go b/vendor/github.com/spf13/cobra/bash_completions.go index cb7e19537..f4d198cbc 100644 --- a/vendor/github.com/spf13/cobra/bash_completions.go +++ b/vendor/github.com/spf13/cobra/bash_completions.go @@ -1,3 +1,17 @@ +// Copyright 2013-2023 The Cobra 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 cobra import ( @@ -71,7 +85,7 @@ __%[1]s_handle_go_custom_completion() local out requestComp lastParam lastChar comp directive args # Prepare the command to request completions for the program. - # Calling ${words[0]} instead of directly %[1]s allows to handle aliases + # Calling ${words[0]} instead of directly %[1]s allows handling aliases args=("${words[@]:1}") # Disable ActiveHelp which is not supported for bash completion v1 requestComp="%[8]s=0 ${words[0]} %[2]s ${args[*]}" @@ -518,7 +532,7 @@ func writeLocalNonPersistentFlag(buf io.StringWriter, flag *pflag.Flag) { } } -// Setup annotations for go completions for registered flags +// prepareCustomAnnotationsForFlags setup annotations for go completions for registered flags func prepareCustomAnnotationsForFlags(cmd *Command) { flagCompletionMutex.RLock() defer flagCompletionMutex.RUnlock() @@ -583,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)) } } }) @@ -607,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/bash_completions.md b/vendor/github.com/spf13/cobra/bash_completions.md deleted file mode 100644 index 52919b2fa..000000000 --- a/vendor/github.com/spf13/cobra/bash_completions.md +++ /dev/null @@ -1,93 +0,0 @@ -# Generating Bash Completions For Your cobra.Command - -Please refer to [Shell Completions](shell_completions.md) for details. - -## Bash legacy dynamic completions - -For backward compatibility, Cobra still supports its legacy dynamic completion solution (described below). Unlike the `ValidArgsFunction` solution, the legacy solution will only work for Bash shell-completion and not for other shells. This legacy solution can be used along-side `ValidArgsFunction` and `RegisterFlagCompletionFunc()`, as long as both solutions are not used for the same command. This provides a path to gradually migrate from the legacy solution to the new solution. - -**Note**: Cobra's default `completion` command uses bash completion V2. If you are currently using Cobra's legacy dynamic completion solution, you should not use the default `completion` command but continue using your own. - -The legacy solution allows you to inject bash functions into the bash completion script. Those bash functions are responsible for providing the completion choices for your own completions. - -Some code that works in kubernetes: - -```bash -const ( - bash_completion_func = `__kubectl_parse_get() -{ - local kubectl_output out - if kubectl_output=$(kubectl get --no-headers "$1" 2>/dev/null); then - out=($(echo "${kubectl_output}" | awk '{print $1}')) - COMPREPLY=( $( compgen -W "${out[*]}" -- "$cur" ) ) - fi -} - -__kubectl_get_resource() -{ - if [[ ${#nouns[@]} -eq 0 ]]; then - return 1 - fi - __kubectl_parse_get ${nouns[${#nouns[@]} -1]} - if [[ $? -eq 0 ]]; then - return 0 - fi -} - -__kubectl_custom_func() { - case ${last_command} in - kubectl_get | kubectl_describe | kubectl_delete | kubectl_stop) - __kubectl_get_resource - return - ;; - *) - ;; - esac -} -`) -``` - -And then I set that in my command definition: - -```go -cmds := &cobra.Command{ - Use: "kubectl", - Short: "kubectl controls the Kubernetes cluster manager", - Long: `kubectl controls the Kubernetes cluster manager. - -Find more information at https://github.com/GoogleCloudPlatform/kubernetes.`, - Run: runHelp, - BashCompletionFunction: bash_completion_func, -} -``` - -The `BashCompletionFunction` option is really only valid/useful on the root command. Doing the above will cause `__kubectl_custom_func()` (`___custom_func()`) to be called when the built in processor was unable to find a solution. In the case of kubernetes a valid command might look something like `kubectl get pod [mypod]`. If you type `kubectl get pod [tab][tab]` the `__kubectl_customc_func()` will run because the cobra.Command only understood "kubectl" and "get." `__kubectl_custom_func()` will see that the cobra.Command is "kubectl_get" and will thus call another helper `__kubectl_get_resource()`. `__kubectl_get_resource` will look at the 'nouns' collected. In our example the only noun will be `pod`. So it will call `__kubectl_parse_get pod`. `__kubectl_parse_get` will actually call out to kubernetes and get any pods. It will then set `COMPREPLY` to valid pods! - -Similarly, for flags: - -```go - annotation := make(map[string][]string) - annotation[cobra.BashCompCustom] = []string{"__kubectl_get_namespaces"} - - flag := &pflag.Flag{ - Name: "namespace", - Usage: usage, - Annotations: annotation, - } - cmd.Flags().AddFlag(flag) -``` - -In addition add the `__kubectl_get_namespaces` implementation in the `BashCompletionFunction` -value, e.g.: - -```bash -__kubectl_get_namespaces() -{ - local template - template="{{ range .items }}{{ .metadata.name }} {{ end }}" - local kubectl_out - if kubectl_out=$(kubectl get -o template --template="${template}" namespace 2>/dev/null); then - COMPREPLY=( $( compgen -W "${kubectl_out}[*]" -- "$cur" ) ) - fi -} -``` diff --git a/vendor/github.com/spf13/cobra/bash_completionsV2.go b/vendor/github.com/spf13/cobra/bash_completionsV2.go index 767bf0312..1cce5c329 100644 --- a/vendor/github.com/spf13/cobra/bash_completionsV2.go +++ b/vendor/github.com/spf13/cobra/bash_completionsV2.go @@ -1,3 +1,17 @@ +// Copyright 2013-2023 The Cobra 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 cobra import ( @@ -24,7 +38,7 @@ func genBashComp(buf io.StringWriter, name string, includeDesc bool) { __%[1]s_debug() { - if [[ -n ${BASH_COMP_DEBUG_FILE:-} ]]; then + if [[ -n ${BASH_COMP_DEBUG_FILE-} ]]; then echo "$*" >> "${BASH_COMP_DEBUG_FILE}" fi } @@ -43,7 +57,7 @@ __%[1]s_get_completion_results() { local requestComp lastParam lastChar args # Prepare the command to request completions for the program. - # Calling ${words[0]} instead of directly %[1]s allows to handle aliases + # Calling ${words[0]} instead of directly %[1]s allows handling aliases args=("${words[@]:1}") requestComp="${words[0]} %[2]s ${args[*]}" @@ -51,7 +65,7 @@ __%[1]s_get_completion_results() { lastChar=${lastParam:$((${#lastParam}-1)):1} __%[1]s_debug "lastParam ${lastParam}, lastChar ${lastChar}" - if [ -z "${cur}" ] && [ "${lastChar}" != "=" ]; then + if [[ -z ${cur} && ${lastChar} != = ]]; then # If the last parameter is complete (there is a space following it) # We add an extra empty parameter so we can indicate this to the go method. __%[1]s_debug "Adding extra empty parameter" @@ -61,7 +75,7 @@ __%[1]s_get_completion_results() { # When completing a flag with an = (e.g., %[1]s -n=) # bash focuses on the part after the =, so we need to remove # the flag part from $cur - if [[ "${cur}" == -*=* ]]; then + if [[ ${cur} == -*=* ]]; then cur="${cur#*=}" fi @@ -73,7 +87,7 @@ __%[1]s_get_completion_results() { directive=${out##*:} # Remove the directive out=${out%%:*} - if [ "${directive}" = "${out}" ]; then + if [[ ${directive} == "${out}" ]]; then # There is not directive specified directive=0 fi @@ -87,22 +101,36 @@ __%[1]s_process_completion_results() { local shellCompDirectiveNoFileComp=%[5]d local shellCompDirectiveFilterFileExt=%[6]d local shellCompDirectiveFilterDirs=%[7]d + local shellCompDirectiveKeepOrder=%[8]d - if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then + if (((directive & shellCompDirectiveError) != 0)); then # Error code. No completion. __%[1]s_debug "Received error from custom completion go code" return else - if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then - if [[ $(type -t compopt) = "builtin" ]]; then + if (((directive & shellCompDirectiveNoSpace) != 0)); then + if [[ $(type -t compopt) == builtin ]]; then __%[1]s_debug "Activating no space" compopt -o nospace else __%[1]s_debug "No space directive not supported in this version of bash" fi fi - if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then - if [[ $(type -t compopt) = "builtin" ]]; then + if (((directive & shellCompDirectiveKeepOrder) != 0)); then + if [[ $(type -t compopt) == builtin ]]; then + # no sort isn't supported for bash less than < 4.4 + if [[ ${BASH_VERSINFO[0]} -lt 4 || ( ${BASH_VERSINFO[0]} -eq 4 && ${BASH_VERSINFO[1]} -lt 4 ) ]]; then + __%[1]s_debug "No sort directive not supported in this version of bash" + else + __%[1]s_debug "Activating keep order" + compopt -o nosort + fi + else + __%[1]s_debug "No sort directive not supported in this version of bash" + fi + fi + if (((directive & shellCompDirectiveNoFileComp) != 0)); then + if [[ $(type -t compopt) == builtin ]]; then __%[1]s_debug "Activating no file completion" compopt +o default else @@ -116,7 +144,7 @@ __%[1]s_process_completion_results() { local activeHelp=() __%[1]s_extract_activeHelp - if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then + if (((directive & shellCompDirectiveFilterFileExt) != 0)); then # File extension filtering local fullFilter filter filteringCmd @@ -129,13 +157,12 @@ __%[1]s_process_completion_results() { filteringCmd="_filedir $fullFilter" __%[1]s_debug "File filtering command: $filteringCmd" $filteringCmd - elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then + elif (((directive & shellCompDirectiveFilterDirs) != 0)); then # File completion for directories only - # Use printf to strip any trailing newline local subdir - subdir=$(printf "%%s" "${completions[0]}") - if [ -n "$subdir" ]; then + subdir=${completions[0]} + if [[ -n $subdir ]]; then __%[1]s_debug "Listing directories in $subdir" pushd "$subdir" >/dev/null 2>&1 && _filedir -d && popd >/dev/null 2>&1 || return else @@ -150,7 +177,7 @@ __%[1]s_process_completion_results() { __%[1]s_handle_special_char "$cur" = # Print the activeHelp statements before we finish - if [ ${#activeHelp} -ne 0 ]; then + if ((${#activeHelp[*]} != 0)); then printf "\n"; printf "%%s\n" "${activeHelp[@]}" printf "\n" @@ -170,21 +197,21 @@ __%[1]s_process_completion_results() { # Separate activeHelp lines from real completions. # Fills the $activeHelp and $completions arrays. __%[1]s_extract_activeHelp() { - local activeHelpMarker="%[8]s" + local activeHelpMarker="%[9]s" local endIndex=${#activeHelpMarker} while IFS='' read -r comp; do - if [ "${comp:0:endIndex}" = "$activeHelpMarker" ]; then + if [[ ${comp:0:endIndex} == $activeHelpMarker ]]; then comp=${comp:endIndex} __%[1]s_debug "ActiveHelp found: $comp" - if [ -n "$comp" ]; then + if [[ -n $comp ]]; then activeHelp+=("$comp") fi else # Not an activeHelp line but a normal completion completions+=("$comp") fi - done < <(printf "%%s\n" "${out}") + done <<<"${out}" } __%[1]s_handle_completion_types() { @@ -240,7 +267,7 @@ __%[1]s_handle_standard_completion_case() { done < <(printf "%%s\n" "${completions[@]}") # If there is a single completion left, remove the description text - if [ ${#COMPREPLY[*]} -eq 1 ]; then + if ((${#COMPREPLY[*]} == 1)); then __%[1]s_debug "COMPREPLY[0]: ${COMPREPLY[0]}" comp="${COMPREPLY[0]%%%%$tab*}" __%[1]s_debug "Removed description from single completion, which is now: ${comp}" @@ -257,8 +284,8 @@ __%[1]s_handle_special_char() if [[ "$comp" == *${char}* && "$COMP_WORDBREAKS" == *${char}* ]]; then local word=${comp%%"${comp##*${char}}"} local idx=${#COMPREPLY[*]} - while [[ $((--idx)) -ge 0 ]]; do - COMPREPLY[$idx]=${COMPREPLY[$idx]#"$word"} + while ((--idx >= 0)); do + COMPREPLY[idx]=${COMPREPLY[idx]#"$word"} done fi } @@ -284,7 +311,7 @@ __%[1]s_format_comp_descriptions() # Make sure we can fit a description of at least 8 characters # if we are to align the descriptions. - if [[ $maxdesclength -gt 8 ]]; then + if ((maxdesclength > 8)); then # Add the proper number of spaces to align the descriptions for ((i = ${#comp} ; i < longest ; i++)); do comp+=" " @@ -296,8 +323,8 @@ __%[1]s_format_comp_descriptions() # If there is enough space for any description text, # truncate the descriptions that are too long for the shell width - if [ $maxdesclength -gt 0 ]; then - if [ ${#desc} -gt $maxdesclength ]; then + if ((maxdesclength > 0)); then + if ((${#desc} > maxdesclength)); then desc=${desc:0:$(( maxdesclength - 1 ))} desc+="…" fi @@ -318,9 +345,9 @@ __start_%[1]s() # Call _init_completion from the bash-completion package # to prepare the arguments properly if declare -F _init_completion >/dev/null 2>&1; then - _init_completion -n "=:" || return + _init_completion -n =: || return else - __%[1]s_init_completion -n "=:" || return + __%[1]s_init_completion -n =: || return fi __%[1]s_debug @@ -347,7 +374,7 @@ fi # ex: ts=4 sw=4 et filetype=sh `, name, compCmd, ShellCompDirectiveError, ShellCompDirectiveNoSpace, ShellCompDirectiveNoFileComp, - ShellCompDirectiveFilterFileExt, ShellCompDirectiveFilterDirs, + ShellCompDirectiveFilterFileExt, ShellCompDirectiveFilterDirs, ShellCompDirectiveKeepOrder, activeHelpMarker)) } diff --git a/vendor/github.com/spf13/cobra/cobra.go b/vendor/github.com/spf13/cobra/cobra.go index d6cbfd719..e0b0947b0 100644 --- a/vendor/github.com/spf13/cobra/cobra.go +++ b/vendor/github.com/spf13/cobra/cobra.go @@ -1,9 +1,10 @@ -// Copyright © 2013 Steve Francia . +// Copyright 2013-2023 The Cobra 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 +// +// 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, @@ -39,15 +40,30 @@ var templateFuncs = template.FuncMap{ } var initializers []func() +var finalizers []func() + +const ( + defaultPrefixMatching = false + defaultCommandSorting = true + defaultCaseInsensitive = false + defaultTraverseRunHooks = false +) -// EnablePrefixMatching allows to set automatic prefix matching. Automatic prefix matching can be a dangerous thing +// EnablePrefixMatching allows setting automatic prefix matching. Automatic prefix matching can be a dangerous thing // to automatically enable in CLI tools. // Set this to true to enable it. -var EnablePrefixMatching = false +var EnablePrefixMatching = defaultPrefixMatching // EnableCommandSorting controls sorting of the slice of commands, which is turned on by default. // To disable sorting, set it to false. -var EnableCommandSorting = true +var EnableCommandSorting = defaultCommandSorting + +// EnableCaseInsensitive allows case-insensitive commands names. (case sensitive by default) +var EnableCaseInsensitive = defaultCaseInsensitive + +// EnableTraverseRunHooks executes persistent pre-run and post-run hooks from all parents. +// By default this is disabled, which means only the first run hook to be found is executed. +var EnableTraverseRunHooks = defaultTraverseRunHooks // MousetrapHelpText enables an information splash screen on Windows // if the CLI is started from explorer.exe. @@ -84,6 +100,12 @@ func OnInitialize(y ...func()) { initializers = append(initializers, y...) } +// OnFinalize sets the passed functions to be run when each command's +// Execute method is terminated. +func OnFinalize(y ...func()) { + finalizers = append(finalizers, y...) +} + // FIXME Gt is unused by cobra and should be removed in a version 2. It exists only for compatibility with users of cobra. // Gt takes two types and checks whether the first type is greater than the second. In case of types Arrays, Chans, @@ -150,8 +172,8 @@ func appendIfNotPresent(s, stringToAppend string) string { // rpad adds padding to the right of a string. func rpad(s string, padding int) string { - template := fmt.Sprintf("%%-%ds", padding) - return fmt.Sprintf(template, s) + formattedString := fmt.Sprintf("%%-%ds", padding) + return fmt.Sprintf(formattedString, s) } // tmpl executes the given template text on data, writing the result to w. @@ -171,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 675bb1340..54748fc67 100644 --- a/vendor/github.com/spf13/cobra/command.go +++ b/vendor/github.com/spf13/cobra/command.go @@ -1,9 +1,10 @@ -// Copyright © 2013 Steve Francia . +// Copyright 2013-2023 The Cobra 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 +// +// 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, @@ -29,16 +30,27 @@ import ( flag "github.com/spf13/pflag" ) +const ( + FlagSetByCobraAnnotation = "cobra_annotation_flag_set_by_cobra" + CommandDisplayNameAnnotation = "cobra_annotation_command_display_name" +) + // FParseErrWhitelist configures Flag parse errors to be ignored type FParseErrWhitelist flag.ParseErrorsWhitelist +// Group Structure to manage groups for commands +type Group struct { + ID string + Title string +} + // Command is just that, a command for your application. // E.g. 'go run ...' - 'run' is the command. Cobra requires // you to define the usage and description as part of your command // definition to ensure usability. type Command struct { // Use is the one-line usage message. - // Recommended syntax is as follow: + // Recommended syntax is as follows: // [ ] identifies an optional argument. Arguments that are not enclosed in brackets are required. // ... indicates that you can specify multiple values for the previous argument. // | indicates mutually exclusive information. You can use the argument to the left of the separator or the @@ -58,6 +70,9 @@ type Command struct { // Short is the short description shown in the 'help' output. Short string + // The group id under which this subcommand is grouped in the 'help' output of its parent. + GroupID string + // Long is the long message shown in the 'help ' output. Long string @@ -87,7 +102,7 @@ type Command struct { Deprecated string // Annotations are key/value pairs that can be used by applications to identify or - // group commands. + // group commands or set special options. Annotations map[string]string // Version defines the version for this command. If this value is non-empty and the command does not @@ -103,6 +118,8 @@ type Command struct { // * PostRun() // * PersistentPostRun() // All functions get the same args, the arguments after the command name. + // The *PreRun and *PostRun functions will only be executed if the Run function of the current + // command has been declared. // // PersistentPreRun: children of this command will inherit and execute. PersistentPreRun func(cmd *Command, args []string) @@ -125,6 +142,9 @@ type Command struct { // PersistentPostRunE: PersistentPostRun but returns an error. PersistentPostRunE func(cmd *Command, args []string) error + // groups for subcommands + commandgroups []*Group + // args is actual args parsed from flags. args []string // flagErrorBuf contains all error messages from pflag. @@ -134,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 @@ -157,9 +179,18 @@ type Command struct { // helpCommand is command with usage 'help'. If it's not defined by user, // cobra uses default help command. helpCommand *Command + // helpCommandGroupID is the group id for the helpCommand + helpCommandGroupID string + + // completionCommandGroupID is the group id for the completion command + completionCommandGroupID string + // versionTemplate is the version template defined by user. versionTemplate string + // errPrefix is the error message prefix defined by user. + errPrefix string + // inReader is a reader defined by the user that replaces stdin inReader io.Reader // outWriter is a writer defined by the user that replaces stdout @@ -236,8 +267,8 @@ func (c *Command) Context() context.Context { return c.ctx } -// SetContext sets context for the command. It is set to context.Background by default and will be overwritten by -// Command.ExecuteContext or Command.ExecuteContextC +// SetContext sets context for the command. This context will be overwritten by +// Command.ExecuteContext or Command.ExecuteContextC. func (c *Command) SetContext(ctx context.Context) { c.ctx = ctx } @@ -300,6 +331,21 @@ func (c *Command) SetHelpCommand(cmd *Command) { c.helpCommand = cmd } +// SetHelpCommandGroupID sets the group id of the help command. +func (c *Command) SetHelpCommandGroupID(groupID string) { + if c.helpCommand != nil { + c.helpCommand.GroupID = groupID + } + // helpCommandGroupID is used if no helpCommand is defined by the user + c.helpCommandGroupID = groupID +} + +// SetCompletionCommandGroupID sets the group id of the completion command. +func (c *Command) SetCompletionCommandGroupID(groupID string) { + // completionCommandGroupID is used if no completion command is defined by the user + c.Root().completionCommandGroupID = groupID +} + // SetHelpTemplate sets help template to be used. Application can use it to set custom template. func (c *Command) SetHelpTemplate(s string) { c.helpTemplate = s @@ -310,6 +356,11 @@ func (c *Command) SetVersionTemplate(s string) { c.versionTemplate = s } +// SetErrPrefix sets error message prefix to be used. Application can use it to set custom prefix. +func (c *Command) SetErrPrefix(s string) { + c.errPrefix = s +} + // SetGlobalNormalizationFunc sets a normalization function to all flag sets and also to child commands. // The user should not have a cyclic dependency on commands. func (c *Command) SetGlobalNormalizationFunc(n func(f *flag.FlagSet, name string) flag.NormalizedName) { @@ -508,10 +559,16 @@ Aliases: {{.NameAndAliases}}{{end}}{{if .HasExample}} Examples: -{{.Example}}{{end}}{{if .HasAvailableSubCommands}} +{{.Example}}{{end}}{{if .HasAvailableSubCommands}}{{$cmds := .Commands}}{{if eq (len .Groups) 0}} + +Available Commands:{{range $cmds}}{{if (or .IsAvailableCommand (eq .Name "help"))}} + {{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{else}}{{range $group := .Groups}} + +{{.Title}}{{range $cmds}}{{if (and (eq .GroupID $group.ID) (or .IsAvailableCommand (eq .Name "help")))}} + {{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{if not .AllChildCommandsHaveGroup}} -Available Commands:{{range .Commands}}{{if (or .IsAvailableCommand (eq .Name "help"))}} - {{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableLocalFlags}} +Additional Commands:{{range $cmds}}{{if (and (eq .GroupID "") (or .IsAvailableCommand (eq .Name "help")))}} + {{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{end}}{{end}}{{if .HasAvailableLocalFlags}} Flags: {{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasAvailableInheritedFlags}} @@ -553,6 +610,18 @@ func (c *Command) VersionTemplate() string { ` } +// ErrPrefix return error message prefix for the command +func (c *Command) ErrPrefix() string { + if c.errPrefix != "" { + return c.errPrefix + } + + if c.HasParent() { + return c.parent.ErrPrefix() + } + return "Error:" +} + func hasNoOptDefVal(name string, fs *flag.FlagSet) bool { flag := fs.Lookup(name) if flag == nil { @@ -613,20 +682,44 @@ Loop: // argsMinusFirstX removes only the first x from args. Otherwise, commands that look like // openshift admin policy add-role-to-user admin my-user, lose the admin argument (arg[4]). -func argsMinusFirstX(args []string, x string) []string { - for i, y := range args { - if x == y { - ret := []string{} - ret = append(ret, args[:i]...) - ret = append(ret, args[i+1:]...) - return ret +// Special care needs to be taken not to remove a flag value. +func (c *Command) argsMinusFirstX(args []string, x string) []string { + if len(args) == 0 { + return args + } + c.mergePersistentFlags() + flags := c.Flags() + +Loop: + for pos := 0; pos < len(args); pos++ { + s := args[pos] + switch { + case s == "--": + // -- means we have reached the end of the parseable args. Break out of the loop now. + break Loop + case strings.HasPrefix(s, "--") && !strings.Contains(s, "=") && !hasNoOptDefVal(s[2:], flags): + fallthrough + case strings.HasPrefix(s, "-") && !strings.Contains(s, "=") && len(s) == 2 && !shortHasNoOptDefVal(s[1:], flags): + // This is a flag without a default value, and an equal sign is not used. Increment pos in order to skip + // over the next arg, because that is the value of this flag. + pos++ + continue + case !strings.HasPrefix(s, "-"): + // 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 := make([]string, 0, len(args)-1) + ret = append(ret, args[:pos]...) + ret = append(ret, args[pos+1:]...) + return ret + } } } return args } func isFlagArg(arg string) bool { - return ((len(arg) >= 3 && arg[1] == '-') || + return ((len(arg) >= 3 && arg[0:2] == "--") || (len(arg) >= 2 && arg[0] == '-' && arg[1] != '-')) } @@ -644,7 +737,7 @@ func (c *Command) Find(args []string) (*Command, []string, error) { cmd := c.findNext(nextSubCmd) if cmd != nil { - return innerfind(cmd, argsMinusFirstX(innerArgs, nextSubCmd)) + return innerfind(cmd, c.argsMinusFirstX(innerArgs, nextSubCmd)) } return c, innerArgs } @@ -663,20 +756,20 @@ 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 { matches := make([]*Command, 0) for _, cmd := range c.commands { - if cmd.Name() == next || cmd.HasAlias(next) { + if commandNameMatches(cmd.Name(), next) || cmd.HasAlias(next) { cmd.commandCalledAs.name = next return cmd } @@ -686,7 +779,9 @@ func (c *Command) findNext(next string) *Command { } if len(matches) == 1 { - return matches[0] + // Temporarily disable gosec G602, which produces a false positive. + // See https://github.com/securego/gosec/issues/1005. + return matches[0] // #nosec G602 } return nil @@ -780,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 { @@ -833,6 +928,8 @@ func (c *Command) execute(a []string) (err error) { c.preRun() + defer c.postRun() + argWoFlags := c.Flags().Args() if c.DisableFlagParsing { argWoFlags = a @@ -842,15 +939,31 @@ func (c *Command) execute(a []string) (err error) { return err } + parents := make([]*Command, 0, 5) for p := c; p != nil; p = p.Parent() { + if EnableTraverseRunHooks { + // When EnableTraverseRunHooks is set: + // - Execute all persistent pre-runs from the root parent till this command. + // - Execute all persistent post-runs from this command till the root parent. + parents = append([]*Command{p}, parents...) + } else { + // Otherwise, execute only the first found persistent hook. + parents = append(parents, p) + } + } + for _, p := range parents { if p.PersistentPreRunE != nil { if err := p.PersistentPreRunE(c, argWoFlags); err != nil { return err } - break + if !EnableTraverseRunHooks { + break + } } else if p.PersistentPreRun != nil { p.PersistentPreRun(c, argWoFlags) - break + if !EnableTraverseRunHooks { + break + } } } if c.PreRunE != nil { @@ -861,10 +974,10 @@ func (c *Command) execute(a []string) (err error) { c.PreRun(c, argWoFlags) } - if err := c.validateRequiredFlags(); err != nil { + if err := c.ValidateRequiredFlags(); err != nil { return err } - if err := c.validateFlagGroups(); err != nil { + if err := c.ValidateFlagGroups(); err != nil { return err } @@ -887,10 +1000,14 @@ func (c *Command) execute(a []string) (err error) { if err := p.PersistentPostRunE(c, argWoFlags); err != nil { return err } - break + if !EnableTraverseRunHooks { + break + } } else if p.PersistentPostRun != nil { p.PersistentPostRun(c, argWoFlags) - break + if !EnableTraverseRunHooks { + break + } } } @@ -903,6 +1020,12 @@ func (c *Command) preRun() { } } +func (c *Command) postRun() { + for _, x := range finalizers { + x() + } +} + // ExecuteContext is the same as Execute(), but sets the ctx on the command. // Retrieve ctx by calling cmd.Context() inside your *Run lifecycle or ValidArgs // functions. @@ -946,7 +1069,11 @@ func (c *Command) ExecuteC() (cmd *Command, err error) { // initialize help at the last point to allow for user overriding c.InitDefaultHelpCmd() // initialize completion at the last point to allow for user overriding - c.initDefaultCompletionCmd() + c.InitDefaultCompletionCmd() + + // Now that all commands have been created, let's make sure all groups + // are properly created also + c.checkCommandGroups() args := c.args @@ -970,7 +1097,7 @@ func (c *Command) ExecuteC() (cmd *Command, err error) { c = cmd } if !c.SilenceErrors { - c.PrintErrln("Error:", err.Error()) + c.PrintErrln(c.ErrPrefix(), err.Error()) c.PrintErrf("Run '%v --help' for usage.\n", c.CommandPath()) } return c, err @@ -999,7 +1126,7 @@ func (c *Command) ExecuteC() (cmd *Command, err error) { // If root command has SilenceErrors flagged, // all subcommands should respect it if !cmd.SilenceErrors && !c.SilenceErrors { - c.PrintErrln("Error:", err.Error()) + c.PrintErrln(cmd.ErrPrefix(), err.Error()) } // If root command has SilenceUsage flagged, @@ -1018,7 +1145,8 @@ func (c *Command) ValidateArgs(args []string) error { return c.Args(c, args) } -func (c *Command) validateRequiredFlags() error { +// ValidateRequiredFlags validates all required flags are present and returns an error otherwise +func (c *Command) ValidateRequiredFlags() error { if c.DisableFlagParsing { return nil } @@ -1041,6 +1169,19 @@ func (c *Command) validateRequiredFlags() error { return nil } +// checkCommandGroups checks if a command has been added to a group that does not exists. +// If so, we panic because it indicates a coding error that should be corrected. +func (c *Command) checkCommandGroups() { + for _, sub := range c.commands { + // if Group is not defined let the developer know right away + if sub.GroupID != "" && !c.ContainsGroup(sub.GroupID) { + panic(fmt.Sprintf("group id '%s' is not defined for subcommand '%s'", sub.GroupID, sub.CommandPath())) + } + + sub.checkCommandGroups() + } +} + // InitDefaultHelpFlag adds default help flag to c. // It is called automatically by executing the c or by calling help and usage. // If c already has help flag, it will do nothing. @@ -1048,12 +1189,14 @@ 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"}) } } @@ -1079,6 +1222,7 @@ func (c *Command) InitDefaultVersionFlag() { } else { c.Flags().Bool("version", false, usage) } + _ = c.Flags().SetAnnotation("version", FlagSetByCobraAnnotation, []string{"true"}) } } @@ -1095,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) @@ -1121,10 +1265,12 @@ Simply type ` + c.Name() + ` help [path to command] for full details.`, c.Printf("Unknown help topic %#q\n", args) CheckErr(c.Root().Usage()) } else { - cmd.InitDefaultHelpFlag() // make possible 'help' flag to be shown + cmd.InitDefaultHelpFlag() // make possible 'help' flag to be shown + cmd.InitDefaultVersionFlag() // make possible 'version' flag to be shown CheckErr(cmd.Help()) } }, + GroupID: c.helpCommandGroupID, } } c.RemoveCommand(c.helpCommand) @@ -1185,6 +1331,36 @@ func (c *Command) AddCommand(cmds ...*Command) { } } +// Groups returns a slice of child command groups. +func (c *Command) Groups() []*Group { + return c.commandgroups +} + +// AllChildCommandsHaveGroup returns if all subcommands are assigned to a group +func (c *Command) AllChildCommandsHaveGroup() bool { + for _, sub := range c.commands { + if (sub.IsAvailableCommand() || sub == c.helpCommand) && sub.GroupID == "" { + return false + } + } + return true +} + +// ContainsGroup return if groupID exists in the list of command groups. +func (c *Command) ContainsGroup(groupID string) bool { + for _, x := range c.commandgroups { + if x.ID == groupID { + return true + } + } + return false +} + +// AddGroup adds one or more command groups to this parent command. +func (c *Command) AddGroup(groups ...*Group) { + c.commandgroups = append(c.commandgroups, groups...) +} + // RemoveCommand removes one or more commands from a parent command. func (c *Command) RemoveCommand(cmds ...*Command) { commands := []*Command{} @@ -1254,16 +1430,24 @@ 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 + } return c.Name() } // 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 @@ -1328,7 +1512,7 @@ func (c *Command) Name() string { // HasAlias determines if a given string is an alias of the command. func (c *Command) HasAlias(s string) bool { for _, a := range c.Aliases { - if a == s { + if commandNameMatches(a, s) { return true } } @@ -1465,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) } @@ -1476,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) @@ -1489,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) } @@ -1505,7 +1691,8 @@ func (c *Command) LocalFlags() *flag.FlagSet { } addToLocal := func(f *flag.Flag) { - if c.lflags.Lookup(f.Name) == nil && c.parentsPflags.Lookup(f.Name) == nil { + // Add the flag if it is not a parent PFlag, or it shadows a parent PFlag + if c.lflags.Lookup(f.Name) == nil && f != c.parentsPflags.Lookup(f.Name) { c.lflags.AddFlag(f) } } @@ -1515,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) } @@ -1540,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() } @@ -1547,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) } @@ -1560,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 @@ -1679,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 } @@ -1694,3 +1883,14 @@ func (c *Command) updateParentsPflags() { c.parentsPflags.AddFlagSet(parent.PersistentFlags()) }) } + +// commandNameMatches checks if two command names are equal +// taking into account case sensitivity according to +// EnableCaseInsensitive global configuration. +func commandNameMatches(s string, t string) bool { + if EnableCaseInsensitive { + return strings.EqualFold(s, t) + } + + return s == t +} diff --git a/vendor/github.com/spf13/cobra/command_notwin.go b/vendor/github.com/spf13/cobra/command_notwin.go index bb5dad90b..307f0c127 100644 --- a/vendor/github.com/spf13/cobra/command_notwin.go +++ b/vendor/github.com/spf13/cobra/command_notwin.go @@ -1,3 +1,17 @@ +// Copyright 2013-2023 The Cobra 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 !windows // +build !windows diff --git a/vendor/github.com/spf13/cobra/command_win.go b/vendor/github.com/spf13/cobra/command_win.go index a84f5a82a..adbef395c 100644 --- a/vendor/github.com/spf13/cobra/command_win.go +++ b/vendor/github.com/spf13/cobra/command_win.go @@ -1,3 +1,17 @@ +// Copyright 2013-2023 The Cobra 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 windows // +build windows diff --git a/vendor/github.com/spf13/cobra/completions.go b/vendor/github.com/spf13/cobra/completions.go index 2c2483998..c0c08b057 100644 --- a/vendor/github.com/spf13/cobra/completions.go +++ b/vendor/github.com/spf13/cobra/completions.go @@ -1,8 +1,24 @@ +// Copyright 2013-2023 The Cobra 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 cobra import ( "fmt" "os" + "regexp" + "strconv" "strings" "sync" @@ -63,6 +79,10 @@ const ( // obtain the same behavior but only for flags. ShellCompDirectiveFilterDirs + // ShellCompDirectiveKeepOrder indicates that the shell should preserve the order + // in which the completions are provided + ShellCompDirectiveKeepOrder + // =========================================================================== // All directives using iota should be above this one. @@ -127,6 +147,20 @@ func (c *Command) RegisterFlagCompletionFunc(flagName string, f func(cmd *Comman return nil } +// GetFlagCompletionFunc returns the completion function for the given flag of the command, if available. +func (c *Command) GetFlagCompletionFunc(flagName string) (func(*Command, []string, string) ([]string, ShellCompDirective), bool) { + flag := c.Flag(flagName) + if flag == nil { + return nil, false + } + + flagCompletionMutex.RLock() + defer flagCompletionMutex.RUnlock() + + completionFunc, exists := flagCompletionFunctions[flag] + return completionFunc, exists +} + // Returns a string listing the different directive enabled in the specified parameter func (d ShellCompDirective) string() string { var directives []string @@ -145,6 +179,9 @@ func (d ShellCompDirective) string() string { if d&ShellCompDirectiveFilterDirs != 0 { directives = append(directives, "ShellCompDirectiveFilterDirs") } + if d&ShellCompDirectiveKeepOrder != 0 { + directives = append(directives, "ShellCompDirectiveKeepOrder") + } if len(directives) == 0 { directives = append(directives, "ShellCompDirectiveDefault") } @@ -155,7 +192,7 @@ func (d ShellCompDirective) string() string { return strings.Join(directives, ", ") } -// Adds a special hidden command that can be used to request custom completions. +// initCompleteCmd adds a special hidden command that can be used to request custom completions. func (c *Command) initCompleteCmd(args []string) { completeCmd := &Command{ Use: fmt.Sprintf("%s [command-line]", ShellCompRequestCmd), @@ -176,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. @@ -202,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. @@ -256,10 +298,20 @@ 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 + // These flags are normally added when `execute()` is called on `finalCmd`, + // however, when doing completion, we don't call `finalCmd.execute()`. + // Let's add the --help and --version flag ourselves but only if the finalCmd + // has not disabled flag parsing; if flag parsing is disabled, it is up to the + // finalCmd itself to handle the completion of *all* flags. + if !finalCmd.DisableFlagParsing { + finalCmd.InitDefaultHelpFlag() + finalCmd.InitDefaultVersionFlag() + } + // Check if we are doing flag value completion before parsing the flags. // This is important because if we are completing a flag value, we need to also // remove the flag name argument from the list of finalArgs or else the parsing @@ -292,6 +344,12 @@ func (c *Command) getCompletions(args []string) (*Command, []string, ShellCompDi } } + // Look for the --help or --version flags. If they are present, + // there should be no further completions. + if helpOrVersionFlagPresent(finalCmd) { + return finalCmd, []string{}, ShellCompDirectiveNoFileComp, nil + } + // We only remove the flags from the arguments if DisableFlagParsing is not set. // This is important for commands which have requested to do their own flag completion. if !finalCmd.DisableFlagParsing { @@ -356,6 +414,11 @@ func (c *Command) getCompletions(args []string) (*Command, []string, ShellCompDi finalCmd.InheritedFlags().VisitAll(func(flag *pflag.Flag) { doCompleteFlags(flag) }) + // Try to complete non-inherited flags even if DisableFlagParsing==true. + // This allows programs to tell Cobra about flags for completion even + // if the actual parsing of flags is not done by Cobra. + // For instance, Helm uses this to provide flag name completion for + // some of its plugins. finalCmd.NonInheritedFlags().VisitAll(func(flag *pflag.Flag) { doCompleteFlags(flag) }) @@ -463,6 +526,18 @@ func (c *Command) getCompletions(args []string) (*Command, []string, ShellCompDi return finalCmd, completions, directive, nil } +func helpOrVersionFlagPresent(cmd *Command) bool { + if versionFlag := cmd.Flags().Lookup("version"); versionFlag != nil && + len(versionFlag.Annotations[FlagSetByCobraAnnotation]) > 0 && versionFlag.Changed { + return true + } + if helpFlag := cmd.Flags().Lookup("help"); helpFlag != nil && + len(helpFlag.Annotations[FlagSetByCobraAnnotation]) > 0 && helpFlag.Changed { + return true + } + return false +} + func getFlagNameCompletions(flag *pflag.Flag, toComplete string) []string { if nonCompletableFlag(flag) { return []string{} @@ -607,12 +682,12 @@ func checkIfFlagCompletion(finalCmd *Command, args []string, lastArg string) (*p return flag, trimmedArgs, lastArg, nil } -// initDefaultCompletionCmd adds a default 'completion' command to c. +// InitDefaultCompletionCmd adds a default 'completion' command to c. // This function will do nothing if any of the following is true: // 1- the feature has been explicitly disabled by the program, // 2- c has no subcommands (to avoid creating one), // 3- c already has a 'completion' command provided by the program. -func (c *Command) initDefaultCompletionCmd() { +func (c *Command) InitDefaultCompletionCmd() { if c.CompletionOptions.DisableDefaultCmd || !c.HasSubCommands() { return } @@ -635,6 +710,7 @@ See each sub-command's help for details on how to use the generated script. Args: NoArgs, ValidArgsFunction: NoFileCompletions, Hidden: c.CompletionOptions.HiddenDefaultCmd, + GroupID: c.completionCommandGroupID, } c.AddCommand(completionCmd) @@ -688,7 +764,7 @@ to enable it. You can execute the following once: To load completions in your current shell session: - source <(%[1]s completion zsh); compdef _%[1]s %[1]s + source <(%[1]s completion zsh) To load completions for every new session, execute once: @@ -830,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/fish_completions.go b/vendor/github.com/spf13/cobra/fish_completions.go index 005ee6be7..12d61b691 100644 --- a/vendor/github.com/spf13/cobra/fish_completions.go +++ b/vendor/github.com/spf13/cobra/fish_completions.go @@ -1,3 +1,17 @@ +// Copyright 2013-2023 The Cobra 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 cobra import ( @@ -39,7 +53,7 @@ function __%[1]s_perform_completion __%[1]s_debug "last arg: $lastArg" # Disable ActiveHelp which is not supported for fish shell - set -l requestComp "%[9]s=0 $args[1] %[3]s $args[2..-1] $lastArg" + set -l requestComp "%[10]s=0 $args[1] %[3]s $args[2..-1] $lastArg" __%[1]s_debug "Calling $requestComp" set -l results (eval $requestComp 2> /dev/null) @@ -75,6 +89,60 @@ function __%[1]s_perform_completion printf "%%s\n" "$directiveLine" end +# this function limits calls to __%[1]s_perform_completion, by caching the result behind $__%[1]s_perform_completion_once_result +function __%[1]s_perform_completion_once + __%[1]s_debug "Starting __%[1]s_perform_completion_once" + + if test -n "$__%[1]s_perform_completion_once_result" + __%[1]s_debug "Seems like a valid result already exists, skipping __%[1]s_perform_completion" + return 0 + end + + set --global __%[1]s_perform_completion_once_result (__%[1]s_perform_completion) + if test -z "$__%[1]s_perform_completion_once_result" + __%[1]s_debug "No completions, probably due to a failure" + return 1 + end + + __%[1]s_debug "Performed completions and set __%[1]s_perform_completion_once_result" + return 0 +end + +# this function is used to clear the $__%[1]s_perform_completion_once_result variable after completions are run +function __%[1]s_clear_perform_completion_once_result + __%[1]s_debug "" + __%[1]s_debug "========= clearing previously set __%[1]s_perform_completion_once_result variable ==========" + set --erase __%[1]s_perform_completion_once_result + __%[1]s_debug "Successfully erased the variable __%[1]s_perform_completion_once_result" +end + +function __%[1]s_requires_order_preservation + __%[1]s_debug "" + __%[1]s_debug "========= checking if order preservation is required ==========" + + __%[1]s_perform_completion_once + if test -z "$__%[1]s_perform_completion_once_result" + __%[1]s_debug "Error determining if order preservation is required" + return 1 + end + + set -l directive (string sub --start 2 $__%[1]s_perform_completion_once_result[-1]) + __%[1]s_debug "Directive is: $directive" + + set -l shellCompDirectiveKeepOrder %[9]d + set -l keeporder (math (math --scale 0 $directive / $shellCompDirectiveKeepOrder) %% 2) + __%[1]s_debug "Keeporder is: $keeporder" + + if test $keeporder -ne 0 + __%[1]s_debug "This does require order preservation" + return 0 + end + + __%[1]s_debug "This doesn't require order preservation" + return 1 +end + + # This function does two things: # - Obtain the completions and store them in the global __%[1]s_comp_results # - Return false if file completion should be performed @@ -85,17 +153,17 @@ function __%[1]s_prepare_completions # Start fresh set --erase __%[1]s_comp_results - set -l results (__%[1]s_perform_completion) - __%[1]s_debug "Completion results: $results" + __%[1]s_perform_completion_once + __%[1]s_debug "Completion results: $__%[1]s_perform_completion_once_result" - if test -z "$results" + if test -z "$__%[1]s_perform_completion_once_result" __%[1]s_debug "No completion, probably due to a failure" # Might as well do file completion, in case it helps return 1 end - set -l directive (string sub --start 2 $results[-1]) - set --global __%[1]s_comp_results $results[1..-2] + set -l directive (string sub --start 2 $__%[1]s_perform_completion_once_result[-1]) + set --global __%[1]s_comp_results $__%[1]s_perform_completion_once_result[1..-2] __%[1]s_debug "Completions are: $__%[1]s_comp_results" __%[1]s_debug "Directive is: $directive" @@ -191,13 +259,17 @@ end # Remove any pre-existing completions for the program since we will be handling all of them. complete -c %[2]s -e +# this will get called after the two calls below and clear the $__%[1]s_perform_completion_once_result global +complete -c %[2]s -n '__%[1]s_clear_perform_completion_once_result' # The call to __%[1]s_prepare_completions will setup __%[1]s_comp_results # which provides the program's completion choices. -complete -c %[2]s -n '__%[1]s_prepare_completions' -f -a '$__%[1]s_comp_results' - +# If this doesn't require order preservation, we don't use the -k flag +complete -c %[2]s -n 'not __%[1]s_requires_order_preservation && __%[1]s_prepare_completions' -f -a '$__%[1]s_comp_results' +# otherwise we use the -k flag +complete -k -c %[2]s -n '__%[1]s_requires_order_preservation && __%[1]s_prepare_completions' -f -a '$__%[1]s_comp_results' `, nameForVar, name, compCmd, ShellCompDirectiveError, ShellCompDirectiveNoSpace, ShellCompDirectiveNoFileComp, - ShellCompDirectiveFilterFileExt, ShellCompDirectiveFilterDirs, activeHelpEnvVar(name))) + ShellCompDirectiveFilterFileExt, ShellCompDirectiveFilterDirs, ShellCompDirectiveKeepOrder, activeHelpEnvVar(name))) } // GenFishCompletion generates fish completion file and writes to the passed writer. diff --git a/vendor/github.com/spf13/cobra/fish_completions.md b/vendor/github.com/spf13/cobra/fish_completions.md deleted file mode 100644 index 19b2ed129..000000000 --- a/vendor/github.com/spf13/cobra/fish_completions.md +++ /dev/null @@ -1,4 +0,0 @@ -## Generating Fish Completions For Your cobra.Command - -Please refer to [Shell Completions](shell_completions.md) for details. - diff --git a/vendor/github.com/spf13/cobra/flag_groups.go b/vendor/github.com/spf13/cobra/flag_groups.go index dc7843119..560612fd3 100644 --- a/vendor/github.com/spf13/cobra/flag_groups.go +++ b/vendor/github.com/spf13/cobra/flag_groups.go @@ -1,9 +1,10 @@ -// Copyright © 2022 Steve Francia . +// Copyright 2013-2023 The Cobra 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 +// +// 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, @@ -22,8 +23,9 @@ import ( ) const ( - requiredAsGroup = "cobra_annotation_required_if_others_set" - 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 @@ -35,7 +37,23 @@ 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) + } + } +} + +// MarkFlagsOneRequired marks the given flags with annotations so that Cobra errors +// if the command is invoked without at least one flag from the given set of flags. +func (c *Command) MarkFlagsOneRequired(flagNames ...string) { + c.mergePersistentFlags() + for _, v := range flagNames { + f := c.Flags().Lookup(v) + 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, oneRequiredAnnotation, append(f.Annotations[oneRequiredAnnotation], strings.Join(flagNames, " "))); err != nil { // Only errs if the flag isn't found. panic(err) } @@ -52,15 +70,15 @@ 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) } } } -// validateFlagGroups validates the mutuallyExclusive/requiredAsGroup logic and returns the +// ValidateFlagGroups validates the mutuallyExclusive/oneRequired/requiredAsGroup logic and returns the // first error encountered. -func (c *Command) validateFlagGroups() error { +func (c *Command) ValidateFlagGroups() error { if c.DisableFlagParsing { return nil } @@ -70,15 +88,20 @@ func (c *Command) validateFlagGroups() error { // groupStatus format is the list of flags as a unique ID, // then a map of each flag name and whether it is set or not. groupStatus := map[string]map[string]bool{} + 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, mutuallyExclusive, mutuallyExclusiveGroupStatus) + processFlagForGroupAnnotation(flags, pflag, requiredAsGroupAnnotation, groupStatus) + processFlagForGroupAnnotation(flags, pflag, oneRequiredAnnotation, oneRequiredGroupStatus) + processFlagForGroupAnnotation(flags, pflag, mutuallyExclusiveAnnotation, mutuallyExclusiveGroupStatus) }) if err := validateRequiredFlagGroups(groupStatus); err != nil { return err } + if err := validateOneRequiredFlagGroups(oneRequiredGroupStatus); err != nil { + return err + } if err := validateExclusiveFlagGroups(mutuallyExclusiveGroupStatus); err != nil { return err } @@ -107,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 } @@ -141,6 +164,27 @@ func validateRequiredFlagGroups(data map[string]map[string]bool) error { return nil } +func validateOneRequiredFlagGroups(data map[string]map[string]bool) error { + keys := sortedKeys(data) + for _, flagList := range keys { + flagnameAndStatus := data[flagList] + var set []string + for flagname, isSet := range flagnameAndStatus { + if isSet { + set = append(set, flagname) + } + } + if len(set) >= 1 { + continue + } + + // Sort values, so they can be tested/scripted against consistently. + sort.Strings(set) + return fmt.Errorf("at least one of the flags in the group [%v] is required", flagList) + } + return nil +} + func validateExclusiveFlagGroups(data map[string]map[string]bool) error { keys := sortedKeys(data) for _, flagList := range keys { @@ -175,6 +219,7 @@ func sortedKeys(m map[string]map[string]bool) []string { // enforceFlagGroupsForCompletion will do the following: // - when a flag in a group is present, other flags in the group will be marked required +// - when none of the flags in a one-required group are present, all flags in the group will be marked required // - when a flag in a mutually exclusive group is present, other flags in the group will be marked as hidden // This allows the standard completion logic to behave appropriately for flag groups func (c *Command) enforceFlagGroupsForCompletion() { @@ -184,10 +229,12 @@ func (c *Command) enforceFlagGroupsForCompletion() { flags := c.Flags() groupStatus := map[string]map[string]bool{} + 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, 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 @@ -203,6 +250,26 @@ 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 { + isSet := false + + for _, isSet = range flagnameAndStatus { + if isSet { + break + } + } + + // None of the flags of the group are set, mark all flags in the group + // as required + if !isSet { + for _, fName := range strings.Split(flagList, " ") { + _ = c.MarkFlagRequired(fName) + } + } + } + // If a flag that is mutually exclusive to others is present, we hide the other // flags of that group so the shell completion does not suggest them for flagList, flagnameAndStatus := range mutuallyExclusiveGroupStatus { diff --git a/vendor/github.com/spf13/cobra/powershell_completions.go b/vendor/github.com/spf13/cobra/powershell_completions.go index 379e7c088..a830b7bca 100644 --- a/vendor/github.com/spf13/cobra/powershell_completions.go +++ b/vendor/github.com/spf13/cobra/powershell_completions.go @@ -1,3 +1,17 @@ +// Copyright 2013-2023 The Cobra 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. + // The generated scripts require PowerShell v5.0+ (which comes Windows 10, but // can be downloaded separately for windows 7 or 8.1). @@ -8,9 +22,15 @@ import ( "fmt" "io" "os" + "strings" ) func genPowerShellComp(buf io.StringWriter, name string, includeDesc bool) { + // Variables should not contain a '-' or ':' character + nameForVar := name + nameForVar = strings.ReplaceAll(nameForVar, "-", "_") + nameForVar = strings.ReplaceAll(nameForVar, ":", "_") + compCmd := ShellCompRequestCmd if !includeDesc { compCmd = ShellCompNoDescRequestCmd @@ -27,7 +47,7 @@ filter __%[1]s_escapeStringWithSpecialChars { `+" $_ -replace '\\s|#|@|\\$|;|,|''|\\{|\\}|\\(|\\)|\"|`|\\||<|>|&','`$&'"+` } -Register-ArgumentCompleter -CommandName '%[1]s' -ScriptBlock { +[scriptblock]${__%[2]sCompleterBlock} = { param( $WordToComplete, $CommandAst, @@ -52,17 +72,18 @@ Register-ArgumentCompleter -CommandName '%[1]s' -ScriptBlock { } __%[1]s_debug "Truncated command: $Command" - $ShellCompDirectiveError=%[3]d - $ShellCompDirectiveNoSpace=%[4]d - $ShellCompDirectiveNoFileComp=%[5]d - $ShellCompDirectiveFilterFileExt=%[6]d - $ShellCompDirectiveFilterDirs=%[7]d + $ShellCompDirectiveError=%[4]d + $ShellCompDirectiveNoSpace=%[5]d + $ShellCompDirectiveNoFileComp=%[6]d + $ShellCompDirectiveFilterFileExt=%[7]d + $ShellCompDirectiveFilterDirs=%[8]d + $ShellCompDirectiveKeepOrder=%[9]d # Prepare the command to request completions for the program. # Split the command at the first space to separate the program and arguments. $Program,$Arguments = $Command.Split(" ",2) - $RequestComp="$Program %[2]s $Arguments" + $RequestComp="$Program %[3]s $Arguments" __%[1]s_debug "RequestComp: $RequestComp" # we cannot use $WordToComplete because it @@ -86,13 +107,22 @@ Register-ArgumentCompleter -CommandName '%[1]s' -ScriptBlock { # If the last parameter is complete (there is a space following it) # We add an extra empty parameter so we can indicate this to the go method. __%[1]s_debug "Adding extra empty parameter" -`+" # We need to use `\"`\" to pass an empty argument a \"\" or '' does not work!!!"+` -`+" $RequestComp=\"$RequestComp\" + ' `\"`\"'"+` + # PowerShell 7.2+ changed the way how the arguments are passed to executables, + # so for pre-7.2 or when Legacy argument passing is enabled we need to use +`+" # `\"`\" to pass an empty argument, a \"\" or '' does not work!!!"+` + if ($PSVersionTable.PsVersion -lt [version]'7.2.0' -or + ($PSVersionTable.PsVersion -lt [version]'7.3.0' -and -not [ExperimentalFeature]::IsEnabled("PSNativeCommandArgumentPassing")) -or + (($PSVersionTable.PsVersion -ge [version]'7.3.0' -or [ExperimentalFeature]::IsEnabled("PSNativeCommandArgumentPassing")) -and + $PSNativeCommandArgumentPassing -eq 'Legacy')) { +`+" $RequestComp=\"$RequestComp\" + ' `\"`\"'"+` + } else { + $RequestComp="$RequestComp" + ' ""' + } } __%[1]s_debug "Calling $RequestComp" # First disable ActiveHelp which is not supported for Powershell - $env:%[8]s=0 + ${env:%[10]s}=0 #call the command store the output in $out and redirect stderr and stdout to null # $Out is an array contains each line per element @@ -117,7 +147,7 @@ Register-ArgumentCompleter -CommandName '%[1]s' -ScriptBlock { } $Longest = 0 - $Values = $Out | ForEach-Object { + [Array]$Values = $Out | ForEach-Object { #Split the output in name and description `+" $Name, $Description = $_.Split(\"`t\",2)"+` __%[1]s_debug "Name: $Name Description: $Description" @@ -162,6 +192,11 @@ Register-ArgumentCompleter -CommandName '%[1]s' -ScriptBlock { } } + # we sort the values in ascending order by name if keep order isn't passed + if (($Directive -band $ShellCompDirectiveKeepOrder) -eq 0 ) { + $Values = $Values | Sort-Object -Property Name + } + if (($Directive -band $ShellCompDirectiveNoFileComp) -ne 0 ) { __%[1]s_debug "ShellCompDirectiveNoFileComp is called" @@ -243,9 +278,11 @@ Register-ArgumentCompleter -CommandName '%[1]s' -ScriptBlock { } } -`, name, compCmd, + +Register-ArgumentCompleter -CommandName '%[1]s' -ScriptBlock ${__%[2]sCompleterBlock} +`, name, nameForVar, compCmd, ShellCompDirectiveError, ShellCompDirectiveNoSpace, ShellCompDirectiveNoFileComp, - ShellCompDirectiveFilterFileExt, ShellCompDirectiveFilterDirs, activeHelpEnvVar(name))) + ShellCompDirectiveFilterFileExt, ShellCompDirectiveFilterDirs, ShellCompDirectiveKeepOrder, activeHelpEnvVar(name))) } func (c *Command) genPowerShellCompletion(w io.Writer, includeDesc bool) error { diff --git a/vendor/github.com/spf13/cobra/powershell_completions.md b/vendor/github.com/spf13/cobra/powershell_completions.md deleted file mode 100644 index c449f1e5c..000000000 --- a/vendor/github.com/spf13/cobra/powershell_completions.md +++ /dev/null @@ -1,3 +0,0 @@ -# Generating PowerShell Completions For Your Own cobra.Command - -Please refer to [Shell Completions](shell_completions.md#powershell-completions) for details. diff --git a/vendor/github.com/spf13/cobra/projects_using_cobra.md b/vendor/github.com/spf13/cobra/projects_using_cobra.md deleted file mode 100644 index ac680118e..000000000 --- a/vendor/github.com/spf13/cobra/projects_using_cobra.md +++ /dev/null @@ -1,54 +0,0 @@ -## Projects using Cobra - -- [Arduino CLI](https://github.com/arduino/arduino-cli) -- [Bleve](https://blevesearch.com/) -- [CockroachDB](https://www.cockroachlabs.com/) -- [Cosmos SDK](https://github.com/cosmos/cosmos-sdk) -- [Datree](https://github.com/datreeio/datree) -- [Delve](https://github.com/derekparker/delve) -- [Docker (distribution)](https://github.com/docker/distribution) -- [Etcd](https://etcd.io/) -- [Gardener](https://github.com/gardener/gardenctl) -- [Giant Swarm's gsctl](https://github.com/giantswarm/gsctl) -- [Git Bump](https://github.com/erdaltsksn/git-bump) -- [Github CLI](https://github.com/cli/cli) -- [GitHub Labeler](https://github.com/erdaltsksn/gh-label) -- [Golangci-lint](https://golangci-lint.run) -- [GopherJS](https://github.com/gopherjs/gopherjs) -- [GoReleaser](https://goreleaser.com) -- [Helm](https://helm.sh) -- [Hugo](https://gohugo.io) -- [Infracost](https://github.com/infracost/infracost) -- [Istio](https://istio.io) -- [Kool](https://github.com/kool-dev/kool) -- [Kubernetes](https://kubernetes.io/) -- [Kubescape](https://github.com/armosec/kubescape) -- [Linkerd](https://linkerd.io/) -- [Mattermost-server](https://github.com/mattermost/mattermost-server) -- [Mercure](https://mercure.rocks/) -- [Meroxa CLI](https://github.com/meroxa/cli) -- [Metal Stack CLI](https://github.com/metal-stack/metalctl) -- [Moby (former Docker)](https://github.com/moby/moby) -- [Moldy](https://github.com/Moldy-Community/moldy) -- [Multi-gitter](https://github.com/lindell/multi-gitter) -- [Nanobox](https://github.com/nanobox-io/nanobox)/[Nanopack](https://github.com/nanopack) -- [nFPM](https://nfpm.goreleaser.com) -- [OpenShift](https://www.openshift.com/) -- [Ory Hydra](https://github.com/ory/hydra) -- [Ory Kratos](https://github.com/ory/kratos) -- [Pixie](https://github.com/pixie-io/pixie) -- [Polygon Edge](https://github.com/0xPolygon/polygon-edge) -- [Pouch](https://github.com/alibaba/pouch) -- [ProjectAtomic (enterprise)](https://www.projectatomic.io/) -- [Prototool](https://github.com/uber/prototool) -- [Pulumi](https://www.pulumi.com) -- [QRcp](https://github.com/claudiodangelis/qrcp) -- [Random](https://github.com/erdaltsksn/random) -- [Rclone](https://rclone.org/) -- [Scaleway CLI](https://github.com/scaleway/scaleway-cli) -- [Skaffold](https://skaffold.dev/) -- [Tendermint](https://github.com/tendermint/tendermint) -- [Twitch CLI](https://github.com/twitchdev/twitch-cli) -- [UpCloud CLI (`upctl`)](https://github.com/UpCloudLtd/upcloud-cli) -- VMware's [Tanzu Community Edition](https://github.com/vmware-tanzu/community-edition) & [Tanzu Framework](https://github.com/vmware-tanzu/tanzu-framework) -- [Werf](https://werf.io/) diff --git a/vendor/github.com/spf13/cobra/shell_completions.go b/vendor/github.com/spf13/cobra/shell_completions.go index d99bf91e5..b035742d3 100644 --- a/vendor/github.com/spf13/cobra/shell_completions.go +++ b/vendor/github.com/spf13/cobra/shell_completions.go @@ -1,3 +1,17 @@ +// Copyright 2013-2023 The Cobra 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 cobra import ( diff --git a/vendor/github.com/spf13/cobra/shell_completions.md b/vendor/github.com/spf13/cobra/shell_completions.md deleted file mode 100644 index 1e2058ed6..000000000 --- a/vendor/github.com/spf13/cobra/shell_completions.md +++ /dev/null @@ -1,548 +0,0 @@ -# Generating shell completions - -Cobra can generate shell completions for multiple shells. -The currently supported shells are: -- Bash -- Zsh -- fish -- PowerShell - -Cobra will automatically provide your program with a fully functional `completion` command, -similarly to how it provides the `help` command. - -## Creating your own completion command - -If you do not wish to use the default `completion` command, you can choose to -provide your own, which will take precedence over the default one. (This also provides -backwards-compatibility with programs that already have their own `completion` command.) - -If you are using the `cobra-cli` generator, -which can be found at [spf13/cobra-cli](https://github.com/spf13/cobra-cli), -you can create a completion command by running - -```bash -cobra-cli add completion -``` -and then modifying the generated `cmd/completion.go` file to look something like this -(writing the shell script to stdout allows the most flexible use): - -```go -var completionCmd = &cobra.Command{ - Use: "completion [bash|zsh|fish|powershell]", - Short: "Generate completion script", - Long: fmt.Sprintf(`To load completions: - -Bash: - - $ source <(%[1]s completion bash) - - # To load completions for each session, execute once: - # Linux: - $ %[1]s completion bash > /etc/bash_completion.d/%[1]s - # macOS: - $ %[1]s completion bash > $(brew --prefix)/etc/bash_completion.d/%[1]s - -Zsh: - - # If shell completion is not already enabled in your environment, - # you will need to enable it. You can execute the following once: - - $ echo "autoload -U compinit; compinit" >> ~/.zshrc - - # To load completions for each session, execute once: - $ %[1]s completion zsh > "${fpath[1]}/_%[1]s" - - # You will need to start a new shell for this setup to take effect. - -fish: - - $ %[1]s completion fish | source - - # To load completions for each session, execute once: - $ %[1]s completion fish > ~/.config/fish/completions/%[1]s.fish - -PowerShell: - - PS> %[1]s completion powershell | Out-String | Invoke-Expression - - # To load completions for every new session, run: - PS> %[1]s completion powershell > %[1]s.ps1 - # and source this file from your PowerShell profile. -`,cmd.Root().Name()), - DisableFlagsInUseLine: true, - ValidArgs: []string{"bash", "zsh", "fish", "powershell"}, - Args: cobra.ExactValidArgs(1), - Run: func(cmd *cobra.Command, args []string) { - switch args[0] { - case "bash": - cmd.Root().GenBashCompletion(os.Stdout) - case "zsh": - cmd.Root().GenZshCompletion(os.Stdout) - case "fish": - cmd.Root().GenFishCompletion(os.Stdout, true) - case "powershell": - cmd.Root().GenPowerShellCompletionWithDesc(os.Stdout) - } - }, -} -``` - -**Note:** The cobra generator may include messages printed to stdout, for example, if the config file is loaded; this will break the auto-completion script so must be removed. - -## Adapting the default completion command - -Cobra provides a few options for the default `completion` command. To configure such options you must set -the `CompletionOptions` field on the *root* command. - -To tell Cobra *not* to provide the default `completion` command: -``` -rootCmd.CompletionOptions.DisableDefaultCmd = true -``` - -To tell Cobra *not* to provide the user with the `--no-descriptions` flag to the completion sub-commands: -``` -rootCmd.CompletionOptions.DisableNoDescFlag = true -``` - -To tell Cobra to completely disable descriptions for completions: -``` -rootCmd.CompletionOptions.DisableDescriptions = true -``` - -# Customizing completions - -The generated completion scripts will automatically handle completing commands and flags. However, you can make your completions much more powerful by providing information to complete your program's nouns and flag values. - -## Completion of nouns - -### Static completion of nouns - -Cobra allows you to provide a pre-defined list of completion choices for your nouns using the `ValidArgs` field. -For example, if you want `kubectl get [tab][tab]` to show a list of valid "nouns" you have to set them. -Some simplified code from `kubectl get` looks like: - -```go -validArgs = []string{ "pod", "node", "service", "replicationcontroller" } - -cmd := &cobra.Command{ - Use: "get [(-o|--output=)json|yaml|template|...] (RESOURCE [NAME] | RESOURCE/NAME ...)", - Short: "Display one or many resources", - Long: get_long, - Example: get_example, - Run: func(cmd *cobra.Command, args []string) { - cobra.CheckErr(RunGet(f, out, cmd, args)) - }, - ValidArgs: validArgs, -} -``` - -Notice we put the `ValidArgs` field on the `get` sub-command. Doing so will give results like: - -```bash -$ kubectl get [tab][tab] -node pod replicationcontroller service -``` - -#### Aliases for nouns - -If your nouns have aliases, you can define them alongside `ValidArgs` using `ArgAliases`: - -```go -argAliases = []string { "pods", "nodes", "services", "svc", "replicationcontrollers", "rc" } - -cmd := &cobra.Command{ - ... - ValidArgs: validArgs, - ArgAliases: argAliases -} -``` - -The aliases are not shown to the user on tab completion, but they are accepted as valid nouns by -the completion algorithm if entered manually, e.g. in: - -```bash -$ kubectl get rc [tab][tab] -backend frontend database -``` - -Note that without declaring `rc` as an alias, the completion algorithm would not know to show the list of -replication controllers following `rc`. - -### Dynamic completion of nouns - -In some cases it is not possible to provide a list of completions in advance. Instead, the list of completions must be determined at execution-time. In a similar fashion as for static completions, you can use the `ValidArgsFunction` field to provide a Go function that Cobra will execute when it needs the list of completion choices for the nouns of a command. Note that either `ValidArgs` or `ValidArgsFunction` can be used for a single cobra command, but not both. -Simplified code from `helm status` looks like: - -```go -cmd := &cobra.Command{ - Use: "status RELEASE_NAME", - Short: "Display the status of the named release", - Long: status_long, - RunE: func(cmd *cobra.Command, args []string) { - RunGet(args[0]) - }, - ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - if len(args) != 0 { - return nil, cobra.ShellCompDirectiveNoFileComp - } - return getReleasesFromCluster(toComplete), cobra.ShellCompDirectiveNoFileComp - }, -} -``` -Where `getReleasesFromCluster()` is a Go function that obtains the list of current Helm releases running on the Kubernetes cluster. -Notice we put the `ValidArgsFunction` on the `status` sub-command. Let's assume the Helm releases on the cluster are: `harbor`, `notary`, `rook` and `thanos` then this dynamic completion will give results like: - -```bash -$ helm status [tab][tab] -harbor notary rook thanos -``` -You may have noticed the use of `cobra.ShellCompDirective`. These directives are bit fields allowing to control some shell completion behaviors for your particular completion. You can combine them with the bit-or operator such as `cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp` -```go -// Indicates that the shell will perform its default behavior after completions -// have been provided (this implies none of the other directives). -ShellCompDirectiveDefault - -// Indicates an error occurred and completions should be ignored. -ShellCompDirectiveError - -// Indicates that the shell should not add a space after the completion, -// even if there is a single completion provided. -ShellCompDirectiveNoSpace - -// Indicates that the shell should not provide file completion even when -// no completion is provided. -ShellCompDirectiveNoFileComp - -// Indicates that the returned completions should be used as file extension filters. -// For example, to complete only files of the form *.json or *.yaml: -// return []string{"yaml", "json"}, ShellCompDirectiveFilterFileExt -// For flags, using MarkFlagFilename() and MarkPersistentFlagFilename() -// is a shortcut to using this directive explicitly. -// -ShellCompDirectiveFilterFileExt - -// Indicates that only directory names should be provided in file completion. -// For example: -// return nil, ShellCompDirectiveFilterDirs -// For flags, using MarkFlagDirname() is a shortcut to using this directive explicitly. -// -// To request directory names within another directory, the returned completions -// should specify a single directory name within which to search. For example, -// to complete directories within "themes/": -// return []string{"themes"}, ShellCompDirectiveFilterDirs -// -ShellCompDirectiveFilterDirs -``` - -***Note***: When using the `ValidArgsFunction`, Cobra will call your registered function after having parsed all flags and arguments provided in the command-line. You therefore don't need to do this parsing yourself. For example, when a user calls `helm status --namespace my-rook-ns [tab][tab]`, Cobra will call your registered `ValidArgsFunction` after having parsed the `--namespace` flag, as it would have done when calling the `RunE` function. - -#### Debugging - -Cobra achieves dynamic completion through the use of a hidden command called by the completion script. To debug your Go completion code, you can call this hidden command directly: -```bash -$ helm __complete status har -harbor -:4 -Completion ended with directive: ShellCompDirectiveNoFileComp # This is on stderr -``` -***Important:*** If the noun to complete is empty (when the user has not yet typed any letters of that noun), you must pass an empty parameter to the `__complete` command: -```bash -$ helm __complete status "" -harbor -notary -rook -thanos -:4 -Completion ended with directive: ShellCompDirectiveNoFileComp # This is on stderr -``` -Calling the `__complete` command directly allows you to run the Go debugger to troubleshoot your code. You can also add printouts to your code; Cobra provides the following functions to use for printouts in Go completion code: -```go -// Prints to the completion script debug file (if BASH_COMP_DEBUG_FILE -// is set to a file path) and optionally prints to stderr. -cobra.CompDebug(msg string, printToStdErr bool) { -cobra.CompDebugln(msg string, printToStdErr bool) - -// Prints to the completion script debug file (if BASH_COMP_DEBUG_FILE -// is set to a file path) and to stderr. -cobra.CompError(msg string) -cobra.CompErrorln(msg string) -``` -***Important:*** You should **not** leave traces that print directly to stdout in your completion code as they will be interpreted as completion choices by the completion script. Instead, use the cobra-provided debugging traces functions mentioned above. - -## Completions for flags - -### Mark flags as required - -Most of the time completions will only show sub-commands. But if a flag is required to make a sub-command work, you probably want it to show up when the user types [tab][tab]. You can mark a flag as 'Required' like so: - -```go -cmd.MarkFlagRequired("pod") -cmd.MarkFlagRequired("container") -``` - -and you'll get something like - -```bash -$ kubectl exec [tab][tab] --c --container= -p --pod= -``` - -### Specify dynamic flag completion - -As for nouns, Cobra provides a way of defining dynamic completion of flags. To provide a Go function that Cobra will execute when it needs the list of completion choices for a flag, you must register the function using the `command.RegisterFlagCompletionFunc()` function. - -```go -flagName := "output" -cmd.RegisterFlagCompletionFunc(flagName, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return []string{"json", "table", "yaml"}, cobra.ShellCompDirectiveDefault -}) -``` -Notice that calling `RegisterFlagCompletionFunc()` is done through the `command` with which the flag is associated. In our example this dynamic completion will give results like so: - -```bash -$ helm status --output [tab][tab] -json table yaml -``` - -#### Debugging - -You can also easily debug your Go completion code for flags: -```bash -$ helm __complete status --output "" -json -table -yaml -:4 -Completion ended with directive: ShellCompDirectiveNoFileComp # This is on stderr -``` -***Important:*** You should **not** leave traces that print to stdout in your completion code as they will be interpreted as completion choices by the completion script. Instead, use the cobra-provided debugging traces functions mentioned further above. - -### Specify valid filename extensions for flags that take a filename - -To limit completions of flag values to file names with certain extensions you can either use the different `MarkFlagFilename()` functions or a combination of `RegisterFlagCompletionFunc()` and `ShellCompDirectiveFilterFileExt`, like so: -```go -flagName := "output" -cmd.MarkFlagFilename(flagName, "yaml", "json") -``` -or -```go -flagName := "output" -cmd.RegisterFlagCompletionFunc(flagName, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return []string{"yaml", "json"}, ShellCompDirectiveFilterFileExt}) -``` - -### Limit flag completions to directory names - -To limit completions of flag values to directory names you can either use the `MarkFlagDirname()` functions or a combination of `RegisterFlagCompletionFunc()` and `ShellCompDirectiveFilterDirs`, like so: -```go -flagName := "output" -cmd.MarkFlagDirname(flagName) -``` -or -```go -flagName := "output" -cmd.RegisterFlagCompletionFunc(flagName, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return nil, cobra.ShellCompDirectiveFilterDirs -}) -``` -To limit completions of flag values to directory names *within another directory* you can use a combination of `RegisterFlagCompletionFunc()` and `ShellCompDirectiveFilterDirs` like so: -```go -flagName := "output" -cmd.RegisterFlagCompletionFunc(flagName, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return []string{"themes"}, cobra.ShellCompDirectiveFilterDirs -}) -``` -### Descriptions for completions - -Cobra provides support for completion descriptions. Such descriptions are supported for each shell -(however, for bash, it is only available in the [completion V2 version](#bash-completion-v2)). -For commands and flags, Cobra will provide the descriptions automatically, based on usage information. -For example, using zsh: -``` -$ helm s[tab] -search -- search for a keyword in charts -show -- show information of a chart -status -- displays the status of the named release -``` -while using fish: -``` -$ helm s[tab] -search (search for a keyword in charts) show (show information of a chart) status (displays the status of the named release) -``` - -Cobra allows you to add descriptions to your own completions. Simply add the description text after each completion, following a `\t` separator. This technique applies to completions returned by `ValidArgs`, `ValidArgsFunction` and `RegisterFlagCompletionFunc()`. For example: -```go -ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return []string{"harbor\tAn image registry", "thanos\tLong-term metrics"}, cobra.ShellCompDirectiveNoFileComp -}} -``` -or -```go -ValidArgs: []string{"bash\tCompletions for bash", "zsh\tCompletions for zsh"} -``` -## Bash completions - -### Dependencies - -The bash completion script generated by Cobra requires the `bash_completion` package. You should update the help text of your completion command to show how to install the `bash_completion` package ([Kubectl docs](https://kubernetes.io/docs/tasks/tools/install-kubectl/#enabling-shell-autocompletion)) - -### Aliases - -You can also configure `bash` aliases for your program and they will also support completions. - -```bash -alias aliasname=origcommand -complete -o default -F __start_origcommand aliasname - -# and now when you run `aliasname` completion will make -# suggestions as it did for `origcommand`. - -$ aliasname -completion firstcommand secondcommand -``` -### Bash legacy dynamic completions - -For backward compatibility, Cobra still supports its bash legacy dynamic completion solution. -Please refer to [Bash Completions](bash_completions.md) for details. - -### Bash completion V2 - -Cobra provides two versions for bash completion. The original bash completion (which started it all!) can be used by calling -`GenBashCompletion()` or `GenBashCompletionFile()`. - -A new V2 bash completion version is also available. This version can be used by calling `GenBashCompletionV2()` or -`GenBashCompletionFileV2()`. The V2 version does **not** support the legacy dynamic completion -(see [Bash Completions](bash_completions.md)) but instead works only with the Go dynamic completion -solution described in this document. -Unless your program already uses the legacy dynamic completion solution, it is recommended that you use the bash -completion V2 solution which provides the following extra features: -- Supports completion descriptions (like the other shells) -- Small completion script of less than 300 lines (v1 generates scripts of thousands of lines; `kubectl` for example has a bash v1 completion script of over 13K lines) -- Streamlined user experience thanks to a completion behavior aligned with the other shells - -`Bash` completion V2 supports descriptions for completions. When calling `GenBashCompletionV2()` or `GenBashCompletionFileV2()` -you must provide these functions with a parameter indicating if the completions should be annotated with a description; Cobra -will provide the description automatically based on usage information. You can choose to make this option configurable by -your users. - -``` -# With descriptions -$ helm s[tab][tab] -search (search for a keyword in charts) status (display the status of the named release) -show (show information of a chart) - -# Without descriptions -$ helm s[tab][tab] -search show status -``` -**Note**: Cobra's default `completion` command uses bash completion V2. If for some reason you need to use bash completion V1, you will need to implement your own `completion` command. -## Zsh completions - -Cobra supports native zsh completion generated from the root `cobra.Command`. -The generated completion script should be put somewhere in your `$fpath` and be named -`_`. You will need to start a new shell for the completions to become available. - -Zsh supports descriptions for completions. Cobra will provide the description automatically, -based on usage information. Cobra provides a way to completely disable such descriptions by -using `GenZshCompletionNoDesc()` or `GenZshCompletionFileNoDesc()`. You can choose to make -this a configurable option to your users. -``` -# With descriptions -$ helm s[tab] -search -- search for a keyword in charts -show -- show information of a chart -status -- displays the status of the named release - -# Without descriptions -$ helm s[tab] -search show status -``` -*Note*: Because of backward-compatibility requirements, we were forced to have a different API to disable completion descriptions between `zsh` and `fish`. - -### Limitations - -* Custom completions implemented in Bash scripting (legacy) are not supported and will be ignored for `zsh` (including the use of the `BashCompCustom` flag annotation). - * You should instead use `ValidArgsFunction` and `RegisterFlagCompletionFunc()` which are portable to the different shells (`bash`, `zsh`, `fish`, `powershell`). -* The function `MarkFlagCustom()` is not supported and will be ignored for `zsh`. - * You should instead use `RegisterFlagCompletionFunc()`. - -### Zsh completions standardization - -Cobra 1.1 standardized its zsh completion support to align it with its other shell completions. Although the API was kept backward-compatible, some small changes in behavior were introduced. -Please refer to [Zsh Completions](zsh_completions.md) for details. - -## fish completions - -Cobra supports native fish completions generated from the root `cobra.Command`. You can use the `command.GenFishCompletion()` or `command.GenFishCompletionFile()` functions. You must provide these functions with a parameter indicating if the completions should be annotated with a description; Cobra will provide the description automatically based on usage information. You can choose to make this option configurable by your users. -``` -# With descriptions -$ helm s[tab] -search (search for a keyword in charts) show (show information of a chart) status (displays the status of the named release) - -# Without descriptions -$ helm s[tab] -search show status -``` -*Note*: Because of backward-compatibility requirements, we were forced to have a different API to disable completion descriptions between `zsh` and `fish`. - -### Limitations - -* Custom completions implemented in bash scripting (legacy) are not supported and will be ignored for `fish` (including the use of the `BashCompCustom` flag annotation). - * You should instead use `ValidArgsFunction` and `RegisterFlagCompletionFunc()` which are portable to the different shells (`bash`, `zsh`, `fish`, `powershell`). -* The function `MarkFlagCustom()` is not supported and will be ignored for `fish`. - * You should instead use `RegisterFlagCompletionFunc()`. -* The following flag completion annotations are not supported and will be ignored for `fish`: - * `BashCompFilenameExt` (filtering by file extension) - * `BashCompSubdirsInDir` (filtering by directory) -* The functions corresponding to the above annotations are consequently not supported and will be ignored for `fish`: - * `MarkFlagFilename()` and `MarkPersistentFlagFilename()` (filtering by file extension) - * `MarkFlagDirname()` and `MarkPersistentFlagDirname()` (filtering by directory) -* Similarly, the following completion directives are not supported and will be ignored for `fish`: - * `ShellCompDirectiveFilterFileExt` (filtering by file extension) - * `ShellCompDirectiveFilterDirs` (filtering by directory) - -## PowerShell completions - -Cobra supports native PowerShell completions generated from the root `cobra.Command`. You can use the `command.GenPowerShellCompletion()` or `command.GenPowerShellCompletionFile()` functions. To include descriptions use `command.GenPowerShellCompletionWithDesc()` and `command.GenPowerShellCompletionFileWithDesc()`. Cobra will provide the description automatically based on usage information. You can choose to make this option configurable by your users. - -The script is designed to support all three PowerShell completion modes: - -* TabCompleteNext (default windows style - on each key press the next option is displayed) -* Complete (works like bash) -* MenuComplete (works like zsh) - -You set the mode with `Set-PSReadLineKeyHandler -Key Tab -Function `. Descriptions are only displayed when using the `Complete` or `MenuComplete` mode. - -Users need PowerShell version 5.0 or above, which comes with Windows 10 and can be downloaded separately for Windows 7 or 8.1. They can then write the completions to a file and source this file from their PowerShell profile, which is referenced by the `$Profile` environment variable. See `Get-Help about_Profiles` for more info about PowerShell profiles. - -``` -# With descriptions and Mode 'Complete' -$ helm s[tab] -search (search for a keyword in charts) show (show information of a chart) status (displays the status of the named release) - -# With descriptions and Mode 'MenuComplete' The description of the current selected value will be displayed below the suggestions. -$ helm s[tab] -search show status - -search for a keyword in charts - -# Without descriptions -$ helm s[tab] -search show status -``` - -### Limitations - -* Custom completions implemented in bash scripting (legacy) are not supported and will be ignored for `powershell` (including the use of the `BashCompCustom` flag annotation). - * You should instead use `ValidArgsFunction` and `RegisterFlagCompletionFunc()` which are portable to the different shells (`bash`, `zsh`, `fish`, `powershell`). -* The function `MarkFlagCustom()` is not supported and will be ignored for `powershell`. - * You should instead use `RegisterFlagCompletionFunc()`. -* The following flag completion annotations are not supported and will be ignored for `powershell`: - * `BashCompFilenameExt` (filtering by file extension) - * `BashCompSubdirsInDir` (filtering by directory) -* The functions corresponding to the above annotations are consequently not supported and will be ignored for `powershell`: - * `MarkFlagFilename()` and `MarkPersistentFlagFilename()` (filtering by file extension) - * `MarkFlagDirname()` and `MarkPersistentFlagDirname()` (filtering by directory) -* Similarly, the following completion directives are not supported and will be ignored for `powershell`: - * `ShellCompDirectiveFilterFileExt` (filtering by file extension) - * `ShellCompDirectiveFilterDirs` (filtering by directory) diff --git a/vendor/github.com/spf13/cobra/user_guide.md b/vendor/github.com/spf13/cobra/user_guide.md deleted file mode 100644 index 5a7acf88e..000000000 --- a/vendor/github.com/spf13/cobra/user_guide.md +++ /dev/null @@ -1,666 +0,0 @@ -# User Guide - -While you are welcome to provide your own organization, typically a Cobra-based -application will follow the following organizational structure: - -``` - ▾ appName/ - ▾ cmd/ - add.go - your.go - commands.go - here.go - main.go -``` - -In a Cobra app, typically the main.go file is very bare. It serves one purpose: initializing Cobra. - -```go -package main - -import ( - "{pathToYourApp}/cmd" -) - -func main() { - cmd.Execute() -} -``` - -## Using the Cobra Generator - -Cobra-CLI is its own program that will create your application and add any -commands you want. It's the easiest way to incorporate Cobra into your application. - -For complete details on using the Cobra generator, please refer to [The Cobra-CLI Generator README](https://github.com/spf13/cobra-cli/blob/main/README.md) - -## Using the Cobra Library - -To manually implement Cobra you need to create a bare main.go file and a rootCmd file. -You will optionally provide additional commands as you see fit. - -### Create rootCmd - -Cobra doesn't require any special constructors. Simply create your commands. - -Ideally you place this in app/cmd/root.go: - -```go -var rootCmd = &cobra.Command{ - Use: "hugo", - Short: "Hugo is a very fast static site generator", - Long: `A Fast and Flexible Static Site Generator built with - love by spf13 and friends in Go. - Complete documentation is available at https://gohugo.io/documentation/`, - Run: func(cmd *cobra.Command, args []string) { - // Do Stuff Here - }, -} - -func Execute() { - if err := rootCmd.Execute(); err != nil { - fmt.Fprintln(os.Stderr, err) - os.Exit(1) - } -} -``` - -You will additionally define flags and handle configuration in your init() function. - -For example cmd/root.go: - -```go -package cmd - -import ( - "fmt" - "os" - - "github.com/spf13/cobra" - "github.com/spf13/viper" -) - -var ( - // Used for flags. - cfgFile string - userLicense string - - rootCmd = &cobra.Command{ - Use: "cobra-cli", - Short: "A generator for Cobra based Applications", - Long: `Cobra is a CLI library for Go that empowers applications. -This application is a tool to generate the needed files -to quickly create a Cobra application.`, - } -) - -// Execute executes the root command. -func Execute() error { - return rootCmd.Execute() -} - -func init() { - cobra.OnInitialize(initConfig) - - rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.cobra.yaml)") - rootCmd.PersistentFlags().StringP("author", "a", "YOUR NAME", "author name for copyright attribution") - rootCmd.PersistentFlags().StringVarP(&userLicense, "license", "l", "", "name of license for the project") - rootCmd.PersistentFlags().Bool("viper", true, "use Viper for configuration") - viper.BindPFlag("author", rootCmd.PersistentFlags().Lookup("author")) - viper.BindPFlag("useViper", rootCmd.PersistentFlags().Lookup("viper")) - viper.SetDefault("author", "NAME HERE ") - viper.SetDefault("license", "apache") - - rootCmd.AddCommand(addCmd) - rootCmd.AddCommand(initCmd) -} - -func initConfig() { - if cfgFile != "" { - // Use config file from the flag. - viper.SetConfigFile(cfgFile) - } else { - // Find home directory. - home, err := os.UserHomeDir() - cobra.CheckErr(err) - - // Search config in home directory with name ".cobra" (without extension). - viper.AddConfigPath(home) - viper.SetConfigType("yaml") - viper.SetConfigName(".cobra") - } - - viper.AutomaticEnv() - - if err := viper.ReadInConfig(); err == nil { - fmt.Println("Using config file:", viper.ConfigFileUsed()) - } -} -``` - -### Create your main.go - -With the root command you need to have your main function execute it. -Execute should be run on the root for clarity, though it can be called on any command. - -In a Cobra app, typically the main.go file is very bare. It serves one purpose: to initialize Cobra. - -```go -package main - -import ( - "{pathToYourApp}/cmd" -) - -func main() { - cmd.Execute() -} -``` - -### Create additional commands - -Additional commands can be defined and typically are each given their own file -inside of the cmd/ directory. - -If you wanted to create a version command you would create cmd/version.go and -populate it with the following: - -```go -package cmd - -import ( - "fmt" - - "github.com/spf13/cobra" -) - -func init() { - rootCmd.AddCommand(versionCmd) -} - -var versionCmd = &cobra.Command{ - Use: "version", - Short: "Print the version number of Hugo", - Long: `All software has versions. This is Hugo's`, - Run: func(cmd *cobra.Command, args []string) { - fmt.Println("Hugo Static Site Generator v0.9 -- HEAD") - }, -} -``` - -### Returning and handling errors - -If you wish to return an error to the caller of a command, `RunE` can be used. - -```go -package cmd - -import ( - "fmt" - - "github.com/spf13/cobra" -) - -func init() { - rootCmd.AddCommand(tryCmd) -} - -var tryCmd = &cobra.Command{ - Use: "try", - Short: "Try and possibly fail at something", - RunE: func(cmd *cobra.Command, args []string) error { - if err := someFunc(); err != nil { - return err - } - return nil - }, -} -``` - -The error can then be caught at the execute function call. - -## Working with Flags - -Flags provide modifiers to control how the action command operates. - -### Assign flags to a command - -Since the flags are defined and used in different locations, we need to -define a variable outside with the correct scope to assign the flag to -work with. - -```go -var Verbose bool -var Source string -``` - -There are two different approaches to assign a flag. - -### Persistent Flags - -A flag can be 'persistent', meaning that this flag will be available to the -command it's assigned to as well as every command under that command. For -global flags, assign a flag as a persistent flag on the root. - -```go -rootCmd.PersistentFlags().BoolVarP(&Verbose, "verbose", "v", false, "verbose output") -``` - -### Local Flags - -A flag can also be assigned locally, which will only apply to that specific command. - -```go -localCmd.Flags().StringVarP(&Source, "source", "s", "", "Source directory to read from") -``` - -### Local Flag on Parent Commands - -By default, Cobra only parses local flags on the target command, and any local flags on -parent commands are ignored. By enabling `Command.TraverseChildren`, Cobra will -parse local flags on each command before executing the target command. - -```go -command := cobra.Command{ - Use: "print [OPTIONS] [COMMANDS]", - TraverseChildren: true, -} -``` - -### Bind Flags with Config - -You can also bind your flags with [viper](https://github.com/spf13/viper): -```go -var author string - -func init() { - rootCmd.PersistentFlags().StringVar(&author, "author", "YOUR NAME", "Author name for copyright attribution") - viper.BindPFlag("author", rootCmd.PersistentFlags().Lookup("author")) -} -``` - -In this example, the persistent flag `author` is bound with `viper`. -**Note**: the variable `author` will not be set to the value from config, -when the `--author` flag is provided by user. - -More in [viper documentation](https://github.com/spf13/viper#working-with-flags). - -### Required flags - -Flags are optional by default. If instead you wish your command to report an error -when a flag has not been set, mark it as required: -```go -rootCmd.Flags().StringVarP(&Region, "region", "r", "", "AWS region (required)") -rootCmd.MarkFlagRequired("region") -``` - -Or, for persistent flags: -```go -rootCmd.PersistentFlags().StringVarP(&Region, "region", "r", "", "AWS region (required)") -rootCmd.MarkPersistentFlagRequired("region") -``` - -### Flag Groups - -If you have different flags that must be provided together (e.g. if they provide the `--username` flag they MUST provide the `--password` flag as well) then -Cobra can enforce that requirement: -```go -rootCmd.Flags().StringVarP(&u, "username", "u", "", "Username (required if password is set)") -rootCmd.Flags().StringVarP(&pw, "password", "p", "", "Password (required if username is set)") -rootCmd.MarkFlagsRequiredTogether("username", "password") -``` - -You can also prevent different flags from being provided together if they represent mutually -exclusive options such as specifying an output format as either `--json` or `--yaml` but never both: -```go -rootCmd.Flags().BoolVar(&u, "json", false, "Output in JSON") -rootCmd.Flags().BoolVar(&pw, "yaml", false, "Output in YAML") -rootCmd.MarkFlagsMutuallyExclusive("json", "yaml") -``` - -In both of these cases: - - both local and persistent flags can be used - - **NOTE:** the group is only enforced on commands where every flag is defined - - a flag may appear in multiple groups - - a group may contain any number of flags - -## Positional and Custom Arguments - -Validation of positional arguments can be specified using the `Args` field of `Command`. -If `Args` is undefined or `nil`, it defaults to `ArbitraryArgs`. - -The following validators are built in: - -- `NoArgs` - the command will report an error if there are any positional args. -- `ArbitraryArgs` - the command will accept any args. -- `OnlyValidArgs` - the command will report an error if there are any positional args that are not in the `ValidArgs` field of `Command`. -- `MinimumNArgs(int)` - the command will report an error if there are not at least N positional args. -- `MaximumNArgs(int)` - the command will report an error if there are more than N positional args. -- `ExactArgs(int)` - the command will report an error if there are not exactly N positional args. -- `ExactValidArgs(int)` - the command will report an error if there are not exactly N positional args OR if there are any positional args that are not in the `ValidArgs` field of `Command` -- `RangeArgs(min, max)` - the command will report an error if the number of args is not between the minimum and maximum number of expected args. -- `MatchAll(pargs ...PositionalArgs)` - enables combining existing checks with arbitrary other checks (e.g. you want to check the ExactArgs length along with other qualities). - -An example of setting the custom validator: - -```go -var cmd = &cobra.Command{ - Short: "hello", - Args: func(cmd *cobra.Command, args []string) error { - if len(args) < 1 { - return errors.New("requires a color argument") - } - if myapp.IsValidColor(args[0]) { - return nil - } - return fmt.Errorf("invalid color specified: %s", args[0]) - }, - Run: func(cmd *cobra.Command, args []string) { - fmt.Println("Hello, World!") - }, -} -``` - -## Example - -In the example below, we have defined three commands. Two are at the top level -and one (cmdTimes) is a child of one of the top commands. In this case the root -is not executable, meaning that a subcommand is required. This is accomplished -by not providing a 'Run' for the 'rootCmd'. - -We have only defined one flag for a single command. - -More documentation about flags is available at https://github.com/spf13/pflag - -```go -package main - -import ( - "fmt" - "strings" - - "github.com/spf13/cobra" -) - -func main() { - var echoTimes int - - var cmdPrint = &cobra.Command{ - Use: "print [string to print]", - Short: "Print anything to the screen", - Long: `print is for printing anything back to the screen. -For many years people have printed back to the screen.`, - Args: cobra.MinimumNArgs(1), - Run: func(cmd *cobra.Command, args []string) { - fmt.Println("Print: " + strings.Join(args, " ")) - }, - } - - var cmdEcho = &cobra.Command{ - Use: "echo [string to echo]", - Short: "Echo anything to the screen", - Long: `echo is for echoing anything back. -Echo works a lot like print, except it has a child command.`, - Args: cobra.MinimumNArgs(1), - Run: func(cmd *cobra.Command, args []string) { - fmt.Println("Echo: " + strings.Join(args, " ")) - }, - } - - var cmdTimes = &cobra.Command{ - Use: "times [string to echo]", - Short: "Echo anything to the screen more times", - Long: `echo things multiple times back to the user by providing -a count and a string.`, - Args: cobra.MinimumNArgs(1), - Run: func(cmd *cobra.Command, args []string) { - for i := 0; i < echoTimes; i++ { - fmt.Println("Echo: " + strings.Join(args, " ")) - } - }, - } - - cmdTimes.Flags().IntVarP(&echoTimes, "times", "t", 1, "times to echo the input") - - var rootCmd = &cobra.Command{Use: "app"} - rootCmd.AddCommand(cmdPrint, cmdEcho) - cmdEcho.AddCommand(cmdTimes) - rootCmd.Execute() -} -``` - -For a more complete example of a larger application, please checkout [Hugo](https://gohugo.io/). - -## Help Command - -Cobra automatically adds a help command to your application when you have subcommands. -This will be called when a user runs 'app help'. Additionally, help will also -support all other commands as input. Say, for instance, you have a command called -'create' without any additional configuration; Cobra will work when 'app help -create' is called. Every command will automatically have the '--help' flag added. - -### Example - -The following output is automatically generated by Cobra. Nothing beyond the -command and flag definitions are needed. - - $ cobra help - - Cobra is a CLI library for Go that empowers applications. - This application is a tool to generate the needed files - to quickly create a Cobra application. - - Usage: - cobra [command] - - Available Commands: - add Add a command to a Cobra Application - help Help about any command - init Initialize a Cobra Application - - Flags: - -a, --author string author name for copyright attribution (default "YOUR NAME") - --config string config file (default is $HOME/.cobra.yaml) - -h, --help help for cobra - -l, --license string name of license for the project - --viper use Viper for configuration (default true) - - Use "cobra [command] --help" for more information about a command. - - -Help is just a command like any other. There is no special logic or behavior -around it. In fact, you can provide your own if you want. - -### Defining your own help - -You can provide your own Help command or your own template for the default command to use -with following functions: - -```go -cmd.SetHelpCommand(cmd *Command) -cmd.SetHelpFunc(f func(*Command, []string)) -cmd.SetHelpTemplate(s string) -``` - -The latter two will also apply to any children commands. - -## Usage Message - -When the user provides an invalid flag or invalid command, Cobra responds by -showing the user the 'usage'. - -### Example -You may recognize this from the help above. That's because the default help -embeds the usage as part of its output. - - $ cobra --invalid - Error: unknown flag: --invalid - Usage: - cobra [command] - - Available Commands: - add Add a command to a Cobra Application - help Help about any command - init Initialize a Cobra Application - - Flags: - -a, --author string author name for copyright attribution (default "YOUR NAME") - --config string config file (default is $HOME/.cobra.yaml) - -h, --help help for cobra - -l, --license string name of license for the project - --viper use Viper for configuration (default true) - - Use "cobra [command] --help" for more information about a command. - -### Defining your own usage -You can provide your own usage function or template for Cobra to use. -Like help, the function and template are overridable through public methods: - -```go -cmd.SetUsageFunc(f func(*Command) error) -cmd.SetUsageTemplate(s string) -``` - -## Version Flag - -Cobra adds a top-level '--version' flag if the Version field is set on the root command. -Running an application with the '--version' flag will print the version to stdout using -the version template. The template can be customized using the -`cmd.SetVersionTemplate(s string)` function. - -## PreRun and PostRun Hooks - -It is possible to run functions before or after the main `Run` function of your command. The `PersistentPreRun` and `PreRun` functions will be executed before `Run`. `PersistentPostRun` and `PostRun` will be executed after `Run`. The `Persistent*Run` functions will be inherited by children if they do not declare their own. These functions are run in the following order: - -- `PersistentPreRun` -- `PreRun` -- `Run` -- `PostRun` -- `PersistentPostRun` - -An example of two commands which use all of these features is below. When the subcommand is executed, it will run the root command's `PersistentPreRun` but not the root command's `PersistentPostRun`: - -```go -package main - -import ( - "fmt" - - "github.com/spf13/cobra" -) - -func main() { - - var rootCmd = &cobra.Command{ - Use: "root [sub]", - Short: "My root command", - PersistentPreRun: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside rootCmd PersistentPreRun with args: %v\n", args) - }, - PreRun: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside rootCmd PreRun with args: %v\n", args) - }, - Run: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside rootCmd Run with args: %v\n", args) - }, - PostRun: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside rootCmd PostRun with args: %v\n", args) - }, - PersistentPostRun: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside rootCmd PersistentPostRun with args: %v\n", args) - }, - } - - var subCmd = &cobra.Command{ - Use: "sub [no options!]", - Short: "My subcommand", - PreRun: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside subCmd PreRun with args: %v\n", args) - }, - Run: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside subCmd Run with args: %v\n", args) - }, - PostRun: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside subCmd PostRun with args: %v\n", args) - }, - PersistentPostRun: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside subCmd PersistentPostRun with args: %v\n", args) - }, - } - - rootCmd.AddCommand(subCmd) - - rootCmd.SetArgs([]string{""}) - rootCmd.Execute() - fmt.Println() - rootCmd.SetArgs([]string{"sub", "arg1", "arg2"}) - rootCmd.Execute() -} -``` - -Output: -``` -Inside rootCmd PersistentPreRun with args: [] -Inside rootCmd PreRun with args: [] -Inside rootCmd Run with args: [] -Inside rootCmd PostRun with args: [] -Inside rootCmd PersistentPostRun with args: [] - -Inside rootCmd PersistentPreRun with args: [arg1 arg2] -Inside subCmd PreRun with args: [arg1 arg2] -Inside subCmd Run with args: [arg1 arg2] -Inside subCmd PostRun with args: [arg1 arg2] -Inside subCmd PersistentPostRun with args: [arg1 arg2] -``` - -## Suggestions when "unknown command" happens - -Cobra will print automatic suggestions when "unknown command" errors happen. This allows Cobra to behave similarly to the `git` command when a typo happens. For example: - -``` -$ hugo srever -Error: unknown command "srever" for "hugo" - -Did you mean this? - server - -Run 'hugo --help' for usage. -``` - -Suggestions are automatic based on every subcommand registered and use an implementation of [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance). Every registered command that matches a minimum distance of 2 (ignoring case) will be displayed as a suggestion. - -If you need to disable suggestions or tweak the string distance in your command, use: - -```go -command.DisableSuggestions = true -``` - -or - -```go -command.SuggestionsMinimumDistance = 1 -``` - -You can also explicitly set names for which a given command will be suggested using the `SuggestFor` attribute. This allows suggestions for strings that are not close in terms of string distance, but makes sense in your set of commands and for some which you don't want aliases. Example: - -``` -$ kubectl remove -Error: unknown command "remove" for "kubectl" - -Did you mean this? - delete - -Run 'kubectl help' for usage. -``` - -## Generating documentation for your command - -Cobra can generate documentation based on subcommands, flags, etc. Read more about it in the [docs generation documentation](doc/README.md). - -## Generating shell completions - -Cobra can generate a shell-completion file for the following shells: bash, zsh, fish, PowerShell. If you add more information to your commands, these completions can be amazingly powerful and flexible. Read more about it in [Shell Completions](shell_completions.md). - -## Providing Active Help - -Cobra makes use of the shell-completion system to define a framework allowing you to provide Active Help to your users. Active Help are messages (hints, warnings, etc) printed as the program is being used. Read more about it in [Active Help](active_help.md). diff --git a/vendor/github.com/spf13/cobra/zsh_completions.go b/vendor/github.com/spf13/cobra/zsh_completions.go index 65cd94c60..1856e4c7f 100644 --- a/vendor/github.com/spf13/cobra/zsh_completions.go +++ b/vendor/github.com/spf13/cobra/zsh_completions.go @@ -1,3 +1,17 @@ +// Copyright 2013-2023 The Cobra 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 cobra import ( @@ -76,6 +90,7 @@ func genZshComp(buf io.StringWriter, name string, includeDesc bool) { compCmd = ShellCompNoDescRequestCmd } WriteStringAndCheck(buf, fmt.Sprintf(`#compdef %[1]s +compdef _%[1]s %[1]s # zsh completion for %-36[1]s -*- shell-script -*- @@ -94,8 +109,9 @@ _%[1]s() local shellCompDirectiveNoFileComp=%[5]d local shellCompDirectiveFilterFileExt=%[6]d local shellCompDirectiveFilterDirs=%[7]d + local shellCompDirectiveKeepOrder=%[8]d - local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace + local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder local -a completions __%[1]s_debug "\n========= starting completion logic ==========" @@ -163,7 +179,7 @@ _%[1]s() return fi - local activeHelpMarker="%[8]s" + local activeHelpMarker="%[9]s" local endIndex=${#activeHelpMarker} local startIndex=$((${#activeHelpMarker}+1)) local hasActiveHelp=0 @@ -213,6 +229,11 @@ _%[1]s() noSpace="-S ''" fi + if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then + __%[1]s_debug "Activating keep order." + keepOrder="-V" + fi + if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then # File extension filtering local filteringCmd @@ -248,7 +269,7 @@ _%[1]s() return $result else __%[1]s_debug "Calling _describe" - if eval _describe "completions" completions $flagPrefix $noSpace; then + if eval _describe $keepOrder "completions" completions $flagPrefix $noSpace; then __%[1]s_debug "_describe found some completions" # Return the success of having called _describe @@ -282,6 +303,6 @@ if [ "$funcstack[1]" = "_%[1]s" ]; then fi `, name, compCmd, ShellCompDirectiveError, ShellCompDirectiveNoSpace, ShellCompDirectiveNoFileComp, - ShellCompDirectiveFilterFileExt, ShellCompDirectiveFilterDirs, + ShellCompDirectiveFilterFileExt, ShellCompDirectiveFilterDirs, ShellCompDirectiveKeepOrder, activeHelpMarker)) } diff --git a/vendor/github.com/spf13/cobra/zsh_completions.md b/vendor/github.com/spf13/cobra/zsh_completions.md deleted file mode 100644 index 7cff61787..000000000 --- a/vendor/github.com/spf13/cobra/zsh_completions.md +++ /dev/null @@ -1,48 +0,0 @@ -## Generating Zsh Completion For Your cobra.Command - -Please refer to [Shell Completions](shell_completions.md) for details. - -## Zsh completions standardization - -Cobra 1.1 standardized its zsh completion support to align it with its other shell completions. Although the API was kept backwards-compatible, some small changes in behavior were introduced. - -### Deprecation summary - -See further below for more details on these deprecations. - -* `cmd.MarkZshCompPositionalArgumentFile(pos, []string{})` is no longer needed. It is therefore **deprecated** and silently ignored. -* `cmd.MarkZshCompPositionalArgumentFile(pos, glob[])` is **deprecated** and silently ignored. - * Instead use `ValidArgsFunction` with `ShellCompDirectiveFilterFileExt`. -* `cmd.MarkZshCompPositionalArgumentWords()` is **deprecated** and silently ignored. - * Instead use `ValidArgsFunction`. - -### Behavioral changes - -**Noun completion** -|Old behavior|New behavior| -|---|---| -|No file completion by default (opposite of bash)|File completion by default; use `ValidArgsFunction` with `ShellCompDirectiveNoFileComp` to turn off file completion on a per-argument basis| -|Completion of flag names without the `-` prefix having been typed|Flag names are only completed if the user has typed the first `-`| -`cmd.MarkZshCompPositionalArgumentFile(pos, []string{})` used to turn on file completion on a per-argument position basis|File completion for all arguments by default; `cmd.MarkZshCompPositionalArgumentFile()` is **deprecated** and silently ignored| -|`cmd.MarkZshCompPositionalArgumentFile(pos, glob[])` used to turn on file completion **with glob filtering** on a per-argument position basis (zsh-specific)|`cmd.MarkZshCompPositionalArgumentFile()` is **deprecated** and silently ignored; use `ValidArgsFunction` with `ShellCompDirectiveFilterFileExt` for file **extension** filtering (not full glob filtering)| -|`cmd.MarkZshCompPositionalArgumentWords(pos, words[])` used to provide completion choices on a per-argument position basis (zsh-specific)|`cmd.MarkZshCompPositionalArgumentWords()` is **deprecated** and silently ignored; use `ValidArgsFunction` to achieve the same behavior| - -**Flag-value completion** - -|Old behavior|New behavior| -|---|---| -|No file completion by default (opposite of bash)|File completion by default; use `RegisterFlagCompletionFunc()` with `ShellCompDirectiveNoFileComp` to turn off file completion| -|`cmd.MarkFlagFilename(flag, []string{})` and similar used to turn on file completion|File completion by default; `cmd.MarkFlagFilename(flag, []string{})` no longer needed in this context and silently ignored| -|`cmd.MarkFlagFilename(flag, glob[])` used to turn on file completion **with glob filtering** (syntax of `[]string{"*.yaml", "*.yml"}` incompatible with bash)|Will continue to work, however, support for bash syntax is added and should be used instead so as to work for all shells (`[]string{"yaml", "yml"}`)| -|`cmd.MarkFlagDirname(flag)` only completes directories (zsh-specific)|Has been added for all shells| -|Completion of a flag name does not repeat, unless flag is of type `*Array` or `*Slice` (not supported by bash)|Retained for `zsh` and added to `fish`| -|Completion of a flag name does not provide the `=` form (unlike bash)|Retained for `zsh` and added to `fish`| - -**Improvements** - -* Custom completion support (`ValidArgsFunction` and `RegisterFlagCompletionFunc()`) -* File completion by default if no other completions found -* Handling of required flags -* File extension filtering no longer mutually exclusive with bash usage -* Completion of directory names *within* another directory -* Support for `=` form of flags diff --git a/vendor/github.com/spf13/pflag/.editorconfig b/vendor/github.com/spf13/pflag/.editorconfig new file mode 100644 index 000000000..4492e9f9f --- /dev/null +++ b/vendor/github.com/spf13/pflag/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.go] +indent_style = tab diff --git a/vendor/github.com/spf13/pflag/.golangci.yaml b/vendor/github.com/spf13/pflag/.golangci.yaml new file mode 100644 index 000000000..b274f2484 --- /dev/null +++ b/vendor/github.com/spf13/pflag/.golangci.yaml @@ -0,0 +1,4 @@ +linters: + disable-all: true + enable: + - nolintlint diff --git a/vendor/github.com/spf13/pflag/flag.go b/vendor/github.com/spf13/pflag/flag.go index 24a5036e9..7c058de37 100644 --- a/vendor/github.com/spf13/pflag/flag.go +++ b/vendor/github.com/spf13/pflag/flag.go @@ -160,7 +160,7 @@ type FlagSet struct { args []string // arguments after flags argsLenAtDash int // len(args) when a '--' was located when parsing, or -1 if no -- errorHandling ErrorHandling - output io.Writer // nil means stderr; use out() accessor + output io.Writer // nil means stderr; use Output() accessor interspersed bool // allow interspersed option/non-option args normalizeNameFunc func(f *FlagSet, name string) NormalizedName @@ -255,13 +255,20 @@ func (f *FlagSet) normalizeFlagName(name string) NormalizedName { return n(f, name) } -func (f *FlagSet) out() io.Writer { +// Output returns the destination for usage and error messages. os.Stderr is returned if +// output was not set or was set to nil. +func (f *FlagSet) Output() io.Writer { if f.output == nil { return os.Stderr } return f.output } +// Name returns the name of the flag set. +func (f *FlagSet) Name() string { + return f.name +} + // SetOutput sets the destination for usage and error messages. // If output is nil, os.Stderr is used. func (f *FlagSet) SetOutput(output io.Writer) { @@ -358,7 +365,7 @@ func (f *FlagSet) ShorthandLookup(name string) *Flag { } if len(name) > 1 { msg := fmt.Sprintf("can not look up shorthand which is more than one ASCII character: %q", name) - fmt.Fprintf(f.out(), msg) + fmt.Fprintf(f.Output(), msg) panic(msg) } c := name[0] @@ -482,7 +489,7 @@ func (f *FlagSet) Set(name, value string) error { } if flag.Deprecated != "" { - fmt.Fprintf(f.out(), "Flag --%s has been deprecated, %s\n", flag.Name, flag.Deprecated) + fmt.Fprintf(f.Output(), "Flag --%s has been deprecated, %s\n", flag.Name, flag.Deprecated) } return nil } @@ -523,7 +530,7 @@ func Set(name, value string) error { // otherwise, the default values of all defined flags in the set. func (f *FlagSet) PrintDefaults() { usages := f.FlagUsages() - fmt.Fprint(f.out(), usages) + fmt.Fprint(f.Output(), usages) } // defaultIsZeroValue returns true if the default value for this flag represents @@ -758,7 +765,7 @@ func PrintDefaults() { // defaultUsage is the default function to print a usage message. func defaultUsage(f *FlagSet) { - fmt.Fprintf(f.out(), "Usage of %s:\n", f.name) + fmt.Fprintf(f.Output(), "Usage of %s:\n", f.name) f.PrintDefaults() } @@ -844,7 +851,7 @@ func (f *FlagSet) AddFlag(flag *Flag) { _, alreadyThere := f.formal[normalizedFlagName] if alreadyThere { msg := fmt.Sprintf("%s flag redefined: %s", f.name, flag.Name) - fmt.Fprintln(f.out(), msg) + fmt.Fprintln(f.Output(), msg) panic(msg) // Happens only if flags are declared with identical names } if f.formal == nil { @@ -860,7 +867,7 @@ func (f *FlagSet) AddFlag(flag *Flag) { } if len(flag.Shorthand) > 1 { msg := fmt.Sprintf("%q shorthand is more than one ASCII character", flag.Shorthand) - fmt.Fprintf(f.out(), msg) + fmt.Fprintf(f.Output(), msg) panic(msg) } if f.shorthands == nil { @@ -870,7 +877,7 @@ func (f *FlagSet) AddFlag(flag *Flag) { used, alreadyThere := f.shorthands[c] if alreadyThere { msg := fmt.Sprintf("unable to redefine %q shorthand in %q flagset: it's already used for %q flag", c, f.name, used.Name) - fmt.Fprintf(f.out(), msg) + fmt.Fprintf(f.Output(), msg) panic(msg) } f.shorthands[c] = flag @@ -909,7 +916,7 @@ func VarP(value Value, name, shorthand, usage string) { func (f *FlagSet) failf(format string, a ...interface{}) error { err := fmt.Errorf(format, a...) if f.errorHandling != ContinueOnError { - fmt.Fprintln(f.out(), err) + fmt.Fprintln(f.Output(), err) f.usage() } return err @@ -1060,7 +1067,7 @@ func (f *FlagSet) parseSingleShortArg(shorthands string, args []string, fn parse } if flag.ShorthandDeprecated != "" { - fmt.Fprintf(f.out(), "Flag shorthand -%s has been deprecated, %s\n", flag.Shorthand, flag.ShorthandDeprecated) + fmt.Fprintf(f.Output(), "Flag shorthand -%s has been deprecated, %s\n", flag.Shorthand, flag.ShorthandDeprecated) } err = fn(flag, value) diff --git a/vendor/github.com/spf13/pflag/ip.go b/vendor/github.com/spf13/pflag/ip.go index 3d414ba69..06b8bcb57 100644 --- a/vendor/github.com/spf13/pflag/ip.go +++ b/vendor/github.com/spf13/pflag/ip.go @@ -16,6 +16,9 @@ func newIPValue(val net.IP, p *net.IP) *ipValue { func (i *ipValue) String() string { return net.IP(*i).String() } func (i *ipValue) Set(s string) error { + if s == "" { + return nil + } ip := net.ParseIP(strings.TrimSpace(s)) if ip == nil { return fmt.Errorf("failed to parse IP: %q", s) diff --git a/vendor/github.com/spf13/pflag/ipnet_slice.go b/vendor/github.com/spf13/pflag/ipnet_slice.go new file mode 100644 index 000000000..6b541aa87 --- /dev/null +++ b/vendor/github.com/spf13/pflag/ipnet_slice.go @@ -0,0 +1,147 @@ +package pflag + +import ( + "fmt" + "io" + "net" + "strings" +) + +// -- ipNetSlice Value +type ipNetSliceValue struct { + value *[]net.IPNet + changed bool +} + +func newIPNetSliceValue(val []net.IPNet, p *[]net.IPNet) *ipNetSliceValue { + ipnsv := new(ipNetSliceValue) + ipnsv.value = p + *ipnsv.value = val + return ipnsv +} + +// Set converts, and assigns, the comma-separated IPNet argument string representation as the []net.IPNet value of this flag. +// If Set is called on a flag that already has a []net.IPNet assigned, the newly converted values will be appended. +func (s *ipNetSliceValue) Set(val string) error { + + // remove all quote characters + rmQuote := strings.NewReplacer(`"`, "", `'`, "", "`", "") + + // read flag arguments with CSV parser + ipNetStrSlice, err := readAsCSV(rmQuote.Replace(val)) + if err != nil && err != io.EOF { + return err + } + + // parse ip values into slice + out := make([]net.IPNet, 0, len(ipNetStrSlice)) + for _, ipNetStr := range ipNetStrSlice { + _, n, err := net.ParseCIDR(strings.TrimSpace(ipNetStr)) + if err != nil { + return fmt.Errorf("invalid string being converted to CIDR: %s", ipNetStr) + } + out = append(out, *n) + } + + if !s.changed { + *s.value = out + } else { + *s.value = append(*s.value, out...) + } + + s.changed = true + + return nil +} + +// Type returns a string that uniquely represents this flag's type. +func (s *ipNetSliceValue) Type() string { + return "ipNetSlice" +} + +// String defines a "native" format for this net.IPNet slice flag value. +func (s *ipNetSliceValue) String() string { + + ipNetStrSlice := make([]string, len(*s.value)) + for i, n := range *s.value { + ipNetStrSlice[i] = n.String() + } + + out, _ := writeAsCSV(ipNetStrSlice) + return "[" + out + "]" +} + +func ipNetSliceConv(val string) (interface{}, error) { + val = strings.Trim(val, "[]") + // Emtpy string would cause a slice with one (empty) entry + if len(val) == 0 { + return []net.IPNet{}, nil + } + ss := strings.Split(val, ",") + out := make([]net.IPNet, len(ss)) + for i, sval := range ss { + _, n, err := net.ParseCIDR(strings.TrimSpace(sval)) + if err != nil { + return nil, fmt.Errorf("invalid string being converted to CIDR: %s", sval) + } + out[i] = *n + } + return out, nil +} + +// GetIPNetSlice returns the []net.IPNet value of a flag with the given name +func (f *FlagSet) GetIPNetSlice(name string) ([]net.IPNet, error) { + val, err := f.getFlagType(name, "ipNetSlice", ipNetSliceConv) + if err != nil { + return []net.IPNet{}, err + } + return val.([]net.IPNet), nil +} + +// IPNetSliceVar defines a ipNetSlice flag with specified name, default value, and usage string. +// The argument p points to a []net.IPNet variable in which to store the value of the flag. +func (f *FlagSet) IPNetSliceVar(p *[]net.IPNet, name string, value []net.IPNet, usage string) { + f.VarP(newIPNetSliceValue(value, p), name, "", usage) +} + +// IPNetSliceVarP is like IPNetSliceVar, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) IPNetSliceVarP(p *[]net.IPNet, name, shorthand string, value []net.IPNet, usage string) { + f.VarP(newIPNetSliceValue(value, p), name, shorthand, usage) +} + +// IPNetSliceVar defines a []net.IPNet flag with specified name, default value, and usage string. +// The argument p points to a []net.IPNet variable in which to store the value of the flag. +func IPNetSliceVar(p *[]net.IPNet, name string, value []net.IPNet, usage string) { + CommandLine.VarP(newIPNetSliceValue(value, p), name, "", usage) +} + +// IPNetSliceVarP is like IPNetSliceVar, but accepts a shorthand letter that can be used after a single dash. +func IPNetSliceVarP(p *[]net.IPNet, name, shorthand string, value []net.IPNet, usage string) { + CommandLine.VarP(newIPNetSliceValue(value, p), name, shorthand, usage) +} + +// IPNetSlice defines a []net.IPNet flag with specified name, default value, and usage string. +// The return value is the address of a []net.IPNet variable that stores the value of that flag. +func (f *FlagSet) IPNetSlice(name string, value []net.IPNet, usage string) *[]net.IPNet { + p := []net.IPNet{} + f.IPNetSliceVarP(&p, name, "", value, usage) + return &p +} + +// IPNetSliceP is like IPNetSlice, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) IPNetSliceP(name, shorthand string, value []net.IPNet, usage string) *[]net.IPNet { + p := []net.IPNet{} + f.IPNetSliceVarP(&p, name, shorthand, value, usage) + return &p +} + +// IPNetSlice defines a []net.IPNet flag with specified name, default value, and usage string. +// The return value is the address of a []net.IP variable that stores the value of the flag. +func IPNetSlice(name string, value []net.IPNet, usage string) *[]net.IPNet { + return CommandLine.IPNetSliceP(name, "", value, usage) +} + +// IPNetSliceP is like IPNetSlice, but accepts a shorthand letter that can be used after a single dash. +func IPNetSliceP(name, shorthand string, value []net.IPNet, usage string) *[]net.IPNet { + return CommandLine.IPNetSliceP(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/string_array.go b/vendor/github.com/spf13/pflag/string_array.go index 4894af818..d1ff0a96b 100644 --- a/vendor/github.com/spf13/pflag/string_array.go +++ b/vendor/github.com/spf13/pflag/string_array.go @@ -31,11 +31,7 @@ func (s *stringArrayValue) Append(val string) error { func (s *stringArrayValue) Replace(val []string) error { out := make([]string, len(val)) for i, d := range val { - var err error out[i] = d - if err != nil { - return err - } } *s.value = out return nil diff --git a/vendor/github.com/stretchr/objx/README.md b/vendor/github.com/stretchr/objx/README.md index 246660b21..78dc1f8b0 100644 --- a/vendor/github.com/stretchr/objx/README.md +++ b/vendor/github.com/stretchr/objx/README.md @@ -4,20 +4,20 @@ [![Maintainability](https://api.codeclimate.com/v1/badges/1d64bc6c8474c2074f2b/maintainability)](https://codeclimate.com/github/stretchr/objx/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/1d64bc6c8474c2074f2b/test_coverage)](https://codeclimate.com/github/stretchr/objx/test_coverage) [![Sourcegraph](https://sourcegraph.com/github.com/stretchr/objx/-/badge.svg)](https://sourcegraph.com/github.com/stretchr/objx) -[![GoDoc](https://godoc.org/github.com/stretchr/objx?status.svg)](https://godoc.org/github.com/stretchr/objx) +[![GoDoc](https://pkg.go.dev/badge/github.com/stretchr/objx?utm_source=godoc)](https://pkg.go.dev/github.com/stretchr/objx) Objx - Go package for dealing with maps, slices, JSON and other data. Get started: - Install Objx with [one line of code](#installation), or [update it with another](#staying-up-to-date) -- Check out the API Documentation http://godoc.org/github.com/stretchr/objx +- Check out the API Documentation http://pkg.go.dev/github.com/stretchr/objx ## Overview Objx provides the `objx.Map` type, which is a `map[string]interface{}` that exposes a powerful `Get` method (among others) that allows you to easily and quickly get access to data within the map, without having to worry too much about type assertions, missing data, default values etc. ### Pattern -Objx uses a preditable pattern to make access data from within `map[string]interface{}` easy. Call one of the `objx.` functions to create your `objx.Map` to get going: +Objx uses a predictable pattern to make access data from within `map[string]interface{}` easy. Call one of the `objx.` functions to create your `objx.Map` to get going: m, err := objx.FromJSON(json) @@ -74,7 +74,7 @@ To update Objx to the latest version, run: go get -u github.com/stretchr/objx ### Supported go versions -We support the lastest three major Go versions, which are 1.10, 1.11 and 1.12 at the moment. +We currently support the three recent major Go versions. ## Contributing Please feel free to submit issues, fork the repository and send pull requests! diff --git a/vendor/github.com/stretchr/objx/Taskfile.yml b/vendor/github.com/stretchr/objx/Taskfile.yml index 7746f516d..8a79e8d67 100644 --- a/vendor/github.com/stretchr/objx/Taskfile.yml +++ b/vendor/github.com/stretchr/objx/Taskfile.yml @@ -1,7 +1,4 @@ -version: '2' - -env: - GOFLAGS: -mod=vendor +version: '3' tasks: default: diff --git a/vendor/github.com/stretchr/objx/accessors.go b/vendor/github.com/stretchr/objx/accessors.go index 4c6045588..72f1d1c1c 100644 --- a/vendor/github.com/stretchr/objx/accessors.go +++ b/vendor/github.com/stretchr/objx/accessors.go @@ -14,17 +14,17 @@ const ( // For example, `location.address.city` PathSeparator string = "." - // arrayAccesRegexString is the regex used to extract the array number + // arrayAccessRegexString is the regex used to extract the array number // from the access path - arrayAccesRegexString = `^(.+)\[([0-9]+)\]$` + arrayAccessRegexString = `^(.+)\[([0-9]+)\]$` // mapAccessRegexString is the regex used to extract the map key // from the access path mapAccessRegexString = `^([^\[]*)\[([^\]]+)\](.*)$` ) -// arrayAccesRegex is the compiled arrayAccesRegexString -var arrayAccesRegex = regexp.MustCompile(arrayAccesRegexString) +// arrayAccessRegex is the compiled arrayAccessRegexString +var arrayAccessRegex = regexp.MustCompile(arrayAccessRegexString) // mapAccessRegex is the compiled mapAccessRegexString var mapAccessRegex = regexp.MustCompile(mapAccessRegexString) @@ -37,11 +37,11 @@ var mapAccessRegex = regexp.MustCompile(mapAccessRegexString) // // Get can only operate directly on map[string]interface{} and []interface. // -// Example +// # Example // // To access the title of the third chapter of the second book, do: // -// o.Get("books[1].chapters[2].title") +// o.Get("books[1].chapters[2].title") func (m Map) Get(selector string) *Value { rawObj := access(m, selector, nil, false) return &Value{data: rawObj} @@ -52,26 +52,26 @@ func (m Map) Get(selector string) *Value { // // Set can only operate directly on map[string]interface{} and []interface // -// Example +// # Example // // To set the title of the third chapter of the second book, do: // -// o.Set("books[1].chapters[2].title","Time to Go") +// o.Set("books[1].chapters[2].title","Time to Go") func (m Map) Set(selector string, value interface{}) Map { access(m, selector, value, true) return m } -// getIndex returns the index, which is hold in s by two braches. -// It also returns s withour the index part, e.g. name[1] will return (1, name). +// getIndex returns the index, which is hold in s by two branches. +// It also returns s without the index part, e.g. name[1] will return (1, name). // If no index is found, -1 is returned func getIndex(s string) (int, string) { - arrayMatches := arrayAccesRegex.FindStringSubmatch(s) + arrayMatches := arrayAccessRegex.FindStringSubmatch(s) if len(arrayMatches) > 0 { // Get the key into the map selector := arrayMatches[1] // Get the index into the array at the key - // We know this cannt fail because arrayMatches[2] is an int for sure + // We know this can't fail because arrayMatches[2] is an int for sure index, _ := strconv.Atoi(arrayMatches[2]) return index, selector } diff --git a/vendor/github.com/stretchr/objx/conversions.go b/vendor/github.com/stretchr/objx/conversions.go index 080aa46e4..01c63d7d3 100644 --- a/vendor/github.com/stretchr/objx/conversions.go +++ b/vendor/github.com/stretchr/objx/conversions.go @@ -15,7 +15,7 @@ import ( const SignatureSeparator = "_" // URLValuesSliceKeySuffix is the character that is used to -// specify a suffic for slices parsed by URLValues. +// specify a suffix for slices parsed by URLValues. // If the suffix is set to "[i]", then the index of the slice // is used in place of i // Ex: Suffix "[]" would have the form a[]=b&a[]=c @@ -30,7 +30,7 @@ const ( ) // SetURLValuesSliceKeySuffix sets the character that is used to -// specify a suffic for slices parsed by URLValues. +// specify a suffix for slices parsed by URLValues. // If the suffix is set to "[i]", then the index of the slice // is used in place of i // Ex: Suffix "[]" would have the form a[]=b&a[]=c diff --git a/vendor/github.com/stretchr/objx/doc.go b/vendor/github.com/stretchr/objx/doc.go index 6d6af1a83..b170af74b 100644 --- a/vendor/github.com/stretchr/objx/doc.go +++ b/vendor/github.com/stretchr/objx/doc.go @@ -1,19 +1,19 @@ /* -Objx - Go package for dealing with maps, slices, JSON and other data. +Package objx provides utilities for dealing with maps, slices, JSON and other data. -Overview +# Overview Objx provides the `objx.Map` type, which is a `map[string]interface{}` that exposes a powerful `Get` method (among others) that allows you to easily and quickly get access to data within the map, without having to worry too much about type assertions, missing data, default values etc. -Pattern +# Pattern -Objx uses a preditable pattern to make access data from within `map[string]interface{}` easy. +Objx uses a predictable pattern to make access data from within `map[string]interface{}` easy. Call one of the `objx.` functions to create your `objx.Map` to get going: - m, err := objx.FromJSON(json) + m, err := objx.FromJSON(json) NOTE: Any methods or functions with the `Must` prefix will panic if something goes wrong, the rest will be optimistic and try to figure things out without panicking. @@ -21,46 +21,46 @@ the rest will be optimistic and try to figure things out without panicking. Use `Get` to access the value you're interested in. You can use dot and array notation too: - m.Get("places[0].latlng") + m.Get("places[0].latlng") Once you have sought the `Value` you're interested in, you can use the `Is*` methods to determine its type. - if m.Get("code").IsStr() { // Your code... } + if m.Get("code").IsStr() { // Your code... } Or you can just assume the type, and use one of the strong type methods to extract the real value: - m.Get("code").Int() + m.Get("code").Int() If there's no value there (or if it's the wrong type) then a default value will be returned, or you can be explicit about the default value. - Get("code").Int(-1) + Get("code").Int(-1) If you're dealing with a slice of data as a value, Objx provides many useful methods for iterating, manipulating and selecting that data. You can find out more by exploring the index below. -Reading data +# Reading data A simple example of how to use Objx: - // Use MustFromJSON to make an objx.Map from some JSON - m := objx.MustFromJSON(`{"name": "Mat", "age": 30}`) + // Use MustFromJSON to make an objx.Map from some JSON + m := objx.MustFromJSON(`{"name": "Mat", "age": 30}`) - // Get the details - name := m.Get("name").Str() - age := m.Get("age").Int() + // Get the details + name := m.Get("name").Str() + age := m.Get("age").Int() - // Get their nickname (or use their name if they don't have one) - nickname := m.Get("nickname").Str(name) + // Get their nickname (or use their name if they don't have one) + nickname := m.Get("nickname").Str(name) -Ranging +# Ranging Since `objx.Map` is a `map[string]interface{}` you can treat it as such. For example, to `range` the data, do what you would expect: - m := objx.MustFromJSON(json) - for key, value := range m { - // Your code... - } + m := objx.MustFromJSON(json) + for key, value := range m { + // Your code... + } */ package objx diff --git a/vendor/github.com/stretchr/objx/map.go b/vendor/github.com/stretchr/objx/map.go index a64712a08..ab9f9ae67 100644 --- a/vendor/github.com/stretchr/objx/map.go +++ b/vendor/github.com/stretchr/objx/map.go @@ -47,17 +47,16 @@ func New(data interface{}) Map { // // The arguments follow a key, value pattern. // -// // Returns nil if any key argument is non-string or if there are an odd number of arguments. // -// Example +// # Example // // To easily create Maps: // -// m := objx.MSI("name", "Mat", "age", 29, "subobj", objx.MSI("active", true)) +// m := objx.MSI("name", "Mat", "age", 29, "subobj", objx.MSI("active", true)) // -// // creates an Map equivalent to -// m := objx.Map{"name": "Mat", "age": 29, "subobj": objx.Map{"active": true}} +// // creates an Map equivalent to +// m := objx.Map{"name": "Mat", "age": 29, "subobj": objx.Map{"active": true}} func MSI(keyAndValuePairs ...interface{}) Map { newMap := Map{} keyAndValuePairsLen := len(keyAndValuePairs) diff --git a/vendor/github.com/stretchr/testify/assert/assertion_compare.go b/vendor/github.com/stretchr/testify/assert/assertion_compare.go index b774da88d..ffb24e8e3 100644 --- a/vendor/github.com/stretchr/testify/assert/assertion_compare.go +++ b/vendor/github.com/stretchr/testify/assert/assertion_compare.go @@ -7,10 +7,13 @@ import ( "time" ) -type CompareType int +// Deprecated: CompareType has only ever been for internal use and has accidentally been published since v1.6.0. Do not use it. +type CompareType = compareResult + +type compareResult int const ( - compareLess CompareType = iota - 1 + compareLess compareResult = iota - 1 compareEqual compareGreater ) @@ -28,6 +31,8 @@ var ( uint32Type = reflect.TypeOf(uint32(1)) uint64Type = reflect.TypeOf(uint64(1)) + uintptrType = reflect.TypeOf(uintptr(1)) + float32Type = reflect.TypeOf(float32(1)) float64Type = reflect.TypeOf(float64(1)) @@ -37,7 +42,7 @@ var ( bytesType = reflect.TypeOf([]byte{}) ) -func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) { +func compare(obj1, obj2 interface{}, kind reflect.Kind) (compareResult, bool) { obj1Value := reflect.ValueOf(obj1) obj2Value := reflect.ValueOf(obj2) @@ -308,11 +313,11 @@ func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) { case reflect.Struct: { // All structs enter here. We're not interested in most types. - if !canConvert(obj1Value, timeType) { + if !obj1Value.CanConvert(timeType) { break } - // time.Time can compared! + // time.Time can be compared! timeObj1, ok := obj1.(time.Time) if !ok { timeObj1 = obj1Value.Convert(timeType).Interface().(time.Time) @@ -323,12 +328,18 @@ func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) { timeObj2 = obj2Value.Convert(timeType).Interface().(time.Time) } - return compare(timeObj1.UnixNano(), timeObj2.UnixNano(), reflect.Int64) + if timeObj1.Before(timeObj2) { + return compareLess, true + } + if timeObj1.Equal(timeObj2) { + return compareEqual, true + } + return compareGreater, true } case reflect.Slice: { // We only care about the []byte type. - if !canConvert(obj1Value, bytesType) { + if !obj1Value.CanConvert(bytesType) { break } @@ -343,7 +354,27 @@ func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) { bytesObj2 = obj2Value.Convert(bytesType).Interface().([]byte) } - return CompareType(bytes.Compare(bytesObj1, bytesObj2)), true + return compareResult(bytes.Compare(bytesObj1, bytesObj2)), true + } + case reflect.Uintptr: + { + uintptrObj1, ok := obj1.(uintptr) + if !ok { + uintptrObj1 = obj1Value.Convert(uintptrType).Interface().(uintptr) + } + uintptrObj2, ok := obj2.(uintptr) + if !ok { + uintptrObj2 = obj2Value.Convert(uintptrType).Interface().(uintptr) + } + if uintptrObj1 > uintptrObj2 { + return compareGreater, true + } + if uintptrObj1 == uintptrObj2 { + return compareEqual, true + } + if uintptrObj1 < uintptrObj2 { + return compareLess, true + } } } @@ -359,7 +390,8 @@ func Greater(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface if h, ok := t.(tHelper); ok { h.Helper() } - return compareTwoValues(t, e1, e2, []CompareType{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs...) + failMessage := fmt.Sprintf("\"%v\" is not greater than \"%v\"", e1, e2) + return compareTwoValues(t, e1, e2, []compareResult{compareGreater}, failMessage, msgAndArgs...) } // GreaterOrEqual asserts that the first element is greater than or equal to the second @@ -372,7 +404,8 @@ func GreaterOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...in if h, ok := t.(tHelper); ok { h.Helper() } - return compareTwoValues(t, e1, e2, []CompareType{compareGreater, compareEqual}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs...) + failMessage := fmt.Sprintf("\"%v\" is not greater than or equal to \"%v\"", e1, e2) + return compareTwoValues(t, e1, e2, []compareResult{compareGreater, compareEqual}, failMessage, msgAndArgs...) } // Less asserts that the first element is less than the second @@ -384,7 +417,8 @@ func Less(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) if h, ok := t.(tHelper); ok { h.Helper() } - return compareTwoValues(t, e1, e2, []CompareType{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs...) + failMessage := fmt.Sprintf("\"%v\" is not less than \"%v\"", e1, e2) + return compareTwoValues(t, e1, e2, []compareResult{compareLess}, failMessage, msgAndArgs...) } // LessOrEqual asserts that the first element is less than or equal to the second @@ -397,7 +431,8 @@ func LessOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...inter if h, ok := t.(tHelper); ok { h.Helper() } - return compareTwoValues(t, e1, e2, []CompareType{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs...) + failMessage := fmt.Sprintf("\"%v\" is not less than or equal to \"%v\"", e1, e2) + return compareTwoValues(t, e1, e2, []compareResult{compareLess, compareEqual}, failMessage, msgAndArgs...) } // Positive asserts that the specified element is positive @@ -409,7 +444,8 @@ func Positive(t TestingT, e interface{}, msgAndArgs ...interface{}) bool { h.Helper() } zero := reflect.Zero(reflect.TypeOf(e)) - return compareTwoValues(t, e, zero.Interface(), []CompareType{compareGreater}, "\"%v\" is not positive", msgAndArgs...) + failMessage := fmt.Sprintf("\"%v\" is not positive", e) + return compareTwoValues(t, e, zero.Interface(), []compareResult{compareGreater}, failMessage, msgAndArgs...) } // Negative asserts that the specified element is negative @@ -421,10 +457,11 @@ func Negative(t TestingT, e interface{}, msgAndArgs ...interface{}) bool { h.Helper() } zero := reflect.Zero(reflect.TypeOf(e)) - return compareTwoValues(t, e, zero.Interface(), []CompareType{compareLess}, "\"%v\" is not negative", msgAndArgs...) + failMessage := fmt.Sprintf("\"%v\" is not negative", e) + return compareTwoValues(t, e, zero.Interface(), []compareResult{compareLess}, failMessage, msgAndArgs...) } -func compareTwoValues(t TestingT, e1 interface{}, e2 interface{}, allowedComparesResults []CompareType, failMessage string, msgAndArgs ...interface{}) bool { +func compareTwoValues(t TestingT, e1 interface{}, e2 interface{}, allowedComparesResults []compareResult, failMessage string, msgAndArgs ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() } @@ -437,17 +474,17 @@ func compareTwoValues(t TestingT, e1 interface{}, e2 interface{}, allowedCompare compareResult, isComparable := compare(e1, e2, e1Kind) if !isComparable { - return Fail(t, fmt.Sprintf("Can not compare type \"%s\"", reflect.TypeOf(e1)), msgAndArgs...) + return Fail(t, fmt.Sprintf(`Can not compare type "%T"`, e1), msgAndArgs...) } if !containsValue(allowedComparesResults, compareResult) { - return Fail(t, fmt.Sprintf(failMessage, e1, e2), msgAndArgs...) + return Fail(t, failMessage, msgAndArgs...) } return true } -func containsValue(values []CompareType, value CompareType) bool { +func containsValue(values []compareResult, value compareResult) bool { for _, v := range values { if v == value { return true diff --git a/vendor/github.com/stretchr/testify/assert/assertion_compare_can_convert.go b/vendor/github.com/stretchr/testify/assert/assertion_compare_can_convert.go deleted file mode 100644 index da867903e..000000000 --- a/vendor/github.com/stretchr/testify/assert/assertion_compare_can_convert.go +++ /dev/null @@ -1,16 +0,0 @@ -//go:build go1.17 -// +build go1.17 - -// TODO: once support for Go 1.16 is dropped, this file can be -// merged/removed with assertion_compare_go1.17_test.go and -// assertion_compare_legacy.go - -package assert - -import "reflect" - -// Wrapper around reflect.Value.CanConvert, for compatibility -// reasons. -func canConvert(value reflect.Value, to reflect.Type) bool { - return value.CanConvert(to) -} diff --git a/vendor/github.com/stretchr/testify/assert/assertion_compare_legacy.go b/vendor/github.com/stretchr/testify/assert/assertion_compare_legacy.go deleted file mode 100644 index 1701af2a3..000000000 --- a/vendor/github.com/stretchr/testify/assert/assertion_compare_legacy.go +++ /dev/null @@ -1,16 +0,0 @@ -//go:build !go1.17 -// +build !go1.17 - -// TODO: once support for Go 1.16 is dropped, this file can be -// merged/removed with assertion_compare_go1.17_test.go and -// assertion_compare_can_convert.go - -package assert - -import "reflect" - -// Older versions of Go does not have the reflect.Value.CanConvert -// method. -func canConvert(value reflect.Value, to reflect.Type) bool { - return false -} diff --git a/vendor/github.com/stretchr/testify/assert/assertion_format.go b/vendor/github.com/stretchr/testify/assert/assertion_format.go index 84dbd6c79..c592f6ad5 100644 --- a/vendor/github.com/stretchr/testify/assert/assertion_format.go +++ b/vendor/github.com/stretchr/testify/assert/assertion_format.go @@ -1,7 +1,4 @@ -/* -* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen -* THIS FILE MUST NOT BE EDITED BY HAND - */ +// Code generated with github.com/stretchr/testify/_codegen; DO NOT EDIT. package assert @@ -53,10 +50,19 @@ func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string return ElementsMatch(t, listA, listB, append([]interface{}{msg}, args...)...) } -// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either -// a slice or a channel with len == 0. +// Emptyf asserts that the given value is "empty". +// +// [Zero values] are "empty". +// +// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). +// +// Slices, maps and channels with zero length are "empty". +// +// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". // // assert.Emptyf(t, obj, "error message %s", "formatted") +// +// [Zero values]: https://go.dev/ref/spec#The_zero_value func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() @@ -107,8 +113,8 @@ func EqualExportedValuesf(t TestingT, expected interface{}, actual interface{}, return EqualExportedValues(t, expected, actual, append([]interface{}{msg}, args...)...) } -// EqualValuesf asserts that two objects are equal or convertable to the same types -// and equal. +// EqualValuesf asserts that two objects are equal or convertible to the larger +// type and equal. // // assert.EqualValuesf(t, uint32(123), int32(123), "error message %s", "formatted") func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { @@ -120,10 +126,8 @@ func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg stri // Errorf asserts that a function returned an error (i.e. not `nil`). // -// actualObj, err := SomeFunction() -// if assert.Errorf(t, err, "error message %s", "formatted") { -// assert.Equal(t, expectedErrorf, err) -// } +// actualObj, err := SomeFunction() +// assert.Errorf(t, err, "error message %s", "formatted") func Errorf(t TestingT, err error, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() @@ -189,7 +193,7 @@ func Eventuallyf(t TestingT, condition func() bool, waitFor time.Duration, tick // assert.EventuallyWithTf(t, func(c *assert.CollectT, "error message %s", "formatted") { // // add assertions as needed; any assertion failure will fail the current tick // assert.True(c, externalValue, "expected 'externalValue' to be true") -// }, 1*time.Second, 10*time.Second, "external state has not changed to 'true'; still false") +// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false") func EventuallyWithTf(t TestingT, condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() @@ -441,7 +445,19 @@ func IsNonIncreasingf(t TestingT, object interface{}, msg string, args ...interf return IsNonIncreasing(t, object, append([]interface{}{msg}, args...)...) } +// IsNotTypef asserts that the specified objects are not of the same type. +// +// assert.IsNotTypef(t, &NotMyStruct{}, &MyStruct{}, "error message %s", "formatted") +func IsNotTypef(t TestingT, theType interface{}, object interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return IsNotType(t, theType, object, append([]interface{}{msg}, args...)...) +} + // IsTypef asserts that the specified objects are of the same type. +// +// assert.IsTypef(t, &MyStruct{}, &MyStruct{}, "error message %s", "formatted") func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() @@ -571,8 +587,24 @@ func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, a return NotContains(t, s, contains, append([]interface{}{msg}, args...)...) } -// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either -// a slice or a channel with len == 0. +// NotElementsMatchf asserts that the specified listA(array, slice...) is NOT equal to specified +// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, +// the number of appearances of each of them in both lists should not match. +// This is an inverse of ElementsMatch. +// +// assert.NotElementsMatchf(t, [1, 1, 2, 3], [1, 1, 2, 3], "error message %s", "formatted") -> false +// +// assert.NotElementsMatchf(t, [1, 1, 2, 3], [1, 2, 3], "error message %s", "formatted") -> true +// +// assert.NotElementsMatchf(t, [1, 2, 3], [1, 2, 4], "error message %s", "formatted") -> true +func NotElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return NotElementsMatch(t, listA, listB, append([]interface{}{msg}, args...)...) +} + +// NotEmptyf asserts that the specified object is NOT [Empty]. // // if assert.NotEmptyf(t, obj, "error message %s", "formatted") { // assert.Equal(t, "two", obj[1]) @@ -607,7 +639,16 @@ func NotEqualValuesf(t TestingT, expected interface{}, actual interface{}, msg s return NotEqualValues(t, expected, actual, append([]interface{}{msg}, args...)...) } -// NotErrorIsf asserts that at none of the errors in err's chain matches target. +// NotErrorAsf asserts that none of the errors in err's chain matches target, +// but if so, sets target to that error value. +func NotErrorAsf(t TestingT, err error, target interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return NotErrorAs(t, err, target, append([]interface{}{msg}, args...)...) +} + +// NotErrorIsf asserts that none of the errors in err's chain matches target. // This is a wrapper for errors.Is. func NotErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { @@ -616,6 +657,16 @@ func NotErrorIsf(t TestingT, err error, target error, msg string, args ...interf return NotErrorIs(t, err, target, append([]interface{}{msg}, args...)...) } +// NotImplementsf asserts that an object does not implement the specified interface. +// +// assert.NotImplementsf(t, (*MyInterface)(nil), new(MyObject), "error message %s", "formatted") +func NotImplementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return NotImplements(t, interfaceObject, object, append([]interface{}{msg}, args...)...) +} + // NotNilf asserts that the specified object is not nil. // // assert.NotNilf(t, err, "error message %s", "formatted") @@ -660,10 +711,15 @@ func NotSamef(t TestingT, expected interface{}, actual interface{}, msg string, return NotSame(t, expected, actual, append([]interface{}{msg}, args...)...) } -// NotSubsetf asserts that the specified list(array, slice...) contains not all -// elements given in the specified subset(array, slice...). +// NotSubsetf asserts that the list (array, slice, or map) does NOT contain all +// elements given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // -// assert.NotSubsetf(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted") +// assert.NotSubsetf(t, [1, 3, 4], [1, 2], "error message %s", "formatted") +// assert.NotSubsetf(t, {"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted") +// assert.NotSubsetf(t, [1, 3, 4], {1: "one", 2: "two"}, "error message %s", "formatted") +// assert.NotSubsetf(t, {"x": 1, "y": 2}, ["z"], "error message %s", "formatted") func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() @@ -747,10 +803,15 @@ func Samef(t TestingT, expected interface{}, actual interface{}, msg string, arg return Same(t, expected, actual, append([]interface{}{msg}, args...)...) } -// Subsetf asserts that the specified list(array, slice...) contains all -// elements given in the specified subset(array, slice...). +// Subsetf asserts that the list (array, slice, or map) contains all elements +// given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // -// assert.Subsetf(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted") +// assert.Subsetf(t, [1, 2, 3], [1, 2], "error message %s", "formatted") +// assert.Subsetf(t, {"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted") +// assert.Subsetf(t, [1, 2, 3], {1: "one", 2: "two"}, "error message %s", "formatted") +// assert.Subsetf(t, {"x": 1, "y": 2}, ["x"], "error message %s", "formatted") func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() diff --git a/vendor/github.com/stretchr/testify/assert/assertion_forward.go b/vendor/github.com/stretchr/testify/assert/assertion_forward.go index b1d94aec5..58db92845 100644 --- a/vendor/github.com/stretchr/testify/assert/assertion_forward.go +++ b/vendor/github.com/stretchr/testify/assert/assertion_forward.go @@ -1,7 +1,4 @@ -/* -* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen -* THIS FILE MUST NOT BE EDITED BY HAND - */ +// Code generated with github.com/stretchr/testify/_codegen; DO NOT EDIT. package assert @@ -95,10 +92,19 @@ func (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg st return ElementsMatchf(a.t, listA, listB, msg, args...) } -// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either -// a slice or a channel with len == 0. +// Empty asserts that the given value is "empty". +// +// [Zero values] are "empty". +// +// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). +// +// Slices, maps and channels with zero length are "empty". +// +// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". // // a.Empty(obj) +// +// [Zero values]: https://go.dev/ref/spec#The_zero_value func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -106,10 +112,19 @@ func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool { return Empty(a.t, object, msgAndArgs...) } -// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either -// a slice or a channel with len == 0. +// Emptyf asserts that the given value is "empty". +// +// [Zero values] are "empty". +// +// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). +// +// Slices, maps and channels with zero length are "empty". +// +// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". // // a.Emptyf(obj, "error message %s", "formatted") +// +// [Zero values]: https://go.dev/ref/spec#The_zero_value func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -189,8 +204,8 @@ func (a *Assertions) EqualExportedValuesf(expected interface{}, actual interface return EqualExportedValuesf(a.t, expected, actual, msg, args...) } -// EqualValues asserts that two objects are equal or convertable to the same types -// and equal. +// EqualValues asserts that two objects are equal or convertible to the larger +// type and equal. // // a.EqualValues(uint32(123), int32(123)) func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { @@ -200,8 +215,8 @@ func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAn return EqualValues(a.t, expected, actual, msgAndArgs...) } -// EqualValuesf asserts that two objects are equal or convertable to the same types -// and equal. +// EqualValuesf asserts that two objects are equal or convertible to the larger +// type and equal. // // a.EqualValuesf(uint32(123), int32(123), "error message %s", "formatted") func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { @@ -227,10 +242,8 @@ func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string // Error asserts that a function returned an error (i.e. not `nil`). // -// actualObj, err := SomeFunction() -// if a.Error(err) { -// assert.Equal(t, expectedError, err) -// } +// actualObj, err := SomeFunction() +// a.Error(err) func (a *Assertions) Error(err error, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -300,10 +313,8 @@ func (a *Assertions) ErrorIsf(err error, target error, msg string, args ...inter // Errorf asserts that a function returned an error (i.e. not `nil`). // -// actualObj, err := SomeFunction() -// if a.Errorf(err, "error message %s", "formatted") { -// assert.Equal(t, expectedErrorf, err) -// } +// actualObj, err := SomeFunction() +// a.Errorf(err, "error message %s", "formatted") func (a *Assertions) Errorf(err error, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -339,7 +350,7 @@ func (a *Assertions) Eventually(condition func() bool, waitFor time.Duration, ti // a.EventuallyWithT(func(c *assert.CollectT) { // // add assertions as needed; any assertion failure will fail the current tick // assert.True(c, externalValue, "expected 'externalValue' to be true") -// }, 1*time.Second, 10*time.Second, "external state has not changed to 'true'; still false") +// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false") func (a *Assertions) EventuallyWithT(condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -364,7 +375,7 @@ func (a *Assertions) EventuallyWithT(condition func(collect *CollectT), waitFor // a.EventuallyWithTf(func(c *assert.CollectT, "error message %s", "formatted") { // // add assertions as needed; any assertion failure will fail the current tick // assert.True(c, externalValue, "expected 'externalValue' to be true") -// }, 1*time.Second, 10*time.Second, "external state has not changed to 'true'; still false") +// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false") func (a *Assertions) EventuallyWithTf(condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -871,7 +882,29 @@ func (a *Assertions) IsNonIncreasingf(object interface{}, msg string, args ...in return IsNonIncreasingf(a.t, object, msg, args...) } +// IsNotType asserts that the specified objects are not of the same type. +// +// a.IsNotType(&NotMyStruct{}, &MyStruct{}) +func (a *Assertions) IsNotType(theType interface{}, object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return IsNotType(a.t, theType, object, msgAndArgs...) +} + +// IsNotTypef asserts that the specified objects are not of the same type. +// +// a.IsNotTypef(&NotMyStruct{}, &MyStruct{}, "error message %s", "formatted") +func (a *Assertions) IsNotTypef(theType interface{}, object interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return IsNotTypef(a.t, theType, object, msg, args...) +} + // IsType asserts that the specified objects are of the same type. +// +// a.IsType(&MyStruct{}, &MyStruct{}) func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -880,6 +913,8 @@ func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAnd } // IsTypef asserts that the specified objects are of the same type. +// +// a.IsTypef(&MyStruct{}, &MyStruct{}, "error message %s", "formatted") func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1131,8 +1166,41 @@ func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg strin return NotContainsf(a.t, s, contains, msg, args...) } -// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either -// a slice or a channel with len == 0. +// NotElementsMatch asserts that the specified listA(array, slice...) is NOT equal to specified +// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, +// the number of appearances of each of them in both lists should not match. +// This is an inverse of ElementsMatch. +// +// a.NotElementsMatch([1, 1, 2, 3], [1, 1, 2, 3]) -> false +// +// a.NotElementsMatch([1, 1, 2, 3], [1, 2, 3]) -> true +// +// a.NotElementsMatch([1, 2, 3], [1, 2, 4]) -> true +func (a *Assertions) NotElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotElementsMatch(a.t, listA, listB, msgAndArgs...) +} + +// NotElementsMatchf asserts that the specified listA(array, slice...) is NOT equal to specified +// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, +// the number of appearances of each of them in both lists should not match. +// This is an inverse of ElementsMatch. +// +// a.NotElementsMatchf([1, 1, 2, 3], [1, 1, 2, 3], "error message %s", "formatted") -> false +// +// a.NotElementsMatchf([1, 1, 2, 3], [1, 2, 3], "error message %s", "formatted") -> true +// +// a.NotElementsMatchf([1, 2, 3], [1, 2, 4], "error message %s", "formatted") -> true +func (a *Assertions) NotElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotElementsMatchf(a.t, listA, listB, msg, args...) +} + +// NotEmpty asserts that the specified object is NOT [Empty]. // // if a.NotEmpty(obj) { // assert.Equal(t, "two", obj[1]) @@ -1144,8 +1212,7 @@ func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) boo return NotEmpty(a.t, object, msgAndArgs...) } -// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either -// a slice or a channel with len == 0. +// NotEmptyf asserts that the specified object is NOT [Empty]. // // if a.NotEmptyf(obj, "error message %s", "formatted") { // assert.Equal(t, "two", obj[1]) @@ -1203,7 +1270,25 @@ func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg str return NotEqualf(a.t, expected, actual, msg, args...) } -// NotErrorIs asserts that at none of the errors in err's chain matches target. +// NotErrorAs asserts that none of the errors in err's chain matches target, +// but if so, sets target to that error value. +func (a *Assertions) NotErrorAs(err error, target interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotErrorAs(a.t, err, target, msgAndArgs...) +} + +// NotErrorAsf asserts that none of the errors in err's chain matches target, +// but if so, sets target to that error value. +func (a *Assertions) NotErrorAsf(err error, target interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotErrorAsf(a.t, err, target, msg, args...) +} + +// NotErrorIs asserts that none of the errors in err's chain matches target. // This is a wrapper for errors.Is. func (a *Assertions) NotErrorIs(err error, target error, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { @@ -1212,7 +1297,7 @@ func (a *Assertions) NotErrorIs(err error, target error, msgAndArgs ...interface return NotErrorIs(a.t, err, target, msgAndArgs...) } -// NotErrorIsf asserts that at none of the errors in err's chain matches target. +// NotErrorIsf asserts that none of the errors in err's chain matches target. // This is a wrapper for errors.Is. func (a *Assertions) NotErrorIsf(err error, target error, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { @@ -1221,6 +1306,26 @@ func (a *Assertions) NotErrorIsf(err error, target error, msg string, args ...in return NotErrorIsf(a.t, err, target, msg, args...) } +// NotImplements asserts that an object does not implement the specified interface. +// +// a.NotImplements((*MyInterface)(nil), new(MyObject)) +func (a *Assertions) NotImplements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotImplements(a.t, interfaceObject, object, msgAndArgs...) +} + +// NotImplementsf asserts that an object does not implement the specified interface. +// +// a.NotImplementsf((*MyInterface)(nil), new(MyObject), "error message %s", "formatted") +func (a *Assertions) NotImplementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotImplementsf(a.t, interfaceObject, object, msg, args...) +} + // NotNil asserts that the specified object is not nil. // // a.NotNil(err) @@ -1309,10 +1414,15 @@ func (a *Assertions) NotSamef(expected interface{}, actual interface{}, msg stri return NotSamef(a.t, expected, actual, msg, args...) } -// NotSubset asserts that the specified list(array, slice...) contains not all -// elements given in the specified subset(array, slice...). +// NotSubset asserts that the list (array, slice, or map) does NOT contain all +// elements given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // -// a.NotSubset([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]") +// a.NotSubset([1, 3, 4], [1, 2]) +// a.NotSubset({"x": 1, "y": 2}, {"z": 3}) +// a.NotSubset([1, 3, 4], {1: "one", 2: "two"}) +// a.NotSubset({"x": 1, "y": 2}, ["z"]) func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1320,10 +1430,15 @@ func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs return NotSubset(a.t, list, subset, msgAndArgs...) } -// NotSubsetf asserts that the specified list(array, slice...) contains not all -// elements given in the specified subset(array, slice...). +// NotSubsetf asserts that the list (array, slice, or map) does NOT contain all +// elements given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // -// a.NotSubsetf([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted") +// a.NotSubsetf([1, 3, 4], [1, 2], "error message %s", "formatted") +// a.NotSubsetf({"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted") +// a.NotSubsetf([1, 3, 4], {1: "one", 2: "two"}, "error message %s", "formatted") +// a.NotSubsetf({"x": 1, "y": 2}, ["z"], "error message %s", "formatted") func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1483,10 +1598,15 @@ func (a *Assertions) Samef(expected interface{}, actual interface{}, msg string, return Samef(a.t, expected, actual, msg, args...) } -// Subset asserts that the specified list(array, slice...) contains all -// elements given in the specified subset(array, slice...). +// Subset asserts that the list (array, slice, or map) contains all elements +// given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // -// a.Subset([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]") +// a.Subset([1, 2, 3], [1, 2]) +// a.Subset({"x": 1, "y": 2}, {"x": 1}) +// a.Subset([1, 2, 3], {1: "one", 2: "two"}) +// a.Subset({"x": 1, "y": 2}, ["x"]) func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1494,10 +1614,15 @@ func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ... return Subset(a.t, list, subset, msgAndArgs...) } -// Subsetf asserts that the specified list(array, slice...) contains all -// elements given in the specified subset(array, slice...). +// Subsetf asserts that the list (array, slice, or map) contains all elements +// given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // -// a.Subsetf([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted") +// a.Subsetf([1, 2, 3], [1, 2], "error message %s", "formatted") +// a.Subsetf({"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted") +// a.Subsetf([1, 2, 3], {1: "one", 2: "two"}, "error message %s", "formatted") +// a.Subsetf({"x": 1, "y": 2}, ["x"], "error message %s", "formatted") func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() diff --git a/vendor/github.com/stretchr/testify/assert/assertion_order.go b/vendor/github.com/stretchr/testify/assert/assertion_order.go index 00df62a05..2fdf80fdd 100644 --- a/vendor/github.com/stretchr/testify/assert/assertion_order.go +++ b/vendor/github.com/stretchr/testify/assert/assertion_order.go @@ -6,7 +6,7 @@ import ( ) // isOrdered checks that collection contains orderable elements. -func isOrdered(t TestingT, object interface{}, allowedComparesResults []CompareType, failMessage string, msgAndArgs ...interface{}) bool { +func isOrdered(t TestingT, object interface{}, allowedComparesResults []compareResult, failMessage string, msgAndArgs ...interface{}) bool { objKind := reflect.TypeOf(object).Kind() if objKind != reflect.Slice && objKind != reflect.Array { return false @@ -33,7 +33,7 @@ func isOrdered(t TestingT, object interface{}, allowedComparesResults []CompareT compareResult, isComparable := compare(prevValueInterface, valueInterface, firstValueKind) if !isComparable { - return Fail(t, fmt.Sprintf("Can not compare type \"%s\" and \"%s\"", reflect.TypeOf(value), reflect.TypeOf(prevValue)), msgAndArgs...) + return Fail(t, fmt.Sprintf(`Can not compare type "%T" and "%T"`, value, prevValue), msgAndArgs...) } if !containsValue(allowedComparesResults, compareResult) { @@ -50,7 +50,7 @@ func isOrdered(t TestingT, object interface{}, allowedComparesResults []CompareT // assert.IsIncreasing(t, []float{1, 2}) // assert.IsIncreasing(t, []string{"a", "b"}) func IsIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - return isOrdered(t, object, []CompareType{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs...) + return isOrdered(t, object, []compareResult{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs...) } // IsNonIncreasing asserts that the collection is not increasing @@ -59,7 +59,7 @@ func IsIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) boo // assert.IsNonIncreasing(t, []float{2, 1}) // assert.IsNonIncreasing(t, []string{"b", "a"}) func IsNonIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - return isOrdered(t, object, []CompareType{compareEqual, compareGreater}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs...) + return isOrdered(t, object, []compareResult{compareEqual, compareGreater}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs...) } // IsDecreasing asserts that the collection is decreasing @@ -68,7 +68,7 @@ func IsNonIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) // assert.IsDecreasing(t, []float{2, 1}) // assert.IsDecreasing(t, []string{"b", "a"}) func IsDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - return isOrdered(t, object, []CompareType{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs...) + return isOrdered(t, object, []compareResult{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs...) } // IsNonDecreasing asserts that the collection is not decreasing @@ -77,5 +77,5 @@ func IsDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) boo // assert.IsNonDecreasing(t, []float{1, 2}) // assert.IsNonDecreasing(t, []string{"a", "b"}) func IsNonDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - return isOrdered(t, object, []CompareType{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs...) + return isOrdered(t, object, []compareResult{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs...) } diff --git a/vendor/github.com/stretchr/testify/assert/assertions.go b/vendor/github.com/stretchr/testify/assert/assertions.go index a55d1bba9..de8de0cb6 100644 --- a/vendor/github.com/stretchr/testify/assert/assertions.go +++ b/vendor/github.com/stretchr/testify/assert/assertions.go @@ -19,7 +19,9 @@ import ( "github.com/davecgh/go-spew/spew" "github.com/pmezard/go-difflib/difflib" - yaml "gopkg.in/yaml.v3" + + // Wrapper around gopkg.in/yaml.v3 + "github.com/stretchr/testify/assert/yaml" ) //go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=assert -template=assertion_format.go.tmpl" @@ -45,6 +47,10 @@ type BoolAssertionFunc func(TestingT, bool, ...interface{}) bool // for table driven tests. type ErrorAssertionFunc func(TestingT, error, ...interface{}) bool +// PanicAssertionFunc is a common function prototype when validating a panic value. Can be useful +// for table driven tests. +type PanicAssertionFunc = func(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool + // Comparison is a custom function that returns true on success and false on failure type Comparison func() (success bool) @@ -110,7 +116,12 @@ func copyExportedFields(expected interface{}) interface{} { return result.Interface() case reflect.Array, reflect.Slice: - result := reflect.MakeSlice(expectedType, expectedValue.Len(), expectedValue.Len()) + var result reflect.Value + if expectedKind == reflect.Array { + result = reflect.New(reflect.ArrayOf(expectedValue.Len(), expectedType.Elem())).Elem() + } else { + result = reflect.MakeSlice(expectedType, expectedValue.Len(), expectedValue.Len()) + } for i := 0; i < expectedValue.Len(); i++ { index := expectedValue.Index(i) if isNil(index) { @@ -140,6 +151,8 @@ func copyExportedFields(expected interface{}) interface{} { // structures. // // This function does no assertion of any kind. +// +// Deprecated: Use [EqualExportedValues] instead. func ObjectsExportedFieldsAreEqual(expected, actual interface{}) bool { expectedCleaned := copyExportedFields(expected) actualCleaned := copyExportedFields(actual) @@ -153,17 +166,40 @@ func ObjectsAreEqualValues(expected, actual interface{}) bool { return true } - actualType := reflect.TypeOf(actual) - if actualType == nil { + expectedValue := reflect.ValueOf(expected) + actualValue := reflect.ValueOf(actual) + if !expectedValue.IsValid() || !actualValue.IsValid() { return false } - expectedValue := reflect.ValueOf(expected) - if expectedValue.IsValid() && expectedValue.Type().ConvertibleTo(actualType) { + + expectedType := expectedValue.Type() + actualType := actualValue.Type() + if !expectedType.ConvertibleTo(actualType) { + return false + } + + if !isNumericType(expectedType) || !isNumericType(actualType) { // Attempt comparison after type conversion - return reflect.DeepEqual(expectedValue.Convert(actualType).Interface(), actual) + return reflect.DeepEqual( + expectedValue.Convert(actualType).Interface(), actual, + ) } - return false + // If BOTH values are numeric, there are chances of false positives due + // to overflow or underflow. So, we need to make sure to always convert + // the smaller type to a larger type before comparing. + if expectedType.Size() >= actualType.Size() { + return actualValue.Convert(expectedType).Interface() == expected + } + + return expectedValue.Convert(actualType).Interface() == actual +} + +// isNumericType returns true if the type is one of: +// int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, +// float32, float64, complex64, complex128 +func isNumericType(t reflect.Type) bool { + return t.Kind() >= reflect.Int && t.Kind() <= reflect.Complex128 } /* CallerInfo is necessary because the assert functions use the testing object @@ -174,59 +210,77 @@ the problem actually occurred in calling code.*/ // of each stack frame leading from the current test to the assert call that // failed. func CallerInfo() []string { - var pc uintptr - var ok bool var file string var line int var name string + const stackFrameBufferSize = 10 + pcs := make([]uintptr, stackFrameBufferSize) + callers := []string{} - for i := 0; ; i++ { - pc, file, line, ok = runtime.Caller(i) - if !ok { - // The breaks below failed to terminate the loop, and we ran off the - // end of the call stack. - break - } + offset := 1 - // This is a huge edge case, but it will panic if this is the case, see #180 - if file == "" { - break - } + for { + n := runtime.Callers(offset, pcs) - f := runtime.FuncForPC(pc) - if f == nil { - break - } - name = f.Name() - - // testing.tRunner is the standard library function that calls - // tests. Subtests are called directly by tRunner, without going through - // the Test/Benchmark/Example function that contains the t.Run calls, so - // with subtests we should break when we hit tRunner, without adding it - // to the list of callers. - if name == "testing.tRunner" { + if n == 0 { break } - parts := strings.Split(file, "/") - if len(parts) > 1 { - filename := parts[len(parts)-1] - dir := parts[len(parts)-2] - if (dir != "assert" && dir != "mock" && dir != "require") || filename == "mock_test.go" { - callers = append(callers, fmt.Sprintf("%s:%d", file, line)) + frames := runtime.CallersFrames(pcs[:n]) + + for { + frame, more := frames.Next() + pc = frame.PC + file = frame.File + line = frame.Line + + // This is a huge edge case, but it will panic if this is the case, see #180 + if file == "" { + break } - } - // Drop the package - segments := strings.Split(name, ".") - name = segments[len(segments)-1] - if isTest(name, "Test") || - isTest(name, "Benchmark") || - isTest(name, "Example") { - break + f := runtime.FuncForPC(pc) + if f == nil { + break + } + name = f.Name() + + // testing.tRunner is the standard library function that calls + // tests. Subtests are called directly by tRunner, without going through + // the Test/Benchmark/Example function that contains the t.Run calls, so + // with subtests we should break when we hit tRunner, without adding it + // to the list of callers. + if name == "testing.tRunner" { + break + } + + parts := strings.Split(file, "/") + if len(parts) > 1 { + filename := parts[len(parts)-1] + dir := parts[len(parts)-2] + if (dir != "assert" && dir != "mock" && dir != "require") || filename == "mock_test.go" { + callers = append(callers, fmt.Sprintf("%s:%d", file, line)) + } + } + + // Drop the package + dotPos := strings.LastIndexByte(name, '.') + name = name[dotPos+1:] + if isTest(name, "Test") || + isTest(name, "Benchmark") || + isTest(name, "Example") { + break + } + + if !more { + break + } } + + // Next batch + offset += cap(pcs) } return callers @@ -266,7 +320,7 @@ func messageFromMsgAndArgs(msgAndArgs ...interface{}) string { // Aligns the provided message so that all lines after the first line start at the same location as the first line. // Assumes that the first line starts at the correct location (after carriage return, tab, label, spacer and tab). -// The longestLabelLen parameter specifies the length of the longest label in the output (required becaues this is the +// The longestLabelLen parameter specifies the length of the longest label in the output (required because this is the // basis on which the alignment occurs). func indentMessageLines(message string, longestLabelLen int) string { outBuf := new(bytes.Buffer) @@ -382,19 +436,55 @@ func Implements(t TestingT, interfaceObject interface{}, object interface{}, msg return true } -// IsType asserts that the specified objects are of the same type. -func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool { +// NotImplements asserts that an object does not implement the specified interface. +// +// assert.NotImplements(t, (*MyInterface)(nil), new(MyObject)) +func NotImplements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() } + interfaceType := reflect.TypeOf(interfaceObject).Elem() - if !ObjectsAreEqual(reflect.TypeOf(object), reflect.TypeOf(expectedType)) { - return Fail(t, fmt.Sprintf("Object expected to be of type %v, but was %v", reflect.TypeOf(expectedType), reflect.TypeOf(object)), msgAndArgs...) + if object == nil { + return Fail(t, fmt.Sprintf("Cannot check if nil does not implement %v", interfaceType), msgAndArgs...) + } + if reflect.TypeOf(object).Implements(interfaceType) { + return Fail(t, fmt.Sprintf("%T implements %v", object, interfaceType), msgAndArgs...) } return true } +func isType(expectedType, object interface{}) bool { + return ObjectsAreEqual(reflect.TypeOf(object), reflect.TypeOf(expectedType)) +} + +// IsType asserts that the specified objects are of the same type. +// +// assert.IsType(t, &MyStruct{}, &MyStruct{}) +func IsType(t TestingT, expectedType, object interface{}, msgAndArgs ...interface{}) bool { + if isType(expectedType, object) { + return true + } + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Fail(t, fmt.Sprintf("Object expected to be of type %T, but was %T", expectedType, object), msgAndArgs...) +} + +// IsNotType asserts that the specified objects are not of the same type. +// +// assert.IsNotType(t, &NotMyStruct{}, &MyStruct{}) +func IsNotType(t TestingT, theType, object interface{}, msgAndArgs ...interface{}) bool { + if !isType(theType, object) { + return true + } + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Fail(t, fmt.Sprintf("Object type expected to be different than %T", theType), msgAndArgs...) +} + // Equal asserts that two objects are equal. // // assert.Equal(t, 123, 123) @@ -420,7 +510,6 @@ func Equal(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) } return true - } // validateEqualArgs checks whether provided arguments can be safely used in the @@ -447,10 +536,17 @@ func Same(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) b h.Helper() } - if !samePointers(expected, actual) { + same, ok := samePointers(expected, actual) + if !ok { + return Fail(t, "Both arguments must be pointers", msgAndArgs...) + } + + if !same { + // both are pointers but not the same type & pointing to the same address return Fail(t, fmt.Sprintf("Not same: \n"+ - "expected: %p %#v\n"+ - "actual : %p %#v", expected, expected, actual, actual), msgAndArgs...) + "expected: %p %#[1]v\n"+ + "actual : %p %#[2]v", + expected, actual), msgAndArgs...) } return true @@ -467,36 +563,44 @@ func NotSame(t TestingT, expected, actual interface{}, msgAndArgs ...interface{} h.Helper() } - if samePointers(expected, actual) { + same, ok := samePointers(expected, actual) + if !ok { + // fails when the arguments are not pointers + return !(Fail(t, "Both arguments must be pointers", msgAndArgs...)) + } + + if same { return Fail(t, fmt.Sprintf( - "Expected and actual point to the same object: %p %#v", - expected, expected), msgAndArgs...) + "Expected and actual point to the same object: %p %#[1]v", + expected), msgAndArgs...) } return true } -// samePointers compares two generic interface objects and returns whether -// they point to the same object -func samePointers(first, second interface{}) bool { +// samePointers checks if two generic interface objects are pointers of the same +// type pointing to the same object. It returns two values: same indicating if +// they are the same type and point to the same object, and ok indicating that +// both inputs are pointers. +func samePointers(first, second interface{}) (same bool, ok bool) { firstPtr, secondPtr := reflect.ValueOf(first), reflect.ValueOf(second) if firstPtr.Kind() != reflect.Ptr || secondPtr.Kind() != reflect.Ptr { - return false + return false, false // not both are pointers } firstType, secondType := reflect.TypeOf(first), reflect.TypeOf(second) if firstType != secondType { - return false + return false, true // both are pointers, but of different types } // compare pointer addresses - return first == second + return first == second, true } // formatUnequalValues takes two values of arbitrary types and returns string // representations appropriate to be presented to the user. // // If the values are not of like type, the returned strings will be prefixed -// with the type name, and the value will be enclosed in parenthesis similar +// with the type name, and the value will be enclosed in parentheses similar // to a type conversion in the Go grammar. func formatUnequalValues(expected, actual interface{}) (e string, a string) { if reflect.TypeOf(expected) != reflect.TypeOf(actual) { @@ -523,8 +627,8 @@ func truncatingFormat(data interface{}) string { return value } -// EqualValues asserts that two objects are equal or convertable to the same types -// and equal. +// EqualValues asserts that two objects are equal or convertible to the larger +// type and equal. // // assert.EqualValues(t, uint32(123), int32(123)) func EqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { @@ -541,7 +645,6 @@ func EqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interfa } return true - } // EqualExportedValues asserts that the types of two objects are equal and their public @@ -566,14 +669,6 @@ func EqualExportedValues(t TestingT, expected, actual interface{}, msgAndArgs .. return Fail(t, fmt.Sprintf("Types expected to match exactly\n\t%v != %v", aType, bType), msgAndArgs...) } - if aType.Kind() != reflect.Struct { - return Fail(t, fmt.Sprintf("Types expected to both be struct \n\t%v != %v", aType.Kind(), reflect.Struct), msgAndArgs...) - } - - if bType.Kind() != reflect.Struct { - return Fail(t, fmt.Sprintf("Types expected to both be struct \n\t%v != %v", bType.Kind(), reflect.Struct), msgAndArgs...) - } - expected = copyExportedFields(expected) actual = copyExportedFields(actual) @@ -604,7 +699,6 @@ func Exactly(t TestingT, expected, actual interface{}, msgAndArgs ...interface{} } return Equal(t, expected, actual, msgAndArgs...) - } // NotNil asserts that the specified object is not nil. @@ -620,17 +714,6 @@ func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { return Fail(t, "Expected value not to be nil.", msgAndArgs...) } -// containsKind checks if a specified kind in the slice of kinds. -func containsKind(kinds []reflect.Kind, kind reflect.Kind) bool { - for i := 0; i < len(kinds); i++ { - if kind == kinds[i] { - return true - } - } - - return false -} - // isNil checks if a specified object is nil or not, without Failing. func isNil(object interface{}) bool { if object == nil { @@ -638,16 +721,13 @@ func isNil(object interface{}) bool { } value := reflect.ValueOf(object) - kind := value.Kind() - isNilableKind := containsKind( - []reflect.Kind{ - reflect.Chan, reflect.Func, - reflect.Interface, reflect.Map, - reflect.Ptr, reflect.Slice, reflect.UnsafePointer}, - kind) - - if isNilableKind && value.IsNil() { - return true + switch value.Kind() { + case + reflect.Chan, reflect.Func, + reflect.Interface, reflect.Map, + reflect.Ptr, reflect.Slice, reflect.UnsafePointer: + + return value.IsNil() } return false @@ -668,37 +748,45 @@ func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { // isEmpty gets whether the specified object is considered empty or not. func isEmpty(object interface{}) bool { - // get nil case out of the way if object == nil { return true } - objValue := reflect.ValueOf(object) + return isEmptyValue(reflect.ValueOf(object)) +} +// isEmptyValue gets whether the specified reflect.Value is considered empty or not. +func isEmptyValue(objValue reflect.Value) bool { + if objValue.IsZero() { + return true + } + // Special cases of non-zero values that we consider empty switch objValue.Kind() { // collection types are empty when they have no element + // Note: array types are empty when they match their zero-initialized state. case reflect.Chan, reflect.Map, reflect.Slice: return objValue.Len() == 0 - // pointers are empty if nil or if the value they point to is empty + // non-nil pointers are empty if the value they point to is empty case reflect.Ptr: - if objValue.IsNil() { - return true - } - deref := objValue.Elem().Interface() - return isEmpty(deref) - // for all other types, compare against the zero value - // array types are empty when they match their zero-initialized state - default: - zero := reflect.Zero(objValue.Type()) - return reflect.DeepEqual(object, zero.Interface()) + return isEmptyValue(objValue.Elem()) } + return false } -// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either -// a slice or a channel with len == 0. +// Empty asserts that the given value is "empty". +// +// [Zero values] are "empty". +// +// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). +// +// Slices, maps and channels with zero length are "empty". +// +// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". // // assert.Empty(t, obj) +// +// [Zero values]: https://go.dev/ref/spec#The_zero_value func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { pass := isEmpty(object) if !pass { @@ -709,11 +797,9 @@ func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { } return pass - } -// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either -// a slice or a channel with len == 0. +// NotEmpty asserts that the specified object is NOT [Empty]. // // if assert.NotEmpty(t, obj) { // assert.Equal(t, "two", obj[1]) @@ -728,19 +814,16 @@ func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { } return pass - } -// getLen try to get length of object. -// return (false, 0) if impossible. -func getLen(x interface{}) (ok bool, length int) { +// getLen tries to get the length of an object. +// It returns (0, false) if impossible. +func getLen(x interface{}) (length int, ok bool) { v := reflect.ValueOf(x) defer func() { - if e := recover(); e != nil { - ok = false - } + ok = recover() == nil }() - return true, v.Len() + return v.Len(), true } // Len asserts that the specified object has specific length. @@ -751,13 +834,13 @@ func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) if h, ok := t.(tHelper); ok { h.Helper() } - ok, l := getLen(object) + l, ok := getLen(object) if !ok { - return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", object), msgAndArgs...) + return Fail(t, fmt.Sprintf("\"%v\" could not be applied builtin len()", object), msgAndArgs...) } if l != length { - return Fail(t, fmt.Sprintf("\"%s\" should have %d item(s), but has %d", object, length, l), msgAndArgs...) + return Fail(t, fmt.Sprintf("\"%v\" should have %d item(s), but has %d", object, length, l), msgAndArgs...) } return true } @@ -774,7 +857,6 @@ func True(t TestingT, value bool, msgAndArgs ...interface{}) bool { } return true - } // False asserts that the specified value is false. @@ -789,7 +871,6 @@ func False(t TestingT, value bool, msgAndArgs ...interface{}) bool { } return true - } // NotEqual asserts that the specified values are NOT equal. @@ -812,7 +893,6 @@ func NotEqual(t TestingT, expected, actual interface{}, msgAndArgs ...interface{ } return true - } // NotEqualValues asserts that two objects are not equal even when converted to the same type @@ -835,7 +915,6 @@ func NotEqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...inte // return (true, false) if element was not found. // return (true, true) if element was found. func containsElement(list interface{}, element interface{}) (ok, found bool) { - listValue := reflect.ValueOf(list) listType := reflect.TypeOf(list) if listType == nil { @@ -870,7 +949,6 @@ func containsElement(list interface{}, element interface{}) (ok, found bool) { } } return true, false - } // Contains asserts that the specified string, list(array, slice...) or map contains the @@ -893,7 +971,6 @@ func Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bo } return true - } // NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the @@ -916,13 +993,17 @@ func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) } return true - } -// Subset asserts that the specified list(array, slice...) contains all -// elements given in the specified subset(array, slice...). +// Subset asserts that the list (array, slice, or map) contains all elements +// given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // -// assert.Subset(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]") +// assert.Subset(t, [1, 2, 3], [1, 2]) +// assert.Subset(t, {"x": 1, "y": 2}, {"x": 1}) +// assert.Subset(t, [1, 2, 3], {1: "one", 2: "two"}) +// assert.Subset(t, {"x": 1, "y": 2}, ["x"]) func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) { if h, ok := t.(tHelper); ok { h.Helper() @@ -937,7 +1018,7 @@ func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok } subsetKind := reflect.TypeOf(subset).Kind() - if subsetKind != reflect.Array && subsetKind != reflect.Slice && listKind != reflect.Map { + if subsetKind != reflect.Array && subsetKind != reflect.Slice && subsetKind != reflect.Map { return Fail(t, fmt.Sprintf("%q has an unsupported type %s", subset, subsetKind), msgAndArgs...) } @@ -961,6 +1042,13 @@ func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok } subsetList := reflect.ValueOf(subset) + if subsetKind == reflect.Map { + keys := make([]interface{}, subsetList.Len()) + for idx, key := range subsetList.MapKeys() { + keys[idx] = key.Interface() + } + subsetList = reflect.ValueOf(keys) + } for i := 0; i < subsetList.Len(); i++ { element := subsetList.Index(i).Interface() ok, found := containsElement(list, element) @@ -975,10 +1063,15 @@ func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok return true } -// NotSubset asserts that the specified list(array, slice...) contains not all -// elements given in the specified subset(array, slice...). +// NotSubset asserts that the list (array, slice, or map) does NOT contain all +// elements given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // -// assert.NotSubset(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]") +// assert.NotSubset(t, [1, 3, 4], [1, 2]) +// assert.NotSubset(t, {"x": 1, "y": 2}, {"z": 3}) +// assert.NotSubset(t, [1, 3, 4], {1: "one", 2: "two"}) +// assert.NotSubset(t, {"x": 1, "y": 2}, ["z"]) func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) { if h, ok := t.(tHelper); ok { h.Helper() @@ -993,7 +1086,7 @@ func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) } subsetKind := reflect.TypeOf(subset).Kind() - if subsetKind != reflect.Array && subsetKind != reflect.Slice && listKind != reflect.Map { + if subsetKind != reflect.Array && subsetKind != reflect.Slice && subsetKind != reflect.Map { return Fail(t, fmt.Sprintf("%q has an unsupported type %s", subset, subsetKind), msgAndArgs...) } @@ -1017,11 +1110,18 @@ func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) } subsetList := reflect.ValueOf(subset) + if subsetKind == reflect.Map { + keys := make([]interface{}, subsetList.Len()) + for idx, key := range subsetList.MapKeys() { + keys[idx] = key.Interface() + } + subsetList = reflect.ValueOf(keys) + } for i := 0; i < subsetList.Len(); i++ { element := subsetList.Index(i).Interface() ok, found := containsElement(list, element) if !ok { - return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", list), msgAndArgs...) + return Fail(t, fmt.Sprintf("%q could not be applied builtin len()", list), msgAndArgs...) } if !found { return true @@ -1127,6 +1227,39 @@ func formatListDiff(listA, listB interface{}, extraA, extraB []interface{}) stri return msg.String() } +// NotElementsMatch asserts that the specified listA(array, slice...) is NOT equal to specified +// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, +// the number of appearances of each of them in both lists should not match. +// This is an inverse of ElementsMatch. +// +// assert.NotElementsMatch(t, [1, 1, 2, 3], [1, 1, 2, 3]) -> false +// +// assert.NotElementsMatch(t, [1, 1, 2, 3], [1, 2, 3]) -> true +// +// assert.NotElementsMatch(t, [1, 2, 3], [1, 2, 4]) -> true +func NotElementsMatch(t TestingT, listA, listB interface{}, msgAndArgs ...interface{}) (ok bool) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if isEmpty(listA) && isEmpty(listB) { + return Fail(t, "listA and listB contain the same elements", msgAndArgs) + } + + if !isList(t, listA, msgAndArgs...) { + return Fail(t, "listA is not a list type", msgAndArgs...) + } + if !isList(t, listB, msgAndArgs...) { + return Fail(t, "listB is not a list type", msgAndArgs...) + } + + extraA, extraB := diffLists(listA, listB) + if len(extraA) == 0 && len(extraB) == 0 { + return Fail(t, "listA and listB contain the same elements", msgAndArgs) + } + + return true +} + // Condition uses a Comparison to assert a complex condition. func Condition(t TestingT, comp Comparison, msgAndArgs ...interface{}) bool { if h, ok := t.(tHelper); ok { @@ -1439,12 +1572,15 @@ func InEpsilon(t TestingT, expected, actual interface{}, epsilon float64, msgAnd h.Helper() } if math.IsNaN(epsilon) { - return Fail(t, "epsilon must not be NaN") + return Fail(t, "epsilon must not be NaN", msgAndArgs...) } actualEpsilon, err := calcRelativeError(expected, actual) if err != nil { return Fail(t, err.Error(), msgAndArgs...) } + if math.IsNaN(actualEpsilon) { + return Fail(t, "relative error is NaN", msgAndArgs...) + } if actualEpsilon > epsilon { return Fail(t, fmt.Sprintf("Relative error is too high: %#v (expected)\n"+ " < %#v (actual)", epsilon, actualEpsilon), msgAndArgs...) @@ -1458,19 +1594,26 @@ func InEpsilonSlice(t TestingT, expected, actual interface{}, epsilon float64, m if h, ok := t.(tHelper); ok { h.Helper() } - if expected == nil || actual == nil || - reflect.TypeOf(actual).Kind() != reflect.Slice || - reflect.TypeOf(expected).Kind() != reflect.Slice { + + if expected == nil || actual == nil { return Fail(t, "Parameters must be slice", msgAndArgs...) } - actualSlice := reflect.ValueOf(actual) expectedSlice := reflect.ValueOf(expected) + actualSlice := reflect.ValueOf(actual) - for i := 0; i < actualSlice.Len(); i++ { - result := InEpsilon(t, actualSlice.Index(i).Interface(), expectedSlice.Index(i).Interface(), epsilon) - if !result { - return result + if expectedSlice.Type().Kind() != reflect.Slice { + return Fail(t, "Expected value must be slice", msgAndArgs...) + } + + expectedLen := expectedSlice.Len() + if !IsType(t, expected, actual) || !Len(t, actual, expectedLen) { + return false + } + + for i := 0; i < expectedLen; i++ { + if !InEpsilon(t, expectedSlice.Index(i).Interface(), actualSlice.Index(i).Interface(), epsilon, "at index %d", i) { + return false } } @@ -1500,10 +1643,8 @@ func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool { // Error asserts that a function returned an error (i.e. not `nil`). // -// actualObj, err := SomeFunction() -// if assert.Error(t, err) { -// assert.Equal(t, expectedError, err) -// } +// actualObj, err := SomeFunction() +// assert.Error(t, err) func Error(t TestingT, err error, msgAndArgs ...interface{}) bool { if err == nil { if h, ok := t.(tHelper); ok { @@ -1561,7 +1702,6 @@ func ErrorContains(t TestingT, theError error, contains string, msgAndArgs ...in // matchRegexp return true if a specified regexp matches a string. func matchRegexp(rx interface{}, str interface{}) bool { - var r *regexp.Regexp if rr, ok := rx.(*regexp.Regexp); ok { r = rr @@ -1569,8 +1709,14 @@ func matchRegexp(rx interface{}, str interface{}) bool { r = regexp.MustCompile(fmt.Sprint(rx)) } - return (r.FindStringIndex(fmt.Sprint(str)) != nil) - + switch v := str.(type) { + case []byte: + return r.Match(v) + case string: + return r.MatchString(v) + default: + return r.MatchString(fmt.Sprint(v)) + } } // Regexp asserts that a specified regexp matches a string. @@ -1606,7 +1752,6 @@ func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interf } return !match - } // Zero asserts that i is the zero value for its type. @@ -1717,6 +1862,11 @@ func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{ return Fail(t, fmt.Sprintf("Expected value ('%s') is not valid json.\nJSON parsing error: '%s'", expected, err.Error()), msgAndArgs...) } + // Shortcut if same bytes + if actual == expected { + return true + } + if err := json.Unmarshal([]byte(actual), &actualJSONAsInterface); err != nil { return Fail(t, fmt.Sprintf("Input ('%s') needs to be valid json.\nJSON parsing error: '%s'", actual, err.Error()), msgAndArgs...) } @@ -1735,6 +1885,11 @@ func YAMLEq(t TestingT, expected string, actual string, msgAndArgs ...interface{ return Fail(t, fmt.Sprintf("Expected value ('%s') is not valid yaml.\nYAML parsing error: '%s'", expected, err.Error()), msgAndArgs...) } + // Shortcut if same bytes + if actual == expected { + return true + } + if err := yaml.Unmarshal([]byte(actual), &actualYAMLAsInterface); err != nil { return Fail(t, fmt.Sprintf("Input ('%s') needs to be valid yaml.\nYAML error: '%s'", actual, err.Error()), msgAndArgs...) } @@ -1822,7 +1977,7 @@ var spewConfigStringerEnabled = spew.ConfigState{ MaxDepth: 10, } -type tHelper interface { +type tHelper = interface { Helper() } @@ -1836,6 +1991,7 @@ func Eventually(t TestingT, condition func() bool, waitFor time.Duration, tick t } ch := make(chan bool, 1) + checkCond := func() { ch <- condition() } timer := time.NewTimer(waitFor) defer timer.Stop() @@ -1843,52 +1999,69 @@ func Eventually(t TestingT, condition func() bool, waitFor time.Duration, tick t ticker := time.NewTicker(tick) defer ticker.Stop() - for tick := ticker.C; ; { + var tickC <-chan time.Time + + // Check the condition once first on the initial call. + go checkCond() + + for { select { case <-timer.C: return Fail(t, "Condition never satisfied", msgAndArgs...) - case <-tick: - tick = nil - go func() { ch <- condition() }() + case <-tickC: + tickC = nil + go checkCond() case v := <-ch: if v { return true } - tick = ticker.C + tickC = ticker.C } } } // CollectT implements the TestingT interface and collects all errors. type CollectT struct { + // A slice of errors. Non-nil slice denotes a failure. + // If it's non-nil but len(c.errors) == 0, this is also a failure + // obtained by direct c.FailNow() call. errors []error } +// Helper is like [testing.T.Helper] but does nothing. +func (CollectT) Helper() {} + // Errorf collects the error. func (c *CollectT) Errorf(format string, args ...interface{}) { c.errors = append(c.errors, fmt.Errorf(format, args...)) } -// FailNow panics. +// FailNow stops execution by calling runtime.Goexit. func (c *CollectT) FailNow() { - panic("Assertion failed") + c.fail() + runtime.Goexit() } -// Reset clears the collected errors. -func (c *CollectT) Reset() { - c.errors = nil +// Deprecated: That was a method for internal usage that should not have been published. Now just panics. +func (*CollectT) Reset() { + panic("Reset() is deprecated") } -// Copy copies the collected errors to the supplied t. -func (c *CollectT) Copy(t TestingT) { - if tt, ok := t.(tHelper); ok { - tt.Helper() - } - for _, err := range c.errors { - t.Errorf("%v", err) +// Deprecated: That was a method for internal usage that should not have been published. Now just panics. +func (*CollectT) Copy(TestingT) { + panic("Copy() is deprecated") +} + +func (c *CollectT) fail() { + if !c.failed() { + c.errors = []error{} // Make it non-nil to mark a failure. } } +func (c *CollectT) failed() bool { + return c.errors != nil +} + // EventuallyWithT asserts that given condition will be met in waitFor time, // periodically checking target function each tick. In contrast to Eventually, // it supplies a CollectT to the condition function, so that the condition @@ -1906,14 +2079,22 @@ func (c *CollectT) Copy(t TestingT) { // assert.EventuallyWithT(t, func(c *assert.CollectT) { // // add assertions as needed; any assertion failure will fail the current tick // assert.True(c, externalValue, "expected 'externalValue' to be true") -// }, 1*time.Second, 10*time.Second, "external state has not changed to 'true'; still false") +// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false") func EventuallyWithT(t TestingT, condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() } - collect := new(CollectT) - ch := make(chan bool, 1) + var lastFinishedTickErrs []error + ch := make(chan *CollectT, 1) + + checkCond := func() { + collect := new(CollectT) + defer func() { + ch <- collect + }() + condition(collect) + } timer := time.NewTimer(waitFor) defer timer.Stop() @@ -1921,23 +2102,28 @@ func EventuallyWithT(t TestingT, condition func(collect *CollectT), waitFor time ticker := time.NewTicker(tick) defer ticker.Stop() - for tick := ticker.C; ; { + var tickC <-chan time.Time + + // Check the condition once first on the initial call. + go checkCond() + + for { select { case <-timer.C: - collect.Copy(t) + for _, err := range lastFinishedTickErrs { + t.Errorf("%v", err) + } return Fail(t, "Condition never satisfied", msgAndArgs...) - case <-tick: - tick = nil - collect.Reset() - go func() { - condition(collect) - ch <- len(collect.errors) == 0 - }() - case v := <-ch: - if v { + case <-tickC: + tickC = nil + go checkCond() + case collect := <-ch: + if !collect.failed() { return true } - tick = ticker.C + // Keep the errors from the last ended condition, so that they can be copied to t if timeout is reached. + lastFinishedTickErrs = collect.errors + tickC = ticker.C } } } @@ -1952,6 +2138,7 @@ func Never(t TestingT, condition func() bool, waitFor time.Duration, tick time.D } ch := make(chan bool, 1) + checkCond := func() { ch <- condition() } timer := time.NewTimer(waitFor) defer timer.Stop() @@ -1959,18 +2146,23 @@ func Never(t TestingT, condition func() bool, waitFor time.Duration, tick time.D ticker := time.NewTicker(tick) defer ticker.Stop() - for tick := ticker.C; ; { + var tickC <-chan time.Time + + // Check the condition once first on the initial call. + go checkCond() + + for { select { case <-timer.C: return true - case <-tick: - tick = nil - go func() { ch <- condition() }() + case <-tickC: + tickC = nil + go checkCond() case v := <-ch: if v { return Fail(t, "Condition satisfied", msgAndArgs...) } - tick = ticker.C + tickC = ticker.C } } } @@ -1988,9 +2180,12 @@ func ErrorIs(t TestingT, err, target error, msgAndArgs ...interface{}) bool { var expectedText string if target != nil { expectedText = target.Error() + if err == nil { + return Fail(t, fmt.Sprintf("Expected error with %q in chain but got nil.", expectedText), msgAndArgs...) + } } - chain := buildErrorChainString(err) + chain := buildErrorChainString(err, false) return Fail(t, fmt.Sprintf("Target error should be in err chain:\n"+ "expected: %q\n"+ @@ -1998,7 +2193,7 @@ func ErrorIs(t TestingT, err, target error, msgAndArgs ...interface{}) bool { ), msgAndArgs...) } -// NotErrorIs asserts that at none of the errors in err's chain matches target. +// NotErrorIs asserts that none of the errors in err's chain matches target. // This is a wrapper for errors.Is. func NotErrorIs(t TestingT, err, target error, msgAndArgs ...interface{}) bool { if h, ok := t.(tHelper); ok { @@ -2013,7 +2208,7 @@ func NotErrorIs(t TestingT, err, target error, msgAndArgs ...interface{}) bool { expectedText = target.Error() } - chain := buildErrorChainString(err) + chain := buildErrorChainString(err, false) return Fail(t, fmt.Sprintf("Target error should not be in err chain:\n"+ "found: %q\n"+ @@ -2031,24 +2226,70 @@ func ErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{ return true } - chain := buildErrorChainString(err) + expectedType := reflect.TypeOf(target).Elem().String() + if err == nil { + return Fail(t, fmt.Sprintf("An error is expected but got nil.\n"+ + "expected: %s", expectedType), msgAndArgs...) + } + + chain := buildErrorChainString(err, true) return Fail(t, fmt.Sprintf("Should be in error chain:\n"+ - "expected: %q\n"+ - "in chain: %s", target, chain, + "expected: %s\n"+ + "in chain: %s", expectedType, chain, + ), msgAndArgs...) +} + +// NotErrorAs asserts that none of the errors in err's chain matches target, +// but if so, sets target to that error value. +func NotErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if !errors.As(err, target) { + return true + } + + chain := buildErrorChainString(err, true) + + return Fail(t, fmt.Sprintf("Target error should not be in err chain:\n"+ + "found: %s\n"+ + "in chain: %s", reflect.TypeOf(target).Elem().String(), chain, ), msgAndArgs...) } -func buildErrorChainString(err error) string { +func unwrapAll(err error) (errs []error) { + errs = append(errs, err) + switch x := err.(type) { + case interface{ Unwrap() error }: + err = x.Unwrap() + if err == nil { + return + } + errs = append(errs, unwrapAll(err)...) + case interface{ Unwrap() []error }: + for _, err := range x.Unwrap() { + errs = append(errs, unwrapAll(err)...) + } + } + return +} + +func buildErrorChainString(err error, withType bool) string { if err == nil { return "" } - e := errors.Unwrap(err) - chain := fmt.Sprintf("%q", err.Error()) - for e != nil { - chain += fmt.Sprintf("\n\t%q", e.Error()) - e = errors.Unwrap(e) + var chain string + errs := unwrapAll(err) + for i := range errs { + if i != 0 { + chain += "\n\t" + } + chain += fmt.Sprintf("%q", errs[i].Error()) + if withType { + chain += fmt.Sprintf(" (%T)", errs[i]) + } } return chain } diff --git a/vendor/github.com/stretchr/testify/assert/doc.go b/vendor/github.com/stretchr/testify/assert/doc.go index 4953981d3..a0b953aa5 100644 --- a/vendor/github.com/stretchr/testify/assert/doc.go +++ b/vendor/github.com/stretchr/testify/assert/doc.go @@ -1,5 +1,9 @@ // Package assert provides a set of comprehensive testing tools for use with the normal Go testing system. // +// # Note +// +// All functions in this package return a bool value indicating whether the assertion has passed. +// // # Example Usage // // The following is a complete example using assert in a standard test function: diff --git a/vendor/github.com/stretchr/testify/assert/http_assertions.go b/vendor/github.com/stretchr/testify/assert/http_assertions.go index d8038c28a..5a6bb75f2 100644 --- a/vendor/github.com/stretchr/testify/assert/http_assertions.go +++ b/vendor/github.com/stretchr/testify/assert/http_assertions.go @@ -12,7 +12,7 @@ import ( // an error if building a new request fails. func httpCode(handler http.HandlerFunc, method, url string, values url.Values) (int, error) { w := httptest.NewRecorder() - req, err := http.NewRequest(method, url, nil) + req, err := http.NewRequest(method, url, http.NoBody) if err != nil { return -1, err } @@ -32,12 +32,12 @@ func HTTPSuccess(t TestingT, handler http.HandlerFunc, method, url string, value } code, err := httpCode(handler, method, url, values) if err != nil { - Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err)) + Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err), msgAndArgs...) } isSuccessCode := code >= http.StatusOK && code <= http.StatusPartialContent if !isSuccessCode { - Fail(t, fmt.Sprintf("Expected HTTP success status code for %q but received %d", url+"?"+values.Encode(), code)) + Fail(t, fmt.Sprintf("Expected HTTP success status code for %q but received %d", url+"?"+values.Encode(), code), msgAndArgs...) } return isSuccessCode @@ -54,12 +54,12 @@ func HTTPRedirect(t TestingT, handler http.HandlerFunc, method, url string, valu } code, err := httpCode(handler, method, url, values) if err != nil { - Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err)) + Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err), msgAndArgs...) } isRedirectCode := code >= http.StatusMultipleChoices && code <= http.StatusTemporaryRedirect if !isRedirectCode { - Fail(t, fmt.Sprintf("Expected HTTP redirect status code for %q but received %d", url+"?"+values.Encode(), code)) + Fail(t, fmt.Sprintf("Expected HTTP redirect status code for %q but received %d", url+"?"+values.Encode(), code), msgAndArgs...) } return isRedirectCode @@ -76,12 +76,12 @@ func HTTPError(t TestingT, handler http.HandlerFunc, method, url string, values } code, err := httpCode(handler, method, url, values) if err != nil { - Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err)) + Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err), msgAndArgs...) } isErrorCode := code >= http.StatusBadRequest if !isErrorCode { - Fail(t, fmt.Sprintf("Expected HTTP error status code for %q but received %d", url+"?"+values.Encode(), code)) + Fail(t, fmt.Sprintf("Expected HTTP error status code for %q but received %d", url+"?"+values.Encode(), code), msgAndArgs...) } return isErrorCode @@ -98,12 +98,12 @@ func HTTPStatusCode(t TestingT, handler http.HandlerFunc, method, url string, va } code, err := httpCode(handler, method, url, values) if err != nil { - Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err)) + Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err), msgAndArgs...) } successful := code == statuscode if !successful { - Fail(t, fmt.Sprintf("Expected HTTP status code %d for %q but received %d", statuscode, url+"?"+values.Encode(), code)) + Fail(t, fmt.Sprintf("Expected HTTP status code %d for %q but received %d", statuscode, url+"?"+values.Encode(), code), msgAndArgs...) } return successful @@ -113,7 +113,10 @@ func HTTPStatusCode(t TestingT, handler http.HandlerFunc, method, url string, va // empty string if building a new request fails. func HTTPBody(handler http.HandlerFunc, method, url string, values url.Values) string { w := httptest.NewRecorder() - req, err := http.NewRequest(method, url+"?"+values.Encode(), nil) + if len(values) > 0 { + url += "?" + values.Encode() + } + req, err := http.NewRequest(method, url, http.NoBody) if err != nil { return "" } @@ -135,7 +138,7 @@ func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url string, contains := strings.Contains(body, fmt.Sprint(str)) if !contains { - Fail(t, fmt.Sprintf("Expected response body for \"%s\" to contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body)) + Fail(t, fmt.Sprintf("Expected response body for %q to contain %q but found %q", url+"?"+values.Encode(), str, body), msgAndArgs...) } return contains @@ -155,7 +158,7 @@ func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method, url strin contains := strings.Contains(body, fmt.Sprint(str)) if contains { - Fail(t, fmt.Sprintf("Expected response body for \"%s\" to NOT contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body)) + Fail(t, fmt.Sprintf("Expected response body for %q to NOT contain %q but found %q", url+"?"+values.Encode(), str, body), msgAndArgs...) } return !contains diff --git a/vendor/github.com/stretchr/testify/assert/yaml/yaml_custom.go b/vendor/github.com/stretchr/testify/assert/yaml/yaml_custom.go new file mode 100644 index 000000000..5a74c4f4d --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/yaml/yaml_custom.go @@ -0,0 +1,24 @@ +//go:build testify_yaml_custom && !testify_yaml_fail && !testify_yaml_default + +// Package yaml is an implementation of YAML functions that calls a pluggable implementation. +// +// This implementation is selected with the testify_yaml_custom build tag. +// +// go test -tags testify_yaml_custom +// +// This implementation can be used at build time to replace the default implementation +// to avoid linking with [gopkg.in/yaml.v3]. +// +// In your test package: +// +// import assertYaml "github.com/stretchr/testify/assert/yaml" +// +// func init() { +// assertYaml.Unmarshal = func (in []byte, out interface{}) error { +// // ... +// return nil +// } +// } +package yaml + +var Unmarshal func(in []byte, out interface{}) error diff --git a/vendor/github.com/stretchr/testify/assert/yaml/yaml_default.go b/vendor/github.com/stretchr/testify/assert/yaml/yaml_default.go new file mode 100644 index 000000000..0bae80e34 --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/yaml/yaml_default.go @@ -0,0 +1,36 @@ +//go:build !testify_yaml_fail && !testify_yaml_custom + +// Package yaml is just an indirection to handle YAML deserialization. +// +// This package is just an indirection that allows the builder to override the +// indirection with an alternative implementation of this package that uses +// another implementation of YAML deserialization. This allows to not either not +// use YAML deserialization at all, or to use another implementation than +// [gopkg.in/yaml.v3] (for example for license compatibility reasons, see [PR #1120]). +// +// Alternative implementations are selected using build tags: +// +// - testify_yaml_fail: [Unmarshal] always fails with an error +// - testify_yaml_custom: [Unmarshal] is a variable. Caller must initialize it +// before calling any of [github.com/stretchr/testify/assert.YAMLEq] or +// [github.com/stretchr/testify/assert.YAMLEqf]. +// +// Usage: +// +// go test -tags testify_yaml_fail +// +// You can check with "go list" which implementation is linked: +// +// go list -f '{{.Imports}}' github.com/stretchr/testify/assert/yaml +// go list -tags testify_yaml_fail -f '{{.Imports}}' github.com/stretchr/testify/assert/yaml +// go list -tags testify_yaml_custom -f '{{.Imports}}' github.com/stretchr/testify/assert/yaml +// +// [PR #1120]: https://github.com/stretchr/testify/pull/1120 +package yaml + +import goyaml "gopkg.in/yaml.v3" + +// Unmarshal is just a wrapper of [gopkg.in/yaml.v3.Unmarshal]. +func Unmarshal(in []byte, out interface{}) error { + return goyaml.Unmarshal(in, out) +} diff --git a/vendor/github.com/stretchr/testify/assert/yaml/yaml_fail.go b/vendor/github.com/stretchr/testify/assert/yaml/yaml_fail.go new file mode 100644 index 000000000..8041803fd --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/yaml/yaml_fail.go @@ -0,0 +1,17 @@ +//go:build testify_yaml_fail && !testify_yaml_custom && !testify_yaml_default + +// Package yaml is an implementation of YAML functions that always fail. +// +// This implementation can be used at build time to replace the default implementation +// to avoid linking with [gopkg.in/yaml.v3]: +// +// go test -tags testify_yaml_fail +package yaml + +import "errors" + +var errNotImplemented = errors.New("YAML functions are not available (see https://pkg.go.dev/github.com/stretchr/testify/assert/yaml)") + +func Unmarshal([]byte, interface{}) error { + return errNotImplemented +} diff --git a/vendor/github.com/stretchr/testify/mock/mock.go b/vendor/github.com/stretchr/testify/mock/mock.go index f4b42e44f..efc89deff 100644 --- a/vendor/github.com/stretchr/testify/mock/mock.go +++ b/vendor/github.com/stretchr/testify/mock/mock.go @@ -18,6 +18,9 @@ import ( "github.com/stretchr/testify/assert" ) +// regex for GCCGO functions +var gccgoRE = regexp.MustCompile(`\.pN\d+_`) + // TestingT is an interface wrapper around *testing.T type TestingT interface { Logf(format string, args ...interface{}) @@ -77,12 +80,12 @@ type Call struct { requires []*Call } -func newCall(parent *Mock, methodName string, callerInfo []string, methodArguments ...interface{}) *Call { +func newCall(parent *Mock, methodName string, callerInfo []string, methodArguments Arguments, returnArguments Arguments) *Call { return &Call{ Parent: parent, Method: methodName, Arguments: methodArguments, - ReturnArguments: make([]interface{}, 0), + ReturnArguments: returnArguments, callerInfo: callerInfo, Repeatability: 0, WaitFor: nil, @@ -111,7 +114,7 @@ func (c *Call) Return(returnArguments ...interface{}) *Call { return c } -// Panic specifies if the functon call should fail and the panic message +// Panic specifies if the function call should fail and the panic message // // Mock.On("DoSomething").Panic("test panic") func (c *Call) Panic(msg string) *Call { @@ -123,21 +126,21 @@ func (c *Call) Panic(msg string) *Call { return c } -// Once indicates that that the mock should only return the value once. +// Once indicates that the mock should only return the value once. // // Mock.On("MyMethod", arg1, arg2).Return(returnArg1, returnArg2).Once() func (c *Call) Once() *Call { return c.Times(1) } -// Twice indicates that that the mock should only return the value twice. +// Twice indicates that the mock should only return the value twice. // // Mock.On("MyMethod", arg1, arg2).Return(returnArg1, returnArg2).Twice() func (c *Call) Twice() *Call { return c.Times(2) } -// Times indicates that that the mock should only return the indicated number +// Times indicates that the mock should only return the indicated number // of times. // // Mock.On("MyMethod", arg1, arg2).Return(returnArg1, returnArg2).Times(5) @@ -205,9 +208,16 @@ func (c *Call) On(methodName string, arguments ...interface{}) *Call { return c.Parent.On(methodName, arguments...) } -// Unset removes a mock handler from being called. +// Unset removes all mock handlers that satisfy the call instance arguments from being +// called. Only supported on call instances with static input arguments. +// +// For example, the only handler remaining after the following would be "MyMethod(2, 2)": // -// test.On("func", mock.Anything).Unset() +// Mock. +// On("MyMethod", 2, 2).Return(0). +// On("MyMethod", 3, 3).Return(0). +// On("MyMethod", Anything, Anything).Return(0) +// Mock.On("MyMethod", 3, 3).Unset() func (c *Call) Unset() *Call { var unlockOnce sync.Once @@ -253,7 +263,7 @@ func (c *Call) Unset() *Call { // calls have been called as expected. The referenced calls may be from the // same mock instance and/or other mock instances. // -// Mock.On("Do").Return(nil).Notbefore( +// Mock.On("Do").Return(nil).NotBefore( // Mock.On("Init").Return(nil) // ) func (c *Call) NotBefore(calls ...*Call) *Call { @@ -270,6 +280,20 @@ func (c *Call) NotBefore(calls ...*Call) *Call { return c } +// InOrder defines the order in which the calls should be made +// +// For example: +// +// InOrder( +// Mock.On("init").Return(nil), +// Mock.On("Do").Return(nil), +// ) +func InOrder(calls ...*Call) { + for i := 1; i < len(calls); i++ { + calls[i].NotBefore(calls[i-1]) + } +} + // Mock is the workhorse used to track activity on another object. // For an example of its usage, refer to the "Example Usage" section at the top // of this document. @@ -314,7 +338,10 @@ func (m *Mock) TestData() objx.Map { Setting expectations */ -// Test sets the test struct variable of the mock object +// Test sets the [TestingT] on which errors will be reported, otherwise errors +// will cause a panic. +// Test should not be called on an object that is going to be used in a +// goroutine other than the one running the test function. func (m *Mock) Test(t TestingT) { m.mutex.Lock() defer m.mutex.Unlock() @@ -348,7 +375,8 @@ func (m *Mock) On(methodName string, arguments ...interface{}) *Call { m.mutex.Lock() defer m.mutex.Unlock() - c := newCall(m, methodName, assert.CallerInfo(), arguments...) + + c := newCall(m, methodName, assert.CallerInfo(), arguments, make([]interface{}, 0)) m.ExpectedCalls = append(m.ExpectedCalls, c) return c } @@ -455,9 +483,8 @@ func (m *Mock) Called(arguments ...interface{}) Arguments { // For Ex: github_com_docker_libkv_store_mock.WatchTree.pN39_github_com_docker_libkv_store_mock.Mock // uses interface information unlike golang github.com/docker/libkv/store/mock.(*Mock).WatchTree // With GCCGO we need to remove interface information starting from pN
. - re := regexp.MustCompile("\\.pN\\d+_") - if re.MatchString(functionPath) { - functionPath = re.Split(functionPath, -1)[0] + if gccgoRE.MatchString(functionPath) { + functionPath = gccgoRE.Split(functionPath, -1)[0] } parts := strings.Split(functionPath, ".") functionName := parts[len(parts)-1] @@ -474,10 +501,10 @@ func (m *Mock) MethodCalled(methodName string, arguments ...interface{}) Argumen found, call := m.findExpectedCall(methodName, arguments...) if found < 0 { - // expected call found but it has already been called with repeatable times + // expected call found, but it has already been called with repeatable times if call != nil { m.mutex.Unlock() - m.fail("\nassert: mock: The method has been called over %d times.\n\tEither do one more Mock.On(\"%s\").Return(...), or remove extra call.\n\tThis call was unexpected:\n\t\t%s\n\tat: %s", call.totalCalls, methodName, callString(methodName, arguments, true), assert.CallerInfo()) + m.fail("\nassert: mock: The method has been called over %d times.\n\tEither do one more Mock.On(%#v).Return(...), or remove extra call.\n\tThis call was unexpected:\n\t\t%s\n\tat: %s", call.totalCalls, methodName, callString(methodName, arguments, true), assert.CallerInfo()) } // we have to fail here - because we don't know what to do // as the return arguments. This is because: @@ -489,14 +516,15 @@ func (m *Mock) MethodCalled(methodName string, arguments ...interface{}) Argumen m.mutex.Unlock() if closestCall != nil { - m.fail("\n\nmock: Unexpected Method Call\n-----------------------------\n\n%s\n\nThe closest call I have is: \n\n%s\n\n%s\nDiff: %s", + m.fail("\n\nmock: Unexpected Method Call\n-----------------------------\n\n%s\n\nThe closest call I have is: \n\n%s\n\n%s\nDiff: %s\nat: %s\n", callString(methodName, arguments, true), callString(methodName, closestCall.Arguments, true), diffArguments(closestCall.Arguments, arguments), strings.TrimSpace(mismatch), + assert.CallerInfo(), ) } else { - m.fail("\nassert: mock: I don't know what to return because the method call was unexpected.\n\tEither do Mock.On(\"%s\").Return(...) first, or remove the %s() call.\n\tThis method was unexpected:\n\t\t%s\n\tat: %s", methodName, methodName, callString(methodName, arguments, true), assert.CallerInfo()) + m.fail("\nassert: mock: I don't know what to return because the method call was unexpected.\n\tEither do Mock.On(%#v).Return(...) first, or remove the %s() call.\n\tThis method was unexpected:\n\t\t%s\n\tat: %s", methodName, methodName, callString(methodName, arguments, true), assert.CallerInfo()) } } @@ -527,7 +555,7 @@ func (m *Mock) MethodCalled(methodName string, arguments ...interface{}) Argumen call.totalCalls++ // add the call - m.Calls = append(m.Calls, *newCall(m, methodName, assert.CallerInfo(), arguments...)) + m.Calls = append(m.Calls, *newCall(m, methodName, assert.CallerInfo(), arguments, call.ReturnArguments)) m.mutex.Unlock() // block if specified @@ -563,7 +591,7 @@ func (m *Mock) MethodCalled(methodName string, arguments ...interface{}) Argumen Assertions */ -type assertExpectationser interface { +type assertExpectationiser interface { AssertExpectations(TestingT) bool } @@ -580,7 +608,7 @@ func AssertExpectationsForObjects(t TestingT, testObjects ...interface{}) bool { t.Logf("Deprecated mock.AssertExpectationsForObjects(myMock.Mock) use mock.AssertExpectationsForObjects(myMock)") obj = m } - m := obj.(assertExpectationser) + m := obj.(assertExpectationiser) if !m.AssertExpectations(t) { t.Logf("Expectations didn't match for Mock: %+v", reflect.TypeOf(m)) return false @@ -592,6 +620,9 @@ func AssertExpectationsForObjects(t TestingT, testObjects ...interface{}) bool { // AssertExpectations asserts that everything specified with On and Return was // in fact called as expected. Calls may have occurred in any order. func (m *Mock) AssertExpectations(t TestingT) bool { + if s, ok := t.(interface{ Skipped() bool }); ok && s.Skipped() { + return true + } if h, ok := t.(tHelper); ok { h.Helper() } @@ -606,8 +637,8 @@ func (m *Mock) AssertExpectations(t TestingT) bool { satisfied, reason := m.checkExpectation(expectedCall) if !satisfied { failedExpectations++ + t.Logf(reason) } - t.Logf(reason) } if failedExpectations != 0 { @@ -640,7 +671,7 @@ func (m *Mock) AssertNumberOfCalls(t TestingT, methodName string, expectedCalls actualCalls++ } } - return assert.Equal(t, expectedCalls, actualCalls, fmt.Sprintf("Expected number of calls (%d) does not match the actual number of calls (%d).", expectedCalls, actualCalls)) + return assert.Equal(t, expectedCalls, actualCalls, fmt.Sprintf("Expected number of calls (%d) of method %s does not match the actual number of calls (%d).", expectedCalls, methodName, actualCalls)) } // AssertCalled asserts that the method was called. @@ -758,62 +789,79 @@ const ( Anything = "mock.Anything" ) -// AnythingOfTypeArgument is a string that contains the type of an argument +// AnythingOfTypeArgument contains the type of an argument +// for use when type checking. Used in [Arguments.Diff] and [Arguments.Assert]. +// +// Deprecated: this is an implementation detail that must not be used. Use the [AnythingOfType] constructor instead, example: +// +// m.On("Do", mock.AnythingOfType("string")) +// +// All explicit type declarations can be replaced with interface{} as is expected by [Mock.On], example: +// +// func anyString interface{} { +// return mock.AnythingOfType("string") +// } +type AnythingOfTypeArgument = anythingOfTypeArgument + +// anythingOfTypeArgument is a string that contains the type of an argument // for use when type checking. Used in Diff and Assert. -type AnythingOfTypeArgument string +type anythingOfTypeArgument string -// AnythingOfType returns an AnythingOfTypeArgument object containing the -// name of the type to check for. Used in Diff and Assert. +// AnythingOfType returns a special value containing the +// name of the type to check for. The type name will be matched against the type name returned by [reflect.Type.String]. +// +// Used in Diff and Assert. // // For example: // -// Assert(t, AnythingOfType("string"), AnythingOfType("int")) +// args.Assert(t, AnythingOfType("string"), AnythingOfType("int")) func AnythingOfType(t string) AnythingOfTypeArgument { - return AnythingOfTypeArgument(t) + return anythingOfTypeArgument(t) } // IsTypeArgument is a struct that contains the type of an argument -// for use when type checking. This is an alternative to AnythingOfType. -// Used in Diff and Assert. +// for use when type checking. This is an alternative to [AnythingOfType]. +// Used in [Arguments.Diff] and [Arguments.Assert]. type IsTypeArgument struct { - t interface{} + t reflect.Type } // IsType returns an IsTypeArgument object containing the type to check for. // You can provide a zero-value of the type to check. This is an -// alternative to AnythingOfType. Used in Diff and Assert. +// alternative to [AnythingOfType]. Used in [Arguments.Diff] and [Arguments.Assert]. // // For example: -// Assert(t, IsType(""), IsType(0)) +// +// args.Assert(t, IsType(""), IsType(0)) func IsType(t interface{}) *IsTypeArgument { - return &IsTypeArgument{t: t} + return &IsTypeArgument{t: reflect.TypeOf(t)} } -// FunctionalOptionsArgument is a struct that contains the type and value of an functional option argument -// for use when type checking. +// FunctionalOptionsArgument contains a list of functional options arguments +// expected for use when matching a list of arguments. type FunctionalOptionsArgument struct { - value interface{} + values []interface{} } // String returns the string representation of FunctionalOptionsArgument func (f *FunctionalOptionsArgument) String() string { var name string - tValue := reflect.ValueOf(f.value) - if tValue.Len() > 0 { - name = "[]" + reflect.TypeOf(tValue.Index(0).Interface()).String() + if len(f.values) > 0 { + name = "[]" + reflect.TypeOf(f.values[0]).String() } - return strings.Replace(fmt.Sprintf("%#v", f.value), "[]interface {}", name, 1) + return strings.Replace(fmt.Sprintf("%#v", f.values), "[]interface {}", name, 1) } -// FunctionalOptions returns an FunctionalOptionsArgument object containing the functional option type -// and the values to check of +// FunctionalOptions returns an [FunctionalOptionsArgument] object containing +// the expected functional-options to check for. // // For example: -// Assert(t, FunctionalOptions("[]foo.FunctionalOption", foo.Opt1(), foo.Opt2())) -func FunctionalOptions(value ...interface{}) *FunctionalOptionsArgument { +// +// args.Assert(t, FunctionalOptions(foo.Opt1("strValue"), foo.Opt2(613))) +func FunctionalOptions(values ...interface{}) *FunctionalOptionsArgument { return &FunctionalOptionsArgument{ - value: value, + values: values, } } @@ -860,10 +908,11 @@ func (f argumentMatcher) String() string { // and false otherwise. // // Example: -// m.On("Do", MatchedBy(func(req *http.Request) bool { return req.Host == "example.com" })) // -// |fn|, must be a function accepting a single argument (of the expected type) -// which returns a bool. If |fn| doesn't match the required signature, +// m.On("Do", MatchedBy(func(req *http.Request) bool { return req.Host == "example.com" })) +// +// fn must be a function accepting a single argument (of the expected type) +// which returns a bool. If fn doesn't match the required signature, // MatchedBy() panics. func MatchedBy(fn interface{}) argumentMatcher { fnType := reflect.TypeOf(fn) @@ -950,53 +999,52 @@ func (args Arguments) Diff(objects []interface{}) (string, int) { differences++ output = fmt.Sprintf("%s\t%d: FAIL: %s not matched by %s\n", output, i, actualFmt, matcher) } - } else if reflect.TypeOf(expected) == reflect.TypeOf((*AnythingOfTypeArgument)(nil)).Elem() { - // type checking - if reflect.TypeOf(actual).Name() != string(expected.(AnythingOfTypeArgument)) && reflect.TypeOf(actual).String() != string(expected.(AnythingOfTypeArgument)) { - // not match - differences++ - output = fmt.Sprintf("%s\t%d: FAIL: type %s != type %s - %s\n", output, i, expected, reflect.TypeOf(actual).Name(), actualFmt) - } - } else if reflect.TypeOf(expected) == reflect.TypeOf((*IsTypeArgument)(nil)) { - t := expected.(*IsTypeArgument).t - if reflect.TypeOf(t) != reflect.TypeOf(actual) { - differences++ - output = fmt.Sprintf("%s\t%d: FAIL: type %s != type %s - %s\n", output, i, reflect.TypeOf(t).Name(), reflect.TypeOf(actual).Name(), actualFmt) - } - } else if reflect.TypeOf(expected) == reflect.TypeOf((*FunctionalOptionsArgument)(nil)) { - t := expected.(*FunctionalOptionsArgument).value + } else { + switch expected := expected.(type) { + case anythingOfTypeArgument: + // type checking + if reflect.TypeOf(actual).Name() != string(expected) && reflect.TypeOf(actual).String() != string(expected) { + // not match + differences++ + output = fmt.Sprintf("%s\t%d: FAIL: type %s != type %s - %s\n", output, i, expected, reflect.TypeOf(actual).Name(), actualFmt) + } + case *IsTypeArgument: + actualT := reflect.TypeOf(actual) + if actualT != expected.t { + differences++ + output = fmt.Sprintf("%s\t%d: FAIL: type %s != type %s - %s\n", output, i, expected.t.Name(), actualT.Name(), actualFmt) + } + case *FunctionalOptionsArgument: + var name string + if len(expected.values) > 0 { + name = "[]" + reflect.TypeOf(expected.values[0]).String() + } - var name string - tValue := reflect.ValueOf(t) - if tValue.Len() > 0 { - name = "[]" + reflect.TypeOf(tValue.Index(0).Interface()).String() - } + const tName = "[]interface{}" + if name != reflect.TypeOf(actual).String() && len(expected.values) != 0 { + differences++ + output = fmt.Sprintf("%s\t%d: FAIL: type %s != type %s - %s\n", output, i, tName, reflect.TypeOf(actual).Name(), actualFmt) + } else { + if ef, af := assertOpts(expected.values, actual); ef == "" && af == "" { + // match + output = fmt.Sprintf("%s\t%d: PASS: %s == %s\n", output, i, tName, tName) + } else { + // not match + differences++ + output = fmt.Sprintf("%s\t%d: FAIL: %s != %s\n", output, i, af, ef) + } + } - tName := reflect.TypeOf(t).Name() - if name != reflect.TypeOf(actual).String() && tValue.Len() != 0 { - differences++ - output = fmt.Sprintf("%s\t%d: FAIL: type %s != type %s - %s\n", output, i, tName, reflect.TypeOf(actual).Name(), actualFmt) - } else { - if ef, af := assertOpts(t, actual); ef == "" && af == "" { + default: + if assert.ObjectsAreEqual(expected, Anything) || assert.ObjectsAreEqual(actual, Anything) || assert.ObjectsAreEqual(actual, expected) { // match - output = fmt.Sprintf("%s\t%d: PASS: %s == %s\n", output, i, tName, tName) + output = fmt.Sprintf("%s\t%d: PASS: %s == %s\n", output, i, actualFmt, expectedFmt) } else { // not match differences++ - output = fmt.Sprintf("%s\t%d: FAIL: %s != %s\n", output, i, af, ef) + output = fmt.Sprintf("%s\t%d: FAIL: %s != %s\n", output, i, actualFmt, expectedFmt) } } - } else { - // normal checking - - if assert.ObjectsAreEqual(expected, Anything) || assert.ObjectsAreEqual(actual, Anything) || assert.ObjectsAreEqual(actual, expected) { - // match - output = fmt.Sprintf("%s\t%d: PASS: %s == %s\n", output, i, actualFmt, expectedFmt) - } else { - // not match - differences++ - output = fmt.Sprintf("%s\t%d: FAIL: %s != %s\n", output, i, actualFmt, expectedFmt) - } } } @@ -1077,7 +1125,7 @@ func (args Arguments) Error(index int) error { return nil } if s, ok = obj.(error); !ok { - panic(fmt.Sprintf("assert: arguments: Error(%d) failed because object wasn't correct type: %v", index, args.Get(index))) + panic(fmt.Sprintf("assert: arguments: Error(%d) failed because object wasn't correct type: %v", index, obj)) } return s } @@ -1166,32 +1214,38 @@ type tHelper interface { func assertOpts(expected, actual interface{}) (expectedFmt, actualFmt string) { expectedOpts := reflect.ValueOf(expected) actualOpts := reflect.ValueOf(actual) + + var expectedFuncs []*runtime.Func var expectedNames []string for i := 0; i < expectedOpts.Len(); i++ { - expectedNames = append(expectedNames, funcName(expectedOpts.Index(i).Interface())) + f := runtimeFunc(expectedOpts.Index(i).Interface()) + expectedFuncs = append(expectedFuncs, f) + expectedNames = append(expectedNames, funcName(f)) } + var actualFuncs []*runtime.Func var actualNames []string for i := 0; i < actualOpts.Len(); i++ { - actualNames = append(actualNames, funcName(actualOpts.Index(i).Interface())) + f := runtimeFunc(actualOpts.Index(i).Interface()) + actualFuncs = append(actualFuncs, f) + actualNames = append(actualNames, funcName(f)) } - if !assert.ObjectsAreEqual(expectedNames, actualNames) { + + if expectedOpts.Len() != actualOpts.Len() { expectedFmt = fmt.Sprintf("%v", expectedNames) actualFmt = fmt.Sprintf("%v", actualNames) return } for i := 0; i < expectedOpts.Len(); i++ { - expectedOpt := expectedOpts.Index(i).Interface() - actualOpt := actualOpts.Index(i).Interface() - - expectedFunc := expectedNames[i] - actualFunc := actualNames[i] - if expectedFunc != actualFunc { - expectedFmt = expectedFunc - actualFmt = actualFunc + if !isFuncSame(expectedFuncs[i], actualFuncs[i]) { + expectedFmt = expectedNames[i] + actualFmt = actualNames[i] return } + expectedOpt := expectedOpts.Index(i).Interface() + actualOpt := actualOpts.Index(i).Interface() + ot := reflect.TypeOf(expectedOpt) var expectedValues []reflect.Value var actualValues []reflect.Value @@ -1209,9 +1263,9 @@ func assertOpts(expected, actual interface{}) (expectedFmt, actualFmt string) { reflect.ValueOf(actualOpt).Call(actualValues) for i := 0; i < ot.NumIn(); i++ { - if !assert.ObjectsAreEqual(expectedValues[i].Interface(), actualValues[i].Interface()) { - expectedFmt = fmt.Sprintf("%s %+v", expectedNames[i], expectedValues[i].Interface()) - actualFmt = fmt.Sprintf("%s %+v", expectedNames[i], actualValues[i].Interface()) + if expectedArg, actualArg := expectedValues[i].Interface(), actualValues[i].Interface(); !assert.ObjectsAreEqual(expectedArg, actualArg) { + expectedFmt = fmt.Sprintf("%s(%T) -> %#v", expectedNames[i], expectedArg, expectedArg) + actualFmt = fmt.Sprintf("%s(%T) -> %#v", expectedNames[i], actualArg, actualArg) return } } @@ -1220,7 +1274,25 @@ func assertOpts(expected, actual interface{}) (expectedFmt, actualFmt string) { return "", "" } -func funcName(opt interface{}) string { - n := runtime.FuncForPC(reflect.ValueOf(opt).Pointer()).Name() - return strings.TrimSuffix(path.Base(n), path.Ext(n)) +func runtimeFunc(opt interface{}) *runtime.Func { + return runtime.FuncForPC(reflect.ValueOf(opt).Pointer()) +} + +func funcName(f *runtime.Func) string { + name := f.Name() + trimmed := strings.TrimSuffix(path.Base(name), path.Ext(name)) + splitted := strings.Split(trimmed, ".") + + if len(splitted) == 0 { + return trimmed + } + + return splitted[len(splitted)-1] +} + +func isFuncSame(f1, f2 *runtime.Func) bool { + f1File, f1Loc := f1.FileLine(f1.Entry()) + f2File, f2Loc := f2.FileLine(f2.Entry()) + + return f1File == f2File && f1Loc == f2Loc } diff --git a/vendor/go.yaml.in/yaml/v3/LICENSE b/vendor/go.yaml.in/yaml/v3/LICENSE new file mode 100644 index 000000000..2683e4bb1 --- /dev/null +++ b/vendor/go.yaml.in/yaml/v3/LICENSE @@ -0,0 +1,50 @@ + +This project is covered by two different licenses: MIT and Apache. + +#### MIT License #### + +The following files were ported to Go from C files of libyaml, and thus +are still covered by their original MIT license, with the additional +copyright staring in 2011 when the project was ported over: + + apic.go emitterc.go parserc.go readerc.go scannerc.go + writerc.go yamlh.go yamlprivateh.go + +Copyright (c) 2006-2010 Kirill Simonov +Copyright (c) 2006-2011 Kirill Simonov + +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. + +### Apache License ### + +All the remaining project files are covered by the Apache license: + +Copyright (c) 2011-2019 Canonical Ltd + +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/go.yaml.in/yaml/v3/NOTICE b/vendor/go.yaml.in/yaml/v3/NOTICE new file mode 100644 index 000000000..866d74a7a --- /dev/null +++ b/vendor/go.yaml.in/yaml/v3/NOTICE @@ -0,0 +1,13 @@ +Copyright 2011-2016 Canonical Ltd. + +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/go.yaml.in/yaml/v3/README.md b/vendor/go.yaml.in/yaml/v3/README.md new file mode 100644 index 000000000..15a85a635 --- /dev/null +++ b/vendor/go.yaml.in/yaml/v3/README.md @@ -0,0 +1,171 @@ +go.yaml.in/yaml +=============== + +YAML Support for the Go Language + + +## Introduction + +The `yaml` package enables [Go](https://go.dev/) programs to comfortably encode +and decode [YAML](https://yaml.org/) values. + +It was originally developed within [Canonical](https://www.canonical.com) as +part of the [juju](https://juju.ubuntu.com) project, and is based on a pure Go +port of the well-known [libyaml](http://pyyaml.org/wiki/LibYAML) C library to +parse and generate YAML data quickly and reliably. + + +## Project Status + +This project started as a fork of the extremely popular [go-yaml]( +https://github.com/go-yaml/yaml/) +project, and is being maintained by the official [YAML organization]( +https://github.com/yaml/). + +The YAML team took over ongoing maintenance and development of the project after +discussion with go-yaml's author, @niemeyer, following his decision to +[label the project repository as "unmaintained"]( +https://github.com/go-yaml/yaml/blob/944c86a7d2/README.md) in April 2025. + +We have put together a team of dedicated maintainers including representatives +of go-yaml's most important downstream projects. + +We will strive to earn the trust of the various go-yaml forks to switch back to +this repository as their upstream. + +Please [contact us](https://cloud-native.slack.com/archives/C08PPAT8PS7) if you +would like to contribute or be involved. + + +## Compatibility + +The `yaml` package supports most of YAML 1.2, but preserves some behavior from +1.1 for backwards compatibility. + +Specifically, v3 of the `yaml` package: + +* Supports YAML 1.1 bools (`yes`/`no`, `on`/`off`) as long as they are being + decoded into a typed bool value. + Otherwise they behave as a string. + Booleans in YAML 1.2 are `true`/`false` only. +* Supports octals encoded and decoded as `0777` per YAML 1.1, rather than + `0o777` as specified in YAML 1.2, because most parsers still use the old + format. + Octals in the `0o777` format are supported though, so new files work. +* Does not support base-60 floats. + These are gone from YAML 1.2, and were actually never supported by this + package as it's clearly a poor choice. + + +## Installation and Usage + +The import path for the package is *go.yaml.in/yaml/v3*. + +To install it, run: + +```bash +go get go.yaml.in/yaml/v3 +``` + + +## API Documentation + +See: + + +## API Stability + +The package API for yaml v3 will remain stable as described in [gopkg.in]( +https://gopkg.in). + + +## Example + +```go +package main + +import ( + "fmt" + "log" + + "go.yaml.in/yaml/v3" +) + +var data = ` +a: Easy! +b: + c: 2 + d: [3, 4] +` + +// Note: struct fields must be public in order for unmarshal to +// correctly populate the data. +type T struct { + A string + B struct { + RenamedC int `yaml:"c"` + D []int `yaml:",flow"` + } +} + +func main() { + t := T{} + + err := yaml.Unmarshal([]byte(data), &t) + if err != nil { + log.Fatalf("error: %v", err) + } + fmt.Printf("--- t:\n%v\n\n", t) + + d, err := yaml.Marshal(&t) + if err != nil { + log.Fatalf("error: %v", err) + } + fmt.Printf("--- t dump:\n%s\n\n", string(d)) + + m := make(map[interface{}]interface{}) + + err = yaml.Unmarshal([]byte(data), &m) + if err != nil { + log.Fatalf("error: %v", err) + } + fmt.Printf("--- m:\n%v\n\n", m) + + d, err = yaml.Marshal(&m) + if err != nil { + log.Fatalf("error: %v", err) + } + fmt.Printf("--- m dump:\n%s\n\n", string(d)) +} +``` + +This example will generate the following output: + +``` +--- t: +{Easy! {2 [3 4]}} + +--- t dump: +a: Easy! +b: + c: 2 + d: [3, 4] + + +--- m: +map[a:Easy! b:map[c:2 d:[3 4]]] + +--- m dump: +a: Easy! +b: + c: 2 + d: + - 3 + - 4 +``` + + +## License + +The yaml package is licensed under the MIT and Apache License 2.0 licenses. +Please see the LICENSE file for details. diff --git a/vendor/go.yaml.in/yaml/v3/apic.go b/vendor/go.yaml.in/yaml/v3/apic.go new file mode 100644 index 000000000..05fd305da --- /dev/null +++ b/vendor/go.yaml.in/yaml/v3/apic.go @@ -0,0 +1,747 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// Copyright (c) 2006-2010 Kirill Simonov +// +// 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. + +package yaml + +import ( + "io" +) + +func yaml_insert_token(parser *yaml_parser_t, pos int, token *yaml_token_t) { + //fmt.Println("yaml_insert_token", "pos:", pos, "typ:", token.typ, "head:", parser.tokens_head, "len:", len(parser.tokens)) + + // Check if we can move the queue at the beginning of the buffer. + if parser.tokens_head > 0 && len(parser.tokens) == cap(parser.tokens) { + if parser.tokens_head != len(parser.tokens) { + copy(parser.tokens, parser.tokens[parser.tokens_head:]) + } + parser.tokens = parser.tokens[:len(parser.tokens)-parser.tokens_head] + parser.tokens_head = 0 + } + parser.tokens = append(parser.tokens, *token) + if pos < 0 { + return + } + copy(parser.tokens[parser.tokens_head+pos+1:], parser.tokens[parser.tokens_head+pos:]) + parser.tokens[parser.tokens_head+pos] = *token +} + +// Create a new parser object. +func yaml_parser_initialize(parser *yaml_parser_t) bool { + *parser = yaml_parser_t{ + raw_buffer: make([]byte, 0, input_raw_buffer_size), + buffer: make([]byte, 0, input_buffer_size), + } + return true +} + +// Destroy a parser object. +func yaml_parser_delete(parser *yaml_parser_t) { + *parser = yaml_parser_t{} +} + +// String read handler. +func yaml_string_read_handler(parser *yaml_parser_t, buffer []byte) (n int, err error) { + if parser.input_pos == len(parser.input) { + return 0, io.EOF + } + n = copy(buffer, parser.input[parser.input_pos:]) + parser.input_pos += n + return n, nil +} + +// Reader read handler. +func yaml_reader_read_handler(parser *yaml_parser_t, buffer []byte) (n int, err error) { + return parser.input_reader.Read(buffer) +} + +// Set a string input. +func yaml_parser_set_input_string(parser *yaml_parser_t, input []byte) { + if parser.read_handler != nil { + panic("must set the input source only once") + } + parser.read_handler = yaml_string_read_handler + parser.input = input + parser.input_pos = 0 +} + +// Set a file input. +func yaml_parser_set_input_reader(parser *yaml_parser_t, r io.Reader) { + if parser.read_handler != nil { + panic("must set the input source only once") + } + parser.read_handler = yaml_reader_read_handler + parser.input_reader = r +} + +// Set the source encoding. +func yaml_parser_set_encoding(parser *yaml_parser_t, encoding yaml_encoding_t) { + if parser.encoding != yaml_ANY_ENCODING { + panic("must set the encoding only once") + } + parser.encoding = encoding +} + +// Create a new emitter object. +func yaml_emitter_initialize(emitter *yaml_emitter_t) { + *emitter = yaml_emitter_t{ + buffer: make([]byte, output_buffer_size), + raw_buffer: make([]byte, 0, output_raw_buffer_size), + states: make([]yaml_emitter_state_t, 0, initial_stack_size), + events: make([]yaml_event_t, 0, initial_queue_size), + best_width: -1, + } +} + +// Destroy an emitter object. +func yaml_emitter_delete(emitter *yaml_emitter_t) { + *emitter = yaml_emitter_t{} +} + +// String write handler. +func yaml_string_write_handler(emitter *yaml_emitter_t, buffer []byte) error { + *emitter.output_buffer = append(*emitter.output_buffer, buffer...) + return nil +} + +// yaml_writer_write_handler uses emitter.output_writer to write the +// emitted text. +func yaml_writer_write_handler(emitter *yaml_emitter_t, buffer []byte) error { + _, err := emitter.output_writer.Write(buffer) + return err +} + +// Set a string output. +func yaml_emitter_set_output_string(emitter *yaml_emitter_t, output_buffer *[]byte) { + if emitter.write_handler != nil { + panic("must set the output target only once") + } + emitter.write_handler = yaml_string_write_handler + emitter.output_buffer = output_buffer +} + +// Set a file output. +func yaml_emitter_set_output_writer(emitter *yaml_emitter_t, w io.Writer) { + if emitter.write_handler != nil { + panic("must set the output target only once") + } + emitter.write_handler = yaml_writer_write_handler + emitter.output_writer = w +} + +// Set the output encoding. +func yaml_emitter_set_encoding(emitter *yaml_emitter_t, encoding yaml_encoding_t) { + if emitter.encoding != yaml_ANY_ENCODING { + panic("must set the output encoding only once") + } + emitter.encoding = encoding +} + +// Set the canonical output style. +func yaml_emitter_set_canonical(emitter *yaml_emitter_t, canonical bool) { + emitter.canonical = canonical +} + +// Set the indentation increment. +func yaml_emitter_set_indent(emitter *yaml_emitter_t, indent int) { + if indent < 2 || indent > 9 { + indent = 2 + } + emitter.best_indent = indent +} + +// Set the preferred line width. +func yaml_emitter_set_width(emitter *yaml_emitter_t, width int) { + if width < 0 { + width = -1 + } + emitter.best_width = width +} + +// Set if unescaped non-ASCII characters are allowed. +func yaml_emitter_set_unicode(emitter *yaml_emitter_t, unicode bool) { + emitter.unicode = unicode +} + +// Set the preferred line break character. +func yaml_emitter_set_break(emitter *yaml_emitter_t, line_break yaml_break_t) { + emitter.line_break = line_break +} + +///* +// * Destroy a token object. +// */ +// +//YAML_DECLARE(void) +//yaml_token_delete(yaml_token_t *token) +//{ +// assert(token); // Non-NULL token object expected. +// +// switch (token.type) +// { +// case YAML_TAG_DIRECTIVE_TOKEN: +// yaml_free(token.data.tag_directive.handle); +// yaml_free(token.data.tag_directive.prefix); +// break; +// +// case YAML_ALIAS_TOKEN: +// yaml_free(token.data.alias.value); +// break; +// +// case YAML_ANCHOR_TOKEN: +// yaml_free(token.data.anchor.value); +// break; +// +// case YAML_TAG_TOKEN: +// yaml_free(token.data.tag.handle); +// yaml_free(token.data.tag.suffix); +// break; +// +// case YAML_SCALAR_TOKEN: +// yaml_free(token.data.scalar.value); +// break; +// +// default: +// break; +// } +// +// memset(token, 0, sizeof(yaml_token_t)); +//} +// +///* +// * Check if a string is a valid UTF-8 sequence. +// * +// * Check 'reader.c' for more details on UTF-8 encoding. +// */ +// +//static int +//yaml_check_utf8(yaml_char_t *start, size_t length) +//{ +// yaml_char_t *end = start+length; +// yaml_char_t *pointer = start; +// +// while (pointer < end) { +// unsigned char octet; +// unsigned int width; +// unsigned int value; +// size_t k; +// +// octet = pointer[0]; +// width = (octet & 0x80) == 0x00 ? 1 : +// (octet & 0xE0) == 0xC0 ? 2 : +// (octet & 0xF0) == 0xE0 ? 3 : +// (octet & 0xF8) == 0xF0 ? 4 : 0; +// value = (octet & 0x80) == 0x00 ? octet & 0x7F : +// (octet & 0xE0) == 0xC0 ? octet & 0x1F : +// (octet & 0xF0) == 0xE0 ? octet & 0x0F : +// (octet & 0xF8) == 0xF0 ? octet & 0x07 : 0; +// if (!width) return 0; +// if (pointer+width > end) return 0; +// for (k = 1; k < width; k ++) { +// octet = pointer[k]; +// if ((octet & 0xC0) != 0x80) return 0; +// value = (value << 6) + (octet & 0x3F); +// } +// if (!((width == 1) || +// (width == 2 && value >= 0x80) || +// (width == 3 && value >= 0x800) || +// (width == 4 && value >= 0x10000))) return 0; +// +// pointer += width; +// } +// +// return 1; +//} +// + +// Create STREAM-START. +func yaml_stream_start_event_initialize(event *yaml_event_t, encoding yaml_encoding_t) { + *event = yaml_event_t{ + typ: yaml_STREAM_START_EVENT, + encoding: encoding, + } +} + +// Create STREAM-END. +func yaml_stream_end_event_initialize(event *yaml_event_t) { + *event = yaml_event_t{ + typ: yaml_STREAM_END_EVENT, + } +} + +// Create DOCUMENT-START. +func yaml_document_start_event_initialize( + event *yaml_event_t, + version_directive *yaml_version_directive_t, + tag_directives []yaml_tag_directive_t, + implicit bool, +) { + *event = yaml_event_t{ + typ: yaml_DOCUMENT_START_EVENT, + version_directive: version_directive, + tag_directives: tag_directives, + implicit: implicit, + } +} + +// Create DOCUMENT-END. +func yaml_document_end_event_initialize(event *yaml_event_t, implicit bool) { + *event = yaml_event_t{ + typ: yaml_DOCUMENT_END_EVENT, + implicit: implicit, + } +} + +// Create ALIAS. +func yaml_alias_event_initialize(event *yaml_event_t, anchor []byte) bool { + *event = yaml_event_t{ + typ: yaml_ALIAS_EVENT, + anchor: anchor, + } + return true +} + +// Create SCALAR. +func yaml_scalar_event_initialize(event *yaml_event_t, anchor, tag, value []byte, plain_implicit, quoted_implicit bool, style yaml_scalar_style_t) bool { + *event = yaml_event_t{ + typ: yaml_SCALAR_EVENT, + anchor: anchor, + tag: tag, + value: value, + implicit: plain_implicit, + quoted_implicit: quoted_implicit, + style: yaml_style_t(style), + } + return true +} + +// Create SEQUENCE-START. +func yaml_sequence_start_event_initialize(event *yaml_event_t, anchor, tag []byte, implicit bool, style yaml_sequence_style_t) bool { + *event = yaml_event_t{ + typ: yaml_SEQUENCE_START_EVENT, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(style), + } + return true +} + +// Create SEQUENCE-END. +func yaml_sequence_end_event_initialize(event *yaml_event_t) bool { + *event = yaml_event_t{ + typ: yaml_SEQUENCE_END_EVENT, + } + return true +} + +// Create MAPPING-START. +func yaml_mapping_start_event_initialize(event *yaml_event_t, anchor, tag []byte, implicit bool, style yaml_mapping_style_t) { + *event = yaml_event_t{ + typ: yaml_MAPPING_START_EVENT, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(style), + } +} + +// Create MAPPING-END. +func yaml_mapping_end_event_initialize(event *yaml_event_t) { + *event = yaml_event_t{ + typ: yaml_MAPPING_END_EVENT, + } +} + +// Destroy an event object. +func yaml_event_delete(event *yaml_event_t) { + *event = yaml_event_t{} +} + +///* +// * Create a document object. +// */ +// +//YAML_DECLARE(int) +//yaml_document_initialize(document *yaml_document_t, +// version_directive *yaml_version_directive_t, +// tag_directives_start *yaml_tag_directive_t, +// tag_directives_end *yaml_tag_directive_t, +// start_implicit int, end_implicit int) +//{ +// struct { +// error yaml_error_type_t +// } context +// struct { +// start *yaml_node_t +// end *yaml_node_t +// top *yaml_node_t +// } nodes = { NULL, NULL, NULL } +// version_directive_copy *yaml_version_directive_t = NULL +// struct { +// start *yaml_tag_directive_t +// end *yaml_tag_directive_t +// top *yaml_tag_directive_t +// } tag_directives_copy = { NULL, NULL, NULL } +// value yaml_tag_directive_t = { NULL, NULL } +// mark yaml_mark_t = { 0, 0, 0 } +// +// assert(document) // Non-NULL document object is expected. +// assert((tag_directives_start && tag_directives_end) || +// (tag_directives_start == tag_directives_end)) +// // Valid tag directives are expected. +// +// if (!STACK_INIT(&context, nodes, INITIAL_STACK_SIZE)) goto error +// +// if (version_directive) { +// version_directive_copy = yaml_malloc(sizeof(yaml_version_directive_t)) +// if (!version_directive_copy) goto error +// version_directive_copy.major = version_directive.major +// version_directive_copy.minor = version_directive.minor +// } +// +// if (tag_directives_start != tag_directives_end) { +// tag_directive *yaml_tag_directive_t +// if (!STACK_INIT(&context, tag_directives_copy, INITIAL_STACK_SIZE)) +// goto error +// for (tag_directive = tag_directives_start +// tag_directive != tag_directives_end; tag_directive ++) { +// assert(tag_directive.handle) +// assert(tag_directive.prefix) +// if (!yaml_check_utf8(tag_directive.handle, +// strlen((char *)tag_directive.handle))) +// goto error +// if (!yaml_check_utf8(tag_directive.prefix, +// strlen((char *)tag_directive.prefix))) +// goto error +// value.handle = yaml_strdup(tag_directive.handle) +// value.prefix = yaml_strdup(tag_directive.prefix) +// if (!value.handle || !value.prefix) goto error +// if (!PUSH(&context, tag_directives_copy, value)) +// goto error +// value.handle = NULL +// value.prefix = NULL +// } +// } +// +// DOCUMENT_INIT(*document, nodes.start, nodes.end, version_directive_copy, +// tag_directives_copy.start, tag_directives_copy.top, +// start_implicit, end_implicit, mark, mark) +// +// return 1 +// +//error: +// STACK_DEL(&context, nodes) +// yaml_free(version_directive_copy) +// while (!STACK_EMPTY(&context, tag_directives_copy)) { +// value yaml_tag_directive_t = POP(&context, tag_directives_copy) +// yaml_free(value.handle) +// yaml_free(value.prefix) +// } +// STACK_DEL(&context, tag_directives_copy) +// yaml_free(value.handle) +// yaml_free(value.prefix) +// +// return 0 +//} +// +///* +// * Destroy a document object. +// */ +// +//YAML_DECLARE(void) +//yaml_document_delete(document *yaml_document_t) +//{ +// struct { +// error yaml_error_type_t +// } context +// tag_directive *yaml_tag_directive_t +// +// context.error = YAML_NO_ERROR // Eliminate a compiler warning. +// +// assert(document) // Non-NULL document object is expected. +// +// while (!STACK_EMPTY(&context, document.nodes)) { +// node yaml_node_t = POP(&context, document.nodes) +// yaml_free(node.tag) +// switch (node.type) { +// case YAML_SCALAR_NODE: +// yaml_free(node.data.scalar.value) +// break +// case YAML_SEQUENCE_NODE: +// STACK_DEL(&context, node.data.sequence.items) +// break +// case YAML_MAPPING_NODE: +// STACK_DEL(&context, node.data.mapping.pairs) +// break +// default: +// assert(0) // Should not happen. +// } +// } +// STACK_DEL(&context, document.nodes) +// +// yaml_free(document.version_directive) +// for (tag_directive = document.tag_directives.start +// tag_directive != document.tag_directives.end +// tag_directive++) { +// yaml_free(tag_directive.handle) +// yaml_free(tag_directive.prefix) +// } +// yaml_free(document.tag_directives.start) +// +// memset(document, 0, sizeof(yaml_document_t)) +//} +// +///** +// * Get a document node. +// */ +// +//YAML_DECLARE(yaml_node_t *) +//yaml_document_get_node(document *yaml_document_t, index int) +//{ +// assert(document) // Non-NULL document object is expected. +// +// if (index > 0 && document.nodes.start + index <= document.nodes.top) { +// return document.nodes.start + index - 1 +// } +// return NULL +//} +// +///** +// * Get the root object. +// */ +// +//YAML_DECLARE(yaml_node_t *) +//yaml_document_get_root_node(document *yaml_document_t) +//{ +// assert(document) // Non-NULL document object is expected. +// +// if (document.nodes.top != document.nodes.start) { +// return document.nodes.start +// } +// return NULL +//} +// +///* +// * Add a scalar node to a document. +// */ +// +//YAML_DECLARE(int) +//yaml_document_add_scalar(document *yaml_document_t, +// tag *yaml_char_t, value *yaml_char_t, length int, +// style yaml_scalar_style_t) +//{ +// struct { +// error yaml_error_type_t +// } context +// mark yaml_mark_t = { 0, 0, 0 } +// tag_copy *yaml_char_t = NULL +// value_copy *yaml_char_t = NULL +// node yaml_node_t +// +// assert(document) // Non-NULL document object is expected. +// assert(value) // Non-NULL value is expected. +// +// if (!tag) { +// tag = (yaml_char_t *)YAML_DEFAULT_SCALAR_TAG +// } +// +// if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error +// tag_copy = yaml_strdup(tag) +// if (!tag_copy) goto error +// +// if (length < 0) { +// length = strlen((char *)value) +// } +// +// if (!yaml_check_utf8(value, length)) goto error +// value_copy = yaml_malloc(length+1) +// if (!value_copy) goto error +// memcpy(value_copy, value, length) +// value_copy[length] = '\0' +// +// SCALAR_NODE_INIT(node, tag_copy, value_copy, length, style, mark, mark) +// if (!PUSH(&context, document.nodes, node)) goto error +// +// return document.nodes.top - document.nodes.start +// +//error: +// yaml_free(tag_copy) +// yaml_free(value_copy) +// +// return 0 +//} +// +///* +// * Add a sequence node to a document. +// */ +// +//YAML_DECLARE(int) +//yaml_document_add_sequence(document *yaml_document_t, +// tag *yaml_char_t, style yaml_sequence_style_t) +//{ +// struct { +// error yaml_error_type_t +// } context +// mark yaml_mark_t = { 0, 0, 0 } +// tag_copy *yaml_char_t = NULL +// struct { +// start *yaml_node_item_t +// end *yaml_node_item_t +// top *yaml_node_item_t +// } items = { NULL, NULL, NULL } +// node yaml_node_t +// +// assert(document) // Non-NULL document object is expected. +// +// if (!tag) { +// tag = (yaml_char_t *)YAML_DEFAULT_SEQUENCE_TAG +// } +// +// if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error +// tag_copy = yaml_strdup(tag) +// if (!tag_copy) goto error +// +// if (!STACK_INIT(&context, items, INITIAL_STACK_SIZE)) goto error +// +// SEQUENCE_NODE_INIT(node, tag_copy, items.start, items.end, +// style, mark, mark) +// if (!PUSH(&context, document.nodes, node)) goto error +// +// return document.nodes.top - document.nodes.start +// +//error: +// STACK_DEL(&context, items) +// yaml_free(tag_copy) +// +// return 0 +//} +// +///* +// * Add a mapping node to a document. +// */ +// +//YAML_DECLARE(int) +//yaml_document_add_mapping(document *yaml_document_t, +// tag *yaml_char_t, style yaml_mapping_style_t) +//{ +// struct { +// error yaml_error_type_t +// } context +// mark yaml_mark_t = { 0, 0, 0 } +// tag_copy *yaml_char_t = NULL +// struct { +// start *yaml_node_pair_t +// end *yaml_node_pair_t +// top *yaml_node_pair_t +// } pairs = { NULL, NULL, NULL } +// node yaml_node_t +// +// assert(document) // Non-NULL document object is expected. +// +// if (!tag) { +// tag = (yaml_char_t *)YAML_DEFAULT_MAPPING_TAG +// } +// +// if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error +// tag_copy = yaml_strdup(tag) +// if (!tag_copy) goto error +// +// if (!STACK_INIT(&context, pairs, INITIAL_STACK_SIZE)) goto error +// +// MAPPING_NODE_INIT(node, tag_copy, pairs.start, pairs.end, +// style, mark, mark) +// if (!PUSH(&context, document.nodes, node)) goto error +// +// return document.nodes.top - document.nodes.start +// +//error: +// STACK_DEL(&context, pairs) +// yaml_free(tag_copy) +// +// return 0 +//} +// +///* +// * Append an item to a sequence node. +// */ +// +//YAML_DECLARE(int) +//yaml_document_append_sequence_item(document *yaml_document_t, +// sequence int, item int) +//{ +// struct { +// error yaml_error_type_t +// } context +// +// assert(document) // Non-NULL document is required. +// assert(sequence > 0 +// && document.nodes.start + sequence <= document.nodes.top) +// // Valid sequence id is required. +// assert(document.nodes.start[sequence-1].type == YAML_SEQUENCE_NODE) +// // A sequence node is required. +// assert(item > 0 && document.nodes.start + item <= document.nodes.top) +// // Valid item id is required. +// +// if (!PUSH(&context, +// document.nodes.start[sequence-1].data.sequence.items, item)) +// return 0 +// +// return 1 +//} +// +///* +// * Append a pair of a key and a value to a mapping node. +// */ +// +//YAML_DECLARE(int) +//yaml_document_append_mapping_pair(document *yaml_document_t, +// mapping int, key int, value int) +//{ +// struct { +// error yaml_error_type_t +// } context +// +// pair yaml_node_pair_t +// +// assert(document) // Non-NULL document is required. +// assert(mapping > 0 +// && document.nodes.start + mapping <= document.nodes.top) +// // Valid mapping id is required. +// assert(document.nodes.start[mapping-1].type == YAML_MAPPING_NODE) +// // A mapping node is required. +// assert(key > 0 && document.nodes.start + key <= document.nodes.top) +// // Valid key id is required. +// assert(value > 0 && document.nodes.start + value <= document.nodes.top) +// // Valid value id is required. +// +// pair.key = key +// pair.value = value +// +// if (!PUSH(&context, +// document.nodes.start[mapping-1].data.mapping.pairs, pair)) +// return 0 +// +// return 1 +//} +// +// diff --git a/vendor/go.yaml.in/yaml/v3/decode.go b/vendor/go.yaml.in/yaml/v3/decode.go new file mode 100644 index 000000000..02e2b17bf --- /dev/null +++ b/vendor/go.yaml.in/yaml/v3/decode.go @@ -0,0 +1,1018 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// +// 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 yaml + +import ( + "encoding" + "encoding/base64" + "fmt" + "io" + "math" + "reflect" + "strconv" + "time" +) + +// ---------------------------------------------------------------------------- +// Parser, produces a node tree out of a libyaml event stream. + +type parser struct { + parser yaml_parser_t + event yaml_event_t + doc *Node + anchors map[string]*Node + doneInit bool + textless bool +} + +func newParser(b []byte) *parser { + p := parser{} + if !yaml_parser_initialize(&p.parser) { + panic("failed to initialize YAML emitter") + } + if len(b) == 0 { + b = []byte{'\n'} + } + yaml_parser_set_input_string(&p.parser, b) + return &p +} + +func newParserFromReader(r io.Reader) *parser { + p := parser{} + if !yaml_parser_initialize(&p.parser) { + panic("failed to initialize YAML emitter") + } + yaml_parser_set_input_reader(&p.parser, r) + return &p +} + +func (p *parser) init() { + if p.doneInit { + return + } + p.anchors = make(map[string]*Node) + p.expect(yaml_STREAM_START_EVENT) + p.doneInit = true +} + +func (p *parser) destroy() { + if p.event.typ != yaml_NO_EVENT { + yaml_event_delete(&p.event) + } + yaml_parser_delete(&p.parser) +} + +// expect consumes an event from the event stream and +// checks that it's of the expected type. +func (p *parser) expect(e yaml_event_type_t) { + if p.event.typ == yaml_NO_EVENT { + if !yaml_parser_parse(&p.parser, &p.event) { + p.fail() + } + } + if p.event.typ == yaml_STREAM_END_EVENT { + failf("attempted to go past the end of stream; corrupted value?") + } + if p.event.typ != e { + p.parser.problem = fmt.Sprintf("expected %s event but got %s", e, p.event.typ) + p.fail() + } + yaml_event_delete(&p.event) + p.event.typ = yaml_NO_EVENT +} + +// peek peeks at the next event in the event stream, +// puts the results into p.event and returns the event type. +func (p *parser) peek() yaml_event_type_t { + if p.event.typ != yaml_NO_EVENT { + return p.event.typ + } + // It's curious choice from the underlying API to generally return a + // positive result on success, but on this case return true in an error + // scenario. This was the source of bugs in the past (issue #666). + if !yaml_parser_parse(&p.parser, &p.event) || p.parser.error != yaml_NO_ERROR { + p.fail() + } + return p.event.typ +} + +func (p *parser) fail() { + var where string + var line int + if p.parser.context_mark.line != 0 { + line = p.parser.context_mark.line + // Scanner errors don't iterate line before returning error + if p.parser.error == yaml_SCANNER_ERROR { + line++ + } + } else if p.parser.problem_mark.line != 0 { + line = p.parser.problem_mark.line + // Scanner errors don't iterate line before returning error + if p.parser.error == yaml_SCANNER_ERROR { + line++ + } + } + if line != 0 { + where = "line " + strconv.Itoa(line) + ": " + } + var msg string + if len(p.parser.problem) > 0 { + msg = p.parser.problem + } else { + msg = "unknown problem parsing YAML content" + } + failf("%s%s", where, msg) +} + +func (p *parser) anchor(n *Node, anchor []byte) { + if anchor != nil { + n.Anchor = string(anchor) + p.anchors[n.Anchor] = n + } +} + +func (p *parser) parse() *Node { + p.init() + switch p.peek() { + case yaml_SCALAR_EVENT: + return p.scalar() + case yaml_ALIAS_EVENT: + return p.alias() + case yaml_MAPPING_START_EVENT: + return p.mapping() + case yaml_SEQUENCE_START_EVENT: + return p.sequence() + case yaml_DOCUMENT_START_EVENT: + return p.document() + case yaml_STREAM_END_EVENT: + // Happens when attempting to decode an empty buffer. + return nil + case yaml_TAIL_COMMENT_EVENT: + panic("internal error: unexpected tail comment event (please report)") + default: + panic("internal error: attempted to parse unknown event (please report): " + p.event.typ.String()) + } +} + +func (p *parser) node(kind Kind, defaultTag, tag, value string) *Node { + var style Style + if tag != "" && tag != "!" { + tag = shortTag(tag) + style = TaggedStyle + } else if defaultTag != "" { + tag = defaultTag + } else if kind == ScalarNode { + tag, _ = resolve("", value) + } + n := &Node{ + Kind: kind, + Tag: tag, + Value: value, + Style: style, + } + if !p.textless { + n.Line = p.event.start_mark.line + 1 + n.Column = p.event.start_mark.column + 1 + n.HeadComment = string(p.event.head_comment) + n.LineComment = string(p.event.line_comment) + n.FootComment = string(p.event.foot_comment) + } + return n +} + +func (p *parser) parseChild(parent *Node) *Node { + child := p.parse() + parent.Content = append(parent.Content, child) + return child +} + +func (p *parser) document() *Node { + n := p.node(DocumentNode, "", "", "") + p.doc = n + p.expect(yaml_DOCUMENT_START_EVENT) + p.parseChild(n) + if p.peek() == yaml_DOCUMENT_END_EVENT { + n.FootComment = string(p.event.foot_comment) + } + p.expect(yaml_DOCUMENT_END_EVENT) + return n +} + +func (p *parser) alias() *Node { + n := p.node(AliasNode, "", "", string(p.event.anchor)) + n.Alias = p.anchors[n.Value] + if n.Alias == nil { + failf("unknown anchor '%s' referenced", n.Value) + } + p.expect(yaml_ALIAS_EVENT) + return n +} + +func (p *parser) scalar() *Node { + var parsedStyle = p.event.scalar_style() + var nodeStyle Style + switch { + case parsedStyle&yaml_DOUBLE_QUOTED_SCALAR_STYLE != 0: + nodeStyle = DoubleQuotedStyle + case parsedStyle&yaml_SINGLE_QUOTED_SCALAR_STYLE != 0: + nodeStyle = SingleQuotedStyle + case parsedStyle&yaml_LITERAL_SCALAR_STYLE != 0: + nodeStyle = LiteralStyle + case parsedStyle&yaml_FOLDED_SCALAR_STYLE != 0: + nodeStyle = FoldedStyle + } + var nodeValue = string(p.event.value) + var nodeTag = string(p.event.tag) + var defaultTag string + if nodeStyle == 0 { + if nodeValue == "<<" { + defaultTag = mergeTag + } + } else { + defaultTag = strTag + } + n := p.node(ScalarNode, defaultTag, nodeTag, nodeValue) + n.Style |= nodeStyle + p.anchor(n, p.event.anchor) + p.expect(yaml_SCALAR_EVENT) + return n +} + +func (p *parser) sequence() *Node { + n := p.node(SequenceNode, seqTag, string(p.event.tag), "") + if p.event.sequence_style()&yaml_FLOW_SEQUENCE_STYLE != 0 { + n.Style |= FlowStyle + } + p.anchor(n, p.event.anchor) + p.expect(yaml_SEQUENCE_START_EVENT) + for p.peek() != yaml_SEQUENCE_END_EVENT { + p.parseChild(n) + } + n.LineComment = string(p.event.line_comment) + n.FootComment = string(p.event.foot_comment) + p.expect(yaml_SEQUENCE_END_EVENT) + return n +} + +func (p *parser) mapping() *Node { + n := p.node(MappingNode, mapTag, string(p.event.tag), "") + block := true + if p.event.mapping_style()&yaml_FLOW_MAPPING_STYLE != 0 { + block = false + n.Style |= FlowStyle + } + p.anchor(n, p.event.anchor) + p.expect(yaml_MAPPING_START_EVENT) + for p.peek() != yaml_MAPPING_END_EVENT { + k := p.parseChild(n) + if block && k.FootComment != "" { + // Must be a foot comment for the prior value when being dedented. + if len(n.Content) > 2 { + n.Content[len(n.Content)-3].FootComment = k.FootComment + k.FootComment = "" + } + } + v := p.parseChild(n) + if k.FootComment == "" && v.FootComment != "" { + k.FootComment = v.FootComment + v.FootComment = "" + } + if p.peek() == yaml_TAIL_COMMENT_EVENT { + if k.FootComment == "" { + k.FootComment = string(p.event.foot_comment) + } + p.expect(yaml_TAIL_COMMENT_EVENT) + } + } + n.LineComment = string(p.event.line_comment) + n.FootComment = string(p.event.foot_comment) + if n.Style&FlowStyle == 0 && n.FootComment != "" && len(n.Content) > 1 { + n.Content[len(n.Content)-2].FootComment = n.FootComment + n.FootComment = "" + } + p.expect(yaml_MAPPING_END_EVENT) + return n +} + +// ---------------------------------------------------------------------------- +// Decoder, unmarshals a node into a provided value. + +type decoder struct { + doc *Node + aliases map[*Node]bool + terrors []string + + stringMapType reflect.Type + generalMapType reflect.Type + + knownFields bool + uniqueKeys bool + decodeCount int + aliasCount int + aliasDepth int + + mergedFields map[interface{}]bool +} + +var ( + nodeType = reflect.TypeOf(Node{}) + durationType = reflect.TypeOf(time.Duration(0)) + stringMapType = reflect.TypeOf(map[string]interface{}{}) + generalMapType = reflect.TypeOf(map[interface{}]interface{}{}) + ifaceType = generalMapType.Elem() + timeType = reflect.TypeOf(time.Time{}) + ptrTimeType = reflect.TypeOf(&time.Time{}) +) + +func newDecoder() *decoder { + d := &decoder{ + stringMapType: stringMapType, + generalMapType: generalMapType, + uniqueKeys: true, + } + d.aliases = make(map[*Node]bool) + return d +} + +func (d *decoder) terror(n *Node, tag string, out reflect.Value) { + if n.Tag != "" { + tag = n.Tag + } + value := n.Value + if tag != seqTag && tag != mapTag { + if len(value) > 10 { + value = " `" + value[:7] + "...`" + } else { + value = " `" + value + "`" + } + } + d.terrors = append(d.terrors, fmt.Sprintf("line %d: cannot unmarshal %s%s into %s", n.Line, shortTag(tag), value, out.Type())) +} + +func (d *decoder) callUnmarshaler(n *Node, u Unmarshaler) (good bool) { + err := u.UnmarshalYAML(n) + if e, ok := err.(*TypeError); ok { + d.terrors = append(d.terrors, e.Errors...) + return false + } + if err != nil { + fail(err) + } + return true +} + +func (d *decoder) callObsoleteUnmarshaler(n *Node, u obsoleteUnmarshaler) (good bool) { + terrlen := len(d.terrors) + err := u.UnmarshalYAML(func(v interface{}) (err error) { + defer handleErr(&err) + d.unmarshal(n, reflect.ValueOf(v)) + if len(d.terrors) > terrlen { + issues := d.terrors[terrlen:] + d.terrors = d.terrors[:terrlen] + return &TypeError{issues} + } + return nil + }) + if e, ok := err.(*TypeError); ok { + d.terrors = append(d.terrors, e.Errors...) + return false + } + if err != nil { + fail(err) + } + return true +} + +// d.prepare initializes and dereferences pointers and calls UnmarshalYAML +// if a value is found to implement it. +// It returns the initialized and dereferenced out value, whether +// unmarshalling was already done by UnmarshalYAML, and if so whether +// its types unmarshalled appropriately. +// +// If n holds a null value, prepare returns before doing anything. +func (d *decoder) prepare(n *Node, out reflect.Value) (newout reflect.Value, unmarshaled, good bool) { + if n.ShortTag() == nullTag { + return out, false, false + } + again := true + for again { + again = false + if out.Kind() == reflect.Ptr { + if out.IsNil() { + out.Set(reflect.New(out.Type().Elem())) + } + out = out.Elem() + again = true + } + if out.CanAddr() { + outi := out.Addr().Interface() + if u, ok := outi.(Unmarshaler); ok { + good = d.callUnmarshaler(n, u) + return out, true, good + } + if u, ok := outi.(obsoleteUnmarshaler); ok { + good = d.callObsoleteUnmarshaler(n, u) + return out, true, good + } + } + } + return out, false, false +} + +func (d *decoder) fieldByIndex(n *Node, v reflect.Value, index []int) (field reflect.Value) { + if n.ShortTag() == nullTag { + return reflect.Value{} + } + for _, num := range index { + for { + if v.Kind() == reflect.Ptr { + if v.IsNil() { + v.Set(reflect.New(v.Type().Elem())) + } + v = v.Elem() + continue + } + break + } + v = v.Field(num) + } + return v +} + +const ( + // 400,000 decode operations is ~500kb of dense object declarations, or + // ~5kb of dense object declarations with 10000% alias expansion + alias_ratio_range_low = 400000 + + // 4,000,000 decode operations is ~5MB of dense object declarations, or + // ~4.5MB of dense object declarations with 10% alias expansion + alias_ratio_range_high = 4000000 + + // alias_ratio_range is the range over which we scale allowed alias ratios + alias_ratio_range = float64(alias_ratio_range_high - alias_ratio_range_low) +) + +func allowedAliasRatio(decodeCount int) float64 { + switch { + case decodeCount <= alias_ratio_range_low: + // allow 99% to come from alias expansion for small-to-medium documents + return 0.99 + case decodeCount >= alias_ratio_range_high: + // allow 10% to come from alias expansion for very large documents + return 0.10 + default: + // scale smoothly from 99% down to 10% over the range. + // this maps to 396,000 - 400,000 allowed alias-driven decodes over the range. + // 400,000 decode operations is ~100MB of allocations in worst-case scenarios (single-item maps). + return 0.99 - 0.89*(float64(decodeCount-alias_ratio_range_low)/alias_ratio_range) + } +} + +func (d *decoder) unmarshal(n *Node, out reflect.Value) (good bool) { + d.decodeCount++ + if d.aliasDepth > 0 { + d.aliasCount++ + } + if d.aliasCount > 100 && d.decodeCount > 1000 && float64(d.aliasCount)/float64(d.decodeCount) > allowedAliasRatio(d.decodeCount) { + failf("document contains excessive aliasing") + } + if out.Type() == nodeType { + out.Set(reflect.ValueOf(n).Elem()) + return true + } + switch n.Kind { + case DocumentNode: + return d.document(n, out) + case AliasNode: + return d.alias(n, out) + } + out, unmarshaled, good := d.prepare(n, out) + if unmarshaled { + return good + } + switch n.Kind { + case ScalarNode: + good = d.scalar(n, out) + case MappingNode: + good = d.mapping(n, out) + case SequenceNode: + good = d.sequence(n, out) + case 0: + if n.IsZero() { + return d.null(out) + } + fallthrough + default: + failf("cannot decode node with unknown kind %d", n.Kind) + } + return good +} + +func (d *decoder) document(n *Node, out reflect.Value) (good bool) { + if len(n.Content) == 1 { + d.doc = n + d.unmarshal(n.Content[0], out) + return true + } + return false +} + +func (d *decoder) alias(n *Node, out reflect.Value) (good bool) { + if d.aliases[n] { + // TODO this could actually be allowed in some circumstances. + failf("anchor '%s' value contains itself", n.Value) + } + d.aliases[n] = true + d.aliasDepth++ + good = d.unmarshal(n.Alias, out) + d.aliasDepth-- + delete(d.aliases, n) + return good +} + +var zeroValue reflect.Value + +func resetMap(out reflect.Value) { + for _, k := range out.MapKeys() { + out.SetMapIndex(k, zeroValue) + } +} + +func (d *decoder) null(out reflect.Value) bool { + if out.CanAddr() { + switch out.Kind() { + case reflect.Interface, reflect.Ptr, reflect.Map, reflect.Slice: + out.Set(reflect.Zero(out.Type())) + return true + } + } + return false +} + +func (d *decoder) scalar(n *Node, out reflect.Value) bool { + var tag string + var resolved interface{} + if n.indicatedString() { + tag = strTag + resolved = n.Value + } else { + tag, resolved = resolve(n.Tag, n.Value) + if tag == binaryTag { + data, err := base64.StdEncoding.DecodeString(resolved.(string)) + if err != nil { + failf("!!binary value contains invalid base64 data") + } + resolved = string(data) + } + } + if resolved == nil { + return d.null(out) + } + if resolvedv := reflect.ValueOf(resolved); out.Type() == resolvedv.Type() { + // We've resolved to exactly the type we want, so use that. + out.Set(resolvedv) + return true + } + // Perhaps we can use the value as a TextUnmarshaler to + // set its value. + if out.CanAddr() { + u, ok := out.Addr().Interface().(encoding.TextUnmarshaler) + if ok { + var text []byte + if tag == binaryTag { + text = []byte(resolved.(string)) + } else { + // We let any value be unmarshaled into TextUnmarshaler. + // That might be more lax than we'd like, but the + // TextUnmarshaler itself should bowl out any dubious values. + text = []byte(n.Value) + } + err := u.UnmarshalText(text) + if err != nil { + fail(err) + } + return true + } + } + switch out.Kind() { + case reflect.String: + if tag == binaryTag { + out.SetString(resolved.(string)) + return true + } + out.SetString(n.Value) + return true + case reflect.Interface: + out.Set(reflect.ValueOf(resolved)) + return true + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + // This used to work in v2, but it's very unfriendly. + isDuration := out.Type() == durationType + + switch resolved := resolved.(type) { + case int: + if !isDuration && !out.OverflowInt(int64(resolved)) { + out.SetInt(int64(resolved)) + return true + } + case int64: + if !isDuration && !out.OverflowInt(resolved) { + out.SetInt(resolved) + return true + } + case uint64: + if !isDuration && resolved <= math.MaxInt64 && !out.OverflowInt(int64(resolved)) { + out.SetInt(int64(resolved)) + return true + } + case float64: + if !isDuration && resolved <= math.MaxInt64 && !out.OverflowInt(int64(resolved)) { + out.SetInt(int64(resolved)) + return true + } + case string: + if out.Type() == durationType { + d, err := time.ParseDuration(resolved) + if err == nil { + out.SetInt(int64(d)) + return true + } + } + } + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + switch resolved := resolved.(type) { + case int: + if resolved >= 0 && !out.OverflowUint(uint64(resolved)) { + out.SetUint(uint64(resolved)) + return true + } + case int64: + if resolved >= 0 && !out.OverflowUint(uint64(resolved)) { + out.SetUint(uint64(resolved)) + return true + } + case uint64: + if !out.OverflowUint(uint64(resolved)) { + out.SetUint(uint64(resolved)) + return true + } + case float64: + if resolved <= math.MaxUint64 && !out.OverflowUint(uint64(resolved)) { + out.SetUint(uint64(resolved)) + return true + } + } + case reflect.Bool: + switch resolved := resolved.(type) { + case bool: + out.SetBool(resolved) + return true + case string: + // This offers some compatibility with the 1.1 spec (https://yaml.org/type/bool.html). + // It only works if explicitly attempting to unmarshal into a typed bool value. + switch resolved { + case "y", "Y", "yes", "Yes", "YES", "on", "On", "ON": + out.SetBool(true) + return true + case "n", "N", "no", "No", "NO", "off", "Off", "OFF": + out.SetBool(false) + return true + } + } + case reflect.Float32, reflect.Float64: + switch resolved := resolved.(type) { + case int: + out.SetFloat(float64(resolved)) + return true + case int64: + out.SetFloat(float64(resolved)) + return true + case uint64: + out.SetFloat(float64(resolved)) + return true + case float64: + out.SetFloat(resolved) + return true + } + case reflect.Struct: + if resolvedv := reflect.ValueOf(resolved); out.Type() == resolvedv.Type() { + out.Set(resolvedv) + return true + } + case reflect.Ptr: + panic("yaml internal error: please report the issue") + } + d.terror(n, tag, out) + return false +} + +func settableValueOf(i interface{}) reflect.Value { + v := reflect.ValueOf(i) + sv := reflect.New(v.Type()).Elem() + sv.Set(v) + return sv +} + +func (d *decoder) sequence(n *Node, out reflect.Value) (good bool) { + l := len(n.Content) + + var iface reflect.Value + switch out.Kind() { + case reflect.Slice: + out.Set(reflect.MakeSlice(out.Type(), l, l)) + case reflect.Array: + if l != out.Len() { + failf("invalid array: want %d elements but got %d", out.Len(), l) + } + case reflect.Interface: + // No type hints. Will have to use a generic sequence. + iface = out + out = settableValueOf(make([]interface{}, l)) + default: + d.terror(n, seqTag, out) + return false + } + et := out.Type().Elem() + + j := 0 + for i := 0; i < l; i++ { + e := reflect.New(et).Elem() + if ok := d.unmarshal(n.Content[i], e); ok { + out.Index(j).Set(e) + j++ + } + } + if out.Kind() != reflect.Array { + out.Set(out.Slice(0, j)) + } + if iface.IsValid() { + iface.Set(out) + } + return true +} + +func (d *decoder) mapping(n *Node, out reflect.Value) (good bool) { + l := len(n.Content) + if d.uniqueKeys { + nerrs := len(d.terrors) + for i := 0; i < l; i += 2 { + ni := n.Content[i] + for j := i + 2; j < l; j += 2 { + nj := n.Content[j] + if ni.Kind == nj.Kind && ni.Value == nj.Value { + d.terrors = append(d.terrors, fmt.Sprintf("line %d: mapping key %#v already defined at line %d", nj.Line, nj.Value, ni.Line)) + } + } + } + if len(d.terrors) > nerrs { + return false + } + } + switch out.Kind() { + case reflect.Struct: + return d.mappingStruct(n, out) + case reflect.Map: + // okay + case reflect.Interface: + iface := out + if isStringMap(n) { + out = reflect.MakeMap(d.stringMapType) + } else { + out = reflect.MakeMap(d.generalMapType) + } + iface.Set(out) + default: + d.terror(n, mapTag, out) + return false + } + + outt := out.Type() + kt := outt.Key() + et := outt.Elem() + + stringMapType := d.stringMapType + generalMapType := d.generalMapType + if outt.Elem() == ifaceType { + if outt.Key().Kind() == reflect.String { + d.stringMapType = outt + } else if outt.Key() == ifaceType { + d.generalMapType = outt + } + } + + mergedFields := d.mergedFields + d.mergedFields = nil + + var mergeNode *Node + + mapIsNew := false + if out.IsNil() { + out.Set(reflect.MakeMap(outt)) + mapIsNew = true + } + for i := 0; i < l; i += 2 { + if isMerge(n.Content[i]) { + mergeNode = n.Content[i+1] + continue + } + k := reflect.New(kt).Elem() + if d.unmarshal(n.Content[i], k) { + if mergedFields != nil { + ki := k.Interface() + if d.getPossiblyUnhashableKey(mergedFields, ki) { + continue + } + d.setPossiblyUnhashableKey(mergedFields, ki, true) + } + kkind := k.Kind() + if kkind == reflect.Interface { + kkind = k.Elem().Kind() + } + if kkind == reflect.Map || kkind == reflect.Slice { + failf("invalid map key: %#v", k.Interface()) + } + e := reflect.New(et).Elem() + if d.unmarshal(n.Content[i+1], e) || n.Content[i+1].ShortTag() == nullTag && (mapIsNew || !out.MapIndex(k).IsValid()) { + out.SetMapIndex(k, e) + } + } + } + + d.mergedFields = mergedFields + if mergeNode != nil { + d.merge(n, mergeNode, out) + } + + d.stringMapType = stringMapType + d.generalMapType = generalMapType + return true +} + +func isStringMap(n *Node) bool { + if n.Kind != MappingNode { + return false + } + l := len(n.Content) + for i := 0; i < l; i += 2 { + shortTag := n.Content[i].ShortTag() + if shortTag != strTag && shortTag != mergeTag { + return false + } + } + return true +} + +func (d *decoder) mappingStruct(n *Node, out reflect.Value) (good bool) { + sinfo, err := getStructInfo(out.Type()) + if err != nil { + panic(err) + } + + var inlineMap reflect.Value + var elemType reflect.Type + if sinfo.InlineMap != -1 { + inlineMap = out.Field(sinfo.InlineMap) + elemType = inlineMap.Type().Elem() + } + + for _, index := range sinfo.InlineUnmarshalers { + field := d.fieldByIndex(n, out, index) + d.prepare(n, field) + } + + mergedFields := d.mergedFields + d.mergedFields = nil + var mergeNode *Node + var doneFields []bool + if d.uniqueKeys { + doneFields = make([]bool, len(sinfo.FieldsList)) + } + name := settableValueOf("") + l := len(n.Content) + for i := 0; i < l; i += 2 { + ni := n.Content[i] + if isMerge(ni) { + mergeNode = n.Content[i+1] + continue + } + if !d.unmarshal(ni, name) { + continue + } + sname := name.String() + if mergedFields != nil { + if mergedFields[sname] { + continue + } + mergedFields[sname] = true + } + if info, ok := sinfo.FieldsMap[sname]; ok { + if d.uniqueKeys { + if doneFields[info.Id] { + d.terrors = append(d.terrors, fmt.Sprintf("line %d: field %s already set in type %s", ni.Line, name.String(), out.Type())) + continue + } + doneFields[info.Id] = true + } + var field reflect.Value + if info.Inline == nil { + field = out.Field(info.Num) + } else { + field = d.fieldByIndex(n, out, info.Inline) + } + d.unmarshal(n.Content[i+1], field) + } else if sinfo.InlineMap != -1 { + if inlineMap.IsNil() { + inlineMap.Set(reflect.MakeMap(inlineMap.Type())) + } + value := reflect.New(elemType).Elem() + d.unmarshal(n.Content[i+1], value) + inlineMap.SetMapIndex(name, value) + } else if d.knownFields { + d.terrors = append(d.terrors, fmt.Sprintf("line %d: field %s not found in type %s", ni.Line, name.String(), out.Type())) + } + } + + d.mergedFields = mergedFields + if mergeNode != nil { + d.merge(n, mergeNode, out) + } + return true +} + +func failWantMap() { + failf("map merge requires map or sequence of maps as the value") +} + +func (d *decoder) setPossiblyUnhashableKey(m map[interface{}]bool, key interface{}, value bool) { + defer func() { + if err := recover(); err != nil { + failf("%v", err) + } + }() + m[key] = value +} + +func (d *decoder) getPossiblyUnhashableKey(m map[interface{}]bool, key interface{}) bool { + defer func() { + if err := recover(); err != nil { + failf("%v", err) + } + }() + return m[key] +} + +func (d *decoder) merge(parent *Node, merge *Node, out reflect.Value) { + mergedFields := d.mergedFields + if mergedFields == nil { + d.mergedFields = make(map[interface{}]bool) + for i := 0; i < len(parent.Content); i += 2 { + k := reflect.New(ifaceType).Elem() + if d.unmarshal(parent.Content[i], k) { + d.setPossiblyUnhashableKey(d.mergedFields, k.Interface(), true) + } + } + } + + switch merge.Kind { + case MappingNode: + d.unmarshal(merge, out) + case AliasNode: + if merge.Alias != nil && merge.Alias.Kind != MappingNode { + failWantMap() + } + d.unmarshal(merge, out) + case SequenceNode: + for i := 0; i < len(merge.Content); i++ { + ni := merge.Content[i] + if ni.Kind == AliasNode { + if ni.Alias != nil && ni.Alias.Kind != MappingNode { + failWantMap() + } + } else if ni.Kind != MappingNode { + failWantMap() + } + d.unmarshal(ni, out) + } + default: + failWantMap() + } + + d.mergedFields = mergedFields +} + +func isMerge(n *Node) bool { + return n.Kind == ScalarNode && n.Value == "<<" && (n.Tag == "" || n.Tag == "!" || shortTag(n.Tag) == mergeTag) +} diff --git a/vendor/go.yaml.in/yaml/v3/emitterc.go b/vendor/go.yaml.in/yaml/v3/emitterc.go new file mode 100644 index 000000000..ab4e03ba7 --- /dev/null +++ b/vendor/go.yaml.in/yaml/v3/emitterc.go @@ -0,0 +1,2054 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// Copyright (c) 2006-2010 Kirill Simonov +// +// 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. + +package yaml + +import ( + "bytes" + "fmt" +) + +// Flush the buffer if needed. +func flush(emitter *yaml_emitter_t) bool { + if emitter.buffer_pos+5 >= len(emitter.buffer) { + return yaml_emitter_flush(emitter) + } + return true +} + +// Put a character to the output buffer. +func put(emitter *yaml_emitter_t, value byte) bool { + if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) { + return false + } + emitter.buffer[emitter.buffer_pos] = value + emitter.buffer_pos++ + emitter.column++ + return true +} + +// Put a line break to the output buffer. +func put_break(emitter *yaml_emitter_t) bool { + if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) { + return false + } + switch emitter.line_break { + case yaml_CR_BREAK: + emitter.buffer[emitter.buffer_pos] = '\r' + emitter.buffer_pos += 1 + case yaml_LN_BREAK: + emitter.buffer[emitter.buffer_pos] = '\n' + emitter.buffer_pos += 1 + case yaml_CRLN_BREAK: + emitter.buffer[emitter.buffer_pos+0] = '\r' + emitter.buffer[emitter.buffer_pos+1] = '\n' + emitter.buffer_pos += 2 + default: + panic("unknown line break setting") + } + if emitter.column == 0 { + emitter.space_above = true + } + emitter.column = 0 + emitter.line++ + // [Go] Do this here and below and drop from everywhere else (see commented lines). + emitter.indention = true + return true +} + +// Copy a character from a string into buffer. +func write(emitter *yaml_emitter_t, s []byte, i *int) bool { + if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) { + return false + } + p := emitter.buffer_pos + w := width(s[*i]) + switch w { + case 4: + emitter.buffer[p+3] = s[*i+3] + fallthrough + case 3: + emitter.buffer[p+2] = s[*i+2] + fallthrough + case 2: + emitter.buffer[p+1] = s[*i+1] + fallthrough + case 1: + emitter.buffer[p+0] = s[*i+0] + default: + panic("unknown character width") + } + emitter.column++ + emitter.buffer_pos += w + *i += w + return true +} + +// Write a whole string into buffer. +func write_all(emitter *yaml_emitter_t, s []byte) bool { + for i := 0; i < len(s); { + if !write(emitter, s, &i) { + return false + } + } + return true +} + +// Copy a line break character from a string into buffer. +func write_break(emitter *yaml_emitter_t, s []byte, i *int) bool { + if s[*i] == '\n' { + if !put_break(emitter) { + return false + } + *i++ + } else { + if !write(emitter, s, i) { + return false + } + if emitter.column == 0 { + emitter.space_above = true + } + emitter.column = 0 + emitter.line++ + // [Go] Do this here and above and drop from everywhere else (see commented lines). + emitter.indention = true + } + return true +} + +// Set an emitter error and return false. +func yaml_emitter_set_emitter_error(emitter *yaml_emitter_t, problem string) bool { + emitter.error = yaml_EMITTER_ERROR + emitter.problem = problem + return false +} + +// Emit an event. +func yaml_emitter_emit(emitter *yaml_emitter_t, event *yaml_event_t) bool { + emitter.events = append(emitter.events, *event) + for !yaml_emitter_need_more_events(emitter) { + event := &emitter.events[emitter.events_head] + if !yaml_emitter_analyze_event(emitter, event) { + return false + } + if !yaml_emitter_state_machine(emitter, event) { + return false + } + yaml_event_delete(event) + emitter.events_head++ + } + return true +} + +// Check if we need to accumulate more events before emitting. +// +// We accumulate extra +// - 1 event for DOCUMENT-START +// - 2 events for SEQUENCE-START +// - 3 events for MAPPING-START +func yaml_emitter_need_more_events(emitter *yaml_emitter_t) bool { + if emitter.events_head == len(emitter.events) { + return true + } + var accumulate int + switch emitter.events[emitter.events_head].typ { + case yaml_DOCUMENT_START_EVENT: + accumulate = 1 + break + case yaml_SEQUENCE_START_EVENT: + accumulate = 2 + break + case yaml_MAPPING_START_EVENT: + accumulate = 3 + break + default: + return false + } + if len(emitter.events)-emitter.events_head > accumulate { + return false + } + var level int + for i := emitter.events_head; i < len(emitter.events); i++ { + switch emitter.events[i].typ { + case yaml_STREAM_START_EVENT, yaml_DOCUMENT_START_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT: + level++ + case yaml_STREAM_END_EVENT, yaml_DOCUMENT_END_EVENT, yaml_SEQUENCE_END_EVENT, yaml_MAPPING_END_EVENT: + level-- + } + if level == 0 { + return false + } + } + return true +} + +// Append a directive to the directives stack. +func yaml_emitter_append_tag_directive(emitter *yaml_emitter_t, value *yaml_tag_directive_t, allow_duplicates bool) bool { + for i := 0; i < len(emitter.tag_directives); i++ { + if bytes.Equal(value.handle, emitter.tag_directives[i].handle) { + if allow_duplicates { + return true + } + return yaml_emitter_set_emitter_error(emitter, "duplicate %TAG directive") + } + } + + // [Go] Do we actually need to copy this given garbage collection + // and the lack of deallocating destructors? + tag_copy := yaml_tag_directive_t{ + handle: make([]byte, len(value.handle)), + prefix: make([]byte, len(value.prefix)), + } + copy(tag_copy.handle, value.handle) + copy(tag_copy.prefix, value.prefix) + emitter.tag_directives = append(emitter.tag_directives, tag_copy) + return true +} + +// Increase the indentation level. +func yaml_emitter_increase_indent_compact(emitter *yaml_emitter_t, flow, indentless bool, compact_seq bool) bool { + emitter.indents = append(emitter.indents, emitter.indent) + if emitter.indent < 0 { + if flow { + emitter.indent = emitter.best_indent + } else { + emitter.indent = 0 + } + } else if !indentless { + // [Go] This was changed so that indentations are more regular. + if emitter.states[len(emitter.states)-1] == yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE { + // The first indent inside a sequence will just skip the "- " indicator. + emitter.indent += 2 + } else { + // Everything else aligns to the chosen indentation. + emitter.indent = emitter.best_indent * ((emitter.indent + emitter.best_indent) / emitter.best_indent) + if compact_seq { + // The value compact_seq passed in is almost always set to `false` when this function is called, + // except when we are dealing with sequence nodes. So this gets triggered to subtract 2 only when we + // are increasing the indent to account for sequence nodes, which will be correct because we need to + // subtract 2 to account for the - at the beginning of the sequence node. + emitter.indent = emitter.indent - 2 + } + } + } + return true +} + +// State dispatcher. +func yaml_emitter_state_machine(emitter *yaml_emitter_t, event *yaml_event_t) bool { + switch emitter.state { + default: + case yaml_EMIT_STREAM_START_STATE: + return yaml_emitter_emit_stream_start(emitter, event) + + case yaml_EMIT_FIRST_DOCUMENT_START_STATE: + return yaml_emitter_emit_document_start(emitter, event, true) + + case yaml_EMIT_DOCUMENT_START_STATE: + return yaml_emitter_emit_document_start(emitter, event, false) + + case yaml_EMIT_DOCUMENT_CONTENT_STATE: + return yaml_emitter_emit_document_content(emitter, event) + + case yaml_EMIT_DOCUMENT_END_STATE: + return yaml_emitter_emit_document_end(emitter, event) + + case yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE: + return yaml_emitter_emit_flow_sequence_item(emitter, event, true, false) + + case yaml_EMIT_FLOW_SEQUENCE_TRAIL_ITEM_STATE: + return yaml_emitter_emit_flow_sequence_item(emitter, event, false, true) + + case yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE: + return yaml_emitter_emit_flow_sequence_item(emitter, event, false, false) + + case yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE: + return yaml_emitter_emit_flow_mapping_key(emitter, event, true, false) + + case yaml_EMIT_FLOW_MAPPING_TRAIL_KEY_STATE: + return yaml_emitter_emit_flow_mapping_key(emitter, event, false, true) + + case yaml_EMIT_FLOW_MAPPING_KEY_STATE: + return yaml_emitter_emit_flow_mapping_key(emitter, event, false, false) + + case yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE: + return yaml_emitter_emit_flow_mapping_value(emitter, event, true) + + case yaml_EMIT_FLOW_MAPPING_VALUE_STATE: + return yaml_emitter_emit_flow_mapping_value(emitter, event, false) + + case yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE: + return yaml_emitter_emit_block_sequence_item(emitter, event, true) + + case yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE: + return yaml_emitter_emit_block_sequence_item(emitter, event, false) + + case yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE: + return yaml_emitter_emit_block_mapping_key(emitter, event, true) + + case yaml_EMIT_BLOCK_MAPPING_KEY_STATE: + return yaml_emitter_emit_block_mapping_key(emitter, event, false) + + case yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE: + return yaml_emitter_emit_block_mapping_value(emitter, event, true) + + case yaml_EMIT_BLOCK_MAPPING_VALUE_STATE: + return yaml_emitter_emit_block_mapping_value(emitter, event, false) + + case yaml_EMIT_END_STATE: + return yaml_emitter_set_emitter_error(emitter, "expected nothing after STREAM-END") + } + panic("invalid emitter state") +} + +// Expect STREAM-START. +func yaml_emitter_emit_stream_start(emitter *yaml_emitter_t, event *yaml_event_t) bool { + if event.typ != yaml_STREAM_START_EVENT { + return yaml_emitter_set_emitter_error(emitter, "expected STREAM-START") + } + if emitter.encoding == yaml_ANY_ENCODING { + emitter.encoding = event.encoding + if emitter.encoding == yaml_ANY_ENCODING { + emitter.encoding = yaml_UTF8_ENCODING + } + } + if emitter.best_indent < 2 || emitter.best_indent > 9 { + emitter.best_indent = 2 + } + if emitter.best_width >= 0 && emitter.best_width <= emitter.best_indent*2 { + emitter.best_width = 80 + } + if emitter.best_width < 0 { + emitter.best_width = 1<<31 - 1 + } + if emitter.line_break == yaml_ANY_BREAK { + emitter.line_break = yaml_LN_BREAK + } + + emitter.indent = -1 + emitter.line = 0 + emitter.column = 0 + emitter.whitespace = true + emitter.indention = true + emitter.space_above = true + emitter.foot_indent = -1 + + if emitter.encoding != yaml_UTF8_ENCODING { + if !yaml_emitter_write_bom(emitter) { + return false + } + } + emitter.state = yaml_EMIT_FIRST_DOCUMENT_START_STATE + return true +} + +// Expect DOCUMENT-START or STREAM-END. +func yaml_emitter_emit_document_start(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { + + if event.typ == yaml_DOCUMENT_START_EVENT { + + if event.version_directive != nil { + if !yaml_emitter_analyze_version_directive(emitter, event.version_directive) { + return false + } + } + + for i := 0; i < len(event.tag_directives); i++ { + tag_directive := &event.tag_directives[i] + if !yaml_emitter_analyze_tag_directive(emitter, tag_directive) { + return false + } + if !yaml_emitter_append_tag_directive(emitter, tag_directive, false) { + return false + } + } + + for i := 0; i < len(default_tag_directives); i++ { + tag_directive := &default_tag_directives[i] + if !yaml_emitter_append_tag_directive(emitter, tag_directive, true) { + return false + } + } + + implicit := event.implicit + if !first || emitter.canonical { + implicit = false + } + + if emitter.open_ended && (event.version_directive != nil || len(event.tag_directives) > 0) { + if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + } + + if event.version_directive != nil { + implicit = false + if !yaml_emitter_write_indicator(emitter, []byte("%YAML"), true, false, false) { + return false + } + if !yaml_emitter_write_indicator(emitter, []byte("1.1"), true, false, false) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + } + + if len(event.tag_directives) > 0 { + implicit = false + for i := 0; i < len(event.tag_directives); i++ { + tag_directive := &event.tag_directives[i] + if !yaml_emitter_write_indicator(emitter, []byte("%TAG"), true, false, false) { + return false + } + if !yaml_emitter_write_tag_handle(emitter, tag_directive.handle) { + return false + } + if !yaml_emitter_write_tag_content(emitter, tag_directive.prefix, true) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + } + } + + if yaml_emitter_check_empty_document(emitter) { + implicit = false + } + if !implicit { + if !yaml_emitter_write_indent(emitter) { + return false + } + if !yaml_emitter_write_indicator(emitter, []byte("---"), true, false, false) { + return false + } + if emitter.canonical || true { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + } + + if len(emitter.head_comment) > 0 { + if !yaml_emitter_process_head_comment(emitter) { + return false + } + if !put_break(emitter) { + return false + } + } + + emitter.state = yaml_EMIT_DOCUMENT_CONTENT_STATE + return true + } + + if event.typ == yaml_STREAM_END_EVENT { + if emitter.open_ended { + if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !yaml_emitter_flush(emitter) { + return false + } + emitter.state = yaml_EMIT_END_STATE + return true + } + + return yaml_emitter_set_emitter_error(emitter, "expected DOCUMENT-START or STREAM-END") +} + +// yaml_emitter_increase_indent preserves the original signature and delegates to +// yaml_emitter_increase_indent_compact without compact-sequence indentation +func yaml_emitter_increase_indent(emitter *yaml_emitter_t, flow, indentless bool) bool { + return yaml_emitter_increase_indent_compact(emitter, flow, indentless, false) +} + +// yaml_emitter_process_line_comment preserves the original signature and delegates to +// yaml_emitter_process_line_comment_linebreak passing false for linebreak +func yaml_emitter_process_line_comment(emitter *yaml_emitter_t) bool { + return yaml_emitter_process_line_comment_linebreak(emitter, false) +} + +// Expect the root node. +func yaml_emitter_emit_document_content(emitter *yaml_emitter_t, event *yaml_event_t) bool { + emitter.states = append(emitter.states, yaml_EMIT_DOCUMENT_END_STATE) + + if !yaml_emitter_process_head_comment(emitter) { + return false + } + if !yaml_emitter_emit_node(emitter, event, true, false, false, false) { + return false + } + if !yaml_emitter_process_line_comment(emitter) { + return false + } + if !yaml_emitter_process_foot_comment(emitter) { + return false + } + return true +} + +// Expect DOCUMENT-END. +func yaml_emitter_emit_document_end(emitter *yaml_emitter_t, event *yaml_event_t) bool { + if event.typ != yaml_DOCUMENT_END_EVENT { + return yaml_emitter_set_emitter_error(emitter, "expected DOCUMENT-END") + } + // [Go] Force document foot separation. + emitter.foot_indent = 0 + if !yaml_emitter_process_foot_comment(emitter) { + return false + } + emitter.foot_indent = -1 + if !yaml_emitter_write_indent(emitter) { + return false + } + if !event.implicit { + // [Go] Allocate the slice elsewhere. + if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !yaml_emitter_flush(emitter) { + return false + } + emitter.state = yaml_EMIT_DOCUMENT_START_STATE + emitter.tag_directives = emitter.tag_directives[:0] + return true +} + +// Expect a flow item node. +func yaml_emitter_emit_flow_sequence_item(emitter *yaml_emitter_t, event *yaml_event_t, first, trail bool) bool { + if first { + if !yaml_emitter_write_indicator(emitter, []byte{'['}, true, true, false) { + return false + } + if !yaml_emitter_increase_indent(emitter, true, false) { + return false + } + emitter.flow_level++ + } + + if event.typ == yaml_SEQUENCE_END_EVENT { + if emitter.canonical && !first && !trail { + if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { + return false + } + } + emitter.flow_level-- + emitter.indent = emitter.indents[len(emitter.indents)-1] + emitter.indents = emitter.indents[:len(emitter.indents)-1] + if emitter.column == 0 || emitter.canonical && !first { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !yaml_emitter_write_indicator(emitter, []byte{']'}, false, false, false) { + return false + } + if !yaml_emitter_process_line_comment(emitter) { + return false + } + if !yaml_emitter_process_foot_comment(emitter) { + return false + } + emitter.state = emitter.states[len(emitter.states)-1] + emitter.states = emitter.states[:len(emitter.states)-1] + + return true + } + + if !first && !trail { + if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { + return false + } + } + + if !yaml_emitter_process_head_comment(emitter) { + return false + } + if emitter.column == 0 { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + + if emitter.canonical || emitter.column > emitter.best_width { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if len(emitter.line_comment)+len(emitter.foot_comment)+len(emitter.tail_comment) > 0 { + emitter.states = append(emitter.states, yaml_EMIT_FLOW_SEQUENCE_TRAIL_ITEM_STATE) + } else { + emitter.states = append(emitter.states, yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE) + } + if !yaml_emitter_emit_node(emitter, event, false, true, false, false) { + return false + } + if len(emitter.line_comment)+len(emitter.foot_comment)+len(emitter.tail_comment) > 0 { + if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { + return false + } + } + if !yaml_emitter_process_line_comment(emitter) { + return false + } + if !yaml_emitter_process_foot_comment(emitter) { + return false + } + return true +} + +// Expect a flow key node. +func yaml_emitter_emit_flow_mapping_key(emitter *yaml_emitter_t, event *yaml_event_t, first, trail bool) bool { + if first { + if !yaml_emitter_write_indicator(emitter, []byte{'{'}, true, true, false) { + return false + } + if !yaml_emitter_increase_indent(emitter, true, false) { + return false + } + emitter.flow_level++ + } + + if event.typ == yaml_MAPPING_END_EVENT { + if (emitter.canonical || len(emitter.head_comment)+len(emitter.foot_comment)+len(emitter.tail_comment) > 0) && !first && !trail { + if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { + return false + } + } + if !yaml_emitter_process_head_comment(emitter) { + return false + } + emitter.flow_level-- + emitter.indent = emitter.indents[len(emitter.indents)-1] + emitter.indents = emitter.indents[:len(emitter.indents)-1] + if emitter.canonical && !first { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !yaml_emitter_write_indicator(emitter, []byte{'}'}, false, false, false) { + return false + } + if !yaml_emitter_process_line_comment(emitter) { + return false + } + if !yaml_emitter_process_foot_comment(emitter) { + return false + } + emitter.state = emitter.states[len(emitter.states)-1] + emitter.states = emitter.states[:len(emitter.states)-1] + return true + } + + if !first && !trail { + if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { + return false + } + } + + if !yaml_emitter_process_head_comment(emitter) { + return false + } + + if emitter.column == 0 { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + + if emitter.canonical || emitter.column > emitter.best_width { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + + if !emitter.canonical && yaml_emitter_check_simple_key(emitter) { + emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE) + return yaml_emitter_emit_node(emitter, event, false, false, true, true) + } + if !yaml_emitter_write_indicator(emitter, []byte{'?'}, true, false, false) { + return false + } + emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_VALUE_STATE) + return yaml_emitter_emit_node(emitter, event, false, false, true, false) +} + +// Expect a flow value node. +func yaml_emitter_emit_flow_mapping_value(emitter *yaml_emitter_t, event *yaml_event_t, simple bool) bool { + if simple { + if !yaml_emitter_write_indicator(emitter, []byte{':'}, false, false, false) { + return false + } + } else { + if emitter.canonical || emitter.column > emitter.best_width { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !yaml_emitter_write_indicator(emitter, []byte{':'}, true, false, false) { + return false + } + } + if len(emitter.line_comment)+len(emitter.foot_comment)+len(emitter.tail_comment) > 0 { + emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_TRAIL_KEY_STATE) + } else { + emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_KEY_STATE) + } + if !yaml_emitter_emit_node(emitter, event, false, false, true, false) { + return false + } + if len(emitter.line_comment)+len(emitter.foot_comment)+len(emitter.tail_comment) > 0 { + if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { + return false + } + } + if !yaml_emitter_process_line_comment(emitter) { + return false + } + if !yaml_emitter_process_foot_comment(emitter) { + return false + } + return true +} + +// Expect a block item node. +func yaml_emitter_emit_block_sequence_item(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { + if first { + // emitter.mapping context tells us if we are currently in a mapping context. + // emiiter.column tells us which column we are in in the yaml output. 0 is the first char of the column. + // emitter.indentation tells us if the last character was an indentation character. + // emitter.compact_sequence_indent tells us if '- ' is considered part of the indentation for sequence elements. + // So, `seq` means that we are in a mapping context, and we are either at the first char of the column or + // the last character was not an indentation character, and we consider '- ' part of the indentation + // for sequence elements. + seq := emitter.mapping_context && (emitter.column == 0 || !emitter.indention) && + emitter.compact_sequence_indent + if !yaml_emitter_increase_indent_compact(emitter, false, false, seq) { + return false + } + } + if event.typ == yaml_SEQUENCE_END_EVENT { + emitter.indent = emitter.indents[len(emitter.indents)-1] + emitter.indents = emitter.indents[:len(emitter.indents)-1] + emitter.state = emitter.states[len(emitter.states)-1] + emitter.states = emitter.states[:len(emitter.states)-1] + return true + } + if !yaml_emitter_process_head_comment(emitter) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + if !yaml_emitter_write_indicator(emitter, []byte{'-'}, true, false, true) { + return false + } + emitter.states = append(emitter.states, yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE) + if !yaml_emitter_emit_node(emitter, event, false, true, false, false) { + return false + } + if !yaml_emitter_process_line_comment(emitter) { + return false + } + if !yaml_emitter_process_foot_comment(emitter) { + return false + } + return true +} + +// Expect a block key node. +func yaml_emitter_emit_block_mapping_key(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { + if first { + if !yaml_emitter_increase_indent(emitter, false, false) { + return false + } + } + if !yaml_emitter_process_head_comment(emitter) { + return false + } + if event.typ == yaml_MAPPING_END_EVENT { + emitter.indent = emitter.indents[len(emitter.indents)-1] + emitter.indents = emitter.indents[:len(emitter.indents)-1] + emitter.state = emitter.states[len(emitter.states)-1] + emitter.states = emitter.states[:len(emitter.states)-1] + return true + } + if !yaml_emitter_write_indent(emitter) { + return false + } + if len(emitter.line_comment) > 0 { + // [Go] A line comment was provided for the key. That's unusual as the + // scanner associates line comments with the value. Either way, + // save the line comment and render it appropriately later. + emitter.key_line_comment = emitter.line_comment + emitter.line_comment = nil + } + if yaml_emitter_check_simple_key(emitter) { + emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE) + return yaml_emitter_emit_node(emitter, event, false, false, true, true) + } + if !yaml_emitter_write_indicator(emitter, []byte{'?'}, true, false, true) { + return false + } + emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_VALUE_STATE) + return yaml_emitter_emit_node(emitter, event, false, false, true, false) +} + +// Expect a block value node. +func yaml_emitter_emit_block_mapping_value(emitter *yaml_emitter_t, event *yaml_event_t, simple bool) bool { + if simple { + if !yaml_emitter_write_indicator(emitter, []byte{':'}, false, false, false) { + return false + } + } else { + if !yaml_emitter_write_indent(emitter) { + return false + } + if !yaml_emitter_write_indicator(emitter, []byte{':'}, true, false, true) { + return false + } + } + if len(emitter.key_line_comment) > 0 { + // [Go] Line comments are generally associated with the value, but when there's + // no value on the same line as a mapping key they end up attached to the + // key itself. + if event.typ == yaml_SCALAR_EVENT { + if len(emitter.line_comment) == 0 { + // A scalar is coming and it has no line comments by itself yet, + // so just let it handle the line comment as usual. If it has a + // line comment, we can't have both so the one from the key is lost. + emitter.line_comment = emitter.key_line_comment + emitter.key_line_comment = nil + } + } else if event.sequence_style() != yaml_FLOW_SEQUENCE_STYLE && (event.typ == yaml_MAPPING_START_EVENT || event.typ == yaml_SEQUENCE_START_EVENT) { + // An indented block follows, so write the comment right now. + emitter.line_comment, emitter.key_line_comment = emitter.key_line_comment, emitter.line_comment + if !yaml_emitter_process_line_comment(emitter) { + return false + } + emitter.line_comment, emitter.key_line_comment = emitter.key_line_comment, emitter.line_comment + } + } + emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_KEY_STATE) + if !yaml_emitter_emit_node(emitter, event, false, false, true, false) { + return false + } + if !yaml_emitter_process_line_comment(emitter) { + return false + } + if !yaml_emitter_process_foot_comment(emitter) { + return false + } + return true +} + +func yaml_emitter_silent_nil_event(emitter *yaml_emitter_t, event *yaml_event_t) bool { + return event.typ == yaml_SCALAR_EVENT && event.implicit && !emitter.canonical && len(emitter.scalar_data.value) == 0 +} + +// Expect a node. +func yaml_emitter_emit_node(emitter *yaml_emitter_t, event *yaml_event_t, + root bool, sequence bool, mapping bool, simple_key bool) bool { + + emitter.root_context = root + emitter.sequence_context = sequence + emitter.mapping_context = mapping + emitter.simple_key_context = simple_key + + switch event.typ { + case yaml_ALIAS_EVENT: + return yaml_emitter_emit_alias(emitter, event) + case yaml_SCALAR_EVENT: + return yaml_emitter_emit_scalar(emitter, event) + case yaml_SEQUENCE_START_EVENT: + return yaml_emitter_emit_sequence_start(emitter, event) + case yaml_MAPPING_START_EVENT: + return yaml_emitter_emit_mapping_start(emitter, event) + default: + return yaml_emitter_set_emitter_error(emitter, + fmt.Sprintf("expected SCALAR, SEQUENCE-START, MAPPING-START, or ALIAS, but got %v", event.typ)) + } +} + +// Expect ALIAS. +func yaml_emitter_emit_alias(emitter *yaml_emitter_t, event *yaml_event_t) bool { + if !yaml_emitter_process_anchor(emitter) { + return false + } + emitter.state = emitter.states[len(emitter.states)-1] + emitter.states = emitter.states[:len(emitter.states)-1] + return true +} + +// Expect SCALAR. +func yaml_emitter_emit_scalar(emitter *yaml_emitter_t, event *yaml_event_t) bool { + if !yaml_emitter_select_scalar_style(emitter, event) { + return false + } + if !yaml_emitter_process_anchor(emitter) { + return false + } + if !yaml_emitter_process_tag(emitter) { + return false + } + if !yaml_emitter_increase_indent(emitter, true, false) { + return false + } + if !yaml_emitter_process_scalar(emitter) { + return false + } + emitter.indent = emitter.indents[len(emitter.indents)-1] + emitter.indents = emitter.indents[:len(emitter.indents)-1] + emitter.state = emitter.states[len(emitter.states)-1] + emitter.states = emitter.states[:len(emitter.states)-1] + return true +} + +// Expect SEQUENCE-START. +func yaml_emitter_emit_sequence_start(emitter *yaml_emitter_t, event *yaml_event_t) bool { + if !yaml_emitter_process_anchor(emitter) { + return false + } + if !yaml_emitter_process_tag(emitter) { + return false + } + if emitter.flow_level > 0 || emitter.canonical || event.sequence_style() == yaml_FLOW_SEQUENCE_STYLE || + yaml_emitter_check_empty_sequence(emitter) { + emitter.state = yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE + } else { + emitter.state = yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE + } + return true +} + +// Expect MAPPING-START. +func yaml_emitter_emit_mapping_start(emitter *yaml_emitter_t, event *yaml_event_t) bool { + if !yaml_emitter_process_anchor(emitter) { + return false + } + if !yaml_emitter_process_tag(emitter) { + return false + } + if emitter.flow_level > 0 || emitter.canonical || event.mapping_style() == yaml_FLOW_MAPPING_STYLE || + yaml_emitter_check_empty_mapping(emitter) { + emitter.state = yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE + } else { + emitter.state = yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE + } + return true +} + +// Check if the document content is an empty scalar. +func yaml_emitter_check_empty_document(emitter *yaml_emitter_t) bool { + return false // [Go] Huh? +} + +// Check if the next events represent an empty sequence. +func yaml_emitter_check_empty_sequence(emitter *yaml_emitter_t) bool { + if len(emitter.events)-emitter.events_head < 2 { + return false + } + return emitter.events[emitter.events_head].typ == yaml_SEQUENCE_START_EVENT && + emitter.events[emitter.events_head+1].typ == yaml_SEQUENCE_END_EVENT +} + +// Check if the next events represent an empty mapping. +func yaml_emitter_check_empty_mapping(emitter *yaml_emitter_t) bool { + if len(emitter.events)-emitter.events_head < 2 { + return false + } + return emitter.events[emitter.events_head].typ == yaml_MAPPING_START_EVENT && + emitter.events[emitter.events_head+1].typ == yaml_MAPPING_END_EVENT +} + +// Check if the next node can be expressed as a simple key. +func yaml_emitter_check_simple_key(emitter *yaml_emitter_t) bool { + length := 0 + switch emitter.events[emitter.events_head].typ { + case yaml_ALIAS_EVENT: + length += len(emitter.anchor_data.anchor) + case yaml_SCALAR_EVENT: + if emitter.scalar_data.multiline { + return false + } + length += len(emitter.anchor_data.anchor) + + len(emitter.tag_data.handle) + + len(emitter.tag_data.suffix) + + len(emitter.scalar_data.value) + case yaml_SEQUENCE_START_EVENT: + if !yaml_emitter_check_empty_sequence(emitter) { + return false + } + length += len(emitter.anchor_data.anchor) + + len(emitter.tag_data.handle) + + len(emitter.tag_data.suffix) + case yaml_MAPPING_START_EVENT: + if !yaml_emitter_check_empty_mapping(emitter) { + return false + } + length += len(emitter.anchor_data.anchor) + + len(emitter.tag_data.handle) + + len(emitter.tag_data.suffix) + default: + return false + } + return length <= 128 +} + +// Determine an acceptable scalar style. +func yaml_emitter_select_scalar_style(emitter *yaml_emitter_t, event *yaml_event_t) bool { + + no_tag := len(emitter.tag_data.handle) == 0 && len(emitter.tag_data.suffix) == 0 + if no_tag && !event.implicit && !event.quoted_implicit { + return yaml_emitter_set_emitter_error(emitter, "neither tag nor implicit flags are specified") + } + + style := event.scalar_style() + if style == yaml_ANY_SCALAR_STYLE { + style = yaml_PLAIN_SCALAR_STYLE + } + if emitter.canonical { + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + if emitter.simple_key_context && emitter.scalar_data.multiline { + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + + if style == yaml_PLAIN_SCALAR_STYLE { + if emitter.flow_level > 0 && !emitter.scalar_data.flow_plain_allowed || + emitter.flow_level == 0 && !emitter.scalar_data.block_plain_allowed { + style = yaml_SINGLE_QUOTED_SCALAR_STYLE + } + if len(emitter.scalar_data.value) == 0 && (emitter.flow_level > 0 || emitter.simple_key_context) { + style = yaml_SINGLE_QUOTED_SCALAR_STYLE + } + if no_tag && !event.implicit { + style = yaml_SINGLE_QUOTED_SCALAR_STYLE + } + } + if style == yaml_SINGLE_QUOTED_SCALAR_STYLE { + if !emitter.scalar_data.single_quoted_allowed { + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + } + if style == yaml_LITERAL_SCALAR_STYLE || style == yaml_FOLDED_SCALAR_STYLE { + if !emitter.scalar_data.block_allowed || emitter.flow_level > 0 || emitter.simple_key_context { + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + } + + if no_tag && !event.quoted_implicit && style != yaml_PLAIN_SCALAR_STYLE { + emitter.tag_data.handle = []byte{'!'} + } + emitter.scalar_data.style = style + return true +} + +// Write an anchor. +func yaml_emitter_process_anchor(emitter *yaml_emitter_t) bool { + if emitter.anchor_data.anchor == nil { + return true + } + c := []byte{'&'} + if emitter.anchor_data.alias { + c[0] = '*' + } + if !yaml_emitter_write_indicator(emitter, c, true, false, false) { + return false + } + return yaml_emitter_write_anchor(emitter, emitter.anchor_data.anchor) +} + +// Write a tag. +func yaml_emitter_process_tag(emitter *yaml_emitter_t) bool { + if len(emitter.tag_data.handle) == 0 && len(emitter.tag_data.suffix) == 0 { + return true + } + if len(emitter.tag_data.handle) > 0 { + if !yaml_emitter_write_tag_handle(emitter, emitter.tag_data.handle) { + return false + } + if len(emitter.tag_data.suffix) > 0 { + if !yaml_emitter_write_tag_content(emitter, emitter.tag_data.suffix, false) { + return false + } + } + } else { + // [Go] Allocate these slices elsewhere. + if !yaml_emitter_write_indicator(emitter, []byte("!<"), true, false, false) { + return false + } + if !yaml_emitter_write_tag_content(emitter, emitter.tag_data.suffix, false) { + return false + } + if !yaml_emitter_write_indicator(emitter, []byte{'>'}, false, false, false) { + return false + } + } + return true +} + +// Write a scalar. +func yaml_emitter_process_scalar(emitter *yaml_emitter_t) bool { + switch emitter.scalar_data.style { + case yaml_PLAIN_SCALAR_STYLE: + return yaml_emitter_write_plain_scalar(emitter, emitter.scalar_data.value, !emitter.simple_key_context) + + case yaml_SINGLE_QUOTED_SCALAR_STYLE: + return yaml_emitter_write_single_quoted_scalar(emitter, emitter.scalar_data.value, !emitter.simple_key_context) + + case yaml_DOUBLE_QUOTED_SCALAR_STYLE: + return yaml_emitter_write_double_quoted_scalar(emitter, emitter.scalar_data.value, !emitter.simple_key_context) + + case yaml_LITERAL_SCALAR_STYLE: + return yaml_emitter_write_literal_scalar(emitter, emitter.scalar_data.value) + + case yaml_FOLDED_SCALAR_STYLE: + return yaml_emitter_write_folded_scalar(emitter, emitter.scalar_data.value) + } + panic("unknown scalar style") +} + +// Write a head comment. +func yaml_emitter_process_head_comment(emitter *yaml_emitter_t) bool { + if len(emitter.tail_comment) > 0 { + if !yaml_emitter_write_indent(emitter) { + return false + } + if !yaml_emitter_write_comment(emitter, emitter.tail_comment) { + return false + } + emitter.tail_comment = emitter.tail_comment[:0] + emitter.foot_indent = emitter.indent + if emitter.foot_indent < 0 { + emitter.foot_indent = 0 + } + } + + if len(emitter.head_comment) == 0 { + return true + } + if !yaml_emitter_write_indent(emitter) { + return false + } + if !yaml_emitter_write_comment(emitter, emitter.head_comment) { + return false + } + emitter.head_comment = emitter.head_comment[:0] + return true +} + +// Write an line comment. +func yaml_emitter_process_line_comment_linebreak(emitter *yaml_emitter_t, linebreak bool) bool { + if len(emitter.line_comment) == 0 { + // The next 3 lines are needed to resolve an issue with leading newlines + // See https://github.com/go-yaml/yaml/issues/755 + // When linebreak is set to true, put_break will be called and will add + // the needed newline. + if linebreak && !put_break(emitter) { + return false + } + return true + } + if !emitter.whitespace { + if !put(emitter, ' ') { + return false + } + } + if !yaml_emitter_write_comment(emitter, emitter.line_comment) { + return false + } + emitter.line_comment = emitter.line_comment[:0] + return true +} + +// Write a foot comment. +func yaml_emitter_process_foot_comment(emitter *yaml_emitter_t) bool { + if len(emitter.foot_comment) == 0 { + return true + } + if !yaml_emitter_write_indent(emitter) { + return false + } + if !yaml_emitter_write_comment(emitter, emitter.foot_comment) { + return false + } + emitter.foot_comment = emitter.foot_comment[:0] + emitter.foot_indent = emitter.indent + if emitter.foot_indent < 0 { + emitter.foot_indent = 0 + } + return true +} + +// Check if a %YAML directive is valid. +func yaml_emitter_analyze_version_directive(emitter *yaml_emitter_t, version_directive *yaml_version_directive_t) bool { + if version_directive.major != 1 || version_directive.minor != 1 { + return yaml_emitter_set_emitter_error(emitter, "incompatible %YAML directive") + } + return true +} + +// Check if a %TAG directive is valid. +func yaml_emitter_analyze_tag_directive(emitter *yaml_emitter_t, tag_directive *yaml_tag_directive_t) bool { + handle := tag_directive.handle + prefix := tag_directive.prefix + if len(handle) == 0 { + return yaml_emitter_set_emitter_error(emitter, "tag handle must not be empty") + } + if handle[0] != '!' { + return yaml_emitter_set_emitter_error(emitter, "tag handle must start with '!'") + } + if handle[len(handle)-1] != '!' { + return yaml_emitter_set_emitter_error(emitter, "tag handle must end with '!'") + } + for i := 1; i < len(handle)-1; i += width(handle[i]) { + if !is_alpha(handle, i) { + return yaml_emitter_set_emitter_error(emitter, "tag handle must contain alphanumerical characters only") + } + } + if len(prefix) == 0 { + return yaml_emitter_set_emitter_error(emitter, "tag prefix must not be empty") + } + return true +} + +// Check if an anchor is valid. +func yaml_emitter_analyze_anchor(emitter *yaml_emitter_t, anchor []byte, alias bool) bool { + if len(anchor) == 0 { + problem := "anchor value must not be empty" + if alias { + problem = "alias value must not be empty" + } + return yaml_emitter_set_emitter_error(emitter, problem) + } + for i := 0; i < len(anchor); i += width(anchor[i]) { + if !is_alpha(anchor, i) { + problem := "anchor value must contain alphanumerical characters only" + if alias { + problem = "alias value must contain alphanumerical characters only" + } + return yaml_emitter_set_emitter_error(emitter, problem) + } + } + emitter.anchor_data.anchor = anchor + emitter.anchor_data.alias = alias + return true +} + +// Check if a tag is valid. +func yaml_emitter_analyze_tag(emitter *yaml_emitter_t, tag []byte) bool { + if len(tag) == 0 { + return yaml_emitter_set_emitter_error(emitter, "tag value must not be empty") + } + for i := 0; i < len(emitter.tag_directives); i++ { + tag_directive := &emitter.tag_directives[i] + if bytes.HasPrefix(tag, tag_directive.prefix) { + emitter.tag_data.handle = tag_directive.handle + emitter.tag_data.suffix = tag[len(tag_directive.prefix):] + return true + } + } + emitter.tag_data.suffix = tag + return true +} + +// Check if a scalar is valid. +func yaml_emitter_analyze_scalar(emitter *yaml_emitter_t, value []byte) bool { + var ( + block_indicators = false + flow_indicators = false + line_breaks = false + special_characters = false + tab_characters = false + + leading_space = false + leading_break = false + trailing_space = false + trailing_break = false + break_space = false + space_break = false + + preceded_by_whitespace = false + followed_by_whitespace = false + previous_space = false + previous_break = false + ) + + emitter.scalar_data.value = value + + if len(value) == 0 { + emitter.scalar_data.multiline = false + emitter.scalar_data.flow_plain_allowed = false + emitter.scalar_data.block_plain_allowed = true + emitter.scalar_data.single_quoted_allowed = true + emitter.scalar_data.block_allowed = false + return true + } + + if len(value) >= 3 && ((value[0] == '-' && value[1] == '-' && value[2] == '-') || (value[0] == '.' && value[1] == '.' && value[2] == '.')) { + block_indicators = true + flow_indicators = true + } + + preceded_by_whitespace = true + for i, w := 0, 0; i < len(value); i += w { + w = width(value[i]) + followed_by_whitespace = i+w >= len(value) || is_blank(value, i+w) + + if i == 0 { + switch value[i] { + case '#', ',', '[', ']', '{', '}', '&', '*', '!', '|', '>', '\'', '"', '%', '@', '`': + flow_indicators = true + block_indicators = true + case '?', ':': + flow_indicators = true + if followed_by_whitespace { + block_indicators = true + } + case '-': + if followed_by_whitespace { + flow_indicators = true + block_indicators = true + } + } + } else { + switch value[i] { + case ',', '?', '[', ']', '{', '}': + flow_indicators = true + case ':': + flow_indicators = true + if followed_by_whitespace { + block_indicators = true + } + case '#': + if preceded_by_whitespace { + flow_indicators = true + block_indicators = true + } + } + } + + if value[i] == '\t' { + tab_characters = true + } else if !is_printable(value, i) || !is_ascii(value, i) && !emitter.unicode { + special_characters = true + } + if is_space(value, i) { + if i == 0 { + leading_space = true + } + if i+width(value[i]) == len(value) { + trailing_space = true + } + if previous_break { + break_space = true + } + previous_space = true + previous_break = false + } else if is_break(value, i) { + line_breaks = true + if i == 0 { + leading_break = true + } + if i+width(value[i]) == len(value) { + trailing_break = true + } + if previous_space { + space_break = true + } + previous_space = false + previous_break = true + } else { + previous_space = false + previous_break = false + } + + // [Go]: Why 'z'? Couldn't be the end of the string as that's the loop condition. + preceded_by_whitespace = is_blankz(value, i) + } + + emitter.scalar_data.multiline = line_breaks + emitter.scalar_data.flow_plain_allowed = true + emitter.scalar_data.block_plain_allowed = true + emitter.scalar_data.single_quoted_allowed = true + emitter.scalar_data.block_allowed = true + + if leading_space || leading_break || trailing_space || trailing_break { + emitter.scalar_data.flow_plain_allowed = false + emitter.scalar_data.block_plain_allowed = false + } + if trailing_space { + emitter.scalar_data.block_allowed = false + } + if break_space { + emitter.scalar_data.flow_plain_allowed = false + emitter.scalar_data.block_plain_allowed = false + emitter.scalar_data.single_quoted_allowed = false + } + if space_break || tab_characters || special_characters { + emitter.scalar_data.flow_plain_allowed = false + emitter.scalar_data.block_plain_allowed = false + emitter.scalar_data.single_quoted_allowed = false + } + if space_break || special_characters { + emitter.scalar_data.block_allowed = false + } + if line_breaks { + emitter.scalar_data.flow_plain_allowed = false + emitter.scalar_data.block_plain_allowed = false + } + if flow_indicators { + emitter.scalar_data.flow_plain_allowed = false + } + if block_indicators { + emitter.scalar_data.block_plain_allowed = false + } + return true +} + +// Check if the event data is valid. +func yaml_emitter_analyze_event(emitter *yaml_emitter_t, event *yaml_event_t) bool { + + emitter.anchor_data.anchor = nil + emitter.tag_data.handle = nil + emitter.tag_data.suffix = nil + emitter.scalar_data.value = nil + + if len(event.head_comment) > 0 { + emitter.head_comment = event.head_comment + } + if len(event.line_comment) > 0 { + emitter.line_comment = event.line_comment + } + if len(event.foot_comment) > 0 { + emitter.foot_comment = event.foot_comment + } + if len(event.tail_comment) > 0 { + emitter.tail_comment = event.tail_comment + } + + switch event.typ { + case yaml_ALIAS_EVENT: + if !yaml_emitter_analyze_anchor(emitter, event.anchor, true) { + return false + } + + case yaml_SCALAR_EVENT: + if len(event.anchor) > 0 { + if !yaml_emitter_analyze_anchor(emitter, event.anchor, false) { + return false + } + } + if len(event.tag) > 0 && (emitter.canonical || (!event.implicit && !event.quoted_implicit)) { + if !yaml_emitter_analyze_tag(emitter, event.tag) { + return false + } + } + if !yaml_emitter_analyze_scalar(emitter, event.value) { + return false + } + + case yaml_SEQUENCE_START_EVENT: + if len(event.anchor) > 0 { + if !yaml_emitter_analyze_anchor(emitter, event.anchor, false) { + return false + } + } + if len(event.tag) > 0 && (emitter.canonical || !event.implicit) { + if !yaml_emitter_analyze_tag(emitter, event.tag) { + return false + } + } + + case yaml_MAPPING_START_EVENT: + if len(event.anchor) > 0 { + if !yaml_emitter_analyze_anchor(emitter, event.anchor, false) { + return false + } + } + if len(event.tag) > 0 && (emitter.canonical || !event.implicit) { + if !yaml_emitter_analyze_tag(emitter, event.tag) { + return false + } + } + } + return true +} + +// Write the BOM character. +func yaml_emitter_write_bom(emitter *yaml_emitter_t) bool { + if !flush(emitter) { + return false + } + pos := emitter.buffer_pos + emitter.buffer[pos+0] = '\xEF' + emitter.buffer[pos+1] = '\xBB' + emitter.buffer[pos+2] = '\xBF' + emitter.buffer_pos += 3 + return true +} + +func yaml_emitter_write_indent(emitter *yaml_emitter_t) bool { + indent := emitter.indent + if indent < 0 { + indent = 0 + } + if !emitter.indention || emitter.column > indent || (emitter.column == indent && !emitter.whitespace) { + if !put_break(emitter) { + return false + } + } + if emitter.foot_indent == indent { + if !put_break(emitter) { + return false + } + } + for emitter.column < indent { + if !put(emitter, ' ') { + return false + } + } + emitter.whitespace = true + //emitter.indention = true + emitter.space_above = false + emitter.foot_indent = -1 + return true +} + +func yaml_emitter_write_indicator(emitter *yaml_emitter_t, indicator []byte, need_whitespace, is_whitespace, is_indention bool) bool { + if need_whitespace && !emitter.whitespace { + if !put(emitter, ' ') { + return false + } + } + if !write_all(emitter, indicator) { + return false + } + emitter.whitespace = is_whitespace + emitter.indention = (emitter.indention && is_indention) + emitter.open_ended = false + return true +} + +func yaml_emitter_write_anchor(emitter *yaml_emitter_t, value []byte) bool { + if !write_all(emitter, value) { + return false + } + emitter.whitespace = false + emitter.indention = false + return true +} + +func yaml_emitter_write_tag_handle(emitter *yaml_emitter_t, value []byte) bool { + if !emitter.whitespace { + if !put(emitter, ' ') { + return false + } + } + if !write_all(emitter, value) { + return false + } + emitter.whitespace = false + emitter.indention = false + return true +} + +func yaml_emitter_write_tag_content(emitter *yaml_emitter_t, value []byte, need_whitespace bool) bool { + if need_whitespace && !emitter.whitespace { + if !put(emitter, ' ') { + return false + } + } + for i := 0; i < len(value); { + var must_write bool + switch value[i] { + case ';', '/', '?', ':', '@', '&', '=', '+', '$', ',', '_', '.', '~', '*', '\'', '(', ')', '[', ']': + must_write = true + default: + must_write = is_alpha(value, i) + } + if must_write { + if !write(emitter, value, &i) { + return false + } + } else { + w := width(value[i]) + for k := 0; k < w; k++ { + octet := value[i] + i++ + if !put(emitter, '%') { + return false + } + + c := octet >> 4 + if c < 10 { + c += '0' + } else { + c += 'A' - 10 + } + if !put(emitter, c) { + return false + } + + c = octet & 0x0f + if c < 10 { + c += '0' + } else { + c += 'A' - 10 + } + if !put(emitter, c) { + return false + } + } + } + } + emitter.whitespace = false + emitter.indention = false + return true +} + +func yaml_emitter_write_plain_scalar(emitter *yaml_emitter_t, value []byte, allow_breaks bool) bool { + if len(value) > 0 && !emitter.whitespace { + if !put(emitter, ' ') { + return false + } + } + + spaces := false + breaks := false + for i := 0; i < len(value); { + if is_space(value, i) { + if allow_breaks && !spaces && emitter.column > emitter.best_width && !is_space(value, i+1) { + if !yaml_emitter_write_indent(emitter) { + return false + } + i += width(value[i]) + } else { + if !write(emitter, value, &i) { + return false + } + } + spaces = true + } else if is_break(value, i) { + if !breaks && value[i] == '\n' { + if !put_break(emitter) { + return false + } + } + if !write_break(emitter, value, &i) { + return false + } + //emitter.indention = true + breaks = true + } else { + if breaks { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !write(emitter, value, &i) { + return false + } + emitter.indention = false + spaces = false + breaks = false + } + } + + if len(value) > 0 { + emitter.whitespace = false + } + emitter.indention = false + if emitter.root_context { + emitter.open_ended = true + } + + return true +} + +func yaml_emitter_write_single_quoted_scalar(emitter *yaml_emitter_t, value []byte, allow_breaks bool) bool { + + if !yaml_emitter_write_indicator(emitter, []byte{'\''}, true, false, false) { + return false + } + + spaces := false + breaks := false + for i := 0; i < len(value); { + if is_space(value, i) { + if allow_breaks && !spaces && emitter.column > emitter.best_width && i > 0 && i < len(value)-1 && !is_space(value, i+1) { + if !yaml_emitter_write_indent(emitter) { + return false + } + i += width(value[i]) + } else { + if !write(emitter, value, &i) { + return false + } + } + spaces = true + } else if is_break(value, i) { + if !breaks && value[i] == '\n' { + if !put_break(emitter) { + return false + } + } + if !write_break(emitter, value, &i) { + return false + } + //emitter.indention = true + breaks = true + } else { + if breaks { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if value[i] == '\'' { + if !put(emitter, '\'') { + return false + } + } + if !write(emitter, value, &i) { + return false + } + emitter.indention = false + spaces = false + breaks = false + } + } + if !yaml_emitter_write_indicator(emitter, []byte{'\''}, false, false, false) { + return false + } + emitter.whitespace = false + emitter.indention = false + return true +} + +func yaml_emitter_write_double_quoted_scalar(emitter *yaml_emitter_t, value []byte, allow_breaks bool) bool { + spaces := false + if !yaml_emitter_write_indicator(emitter, []byte{'"'}, true, false, false) { + return false + } + + for i := 0; i < len(value); { + if !is_printable(value, i) || (!emitter.unicode && !is_ascii(value, i)) || + is_bom(value, i) || is_break(value, i) || + value[i] == '"' || value[i] == '\\' { + + octet := value[i] + + var w int + var v rune + switch { + case octet&0x80 == 0x00: + w, v = 1, rune(octet&0x7F) + case octet&0xE0 == 0xC0: + w, v = 2, rune(octet&0x1F) + case octet&0xF0 == 0xE0: + w, v = 3, rune(octet&0x0F) + case octet&0xF8 == 0xF0: + w, v = 4, rune(octet&0x07) + } + for k := 1; k < w; k++ { + octet = value[i+k] + v = (v << 6) + (rune(octet) & 0x3F) + } + i += w + + if !put(emitter, '\\') { + return false + } + + var ok bool + switch v { + case 0x00: + ok = put(emitter, '0') + case 0x07: + ok = put(emitter, 'a') + case 0x08: + ok = put(emitter, 'b') + case 0x09: + ok = put(emitter, 't') + case 0x0A: + ok = put(emitter, 'n') + case 0x0b: + ok = put(emitter, 'v') + case 0x0c: + ok = put(emitter, 'f') + case 0x0d: + ok = put(emitter, 'r') + case 0x1b: + ok = put(emitter, 'e') + case 0x22: + ok = put(emitter, '"') + case 0x5c: + ok = put(emitter, '\\') + case 0x85: + ok = put(emitter, 'N') + case 0xA0: + ok = put(emitter, '_') + case 0x2028: + ok = put(emitter, 'L') + case 0x2029: + ok = put(emitter, 'P') + default: + if v <= 0xFF { + ok = put(emitter, 'x') + w = 2 + } else if v <= 0xFFFF { + ok = put(emitter, 'u') + w = 4 + } else { + ok = put(emitter, 'U') + w = 8 + } + for k := (w - 1) * 4; ok && k >= 0; k -= 4 { + digit := byte((v >> uint(k)) & 0x0F) + if digit < 10 { + ok = put(emitter, digit+'0') + } else { + ok = put(emitter, digit+'A'-10) + } + } + } + if !ok { + return false + } + spaces = false + } else if is_space(value, i) { + if allow_breaks && !spaces && emitter.column > emitter.best_width && i > 0 && i < len(value)-1 { + if !yaml_emitter_write_indent(emitter) { + return false + } + if is_space(value, i+1) { + if !put(emitter, '\\') { + return false + } + } + i += width(value[i]) + } else if !write(emitter, value, &i) { + return false + } + spaces = true + } else { + if !write(emitter, value, &i) { + return false + } + spaces = false + } + } + if !yaml_emitter_write_indicator(emitter, []byte{'"'}, false, false, false) { + return false + } + emitter.whitespace = false + emitter.indention = false + return true +} + +func yaml_emitter_write_block_scalar_hints(emitter *yaml_emitter_t, value []byte) bool { + if is_space(value, 0) || is_break(value, 0) { + indent_hint := []byte{'0' + byte(emitter.best_indent)} + if !yaml_emitter_write_indicator(emitter, indent_hint, false, false, false) { + return false + } + } + + emitter.open_ended = false + + var chomp_hint [1]byte + if len(value) == 0 { + chomp_hint[0] = '-' + } else { + i := len(value) - 1 + for value[i]&0xC0 == 0x80 { + i-- + } + if !is_break(value, i) { + chomp_hint[0] = '-' + } else if i == 0 { + chomp_hint[0] = '+' + emitter.open_ended = true + } else { + i-- + for value[i]&0xC0 == 0x80 { + i-- + } + if is_break(value, i) { + chomp_hint[0] = '+' + emitter.open_ended = true + } + } + } + if chomp_hint[0] != 0 { + if !yaml_emitter_write_indicator(emitter, chomp_hint[:], false, false, false) { + return false + } + } + return true +} + +func yaml_emitter_write_literal_scalar(emitter *yaml_emitter_t, value []byte) bool { + if !yaml_emitter_write_indicator(emitter, []byte{'|'}, true, false, false) { + return false + } + if !yaml_emitter_write_block_scalar_hints(emitter, value) { + return false + } + if !yaml_emitter_process_line_comment_linebreak(emitter, true) { + return false + } + //emitter.indention = true + emitter.whitespace = true + breaks := true + for i := 0; i < len(value); { + if is_break(value, i) { + if !write_break(emitter, value, &i) { + return false + } + //emitter.indention = true + breaks = true + } else { + if breaks { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !write(emitter, value, &i) { + return false + } + emitter.indention = false + breaks = false + } + } + + return true +} + +func yaml_emitter_write_folded_scalar(emitter *yaml_emitter_t, value []byte) bool { + if !yaml_emitter_write_indicator(emitter, []byte{'>'}, true, false, false) { + return false + } + if !yaml_emitter_write_block_scalar_hints(emitter, value) { + return false + } + if !yaml_emitter_process_line_comment_linebreak(emitter, true) { + return false + } + + //emitter.indention = true + emitter.whitespace = true + + breaks := true + leading_spaces := true + for i := 0; i < len(value); { + if is_break(value, i) { + if !breaks && !leading_spaces && value[i] == '\n' { + k := 0 + for is_break(value, k) { + k += width(value[k]) + } + if !is_blankz(value, k) { + if !put_break(emitter) { + return false + } + } + } + if !write_break(emitter, value, &i) { + return false + } + //emitter.indention = true + breaks = true + } else { + if breaks { + if !yaml_emitter_write_indent(emitter) { + return false + } + leading_spaces = is_blank(value, i) + } + if !breaks && is_space(value, i) && !is_space(value, i+1) && emitter.column > emitter.best_width { + if !yaml_emitter_write_indent(emitter) { + return false + } + i += width(value[i]) + } else { + if !write(emitter, value, &i) { + return false + } + } + emitter.indention = false + breaks = false + } + } + return true +} + +func yaml_emitter_write_comment(emitter *yaml_emitter_t, comment []byte) bool { + breaks := false + pound := false + for i := 0; i < len(comment); { + if is_break(comment, i) { + if !write_break(emitter, comment, &i) { + return false + } + //emitter.indention = true + breaks = true + pound = false + } else { + if breaks && !yaml_emitter_write_indent(emitter) { + return false + } + if !pound { + if comment[i] != '#' && (!put(emitter, '#') || !put(emitter, ' ')) { + return false + } + pound = true + } + if !write(emitter, comment, &i) { + return false + } + emitter.indention = false + breaks = false + } + } + if !breaks && !put_break(emitter) { + return false + } + + emitter.whitespace = true + //emitter.indention = true + return true +} diff --git a/vendor/go.yaml.in/yaml/v3/encode.go b/vendor/go.yaml.in/yaml/v3/encode.go new file mode 100644 index 000000000..de9e72a3e --- /dev/null +++ b/vendor/go.yaml.in/yaml/v3/encode.go @@ -0,0 +1,577 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// +// 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 yaml + +import ( + "encoding" + "fmt" + "io" + "reflect" + "regexp" + "sort" + "strconv" + "strings" + "time" + "unicode/utf8" +) + +type encoder struct { + emitter yaml_emitter_t + event yaml_event_t + out []byte + flow bool + indent int + doneInit bool +} + +func newEncoder() *encoder { + e := &encoder{} + yaml_emitter_initialize(&e.emitter) + yaml_emitter_set_output_string(&e.emitter, &e.out) + yaml_emitter_set_unicode(&e.emitter, true) + return e +} + +func newEncoderWithWriter(w io.Writer) *encoder { + e := &encoder{} + yaml_emitter_initialize(&e.emitter) + yaml_emitter_set_output_writer(&e.emitter, w) + yaml_emitter_set_unicode(&e.emitter, true) + return e +} + +func (e *encoder) init() { + if e.doneInit { + return + } + if e.indent == 0 { + e.indent = 4 + } + e.emitter.best_indent = e.indent + yaml_stream_start_event_initialize(&e.event, yaml_UTF8_ENCODING) + e.emit() + e.doneInit = true +} + +func (e *encoder) finish() { + e.emitter.open_ended = false + yaml_stream_end_event_initialize(&e.event) + e.emit() +} + +func (e *encoder) destroy() { + yaml_emitter_delete(&e.emitter) +} + +func (e *encoder) emit() { + // This will internally delete the e.event value. + e.must(yaml_emitter_emit(&e.emitter, &e.event)) +} + +func (e *encoder) must(ok bool) { + if !ok { + msg := e.emitter.problem + if msg == "" { + msg = "unknown problem generating YAML content" + } + failf("%s", msg) + } +} + +func (e *encoder) marshalDoc(tag string, in reflect.Value) { + e.init() + var node *Node + if in.IsValid() { + node, _ = in.Interface().(*Node) + } + if node != nil && node.Kind == DocumentNode { + e.nodev(in) + } else { + yaml_document_start_event_initialize(&e.event, nil, nil, true) + e.emit() + e.marshal(tag, in) + yaml_document_end_event_initialize(&e.event, true) + e.emit() + } +} + +func (e *encoder) marshal(tag string, in reflect.Value) { + tag = shortTag(tag) + if !in.IsValid() || in.Kind() == reflect.Ptr && in.IsNil() { + e.nilv() + return + } + iface := in.Interface() + switch value := iface.(type) { + case *Node: + e.nodev(in) + return + case Node: + if !in.CanAddr() { + var n = reflect.New(in.Type()).Elem() + n.Set(in) + in = n + } + e.nodev(in.Addr()) + return + case time.Time: + e.timev(tag, in) + return + case *time.Time: + e.timev(tag, in.Elem()) + return + case time.Duration: + e.stringv(tag, reflect.ValueOf(value.String())) + return + case Marshaler: + v, err := value.MarshalYAML() + if err != nil { + fail(err) + } + if v == nil { + e.nilv() + return + } + e.marshal(tag, reflect.ValueOf(v)) + return + case encoding.TextMarshaler: + text, err := value.MarshalText() + if err != nil { + fail(err) + } + in = reflect.ValueOf(string(text)) + case nil: + e.nilv() + return + } + switch in.Kind() { + case reflect.Interface: + e.marshal(tag, in.Elem()) + case reflect.Map: + e.mapv(tag, in) + case reflect.Ptr: + e.marshal(tag, in.Elem()) + case reflect.Struct: + e.structv(tag, in) + case reflect.Slice, reflect.Array: + e.slicev(tag, in) + case reflect.String: + e.stringv(tag, in) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + e.intv(tag, in) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + e.uintv(tag, in) + case reflect.Float32, reflect.Float64: + e.floatv(tag, in) + case reflect.Bool: + e.boolv(tag, in) + default: + panic("cannot marshal type: " + in.Type().String()) + } +} + +func (e *encoder) mapv(tag string, in reflect.Value) { + e.mappingv(tag, func() { + keys := keyList(in.MapKeys()) + sort.Sort(keys) + for _, k := range keys { + e.marshal("", k) + e.marshal("", in.MapIndex(k)) + } + }) +} + +func (e *encoder) fieldByIndex(v reflect.Value, index []int) (field reflect.Value) { + for _, num := range index { + for { + if v.Kind() == reflect.Ptr { + if v.IsNil() { + return reflect.Value{} + } + v = v.Elem() + continue + } + break + } + v = v.Field(num) + } + return v +} + +func (e *encoder) structv(tag string, in reflect.Value) { + sinfo, err := getStructInfo(in.Type()) + if err != nil { + panic(err) + } + e.mappingv(tag, func() { + for _, info := range sinfo.FieldsList { + var value reflect.Value + if info.Inline == nil { + value = in.Field(info.Num) + } else { + value = e.fieldByIndex(in, info.Inline) + if !value.IsValid() { + continue + } + } + if info.OmitEmpty && isZero(value) { + continue + } + e.marshal("", reflect.ValueOf(info.Key)) + e.flow = info.Flow + e.marshal("", value) + } + if sinfo.InlineMap >= 0 { + m := in.Field(sinfo.InlineMap) + if m.Len() > 0 { + e.flow = false + keys := keyList(m.MapKeys()) + sort.Sort(keys) + for _, k := range keys { + if _, found := sinfo.FieldsMap[k.String()]; found { + panic(fmt.Sprintf("cannot have key %q in inlined map: conflicts with struct field", k.String())) + } + e.marshal("", k) + e.flow = false + e.marshal("", m.MapIndex(k)) + } + } + } + }) +} + +func (e *encoder) mappingv(tag string, f func()) { + implicit := tag == "" + style := yaml_BLOCK_MAPPING_STYLE + if e.flow { + e.flow = false + style = yaml_FLOW_MAPPING_STYLE + } + yaml_mapping_start_event_initialize(&e.event, nil, []byte(tag), implicit, style) + e.emit() + f() + yaml_mapping_end_event_initialize(&e.event) + e.emit() +} + +func (e *encoder) slicev(tag string, in reflect.Value) { + implicit := tag == "" + style := yaml_BLOCK_SEQUENCE_STYLE + if e.flow { + e.flow = false + style = yaml_FLOW_SEQUENCE_STYLE + } + e.must(yaml_sequence_start_event_initialize(&e.event, nil, []byte(tag), implicit, style)) + e.emit() + n := in.Len() + for i := 0; i < n; i++ { + e.marshal("", in.Index(i)) + } + e.must(yaml_sequence_end_event_initialize(&e.event)) + e.emit() +} + +// isBase60 returns whether s is in base 60 notation as defined in YAML 1.1. +// +// The base 60 float notation in YAML 1.1 is a terrible idea and is unsupported +// in YAML 1.2 and by this package, but these should be marshalled quoted for +// the time being for compatibility with other parsers. +func isBase60Float(s string) (result bool) { + // Fast path. + if s == "" { + return false + } + c := s[0] + if !(c == '+' || c == '-' || c >= '0' && c <= '9') || strings.IndexByte(s, ':') < 0 { + return false + } + // Do the full match. + return base60float.MatchString(s) +} + +// From http://yaml.org/type/float.html, except the regular expression there +// is bogus. In practice parsers do not enforce the "\.[0-9_]*" suffix. +var base60float = regexp.MustCompile(`^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+(?:\.[0-9_]*)?$`) + +// isOldBool returns whether s is bool notation as defined in YAML 1.1. +// +// We continue to force strings that YAML 1.1 would interpret as booleans to be +// rendered as quotes strings so that the marshalled output valid for YAML 1.1 +// parsing. +func isOldBool(s string) (result bool) { + switch s { + case "y", "Y", "yes", "Yes", "YES", "on", "On", "ON", + "n", "N", "no", "No", "NO", "off", "Off", "OFF": + return true + default: + return false + } +} + +func (e *encoder) stringv(tag string, in reflect.Value) { + var style yaml_scalar_style_t + s := in.String() + canUsePlain := true + switch { + case !utf8.ValidString(s): + if tag == binaryTag { + failf("explicitly tagged !!binary data must be base64-encoded") + } + if tag != "" { + failf("cannot marshal invalid UTF-8 data as %s", shortTag(tag)) + } + // It can't be encoded directly as YAML so use a binary tag + // and encode it as base64. + tag = binaryTag + s = encodeBase64(s) + case tag == "": + // Check to see if it would resolve to a specific + // tag when encoded unquoted. If it doesn't, + // there's no need to quote it. + rtag, _ := resolve("", s) + canUsePlain = rtag == strTag && !(isBase60Float(s) || isOldBool(s)) + } + // Note: it's possible for user code to emit invalid YAML + // if they explicitly specify a tag and a string containing + // text that's incompatible with that tag. + switch { + case strings.Contains(s, "\n"): + if e.flow { + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } else { + style = yaml_LITERAL_SCALAR_STYLE + } + case canUsePlain: + style = yaml_PLAIN_SCALAR_STYLE + default: + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + e.emitScalar(s, "", tag, style, nil, nil, nil, nil) +} + +func (e *encoder) boolv(tag string, in reflect.Value) { + var s string + if in.Bool() { + s = "true" + } else { + s = "false" + } + e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE, nil, nil, nil, nil) +} + +func (e *encoder) intv(tag string, in reflect.Value) { + s := strconv.FormatInt(in.Int(), 10) + e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE, nil, nil, nil, nil) +} + +func (e *encoder) uintv(tag string, in reflect.Value) { + s := strconv.FormatUint(in.Uint(), 10) + e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE, nil, nil, nil, nil) +} + +func (e *encoder) timev(tag string, in reflect.Value) { + t := in.Interface().(time.Time) + s := t.Format(time.RFC3339Nano) + e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE, nil, nil, nil, nil) +} + +func (e *encoder) floatv(tag string, in reflect.Value) { + // Issue #352: When formatting, use the precision of the underlying value + precision := 64 + if in.Kind() == reflect.Float32 { + precision = 32 + } + + s := strconv.FormatFloat(in.Float(), 'g', -1, precision) + switch s { + case "+Inf": + s = ".inf" + case "-Inf": + s = "-.inf" + case "NaN": + s = ".nan" + } + e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE, nil, nil, nil, nil) +} + +func (e *encoder) nilv() { + e.emitScalar("null", "", "", yaml_PLAIN_SCALAR_STYLE, nil, nil, nil, nil) +} + +func (e *encoder) emitScalar(value, anchor, tag string, style yaml_scalar_style_t, head, line, foot, tail []byte) { + // TODO Kill this function. Replace all initialize calls by their underlining Go literals. + implicit := tag == "" + if !implicit { + tag = longTag(tag) + } + e.must(yaml_scalar_event_initialize(&e.event, []byte(anchor), []byte(tag), []byte(value), implicit, implicit, style)) + e.event.head_comment = head + e.event.line_comment = line + e.event.foot_comment = foot + e.event.tail_comment = tail + e.emit() +} + +func (e *encoder) nodev(in reflect.Value) { + e.node(in.Interface().(*Node), "") +} + +func (e *encoder) node(node *Node, tail string) { + // Zero nodes behave as nil. + if node.Kind == 0 && node.IsZero() { + e.nilv() + return + } + + // If the tag was not explicitly requested, and dropping it won't change the + // implicit tag of the value, don't include it in the presentation. + var tag = node.Tag + var stag = shortTag(tag) + var forceQuoting bool + if tag != "" && node.Style&TaggedStyle == 0 { + if node.Kind == ScalarNode { + if stag == strTag && node.Style&(SingleQuotedStyle|DoubleQuotedStyle|LiteralStyle|FoldedStyle) != 0 { + tag = "" + } else { + rtag, _ := resolve("", node.Value) + if rtag == stag { + tag = "" + } else if stag == strTag { + tag = "" + forceQuoting = true + } + } + } else { + var rtag string + switch node.Kind { + case MappingNode: + rtag = mapTag + case SequenceNode: + rtag = seqTag + } + if rtag == stag { + tag = "" + } + } + } + + switch node.Kind { + case DocumentNode: + yaml_document_start_event_initialize(&e.event, nil, nil, true) + e.event.head_comment = []byte(node.HeadComment) + e.emit() + for _, node := range node.Content { + e.node(node, "") + } + yaml_document_end_event_initialize(&e.event, true) + e.event.foot_comment = []byte(node.FootComment) + e.emit() + + case SequenceNode: + style := yaml_BLOCK_SEQUENCE_STYLE + if node.Style&FlowStyle != 0 { + style = yaml_FLOW_SEQUENCE_STYLE + } + e.must(yaml_sequence_start_event_initialize(&e.event, []byte(node.Anchor), []byte(longTag(tag)), tag == "", style)) + e.event.head_comment = []byte(node.HeadComment) + e.emit() + for _, node := range node.Content { + e.node(node, "") + } + e.must(yaml_sequence_end_event_initialize(&e.event)) + e.event.line_comment = []byte(node.LineComment) + e.event.foot_comment = []byte(node.FootComment) + e.emit() + + case MappingNode: + style := yaml_BLOCK_MAPPING_STYLE + if node.Style&FlowStyle != 0 { + style = yaml_FLOW_MAPPING_STYLE + } + yaml_mapping_start_event_initialize(&e.event, []byte(node.Anchor), []byte(longTag(tag)), tag == "", style) + e.event.tail_comment = []byte(tail) + e.event.head_comment = []byte(node.HeadComment) + e.emit() + + // The tail logic below moves the foot comment of prior keys to the following key, + // since the value for each key may be a nested structure and the foot needs to be + // processed only the entirety of the value is streamed. The last tail is processed + // with the mapping end event. + var tail string + for i := 0; i+1 < len(node.Content); i += 2 { + k := node.Content[i] + foot := k.FootComment + if foot != "" { + kopy := *k + kopy.FootComment = "" + k = &kopy + } + e.node(k, tail) + tail = foot + + v := node.Content[i+1] + e.node(v, "") + } + + yaml_mapping_end_event_initialize(&e.event) + e.event.tail_comment = []byte(tail) + e.event.line_comment = []byte(node.LineComment) + e.event.foot_comment = []byte(node.FootComment) + e.emit() + + case AliasNode: + yaml_alias_event_initialize(&e.event, []byte(node.Value)) + e.event.head_comment = []byte(node.HeadComment) + e.event.line_comment = []byte(node.LineComment) + e.event.foot_comment = []byte(node.FootComment) + e.emit() + + case ScalarNode: + value := node.Value + if !utf8.ValidString(value) { + if stag == binaryTag { + failf("explicitly tagged !!binary data must be base64-encoded") + } + if stag != "" { + failf("cannot marshal invalid UTF-8 data as %s", stag) + } + // It can't be encoded directly as YAML so use a binary tag + // and encode it as base64. + tag = binaryTag + value = encodeBase64(value) + } + + style := yaml_PLAIN_SCALAR_STYLE + switch { + case node.Style&DoubleQuotedStyle != 0: + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + case node.Style&SingleQuotedStyle != 0: + style = yaml_SINGLE_QUOTED_SCALAR_STYLE + case node.Style&LiteralStyle != 0: + style = yaml_LITERAL_SCALAR_STYLE + case node.Style&FoldedStyle != 0: + style = yaml_FOLDED_SCALAR_STYLE + case strings.Contains(value, "\n"): + style = yaml_LITERAL_SCALAR_STYLE + case forceQuoting: + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + + e.emitScalar(value, node.Anchor, tag, style, []byte(node.HeadComment), []byte(node.LineComment), []byte(node.FootComment), []byte(tail)) + default: + failf("cannot encode node with unknown kind %d", node.Kind) + } +} diff --git a/vendor/go.yaml.in/yaml/v3/parserc.go b/vendor/go.yaml.in/yaml/v3/parserc.go new file mode 100644 index 000000000..25fe82363 --- /dev/null +++ b/vendor/go.yaml.in/yaml/v3/parserc.go @@ -0,0 +1,1274 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// Copyright (c) 2006-2010 Kirill Simonov +// +// 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. + +package yaml + +import ( + "bytes" +) + +// The parser implements the following grammar: +// +// stream ::= STREAM-START implicit_document? explicit_document* STREAM-END +// implicit_document ::= block_node DOCUMENT-END* +// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* +// block_node_or_indentless_sequence ::= +// ALIAS +// | properties (block_content | indentless_block_sequence)? +// | block_content +// | indentless_block_sequence +// block_node ::= ALIAS +// | properties block_content? +// | block_content +// flow_node ::= ALIAS +// | properties flow_content? +// | flow_content +// properties ::= TAG ANCHOR? | ANCHOR TAG? +// block_content ::= block_collection | flow_collection | SCALAR +// flow_content ::= flow_collection | SCALAR +// block_collection ::= block_sequence | block_mapping +// flow_collection ::= flow_sequence | flow_mapping +// block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END +// indentless_sequence ::= (BLOCK-ENTRY block_node?)+ +// block_mapping ::= BLOCK-MAPPING_START +// ((KEY block_node_or_indentless_sequence?)? +// (VALUE block_node_or_indentless_sequence?)?)* +// BLOCK-END +// flow_sequence ::= FLOW-SEQUENCE-START +// (flow_sequence_entry FLOW-ENTRY)* +// flow_sequence_entry? +// FLOW-SEQUENCE-END +// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// flow_mapping ::= FLOW-MAPPING-START +// (flow_mapping_entry FLOW-ENTRY)* +// flow_mapping_entry? +// FLOW-MAPPING-END +// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? + +// Peek the next token in the token queue. +func peek_token(parser *yaml_parser_t) *yaml_token_t { + if parser.token_available || yaml_parser_fetch_more_tokens(parser) { + token := &parser.tokens[parser.tokens_head] + yaml_parser_unfold_comments(parser, token) + return token + } + return nil +} + +// yaml_parser_unfold_comments walks through the comments queue and joins all +// comments behind the position of the provided token into the respective +// top-level comment slices in the parser. +func yaml_parser_unfold_comments(parser *yaml_parser_t, token *yaml_token_t) { + for parser.comments_head < len(parser.comments) && token.start_mark.index >= parser.comments[parser.comments_head].token_mark.index { + comment := &parser.comments[parser.comments_head] + if len(comment.head) > 0 { + if token.typ == yaml_BLOCK_END_TOKEN { + // No heads on ends, so keep comment.head for a follow up token. + break + } + if len(parser.head_comment) > 0 { + parser.head_comment = append(parser.head_comment, '\n') + } + parser.head_comment = append(parser.head_comment, comment.head...) + } + if len(comment.foot) > 0 { + if len(parser.foot_comment) > 0 { + parser.foot_comment = append(parser.foot_comment, '\n') + } + parser.foot_comment = append(parser.foot_comment, comment.foot...) + } + if len(comment.line) > 0 { + if len(parser.line_comment) > 0 { + parser.line_comment = append(parser.line_comment, '\n') + } + parser.line_comment = append(parser.line_comment, comment.line...) + } + *comment = yaml_comment_t{} + parser.comments_head++ + } +} + +// Remove the next token from the queue (must be called after peek_token). +func skip_token(parser *yaml_parser_t) { + parser.token_available = false + parser.tokens_parsed++ + parser.stream_end_produced = parser.tokens[parser.tokens_head].typ == yaml_STREAM_END_TOKEN + parser.tokens_head++ +} + +// Get the next event. +func yaml_parser_parse(parser *yaml_parser_t, event *yaml_event_t) bool { + // Erase the event object. + *event = yaml_event_t{} + + // No events after the end of the stream or error. + if parser.stream_end_produced || parser.error != yaml_NO_ERROR || parser.state == yaml_PARSE_END_STATE { + return true + } + + // Generate the next event. + return yaml_parser_state_machine(parser, event) +} + +// Set parser error. +func yaml_parser_set_parser_error(parser *yaml_parser_t, problem string, problem_mark yaml_mark_t) bool { + parser.error = yaml_PARSER_ERROR + parser.problem = problem + parser.problem_mark = problem_mark + return false +} + +func yaml_parser_set_parser_error_context(parser *yaml_parser_t, context string, context_mark yaml_mark_t, problem string, problem_mark yaml_mark_t) bool { + parser.error = yaml_PARSER_ERROR + parser.context = context + parser.context_mark = context_mark + parser.problem = problem + parser.problem_mark = problem_mark + return false +} + +// State dispatcher. +func yaml_parser_state_machine(parser *yaml_parser_t, event *yaml_event_t) bool { + //trace("yaml_parser_state_machine", "state:", parser.state.String()) + + switch parser.state { + case yaml_PARSE_STREAM_START_STATE: + return yaml_parser_parse_stream_start(parser, event) + + case yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE: + return yaml_parser_parse_document_start(parser, event, true) + + case yaml_PARSE_DOCUMENT_START_STATE: + return yaml_parser_parse_document_start(parser, event, false) + + case yaml_PARSE_DOCUMENT_CONTENT_STATE: + return yaml_parser_parse_document_content(parser, event) + + case yaml_PARSE_DOCUMENT_END_STATE: + return yaml_parser_parse_document_end(parser, event) + + case yaml_PARSE_BLOCK_NODE_STATE: + return yaml_parser_parse_node(parser, event, true, false) + + case yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE: + return yaml_parser_parse_node(parser, event, true, true) + + case yaml_PARSE_FLOW_NODE_STATE: + return yaml_parser_parse_node(parser, event, false, false) + + case yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE: + return yaml_parser_parse_block_sequence_entry(parser, event, true) + + case yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE: + return yaml_parser_parse_block_sequence_entry(parser, event, false) + + case yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE: + return yaml_parser_parse_indentless_sequence_entry(parser, event) + + case yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE: + return yaml_parser_parse_block_mapping_key(parser, event, true) + + case yaml_PARSE_BLOCK_MAPPING_KEY_STATE: + return yaml_parser_parse_block_mapping_key(parser, event, false) + + case yaml_PARSE_BLOCK_MAPPING_VALUE_STATE: + return yaml_parser_parse_block_mapping_value(parser, event) + + case yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE: + return yaml_parser_parse_flow_sequence_entry(parser, event, true) + + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE: + return yaml_parser_parse_flow_sequence_entry(parser, event, false) + + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE: + return yaml_parser_parse_flow_sequence_entry_mapping_key(parser, event) + + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE: + return yaml_parser_parse_flow_sequence_entry_mapping_value(parser, event) + + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE: + return yaml_parser_parse_flow_sequence_entry_mapping_end(parser, event) + + case yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE: + return yaml_parser_parse_flow_mapping_key(parser, event, true) + + case yaml_PARSE_FLOW_MAPPING_KEY_STATE: + return yaml_parser_parse_flow_mapping_key(parser, event, false) + + case yaml_PARSE_FLOW_MAPPING_VALUE_STATE: + return yaml_parser_parse_flow_mapping_value(parser, event, false) + + case yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE: + return yaml_parser_parse_flow_mapping_value(parser, event, true) + + default: + panic("invalid parser state") + } +} + +// Parse the production: +// stream ::= STREAM-START implicit_document? explicit_document* STREAM-END +// +// ************ +func yaml_parser_parse_stream_start(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_STREAM_START_TOKEN { + return yaml_parser_set_parser_error(parser, "did not find expected ", token.start_mark) + } + parser.state = yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE + *event = yaml_event_t{ + typ: yaml_STREAM_START_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + encoding: token.encoding, + } + skip_token(parser) + return true +} + +// Parse the productions: +// implicit_document ::= block_node DOCUMENT-END* +// +// * +// +// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* +// +// ************************* +func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml_event_t, implicit bool) bool { + + token := peek_token(parser) + if token == nil { + return false + } + + // Parse extra document end indicators. + if !implicit { + for token.typ == yaml_DOCUMENT_END_TOKEN { + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + } + } + + if implicit && token.typ != yaml_VERSION_DIRECTIVE_TOKEN && + token.typ != yaml_TAG_DIRECTIVE_TOKEN && + token.typ != yaml_DOCUMENT_START_TOKEN && + token.typ != yaml_STREAM_END_TOKEN { + // Parse an implicit document. + if !yaml_parser_process_directives(parser, nil, nil) { + return false + } + parser.states = append(parser.states, yaml_PARSE_DOCUMENT_END_STATE) + parser.state = yaml_PARSE_BLOCK_NODE_STATE + + var head_comment []byte + if len(parser.head_comment) > 0 { + // [Go] Scan the header comment backwards, and if an empty line is found, break + // the header so the part before the last empty line goes into the + // document header, while the bottom of it goes into a follow up event. + for i := len(parser.head_comment) - 1; i > 0; i-- { + if parser.head_comment[i] == '\n' { + if i == len(parser.head_comment)-1 { + head_comment = parser.head_comment[:i] + parser.head_comment = parser.head_comment[i+1:] + break + } else if parser.head_comment[i-1] == '\n' { + head_comment = parser.head_comment[:i-1] + parser.head_comment = parser.head_comment[i+1:] + break + } + } + } + } + + *event = yaml_event_t{ + typ: yaml_DOCUMENT_START_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + + head_comment: head_comment, + } + + } else if token.typ != yaml_STREAM_END_TOKEN { + // Parse an explicit document. + var version_directive *yaml_version_directive_t + var tag_directives []yaml_tag_directive_t + start_mark := token.start_mark + if !yaml_parser_process_directives(parser, &version_directive, &tag_directives) { + return false + } + token = peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_DOCUMENT_START_TOKEN { + yaml_parser_set_parser_error(parser, + "did not find expected ", token.start_mark) + return false + } + parser.states = append(parser.states, yaml_PARSE_DOCUMENT_END_STATE) + parser.state = yaml_PARSE_DOCUMENT_CONTENT_STATE + end_mark := token.end_mark + + *event = yaml_event_t{ + typ: yaml_DOCUMENT_START_EVENT, + start_mark: start_mark, + end_mark: end_mark, + version_directive: version_directive, + tag_directives: tag_directives, + implicit: false, + } + skip_token(parser) + + } else { + // Parse the stream end. + parser.state = yaml_PARSE_END_STATE + *event = yaml_event_t{ + typ: yaml_STREAM_END_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + } + skip_token(parser) + } + + return true +} + +// Parse the productions: +// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* +// +// *********** +func yaml_parser_parse_document_content(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + + if token.typ == yaml_VERSION_DIRECTIVE_TOKEN || + token.typ == yaml_TAG_DIRECTIVE_TOKEN || + token.typ == yaml_DOCUMENT_START_TOKEN || + token.typ == yaml_DOCUMENT_END_TOKEN || + token.typ == yaml_STREAM_END_TOKEN { + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + return yaml_parser_process_empty_scalar(parser, event, + token.start_mark) + } + return yaml_parser_parse_node(parser, event, true, false) +} + +// Parse the productions: +// implicit_document ::= block_node DOCUMENT-END* +// +// ************* +// +// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* +func yaml_parser_parse_document_end(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + + start_mark := token.start_mark + end_mark := token.start_mark + + implicit := true + if token.typ == yaml_DOCUMENT_END_TOKEN { + end_mark = token.end_mark + skip_token(parser) + implicit = false + } + + parser.tag_directives = parser.tag_directives[:0] + + parser.state = yaml_PARSE_DOCUMENT_START_STATE + *event = yaml_event_t{ + typ: yaml_DOCUMENT_END_EVENT, + start_mark: start_mark, + end_mark: end_mark, + implicit: implicit, + } + yaml_parser_set_event_comments(parser, event) + if len(event.head_comment) > 0 && len(event.foot_comment) == 0 { + event.foot_comment = event.head_comment + event.head_comment = nil + } + return true +} + +func yaml_parser_set_event_comments(parser *yaml_parser_t, event *yaml_event_t) { + event.head_comment = parser.head_comment + event.line_comment = parser.line_comment + event.foot_comment = parser.foot_comment + parser.head_comment = nil + parser.line_comment = nil + parser.foot_comment = nil + parser.tail_comment = nil + parser.stem_comment = nil +} + +// Parse the productions: +// block_node_or_indentless_sequence ::= +// +// ALIAS +// ***** +// | properties (block_content | indentless_block_sequence)? +// ********** * +// | block_content | indentless_block_sequence +// * +// +// block_node ::= ALIAS +// +// ***** +// | properties block_content? +// ********** * +// | block_content +// * +// +// flow_node ::= ALIAS +// +// ***** +// | properties flow_content? +// ********** * +// | flow_content +// * +// +// properties ::= TAG ANCHOR? | ANCHOR TAG? +// +// ************************* +// +// block_content ::= block_collection | flow_collection | SCALAR +// +// ****** +// +// flow_content ::= flow_collection | SCALAR +// +// ****** +func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, indentless_sequence bool) bool { + //defer trace("yaml_parser_parse_node", "block:", block, "indentless_sequence:", indentless_sequence)() + + token := peek_token(parser) + if token == nil { + return false + } + + if token.typ == yaml_ALIAS_TOKEN { + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + *event = yaml_event_t{ + typ: yaml_ALIAS_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + anchor: token.value, + } + yaml_parser_set_event_comments(parser, event) + skip_token(parser) + return true + } + + start_mark := token.start_mark + end_mark := token.start_mark + + var tag_token bool + var tag_handle, tag_suffix, anchor []byte + var tag_mark yaml_mark_t + if token.typ == yaml_ANCHOR_TOKEN { + anchor = token.value + start_mark = token.start_mark + end_mark = token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ == yaml_TAG_TOKEN { + tag_token = true + tag_handle = token.value + tag_suffix = token.suffix + tag_mark = token.start_mark + end_mark = token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + } + } else if token.typ == yaml_TAG_TOKEN { + tag_token = true + tag_handle = token.value + tag_suffix = token.suffix + start_mark = token.start_mark + tag_mark = token.start_mark + end_mark = token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ == yaml_ANCHOR_TOKEN { + anchor = token.value + end_mark = token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + } + } + + var tag []byte + if tag_token { + if len(tag_handle) == 0 { + tag = tag_suffix + tag_suffix = nil + } else { + for i := range parser.tag_directives { + if bytes.Equal(parser.tag_directives[i].handle, tag_handle) { + tag = append([]byte(nil), parser.tag_directives[i].prefix...) + tag = append(tag, tag_suffix...) + break + } + } + if len(tag) == 0 { + yaml_parser_set_parser_error_context(parser, + "while parsing a node", start_mark, + "found undefined tag handle", tag_mark) + return false + } + } + } + + implicit := len(tag) == 0 + if indentless_sequence && token.typ == yaml_BLOCK_ENTRY_TOKEN { + end_mark = token.end_mark + parser.state = yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE + *event = yaml_event_t{ + typ: yaml_SEQUENCE_START_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(yaml_BLOCK_SEQUENCE_STYLE), + } + return true + } + if token.typ == yaml_SCALAR_TOKEN { + var plain_implicit, quoted_implicit bool + end_mark = token.end_mark + if (len(tag) == 0 && token.style == yaml_PLAIN_SCALAR_STYLE) || (len(tag) == 1 && tag[0] == '!') { + plain_implicit = true + } else if len(tag) == 0 { + quoted_implicit = true + } + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + + *event = yaml_event_t{ + typ: yaml_SCALAR_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + value: token.value, + implicit: plain_implicit, + quoted_implicit: quoted_implicit, + style: yaml_style_t(token.style), + } + yaml_parser_set_event_comments(parser, event) + skip_token(parser) + return true + } + if token.typ == yaml_FLOW_SEQUENCE_START_TOKEN { + // [Go] Some of the events below can be merged as they differ only on style. + end_mark = token.end_mark + parser.state = yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE + *event = yaml_event_t{ + typ: yaml_SEQUENCE_START_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(yaml_FLOW_SEQUENCE_STYLE), + } + yaml_parser_set_event_comments(parser, event) + return true + } + if token.typ == yaml_FLOW_MAPPING_START_TOKEN { + end_mark = token.end_mark + parser.state = yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE + *event = yaml_event_t{ + typ: yaml_MAPPING_START_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(yaml_FLOW_MAPPING_STYLE), + } + yaml_parser_set_event_comments(parser, event) + return true + } + if block && token.typ == yaml_BLOCK_SEQUENCE_START_TOKEN { + end_mark = token.end_mark + parser.state = yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE + *event = yaml_event_t{ + typ: yaml_SEQUENCE_START_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(yaml_BLOCK_SEQUENCE_STYLE), + } + if parser.stem_comment != nil { + event.head_comment = parser.stem_comment + parser.stem_comment = nil + } + return true + } + if block && token.typ == yaml_BLOCK_MAPPING_START_TOKEN { + end_mark = token.end_mark + parser.state = yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE + *event = yaml_event_t{ + typ: yaml_MAPPING_START_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(yaml_BLOCK_MAPPING_STYLE), + } + if parser.stem_comment != nil { + event.head_comment = parser.stem_comment + parser.stem_comment = nil + } + return true + } + if len(anchor) > 0 || len(tag) > 0 { + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + + *event = yaml_event_t{ + typ: yaml_SCALAR_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + implicit: implicit, + quoted_implicit: false, + style: yaml_style_t(yaml_PLAIN_SCALAR_STYLE), + } + return true + } + + context := "while parsing a flow node" + if block { + context = "while parsing a block node" + } + yaml_parser_set_parser_error_context(parser, context, start_mark, + "did not find expected node content", token.start_mark) + return false +} + +// Parse the productions: +// block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END +// +// ******************** *********** * ********* +func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { + if first { + token := peek_token(parser) + if token == nil { + return false + } + parser.marks = append(parser.marks, token.start_mark) + skip_token(parser) + } + + token := peek_token(parser) + if token == nil { + return false + } + + if token.typ == yaml_BLOCK_ENTRY_TOKEN { + mark := token.end_mark + prior_head_len := len(parser.head_comment) + skip_token(parser) + yaml_parser_split_stem_comment(parser, prior_head_len) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_BLOCK_ENTRY_TOKEN && token.typ != yaml_BLOCK_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE) + return yaml_parser_parse_node(parser, event, true, false) + } else { + parser.state = yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE + return yaml_parser_process_empty_scalar(parser, event, mark) + } + } + if token.typ == yaml_BLOCK_END_TOKEN { + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + + *event = yaml_event_t{ + typ: yaml_SEQUENCE_END_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + } + + skip_token(parser) + return true + } + + context_mark := parser.marks[len(parser.marks)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + return yaml_parser_set_parser_error_context(parser, + "while parsing a block collection", context_mark, + "did not find expected '-' indicator", token.start_mark) +} + +// Parse the productions: +// indentless_sequence ::= (BLOCK-ENTRY block_node?)+ +// +// *********** * +func yaml_parser_parse_indentless_sequence_entry(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + + if token.typ == yaml_BLOCK_ENTRY_TOKEN { + mark := token.end_mark + prior_head_len := len(parser.head_comment) + skip_token(parser) + yaml_parser_split_stem_comment(parser, prior_head_len) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_BLOCK_ENTRY_TOKEN && + token.typ != yaml_KEY_TOKEN && + token.typ != yaml_VALUE_TOKEN && + token.typ != yaml_BLOCK_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE) + return yaml_parser_parse_node(parser, event, true, false) + } + parser.state = yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE + return yaml_parser_process_empty_scalar(parser, event, mark) + } + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + + *event = yaml_event_t{ + typ: yaml_SEQUENCE_END_EVENT, + start_mark: token.start_mark, + end_mark: token.start_mark, // [Go] Shouldn't this be token.end_mark? + } + return true +} + +// Split stem comment from head comment. +// +// When a sequence or map is found under a sequence entry, the former head comment +// is assigned to the underlying sequence or map as a whole, not the individual +// sequence or map entry as would be expected otherwise. To handle this case the +// previous head comment is moved aside as the stem comment. +func yaml_parser_split_stem_comment(parser *yaml_parser_t, stem_len int) { + if stem_len == 0 { + return + } + + token := peek_token(parser) + if token == nil || token.typ != yaml_BLOCK_SEQUENCE_START_TOKEN && token.typ != yaml_BLOCK_MAPPING_START_TOKEN { + return + } + + parser.stem_comment = parser.head_comment[:stem_len] + if len(parser.head_comment) == stem_len { + parser.head_comment = nil + } else { + // Copy suffix to prevent very strange bugs if someone ever appends + // further bytes to the prefix in the stem_comment slice above. + parser.head_comment = append([]byte(nil), parser.head_comment[stem_len+1:]...) + } +} + +// Parse the productions: +// block_mapping ::= BLOCK-MAPPING_START +// +// ******************* +// ((KEY block_node_or_indentless_sequence?)? +// *** * +// (VALUE block_node_or_indentless_sequence?)?)* +// +// BLOCK-END +// ********* +func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { + if first { + token := peek_token(parser) + if token == nil { + return false + } + parser.marks = append(parser.marks, token.start_mark) + skip_token(parser) + } + + token := peek_token(parser) + if token == nil { + return false + } + + // [Go] A tail comment was left from the prior mapping value processed. Emit an event + // as it needs to be processed with that value and not the following key. + if len(parser.tail_comment) > 0 { + *event = yaml_event_t{ + typ: yaml_TAIL_COMMENT_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + foot_comment: parser.tail_comment, + } + parser.tail_comment = nil + return true + } + + if token.typ == yaml_KEY_TOKEN { + mark := token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_KEY_TOKEN && + token.typ != yaml_VALUE_TOKEN && + token.typ != yaml_BLOCK_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_BLOCK_MAPPING_VALUE_STATE) + return yaml_parser_parse_node(parser, event, true, true) + } else { + parser.state = yaml_PARSE_BLOCK_MAPPING_VALUE_STATE + return yaml_parser_process_empty_scalar(parser, event, mark) + } + } else if token.typ == yaml_BLOCK_END_TOKEN { + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + *event = yaml_event_t{ + typ: yaml_MAPPING_END_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + } + yaml_parser_set_event_comments(parser, event) + skip_token(parser) + return true + } + + context_mark := parser.marks[len(parser.marks)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + return yaml_parser_set_parser_error_context(parser, + "while parsing a block mapping", context_mark, + "did not find expected key", token.start_mark) +} + +// Parse the productions: +// block_mapping ::= BLOCK-MAPPING_START +// +// ((KEY block_node_or_indentless_sequence?)? +// +// (VALUE block_node_or_indentless_sequence?)?)* +// ***** * +// BLOCK-END +func yaml_parser_parse_block_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + if token.typ == yaml_VALUE_TOKEN { + mark := token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_KEY_TOKEN && + token.typ != yaml_VALUE_TOKEN && + token.typ != yaml_BLOCK_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_BLOCK_MAPPING_KEY_STATE) + return yaml_parser_parse_node(parser, event, true, true) + } + parser.state = yaml_PARSE_BLOCK_MAPPING_KEY_STATE + return yaml_parser_process_empty_scalar(parser, event, mark) + } + parser.state = yaml_PARSE_BLOCK_MAPPING_KEY_STATE + return yaml_parser_process_empty_scalar(parser, event, token.start_mark) +} + +// Parse the productions: +// flow_sequence ::= FLOW-SEQUENCE-START +// +// ******************* +// (flow_sequence_entry FLOW-ENTRY)* +// * ********** +// flow_sequence_entry? +// * +// FLOW-SEQUENCE-END +// ***************** +// +// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// +// * +func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { + if first { + token := peek_token(parser) + if token == nil { + return false + } + parser.marks = append(parser.marks, token.start_mark) + skip_token(parser) + } + token := peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { + if !first { + if token.typ == yaml_FLOW_ENTRY_TOKEN { + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + } else { + context_mark := parser.marks[len(parser.marks)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + return yaml_parser_set_parser_error_context(parser, + "while parsing a flow sequence", context_mark, + "did not find expected ',' or ']'", token.start_mark) + } + } + + if token.typ == yaml_KEY_TOKEN { + parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE + *event = yaml_event_t{ + typ: yaml_MAPPING_START_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + implicit: true, + style: yaml_style_t(yaml_FLOW_MAPPING_STYLE), + } + skip_token(parser) + return true + } else if token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE) + return yaml_parser_parse_node(parser, event, false, false) + } + } + + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + + *event = yaml_event_t{ + typ: yaml_SEQUENCE_END_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + } + yaml_parser_set_event_comments(parser, event) + + skip_token(parser) + return true +} + +// Parse the productions: +// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// +// *** * +func yaml_parser_parse_flow_sequence_entry_mapping_key(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_VALUE_TOKEN && + token.typ != yaml_FLOW_ENTRY_TOKEN && + token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE) + return yaml_parser_parse_node(parser, event, false, false) + } + mark := token.end_mark + skip_token(parser) + parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE + return yaml_parser_process_empty_scalar(parser, event, mark) +} + +// Parse the productions: +// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// +// ***** * +func yaml_parser_parse_flow_sequence_entry_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + if token.typ == yaml_VALUE_TOKEN { + skip_token(parser) + token := peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_FLOW_ENTRY_TOKEN && token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE) + return yaml_parser_parse_node(parser, event, false, false) + } + } + parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE + return yaml_parser_process_empty_scalar(parser, event, token.start_mark) +} + +// Parse the productions: +// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// +// * +func yaml_parser_parse_flow_sequence_entry_mapping_end(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE + *event = yaml_event_t{ + typ: yaml_MAPPING_END_EVENT, + start_mark: token.start_mark, + end_mark: token.start_mark, // [Go] Shouldn't this be end_mark? + } + return true +} + +// Parse the productions: +// flow_mapping ::= FLOW-MAPPING-START +// +// ****************** +// (flow_mapping_entry FLOW-ENTRY)* +// * ********** +// flow_mapping_entry? +// ****************** +// FLOW-MAPPING-END +// **************** +// +// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// - *** * +func yaml_parser_parse_flow_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { + if first { + token := peek_token(parser) + parser.marks = append(parser.marks, token.start_mark) + skip_token(parser) + } + + token := peek_token(parser) + if token == nil { + return false + } + + if token.typ != yaml_FLOW_MAPPING_END_TOKEN { + if !first { + if token.typ == yaml_FLOW_ENTRY_TOKEN { + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + } else { + context_mark := parser.marks[len(parser.marks)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + return yaml_parser_set_parser_error_context(parser, + "while parsing a flow mapping", context_mark, + "did not find expected ',' or '}'", token.start_mark) + } + } + + if token.typ == yaml_KEY_TOKEN { + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_VALUE_TOKEN && + token.typ != yaml_FLOW_ENTRY_TOKEN && + token.typ != yaml_FLOW_MAPPING_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_VALUE_STATE) + return yaml_parser_parse_node(parser, event, false, false) + } else { + parser.state = yaml_PARSE_FLOW_MAPPING_VALUE_STATE + return yaml_parser_process_empty_scalar(parser, event, token.start_mark) + } + } else if token.typ != yaml_FLOW_MAPPING_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE) + return yaml_parser_parse_node(parser, event, false, false) + } + } + + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + *event = yaml_event_t{ + typ: yaml_MAPPING_END_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + } + yaml_parser_set_event_comments(parser, event) + skip_token(parser) + return true +} + +// Parse the productions: +// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// - ***** * +func yaml_parser_parse_flow_mapping_value(parser *yaml_parser_t, event *yaml_event_t, empty bool) bool { + token := peek_token(parser) + if token == nil { + return false + } + if empty { + parser.state = yaml_PARSE_FLOW_MAPPING_KEY_STATE + return yaml_parser_process_empty_scalar(parser, event, token.start_mark) + } + if token.typ == yaml_VALUE_TOKEN { + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_FLOW_ENTRY_TOKEN && token.typ != yaml_FLOW_MAPPING_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_KEY_STATE) + return yaml_parser_parse_node(parser, event, false, false) + } + } + parser.state = yaml_PARSE_FLOW_MAPPING_KEY_STATE + return yaml_parser_process_empty_scalar(parser, event, token.start_mark) +} + +// Generate an empty scalar event. +func yaml_parser_process_empty_scalar(parser *yaml_parser_t, event *yaml_event_t, mark yaml_mark_t) bool { + *event = yaml_event_t{ + typ: yaml_SCALAR_EVENT, + start_mark: mark, + end_mark: mark, + value: nil, // Empty + implicit: true, + style: yaml_style_t(yaml_PLAIN_SCALAR_STYLE), + } + return true +} + +var default_tag_directives = []yaml_tag_directive_t{ + {[]byte("!"), []byte("!")}, + {[]byte("!!"), []byte("tag:yaml.org,2002:")}, +} + +// Parse directives. +func yaml_parser_process_directives(parser *yaml_parser_t, + version_directive_ref **yaml_version_directive_t, + tag_directives_ref *[]yaml_tag_directive_t) bool { + + var version_directive *yaml_version_directive_t + var tag_directives []yaml_tag_directive_t + + token := peek_token(parser) + if token == nil { + return false + } + + for token.typ == yaml_VERSION_DIRECTIVE_TOKEN || token.typ == yaml_TAG_DIRECTIVE_TOKEN { + if token.typ == yaml_VERSION_DIRECTIVE_TOKEN { + if version_directive != nil { + yaml_parser_set_parser_error(parser, + "found duplicate %YAML directive", token.start_mark) + return false + } + if token.major != 1 || token.minor != 1 { + yaml_parser_set_parser_error(parser, + "found incompatible YAML document", token.start_mark) + return false + } + version_directive = &yaml_version_directive_t{ + major: token.major, + minor: token.minor, + } + } else if token.typ == yaml_TAG_DIRECTIVE_TOKEN { + value := yaml_tag_directive_t{ + handle: token.value, + prefix: token.prefix, + } + if !yaml_parser_append_tag_directive(parser, value, false, token.start_mark) { + return false + } + tag_directives = append(tag_directives, value) + } + + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + } + + for i := range default_tag_directives { + if !yaml_parser_append_tag_directive(parser, default_tag_directives[i], true, token.start_mark) { + return false + } + } + + if version_directive_ref != nil { + *version_directive_ref = version_directive + } + if tag_directives_ref != nil { + *tag_directives_ref = tag_directives + } + return true +} + +// Append a tag directive to the directives stack. +func yaml_parser_append_tag_directive(parser *yaml_parser_t, value yaml_tag_directive_t, allow_duplicates bool, mark yaml_mark_t) bool { + for i := range parser.tag_directives { + if bytes.Equal(value.handle, parser.tag_directives[i].handle) { + if allow_duplicates { + return true + } + return yaml_parser_set_parser_error(parser, "found duplicate %TAG directive", mark) + } + } + + // [Go] I suspect the copy is unnecessary. This was likely done + // because there was no way to track ownership of the data. + value_copy := yaml_tag_directive_t{ + handle: make([]byte, len(value.handle)), + prefix: make([]byte, len(value.prefix)), + } + copy(value_copy.handle, value.handle) + copy(value_copy.prefix, value.prefix) + parser.tag_directives = append(parser.tag_directives, value_copy) + return true +} diff --git a/vendor/go.yaml.in/yaml/v3/readerc.go b/vendor/go.yaml.in/yaml/v3/readerc.go new file mode 100644 index 000000000..56af24536 --- /dev/null +++ b/vendor/go.yaml.in/yaml/v3/readerc.go @@ -0,0 +1,434 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// Copyright (c) 2006-2010 Kirill Simonov +// +// 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. + +package yaml + +import ( + "io" +) + +// Set the reader error and return 0. +func yaml_parser_set_reader_error(parser *yaml_parser_t, problem string, offset int, value int) bool { + parser.error = yaml_READER_ERROR + parser.problem = problem + parser.problem_offset = offset + parser.problem_value = value + return false +} + +// Byte order marks. +const ( + bom_UTF8 = "\xef\xbb\xbf" + bom_UTF16LE = "\xff\xfe" + bom_UTF16BE = "\xfe\xff" +) + +// Determine the input stream encoding by checking the BOM symbol. If no BOM is +// found, the UTF-8 encoding is assumed. Return 1 on success, 0 on failure. +func yaml_parser_determine_encoding(parser *yaml_parser_t) bool { + // Ensure that we had enough bytes in the raw buffer. + for !parser.eof && len(parser.raw_buffer)-parser.raw_buffer_pos < 3 { + if !yaml_parser_update_raw_buffer(parser) { + return false + } + } + + // Determine the encoding. + buf := parser.raw_buffer + pos := parser.raw_buffer_pos + avail := len(buf) - pos + if avail >= 2 && buf[pos] == bom_UTF16LE[0] && buf[pos+1] == bom_UTF16LE[1] { + parser.encoding = yaml_UTF16LE_ENCODING + parser.raw_buffer_pos += 2 + parser.offset += 2 + } else if avail >= 2 && buf[pos] == bom_UTF16BE[0] && buf[pos+1] == bom_UTF16BE[1] { + parser.encoding = yaml_UTF16BE_ENCODING + parser.raw_buffer_pos += 2 + parser.offset += 2 + } else if avail >= 3 && buf[pos] == bom_UTF8[0] && buf[pos+1] == bom_UTF8[1] && buf[pos+2] == bom_UTF8[2] { + parser.encoding = yaml_UTF8_ENCODING + parser.raw_buffer_pos += 3 + parser.offset += 3 + } else { + parser.encoding = yaml_UTF8_ENCODING + } + return true +} + +// Update the raw buffer. +func yaml_parser_update_raw_buffer(parser *yaml_parser_t) bool { + size_read := 0 + + // Return if the raw buffer is full. + if parser.raw_buffer_pos == 0 && len(parser.raw_buffer) == cap(parser.raw_buffer) { + return true + } + + // Return on EOF. + if parser.eof { + return true + } + + // Move the remaining bytes in the raw buffer to the beginning. + if parser.raw_buffer_pos > 0 && parser.raw_buffer_pos < len(parser.raw_buffer) { + copy(parser.raw_buffer, parser.raw_buffer[parser.raw_buffer_pos:]) + } + parser.raw_buffer = parser.raw_buffer[:len(parser.raw_buffer)-parser.raw_buffer_pos] + parser.raw_buffer_pos = 0 + + // Call the read handler to fill the buffer. + size_read, err := parser.read_handler(parser, parser.raw_buffer[len(parser.raw_buffer):cap(parser.raw_buffer)]) + parser.raw_buffer = parser.raw_buffer[:len(parser.raw_buffer)+size_read] + if err == io.EOF { + parser.eof = true + } else if err != nil { + return yaml_parser_set_reader_error(parser, "input error: "+err.Error(), parser.offset, -1) + } + return true +} + +// Ensure that the buffer contains at least `length` characters. +// Return true on success, false on failure. +// +// The length is supposed to be significantly less that the buffer size. +func yaml_parser_update_buffer(parser *yaml_parser_t, length int) bool { + if parser.read_handler == nil { + panic("read handler must be set") + } + + // [Go] This function was changed to guarantee the requested length size at EOF. + // The fact we need to do this is pretty awful, but the description above implies + // for that to be the case, and there are tests + + // If the EOF flag is set and the raw buffer is empty, do nothing. + if parser.eof && parser.raw_buffer_pos == len(parser.raw_buffer) { + // [Go] ACTUALLY! Read the documentation of this function above. + // This is just broken. To return true, we need to have the + // given length in the buffer. Not doing that means every single + // check that calls this function to make sure the buffer has a + // given length is Go) panicking; or C) accessing invalid memory. + //return true + } + + // Return if the buffer contains enough characters. + if parser.unread >= length { + return true + } + + // Determine the input encoding if it is not known yet. + if parser.encoding == yaml_ANY_ENCODING { + if !yaml_parser_determine_encoding(parser) { + return false + } + } + + // Move the unread characters to the beginning of the buffer. + buffer_len := len(parser.buffer) + if parser.buffer_pos > 0 && parser.buffer_pos < buffer_len { + copy(parser.buffer, parser.buffer[parser.buffer_pos:]) + buffer_len -= parser.buffer_pos + parser.buffer_pos = 0 + } else if parser.buffer_pos == buffer_len { + buffer_len = 0 + parser.buffer_pos = 0 + } + + // Open the whole buffer for writing, and cut it before returning. + parser.buffer = parser.buffer[:cap(parser.buffer)] + + // Fill the buffer until it has enough characters. + first := true + for parser.unread < length { + + // Fill the raw buffer if necessary. + if !first || parser.raw_buffer_pos == len(parser.raw_buffer) { + if !yaml_parser_update_raw_buffer(parser) { + parser.buffer = parser.buffer[:buffer_len] + return false + } + } + first = false + + // Decode the raw buffer. + inner: + for parser.raw_buffer_pos != len(parser.raw_buffer) { + var value rune + var width int + + raw_unread := len(parser.raw_buffer) - parser.raw_buffer_pos + + // Decode the next character. + switch parser.encoding { + case yaml_UTF8_ENCODING: + // Decode a UTF-8 character. Check RFC 3629 + // (http://www.ietf.org/rfc/rfc3629.txt) for more details. + // + // The following table (taken from the RFC) is used for + // decoding. + // + // Char. number range | UTF-8 octet sequence + // (hexadecimal) | (binary) + // --------------------+------------------------------------ + // 0000 0000-0000 007F | 0xxxxxxx + // 0000 0080-0000 07FF | 110xxxxx 10xxxxxx + // 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx + // 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx + // + // Additionally, the characters in the range 0xD800-0xDFFF + // are prohibited as they are reserved for use with UTF-16 + // surrogate pairs. + + // Determine the length of the UTF-8 sequence. + octet := parser.raw_buffer[parser.raw_buffer_pos] + switch { + case octet&0x80 == 0x00: + width = 1 + case octet&0xE0 == 0xC0: + width = 2 + case octet&0xF0 == 0xE0: + width = 3 + case octet&0xF8 == 0xF0: + width = 4 + default: + // The leading octet is invalid. + return yaml_parser_set_reader_error(parser, + "invalid leading UTF-8 octet", + parser.offset, int(octet)) + } + + // Check if the raw buffer contains an incomplete character. + if width > raw_unread { + if parser.eof { + return yaml_parser_set_reader_error(parser, + "incomplete UTF-8 octet sequence", + parser.offset, -1) + } + break inner + } + + // Decode the leading octet. + switch { + case octet&0x80 == 0x00: + value = rune(octet & 0x7F) + case octet&0xE0 == 0xC0: + value = rune(octet & 0x1F) + case octet&0xF0 == 0xE0: + value = rune(octet & 0x0F) + case octet&0xF8 == 0xF0: + value = rune(octet & 0x07) + default: + value = 0 + } + + // Check and decode the trailing octets. + for k := 1; k < width; k++ { + octet = parser.raw_buffer[parser.raw_buffer_pos+k] + + // Check if the octet is valid. + if (octet & 0xC0) != 0x80 { + return yaml_parser_set_reader_error(parser, + "invalid trailing UTF-8 octet", + parser.offset+k, int(octet)) + } + + // Decode the octet. + value = (value << 6) + rune(octet&0x3F) + } + + // Check the length of the sequence against the value. + switch { + case width == 1: + case width == 2 && value >= 0x80: + case width == 3 && value >= 0x800: + case width == 4 && value >= 0x10000: + default: + return yaml_parser_set_reader_error(parser, + "invalid length of a UTF-8 sequence", + parser.offset, -1) + } + + // Check the range of the value. + if value >= 0xD800 && value <= 0xDFFF || value > 0x10FFFF { + return yaml_parser_set_reader_error(parser, + "invalid Unicode character", + parser.offset, int(value)) + } + + case yaml_UTF16LE_ENCODING, yaml_UTF16BE_ENCODING: + var low, high int + if parser.encoding == yaml_UTF16LE_ENCODING { + low, high = 0, 1 + } else { + low, high = 1, 0 + } + + // The UTF-16 encoding is not as simple as one might + // naively think. Check RFC 2781 + // (http://www.ietf.org/rfc/rfc2781.txt). + // + // Normally, two subsequent bytes describe a Unicode + // character. However a special technique (called a + // surrogate pair) is used for specifying character + // values larger than 0xFFFF. + // + // A surrogate pair consists of two pseudo-characters: + // high surrogate area (0xD800-0xDBFF) + // low surrogate area (0xDC00-0xDFFF) + // + // The following formulas are used for decoding + // and encoding characters using surrogate pairs: + // + // U = U' + 0x10000 (0x01 00 00 <= U <= 0x10 FF FF) + // U' = yyyyyyyyyyxxxxxxxxxx (0 <= U' <= 0x0F FF FF) + // W1 = 110110yyyyyyyyyy + // W2 = 110111xxxxxxxxxx + // + // where U is the character value, W1 is the high surrogate + // area, W2 is the low surrogate area. + + // Check for incomplete UTF-16 character. + if raw_unread < 2 { + if parser.eof { + return yaml_parser_set_reader_error(parser, + "incomplete UTF-16 character", + parser.offset, -1) + } + break inner + } + + // Get the character. + value = rune(parser.raw_buffer[parser.raw_buffer_pos+low]) + + (rune(parser.raw_buffer[parser.raw_buffer_pos+high]) << 8) + + // Check for unexpected low surrogate area. + if value&0xFC00 == 0xDC00 { + return yaml_parser_set_reader_error(parser, + "unexpected low surrogate area", + parser.offset, int(value)) + } + + // Check for a high surrogate area. + if value&0xFC00 == 0xD800 { + width = 4 + + // Check for incomplete surrogate pair. + if raw_unread < 4 { + if parser.eof { + return yaml_parser_set_reader_error(parser, + "incomplete UTF-16 surrogate pair", + parser.offset, -1) + } + break inner + } + + // Get the next character. + value2 := rune(parser.raw_buffer[parser.raw_buffer_pos+low+2]) + + (rune(parser.raw_buffer[parser.raw_buffer_pos+high+2]) << 8) + + // Check for a low surrogate area. + if value2&0xFC00 != 0xDC00 { + return yaml_parser_set_reader_error(parser, + "expected low surrogate area", + parser.offset+2, int(value2)) + } + + // Generate the value of the surrogate pair. + value = 0x10000 + ((value & 0x3FF) << 10) + (value2 & 0x3FF) + } else { + width = 2 + } + + default: + panic("impossible") + } + + // Check if the character is in the allowed range: + // #x9 | #xA | #xD | [#x20-#x7E] (8 bit) + // | #x85 | [#xA0-#xD7FF] | [#xE000-#xFFFD] (16 bit) + // | [#x10000-#x10FFFF] (32 bit) + switch { + case value == 0x09: + case value == 0x0A: + case value == 0x0D: + case value >= 0x20 && value <= 0x7E: + case value == 0x85: + case value >= 0xA0 && value <= 0xD7FF: + case value >= 0xE000 && value <= 0xFFFD: + case value >= 0x10000 && value <= 0x10FFFF: + default: + return yaml_parser_set_reader_error(parser, + "control characters are not allowed", + parser.offset, int(value)) + } + + // Move the raw pointers. + parser.raw_buffer_pos += width + parser.offset += width + + // Finally put the character into the buffer. + if value <= 0x7F { + // 0000 0000-0000 007F . 0xxxxxxx + parser.buffer[buffer_len+0] = byte(value) + buffer_len += 1 + } else if value <= 0x7FF { + // 0000 0080-0000 07FF . 110xxxxx 10xxxxxx + parser.buffer[buffer_len+0] = byte(0xC0 + (value >> 6)) + parser.buffer[buffer_len+1] = byte(0x80 + (value & 0x3F)) + buffer_len += 2 + } else if value <= 0xFFFF { + // 0000 0800-0000 FFFF . 1110xxxx 10xxxxxx 10xxxxxx + parser.buffer[buffer_len+0] = byte(0xE0 + (value >> 12)) + parser.buffer[buffer_len+1] = byte(0x80 + ((value >> 6) & 0x3F)) + parser.buffer[buffer_len+2] = byte(0x80 + (value & 0x3F)) + buffer_len += 3 + } else { + // 0001 0000-0010 FFFF . 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx + parser.buffer[buffer_len+0] = byte(0xF0 + (value >> 18)) + parser.buffer[buffer_len+1] = byte(0x80 + ((value >> 12) & 0x3F)) + parser.buffer[buffer_len+2] = byte(0x80 + ((value >> 6) & 0x3F)) + parser.buffer[buffer_len+3] = byte(0x80 + (value & 0x3F)) + buffer_len += 4 + } + + parser.unread++ + } + + // On EOF, put NUL into the buffer and return. + if parser.eof { + parser.buffer[buffer_len] = 0 + buffer_len++ + parser.unread++ + break + } + } + // [Go] Read the documentation of this function above. To return true, + // we need to have the given length in the buffer. Not doing that means + // every single check that calls this function to make sure the buffer + // has a given length is Go) panicking; or C) accessing invalid memory. + // This happens here due to the EOF above breaking early. + for buffer_len < length { + parser.buffer[buffer_len] = 0 + buffer_len++ + } + parser.buffer = parser.buffer[:buffer_len] + return true +} diff --git a/vendor/go.yaml.in/yaml/v3/resolve.go b/vendor/go.yaml.in/yaml/v3/resolve.go new file mode 100644 index 000000000..64ae88805 --- /dev/null +++ b/vendor/go.yaml.in/yaml/v3/resolve.go @@ -0,0 +1,326 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// +// 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 yaml + +import ( + "encoding/base64" + "math" + "regexp" + "strconv" + "strings" + "time" +) + +type resolveMapItem struct { + value interface{} + tag string +} + +var resolveTable = make([]byte, 256) +var resolveMap = make(map[string]resolveMapItem) + +func init() { + t := resolveTable + t[int('+')] = 'S' // Sign + t[int('-')] = 'S' + for _, c := range "0123456789" { + t[int(c)] = 'D' // Digit + } + for _, c := range "yYnNtTfFoO~" { + t[int(c)] = 'M' // In map + } + t[int('.')] = '.' // Float (potentially in map) + + var resolveMapList = []struct { + v interface{} + tag string + l []string + }{ + {true, boolTag, []string{"true", "True", "TRUE"}}, + {false, boolTag, []string{"false", "False", "FALSE"}}, + {nil, nullTag, []string{"", "~", "null", "Null", "NULL"}}, + {math.NaN(), floatTag, []string{".nan", ".NaN", ".NAN"}}, + {math.Inf(+1), floatTag, []string{".inf", ".Inf", ".INF"}}, + {math.Inf(+1), floatTag, []string{"+.inf", "+.Inf", "+.INF"}}, + {math.Inf(-1), floatTag, []string{"-.inf", "-.Inf", "-.INF"}}, + {"<<", mergeTag, []string{"<<"}}, + } + + m := resolveMap + for _, item := range resolveMapList { + for _, s := range item.l { + m[s] = resolveMapItem{item.v, item.tag} + } + } +} + +const ( + nullTag = "!!null" + boolTag = "!!bool" + strTag = "!!str" + intTag = "!!int" + floatTag = "!!float" + timestampTag = "!!timestamp" + seqTag = "!!seq" + mapTag = "!!map" + binaryTag = "!!binary" + mergeTag = "!!merge" +) + +var longTags = make(map[string]string) +var shortTags = make(map[string]string) + +func init() { + for _, stag := range []string{nullTag, boolTag, strTag, intTag, floatTag, timestampTag, seqTag, mapTag, binaryTag, mergeTag} { + ltag := longTag(stag) + longTags[stag] = ltag + shortTags[ltag] = stag + } +} + +const longTagPrefix = "tag:yaml.org,2002:" + +func shortTag(tag string) string { + if strings.HasPrefix(tag, longTagPrefix) { + if stag, ok := shortTags[tag]; ok { + return stag + } + return "!!" + tag[len(longTagPrefix):] + } + return tag +} + +func longTag(tag string) string { + if strings.HasPrefix(tag, "!!") { + if ltag, ok := longTags[tag]; ok { + return ltag + } + return longTagPrefix + tag[2:] + } + return tag +} + +func resolvableTag(tag string) bool { + switch tag { + case "", strTag, boolTag, intTag, floatTag, nullTag, timestampTag: + return true + } + return false +} + +var yamlStyleFloat = regexp.MustCompile(`^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$`) + +func resolve(tag string, in string) (rtag string, out interface{}) { + tag = shortTag(tag) + if !resolvableTag(tag) { + return tag, in + } + + defer func() { + switch tag { + case "", rtag, strTag, binaryTag: + return + case floatTag: + if rtag == intTag { + switch v := out.(type) { + case int64: + rtag = floatTag + out = float64(v) + return + case int: + rtag = floatTag + out = float64(v) + return + } + } + } + failf("cannot decode %s `%s` as a %s", shortTag(rtag), in, shortTag(tag)) + }() + + // Any data is accepted as a !!str or !!binary. + // Otherwise, the prefix is enough of a hint about what it might be. + hint := byte('N') + if in != "" { + hint = resolveTable[in[0]] + } + if hint != 0 && tag != strTag && tag != binaryTag { + // Handle things we can lookup in a map. + if item, ok := resolveMap[in]; ok { + return item.tag, item.value + } + + // Base 60 floats are a bad idea, were dropped in YAML 1.2, and + // are purposefully unsupported here. They're still quoted on + // the way out for compatibility with other parser, though. + + switch hint { + case 'M': + // We've already checked the map above. + + case '.': + // Not in the map, so maybe a normal float. + floatv, err := strconv.ParseFloat(in, 64) + if err == nil { + return floatTag, floatv + } + + case 'D', 'S': + // Int, float, or timestamp. + // Only try values as a timestamp if the value is unquoted or there's an explicit + // !!timestamp tag. + if tag == "" || tag == timestampTag { + t, ok := parseTimestamp(in) + if ok { + return timestampTag, t + } + } + + plain := strings.Replace(in, "_", "", -1) + intv, err := strconv.ParseInt(plain, 0, 64) + if err == nil { + if intv == int64(int(intv)) { + return intTag, int(intv) + } else { + return intTag, intv + } + } + uintv, err := strconv.ParseUint(plain, 0, 64) + if err == nil { + return intTag, uintv + } + if yamlStyleFloat.MatchString(plain) { + floatv, err := strconv.ParseFloat(plain, 64) + if err == nil { + return floatTag, floatv + } + } + if strings.HasPrefix(plain, "0b") { + intv, err := strconv.ParseInt(plain[2:], 2, 64) + if err == nil { + if intv == int64(int(intv)) { + return intTag, int(intv) + } else { + return intTag, intv + } + } + uintv, err := strconv.ParseUint(plain[2:], 2, 64) + if err == nil { + return intTag, uintv + } + } else if strings.HasPrefix(plain, "-0b") { + intv, err := strconv.ParseInt("-"+plain[3:], 2, 64) + if err == nil { + if true || intv == int64(int(intv)) { + return intTag, int(intv) + } else { + return intTag, intv + } + } + } + // Octals as introduced in version 1.2 of the spec. + // Octals from the 1.1 spec, spelled as 0777, are still + // decoded by default in v3 as well for compatibility. + // May be dropped in v4 depending on how usage evolves. + if strings.HasPrefix(plain, "0o") { + intv, err := strconv.ParseInt(plain[2:], 8, 64) + if err == nil { + if intv == int64(int(intv)) { + return intTag, int(intv) + } else { + return intTag, intv + } + } + uintv, err := strconv.ParseUint(plain[2:], 8, 64) + if err == nil { + return intTag, uintv + } + } else if strings.HasPrefix(plain, "-0o") { + intv, err := strconv.ParseInt("-"+plain[3:], 8, 64) + if err == nil { + if true || intv == int64(int(intv)) { + return intTag, int(intv) + } else { + return intTag, intv + } + } + } + default: + panic("internal error: missing handler for resolver table: " + string(rune(hint)) + " (with " + in + ")") + } + } + return strTag, in +} + +// encodeBase64 encodes s as base64 that is broken up into multiple lines +// as appropriate for the resulting length. +func encodeBase64(s string) string { + const lineLen = 70 + encLen := base64.StdEncoding.EncodedLen(len(s)) + lines := encLen/lineLen + 1 + buf := make([]byte, encLen*2+lines) + in := buf[0:encLen] + out := buf[encLen:] + base64.StdEncoding.Encode(in, []byte(s)) + k := 0 + for i := 0; i < len(in); i += lineLen { + j := i + lineLen + if j > len(in) { + j = len(in) + } + k += copy(out[k:], in[i:j]) + if lines > 1 { + out[k] = '\n' + k++ + } + } + return string(out[:k]) +} + +// This is a subset of the formats allowed by the regular expression +// defined at http://yaml.org/type/timestamp.html. +var allowedTimestampFormats = []string{ + "2006-1-2T15:4:5.999999999Z07:00", // RCF3339Nano with short date fields. + "2006-1-2t15:4:5.999999999Z07:00", // RFC3339Nano with short date fields and lower-case "t". + "2006-1-2 15:4:5.999999999", // space separated with no time zone + "2006-1-2", // date only + // Notable exception: time.Parse cannot handle: "2001-12-14 21:59:43.10 -5" + // from the set of examples. +} + +// parseTimestamp parses s as a timestamp string and +// returns the timestamp and reports whether it succeeded. +// Timestamp formats are defined at http://yaml.org/type/timestamp.html +func parseTimestamp(s string) (time.Time, bool) { + // TODO write code to check all the formats supported by + // http://yaml.org/type/timestamp.html instead of using time.Parse. + + // Quick check: all date formats start with YYYY-. + i := 0 + for ; i < len(s); i++ { + if c := s[i]; c < '0' || c > '9' { + break + } + } + if i != 4 || i == len(s) || s[i] != '-' { + return time.Time{}, false + } + for _, format := range allowedTimestampFormats { + if t, err := time.Parse(format, s); err == nil { + return t, true + } + } + return time.Time{}, false +} diff --git a/vendor/go.yaml.in/yaml/v3/scannerc.go b/vendor/go.yaml.in/yaml/v3/scannerc.go new file mode 100644 index 000000000..30b1f0892 --- /dev/null +++ b/vendor/go.yaml.in/yaml/v3/scannerc.go @@ -0,0 +1,3040 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// Copyright (c) 2006-2010 Kirill Simonov +// +// 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. + +package yaml + +import ( + "bytes" + "fmt" +) + +// Introduction +// ************ +// +// The following notes assume that you are familiar with the YAML specification +// (http://yaml.org/spec/1.2/spec.html). We mostly follow it, although in +// some cases we are less restrictive that it requires. +// +// The process of transforming a YAML stream into a sequence of events is +// divided on two steps: Scanning and Parsing. +// +// The Scanner transforms the input stream into a sequence of tokens, while the +// parser transform the sequence of tokens produced by the Scanner into a +// sequence of parsing events. +// +// The Scanner is rather clever and complicated. The Parser, on the contrary, +// is a straightforward implementation of a recursive-descendant parser (or, +// LL(1) parser, as it is usually called). +// +// Actually there are two issues of Scanning that might be called "clever", the +// rest is quite straightforward. The issues are "block collection start" and +// "simple keys". Both issues are explained below in details. +// +// Here the Scanning step is explained and implemented. We start with the list +// of all the tokens produced by the Scanner together with short descriptions. +// +// Now, tokens: +// +// STREAM-START(encoding) # The stream start. +// STREAM-END # The stream end. +// VERSION-DIRECTIVE(major,minor) # The '%YAML' directive. +// TAG-DIRECTIVE(handle,prefix) # The '%TAG' directive. +// DOCUMENT-START # '---' +// DOCUMENT-END # '...' +// BLOCK-SEQUENCE-START # Indentation increase denoting a block +// BLOCK-MAPPING-START # sequence or a block mapping. +// BLOCK-END # Indentation decrease. +// FLOW-SEQUENCE-START # '[' +// FLOW-SEQUENCE-END # ']' +// BLOCK-SEQUENCE-START # '{' +// BLOCK-SEQUENCE-END # '}' +// BLOCK-ENTRY # '-' +// FLOW-ENTRY # ',' +// KEY # '?' or nothing (simple keys). +// VALUE # ':' +// ALIAS(anchor) # '*anchor' +// ANCHOR(anchor) # '&anchor' +// TAG(handle,suffix) # '!handle!suffix' +// SCALAR(value,style) # A scalar. +// +// The following two tokens are "virtual" tokens denoting the beginning and the +// end of the stream: +// +// STREAM-START(encoding) +// STREAM-END +// +// We pass the information about the input stream encoding with the +// STREAM-START token. +// +// The next two tokens are responsible for tags: +// +// VERSION-DIRECTIVE(major,minor) +// TAG-DIRECTIVE(handle,prefix) +// +// Example: +// +// %YAML 1.1 +// %TAG ! !foo +// %TAG !yaml! tag:yaml.org,2002: +// --- +// +// The correspoding sequence of tokens: +// +// STREAM-START(utf-8) +// VERSION-DIRECTIVE(1,1) +// TAG-DIRECTIVE("!","!foo") +// TAG-DIRECTIVE("!yaml","tag:yaml.org,2002:") +// DOCUMENT-START +// STREAM-END +// +// Note that the VERSION-DIRECTIVE and TAG-DIRECTIVE tokens occupy a whole +// line. +// +// The document start and end indicators are represented by: +// +// DOCUMENT-START +// DOCUMENT-END +// +// Note that if a YAML stream contains an implicit document (without '---' +// and '...' indicators), no DOCUMENT-START and DOCUMENT-END tokens will be +// produced. +// +// In the following examples, we present whole documents together with the +// produced tokens. +// +// 1. An implicit document: +// +// 'a scalar' +// +// Tokens: +// +// STREAM-START(utf-8) +// SCALAR("a scalar",single-quoted) +// STREAM-END +// +// 2. An explicit document: +// +// --- +// 'a scalar' +// ... +// +// Tokens: +// +// STREAM-START(utf-8) +// DOCUMENT-START +// SCALAR("a scalar",single-quoted) +// DOCUMENT-END +// STREAM-END +// +// 3. Several documents in a stream: +// +// 'a scalar' +// --- +// 'another scalar' +// --- +// 'yet another scalar' +// +// Tokens: +// +// STREAM-START(utf-8) +// SCALAR("a scalar",single-quoted) +// DOCUMENT-START +// SCALAR("another scalar",single-quoted) +// DOCUMENT-START +// SCALAR("yet another scalar",single-quoted) +// STREAM-END +// +// We have already introduced the SCALAR token above. The following tokens are +// used to describe aliases, anchors, tag, and scalars: +// +// ALIAS(anchor) +// ANCHOR(anchor) +// TAG(handle,suffix) +// SCALAR(value,style) +// +// The following series of examples illustrate the usage of these tokens: +// +// 1. A recursive sequence: +// +// &A [ *A ] +// +// Tokens: +// +// STREAM-START(utf-8) +// ANCHOR("A") +// FLOW-SEQUENCE-START +// ALIAS("A") +// FLOW-SEQUENCE-END +// STREAM-END +// +// 2. A tagged scalar: +// +// !!float "3.14" # A good approximation. +// +// Tokens: +// +// STREAM-START(utf-8) +// TAG("!!","float") +// SCALAR("3.14",double-quoted) +// STREAM-END +// +// 3. Various scalar styles: +// +// --- # Implicit empty plain scalars do not produce tokens. +// --- a plain scalar +// --- 'a single-quoted scalar' +// --- "a double-quoted scalar" +// --- |- +// a literal scalar +// --- >- +// a folded +// scalar +// +// Tokens: +// +// STREAM-START(utf-8) +// DOCUMENT-START +// DOCUMENT-START +// SCALAR("a plain scalar",plain) +// DOCUMENT-START +// SCALAR("a single-quoted scalar",single-quoted) +// DOCUMENT-START +// SCALAR("a double-quoted scalar",double-quoted) +// DOCUMENT-START +// SCALAR("a literal scalar",literal) +// DOCUMENT-START +// SCALAR("a folded scalar",folded) +// STREAM-END +// +// Now it's time to review collection-related tokens. We will start with +// flow collections: +// +// FLOW-SEQUENCE-START +// FLOW-SEQUENCE-END +// FLOW-MAPPING-START +// FLOW-MAPPING-END +// FLOW-ENTRY +// KEY +// VALUE +// +// The tokens FLOW-SEQUENCE-START, FLOW-SEQUENCE-END, FLOW-MAPPING-START, and +// FLOW-MAPPING-END represent the indicators '[', ']', '{', and '}' +// correspondingly. FLOW-ENTRY represent the ',' indicator. Finally the +// indicators '?' and ':', which are used for denoting mapping keys and values, +// are represented by the KEY and VALUE tokens. +// +// The following examples show flow collections: +// +// 1. A flow sequence: +// +// [item 1, item 2, item 3] +// +// Tokens: +// +// STREAM-START(utf-8) +// FLOW-SEQUENCE-START +// SCALAR("item 1",plain) +// FLOW-ENTRY +// SCALAR("item 2",plain) +// FLOW-ENTRY +// SCALAR("item 3",plain) +// FLOW-SEQUENCE-END +// STREAM-END +// +// 2. A flow mapping: +// +// { +// a simple key: a value, # Note that the KEY token is produced. +// ? a complex key: another value, +// } +// +// Tokens: +// +// STREAM-START(utf-8) +// FLOW-MAPPING-START +// KEY +// SCALAR("a simple key",plain) +// VALUE +// SCALAR("a value",plain) +// FLOW-ENTRY +// KEY +// SCALAR("a complex key",plain) +// VALUE +// SCALAR("another value",plain) +// FLOW-ENTRY +// FLOW-MAPPING-END +// STREAM-END +// +// A simple key is a key which is not denoted by the '?' indicator. Note that +// the Scanner still produce the KEY token whenever it encounters a simple key. +// +// For scanning block collections, the following tokens are used (note that we +// repeat KEY and VALUE here): +// +// BLOCK-SEQUENCE-START +// BLOCK-MAPPING-START +// BLOCK-END +// BLOCK-ENTRY +// KEY +// VALUE +// +// The tokens BLOCK-SEQUENCE-START and BLOCK-MAPPING-START denote indentation +// increase that precedes a block collection (cf. the INDENT token in Python). +// The token BLOCK-END denote indentation decrease that ends a block collection +// (cf. the DEDENT token in Python). However YAML has some syntax pecularities +// that makes detections of these tokens more complex. +// +// The tokens BLOCK-ENTRY, KEY, and VALUE are used to represent the indicators +// '-', '?', and ':' correspondingly. +// +// The following examples show how the tokens BLOCK-SEQUENCE-START, +// BLOCK-MAPPING-START, and BLOCK-END are emitted by the Scanner: +// +// 1. Block sequences: +// +// - item 1 +// - item 2 +// - +// - item 3.1 +// - item 3.2 +// - +// key 1: value 1 +// key 2: value 2 +// +// Tokens: +// +// STREAM-START(utf-8) +// BLOCK-SEQUENCE-START +// BLOCK-ENTRY +// SCALAR("item 1",plain) +// BLOCK-ENTRY +// SCALAR("item 2",plain) +// BLOCK-ENTRY +// BLOCK-SEQUENCE-START +// BLOCK-ENTRY +// SCALAR("item 3.1",plain) +// BLOCK-ENTRY +// SCALAR("item 3.2",plain) +// BLOCK-END +// BLOCK-ENTRY +// BLOCK-MAPPING-START +// KEY +// SCALAR("key 1",plain) +// VALUE +// SCALAR("value 1",plain) +// KEY +// SCALAR("key 2",plain) +// VALUE +// SCALAR("value 2",plain) +// BLOCK-END +// BLOCK-END +// STREAM-END +// +// 2. Block mappings: +// +// a simple key: a value # The KEY token is produced here. +// ? a complex key +// : another value +// a mapping: +// key 1: value 1 +// key 2: value 2 +// a sequence: +// - item 1 +// - item 2 +// +// Tokens: +// +// STREAM-START(utf-8) +// BLOCK-MAPPING-START +// KEY +// SCALAR("a simple key",plain) +// VALUE +// SCALAR("a value",plain) +// KEY +// SCALAR("a complex key",plain) +// VALUE +// SCALAR("another value",plain) +// KEY +// SCALAR("a mapping",plain) +// BLOCK-MAPPING-START +// KEY +// SCALAR("key 1",plain) +// VALUE +// SCALAR("value 1",plain) +// KEY +// SCALAR("key 2",plain) +// VALUE +// SCALAR("value 2",plain) +// BLOCK-END +// KEY +// SCALAR("a sequence",plain) +// VALUE +// BLOCK-SEQUENCE-START +// BLOCK-ENTRY +// SCALAR("item 1",plain) +// BLOCK-ENTRY +// SCALAR("item 2",plain) +// BLOCK-END +// BLOCK-END +// STREAM-END +// +// YAML does not always require to start a new block collection from a new +// line. If the current line contains only '-', '?', and ':' indicators, a new +// block collection may start at the current line. The following examples +// illustrate this case: +// +// 1. Collections in a sequence: +// +// - - item 1 +// - item 2 +// - key 1: value 1 +// key 2: value 2 +// - ? complex key +// : complex value +// +// Tokens: +// +// STREAM-START(utf-8) +// BLOCK-SEQUENCE-START +// BLOCK-ENTRY +// BLOCK-SEQUENCE-START +// BLOCK-ENTRY +// SCALAR("item 1",plain) +// BLOCK-ENTRY +// SCALAR("item 2",plain) +// BLOCK-END +// BLOCK-ENTRY +// BLOCK-MAPPING-START +// KEY +// SCALAR("key 1",plain) +// VALUE +// SCALAR("value 1",plain) +// KEY +// SCALAR("key 2",plain) +// VALUE +// SCALAR("value 2",plain) +// BLOCK-END +// BLOCK-ENTRY +// BLOCK-MAPPING-START +// KEY +// SCALAR("complex key") +// VALUE +// SCALAR("complex value") +// BLOCK-END +// BLOCK-END +// STREAM-END +// +// 2. Collections in a mapping: +// +// ? a sequence +// : - item 1 +// - item 2 +// ? a mapping +// : key 1: value 1 +// key 2: value 2 +// +// Tokens: +// +// STREAM-START(utf-8) +// BLOCK-MAPPING-START +// KEY +// SCALAR("a sequence",plain) +// VALUE +// BLOCK-SEQUENCE-START +// BLOCK-ENTRY +// SCALAR("item 1",plain) +// BLOCK-ENTRY +// SCALAR("item 2",plain) +// BLOCK-END +// KEY +// SCALAR("a mapping",plain) +// VALUE +// BLOCK-MAPPING-START +// KEY +// SCALAR("key 1",plain) +// VALUE +// SCALAR("value 1",plain) +// KEY +// SCALAR("key 2",plain) +// VALUE +// SCALAR("value 2",plain) +// BLOCK-END +// BLOCK-END +// STREAM-END +// +// YAML also permits non-indented sequences if they are included into a block +// mapping. In this case, the token BLOCK-SEQUENCE-START is not produced: +// +// key: +// - item 1 # BLOCK-SEQUENCE-START is NOT produced here. +// - item 2 +// +// Tokens: +// +// STREAM-START(utf-8) +// BLOCK-MAPPING-START +// KEY +// SCALAR("key",plain) +// VALUE +// BLOCK-ENTRY +// SCALAR("item 1",plain) +// BLOCK-ENTRY +// SCALAR("item 2",plain) +// BLOCK-END +// + +// Ensure that the buffer contains the required number of characters. +// Return true on success, false on failure (reader error or memory error). +func cache(parser *yaml_parser_t, length int) bool { + // [Go] This was inlined: !cache(A, B) -> unread < B && !update(A, B) + return parser.unread >= length || yaml_parser_update_buffer(parser, length) +} + +// Advance the buffer pointer. +func skip(parser *yaml_parser_t) { + if !is_blank(parser.buffer, parser.buffer_pos) { + parser.newlines = 0 + } + parser.mark.index++ + parser.mark.column++ + parser.unread-- + parser.buffer_pos += width(parser.buffer[parser.buffer_pos]) +} + +func skip_line(parser *yaml_parser_t) { + if is_crlf(parser.buffer, parser.buffer_pos) { + parser.mark.index += 2 + parser.mark.column = 0 + parser.mark.line++ + parser.unread -= 2 + parser.buffer_pos += 2 + parser.newlines++ + } else if is_break(parser.buffer, parser.buffer_pos) { + parser.mark.index++ + parser.mark.column = 0 + parser.mark.line++ + parser.unread-- + parser.buffer_pos += width(parser.buffer[parser.buffer_pos]) + parser.newlines++ + } +} + +// Copy a character to a string buffer and advance pointers. +func read(parser *yaml_parser_t, s []byte) []byte { + if !is_blank(parser.buffer, parser.buffer_pos) { + parser.newlines = 0 + } + w := width(parser.buffer[parser.buffer_pos]) + if w == 0 { + panic("invalid character sequence") + } + if len(s) == 0 { + s = make([]byte, 0, 32) + } + if w == 1 && len(s)+w <= cap(s) { + s = s[:len(s)+1] + s[len(s)-1] = parser.buffer[parser.buffer_pos] + parser.buffer_pos++ + } else { + s = append(s, parser.buffer[parser.buffer_pos:parser.buffer_pos+w]...) + parser.buffer_pos += w + } + parser.mark.index++ + parser.mark.column++ + parser.unread-- + return s +} + +// Copy a line break character to a string buffer and advance pointers. +func read_line(parser *yaml_parser_t, s []byte) []byte { + buf := parser.buffer + pos := parser.buffer_pos + switch { + case buf[pos] == '\r' && buf[pos+1] == '\n': + // CR LF . LF + s = append(s, '\n') + parser.buffer_pos += 2 + parser.mark.index++ + parser.unread-- + case buf[pos] == '\r' || buf[pos] == '\n': + // CR|LF . LF + s = append(s, '\n') + parser.buffer_pos += 1 + case buf[pos] == '\xC2' && buf[pos+1] == '\x85': + // NEL . LF + s = append(s, '\n') + parser.buffer_pos += 2 + case buf[pos] == '\xE2' && buf[pos+1] == '\x80' && (buf[pos+2] == '\xA8' || buf[pos+2] == '\xA9'): + // LS|PS . LS|PS + s = append(s, buf[parser.buffer_pos:pos+3]...) + parser.buffer_pos += 3 + default: + return s + } + parser.mark.index++ + parser.mark.column = 0 + parser.mark.line++ + parser.unread-- + parser.newlines++ + return s +} + +// Get the next token. +func yaml_parser_scan(parser *yaml_parser_t, token *yaml_token_t) bool { + // Erase the token object. + *token = yaml_token_t{} // [Go] Is this necessary? + + // No tokens after STREAM-END or error. + if parser.stream_end_produced || parser.error != yaml_NO_ERROR { + return true + } + + // Ensure that the tokens queue contains enough tokens. + if !parser.token_available { + if !yaml_parser_fetch_more_tokens(parser) { + return false + } + } + + // Fetch the next token from the queue. + *token = parser.tokens[parser.tokens_head] + parser.tokens_head++ + parser.tokens_parsed++ + parser.token_available = false + + if token.typ == yaml_STREAM_END_TOKEN { + parser.stream_end_produced = true + } + return true +} + +// Set the scanner error and return false. +func yaml_parser_set_scanner_error(parser *yaml_parser_t, context string, context_mark yaml_mark_t, problem string) bool { + parser.error = yaml_SCANNER_ERROR + parser.context = context + parser.context_mark = context_mark + parser.problem = problem + parser.problem_mark = parser.mark + return false +} + +func yaml_parser_set_scanner_tag_error(parser *yaml_parser_t, directive bool, context_mark yaml_mark_t, problem string) bool { + context := "while parsing a tag" + if directive { + context = "while parsing a %TAG directive" + } + return yaml_parser_set_scanner_error(parser, context, context_mark, problem) +} + +func trace(args ...interface{}) func() { + pargs := append([]interface{}{"+++"}, args...) + fmt.Println(pargs...) + pargs = append([]interface{}{"---"}, args...) + return func() { fmt.Println(pargs...) } +} + +// Ensure that the tokens queue contains at least one token which can be +// returned to the Parser. +func yaml_parser_fetch_more_tokens(parser *yaml_parser_t) bool { + // While we need more tokens to fetch, do it. + for { + // [Go] The comment parsing logic requires a lookahead of two tokens + // so that foot comments may be parsed in time of associating them + // with the tokens that are parsed before them, and also for line + // comments to be transformed into head comments in some edge cases. + if parser.tokens_head < len(parser.tokens)-2 { + // If a potential simple key is at the head position, we need to fetch + // the next token to disambiguate it. + head_tok_idx, ok := parser.simple_keys_by_tok[parser.tokens_parsed] + if !ok { + break + } else if valid, ok := yaml_simple_key_is_valid(parser, &parser.simple_keys[head_tok_idx]); !ok { + return false + } else if !valid { + break + } + } + // Fetch the next token. + if !yaml_parser_fetch_next_token(parser) { + return false + } + } + + parser.token_available = true + return true +} + +// The dispatcher for token fetchers. +func yaml_parser_fetch_next_token(parser *yaml_parser_t) (ok bool) { + // Ensure that the buffer is initialized. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + // Check if we just started scanning. Fetch STREAM-START then. + if !parser.stream_start_produced { + return yaml_parser_fetch_stream_start(parser) + } + + scan_mark := parser.mark + + // Eat whitespaces and comments until we reach the next token. + if !yaml_parser_scan_to_next_token(parser) { + return false + } + + // [Go] While unrolling indents, transform the head comments of prior + // indentation levels observed after scan_start into foot comments at + // the respective indexes. + + // Check the indentation level against the current column. + if !yaml_parser_unroll_indent(parser, parser.mark.column, scan_mark) { + return false + } + + // Ensure that the buffer contains at least 4 characters. 4 is the length + // of the longest indicators ('--- ' and '... '). + if parser.unread < 4 && !yaml_parser_update_buffer(parser, 4) { + return false + } + + // Is it the end of the stream? + if is_z(parser.buffer, parser.buffer_pos) { + return yaml_parser_fetch_stream_end(parser) + } + + // Is it a directive? + if parser.mark.column == 0 && parser.buffer[parser.buffer_pos] == '%' { + return yaml_parser_fetch_directive(parser) + } + + buf := parser.buffer + pos := parser.buffer_pos + + // Is it the document start indicator? + if parser.mark.column == 0 && buf[pos] == '-' && buf[pos+1] == '-' && buf[pos+2] == '-' && is_blankz(buf, pos+3) { + return yaml_parser_fetch_document_indicator(parser, yaml_DOCUMENT_START_TOKEN) + } + + // Is it the document end indicator? + if parser.mark.column == 0 && buf[pos] == '.' && buf[pos+1] == '.' && buf[pos+2] == '.' && is_blankz(buf, pos+3) { + return yaml_parser_fetch_document_indicator(parser, yaml_DOCUMENT_END_TOKEN) + } + + comment_mark := parser.mark + if len(parser.tokens) > 0 && (parser.flow_level == 0 && buf[pos] == ':' || parser.flow_level > 0 && buf[pos] == ',') { + // Associate any following comments with the prior token. + comment_mark = parser.tokens[len(parser.tokens)-1].start_mark + } + defer func() { + if !ok { + return + } + if len(parser.tokens) > 0 && parser.tokens[len(parser.tokens)-1].typ == yaml_BLOCK_ENTRY_TOKEN { + // Sequence indicators alone have no line comments. It becomes + // a head comment for whatever follows. + return + } + if !yaml_parser_scan_line_comment(parser, comment_mark) { + ok = false + return + } + }() + + // Is it the flow sequence start indicator? + if buf[pos] == '[' { + return yaml_parser_fetch_flow_collection_start(parser, yaml_FLOW_SEQUENCE_START_TOKEN) + } + + // Is it the flow mapping start indicator? + if parser.buffer[parser.buffer_pos] == '{' { + return yaml_parser_fetch_flow_collection_start(parser, yaml_FLOW_MAPPING_START_TOKEN) + } + + // Is it the flow sequence end indicator? + if parser.buffer[parser.buffer_pos] == ']' { + return yaml_parser_fetch_flow_collection_end(parser, + yaml_FLOW_SEQUENCE_END_TOKEN) + } + + // Is it the flow mapping end indicator? + if parser.buffer[parser.buffer_pos] == '}' { + return yaml_parser_fetch_flow_collection_end(parser, + yaml_FLOW_MAPPING_END_TOKEN) + } + + // Is it the flow entry indicator? + if parser.buffer[parser.buffer_pos] == ',' { + return yaml_parser_fetch_flow_entry(parser) + } + + // Is it the block entry indicator? + if parser.buffer[parser.buffer_pos] == '-' && is_blankz(parser.buffer, parser.buffer_pos+1) { + return yaml_parser_fetch_block_entry(parser) + } + + // Is it the key indicator? + if parser.buffer[parser.buffer_pos] == '?' && (parser.flow_level > 0 || is_blankz(parser.buffer, parser.buffer_pos+1)) { + return yaml_parser_fetch_key(parser) + } + + // Is it the value indicator? + if parser.buffer[parser.buffer_pos] == ':' && (parser.flow_level > 0 || is_blankz(parser.buffer, parser.buffer_pos+1)) { + return yaml_parser_fetch_value(parser) + } + + // Is it an alias? + if parser.buffer[parser.buffer_pos] == '*' { + return yaml_parser_fetch_anchor(parser, yaml_ALIAS_TOKEN) + } + + // Is it an anchor? + if parser.buffer[parser.buffer_pos] == '&' { + return yaml_parser_fetch_anchor(parser, yaml_ANCHOR_TOKEN) + } + + // Is it a tag? + if parser.buffer[parser.buffer_pos] == '!' { + return yaml_parser_fetch_tag(parser) + } + + // Is it a literal scalar? + if parser.buffer[parser.buffer_pos] == '|' && parser.flow_level == 0 { + return yaml_parser_fetch_block_scalar(parser, true) + } + + // Is it a folded scalar? + if parser.buffer[parser.buffer_pos] == '>' && parser.flow_level == 0 { + return yaml_parser_fetch_block_scalar(parser, false) + } + + // Is it a single-quoted scalar? + if parser.buffer[parser.buffer_pos] == '\'' { + return yaml_parser_fetch_flow_scalar(parser, true) + } + + // Is it a double-quoted scalar? + if parser.buffer[parser.buffer_pos] == '"' { + return yaml_parser_fetch_flow_scalar(parser, false) + } + + // Is it a plain scalar? + // + // A plain scalar may start with any non-blank characters except + // + // '-', '?', ':', ',', '[', ']', '{', '}', + // '#', '&', '*', '!', '|', '>', '\'', '\"', + // '%', '@', '`'. + // + // In the block context (and, for the '-' indicator, in the flow context + // too), it may also start with the characters + // + // '-', '?', ':' + // + // if it is followed by a non-space character. + // + // The last rule is more restrictive than the specification requires. + // [Go] TODO Make this logic more reasonable. + //switch parser.buffer[parser.buffer_pos] { + //case '-', '?', ':', ',', '?', '-', ',', ':', ']', '[', '}', '{', '&', '#', '!', '*', '>', '|', '"', '\'', '@', '%', '-', '`': + //} + if !(is_blankz(parser.buffer, parser.buffer_pos) || parser.buffer[parser.buffer_pos] == '-' || + parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == ':' || + parser.buffer[parser.buffer_pos] == ',' || parser.buffer[parser.buffer_pos] == '[' || + parser.buffer[parser.buffer_pos] == ']' || parser.buffer[parser.buffer_pos] == '{' || + parser.buffer[parser.buffer_pos] == '}' || parser.buffer[parser.buffer_pos] == '#' || + parser.buffer[parser.buffer_pos] == '&' || parser.buffer[parser.buffer_pos] == '*' || + parser.buffer[parser.buffer_pos] == '!' || parser.buffer[parser.buffer_pos] == '|' || + parser.buffer[parser.buffer_pos] == '>' || parser.buffer[parser.buffer_pos] == '\'' || + parser.buffer[parser.buffer_pos] == '"' || parser.buffer[parser.buffer_pos] == '%' || + parser.buffer[parser.buffer_pos] == '@' || parser.buffer[parser.buffer_pos] == '`') || + (parser.buffer[parser.buffer_pos] == '-' && !is_blank(parser.buffer, parser.buffer_pos+1)) || + (parser.flow_level == 0 && + (parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == ':') && + !is_blankz(parser.buffer, parser.buffer_pos+1)) { + return yaml_parser_fetch_plain_scalar(parser) + } + + // If we don't determine the token type so far, it is an error. + return yaml_parser_set_scanner_error(parser, + "while scanning for the next token", parser.mark, + "found character that cannot start any token") +} + +func yaml_simple_key_is_valid(parser *yaml_parser_t, simple_key *yaml_simple_key_t) (valid, ok bool) { + if !simple_key.possible { + return false, true + } + + // The 1.2 specification says: + // + // "If the ? indicator is omitted, parsing needs to see past the + // implicit key to recognize it as such. To limit the amount of + // lookahead required, the “:” indicator must appear at most 1024 + // Unicode characters beyond the start of the key. In addition, the key + // is restricted to a single line." + // + if simple_key.mark.line < parser.mark.line || simple_key.mark.index+1024 < parser.mark.index { + // Check if the potential simple key to be removed is required. + if simple_key.required { + return false, yaml_parser_set_scanner_error(parser, + "while scanning a simple key", simple_key.mark, + "could not find expected ':'") + } + simple_key.possible = false + return false, true + } + return true, true +} + +// Check if a simple key may start at the current position and add it if +// needed. +func yaml_parser_save_simple_key(parser *yaml_parser_t) bool { + // A simple key is required at the current position if the scanner is in + // the block context and the current column coincides with the indentation + // level. + + required := parser.flow_level == 0 && parser.indent == parser.mark.column + + // + // If the current position may start a simple key, save it. + // + if parser.simple_key_allowed { + simple_key := yaml_simple_key_t{ + possible: true, + required: required, + token_number: parser.tokens_parsed + (len(parser.tokens) - parser.tokens_head), + mark: parser.mark, + } + + if !yaml_parser_remove_simple_key(parser) { + return false + } + parser.simple_keys[len(parser.simple_keys)-1] = simple_key + parser.simple_keys_by_tok[simple_key.token_number] = len(parser.simple_keys) - 1 + } + return true +} + +// Remove a potential simple key at the current flow level. +func yaml_parser_remove_simple_key(parser *yaml_parser_t) bool { + i := len(parser.simple_keys) - 1 + if parser.simple_keys[i].possible { + // If the key is required, it is an error. + if parser.simple_keys[i].required { + return yaml_parser_set_scanner_error(parser, + "while scanning a simple key", parser.simple_keys[i].mark, + "could not find expected ':'") + } + // Remove the key from the stack. + parser.simple_keys[i].possible = false + delete(parser.simple_keys_by_tok, parser.simple_keys[i].token_number) + } + return true +} + +// max_flow_level limits the flow_level +const max_flow_level = 10000 + +// Increase the flow level and resize the simple key list if needed. +func yaml_parser_increase_flow_level(parser *yaml_parser_t) bool { + // Reset the simple key on the next level. + parser.simple_keys = append(parser.simple_keys, yaml_simple_key_t{ + possible: false, + required: false, + token_number: parser.tokens_parsed + (len(parser.tokens) - parser.tokens_head), + mark: parser.mark, + }) + + // Increase the flow level. + parser.flow_level++ + if parser.flow_level > max_flow_level { + return yaml_parser_set_scanner_error(parser, + "while increasing flow level", parser.simple_keys[len(parser.simple_keys)-1].mark, + fmt.Sprintf("exceeded max depth of %d", max_flow_level)) + } + return true +} + +// Decrease the flow level. +func yaml_parser_decrease_flow_level(parser *yaml_parser_t) bool { + if parser.flow_level > 0 { + parser.flow_level-- + last := len(parser.simple_keys) - 1 + delete(parser.simple_keys_by_tok, parser.simple_keys[last].token_number) + parser.simple_keys = parser.simple_keys[:last] + } + return true +} + +// max_indents limits the indents stack size +const max_indents = 10000 + +// Push the current indentation level to the stack and set the new level +// the current column is greater than the indentation level. In this case, +// append or insert the specified token into the token queue. +func yaml_parser_roll_indent(parser *yaml_parser_t, column, number int, typ yaml_token_type_t, mark yaml_mark_t) bool { + // In the flow context, do nothing. + if parser.flow_level > 0 { + return true + } + + if parser.indent < column { + // Push the current indentation level to the stack and set the new + // indentation level. + parser.indents = append(parser.indents, parser.indent) + parser.indent = column + if len(parser.indents) > max_indents { + return yaml_parser_set_scanner_error(parser, + "while increasing indent level", parser.simple_keys[len(parser.simple_keys)-1].mark, + fmt.Sprintf("exceeded max depth of %d", max_indents)) + } + + // Create a token and insert it into the queue. + token := yaml_token_t{ + typ: typ, + start_mark: mark, + end_mark: mark, + } + if number > -1 { + number -= parser.tokens_parsed + } + yaml_insert_token(parser, number, &token) + } + return true +} + +// Pop indentation levels from the indents stack until the current level +// becomes less or equal to the column. For each indentation level, append +// the BLOCK-END token. +func yaml_parser_unroll_indent(parser *yaml_parser_t, column int, scan_mark yaml_mark_t) bool { + // In the flow context, do nothing. + if parser.flow_level > 0 { + return true + } + + block_mark := scan_mark + block_mark.index-- + + // Loop through the indentation levels in the stack. + for parser.indent > column { + + // [Go] Reposition the end token before potential following + // foot comments of parent blocks. For that, search + // backwards for recent comments that were at the same + // indent as the block that is ending now. + stop_index := block_mark.index + for i := len(parser.comments) - 1; i >= 0; i-- { + comment := &parser.comments[i] + + if comment.end_mark.index < stop_index { + // Don't go back beyond the start of the comment/whitespace scan, unless column < 0. + // If requested indent column is < 0, then the document is over and everything else + // is a foot anyway. + break + } + if comment.start_mark.column == parser.indent+1 { + // This is a good match. But maybe there's a former comment + // at that same indent level, so keep searching. + block_mark = comment.start_mark + } + + // While the end of the former comment matches with + // the start of the following one, we know there's + // nothing in between and scanning is still safe. + stop_index = comment.scan_mark.index + } + + // Create a token and append it to the queue. + token := yaml_token_t{ + typ: yaml_BLOCK_END_TOKEN, + start_mark: block_mark, + end_mark: block_mark, + } + yaml_insert_token(parser, -1, &token) + + // Pop the indentation level. + parser.indent = parser.indents[len(parser.indents)-1] + parser.indents = parser.indents[:len(parser.indents)-1] + } + return true +} + +// Initialize the scanner and produce the STREAM-START token. +func yaml_parser_fetch_stream_start(parser *yaml_parser_t) bool { + + // Set the initial indentation. + parser.indent = -1 + + // Initialize the simple key stack. + parser.simple_keys = append(parser.simple_keys, yaml_simple_key_t{}) + + parser.simple_keys_by_tok = make(map[int]int) + + // A simple key is allowed at the beginning of the stream. + parser.simple_key_allowed = true + + // We have started. + parser.stream_start_produced = true + + // Create the STREAM-START token and append it to the queue. + token := yaml_token_t{ + typ: yaml_STREAM_START_TOKEN, + start_mark: parser.mark, + end_mark: parser.mark, + encoding: parser.encoding, + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the STREAM-END token and shut down the scanner. +func yaml_parser_fetch_stream_end(parser *yaml_parser_t) bool { + + // Force new line. + if parser.mark.column != 0 { + parser.mark.column = 0 + parser.mark.line++ + } + + // Reset the indentation level. + if !yaml_parser_unroll_indent(parser, -1, parser.mark) { + return false + } + + // Reset simple keys. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + parser.simple_key_allowed = false + + // Create the STREAM-END token and append it to the queue. + token := yaml_token_t{ + typ: yaml_STREAM_END_TOKEN, + start_mark: parser.mark, + end_mark: parser.mark, + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce a VERSION-DIRECTIVE or TAG-DIRECTIVE token. +func yaml_parser_fetch_directive(parser *yaml_parser_t) bool { + // Reset the indentation level. + if !yaml_parser_unroll_indent(parser, -1, parser.mark) { + return false + } + + // Reset simple keys. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + parser.simple_key_allowed = false + + // Create the YAML-DIRECTIVE or TAG-DIRECTIVE token. + token := yaml_token_t{} + if !yaml_parser_scan_directive(parser, &token) { + return false + } + // Append the token to the queue. + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the DOCUMENT-START or DOCUMENT-END token. +func yaml_parser_fetch_document_indicator(parser *yaml_parser_t, typ yaml_token_type_t) bool { + // Reset the indentation level. + if !yaml_parser_unroll_indent(parser, -1, parser.mark) { + return false + } + + // Reset simple keys. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + parser.simple_key_allowed = false + + // Consume the token. + start_mark := parser.mark + + skip(parser) + skip(parser) + skip(parser) + + end_mark := parser.mark + + // Create the DOCUMENT-START or DOCUMENT-END token. + token := yaml_token_t{ + typ: typ, + start_mark: start_mark, + end_mark: end_mark, + } + // Append the token to the queue. + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the FLOW-SEQUENCE-START or FLOW-MAPPING-START token. +func yaml_parser_fetch_flow_collection_start(parser *yaml_parser_t, typ yaml_token_type_t) bool { + + // The indicators '[' and '{' may start a simple key. + if !yaml_parser_save_simple_key(parser) { + return false + } + + // Increase the flow level. + if !yaml_parser_increase_flow_level(parser) { + return false + } + + // A simple key may follow the indicators '[' and '{'. + parser.simple_key_allowed = true + + // Consume the token. + start_mark := parser.mark + skip(parser) + end_mark := parser.mark + + // Create the FLOW-SEQUENCE-START of FLOW-MAPPING-START token. + token := yaml_token_t{ + typ: typ, + start_mark: start_mark, + end_mark: end_mark, + } + // Append the token to the queue. + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the FLOW-SEQUENCE-END or FLOW-MAPPING-END token. +func yaml_parser_fetch_flow_collection_end(parser *yaml_parser_t, typ yaml_token_type_t) bool { + // Reset any potential simple key on the current flow level. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + // Decrease the flow level. + if !yaml_parser_decrease_flow_level(parser) { + return false + } + + // No simple keys after the indicators ']' and '}'. + parser.simple_key_allowed = false + + // Consume the token. + + start_mark := parser.mark + skip(parser) + end_mark := parser.mark + + // Create the FLOW-SEQUENCE-END of FLOW-MAPPING-END token. + token := yaml_token_t{ + typ: typ, + start_mark: start_mark, + end_mark: end_mark, + } + // Append the token to the queue. + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the FLOW-ENTRY token. +func yaml_parser_fetch_flow_entry(parser *yaml_parser_t) bool { + // Reset any potential simple keys on the current flow level. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + // Simple keys are allowed after ','. + parser.simple_key_allowed = true + + // Consume the token. + start_mark := parser.mark + skip(parser) + end_mark := parser.mark + + // Create the FLOW-ENTRY token and append it to the queue. + token := yaml_token_t{ + typ: yaml_FLOW_ENTRY_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the BLOCK-ENTRY token. +func yaml_parser_fetch_block_entry(parser *yaml_parser_t) bool { + // Check if the scanner is in the block context. + if parser.flow_level == 0 { + // Check if we are allowed to start a new entry. + if !parser.simple_key_allowed { + return yaml_parser_set_scanner_error(parser, "", parser.mark, + "block sequence entries are not allowed in this context") + } + // Add the BLOCK-SEQUENCE-START token if needed. + if !yaml_parser_roll_indent(parser, parser.mark.column, -1, yaml_BLOCK_SEQUENCE_START_TOKEN, parser.mark) { + return false + } + } else { + // It is an error for the '-' indicator to occur in the flow context, + // but we let the Parser detect and report about it because the Parser + // is able to point to the context. + } + + // Reset any potential simple keys on the current flow level. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + // Simple keys are allowed after '-'. + parser.simple_key_allowed = true + + // Consume the token. + start_mark := parser.mark + skip(parser) + end_mark := parser.mark + + // Create the BLOCK-ENTRY token and append it to the queue. + token := yaml_token_t{ + typ: yaml_BLOCK_ENTRY_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the KEY token. +func yaml_parser_fetch_key(parser *yaml_parser_t) bool { + + // In the block context, additional checks are required. + if parser.flow_level == 0 { + // Check if we are allowed to start a new key (not nessesary simple). + if !parser.simple_key_allowed { + return yaml_parser_set_scanner_error(parser, "", parser.mark, + "mapping keys are not allowed in this context") + } + // Add the BLOCK-MAPPING-START token if needed. + if !yaml_parser_roll_indent(parser, parser.mark.column, -1, yaml_BLOCK_MAPPING_START_TOKEN, parser.mark) { + return false + } + } + + // Reset any potential simple keys on the current flow level. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + // Simple keys are allowed after '?' in the block context. + parser.simple_key_allowed = parser.flow_level == 0 + + // Consume the token. + start_mark := parser.mark + skip(parser) + end_mark := parser.mark + + // Create the KEY token and append it to the queue. + token := yaml_token_t{ + typ: yaml_KEY_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the VALUE token. +func yaml_parser_fetch_value(parser *yaml_parser_t) bool { + + simple_key := &parser.simple_keys[len(parser.simple_keys)-1] + + // Have we found a simple key? + if valid, ok := yaml_simple_key_is_valid(parser, simple_key); !ok { + return false + + } else if valid { + + // Create the KEY token and insert it into the queue. + token := yaml_token_t{ + typ: yaml_KEY_TOKEN, + start_mark: simple_key.mark, + end_mark: simple_key.mark, + } + yaml_insert_token(parser, simple_key.token_number-parser.tokens_parsed, &token) + + // In the block context, we may need to add the BLOCK-MAPPING-START token. + if !yaml_parser_roll_indent(parser, simple_key.mark.column, + simple_key.token_number, + yaml_BLOCK_MAPPING_START_TOKEN, simple_key.mark) { + return false + } + + // Remove the simple key. + simple_key.possible = false + delete(parser.simple_keys_by_tok, simple_key.token_number) + + // A simple key cannot follow another simple key. + parser.simple_key_allowed = false + + } else { + // The ':' indicator follows a complex key. + + // In the block context, extra checks are required. + if parser.flow_level == 0 { + + // Check if we are allowed to start a complex value. + if !parser.simple_key_allowed { + return yaml_parser_set_scanner_error(parser, "", parser.mark, + "mapping values are not allowed in this context") + } + + // Add the BLOCK-MAPPING-START token if needed. + if !yaml_parser_roll_indent(parser, parser.mark.column, -1, yaml_BLOCK_MAPPING_START_TOKEN, parser.mark) { + return false + } + } + + // Simple keys after ':' are allowed in the block context. + parser.simple_key_allowed = parser.flow_level == 0 + } + + // Consume the token. + start_mark := parser.mark + skip(parser) + end_mark := parser.mark + + // Create the VALUE token and append it to the queue. + token := yaml_token_t{ + typ: yaml_VALUE_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the ALIAS or ANCHOR token. +func yaml_parser_fetch_anchor(parser *yaml_parser_t, typ yaml_token_type_t) bool { + // An anchor or an alias could be a simple key. + if !yaml_parser_save_simple_key(parser) { + return false + } + + // A simple key cannot follow an anchor or an alias. + parser.simple_key_allowed = false + + // Create the ALIAS or ANCHOR token and append it to the queue. + var token yaml_token_t + if !yaml_parser_scan_anchor(parser, &token, typ) { + return false + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the TAG token. +func yaml_parser_fetch_tag(parser *yaml_parser_t) bool { + // A tag could be a simple key. + if !yaml_parser_save_simple_key(parser) { + return false + } + + // A simple key cannot follow a tag. + parser.simple_key_allowed = false + + // Create the TAG token and append it to the queue. + var token yaml_token_t + if !yaml_parser_scan_tag(parser, &token) { + return false + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the SCALAR(...,literal) or SCALAR(...,folded) tokens. +func yaml_parser_fetch_block_scalar(parser *yaml_parser_t, literal bool) bool { + // Remove any potential simple keys. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + // A simple key may follow a block scalar. + parser.simple_key_allowed = true + + // Create the SCALAR token and append it to the queue. + var token yaml_token_t + if !yaml_parser_scan_block_scalar(parser, &token, literal) { + return false + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the SCALAR(...,single-quoted) or SCALAR(...,double-quoted) tokens. +func yaml_parser_fetch_flow_scalar(parser *yaml_parser_t, single bool) bool { + // A plain scalar could be a simple key. + if !yaml_parser_save_simple_key(parser) { + return false + } + + // A simple key cannot follow a flow scalar. + parser.simple_key_allowed = false + + // Create the SCALAR token and append it to the queue. + var token yaml_token_t + if !yaml_parser_scan_flow_scalar(parser, &token, single) { + return false + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the SCALAR(...,plain) token. +func yaml_parser_fetch_plain_scalar(parser *yaml_parser_t) bool { + // A plain scalar could be a simple key. + if !yaml_parser_save_simple_key(parser) { + return false + } + + // A simple key cannot follow a flow scalar. + parser.simple_key_allowed = false + + // Create the SCALAR token and append it to the queue. + var token yaml_token_t + if !yaml_parser_scan_plain_scalar(parser, &token) { + return false + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Eat whitespaces and comments until the next token is found. +func yaml_parser_scan_to_next_token(parser *yaml_parser_t) bool { + + scan_mark := parser.mark + + // Until the next token is not found. + for { + // Allow the BOM mark to start a line. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if parser.mark.column == 0 && is_bom(parser.buffer, parser.buffer_pos) { + skip(parser) + } + + // Eat whitespaces. + // Tabs are allowed: + // - in the flow context + // - in the block context, but not at the beginning of the line or + // after '-', '?', or ':' (complex value). + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + for parser.buffer[parser.buffer_pos] == ' ' || ((parser.flow_level > 0 || !parser.simple_key_allowed) && parser.buffer[parser.buffer_pos] == '\t') { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Check if we just had a line comment under a sequence entry that + // looks more like a header to the following content. Similar to this: + // + // - # The comment + // - Some data + // + // If so, transform the line comment to a head comment and reposition. + if len(parser.comments) > 0 && len(parser.tokens) > 1 { + tokenA := parser.tokens[len(parser.tokens)-2] + tokenB := parser.tokens[len(parser.tokens)-1] + comment := &parser.comments[len(parser.comments)-1] + if tokenA.typ == yaml_BLOCK_SEQUENCE_START_TOKEN && tokenB.typ == yaml_BLOCK_ENTRY_TOKEN && len(comment.line) > 0 && !is_break(parser.buffer, parser.buffer_pos) { + // If it was in the prior line, reposition so it becomes a + // header of the follow up token. Otherwise, keep it in place + // so it becomes a header of the former. + comment.head = comment.line + comment.line = nil + if comment.start_mark.line == parser.mark.line-1 { + comment.token_mark = parser.mark + } + } + } + + // Eat a comment until a line break. + if parser.buffer[parser.buffer_pos] == '#' { + if !yaml_parser_scan_comments(parser, scan_mark) { + return false + } + } + + // If it is a line break, eat it. + if is_break(parser.buffer, parser.buffer_pos) { + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + skip_line(parser) + + // In the block context, a new line may start a simple key. + if parser.flow_level == 0 { + parser.simple_key_allowed = true + } + } else { + break // We have found a token. + } + } + + return true +} + +// Scan a YAML-DIRECTIVE or TAG-DIRECTIVE token. +// +// Scope: +// +// %YAML 1.1 # a comment \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +func yaml_parser_scan_directive(parser *yaml_parser_t, token *yaml_token_t) bool { + // Eat '%'. + start_mark := parser.mark + skip(parser) + + // Scan the directive name. + var name []byte + if !yaml_parser_scan_directive_name(parser, start_mark, &name) { + return false + } + + // Is it a YAML directive? + if bytes.Equal(name, []byte("YAML")) { + // Scan the VERSION directive value. + var major, minor int8 + if !yaml_parser_scan_version_directive_value(parser, start_mark, &major, &minor) { + return false + } + end_mark := parser.mark + + // Create a VERSION-DIRECTIVE token. + *token = yaml_token_t{ + typ: yaml_VERSION_DIRECTIVE_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + major: major, + minor: minor, + } + + // Is it a TAG directive? + } else if bytes.Equal(name, []byte("TAG")) { + // Scan the TAG directive value. + var handle, prefix []byte + if !yaml_parser_scan_tag_directive_value(parser, start_mark, &handle, &prefix) { + return false + } + end_mark := parser.mark + + // Create a TAG-DIRECTIVE token. + *token = yaml_token_t{ + typ: yaml_TAG_DIRECTIVE_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + value: handle, + prefix: prefix, + } + + // Unknown directive. + } else { + yaml_parser_set_scanner_error(parser, "while scanning a directive", + start_mark, "found unknown directive name") + return false + } + + // Eat the rest of the line including any comments. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + for is_blank(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + if parser.buffer[parser.buffer_pos] == '#' { + // [Go] Discard this inline comment for the time being. + //if !yaml_parser_scan_line_comment(parser, start_mark) { + // return false + //} + for !is_breakz(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + } + + // Check if we are at the end of the line. + if !is_breakz(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a directive", + start_mark, "did not find expected comment or line break") + return false + } + + // Eat a line break. + if is_break(parser.buffer, parser.buffer_pos) { + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + skip_line(parser) + } + + return true +} + +// Scan the directive name. +// +// Scope: +// +// %YAML 1.1 # a comment \n +// ^^^^ +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^ +func yaml_parser_scan_directive_name(parser *yaml_parser_t, start_mark yaml_mark_t, name *[]byte) bool { + // Consume the directive name. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + var s []byte + for is_alpha(parser.buffer, parser.buffer_pos) { + s = read(parser, s) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Check if the name is empty. + if len(s) == 0 { + yaml_parser_set_scanner_error(parser, "while scanning a directive", + start_mark, "could not find expected directive name") + return false + } + + // Check for an blank character after the name. + if !is_blankz(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a directive", + start_mark, "found unexpected non-alphabetical character") + return false + } + *name = s + return true +} + +// Scan the value of VERSION-DIRECTIVE. +// +// Scope: +// +// %YAML 1.1 # a comment \n +// ^^^^^^ +func yaml_parser_scan_version_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, major, minor *int8) bool { + // Eat whitespaces. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + for is_blank(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Consume the major version number. + if !yaml_parser_scan_version_directive_number(parser, start_mark, major) { + return false + } + + // Eat '.'. + if parser.buffer[parser.buffer_pos] != '.' { + return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive", + start_mark, "did not find expected digit or '.' character") + } + + skip(parser) + + // Consume the minor version number. + if !yaml_parser_scan_version_directive_number(parser, start_mark, minor) { + return false + } + return true +} + +const max_number_length = 2 + +// Scan the version number of VERSION-DIRECTIVE. +// +// Scope: +// +// %YAML 1.1 # a comment \n +// ^ +// %YAML 1.1 # a comment \n +// ^ +func yaml_parser_scan_version_directive_number(parser *yaml_parser_t, start_mark yaml_mark_t, number *int8) bool { + + // Repeat while the next character is digit. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + var value, length int8 + for is_digit(parser.buffer, parser.buffer_pos) { + // Check if the number is too long. + length++ + if length > max_number_length { + return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive", + start_mark, "found extremely long version number") + } + value = value*10 + int8(as_digit(parser.buffer, parser.buffer_pos)) + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Check if the number was present. + if length == 0 { + return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive", + start_mark, "did not find expected version number") + } + *number = value + return true +} + +// Scan the value of a TAG-DIRECTIVE token. +// +// Scope: +// +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +func yaml_parser_scan_tag_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, handle, prefix *[]byte) bool { + var handle_value, prefix_value []byte + + // Eat whitespaces. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + for is_blank(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Scan a handle. + if !yaml_parser_scan_tag_handle(parser, true, start_mark, &handle_value) { + return false + } + + // Expect a whitespace. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if !is_blank(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a %TAG directive", + start_mark, "did not find expected whitespace") + return false + } + + // Eat whitespaces. + for is_blank(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Scan a prefix. + if !yaml_parser_scan_tag_uri(parser, true, nil, start_mark, &prefix_value) { + return false + } + + // Expect a whitespace or line break. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if !is_blankz(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a %TAG directive", + start_mark, "did not find expected whitespace or line break") + return false + } + + *handle = handle_value + *prefix = prefix_value + return true +} + +func yaml_parser_scan_anchor(parser *yaml_parser_t, token *yaml_token_t, typ yaml_token_type_t) bool { + var s []byte + + // Eat the indicator character. + start_mark := parser.mark + skip(parser) + + // Consume the value. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + for is_alpha(parser.buffer, parser.buffer_pos) { + s = read(parser, s) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + end_mark := parser.mark + + /* + * Check if length of the anchor is greater than 0 and it is followed by + * a whitespace character or one of the indicators: + * + * '?', ':', ',', ']', '}', '%', '@', '`'. + */ + + if len(s) == 0 || + !(is_blankz(parser.buffer, parser.buffer_pos) || parser.buffer[parser.buffer_pos] == '?' || + parser.buffer[parser.buffer_pos] == ':' || parser.buffer[parser.buffer_pos] == ',' || + parser.buffer[parser.buffer_pos] == ']' || parser.buffer[parser.buffer_pos] == '}' || + parser.buffer[parser.buffer_pos] == '%' || parser.buffer[parser.buffer_pos] == '@' || + parser.buffer[parser.buffer_pos] == '`') { + context := "while scanning an alias" + if typ == yaml_ANCHOR_TOKEN { + context = "while scanning an anchor" + } + yaml_parser_set_scanner_error(parser, context, start_mark, + "did not find expected alphabetic or numeric character") + return false + } + + // Create a token. + *token = yaml_token_t{ + typ: typ, + start_mark: start_mark, + end_mark: end_mark, + value: s, + } + + return true +} + +/* + * Scan a TAG token. + */ + +func yaml_parser_scan_tag(parser *yaml_parser_t, token *yaml_token_t) bool { + var handle, suffix []byte + + start_mark := parser.mark + + // Check if the tag is in the canonical form. + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + + if parser.buffer[parser.buffer_pos+1] == '<' { + // Keep the handle as '' + + // Eat '!<' + skip(parser) + skip(parser) + + // Consume the tag value. + if !yaml_parser_scan_tag_uri(parser, false, nil, start_mark, &suffix) { + return false + } + + // Check for '>' and eat it. + if parser.buffer[parser.buffer_pos] != '>' { + yaml_parser_set_scanner_error(parser, "while scanning a tag", + start_mark, "did not find the expected '>'") + return false + } + + skip(parser) + } else { + // The tag has either the '!suffix' or the '!handle!suffix' form. + + // First, try to scan a handle. + if !yaml_parser_scan_tag_handle(parser, false, start_mark, &handle) { + return false + } + + // Check if it is, indeed, handle. + if handle[0] == '!' && len(handle) > 1 && handle[len(handle)-1] == '!' { + // Scan the suffix now. + if !yaml_parser_scan_tag_uri(parser, false, nil, start_mark, &suffix) { + return false + } + } else { + // It wasn't a handle after all. Scan the rest of the tag. + if !yaml_parser_scan_tag_uri(parser, false, handle, start_mark, &suffix) { + return false + } + + // Set the handle to '!'. + handle = []byte{'!'} + + // A special case: the '!' tag. Set the handle to '' and the + // suffix to '!'. + if len(suffix) == 0 { + handle, suffix = suffix, handle + } + } + } + + // Check the character which ends the tag. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if !is_blankz(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a tag", + start_mark, "did not find expected whitespace or line break") + return false + } + + end_mark := parser.mark + + // Create a token. + *token = yaml_token_t{ + typ: yaml_TAG_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + value: handle, + suffix: suffix, + } + return true +} + +// Scan a tag handle. +func yaml_parser_scan_tag_handle(parser *yaml_parser_t, directive bool, start_mark yaml_mark_t, handle *[]byte) bool { + // Check the initial '!' character. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if parser.buffer[parser.buffer_pos] != '!' { + yaml_parser_set_scanner_tag_error(parser, directive, + start_mark, "did not find expected '!'") + return false + } + + var s []byte + + // Copy the '!' character. + s = read(parser, s) + + // Copy all subsequent alphabetical and numerical characters. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + for is_alpha(parser.buffer, parser.buffer_pos) { + s = read(parser, s) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Check if the trailing character is '!' and copy it. + if parser.buffer[parser.buffer_pos] == '!' { + s = read(parser, s) + } else { + // It's either the '!' tag or not really a tag handle. If it's a %TAG + // directive, it's an error. If it's a tag token, it must be a part of URI. + if directive && string(s) != "!" { + yaml_parser_set_scanner_tag_error(parser, directive, + start_mark, "did not find expected '!'") + return false + } + } + + *handle = s + return true +} + +// Scan a tag. +func yaml_parser_scan_tag_uri(parser *yaml_parser_t, directive bool, head []byte, start_mark yaml_mark_t, uri *[]byte) bool { + //size_t length = head ? strlen((char *)head) : 0 + var s []byte + hasTag := len(head) > 0 + + // Copy the head if needed. + // + // Note that we don't copy the leading '!' character. + if len(head) > 1 { + s = append(s, head[1:]...) + } + + // Scan the tag. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + // The set of characters that may appear in URI is as follows: + // + // '0'-'9', 'A'-'Z', 'a'-'z', '_', '-', ';', '/', '?', ':', '@', '&', + // '=', '+', '$', ',', '.', '!', '~', '*', '\'', '(', ')', '[', ']', + // '%'. + // [Go] TODO Convert this into more reasonable logic. + for is_alpha(parser.buffer, parser.buffer_pos) || parser.buffer[parser.buffer_pos] == ';' || + parser.buffer[parser.buffer_pos] == '/' || parser.buffer[parser.buffer_pos] == '?' || + parser.buffer[parser.buffer_pos] == ':' || parser.buffer[parser.buffer_pos] == '@' || + parser.buffer[parser.buffer_pos] == '&' || parser.buffer[parser.buffer_pos] == '=' || + parser.buffer[parser.buffer_pos] == '+' || parser.buffer[parser.buffer_pos] == '$' || + parser.buffer[parser.buffer_pos] == ',' || parser.buffer[parser.buffer_pos] == '.' || + parser.buffer[parser.buffer_pos] == '!' || parser.buffer[parser.buffer_pos] == '~' || + parser.buffer[parser.buffer_pos] == '*' || parser.buffer[parser.buffer_pos] == '\'' || + parser.buffer[parser.buffer_pos] == '(' || parser.buffer[parser.buffer_pos] == ')' || + parser.buffer[parser.buffer_pos] == '[' || parser.buffer[parser.buffer_pos] == ']' || + parser.buffer[parser.buffer_pos] == '%' { + // Check if it is a URI-escape sequence. + if parser.buffer[parser.buffer_pos] == '%' { + if !yaml_parser_scan_uri_escapes(parser, directive, start_mark, &s) { + return false + } + } else { + s = read(parser, s) + } + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + hasTag = true + } + + if !hasTag { + yaml_parser_set_scanner_tag_error(parser, directive, + start_mark, "did not find expected tag URI") + return false + } + *uri = s + return true +} + +// Decode an URI-escape sequence corresponding to a single UTF-8 character. +func yaml_parser_scan_uri_escapes(parser *yaml_parser_t, directive bool, start_mark yaml_mark_t, s *[]byte) bool { + + // Decode the required number of characters. + w := 1024 + for w > 0 { + // Check for a URI-escaped octet. + if parser.unread < 3 && !yaml_parser_update_buffer(parser, 3) { + return false + } + + if !(parser.buffer[parser.buffer_pos] == '%' && + is_hex(parser.buffer, parser.buffer_pos+1) && + is_hex(parser.buffer, parser.buffer_pos+2)) { + return yaml_parser_set_scanner_tag_error(parser, directive, + start_mark, "did not find URI escaped octet") + } + + // Get the octet. + octet := byte((as_hex(parser.buffer, parser.buffer_pos+1) << 4) + as_hex(parser.buffer, parser.buffer_pos+2)) + + // If it is the leading octet, determine the length of the UTF-8 sequence. + if w == 1024 { + w = width(octet) + if w == 0 { + return yaml_parser_set_scanner_tag_error(parser, directive, + start_mark, "found an incorrect leading UTF-8 octet") + } + } else { + // Check if the trailing octet is correct. + if octet&0xC0 != 0x80 { + return yaml_parser_set_scanner_tag_error(parser, directive, + start_mark, "found an incorrect trailing UTF-8 octet") + } + } + + // Copy the octet and move the pointers. + *s = append(*s, octet) + skip(parser) + skip(parser) + skip(parser) + w-- + } + return true +} + +// Scan a block scalar. +func yaml_parser_scan_block_scalar(parser *yaml_parser_t, token *yaml_token_t, literal bool) bool { + // Eat the indicator '|' or '>'. + start_mark := parser.mark + skip(parser) + + // Scan the additional block scalar indicators. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + // Check for a chomping indicator. + var chomping, increment int + if parser.buffer[parser.buffer_pos] == '+' || parser.buffer[parser.buffer_pos] == '-' { + // Set the chomping method and eat the indicator. + if parser.buffer[parser.buffer_pos] == '+' { + chomping = +1 + } else { + chomping = -1 + } + skip(parser) + + // Check for an indentation indicator. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if is_digit(parser.buffer, parser.buffer_pos) { + // Check that the indentation is greater than 0. + if parser.buffer[parser.buffer_pos] == '0' { + yaml_parser_set_scanner_error(parser, "while scanning a block scalar", + start_mark, "found an indentation indicator equal to 0") + return false + } + + // Get the indentation level and eat the indicator. + increment = as_digit(parser.buffer, parser.buffer_pos) + skip(parser) + } + + } else if is_digit(parser.buffer, parser.buffer_pos) { + // Do the same as above, but in the opposite order. + + if parser.buffer[parser.buffer_pos] == '0' { + yaml_parser_set_scanner_error(parser, "while scanning a block scalar", + start_mark, "found an indentation indicator equal to 0") + return false + } + increment = as_digit(parser.buffer, parser.buffer_pos) + skip(parser) + + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if parser.buffer[parser.buffer_pos] == '+' || parser.buffer[parser.buffer_pos] == '-' { + if parser.buffer[parser.buffer_pos] == '+' { + chomping = +1 + } else { + chomping = -1 + } + skip(parser) + } + } + + // Eat whitespaces and comments to the end of the line. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + for is_blank(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + if parser.buffer[parser.buffer_pos] == '#' { + if !yaml_parser_scan_line_comment(parser, start_mark) { + return false + } + for !is_breakz(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + } + + // Check if we are at the end of the line. + if !is_breakz(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a block scalar", + start_mark, "did not find expected comment or line break") + return false + } + + // Eat a line break. + if is_break(parser.buffer, parser.buffer_pos) { + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + skip_line(parser) + } + + end_mark := parser.mark + + // Set the indentation level if it was specified. + var indent int + if increment > 0 { + if parser.indent >= 0 { + indent = parser.indent + increment + } else { + indent = increment + } + } + + // Scan the leading line breaks and determine the indentation level if needed. + var s, leading_break, trailing_breaks []byte + if !yaml_parser_scan_block_scalar_breaks(parser, &indent, &trailing_breaks, start_mark, &end_mark) { + return false + } + + // Scan the block scalar content. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + var leading_blank, trailing_blank bool + for parser.mark.column == indent && !is_z(parser.buffer, parser.buffer_pos) { + // We are at the beginning of a non-empty line. + + // Is it a trailing whitespace? + trailing_blank = is_blank(parser.buffer, parser.buffer_pos) + + // Check if we need to fold the leading line break. + if !literal && !leading_blank && !trailing_blank && len(leading_break) > 0 && leading_break[0] == '\n' { + // Do we need to join the lines by space? + if len(trailing_breaks) == 0 { + s = append(s, ' ') + } + } else { + s = append(s, leading_break...) + } + leading_break = leading_break[:0] + + // Append the remaining line breaks. + s = append(s, trailing_breaks...) + trailing_breaks = trailing_breaks[:0] + + // Is it a leading whitespace? + leading_blank = is_blank(parser.buffer, parser.buffer_pos) + + // Consume the current line. + for !is_breakz(parser.buffer, parser.buffer_pos) { + s = read(parser, s) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Consume the line break. + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + + leading_break = read_line(parser, leading_break) + + // Eat the following indentation spaces and line breaks. + if !yaml_parser_scan_block_scalar_breaks(parser, &indent, &trailing_breaks, start_mark, &end_mark) { + return false + } + } + + // Chomp the tail. + if chomping != -1 { + s = append(s, leading_break...) + } + if chomping == 1 { + s = append(s, trailing_breaks...) + } + + // Create a token. + *token = yaml_token_t{ + typ: yaml_SCALAR_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + value: s, + style: yaml_LITERAL_SCALAR_STYLE, + } + if !literal { + token.style = yaml_FOLDED_SCALAR_STYLE + } + return true +} + +// Scan indentation spaces and line breaks for a block scalar. Determine the +// indentation level if needed. +func yaml_parser_scan_block_scalar_breaks(parser *yaml_parser_t, indent *int, breaks *[]byte, start_mark yaml_mark_t, end_mark *yaml_mark_t) bool { + *end_mark = parser.mark + + // Eat the indentation spaces and line breaks. + max_indent := 0 + for { + // Eat the indentation spaces. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + for (*indent == 0 || parser.mark.column < *indent) && is_space(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + if parser.mark.column > max_indent { + max_indent = parser.mark.column + } + + // Check for a tab character messing the indentation. + if (*indent == 0 || parser.mark.column < *indent) && is_tab(parser.buffer, parser.buffer_pos) { + return yaml_parser_set_scanner_error(parser, "while scanning a block scalar", + start_mark, "found a tab character where an indentation space is expected") + } + + // Have we found a non-empty line? + if !is_break(parser.buffer, parser.buffer_pos) { + break + } + + // Consume the line break. + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + // [Go] Should really be returning breaks instead. + *breaks = read_line(parser, *breaks) + *end_mark = parser.mark + } + + // Determine the indentation level if needed. + if *indent == 0 { + *indent = max_indent + if *indent < parser.indent+1 { + *indent = parser.indent + 1 + } + if *indent < 1 { + *indent = 1 + } + } + return true +} + +// Scan a quoted scalar. +func yaml_parser_scan_flow_scalar(parser *yaml_parser_t, token *yaml_token_t, single bool) bool { + // Eat the left quote. + start_mark := parser.mark + skip(parser) + + // Consume the content of the quoted scalar. + var s, leading_break, trailing_breaks, whitespaces []byte + for { + // Check that there are no document indicators at the beginning of the line. + if parser.unread < 4 && !yaml_parser_update_buffer(parser, 4) { + return false + } + + if parser.mark.column == 0 && + ((parser.buffer[parser.buffer_pos+0] == '-' && + parser.buffer[parser.buffer_pos+1] == '-' && + parser.buffer[parser.buffer_pos+2] == '-') || + (parser.buffer[parser.buffer_pos+0] == '.' && + parser.buffer[parser.buffer_pos+1] == '.' && + parser.buffer[parser.buffer_pos+2] == '.')) && + is_blankz(parser.buffer, parser.buffer_pos+3) { + yaml_parser_set_scanner_error(parser, "while scanning a quoted scalar", + start_mark, "found unexpected document indicator") + return false + } + + // Check for EOF. + if is_z(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a quoted scalar", + start_mark, "found unexpected end of stream") + return false + } + + // Consume non-blank characters. + leading_blanks := false + for !is_blankz(parser.buffer, parser.buffer_pos) { + if single && parser.buffer[parser.buffer_pos] == '\'' && parser.buffer[parser.buffer_pos+1] == '\'' { + // Is is an escaped single quote. + s = append(s, '\'') + skip(parser) + skip(parser) + + } else if single && parser.buffer[parser.buffer_pos] == '\'' { + // It is a right single quote. + break + } else if !single && parser.buffer[parser.buffer_pos] == '"' { + // It is a right double quote. + break + + } else if !single && parser.buffer[parser.buffer_pos] == '\\' && is_break(parser.buffer, parser.buffer_pos+1) { + // It is an escaped line break. + if parser.unread < 3 && !yaml_parser_update_buffer(parser, 3) { + return false + } + skip(parser) + skip_line(parser) + leading_blanks = true + break + + } else if !single && parser.buffer[parser.buffer_pos] == '\\' { + // It is an escape sequence. + code_length := 0 + + // Check the escape character. + switch parser.buffer[parser.buffer_pos+1] { + case '0': + s = append(s, 0) + case 'a': + s = append(s, '\x07') + case 'b': + s = append(s, '\x08') + case 't', '\t': + s = append(s, '\x09') + case 'n': + s = append(s, '\x0A') + case 'v': + s = append(s, '\x0B') + case 'f': + s = append(s, '\x0C') + case 'r': + s = append(s, '\x0D') + case 'e': + s = append(s, '\x1B') + case ' ': + s = append(s, '\x20') + case '"': + s = append(s, '"') + case '\'': + s = append(s, '\'') + case '\\': + s = append(s, '\\') + case 'N': // NEL (#x85) + s = append(s, '\xC2') + s = append(s, '\x85') + case '_': // #xA0 + s = append(s, '\xC2') + s = append(s, '\xA0') + case 'L': // LS (#x2028) + s = append(s, '\xE2') + s = append(s, '\x80') + s = append(s, '\xA8') + case 'P': // PS (#x2029) + s = append(s, '\xE2') + s = append(s, '\x80') + s = append(s, '\xA9') + case 'x': + code_length = 2 + case 'u': + code_length = 4 + case 'U': + code_length = 8 + default: + yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar", + start_mark, "found unknown escape character") + return false + } + + skip(parser) + skip(parser) + + // Consume an arbitrary escape code. + if code_length > 0 { + var value int + + // Scan the character value. + if parser.unread < code_length && !yaml_parser_update_buffer(parser, code_length) { + return false + } + for k := 0; k < code_length; k++ { + if !is_hex(parser.buffer, parser.buffer_pos+k) { + yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar", + start_mark, "did not find expected hexdecimal number") + return false + } + value = (value << 4) + as_hex(parser.buffer, parser.buffer_pos+k) + } + + // Check the value and write the character. + if (value >= 0xD800 && value <= 0xDFFF) || value > 0x10FFFF { + yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar", + start_mark, "found invalid Unicode character escape code") + return false + } + if value <= 0x7F { + s = append(s, byte(value)) + } else if value <= 0x7FF { + s = append(s, byte(0xC0+(value>>6))) + s = append(s, byte(0x80+(value&0x3F))) + } else if value <= 0xFFFF { + s = append(s, byte(0xE0+(value>>12))) + s = append(s, byte(0x80+((value>>6)&0x3F))) + s = append(s, byte(0x80+(value&0x3F))) + } else { + s = append(s, byte(0xF0+(value>>18))) + s = append(s, byte(0x80+((value>>12)&0x3F))) + s = append(s, byte(0x80+((value>>6)&0x3F))) + s = append(s, byte(0x80+(value&0x3F))) + } + + // Advance the pointer. + for k := 0; k < code_length; k++ { + skip(parser) + } + } + } else { + // It is a non-escaped non-blank character. + s = read(parser, s) + } + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + } + + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + // Check if we are at the end of the scalar. + if single { + if parser.buffer[parser.buffer_pos] == '\'' { + break + } + } else { + if parser.buffer[parser.buffer_pos] == '"' { + break + } + } + + // Consume blank characters. + for is_blank(parser.buffer, parser.buffer_pos) || is_break(parser.buffer, parser.buffer_pos) { + if is_blank(parser.buffer, parser.buffer_pos) { + // Consume a space or a tab character. + if !leading_blanks { + whitespaces = read(parser, whitespaces) + } else { + skip(parser) + } + } else { + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + + // Check if it is a first line break. + if !leading_blanks { + whitespaces = whitespaces[:0] + leading_break = read_line(parser, leading_break) + leading_blanks = true + } else { + trailing_breaks = read_line(parser, trailing_breaks) + } + } + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Join the whitespaces or fold line breaks. + if leading_blanks { + // Do we need to fold line breaks? + if len(leading_break) > 0 && leading_break[0] == '\n' { + if len(trailing_breaks) == 0 { + s = append(s, ' ') + } else { + s = append(s, trailing_breaks...) + } + } else { + s = append(s, leading_break...) + s = append(s, trailing_breaks...) + } + trailing_breaks = trailing_breaks[:0] + leading_break = leading_break[:0] + } else { + s = append(s, whitespaces...) + whitespaces = whitespaces[:0] + } + } + + // Eat the right quote. + skip(parser) + end_mark := parser.mark + + // Create a token. + *token = yaml_token_t{ + typ: yaml_SCALAR_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + value: s, + style: yaml_SINGLE_QUOTED_SCALAR_STYLE, + } + if !single { + token.style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + return true +} + +// Scan a plain scalar. +func yaml_parser_scan_plain_scalar(parser *yaml_parser_t, token *yaml_token_t) bool { + + var s, leading_break, trailing_breaks, whitespaces []byte + var leading_blanks bool + var indent = parser.indent + 1 + + start_mark := parser.mark + end_mark := parser.mark + + // Consume the content of the plain scalar. + for { + // Check for a document indicator. + if parser.unread < 4 && !yaml_parser_update_buffer(parser, 4) { + return false + } + if parser.mark.column == 0 && + ((parser.buffer[parser.buffer_pos+0] == '-' && + parser.buffer[parser.buffer_pos+1] == '-' && + parser.buffer[parser.buffer_pos+2] == '-') || + (parser.buffer[parser.buffer_pos+0] == '.' && + parser.buffer[parser.buffer_pos+1] == '.' && + parser.buffer[parser.buffer_pos+2] == '.')) && + is_blankz(parser.buffer, parser.buffer_pos+3) { + break + } + + // Check for a comment. + if parser.buffer[parser.buffer_pos] == '#' { + break + } + + // Consume non-blank characters. + for !is_blankz(parser.buffer, parser.buffer_pos) { + + // Check for indicators that may end a plain scalar. + if (parser.buffer[parser.buffer_pos] == ':' && is_blankz(parser.buffer, parser.buffer_pos+1)) || + (parser.flow_level > 0 && + (parser.buffer[parser.buffer_pos] == ',' || + parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == '[' || + parser.buffer[parser.buffer_pos] == ']' || parser.buffer[parser.buffer_pos] == '{' || + parser.buffer[parser.buffer_pos] == '}')) { + break + } + + // Check if we need to join whitespaces and breaks. + if leading_blanks || len(whitespaces) > 0 { + if leading_blanks { + // Do we need to fold line breaks? + if leading_break[0] == '\n' { + if len(trailing_breaks) == 0 { + s = append(s, ' ') + } else { + s = append(s, trailing_breaks...) + } + } else { + s = append(s, leading_break...) + s = append(s, trailing_breaks...) + } + trailing_breaks = trailing_breaks[:0] + leading_break = leading_break[:0] + leading_blanks = false + } else { + s = append(s, whitespaces...) + whitespaces = whitespaces[:0] + } + } + + // Copy the character. + s = read(parser, s) + + end_mark = parser.mark + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + } + + // Is it the end? + if !(is_blank(parser.buffer, parser.buffer_pos) || is_break(parser.buffer, parser.buffer_pos)) { + break + } + + // Consume blank characters. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + for is_blank(parser.buffer, parser.buffer_pos) || is_break(parser.buffer, parser.buffer_pos) { + if is_blank(parser.buffer, parser.buffer_pos) { + + // Check for tab characters that abuse indentation. + if leading_blanks && parser.mark.column < indent && is_tab(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a plain scalar", + start_mark, "found a tab character that violates indentation") + return false + } + + // Consume a space or a tab character. + if !leading_blanks { + whitespaces = read(parser, whitespaces) + } else { + skip(parser) + } + } else { + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + + // Check if it is a first line break. + if !leading_blanks { + whitespaces = whitespaces[:0] + leading_break = read_line(parser, leading_break) + leading_blanks = true + } else { + trailing_breaks = read_line(parser, trailing_breaks) + } + } + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Check indentation level. + if parser.flow_level == 0 && parser.mark.column < indent { + break + } + } + + // Create a token. + *token = yaml_token_t{ + typ: yaml_SCALAR_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + value: s, + style: yaml_PLAIN_SCALAR_STYLE, + } + + // Note that we change the 'simple_key_allowed' flag. + if leading_blanks { + parser.simple_key_allowed = true + } + return true +} + +func yaml_parser_scan_line_comment(parser *yaml_parser_t, token_mark yaml_mark_t) bool { + if parser.newlines > 0 { + return true + } + + var start_mark yaml_mark_t + var text []byte + + for peek := 0; peek < 512; peek++ { + if parser.unread < peek+1 && !yaml_parser_update_buffer(parser, peek+1) { + break + } + if is_blank(parser.buffer, parser.buffer_pos+peek) { + continue + } + if parser.buffer[parser.buffer_pos+peek] == '#' { + seen := parser.mark.index + peek + for { + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if is_breakz(parser.buffer, parser.buffer_pos) { + if parser.mark.index >= seen { + break + } + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + skip_line(parser) + } else if parser.mark.index >= seen { + if len(text) == 0 { + start_mark = parser.mark + } + text = read(parser, text) + } else { + skip(parser) + } + } + } + break + } + if len(text) > 0 { + parser.comments = append(parser.comments, yaml_comment_t{ + token_mark: token_mark, + start_mark: start_mark, + line: text, + }) + } + return true +} + +func yaml_parser_scan_comments(parser *yaml_parser_t, scan_mark yaml_mark_t) bool { + token := parser.tokens[len(parser.tokens)-1] + + if token.typ == yaml_FLOW_ENTRY_TOKEN && len(parser.tokens) > 1 { + token = parser.tokens[len(parser.tokens)-2] + } + + var token_mark = token.start_mark + var start_mark yaml_mark_t + var next_indent = parser.indent + if next_indent < 0 { + next_indent = 0 + } + + var recent_empty = false + var first_empty = parser.newlines <= 1 + + var line = parser.mark.line + var column = parser.mark.column + + var text []byte + + // The foot line is the place where a comment must start to + // still be considered as a foot of the prior content. + // If there's some content in the currently parsed line, then + // the foot is the line below it. + var foot_line = -1 + if scan_mark.line > 0 { + foot_line = parser.mark.line - parser.newlines + 1 + if parser.newlines == 0 && parser.mark.column > 1 { + foot_line++ + } + } + + var peek = 0 + for ; peek < 512; peek++ { + if parser.unread < peek+1 && !yaml_parser_update_buffer(parser, peek+1) { + break + } + column++ + if is_blank(parser.buffer, parser.buffer_pos+peek) { + continue + } + c := parser.buffer[parser.buffer_pos+peek] + var close_flow = parser.flow_level > 0 && (c == ']' || c == '}') + if close_flow || is_breakz(parser.buffer, parser.buffer_pos+peek) { + // Got line break or terminator. + if close_flow || !recent_empty { + if close_flow || first_empty && (start_mark.line == foot_line && token.typ != yaml_VALUE_TOKEN || start_mark.column-1 < next_indent) { + // This is the first empty line and there were no empty lines before, + // so this initial part of the comment is a foot of the prior token + // instead of being a head for the following one. Split it up. + // Alternatively, this might also be the last comment inside a flow + // scope, so it must be a footer. + if len(text) > 0 { + if start_mark.column-1 < next_indent { + // If dedented it's unrelated to the prior token. + token_mark = start_mark + } + parser.comments = append(parser.comments, yaml_comment_t{ + scan_mark: scan_mark, + token_mark: token_mark, + start_mark: start_mark, + end_mark: yaml_mark_t{parser.mark.index + peek, line, column}, + foot: text, + }) + scan_mark = yaml_mark_t{parser.mark.index + peek, line, column} + token_mark = scan_mark + text = nil + } + } else { + if len(text) > 0 && parser.buffer[parser.buffer_pos+peek] != 0 { + text = append(text, '\n') + } + } + } + if !is_break(parser.buffer, parser.buffer_pos+peek) { + break + } + first_empty = false + recent_empty = true + column = 0 + line++ + continue + } + + if len(text) > 0 && (close_flow || column-1 < next_indent && column != start_mark.column) { + // The comment at the different indentation is a foot of the + // preceding data rather than a head of the upcoming one. + parser.comments = append(parser.comments, yaml_comment_t{ + scan_mark: scan_mark, + token_mark: token_mark, + start_mark: start_mark, + end_mark: yaml_mark_t{parser.mark.index + peek, line, column}, + foot: text, + }) + scan_mark = yaml_mark_t{parser.mark.index + peek, line, column} + token_mark = scan_mark + text = nil + } + + if parser.buffer[parser.buffer_pos+peek] != '#' { + break + } + + if len(text) == 0 { + start_mark = yaml_mark_t{parser.mark.index + peek, line, column} + } else { + text = append(text, '\n') + } + + recent_empty = false + + // Consume until after the consumed comment line. + seen := parser.mark.index + peek + for { + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if is_breakz(parser.buffer, parser.buffer_pos) { + if parser.mark.index >= seen { + break + } + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + skip_line(parser) + } else if parser.mark.index >= seen { + text = read(parser, text) + } else { + skip(parser) + } + } + + peek = 0 + column = 0 + line = parser.mark.line + next_indent = parser.indent + if next_indent < 0 { + next_indent = 0 + } + } + + if len(text) > 0 { + parser.comments = append(parser.comments, yaml_comment_t{ + scan_mark: scan_mark, + token_mark: start_mark, + start_mark: start_mark, + end_mark: yaml_mark_t{parser.mark.index + peek - 1, line, column}, + head: text, + }) + } + return true +} diff --git a/vendor/go.yaml.in/yaml/v3/sorter.go b/vendor/go.yaml.in/yaml/v3/sorter.go new file mode 100644 index 000000000..9210ece7e --- /dev/null +++ b/vendor/go.yaml.in/yaml/v3/sorter.go @@ -0,0 +1,134 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// +// 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 yaml + +import ( + "reflect" + "unicode" +) + +type keyList []reflect.Value + +func (l keyList) Len() int { return len(l) } +func (l keyList) Swap(i, j int) { l[i], l[j] = l[j], l[i] } +func (l keyList) Less(i, j int) bool { + a := l[i] + b := l[j] + ak := a.Kind() + bk := b.Kind() + for (ak == reflect.Interface || ak == reflect.Ptr) && !a.IsNil() { + a = a.Elem() + ak = a.Kind() + } + for (bk == reflect.Interface || bk == reflect.Ptr) && !b.IsNil() { + b = b.Elem() + bk = b.Kind() + } + af, aok := keyFloat(a) + bf, bok := keyFloat(b) + if aok && bok { + if af != bf { + return af < bf + } + if ak != bk { + return ak < bk + } + return numLess(a, b) + } + if ak != reflect.String || bk != reflect.String { + return ak < bk + } + ar, br := []rune(a.String()), []rune(b.String()) + digits := false + for i := 0; i < len(ar) && i < len(br); i++ { + if ar[i] == br[i] { + digits = unicode.IsDigit(ar[i]) + continue + } + al := unicode.IsLetter(ar[i]) + bl := unicode.IsLetter(br[i]) + if al && bl { + return ar[i] < br[i] + } + if al || bl { + if digits { + return al + } else { + return bl + } + } + var ai, bi int + var an, bn int64 + if ar[i] == '0' || br[i] == '0' { + for j := i - 1; j >= 0 && unicode.IsDigit(ar[j]); j-- { + if ar[j] != '0' { + an = 1 + bn = 1 + break + } + } + } + for ai = i; ai < len(ar) && unicode.IsDigit(ar[ai]); ai++ { + an = an*10 + int64(ar[ai]-'0') + } + for bi = i; bi < len(br) && unicode.IsDigit(br[bi]); bi++ { + bn = bn*10 + int64(br[bi]-'0') + } + if an != bn { + return an < bn + } + if ai != bi { + return ai < bi + } + return ar[i] < br[i] + } + return len(ar) < len(br) +} + +// keyFloat returns a float value for v if it is a number/bool +// and whether it is a number/bool or not. +func keyFloat(v reflect.Value) (f float64, ok bool) { + switch v.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return float64(v.Int()), true + case reflect.Float32, reflect.Float64: + return v.Float(), true + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return float64(v.Uint()), true + case reflect.Bool: + if v.Bool() { + return 1, true + } + return 0, true + } + return 0, false +} + +// numLess returns whether a < b. +// a and b must necessarily have the same kind. +func numLess(a, b reflect.Value) bool { + switch a.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return a.Int() < b.Int() + case reflect.Float32, reflect.Float64: + return a.Float() < b.Float() + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return a.Uint() < b.Uint() + case reflect.Bool: + return !a.Bool() && b.Bool() + } + panic("not a number") +} diff --git a/vendor/go.yaml.in/yaml/v3/writerc.go b/vendor/go.yaml.in/yaml/v3/writerc.go new file mode 100644 index 000000000..266d0b092 --- /dev/null +++ b/vendor/go.yaml.in/yaml/v3/writerc.go @@ -0,0 +1,48 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// Copyright (c) 2006-2010 Kirill Simonov +// +// 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. + +package yaml + +// Set the writer error and return false. +func yaml_emitter_set_writer_error(emitter *yaml_emitter_t, problem string) bool { + emitter.error = yaml_WRITER_ERROR + emitter.problem = problem + return false +} + +// Flush the output buffer. +func yaml_emitter_flush(emitter *yaml_emitter_t) bool { + if emitter.write_handler == nil { + panic("write handler not set") + } + + // Check if the buffer is empty. + if emitter.buffer_pos == 0 { + return true + } + + if err := emitter.write_handler(emitter, emitter.buffer[:emitter.buffer_pos]); err != nil { + return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error()) + } + emitter.buffer_pos = 0 + return true +} diff --git a/vendor/go.yaml.in/yaml/v3/yaml.go b/vendor/go.yaml.in/yaml/v3/yaml.go new file mode 100644 index 000000000..0b101cd20 --- /dev/null +++ b/vendor/go.yaml.in/yaml/v3/yaml.go @@ -0,0 +1,703 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// +// 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 yaml implements YAML support for the Go language. +// +// Source code and other details for the project are available at GitHub: +// +// https://github.com/yaml/go-yaml +package yaml + +import ( + "errors" + "fmt" + "io" + "reflect" + "strings" + "sync" + "unicode/utf8" +) + +// The Unmarshaler interface may be implemented by types to customize their +// behavior when being unmarshaled from a YAML document. +type Unmarshaler interface { + UnmarshalYAML(value *Node) error +} + +type obsoleteUnmarshaler interface { + UnmarshalYAML(unmarshal func(interface{}) error) error +} + +// The Marshaler interface may be implemented by types to customize their +// behavior when being marshaled into a YAML document. The returned value +// is marshaled in place of the original value implementing Marshaler. +// +// If an error is returned by MarshalYAML, the marshaling procedure stops +// and returns with the provided error. +type Marshaler interface { + MarshalYAML() (interface{}, error) +} + +// Unmarshal decodes the first document found within the in byte slice +// and assigns decoded values into the out value. +// +// Maps and pointers (to a struct, string, int, etc) are accepted as out +// values. If an internal pointer within a struct is not initialized, +// the yaml package will initialize it if necessary for unmarshalling +// the provided data. The out parameter must not be nil. +// +// The type of the decoded values should be compatible with the respective +// values in out. If one or more values cannot be decoded due to a type +// mismatches, decoding continues partially until the end of the YAML +// content, and a *yaml.TypeError is returned with details for all +// missed values. +// +// Struct fields are only unmarshalled if they are exported (have an +// upper case first letter), and are unmarshalled using the field name +// lowercased as the default key. Custom keys may be defined via the +// "yaml" name in the field tag: the content preceding the first comma +// is used as the key, and the following comma-separated options are +// used to tweak the marshalling process (see Marshal). +// Conflicting names result in a runtime error. +// +// For example: +// +// type T struct { +// F int `yaml:"a,omitempty"` +// B int +// } +// var t T +// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t) +// +// See the documentation of Marshal for the format of tags and a list of +// supported tag options. +func Unmarshal(in []byte, out interface{}) (err error) { + return unmarshal(in, out, false) +} + +// A Decoder reads and decodes YAML values from an input stream. +type Decoder struct { + parser *parser + knownFields bool +} + +// NewDecoder returns a new decoder that reads from r. +// +// The decoder introduces its own buffering and may read +// data from r beyond the YAML values requested. +func NewDecoder(r io.Reader) *Decoder { + return &Decoder{ + parser: newParserFromReader(r), + } +} + +// KnownFields ensures that the keys in decoded mappings to +// exist as fields in the struct being decoded into. +func (dec *Decoder) KnownFields(enable bool) { + dec.knownFields = enable +} + +// Decode reads the next YAML-encoded value from its input +// and stores it in the value pointed to by v. +// +// See the documentation for Unmarshal for details about the +// conversion of YAML into a Go value. +func (dec *Decoder) Decode(v interface{}) (err error) { + d := newDecoder() + d.knownFields = dec.knownFields + defer handleErr(&err) + node := dec.parser.parse() + if node == nil { + return io.EOF + } + out := reflect.ValueOf(v) + if out.Kind() == reflect.Ptr && !out.IsNil() { + out = out.Elem() + } + d.unmarshal(node, out) + if len(d.terrors) > 0 { + return &TypeError{d.terrors} + } + return nil +} + +// Decode decodes the node and stores its data into the value pointed to by v. +// +// See the documentation for Unmarshal for details about the +// conversion of YAML into a Go value. +func (n *Node) Decode(v interface{}) (err error) { + d := newDecoder() + defer handleErr(&err) + out := reflect.ValueOf(v) + if out.Kind() == reflect.Ptr && !out.IsNil() { + out = out.Elem() + } + d.unmarshal(n, out) + if len(d.terrors) > 0 { + return &TypeError{d.terrors} + } + return nil +} + +func unmarshal(in []byte, out interface{}, strict bool) (err error) { + defer handleErr(&err) + d := newDecoder() + p := newParser(in) + defer p.destroy() + node := p.parse() + if node != nil { + v := reflect.ValueOf(out) + if v.Kind() == reflect.Ptr && !v.IsNil() { + v = v.Elem() + } + d.unmarshal(node, v) + } + if len(d.terrors) > 0 { + return &TypeError{d.terrors} + } + return nil +} + +// Marshal serializes the value provided into a YAML document. The structure +// of the generated document will reflect the structure of the value itself. +// Maps and pointers (to struct, string, int, etc) are accepted as the in value. +// +// Struct fields are only marshalled if they are exported (have an upper case +// first letter), and are marshalled using the field name lowercased as the +// default key. Custom keys may be defined via the "yaml" name in the field +// tag: the content preceding the first comma is used as the key, and the +// following comma-separated options are used to tweak the marshalling process. +// Conflicting names result in a runtime error. +// +// The field tag format accepted is: +// +// `(...) yaml:"[][,[,]]" (...)` +// +// The following flags are currently supported: +// +// omitempty Only include the field if it's not set to the zero +// value for the type or to empty slices or maps. +// Zero valued structs will be omitted if all their public +// fields are zero, unless they implement an IsZero +// method (see the IsZeroer interface type), in which +// case the field will be excluded if IsZero returns true. +// +// flow Marshal using a flow style (useful for structs, +// sequences and maps). +// +// inline Inline the field, which must be a struct or a map, +// causing all of its fields or keys to be processed as if +// they were part of the outer struct. For maps, keys must +// not conflict with the yaml keys of other struct fields. +// +// In addition, if the key is "-", the field is ignored. +// +// For example: +// +// type T struct { +// F int `yaml:"a,omitempty"` +// B int +// } +// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n" +// yaml.Marshal(&T{F: 1}} // Returns "a: 1\nb: 0\n" +func Marshal(in interface{}) (out []byte, err error) { + defer handleErr(&err) + e := newEncoder() + defer e.destroy() + e.marshalDoc("", reflect.ValueOf(in)) + e.finish() + out = e.out + return +} + +// An Encoder writes YAML values to an output stream. +type Encoder struct { + encoder *encoder +} + +// NewEncoder returns a new encoder that writes to w. +// The Encoder should be closed after use to flush all data +// to w. +func NewEncoder(w io.Writer) *Encoder { + return &Encoder{ + encoder: newEncoderWithWriter(w), + } +} + +// Encode writes the YAML encoding of v to the stream. +// If multiple items are encoded to the stream, the +// second and subsequent document will be preceded +// with a "---" document separator, but the first will not. +// +// See the documentation for Marshal for details about the conversion of Go +// values to YAML. +func (e *Encoder) Encode(v interface{}) (err error) { + defer handleErr(&err) + e.encoder.marshalDoc("", reflect.ValueOf(v)) + return nil +} + +// Encode encodes value v and stores its representation in n. +// +// See the documentation for Marshal for details about the +// conversion of Go values into YAML. +func (n *Node) Encode(v interface{}) (err error) { + defer handleErr(&err) + e := newEncoder() + defer e.destroy() + e.marshalDoc("", reflect.ValueOf(v)) + e.finish() + p := newParser(e.out) + p.textless = true + defer p.destroy() + doc := p.parse() + *n = *doc.Content[0] + return nil +} + +// SetIndent changes the used indentation used when encoding. +func (e *Encoder) SetIndent(spaces int) { + if spaces < 0 { + panic("yaml: cannot indent to a negative number of spaces") + } + e.encoder.indent = spaces +} + +// CompactSeqIndent makes it so that '- ' is considered part of the indentation. +func (e *Encoder) CompactSeqIndent() { + e.encoder.emitter.compact_sequence_indent = true +} + +// DefaultSeqIndent makes it so that '- ' is not considered part of the indentation. +func (e *Encoder) DefaultSeqIndent() { + e.encoder.emitter.compact_sequence_indent = false +} + +// Close closes the encoder by writing any remaining data. +// It does not write a stream terminating string "...". +func (e *Encoder) Close() (err error) { + defer handleErr(&err) + e.encoder.finish() + return nil +} + +func handleErr(err *error) { + if v := recover(); v != nil { + if e, ok := v.(yamlError); ok { + *err = e.err + } else { + panic(v) + } + } +} + +type yamlError struct { + err error +} + +func fail(err error) { + panic(yamlError{err}) +} + +func failf(format string, args ...interface{}) { + panic(yamlError{fmt.Errorf("yaml: "+format, args...)}) +} + +// A TypeError is returned by Unmarshal when one or more fields in +// the YAML document cannot be properly decoded into the requested +// types. When this error is returned, the value is still +// unmarshaled partially. +type TypeError struct { + Errors []string +} + +func (e *TypeError) Error() string { + return fmt.Sprintf("yaml: unmarshal errors:\n %s", strings.Join(e.Errors, "\n ")) +} + +type Kind uint32 + +const ( + DocumentNode Kind = 1 << iota + SequenceNode + MappingNode + ScalarNode + AliasNode +) + +type Style uint32 + +const ( + TaggedStyle Style = 1 << iota + DoubleQuotedStyle + SingleQuotedStyle + LiteralStyle + FoldedStyle + FlowStyle +) + +// Node represents an element in the YAML document hierarchy. While documents +// are typically encoded and decoded into higher level types, such as structs +// and maps, Node is an intermediate representation that allows detailed +// control over the content being decoded or encoded. +// +// It's worth noting that although Node offers access into details such as +// line numbers, colums, and comments, the content when re-encoded will not +// have its original textual representation preserved. An effort is made to +// render the data plesantly, and to preserve comments near the data they +// describe, though. +// +// Values that make use of the Node type interact with the yaml package in the +// same way any other type would do, by encoding and decoding yaml data +// directly or indirectly into them. +// +// For example: +// +// var person struct { +// Name string +// Address yaml.Node +// } +// err := yaml.Unmarshal(data, &person) +// +// Or by itself: +// +// var person Node +// err := yaml.Unmarshal(data, &person) +type Node struct { + // Kind defines whether the node is a document, a mapping, a sequence, + // a scalar value, or an alias to another node. The specific data type of + // scalar nodes may be obtained via the ShortTag and LongTag methods. + Kind Kind + + // Style allows customizing the apperance of the node in the tree. + Style Style + + // Tag holds the YAML tag defining the data type for the value. + // When decoding, this field will always be set to the resolved tag, + // even when it wasn't explicitly provided in the YAML content. + // When encoding, if this field is unset the value type will be + // implied from the node properties, and if it is set, it will only + // be serialized into the representation if TaggedStyle is used or + // the implicit tag diverges from the provided one. + Tag string + + // Value holds the unescaped and unquoted represenation of the value. + Value string + + // Anchor holds the anchor name for this node, which allows aliases to point to it. + Anchor string + + // Alias holds the node that this alias points to. Only valid when Kind is AliasNode. + Alias *Node + + // Content holds contained nodes for documents, mappings, and sequences. + Content []*Node + + // HeadComment holds any comments in the lines preceding the node and + // not separated by an empty line. + HeadComment string + + // LineComment holds any comments at the end of the line where the node is in. + LineComment string + + // FootComment holds any comments following the node and before empty lines. + FootComment string + + // Line and Column hold the node position in the decoded YAML text. + // These fields are not respected when encoding the node. + Line int + Column int +} + +// IsZero returns whether the node has all of its fields unset. +func (n *Node) IsZero() bool { + return n.Kind == 0 && n.Style == 0 && n.Tag == "" && n.Value == "" && n.Anchor == "" && n.Alias == nil && n.Content == nil && + n.HeadComment == "" && n.LineComment == "" && n.FootComment == "" && n.Line == 0 && n.Column == 0 +} + +// LongTag returns the long form of the tag that indicates the data type for +// the node. If the Tag field isn't explicitly defined, one will be computed +// based on the node properties. +func (n *Node) LongTag() string { + return longTag(n.ShortTag()) +} + +// ShortTag returns the short form of the YAML tag that indicates data type for +// the node. If the Tag field isn't explicitly defined, one will be computed +// based on the node properties. +func (n *Node) ShortTag() string { + if n.indicatedString() { + return strTag + } + if n.Tag == "" || n.Tag == "!" { + switch n.Kind { + case MappingNode: + return mapTag + case SequenceNode: + return seqTag + case AliasNode: + if n.Alias != nil { + return n.Alias.ShortTag() + } + case ScalarNode: + tag, _ := resolve("", n.Value) + return tag + case 0: + // Special case to make the zero value convenient. + if n.IsZero() { + return nullTag + } + } + return "" + } + return shortTag(n.Tag) +} + +func (n *Node) indicatedString() bool { + return n.Kind == ScalarNode && + (shortTag(n.Tag) == strTag || + (n.Tag == "" || n.Tag == "!") && n.Style&(SingleQuotedStyle|DoubleQuotedStyle|LiteralStyle|FoldedStyle) != 0) +} + +// SetString is a convenience function that sets the node to a string value +// and defines its style in a pleasant way depending on its content. +func (n *Node) SetString(s string) { + n.Kind = ScalarNode + if utf8.ValidString(s) { + n.Value = s + n.Tag = strTag + } else { + n.Value = encodeBase64(s) + n.Tag = binaryTag + } + if strings.Contains(n.Value, "\n") { + n.Style = LiteralStyle + } +} + +// -------------------------------------------------------------------------- +// Maintain a mapping of keys to structure field indexes + +// The code in this section was copied from mgo/bson. + +// structInfo holds details for the serialization of fields of +// a given struct. +type structInfo struct { + FieldsMap map[string]fieldInfo + FieldsList []fieldInfo + + // InlineMap is the number of the field in the struct that + // contains an ,inline map, or -1 if there's none. + InlineMap int + + // InlineUnmarshalers holds indexes to inlined fields that + // contain unmarshaler values. + InlineUnmarshalers [][]int +} + +type fieldInfo struct { + Key string + Num int + OmitEmpty bool + Flow bool + // Id holds the unique field identifier, so we can cheaply + // check for field duplicates without maintaining an extra map. + Id int + + // Inline holds the field index if the field is part of an inlined struct. + Inline []int +} + +var structMap = make(map[reflect.Type]*structInfo) +var fieldMapMutex sync.RWMutex +var unmarshalerType reflect.Type + +func init() { + var v Unmarshaler + unmarshalerType = reflect.ValueOf(&v).Elem().Type() +} + +func getStructInfo(st reflect.Type) (*structInfo, error) { + fieldMapMutex.RLock() + sinfo, found := structMap[st] + fieldMapMutex.RUnlock() + if found { + return sinfo, nil + } + + n := st.NumField() + fieldsMap := make(map[string]fieldInfo) + fieldsList := make([]fieldInfo, 0, n) + inlineMap := -1 + inlineUnmarshalers := [][]int(nil) + for i := 0; i != n; i++ { + field := st.Field(i) + if field.PkgPath != "" && !field.Anonymous { + continue // Private field + } + + info := fieldInfo{Num: i} + + tag := field.Tag.Get("yaml") + if tag == "" && strings.Index(string(field.Tag), ":") < 0 { + tag = string(field.Tag) + } + if tag == "-" { + continue + } + + inline := false + fields := strings.Split(tag, ",") + if len(fields) > 1 { + for _, flag := range fields[1:] { + switch flag { + case "omitempty": + info.OmitEmpty = true + case "flow": + info.Flow = true + case "inline": + inline = true + default: + return nil, errors.New(fmt.Sprintf("unsupported flag %q in tag %q of type %s", flag, tag, st)) + } + } + tag = fields[0] + } + + if inline { + switch field.Type.Kind() { + case reflect.Map: + if inlineMap >= 0 { + return nil, errors.New("multiple ,inline maps in struct " + st.String()) + } + if field.Type.Key() != reflect.TypeOf("") { + return nil, errors.New("option ,inline needs a map with string keys in struct " + st.String()) + } + inlineMap = info.Num + case reflect.Struct, reflect.Ptr: + ftype := field.Type + for ftype.Kind() == reflect.Ptr { + ftype = ftype.Elem() + } + if ftype.Kind() != reflect.Struct { + return nil, errors.New("option ,inline may only be used on a struct or map field") + } + if reflect.PtrTo(ftype).Implements(unmarshalerType) { + inlineUnmarshalers = append(inlineUnmarshalers, []int{i}) + } else { + sinfo, err := getStructInfo(ftype) + if err != nil { + return nil, err + } + for _, index := range sinfo.InlineUnmarshalers { + inlineUnmarshalers = append(inlineUnmarshalers, append([]int{i}, index...)) + } + for _, finfo := range sinfo.FieldsList { + if _, found := fieldsMap[finfo.Key]; found { + msg := "duplicated key '" + finfo.Key + "' in struct " + st.String() + return nil, errors.New(msg) + } + if finfo.Inline == nil { + finfo.Inline = []int{i, finfo.Num} + } else { + finfo.Inline = append([]int{i}, finfo.Inline...) + } + finfo.Id = len(fieldsList) + fieldsMap[finfo.Key] = finfo + fieldsList = append(fieldsList, finfo) + } + } + default: + return nil, errors.New("option ,inline may only be used on a struct or map field") + } + continue + } + + if tag != "" { + info.Key = tag + } else { + info.Key = strings.ToLower(field.Name) + } + + if _, found = fieldsMap[info.Key]; found { + msg := "duplicated key '" + info.Key + "' in struct " + st.String() + return nil, errors.New(msg) + } + + info.Id = len(fieldsList) + fieldsList = append(fieldsList, info) + fieldsMap[info.Key] = info + } + + sinfo = &structInfo{ + FieldsMap: fieldsMap, + FieldsList: fieldsList, + InlineMap: inlineMap, + InlineUnmarshalers: inlineUnmarshalers, + } + + fieldMapMutex.Lock() + structMap[st] = sinfo + fieldMapMutex.Unlock() + return sinfo, nil +} + +// IsZeroer is used to check whether an object is zero to +// determine whether it should be omitted when marshaling +// with the omitempty flag. One notable implementation +// is time.Time. +type IsZeroer interface { + IsZero() bool +} + +func isZero(v reflect.Value) bool { + kind := v.Kind() + if z, ok := v.Interface().(IsZeroer); ok { + if (kind == reflect.Ptr || kind == reflect.Interface) && v.IsNil() { + return true + } + return z.IsZero() + } + switch kind { + case reflect.String: + return len(v.String()) == 0 + case reflect.Interface, reflect.Ptr: + return v.IsNil() + case reflect.Slice: + return v.Len() == 0 + case reflect.Map: + return v.Len() == 0 + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return v.Int() == 0 + case reflect.Float32, reflect.Float64: + return v.Float() == 0 + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return v.Uint() == 0 + case reflect.Bool: + return !v.Bool() + case reflect.Struct: + vt := v.Type() + for i := v.NumField() - 1; i >= 0; i-- { + if vt.Field(i).PkgPath != "" { + continue // Private field + } + if !isZero(v.Field(i)) { + return false + } + } + return true + } + return false +} diff --git a/vendor/go.yaml.in/yaml/v3/yamlh.go b/vendor/go.yaml.in/yaml/v3/yamlh.go new file mode 100644 index 000000000..f59aa40f6 --- /dev/null +++ b/vendor/go.yaml.in/yaml/v3/yamlh.go @@ -0,0 +1,811 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// Copyright (c) 2006-2010 Kirill Simonov +// +// 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. + +package yaml + +import ( + "fmt" + "io" +) + +// The version directive data. +type yaml_version_directive_t struct { + major int8 // The major version number. + minor int8 // The minor version number. +} + +// The tag directive data. +type yaml_tag_directive_t struct { + handle []byte // The tag handle. + prefix []byte // The tag prefix. +} + +type yaml_encoding_t int + +// The stream encoding. +const ( + // Let the parser choose the encoding. + yaml_ANY_ENCODING yaml_encoding_t = iota + + yaml_UTF8_ENCODING // The default UTF-8 encoding. + yaml_UTF16LE_ENCODING // The UTF-16-LE encoding with BOM. + yaml_UTF16BE_ENCODING // The UTF-16-BE encoding with BOM. +) + +type yaml_break_t int + +// Line break types. +const ( + // Let the parser choose the break type. + yaml_ANY_BREAK yaml_break_t = iota + + yaml_CR_BREAK // Use CR for line breaks (Mac style). + yaml_LN_BREAK // Use LN for line breaks (Unix style). + yaml_CRLN_BREAK // Use CR LN for line breaks (DOS style). +) + +type yaml_error_type_t int + +// Many bad things could happen with the parser and emitter. +const ( + // No error is produced. + yaml_NO_ERROR yaml_error_type_t = iota + + yaml_MEMORY_ERROR // Cannot allocate or reallocate a block of memory. + yaml_READER_ERROR // Cannot read or decode the input stream. + yaml_SCANNER_ERROR // Cannot scan the input stream. + yaml_PARSER_ERROR // Cannot parse the input stream. + yaml_COMPOSER_ERROR // Cannot compose a YAML document. + yaml_WRITER_ERROR // Cannot write to the output stream. + yaml_EMITTER_ERROR // Cannot emit a YAML stream. +) + +// The pointer position. +type yaml_mark_t struct { + index int // The position index. + line int // The position line. + column int // The position column. +} + +// Node Styles + +type yaml_style_t int8 + +type yaml_scalar_style_t yaml_style_t + +// Scalar styles. +const ( + // Let the emitter choose the style. + yaml_ANY_SCALAR_STYLE yaml_scalar_style_t = 0 + + yaml_PLAIN_SCALAR_STYLE yaml_scalar_style_t = 1 << iota // The plain scalar style. + yaml_SINGLE_QUOTED_SCALAR_STYLE // The single-quoted scalar style. + yaml_DOUBLE_QUOTED_SCALAR_STYLE // The double-quoted scalar style. + yaml_LITERAL_SCALAR_STYLE // The literal scalar style. + yaml_FOLDED_SCALAR_STYLE // The folded scalar style. +) + +type yaml_sequence_style_t yaml_style_t + +// Sequence styles. +const ( + // Let the emitter choose the style. + yaml_ANY_SEQUENCE_STYLE yaml_sequence_style_t = iota + + yaml_BLOCK_SEQUENCE_STYLE // The block sequence style. + yaml_FLOW_SEQUENCE_STYLE // The flow sequence style. +) + +type yaml_mapping_style_t yaml_style_t + +// Mapping styles. +const ( + // Let the emitter choose the style. + yaml_ANY_MAPPING_STYLE yaml_mapping_style_t = iota + + yaml_BLOCK_MAPPING_STYLE // The block mapping style. + yaml_FLOW_MAPPING_STYLE // The flow mapping style. +) + +// Tokens + +type yaml_token_type_t int + +// Token types. +const ( + // An empty token. + yaml_NO_TOKEN yaml_token_type_t = iota + + yaml_STREAM_START_TOKEN // A STREAM-START token. + yaml_STREAM_END_TOKEN // A STREAM-END token. + + yaml_VERSION_DIRECTIVE_TOKEN // A VERSION-DIRECTIVE token. + yaml_TAG_DIRECTIVE_TOKEN // A TAG-DIRECTIVE token. + yaml_DOCUMENT_START_TOKEN // A DOCUMENT-START token. + yaml_DOCUMENT_END_TOKEN // A DOCUMENT-END token. + + yaml_BLOCK_SEQUENCE_START_TOKEN // A BLOCK-SEQUENCE-START token. + yaml_BLOCK_MAPPING_START_TOKEN // A BLOCK-SEQUENCE-END token. + yaml_BLOCK_END_TOKEN // A BLOCK-END token. + + yaml_FLOW_SEQUENCE_START_TOKEN // A FLOW-SEQUENCE-START token. + yaml_FLOW_SEQUENCE_END_TOKEN // A FLOW-SEQUENCE-END token. + yaml_FLOW_MAPPING_START_TOKEN // A FLOW-MAPPING-START token. + yaml_FLOW_MAPPING_END_TOKEN // A FLOW-MAPPING-END token. + + yaml_BLOCK_ENTRY_TOKEN // A BLOCK-ENTRY token. + yaml_FLOW_ENTRY_TOKEN // A FLOW-ENTRY token. + yaml_KEY_TOKEN // A KEY token. + yaml_VALUE_TOKEN // A VALUE token. + + yaml_ALIAS_TOKEN // An ALIAS token. + yaml_ANCHOR_TOKEN // An ANCHOR token. + yaml_TAG_TOKEN // A TAG token. + yaml_SCALAR_TOKEN // A SCALAR token. +) + +func (tt yaml_token_type_t) String() string { + switch tt { + case yaml_NO_TOKEN: + return "yaml_NO_TOKEN" + case yaml_STREAM_START_TOKEN: + return "yaml_STREAM_START_TOKEN" + case yaml_STREAM_END_TOKEN: + return "yaml_STREAM_END_TOKEN" + case yaml_VERSION_DIRECTIVE_TOKEN: + return "yaml_VERSION_DIRECTIVE_TOKEN" + case yaml_TAG_DIRECTIVE_TOKEN: + return "yaml_TAG_DIRECTIVE_TOKEN" + case yaml_DOCUMENT_START_TOKEN: + return "yaml_DOCUMENT_START_TOKEN" + case yaml_DOCUMENT_END_TOKEN: + return "yaml_DOCUMENT_END_TOKEN" + case yaml_BLOCK_SEQUENCE_START_TOKEN: + return "yaml_BLOCK_SEQUENCE_START_TOKEN" + case yaml_BLOCK_MAPPING_START_TOKEN: + return "yaml_BLOCK_MAPPING_START_TOKEN" + case yaml_BLOCK_END_TOKEN: + return "yaml_BLOCK_END_TOKEN" + case yaml_FLOW_SEQUENCE_START_TOKEN: + return "yaml_FLOW_SEQUENCE_START_TOKEN" + case yaml_FLOW_SEQUENCE_END_TOKEN: + return "yaml_FLOW_SEQUENCE_END_TOKEN" + case yaml_FLOW_MAPPING_START_TOKEN: + return "yaml_FLOW_MAPPING_START_TOKEN" + case yaml_FLOW_MAPPING_END_TOKEN: + return "yaml_FLOW_MAPPING_END_TOKEN" + case yaml_BLOCK_ENTRY_TOKEN: + return "yaml_BLOCK_ENTRY_TOKEN" + case yaml_FLOW_ENTRY_TOKEN: + return "yaml_FLOW_ENTRY_TOKEN" + case yaml_KEY_TOKEN: + return "yaml_KEY_TOKEN" + case yaml_VALUE_TOKEN: + return "yaml_VALUE_TOKEN" + case yaml_ALIAS_TOKEN: + return "yaml_ALIAS_TOKEN" + case yaml_ANCHOR_TOKEN: + return "yaml_ANCHOR_TOKEN" + case yaml_TAG_TOKEN: + return "yaml_TAG_TOKEN" + case yaml_SCALAR_TOKEN: + return "yaml_SCALAR_TOKEN" + } + return "" +} + +// The token structure. +type yaml_token_t struct { + // The token type. + typ yaml_token_type_t + + // The start/end of the token. + start_mark, end_mark yaml_mark_t + + // The stream encoding (for yaml_STREAM_START_TOKEN). + encoding yaml_encoding_t + + // The alias/anchor/scalar value or tag/tag directive handle + // (for yaml_ALIAS_TOKEN, yaml_ANCHOR_TOKEN, yaml_SCALAR_TOKEN, yaml_TAG_TOKEN, yaml_TAG_DIRECTIVE_TOKEN). + value []byte + + // The tag suffix (for yaml_TAG_TOKEN). + suffix []byte + + // The tag directive prefix (for yaml_TAG_DIRECTIVE_TOKEN). + prefix []byte + + // The scalar style (for yaml_SCALAR_TOKEN). + style yaml_scalar_style_t + + // The version directive major/minor (for yaml_VERSION_DIRECTIVE_TOKEN). + major, minor int8 +} + +// Events + +type yaml_event_type_t int8 + +// Event types. +const ( + // An empty event. + yaml_NO_EVENT yaml_event_type_t = iota + + yaml_STREAM_START_EVENT // A STREAM-START event. + yaml_STREAM_END_EVENT // A STREAM-END event. + yaml_DOCUMENT_START_EVENT // A DOCUMENT-START event. + yaml_DOCUMENT_END_EVENT // A DOCUMENT-END event. + yaml_ALIAS_EVENT // An ALIAS event. + yaml_SCALAR_EVENT // A SCALAR event. + yaml_SEQUENCE_START_EVENT // A SEQUENCE-START event. + yaml_SEQUENCE_END_EVENT // A SEQUENCE-END event. + yaml_MAPPING_START_EVENT // A MAPPING-START event. + yaml_MAPPING_END_EVENT // A MAPPING-END event. + yaml_TAIL_COMMENT_EVENT +) + +var eventStrings = []string{ + yaml_NO_EVENT: "none", + yaml_STREAM_START_EVENT: "stream start", + yaml_STREAM_END_EVENT: "stream end", + yaml_DOCUMENT_START_EVENT: "document start", + yaml_DOCUMENT_END_EVENT: "document end", + yaml_ALIAS_EVENT: "alias", + yaml_SCALAR_EVENT: "scalar", + yaml_SEQUENCE_START_EVENT: "sequence start", + yaml_SEQUENCE_END_EVENT: "sequence end", + yaml_MAPPING_START_EVENT: "mapping start", + yaml_MAPPING_END_EVENT: "mapping end", + yaml_TAIL_COMMENT_EVENT: "tail comment", +} + +func (e yaml_event_type_t) String() string { + if e < 0 || int(e) >= len(eventStrings) { + return fmt.Sprintf("unknown event %d", e) + } + return eventStrings[e] +} + +// The event structure. +type yaml_event_t struct { + + // The event type. + typ yaml_event_type_t + + // The start and end of the event. + start_mark, end_mark yaml_mark_t + + // The document encoding (for yaml_STREAM_START_EVENT). + encoding yaml_encoding_t + + // The version directive (for yaml_DOCUMENT_START_EVENT). + version_directive *yaml_version_directive_t + + // The list of tag directives (for yaml_DOCUMENT_START_EVENT). + tag_directives []yaml_tag_directive_t + + // The comments + head_comment []byte + line_comment []byte + foot_comment []byte + tail_comment []byte + + // The anchor (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT, yaml_ALIAS_EVENT). + anchor []byte + + // The tag (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT). + tag []byte + + // The scalar value (for yaml_SCALAR_EVENT). + value []byte + + // Is the document start/end indicator implicit, or the tag optional? + // (for yaml_DOCUMENT_START_EVENT, yaml_DOCUMENT_END_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT, yaml_SCALAR_EVENT). + implicit bool + + // Is the tag optional for any non-plain style? (for yaml_SCALAR_EVENT). + quoted_implicit bool + + // The style (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT). + style yaml_style_t +} + +func (e *yaml_event_t) scalar_style() yaml_scalar_style_t { return yaml_scalar_style_t(e.style) } +func (e *yaml_event_t) sequence_style() yaml_sequence_style_t { return yaml_sequence_style_t(e.style) } +func (e *yaml_event_t) mapping_style() yaml_mapping_style_t { return yaml_mapping_style_t(e.style) } + +// Nodes + +const ( + yaml_NULL_TAG = "tag:yaml.org,2002:null" // The tag !!null with the only possible value: null. + yaml_BOOL_TAG = "tag:yaml.org,2002:bool" // The tag !!bool with the values: true and false. + yaml_STR_TAG = "tag:yaml.org,2002:str" // The tag !!str for string values. + yaml_INT_TAG = "tag:yaml.org,2002:int" // The tag !!int for integer values. + yaml_FLOAT_TAG = "tag:yaml.org,2002:float" // The tag !!float for float values. + yaml_TIMESTAMP_TAG = "tag:yaml.org,2002:timestamp" // The tag !!timestamp for date and time values. + + yaml_SEQ_TAG = "tag:yaml.org,2002:seq" // The tag !!seq is used to denote sequences. + yaml_MAP_TAG = "tag:yaml.org,2002:map" // The tag !!map is used to denote mapping. + + // Not in original libyaml. + yaml_BINARY_TAG = "tag:yaml.org,2002:binary" + yaml_MERGE_TAG = "tag:yaml.org,2002:merge" + + yaml_DEFAULT_SCALAR_TAG = yaml_STR_TAG // The default scalar tag is !!str. + yaml_DEFAULT_SEQUENCE_TAG = yaml_SEQ_TAG // The default sequence tag is !!seq. + yaml_DEFAULT_MAPPING_TAG = yaml_MAP_TAG // The default mapping tag is !!map. +) + +type yaml_node_type_t int + +// Node types. +const ( + // An empty node. + yaml_NO_NODE yaml_node_type_t = iota + + yaml_SCALAR_NODE // A scalar node. + yaml_SEQUENCE_NODE // A sequence node. + yaml_MAPPING_NODE // A mapping node. +) + +// An element of a sequence node. +type yaml_node_item_t int + +// An element of a mapping node. +type yaml_node_pair_t struct { + key int // The key of the element. + value int // The value of the element. +} + +// The node structure. +type yaml_node_t struct { + typ yaml_node_type_t // The node type. + tag []byte // The node tag. + + // The node data. + + // The scalar parameters (for yaml_SCALAR_NODE). + scalar struct { + value []byte // The scalar value. + length int // The length of the scalar value. + style yaml_scalar_style_t // The scalar style. + } + + // The sequence parameters (for YAML_SEQUENCE_NODE). + sequence struct { + items_data []yaml_node_item_t // The stack of sequence items. + style yaml_sequence_style_t // The sequence style. + } + + // The mapping parameters (for yaml_MAPPING_NODE). + mapping struct { + pairs_data []yaml_node_pair_t // The stack of mapping pairs (key, value). + pairs_start *yaml_node_pair_t // The beginning of the stack. + pairs_end *yaml_node_pair_t // The end of the stack. + pairs_top *yaml_node_pair_t // The top of the stack. + style yaml_mapping_style_t // The mapping style. + } + + start_mark yaml_mark_t // The beginning of the node. + end_mark yaml_mark_t // The end of the node. + +} + +// The document structure. +type yaml_document_t struct { + + // The document nodes. + nodes []yaml_node_t + + // The version directive. + version_directive *yaml_version_directive_t + + // The list of tag directives. + tag_directives_data []yaml_tag_directive_t + tag_directives_start int // The beginning of the tag directives list. + tag_directives_end int // The end of the tag directives list. + + start_implicit int // Is the document start indicator implicit? + end_implicit int // Is the document end indicator implicit? + + // The start/end of the document. + start_mark, end_mark yaml_mark_t +} + +// The prototype of a read handler. +// +// The read handler is called when the parser needs to read more bytes from the +// source. The handler should write not more than size bytes to the buffer. +// The number of written bytes should be set to the size_read variable. +// +// [in,out] data A pointer to an application data specified by +// +// yaml_parser_set_input(). +// +// [out] buffer The buffer to write the data from the source. +// [in] size The size of the buffer. +// [out] size_read The actual number of bytes read from the source. +// +// On success, the handler should return 1. If the handler failed, +// the returned value should be 0. On EOF, the handler should set the +// size_read to 0 and return 1. +type yaml_read_handler_t func(parser *yaml_parser_t, buffer []byte) (n int, err error) + +// This structure holds information about a potential simple key. +type yaml_simple_key_t struct { + possible bool // Is a simple key possible? + required bool // Is a simple key required? + token_number int // The number of the token. + mark yaml_mark_t // The position mark. +} + +// The states of the parser. +type yaml_parser_state_t int + +const ( + yaml_PARSE_STREAM_START_STATE yaml_parser_state_t = iota + + yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE // Expect the beginning of an implicit document. + yaml_PARSE_DOCUMENT_START_STATE // Expect DOCUMENT-START. + yaml_PARSE_DOCUMENT_CONTENT_STATE // Expect the content of a document. + yaml_PARSE_DOCUMENT_END_STATE // Expect DOCUMENT-END. + yaml_PARSE_BLOCK_NODE_STATE // Expect a block node. + yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE // Expect a block node or indentless sequence. + yaml_PARSE_FLOW_NODE_STATE // Expect a flow node. + yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE // Expect the first entry of a block sequence. + yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE // Expect an entry of a block sequence. + yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE // Expect an entry of an indentless sequence. + yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE // Expect the first key of a block mapping. + yaml_PARSE_BLOCK_MAPPING_KEY_STATE // Expect a block mapping key. + yaml_PARSE_BLOCK_MAPPING_VALUE_STATE // Expect a block mapping value. + yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE // Expect the first entry of a flow sequence. + yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE // Expect an entry of a flow sequence. + yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE // Expect a key of an ordered mapping. + yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE // Expect a value of an ordered mapping. + yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE // Expect the and of an ordered mapping entry. + yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE // Expect the first key of a flow mapping. + yaml_PARSE_FLOW_MAPPING_KEY_STATE // Expect a key of a flow mapping. + yaml_PARSE_FLOW_MAPPING_VALUE_STATE // Expect a value of a flow mapping. + yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE // Expect an empty value of a flow mapping. + yaml_PARSE_END_STATE // Expect nothing. +) + +func (ps yaml_parser_state_t) String() string { + switch ps { + case yaml_PARSE_STREAM_START_STATE: + return "yaml_PARSE_STREAM_START_STATE" + case yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE: + return "yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE" + case yaml_PARSE_DOCUMENT_START_STATE: + return "yaml_PARSE_DOCUMENT_START_STATE" + case yaml_PARSE_DOCUMENT_CONTENT_STATE: + return "yaml_PARSE_DOCUMENT_CONTENT_STATE" + case yaml_PARSE_DOCUMENT_END_STATE: + return "yaml_PARSE_DOCUMENT_END_STATE" + case yaml_PARSE_BLOCK_NODE_STATE: + return "yaml_PARSE_BLOCK_NODE_STATE" + case yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE: + return "yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE" + case yaml_PARSE_FLOW_NODE_STATE: + return "yaml_PARSE_FLOW_NODE_STATE" + case yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE: + return "yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE" + case yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE: + return "yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE" + case yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE: + return "yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE" + case yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE: + return "yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE" + case yaml_PARSE_BLOCK_MAPPING_KEY_STATE: + return "yaml_PARSE_BLOCK_MAPPING_KEY_STATE" + case yaml_PARSE_BLOCK_MAPPING_VALUE_STATE: + return "yaml_PARSE_BLOCK_MAPPING_VALUE_STATE" + case yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE: + return "yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE" + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE: + return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE" + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE: + return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE" + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE: + return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE" + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE: + return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE" + case yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE: + return "yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE" + case yaml_PARSE_FLOW_MAPPING_KEY_STATE: + return "yaml_PARSE_FLOW_MAPPING_KEY_STATE" + case yaml_PARSE_FLOW_MAPPING_VALUE_STATE: + return "yaml_PARSE_FLOW_MAPPING_VALUE_STATE" + case yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE: + return "yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE" + case yaml_PARSE_END_STATE: + return "yaml_PARSE_END_STATE" + } + return "" +} + +// This structure holds aliases data. +type yaml_alias_data_t struct { + anchor []byte // The anchor. + index int // The node id. + mark yaml_mark_t // The anchor mark. +} + +// The parser structure. +// +// All members are internal. Manage the structure using the +// yaml_parser_ family of functions. +type yaml_parser_t struct { + + // Error handling + + error yaml_error_type_t // Error type. + + problem string // Error description. + + // The byte about which the problem occurred. + problem_offset int + problem_value int + problem_mark yaml_mark_t + + // The error context. + context string + context_mark yaml_mark_t + + // Reader stuff + + read_handler yaml_read_handler_t // Read handler. + + input_reader io.Reader // File input data. + input []byte // String input data. + input_pos int + + eof bool // EOF flag + + buffer []byte // The working buffer. + buffer_pos int // The current position of the buffer. + + unread int // The number of unread characters in the buffer. + + newlines int // The number of line breaks since last non-break/non-blank character + + raw_buffer []byte // The raw buffer. + raw_buffer_pos int // The current position of the buffer. + + encoding yaml_encoding_t // The input encoding. + + offset int // The offset of the current position (in bytes). + mark yaml_mark_t // The mark of the current position. + + // Comments + + head_comment []byte // The current head comments + line_comment []byte // The current line comments + foot_comment []byte // The current foot comments + tail_comment []byte // Foot comment that happens at the end of a block. + stem_comment []byte // Comment in item preceding a nested structure (list inside list item, etc) + + comments []yaml_comment_t // The folded comments for all parsed tokens + comments_head int + + // Scanner stuff + + stream_start_produced bool // Have we started to scan the input stream? + stream_end_produced bool // Have we reached the end of the input stream? + + flow_level int // The number of unclosed '[' and '{' indicators. + + tokens []yaml_token_t // The tokens queue. + tokens_head int // The head of the tokens queue. + tokens_parsed int // The number of tokens fetched from the queue. + token_available bool // Does the tokens queue contain a token ready for dequeueing. + + indent int // The current indentation level. + indents []int // The indentation levels stack. + + simple_key_allowed bool // May a simple key occur at the current position? + simple_keys []yaml_simple_key_t // The stack of simple keys. + simple_keys_by_tok map[int]int // possible simple_key indexes indexed by token_number + + // Parser stuff + + state yaml_parser_state_t // The current parser state. + states []yaml_parser_state_t // The parser states stack. + marks []yaml_mark_t // The stack of marks. + tag_directives []yaml_tag_directive_t // The list of TAG directives. + + // Dumper stuff + + aliases []yaml_alias_data_t // The alias data. + + document *yaml_document_t // The currently parsed document. +} + +type yaml_comment_t struct { + scan_mark yaml_mark_t // Position where scanning for comments started + token_mark yaml_mark_t // Position after which tokens will be associated with this comment + start_mark yaml_mark_t // Position of '#' comment mark + end_mark yaml_mark_t // Position where comment terminated + + head []byte + line []byte + foot []byte +} + +// Emitter Definitions + +// The prototype of a write handler. +// +// The write handler is called when the emitter needs to flush the accumulated +// characters to the output. The handler should write @a size bytes of the +// @a buffer to the output. +// +// @param[in,out] data A pointer to an application data specified by +// +// yaml_emitter_set_output(). +// +// @param[in] buffer The buffer with bytes to be written. +// @param[in] size The size of the buffer. +// +// @returns On success, the handler should return @c 1. If the handler failed, +// the returned value should be @c 0. +type yaml_write_handler_t func(emitter *yaml_emitter_t, buffer []byte) error + +type yaml_emitter_state_t int + +// The emitter states. +const ( + // Expect STREAM-START. + yaml_EMIT_STREAM_START_STATE yaml_emitter_state_t = iota + + yaml_EMIT_FIRST_DOCUMENT_START_STATE // Expect the first DOCUMENT-START or STREAM-END. + yaml_EMIT_DOCUMENT_START_STATE // Expect DOCUMENT-START or STREAM-END. + yaml_EMIT_DOCUMENT_CONTENT_STATE // Expect the content of a document. + yaml_EMIT_DOCUMENT_END_STATE // Expect DOCUMENT-END. + yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE // Expect the first item of a flow sequence. + yaml_EMIT_FLOW_SEQUENCE_TRAIL_ITEM_STATE // Expect the next item of a flow sequence, with the comma already written out + yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE // Expect an item of a flow sequence. + yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE // Expect the first key of a flow mapping. + yaml_EMIT_FLOW_MAPPING_TRAIL_KEY_STATE // Expect the next key of a flow mapping, with the comma already written out + yaml_EMIT_FLOW_MAPPING_KEY_STATE // Expect a key of a flow mapping. + yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE // Expect a value for a simple key of a flow mapping. + yaml_EMIT_FLOW_MAPPING_VALUE_STATE // Expect a value of a flow mapping. + yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE // Expect the first item of a block sequence. + yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE // Expect an item of a block sequence. + yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE // Expect the first key of a block mapping. + yaml_EMIT_BLOCK_MAPPING_KEY_STATE // Expect the key of a block mapping. + yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE // Expect a value for a simple key of a block mapping. + yaml_EMIT_BLOCK_MAPPING_VALUE_STATE // Expect a value of a block mapping. + yaml_EMIT_END_STATE // Expect nothing. +) + +// The emitter structure. +// +// All members are internal. Manage the structure using the @c yaml_emitter_ +// family of functions. +type yaml_emitter_t struct { + + // Error handling + + error yaml_error_type_t // Error type. + problem string // Error description. + + // Writer stuff + + write_handler yaml_write_handler_t // Write handler. + + output_buffer *[]byte // String output data. + output_writer io.Writer // File output data. + + buffer []byte // The working buffer. + buffer_pos int // The current position of the buffer. + + raw_buffer []byte // The raw buffer. + raw_buffer_pos int // The current position of the buffer. + + encoding yaml_encoding_t // The stream encoding. + + // Emitter stuff + + canonical bool // If the output is in the canonical style? + best_indent int // The number of indentation spaces. + best_width int // The preferred width of the output lines. + unicode bool // Allow unescaped non-ASCII characters? + line_break yaml_break_t // The preferred line break. + + state yaml_emitter_state_t // The current emitter state. + states []yaml_emitter_state_t // The stack of states. + + events []yaml_event_t // The event queue. + events_head int // The head of the event queue. + + indents []int // The stack of indentation levels. + + tag_directives []yaml_tag_directive_t // The list of tag directives. + + indent int // The current indentation level. + + compact_sequence_indent bool // Is '- ' is considered part of the indentation for sequence elements? + + flow_level int // The current flow level. + + root_context bool // Is it the document root context? + sequence_context bool // Is it a sequence context? + mapping_context bool // Is it a mapping context? + simple_key_context bool // Is it a simple mapping key context? + + line int // The current line. + column int // The current column. + whitespace bool // If the last character was a whitespace? + indention bool // If the last character was an indentation character (' ', '-', '?', ':')? + open_ended bool // If an explicit document end is required? + + space_above bool // Is there's an empty line above? + foot_indent int // The indent used to write the foot comment above, or -1 if none. + + // Anchor analysis. + anchor_data struct { + anchor []byte // The anchor value. + alias bool // Is it an alias? + } + + // Tag analysis. + tag_data struct { + handle []byte // The tag handle. + suffix []byte // The tag suffix. + } + + // Scalar analysis. + scalar_data struct { + value []byte // The scalar value. + multiline bool // Does the scalar contain line breaks? + flow_plain_allowed bool // Can the scalar be expessed in the flow plain style? + block_plain_allowed bool // Can the scalar be expressed in the block plain style? + single_quoted_allowed bool // Can the scalar be expressed in the single quoted style? + block_allowed bool // Can the scalar be expressed in the literal or folded styles? + style yaml_scalar_style_t // The output style. + } + + // Comments + head_comment []byte + line_comment []byte + foot_comment []byte + tail_comment []byte + + key_line_comment []byte + + // Dumper stuff + + opened bool // If the stream was already opened? + closed bool // If the stream was already closed? + + // The information associated with the document nodes. + anchors *struct { + references int // The number of references. + anchor int // The anchor id. + serialized bool // If the node has been emitted? + } + + last_anchor_id int // The last assigned anchor id. + + document *yaml_document_t // The currently emitted document. +} diff --git a/vendor/go.yaml.in/yaml/v3/yamlprivateh.go b/vendor/go.yaml.in/yaml/v3/yamlprivateh.go new file mode 100644 index 000000000..dea1ba961 --- /dev/null +++ b/vendor/go.yaml.in/yaml/v3/yamlprivateh.go @@ -0,0 +1,198 @@ +// +// Copyright (c) 2011-2019 Canonical Ltd +// Copyright (c) 2006-2010 Kirill Simonov +// +// 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. + +package yaml + +const ( + // The size of the input raw buffer. + input_raw_buffer_size = 512 + + // The size of the input buffer. + // It should be possible to decode the whole raw buffer. + input_buffer_size = input_raw_buffer_size * 3 + + // The size of the output buffer. + output_buffer_size = 128 + + // The size of the output raw buffer. + // It should be possible to encode the whole output buffer. + output_raw_buffer_size = (output_buffer_size*2 + 2) + + // The size of other stacks and queues. + initial_stack_size = 16 + initial_queue_size = 16 + initial_string_size = 16 +) + +// Check if the character at the specified position is an alphabetical +// character, a digit, '_', or '-'. +func is_alpha(b []byte, i int) bool { + return b[i] >= '0' && b[i] <= '9' || b[i] >= 'A' && b[i] <= 'Z' || b[i] >= 'a' && b[i] <= 'z' || b[i] == '_' || b[i] == '-' +} + +// Check if the character at the specified position is a digit. +func is_digit(b []byte, i int) bool { + return b[i] >= '0' && b[i] <= '9' +} + +// Get the value of a digit. +func as_digit(b []byte, i int) int { + return int(b[i]) - '0' +} + +// Check if the character at the specified position is a hex-digit. +func is_hex(b []byte, i int) bool { + return b[i] >= '0' && b[i] <= '9' || b[i] >= 'A' && b[i] <= 'F' || b[i] >= 'a' && b[i] <= 'f' +} + +// Get the value of a hex-digit. +func as_hex(b []byte, i int) int { + bi := b[i] + if bi >= 'A' && bi <= 'F' { + return int(bi) - 'A' + 10 + } + if bi >= 'a' && bi <= 'f' { + return int(bi) - 'a' + 10 + } + return int(bi) - '0' +} + +// Check if the character is ASCII. +func is_ascii(b []byte, i int) bool { + return b[i] <= 0x7F +} + +// Check if the character at the start of the buffer can be printed unescaped. +func is_printable(b []byte, i int) bool { + return ((b[i] == 0x0A) || // . == #x0A + (b[i] >= 0x20 && b[i] <= 0x7E) || // #x20 <= . <= #x7E + (b[i] == 0xC2 && b[i+1] >= 0xA0) || // #0xA0 <= . <= #xD7FF + (b[i] > 0xC2 && b[i] < 0xED) || + (b[i] == 0xED && b[i+1] < 0xA0) || + (b[i] == 0xEE) || + (b[i] == 0xEF && // #xE000 <= . <= #xFFFD + !(b[i+1] == 0xBB && b[i+2] == 0xBF) && // && . != #xFEFF + !(b[i+1] == 0xBF && (b[i+2] == 0xBE || b[i+2] == 0xBF)))) +} + +// Check if the character at the specified position is NUL. +func is_z(b []byte, i int) bool { + return b[i] == 0x00 +} + +// Check if the beginning of the buffer is a BOM. +func is_bom(b []byte, i int) bool { + return b[0] == 0xEF && b[1] == 0xBB && b[2] == 0xBF +} + +// Check if the character at the specified position is space. +func is_space(b []byte, i int) bool { + return b[i] == ' ' +} + +// Check if the character at the specified position is tab. +func is_tab(b []byte, i int) bool { + return b[i] == '\t' +} + +// Check if the character at the specified position is blank (space or tab). +func is_blank(b []byte, i int) bool { + //return is_space(b, i) || is_tab(b, i) + return b[i] == ' ' || b[i] == '\t' +} + +// Check if the character at the specified position is a line break. +func is_break(b []byte, i int) bool { + return (b[i] == '\r' || // CR (#xD) + b[i] == '\n' || // LF (#xA) + b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9) // PS (#x2029) +} + +func is_crlf(b []byte, i int) bool { + return b[i] == '\r' && b[i+1] == '\n' +} + +// Check if the character is a line break or NUL. +func is_breakz(b []byte, i int) bool { + //return is_break(b, i) || is_z(b, i) + return ( + // is_break: + b[i] == '\r' || // CR (#xD) + b[i] == '\n' || // LF (#xA) + b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029) + // is_z: + b[i] == 0) +} + +// Check if the character is a line break, space, or NUL. +func is_spacez(b []byte, i int) bool { + //return is_space(b, i) || is_breakz(b, i) + return ( + // is_space: + b[i] == ' ' || + // is_breakz: + b[i] == '\r' || // CR (#xD) + b[i] == '\n' || // LF (#xA) + b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029) + b[i] == 0) +} + +// Check if the character is a line break, space, tab, or NUL. +func is_blankz(b []byte, i int) bool { + //return is_blank(b, i) || is_breakz(b, i) + return ( + // is_blank: + b[i] == ' ' || b[i] == '\t' || + // is_breakz: + b[i] == '\r' || // CR (#xD) + b[i] == '\n' || // LF (#xA) + b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029) + b[i] == 0) +} + +// Determine the width of the character. +func width(b byte) int { + // Don't replace these by a switch without first + // confirming that it is being inlined. + if b&0x80 == 0x00 { + return 1 + } + if b&0xE0 == 0xC0 { + return 2 + } + if b&0xF0 == 0xE0 { + return 3 + } + if b&0xF8 == 0xF0 { + return 4 + } + return 0 + +} diff --git a/vendor/golang.org/x/crypto/bcrypt/bcrypt.go b/vendor/golang.org/x/crypto/bcrypt/bcrypt.go index dc9311870..3e7f8df87 100644 --- a/vendor/golang.org/x/crypto/bcrypt/bcrypt.go +++ b/vendor/golang.org/x/crypto/bcrypt/bcrypt.go @@ -50,7 +50,7 @@ func (ih InvalidHashPrefixError) Error() string { type InvalidCostError int func (ic InvalidCostError) Error() string { - return fmt.Sprintf("crypto/bcrypt: cost %d is outside allowed range (%d,%d)", int(ic), MinCost, MaxCost) + return fmt.Sprintf("crypto/bcrypt: cost %d is outside allowed inclusive range %d..%d", int(ic), MinCost, MaxCost) } const ( diff --git a/vendor/golang.org/x/crypto/blake2b/blake2x.go b/vendor/golang.org/x/crypto/blake2b/blake2x.go index 52c414db0..7692bb346 100644 --- a/vendor/golang.org/x/crypto/blake2b/blake2x.go +++ b/vendor/golang.org/x/crypto/blake2b/blake2x.go @@ -12,6 +12,8 @@ import ( // XOF defines the interface to hash functions that // support arbitrary-length output. +// +// New callers should prefer the standard library [hash.XOF]. type XOF interface { // Write absorbs more data into the hash's state. It panics if called // after Read. @@ -47,6 +49,8 @@ const maxOutputLength = (1 << 32) * 64 // // A non-nil key turns the hash into a MAC. The key must between // zero and 32 bytes long. +// +// The result can be safely interface-upgraded to [hash.XOF]. func NewXOF(size uint32, key []byte) (XOF, error) { if len(key) > Size { return nil, errKeySize @@ -93,6 +97,10 @@ func (x *xof) Clone() XOF { return &clone } +func (x *xof) BlockSize() int { + return x.d.BlockSize() +} + func (x *xof) Reset() { x.cfg[0] = byte(Size) binary.LittleEndian.PutUint32(x.cfg[4:], uint32(Size)) // leaf length diff --git a/vendor/golang.org/x/crypto/blake2b/go125.go b/vendor/golang.org/x/crypto/blake2b/go125.go new file mode 100644 index 000000000..67e990b7e --- /dev/null +++ b/vendor/golang.org/x/crypto/blake2b/go125.go @@ -0,0 +1,11 @@ +// Copyright 2025 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.25 + +package blake2b + +import "hash" + +var _ hash.XOF = (*xof)(nil) diff --git a/vendor/golang.org/x/crypto/cryptobyte/asn1.go b/vendor/golang.org/x/crypto/cryptobyte/asn1.go index 2492f796a..d25979d9f 100644 --- a/vendor/golang.org/x/crypto/cryptobyte/asn1.go +++ b/vendor/golang.org/x/crypto/cryptobyte/asn1.go @@ -234,7 +234,7 @@ func (b *Builder) AddASN1(tag asn1.Tag, f BuilderContinuation) { // Identifiers with the low five bits set indicate high-tag-number format // (two or more octets), which we don't support. if tag&0x1f == 0x1f { - b.err = fmt.Errorf("cryptobyte: high-tag number identifier octects not supported: 0x%x", tag) + b.err = fmt.Errorf("cryptobyte: high-tag number identifier octets not supported: 0x%x", tag) return } b.AddUint8(uint8(tag)) diff --git a/vendor/golang.org/x/crypto/ed25519/ed25519.go b/vendor/golang.org/x/crypto/ed25519/ed25519.go index 59b3a95a7..df453dcce 100644 --- a/vendor/golang.org/x/crypto/ed25519/ed25519.go +++ b/vendor/golang.org/x/crypto/ed25519/ed25519.go @@ -2,16 +2,19 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Package ed25519 implements the Ed25519 signature algorithm. See -// https://ed25519.cr.yp.to/. +// Package ed25519 implements the Ed25519 signature algorithm. // // These functions are also compatible with the “Ed25519” function defined in -// RFC 8032. However, unlike RFC 8032's formulation, this package's private key +// [RFC 8032]. However, unlike RFC 8032's formulation, this package's private key // representation includes a public key suffix to make multiple signing // operations with the same key more efficient. This package refers to the RFC // 8032 private key as the “seed”. // -// This package is a wrapper around the standard library crypto/ed25519 package. +// The ed25519 package is a wrapper for the Ed25519 implementation in the +// crypto/ed25519 package. It is [frozen] and is not accepting new features. +// +// [RFC 8032]: https://datatracker.ietf.org/doc/html/rfc8032 +// [frozen]: https://go.dev/wiki/Frozen package ed25519 import ( diff --git a/vendor/golang.org/x/crypto/pkcs12/pkcs12.go b/vendor/golang.org/x/crypto/pkcs12/pkcs12.go index 3a89bdb3e..374d9facf 100644 --- a/vendor/golang.org/x/crypto/pkcs12/pkcs12.go +++ b/vendor/golang.org/x/crypto/pkcs12/pkcs12.go @@ -4,12 +4,16 @@ // Package pkcs12 implements some of PKCS#12. // -// This implementation is distilled from https://tools.ietf.org/html/rfc7292 -// and referenced documents. It is intended for decoding P12/PFX-stored -// certificates and keys for use with the crypto/tls package. +// This implementation is distilled from [RFC 7292] and referenced documents. +// It is intended for decoding P12/PFX-stored certificates and keys for use +// with the crypto/tls package. // -// This package is frozen. If it's missing functionality you need, consider -// an alternative like software.sslmate.com/src/go-pkcs12. +// The pkcs12 package is [frozen] and is not accepting new features. +// If it's missing functionality you need, consider an alternative like +// software.sslmate.com/src/go-pkcs12. +// +// [RFC 7292]: https://datatracker.ietf.org/doc/html/rfc7292 +// [frozen]: https://go.dev/wiki/Frozen package pkcs12 import ( diff --git a/vendor/golang.org/x/net/context/context.go b/vendor/golang.org/x/net/context/context.go index db1c95fab..d3cb95175 100644 --- a/vendor/golang.org/x/net/context/context.go +++ b/vendor/golang.org/x/net/context/context.go @@ -6,7 +6,7 @@ // cancellation signals, and other request-scoped values across API boundaries // and between processes. // As of Go 1.7 this package is available in the standard library under the -// name [context], and migrating to it can be done automatically with [go fix]. +// name [context]. // // Incoming requests to a server should create a [Context], and outgoing // calls to servers should accept a Context. The chain of function @@ -38,8 +38,6 @@ // // See https://go.dev/blog/context for example code for a server that uses // Contexts. -// -// [go fix]: https://go.dev/cmd/go#hdr-Update_packages_to_use_new_APIs package context import ( @@ -51,36 +49,37 @@ import ( // API boundaries. // // Context's methods may be called by multiple goroutines simultaneously. +// +//go:fix inline type Context = context.Context // Canceled is the error returned by [Context.Err] when the context is canceled // for some reason other than its deadline passing. +// +//go:fix inline var Canceled = context.Canceled // DeadlineExceeded is the error returned by [Context.Err] when the context is canceled // due to its deadline passing. +// +//go:fix inline var DeadlineExceeded = context.DeadlineExceeded // Background returns a non-nil, empty Context. It is never canceled, has no // values, and has no deadline. It is typically used by the main function, // initialization, and tests, and as the top-level Context for incoming // requests. -func Background() Context { - return background -} +// +//go:fix inline +func Background() Context { return context.Background() } // TODO returns a non-nil, empty Context. Code should use context.TODO when // it's unclear which Context to use or it is not yet available (because the // surrounding function has not yet been extended to accept a Context // parameter). -func TODO() Context { - return todo -} - -var ( - background = context.Background() - todo = context.TODO() -) +// +//go:fix inline +func TODO() Context { return context.TODO() } // A CancelFunc tells an operation to abandon its work. // A CancelFunc does not wait for the work to stop. @@ -95,6 +94,8 @@ type CancelFunc = context.CancelFunc // // Canceling this context releases resources associated with it, so code should // call cancel as soon as the operations running in this [Context] complete. +// +//go:fix inline func WithCancel(parent Context) (ctx Context, cancel CancelFunc) { return context.WithCancel(parent) } @@ -108,6 +109,8 @@ func WithCancel(parent Context) (ctx Context, cancel CancelFunc) { // // Canceling this context releases resources associated with it, so code should // call cancel as soon as the operations running in this [Context] complete. +// +//go:fix inline func WithDeadline(parent Context, d time.Time) (Context, CancelFunc) { return context.WithDeadline(parent, d) } @@ -122,6 +125,8 @@ func WithDeadline(parent Context, d time.Time) (Context, CancelFunc) { // defer cancel() // releases resources if slowOperation completes before timeout elapses // return slowOperation(ctx) // } +// +//go:fix inline func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) { return context.WithTimeout(parent, timeout) } @@ -139,6 +144,8 @@ func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) { // interface{}, context keys often have concrete type // struct{}. Alternatively, exported context key variables' static // type should be a pointer or interface. +// +//go:fix inline func WithValue(parent Context, key, val interface{}) Context { return context.WithValue(parent, key, val) } diff --git a/vendor/golang.org/x/net/html/escape.go b/vendor/golang.org/x/net/html/escape.go index 04c6bec21..12f227370 100644 --- a/vendor/golang.org/x/net/html/escape.go +++ b/vendor/golang.org/x/net/html/escape.go @@ -299,7 +299,7 @@ func escape(w writer, s string) error { case '\r': esc = " " default: - panic("unrecognized escape character") + panic("html: unrecognized escape character") } s = s[i+1:] if _, err := w.WriteString(esc); err != nil { diff --git a/vendor/golang.org/x/net/html/parse.go b/vendor/golang.org/x/net/html/parse.go index 518ee4c94..88fc0056a 100644 --- a/vendor/golang.org/x/net/html/parse.go +++ b/vendor/golang.org/x/net/html/parse.go @@ -136,7 +136,7 @@ func (p *parser) indexOfElementInScope(s scope, matchTags ...a.Atom) int { return -1 } default: - panic("unreachable") + panic(fmt.Sprintf("html: internal error: indexOfElementInScope unknown scope: %d", s)) } } switch s { @@ -179,7 +179,7 @@ func (p *parser) clearStackToContext(s scope) { return } default: - panic("unreachable") + panic(fmt.Sprintf("html: internal error: clearStackToContext unknown scope: %d", s)) } } } @@ -231,7 +231,14 @@ func (p *parser) addChild(n *Node) { } if n.Type == ElementNode { - p.oe = append(p.oe, n) + p.insertOpenElement(n) + } +} + +func (p *parser) insertOpenElement(n *Node) { + p.oe = append(p.oe, n) + if len(p.oe) > 512 { + panic("html: open stack of elements exceeds 512 nodes") } } @@ -810,7 +817,7 @@ func afterHeadIM(p *parser) bool { p.im = inFramesetIM return true case a.Base, a.Basefont, a.Bgsound, a.Link, a.Meta, a.Noframes, a.Script, a.Style, a.Template, a.Title: - p.oe = append(p.oe, p.head) + p.insertOpenElement(p.head) defer p.oe.remove(p.head) return inHeadIM(p) case a.Head: @@ -1678,7 +1685,7 @@ func inTableBodyIM(p *parser) bool { return inTableIM(p) } -// Section 12.2.6.4.14. +// Section 13.2.6.4.14. func inRowIM(p *parser) bool { switch p.tok.Type { case StartTagToken: @@ -1690,7 +1697,9 @@ func inRowIM(p *parser) bool { p.im = inCellIM return true case a.Caption, a.Col, a.Colgroup, a.Tbody, a.Tfoot, a.Thead, a.Tr: - if p.popUntil(tableScope, a.Tr) { + if p.elementInScope(tableScope, a.Tr) { + p.clearStackToContext(tableRowScope) + p.oe.pop() p.im = inTableBodyIM return false } @@ -1700,22 +1709,28 @@ func inRowIM(p *parser) bool { case EndTagToken: switch p.tok.DataAtom { case a.Tr: - if p.popUntil(tableScope, a.Tr) { + if p.elementInScope(tableScope, a.Tr) { + p.clearStackToContext(tableRowScope) + p.oe.pop() p.im = inTableBodyIM return true } // Ignore the token. return true case a.Table: - if p.popUntil(tableScope, a.Tr) { + if p.elementInScope(tableScope, a.Tr) { + p.clearStackToContext(tableRowScope) + p.oe.pop() p.im = inTableBodyIM return false } // Ignore the token. return true case a.Tbody, a.Tfoot, a.Thead: - if p.elementInScope(tableScope, p.tok.DataAtom) { - p.parseImpliedToken(EndTagToken, a.Tr, a.Tr.String()) + if p.elementInScope(tableScope, p.tok.DataAtom) && p.elementInScope(tableScope, a.Tr) { + p.clearStackToContext(tableRowScope) + p.oe.pop() + p.im = inTableBodyIM return false } // Ignore the token. @@ -2222,16 +2237,20 @@ func parseForeignContent(p *parser) bool { p.acknowledgeSelfClosingTag() } case EndTagToken: + if strings.EqualFold(p.oe[len(p.oe)-1].Data, p.tok.Data) { + p.oe = p.oe[:len(p.oe)-1] + return true + } for i := len(p.oe) - 1; i >= 0; i-- { - if p.oe[i].Namespace == "" { - return p.im(p) - } if strings.EqualFold(p.oe[i].Data, p.tok.Data) { p.oe = p.oe[:i] + return true + } + if i > 0 && p.oe[i-1].Namespace == "" { break } } - return true + return p.im(p) default: // Ignore the token. } @@ -2312,9 +2331,13 @@ func (p *parser) parseCurrentToken() { } } -func (p *parser) parse() error { +func (p *parser) parse() (err error) { + defer func() { + if panicErr := recover(); panicErr != nil { + err = fmt.Errorf("%s", panicErr) + } + }() // Iterate until EOF. Any other error will cause an early return. - var err error for err != io.EOF { // CDATA sections are allowed only in foreign content. n := p.oe.top() @@ -2343,6 +2366,8 @@ func (p *parser) parse() error { // s. Conversely, explicit s in r's data can be silently dropped, // with no corresponding node in the resulting tree. // +// Parse will reject HTML that is nested deeper than 512 elements. +// // The input is assumed to be UTF-8 encoded. func Parse(r io.Reader) (*Node, error) { return ParseWithOptions(r) diff --git a/vendor/golang.org/x/net/html/render.go b/vendor/golang.org/x/net/html/render.go index e8c123345..0157d89e1 100644 --- a/vendor/golang.org/x/net/html/render.go +++ b/vendor/golang.org/x/net/html/render.go @@ -184,7 +184,7 @@ func render1(w writer, n *Node) error { return err } - // Add initial newline where there is danger of a newline beging ignored. + // Add initial newline where there is danger of a newline being ignored. if c := n.FirstChild; c != nil && c.Type == TextNode && strings.HasPrefix(c.Data, "\n") { switch n.Data { case "pre", "listing", "textarea": diff --git a/vendor/golang.org/x/sys/cpu/cpu.go b/vendor/golang.org/x/sys/cpu/cpu.go index 9c105f23a..63541994e 100644 --- a/vendor/golang.org/x/sys/cpu/cpu.go +++ b/vendor/golang.org/x/sys/cpu/cpu.go @@ -149,6 +149,18 @@ var ARM struct { _ CacheLinePad } +// The booleans in Loong64 contain the correspondingly named cpu feature bit. +// The struct is padded to avoid false sharing. +var Loong64 struct { + _ CacheLinePad + HasLSX bool // support 128-bit vector extension + HasLASX bool // support 256-bit vector extension + HasCRC32 bool // support CRC instruction + HasLAM_BH bool // support AM{SWAP/ADD}[_DB].{B/H} instruction + HasLAMCAS bool // support AMCAS[_DB].{B/H/W/D} instruction + _ CacheLinePad +} + // MIPS64X contains the supported CPU features of the current mips64/mips64le // platforms. If the current platform is not mips64/mips64le or the current // operating system is not Linux then all feature flags are false. @@ -220,6 +232,17 @@ var RISCV64 struct { HasZba bool // Address generation instructions extension HasZbb bool // Basic bit-manipulation extension HasZbs bool // Single-bit instructions extension + HasZvbb bool // Vector Basic Bit-manipulation + HasZvbc bool // Vector Carryless Multiplication + HasZvkb bool // Vector Cryptography Bit-manipulation + HasZvkt bool // Vector Data-Independent Execution Latency + HasZvkg bool // Vector GCM/GMAC + HasZvkn bool // NIST Algorithm Suite (AES/SHA256/SHA512) + HasZvknc bool // NIST Algorithm Suite with carryless multiply + HasZvkng bool // NIST Algorithm Suite with GCM + HasZvks bool // ShangMi Algorithm Suite + HasZvksc bool // ShangMi Algorithm Suite with carryless multiplication + HasZvksg bool // ShangMi Algorithm Suite with GCM _ CacheLinePad } diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_loong64.go b/vendor/golang.org/x/sys/cpu/cpu_linux_loong64.go new file mode 100644 index 000000000..4f3411432 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_linux_loong64.go @@ -0,0 +1,22 @@ +// Copyright 2025 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 cpu + +// HWCAP bits. These are exposed by the Linux kernel. +const ( + hwcap_LOONGARCH_LSX = 1 << 4 + hwcap_LOONGARCH_LASX = 1 << 5 +) + +func doinit() { + // TODO: Features that require kernel support like LSX and LASX can + // be detected here once needed in std library or by the compiler. + Loong64.HasLSX = hwcIsSet(hwCap, hwcap_LOONGARCH_LSX) + Loong64.HasLASX = hwcIsSet(hwCap, hwcap_LOONGARCH_LASX) +} + +func hwcIsSet(hwc uint, val uint) bool { + return hwc&val != 0 +} diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go b/vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go index 7d902b684..a428dec9c 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go +++ b/vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build linux && !arm && !arm64 && !mips64 && !mips64le && !ppc64 && !ppc64le && !s390x && !riscv64 +//go:build linux && !arm && !arm64 && !loong64 && !mips64 && !mips64le && !ppc64 && !ppc64le && !s390x && !riscv64 package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_riscv64.go b/vendor/golang.org/x/sys/cpu/cpu_linux_riscv64.go index cb4a0c572..ad741536f 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_linux_riscv64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_linux_riscv64.go @@ -58,6 +58,15 @@ const ( riscv_HWPROBE_EXT_ZBA = 0x8 riscv_HWPROBE_EXT_ZBB = 0x10 riscv_HWPROBE_EXT_ZBS = 0x20 + riscv_HWPROBE_EXT_ZVBB = 0x20000 + riscv_HWPROBE_EXT_ZVBC = 0x40000 + riscv_HWPROBE_EXT_ZVKB = 0x80000 + riscv_HWPROBE_EXT_ZVKG = 0x100000 + riscv_HWPROBE_EXT_ZVKNED = 0x200000 + riscv_HWPROBE_EXT_ZVKNHB = 0x800000 + riscv_HWPROBE_EXT_ZVKSED = 0x1000000 + riscv_HWPROBE_EXT_ZVKSH = 0x2000000 + riscv_HWPROBE_EXT_ZVKT = 0x4000000 riscv_HWPROBE_KEY_CPUPERF_0 = 0x5 riscv_HWPROBE_MISALIGNED_FAST = 0x3 riscv_HWPROBE_MISALIGNED_MASK = 0x7 @@ -99,6 +108,20 @@ func doinit() { RISCV64.HasZba = isSet(v, riscv_HWPROBE_EXT_ZBA) RISCV64.HasZbb = isSet(v, riscv_HWPROBE_EXT_ZBB) RISCV64.HasZbs = isSet(v, riscv_HWPROBE_EXT_ZBS) + RISCV64.HasZvbb = isSet(v, riscv_HWPROBE_EXT_ZVBB) + RISCV64.HasZvbc = isSet(v, riscv_HWPROBE_EXT_ZVBC) + RISCV64.HasZvkb = isSet(v, riscv_HWPROBE_EXT_ZVKB) + RISCV64.HasZvkg = isSet(v, riscv_HWPROBE_EXT_ZVKG) + RISCV64.HasZvkt = isSet(v, riscv_HWPROBE_EXT_ZVKT) + // Cryptography shorthand extensions + RISCV64.HasZvkn = isSet(v, riscv_HWPROBE_EXT_ZVKNED) && + isSet(v, riscv_HWPROBE_EXT_ZVKNHB) && RISCV64.HasZvkb && RISCV64.HasZvkt + RISCV64.HasZvknc = RISCV64.HasZvkn && RISCV64.HasZvbc + RISCV64.HasZvkng = RISCV64.HasZvkn && RISCV64.HasZvkg + RISCV64.HasZvks = isSet(v, riscv_HWPROBE_EXT_ZVKSED) && + isSet(v, riscv_HWPROBE_EXT_ZVKSH) && RISCV64.HasZvkb && RISCV64.HasZvkt + RISCV64.HasZvksc = RISCV64.HasZvks && RISCV64.HasZvbc + RISCV64.HasZvksg = RISCV64.HasZvks && RISCV64.HasZvkg } if pairs[1].key != -1 { v := pairs[1].value & riscv_HWPROBE_MISALIGNED_MASK diff --git a/vendor/golang.org/x/sys/cpu/cpu_loong64.go b/vendor/golang.org/x/sys/cpu/cpu_loong64.go index 558635850..45ecb29ae 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_loong64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_loong64.go @@ -8,5 +8,43 @@ package cpu const cacheLineSize = 64 +// Bit fields for CPUCFG registers, Related reference documents: +// https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#_cpucfg +const ( + // CPUCFG1 bits + cpucfg1_CRC32 = 1 << 25 + + // CPUCFG2 bits + cpucfg2_LAM_BH = 1 << 27 + cpucfg2_LAMCAS = 1 << 28 +) + func initOptions() { + options = []option{ + {Name: "lsx", Feature: &Loong64.HasLSX}, + {Name: "lasx", Feature: &Loong64.HasLASX}, + {Name: "crc32", Feature: &Loong64.HasCRC32}, + {Name: "lam_bh", Feature: &Loong64.HasLAM_BH}, + {Name: "lamcas", Feature: &Loong64.HasLAMCAS}, + } + + // The CPUCFG data on Loong64 only reflects the hardware capabilities, + // not the kernel support status, so features such as LSX and LASX that + // require kernel support cannot be obtained from the CPUCFG data. + // + // These features only require hardware capability support and do not + // require kernel specific support, so they can be obtained directly + // through CPUCFG + cfg1 := get_cpucfg(1) + cfg2 := get_cpucfg(2) + + Loong64.HasCRC32 = cfgIsSet(cfg1, cpucfg1_CRC32) + Loong64.HasLAMCAS = cfgIsSet(cfg2, cpucfg2_LAMCAS) + Loong64.HasLAM_BH = cfgIsSet(cfg2, cpucfg2_LAM_BH) +} + +func get_cpucfg(reg uint32) uint32 + +func cfgIsSet(cfg uint32, val uint32) bool { + return cfg&val != 0 } diff --git a/vendor/golang.org/x/sys/cpu/cpu_loong64.s b/vendor/golang.org/x/sys/cpu/cpu_loong64.s new file mode 100644 index 000000000..71cbaf1ce --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_loong64.s @@ -0,0 +1,13 @@ +// Copyright 2025 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. + +#include "textflag.h" + +// func get_cpucfg(reg uint32) uint32 +TEXT ·get_cpucfg(SB), NOSPLIT|NOFRAME, $0 + MOVW reg+0(FP), R5 + // CPUCFG R5, R4 = 0x00006ca4 + WORD $0x00006ca4 + MOVW R4, ret+8(FP) + RET diff --git a/vendor/golang.org/x/sys/cpu/cpu_riscv64.go b/vendor/golang.org/x/sys/cpu/cpu_riscv64.go index aca3199c9..0f617aef5 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_riscv64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_riscv64.go @@ -16,5 +16,17 @@ func initOptions() { {Name: "zba", Feature: &RISCV64.HasZba}, {Name: "zbb", Feature: &RISCV64.HasZbb}, {Name: "zbs", Feature: &RISCV64.HasZbs}, + // RISC-V Cryptography Extensions + {Name: "zvbb", Feature: &RISCV64.HasZvbb}, + {Name: "zvbc", Feature: &RISCV64.HasZvbc}, + {Name: "zvkb", Feature: &RISCV64.HasZvkb}, + {Name: "zvkg", Feature: &RISCV64.HasZvkg}, + {Name: "zvkt", Feature: &RISCV64.HasZvkt}, + {Name: "zvkn", Feature: &RISCV64.HasZvkn}, + {Name: "zvknc", Feature: &RISCV64.HasZvknc}, + {Name: "zvkng", Feature: &RISCV64.HasZvkng}, + {Name: "zvks", Feature: &RISCV64.HasZvks}, + {Name: "zvksc", Feature: &RISCV64.HasZvksc}, + {Name: "zvksg", Feature: &RISCV64.HasZvksg}, } } diff --git a/vendor/golang.org/x/sys/cpu/parse.go b/vendor/golang.org/x/sys/cpu/parse.go index 762b63d68..56a7e1a17 100644 --- a/vendor/golang.org/x/sys/cpu/parse.go +++ b/vendor/golang.org/x/sys/cpu/parse.go @@ -13,7 +13,7 @@ import "strconv" // https://golang.org/cl/209597. func parseRelease(rel string) (major, minor, patch int, ok bool) { // Strip anything after a dash or plus. - for i := 0; i < len(rel); i++ { + for i := range len(rel) { if rel[i] == '-' || rel[i] == '+' { rel = rel[:i] break @@ -21,7 +21,7 @@ func parseRelease(rel string) (major, minor, patch int, ok bool) { } next := func() (int, bool) { - for i := 0; i < len(rel); i++ { + for i := range len(rel) { if rel[i] == '.' { ver, err := strconv.Atoi(rel[:i]) rel = rel[i+1:] diff --git a/vendor/golang.org/x/sys/unix/affinity_linux.go b/vendor/golang.org/x/sys/unix/affinity_linux.go index 6e5c81acd..3ea470387 100644 --- a/vendor/golang.org/x/sys/unix/affinity_linux.go +++ b/vendor/golang.org/x/sys/unix/affinity_linux.go @@ -38,8 +38,15 @@ func SchedSetaffinity(pid int, set *CPUSet) error { // Zero clears the set s, so that it contains no CPUs. func (s *CPUSet) Zero() { + clear(s[:]) +} + +// Fill adds all possible CPU bits to the set s. On Linux, [SchedSetaffinity] +// will silently ignore any invalid CPU bits in [CPUSet] so this is an +// efficient way of resetting the CPU affinity of a process. +func (s *CPUSet) Fill() { for i := range s { - s[i] = 0 + s[i] = ^cpuMask(0) } } diff --git a/vendor/golang.org/x/sys/unix/fdset.go b/vendor/golang.org/x/sys/unix/fdset.go index 9e83d18cd..62ed12645 100644 --- a/vendor/golang.org/x/sys/unix/fdset.go +++ b/vendor/golang.org/x/sys/unix/fdset.go @@ -23,7 +23,5 @@ func (fds *FdSet) IsSet(fd int) bool { // Zero clears the set fds. func (fds *FdSet) Zero() { - for i := range fds.Bits { - fds.Bits[i] = 0 - } + clear(fds.Bits[:]) } diff --git a/vendor/golang.org/x/sys/unix/ifreq_linux.go b/vendor/golang.org/x/sys/unix/ifreq_linux.go index 848840ae4..309f5a2b0 100644 --- a/vendor/golang.org/x/sys/unix/ifreq_linux.go +++ b/vendor/golang.org/x/sys/unix/ifreq_linux.go @@ -111,9 +111,7 @@ func (ifr *Ifreq) SetUint32(v uint32) { // clear zeroes the ifreq's union field to prevent trailing garbage data from // being sent to the kernel if an ifreq is reused. func (ifr *Ifreq) clear() { - for i := range ifr.raw.Ifru { - ifr.raw.Ifru[i] = 0 - } + clear(ifr.raw.Ifru[:]) } // TODO(mdlayher): export as IfreqData? For now we can provide helpers such as diff --git a/vendor/golang.org/x/sys/unix/mkall.sh b/vendor/golang.org/x/sys/unix/mkall.sh index e6f31d374..d0ed61191 100644 --- a/vendor/golang.org/x/sys/unix/mkall.sh +++ b/vendor/golang.org/x/sys/unix/mkall.sh @@ -49,6 +49,7 @@ esac if [[ "$GOOS" = "linux" ]]; then # Use the Docker-based build system # Files generated through docker (use $cmd so you can Ctl-C the build or run) + set -e $cmd docker build --tag generate:$GOOS $GOOS $cmd docker run --interactive --tty --volume $(cd -- "$(dirname -- "$0")/.." && pwd):/build generate:$GOOS exit diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index 6ab02b6c3..d1c8b2640 100644 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -349,6 +349,9 @@ struct ltchars { #define _HIDIOCGRAWPHYS HIDIOCGRAWPHYS(_HIDIOCGRAWPHYS_LEN) #define _HIDIOCGRAWUNIQ HIDIOCGRAWUNIQ(_HIDIOCGRAWUNIQ_LEN) +// Renamed in v6.16, commit c6d732c38f93 ("net: ethtool: remove duplicate defines for family info") +#define ETHTOOL_FAMILY_NAME ETHTOOL_GENL_NAME +#define ETHTOOL_FAMILY_VERSION ETHTOOL_GENL_VERSION ' includes_NetBSD=' diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.go b/vendor/golang.org/x/sys/unix/syscall_darwin.go index 099867dee..7838ca5db 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin.go @@ -602,6 +602,95 @@ func Connectx(fd int, srcIf uint32, srcAddr, dstAddr Sockaddr, associd SaeAssocI return } +const minIovec = 8 + +func Readv(fd int, iovs [][]byte) (n int, err error) { + iovecs := make([]Iovec, 0, minIovec) + iovecs = appendBytes(iovecs, iovs) + n, err = readv(fd, iovecs) + readvRacedetect(iovecs, n, err) + return n, err +} + +func Preadv(fd int, iovs [][]byte, offset int64) (n int, err error) { + iovecs := make([]Iovec, 0, minIovec) + iovecs = appendBytes(iovecs, iovs) + n, err = preadv(fd, iovecs, offset) + readvRacedetect(iovecs, n, err) + return n, err +} + +func Writev(fd int, iovs [][]byte) (n int, err error) { + iovecs := make([]Iovec, 0, minIovec) + iovecs = appendBytes(iovecs, iovs) + if raceenabled { + raceReleaseMerge(unsafe.Pointer(&ioSync)) + } + n, err = writev(fd, iovecs) + writevRacedetect(iovecs, n) + return n, err +} + +func Pwritev(fd int, iovs [][]byte, offset int64) (n int, err error) { + iovecs := make([]Iovec, 0, minIovec) + iovecs = appendBytes(iovecs, iovs) + if raceenabled { + raceReleaseMerge(unsafe.Pointer(&ioSync)) + } + n, err = pwritev(fd, iovecs, offset) + writevRacedetect(iovecs, n) + return n, err +} + +func appendBytes(vecs []Iovec, bs [][]byte) []Iovec { + for _, b := range bs { + var v Iovec + v.SetLen(len(b)) + if len(b) > 0 { + v.Base = &b[0] + } else { + v.Base = (*byte)(unsafe.Pointer(&_zero)) + } + vecs = append(vecs, v) + } + return vecs +} + +func writevRacedetect(iovecs []Iovec, n int) { + if !raceenabled { + return + } + for i := 0; n > 0 && i < len(iovecs); i++ { + m := int(iovecs[i].Len) + if m > n { + m = n + } + n -= m + if m > 0 { + raceReadRange(unsafe.Pointer(iovecs[i].Base), m) + } + } +} + +func readvRacedetect(iovecs []Iovec, n int, err error) { + if !raceenabled { + return + } + for i := 0; n > 0 && i < len(iovecs); i++ { + m := int(iovecs[i].Len) + if m > n { + m = n + } + n -= m + if m > 0 { + raceWriteRange(unsafe.Pointer(iovecs[i].Base), m) + } + } + if err == nil { + raceAcquire(unsafe.Pointer(&ioSync)) + } +} + //sys connectx(fd int, endpoints *SaEndpoints, associd SaeAssocID, flags uint32, iov []Iovec, n *uintptr, connid *SaeConnID) (err error) //sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) @@ -705,3 +794,7 @@ func Connectx(fd int, srcIf uint32, srcAddr, dstAddr Sockaddr, associd SaeAssocI //sys write(fd int, p []byte) (n int, err error) //sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) //sys munmap(addr uintptr, length uintptr) (err error) +//sys readv(fd int, iovecs []Iovec) (n int, err error) +//sys preadv(fd int, iovecs []Iovec, offset int64) (n int, err error) +//sys writev(fd int, iovecs []Iovec) (n int, err error) +//sys pwritev(fd int, iovecs []Iovec, offset int64) (n int, err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go index 230a94549..9439af961 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -13,6 +13,7 @@ package unix import ( "encoding/binary" + "slices" "strconv" "syscall" "time" @@ -417,7 +418,7 @@ func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, _Socklen, error) { return nil, 0, EINVAL } sa.raw.Family = AF_UNIX - for i := 0; i < n; i++ { + for i := range n { sa.raw.Path[i] = int8(name[i]) } // length is family (uint16), name, NUL. @@ -507,7 +508,7 @@ func (sa *SockaddrL2) sockaddr() (unsafe.Pointer, _Socklen, error) { psm := (*[2]byte)(unsafe.Pointer(&sa.raw.Psm)) psm[0] = byte(sa.PSM) psm[1] = byte(sa.PSM >> 8) - for i := 0; i < len(sa.Addr); i++ { + for i := range len(sa.Addr) { sa.raw.Bdaddr[i] = sa.Addr[len(sa.Addr)-1-i] } cid := (*[2]byte)(unsafe.Pointer(&sa.raw.Cid)) @@ -589,11 +590,11 @@ func (sa *SockaddrCAN) sockaddr() (unsafe.Pointer, _Socklen, error) { sa.raw.Family = AF_CAN sa.raw.Ifindex = int32(sa.Ifindex) rx := (*[4]byte)(unsafe.Pointer(&sa.RxID)) - for i := 0; i < 4; i++ { + for i := range 4 { sa.raw.Addr[i] = rx[i] } tx := (*[4]byte)(unsafe.Pointer(&sa.TxID)) - for i := 0; i < 4; i++ { + for i := range 4 { sa.raw.Addr[i+4] = tx[i] } return unsafe.Pointer(&sa.raw), SizeofSockaddrCAN, nil @@ -618,11 +619,11 @@ func (sa *SockaddrCANJ1939) sockaddr() (unsafe.Pointer, _Socklen, error) { sa.raw.Family = AF_CAN sa.raw.Ifindex = int32(sa.Ifindex) n := (*[8]byte)(unsafe.Pointer(&sa.Name)) - for i := 0; i < 8; i++ { + for i := range 8 { sa.raw.Addr[i] = n[i] } p := (*[4]byte)(unsafe.Pointer(&sa.PGN)) - for i := 0; i < 4; i++ { + for i := range 4 { sa.raw.Addr[i+8] = p[i] } sa.raw.Addr[12] = sa.Addr @@ -800,9 +801,7 @@ func (sa *SockaddrPPPoE) sockaddr() (unsafe.Pointer, _Socklen, error) { // one. The kernel expects SID to be in network byte order. binary.BigEndian.PutUint16(sa.raw[6:8], sa.SID) copy(sa.raw[8:14], sa.Remote) - for i := 14; i < 14+IFNAMSIZ; i++ { - sa.raw[i] = 0 - } + clear(sa.raw[14 : 14+IFNAMSIZ]) copy(sa.raw[14:], sa.Dev) return unsafe.Pointer(&sa.raw), SizeofSockaddrPPPoX, nil } @@ -911,7 +910,7 @@ func (sa *SockaddrIUCV) sockaddr() (unsafe.Pointer, _Socklen, error) { // These are EBCDIC encoded by the kernel, but we still need to pad them // with blanks. Initializing with blanks allows the caller to feed in either // a padded or an unpadded string. - for i := 0; i < 8; i++ { + for i := range 8 { sa.raw.Nodeid[i] = ' ' sa.raw.User_id[i] = ' ' sa.raw.Name[i] = ' ' @@ -1148,7 +1147,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { var user [8]byte var name [8]byte - for i := 0; i < 8; i++ { + for i := range 8 { user[i] = byte(pp.User_id[i]) name[i] = byte(pp.Name[i]) } @@ -1173,11 +1172,11 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { Ifindex: int(pp.Ifindex), } name := (*[8]byte)(unsafe.Pointer(&sa.Name)) - for i := 0; i < 8; i++ { + for i := range 8 { name[i] = pp.Addr[i] } pgn := (*[4]byte)(unsafe.Pointer(&sa.PGN)) - for i := 0; i < 4; i++ { + for i := range 4 { pgn[i] = pp.Addr[i+8] } addr := (*[1]byte)(unsafe.Pointer(&sa.Addr)) @@ -1188,11 +1187,11 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { Ifindex: int(pp.Ifindex), } rx := (*[4]byte)(unsafe.Pointer(&sa.RxID)) - for i := 0; i < 4; i++ { + for i := range 4 { rx[i] = pp.Addr[i] } tx := (*[4]byte)(unsafe.Pointer(&sa.TxID)) - for i := 0; i < 4; i++ { + for i := range 4 { tx[i] = pp.Addr[i+4] } return sa, nil @@ -2216,10 +2215,7 @@ func readvRacedetect(iovecs []Iovec, n int, err error) { return } for i := 0; n > 0 && i < len(iovecs); i++ { - m := int(iovecs[i].Len) - if m > n { - m = n - } + m := min(int(iovecs[i].Len), n) n -= m if m > 0 { raceWriteRange(unsafe.Pointer(iovecs[i].Base), m) @@ -2270,10 +2266,7 @@ func writevRacedetect(iovecs []Iovec, n int) { return } for i := 0; n > 0 && i < len(iovecs); i++ { - m := int(iovecs[i].Len) - if m > n { - m = n - } + m := min(int(iovecs[i].Len), n) n -= m if m > 0 { raceReadRange(unsafe.Pointer(iovecs[i].Base), m) @@ -2320,12 +2313,7 @@ func isGroupMember(gid int) bool { return false } - for _, g := range groups { - if g == gid { - return true - } - } - return false + return slices.Contains(groups, gid) } func isCapDacOverrideSet() bool { diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd.go b/vendor/golang.org/x/sys/unix/syscall_netbsd.go index 88162099a..34a467697 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd.go @@ -248,6 +248,23 @@ func Statvfs(path string, buf *Statvfs_t) (err error) { return Statvfs1(path, buf, ST_WAIT) } +func Getvfsstat(buf []Statvfs_t, flags int) (n int, err error) { + var ( + _p0 unsafe.Pointer + bufsize uintptr + ) + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + bufsize = unsafe.Sizeof(Statvfs_t{}) * uintptr(len(buf)) + } + r0, _, e1 := Syscall(SYS_GETVFSSTAT, uintptr(_p0), bufsize, uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = e1 + } + return +} + /* * Exposed directly */ diff --git a/vendor/golang.org/x/sys/unix/syscall_solaris.go b/vendor/golang.org/x/sys/unix/syscall_solaris.go index abc395547..18a3d9bda 100644 --- a/vendor/golang.org/x/sys/unix/syscall_solaris.go +++ b/vendor/golang.org/x/sys/unix/syscall_solaris.go @@ -629,7 +629,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Kill(pid int, signum syscall.Signal) (err error) //sys Lchown(path string, uid int, gid int) (err error) //sys Link(path string, link string) (err error) -//sys Listen(s int, backlog int) (err error) = libsocket.__xnet_llisten +//sys Listen(s int, backlog int) (err error) = libsocket.__xnet_listen //sys Lstat(path string, stat *Stat_t) (err error) //sys Madvise(b []byte, advice int) (err error) //sys Mkdir(path string, mode uint32) (err error) diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux.go b/vendor/golang.org/x/sys/unix/zerrors_linux.go index 4f432bfe8..b6db27d93 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux.go @@ -319,6 +319,7 @@ const ( AUDIT_INTEGRITY_POLICY_RULE = 0x70f AUDIT_INTEGRITY_RULE = 0x70d AUDIT_INTEGRITY_STATUS = 0x70a + AUDIT_INTEGRITY_USERSPACE = 0x710 AUDIT_IPC = 0x517 AUDIT_IPC_SET_PERM = 0x51f AUDIT_IPE_ACCESS = 0x58c @@ -327,6 +328,8 @@ const ( AUDIT_KERNEL = 0x7d0 AUDIT_KERNEL_OTHER = 0x524 AUDIT_KERN_MODULE = 0x532 + AUDIT_LANDLOCK_ACCESS = 0x58f + AUDIT_LANDLOCK_DOMAIN = 0x590 AUDIT_LAST_FEATURE = 0x1 AUDIT_LAST_KERN_ANOM_MSG = 0x707 AUDIT_LAST_USER_MSG = 0x4af @@ -491,6 +494,7 @@ const ( BPF_F_BEFORE = 0x8 BPF_F_ID = 0x20 BPF_F_NETFILTER_IP_DEFRAG = 0x1 + BPF_F_PREORDER = 0x40 BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_REDIRECT_FLAGS = 0x19 BPF_F_REPLACE = 0x4 @@ -527,6 +531,7 @@ const ( BPF_LDX = 0x1 BPF_LEN = 0x80 BPF_LL_OFF = -0x200000 + BPF_LOAD_ACQ = 0x100 BPF_LSH = 0x60 BPF_MAJOR_VERSION = 0x1 BPF_MAXINSNS = 0x1000 @@ -554,6 +559,7 @@ const ( BPF_RET = 0x6 BPF_RSH = 0x70 BPF_ST = 0x2 + BPF_STORE_REL = 0x110 BPF_STX = 0x3 BPF_SUB = 0x10 BPF_TAG_SIZE = 0x8 @@ -843,9 +849,9 @@ const ( DM_UUID_FLAG = 0x4000 DM_UUID_LEN = 0x81 DM_VERSION = 0xc138fd00 - DM_VERSION_EXTRA = "-ioctl (2023-03-01)" + DM_VERSION_EXTRA = "-ioctl (2025-04-28)" DM_VERSION_MAJOR = 0x4 - DM_VERSION_MINOR = 0x30 + DM_VERSION_MINOR = 0x32 DM_VERSION_PATCHLEVEL = 0x0 DT_BLK = 0x6 DT_CHR = 0x2 @@ -936,11 +942,10 @@ const ( EPOLL_CTL_MOD = 0x3 EPOLL_IOC_TYPE = 0x8a EROFS_SUPER_MAGIC_V1 = 0xe0f5e1e2 - ESP_V4_FLOW = 0xa - ESP_V6_FLOW = 0xc - ETHER_FLOW = 0x12 ETHTOOL_BUSINFO_LEN = 0x20 ETHTOOL_EROMVERS_LEN = 0x20 + ETHTOOL_FAMILY_NAME = "ethtool" + ETHTOOL_FAMILY_VERSION = 0x1 ETHTOOL_FEC_AUTO = 0x2 ETHTOOL_FEC_BASER = 0x10 ETHTOOL_FEC_LLRS = 0x20 @@ -1203,13 +1208,18 @@ const ( FAN_DENY = 0x2 FAN_ENABLE_AUDIT = 0x40 FAN_EPIDFD = -0x2 + FAN_ERRNO_BITS = 0x8 + FAN_ERRNO_MASK = 0xff + FAN_ERRNO_SHIFT = 0x18 FAN_EVENT_INFO_TYPE_DFID = 0x3 FAN_EVENT_INFO_TYPE_DFID_NAME = 0x2 FAN_EVENT_INFO_TYPE_ERROR = 0x5 FAN_EVENT_INFO_TYPE_FID = 0x1 + FAN_EVENT_INFO_TYPE_MNT = 0x7 FAN_EVENT_INFO_TYPE_NEW_DFID_NAME = 0xc FAN_EVENT_INFO_TYPE_OLD_DFID_NAME = 0xa FAN_EVENT_INFO_TYPE_PIDFD = 0x4 + FAN_EVENT_INFO_TYPE_RANGE = 0x6 FAN_EVENT_METADATA_LEN = 0x18 FAN_EVENT_ON_CHILD = 0x8000000 FAN_FS_ERROR = 0x8000 @@ -1224,9 +1234,12 @@ const ( FAN_MARK_IGNORED_SURV_MODIFY = 0x40 FAN_MARK_IGNORE_SURV = 0x440 FAN_MARK_INODE = 0x0 + FAN_MARK_MNTNS = 0x110 FAN_MARK_MOUNT = 0x10 FAN_MARK_ONLYDIR = 0x8 FAN_MARK_REMOVE = 0x2 + FAN_MNT_ATTACH = 0x1000000 + FAN_MNT_DETACH = 0x2000000 FAN_MODIFY = 0x2 FAN_MOVE = 0xc0 FAN_MOVED_FROM = 0x40 @@ -1240,6 +1253,7 @@ const ( FAN_OPEN_EXEC = 0x1000 FAN_OPEN_EXEC_PERM = 0x40000 FAN_OPEN_PERM = 0x10000 + FAN_PRE_ACCESS = 0x100000 FAN_Q_OVERFLOW = 0x4000 FAN_RENAME = 0x10000000 FAN_REPORT_DFID_NAME = 0xc00 @@ -1247,6 +1261,7 @@ const ( FAN_REPORT_DIR_FID = 0x400 FAN_REPORT_FD_ERROR = 0x2000 FAN_REPORT_FID = 0x200 + FAN_REPORT_MNT = 0x4000 FAN_REPORT_NAME = 0x800 FAN_REPORT_PIDFD = 0x80 FAN_REPORT_TARGET_FID = 0x1000 @@ -1266,6 +1281,7 @@ const ( FIB_RULE_PERMANENT = 0x1 FIB_RULE_UNRESOLVED = 0x4 FIDEDUPERANGE = 0xc0189436 + FSCRYPT_ADD_KEY_FLAG_HW_WRAPPED = 0x1 FSCRYPT_KEY_DESCRIPTOR_SIZE = 0x8 FSCRYPT_KEY_DESC_PREFIX = "fscrypt:" FSCRYPT_KEY_DESC_PREFIX_SIZE = 0x8 @@ -1574,7 +1590,6 @@ const ( IPV6_DONTFRAG = 0x3e IPV6_DROP_MEMBERSHIP = 0x15 IPV6_DSTOPTS = 0x3b - IPV6_FLOW = 0x11 IPV6_FREEBIND = 0x4e IPV6_HDRINCL = 0x24 IPV6_HOPLIMIT = 0x34 @@ -1625,7 +1640,6 @@ const ( IPV6_TRANSPARENT = 0x4b IPV6_UNICAST_HOPS = 0x10 IPV6_UNICAST_IF = 0x4c - IPV6_USER_FLOW = 0xe IPV6_V6ONLY = 0x1a IPV6_VERSION = 0x60 IPV6_VERSION_MASK = 0xf0 @@ -1687,7 +1701,6 @@ const ( IP_TTL = 0x2 IP_UNBLOCK_SOURCE = 0x25 IP_UNICAST_IF = 0x32 - IP_USER_FLOW = 0xd IP_XFRM_POLICY = 0x11 ISOFS_SUPER_MAGIC = 0x9660 ISTRIP = 0x20 @@ -1809,7 +1822,11 @@ const ( LANDLOCK_ACCESS_FS_WRITE_FILE = 0x2 LANDLOCK_ACCESS_NET_BIND_TCP = 0x1 LANDLOCK_ACCESS_NET_CONNECT_TCP = 0x2 + LANDLOCK_CREATE_RULESET_ERRATA = 0x2 LANDLOCK_CREATE_RULESET_VERSION = 0x1 + LANDLOCK_RESTRICT_SELF_LOG_NEW_EXEC_ON = 0x2 + LANDLOCK_RESTRICT_SELF_LOG_SAME_EXEC_OFF = 0x1 + LANDLOCK_RESTRICT_SELF_LOG_SUBDOMAINS_OFF = 0x4 LANDLOCK_SCOPE_ABSTRACT_UNIX_SOCKET = 0x1 LANDLOCK_SCOPE_SIGNAL = 0x2 LINUX_REBOOT_CMD_CAD_OFF = 0x0 @@ -2485,6 +2502,10 @@ const ( PR_FP_EXC_UND = 0x40000 PR_FP_MODE_FR = 0x1 PR_FP_MODE_FRE = 0x2 + PR_FUTEX_HASH = 0x4e + PR_FUTEX_HASH_GET_IMMUTABLE = 0x3 + PR_FUTEX_HASH_GET_SLOTS = 0x2 + PR_FUTEX_HASH_SET_SLOTS = 0x1 PR_GET_AUXV = 0x41555856 PR_GET_CHILD_SUBREAPER = 0x25 PR_GET_DUMPABLE = 0x3 @@ -2644,6 +2665,10 @@ const ( PR_TAGGED_ADDR_ENABLE = 0x1 PR_TASK_PERF_EVENTS_DISABLE = 0x1f PR_TASK_PERF_EVENTS_ENABLE = 0x20 + PR_TIMER_CREATE_RESTORE_IDS = 0x4d + PR_TIMER_CREATE_RESTORE_IDS_GET = 0x2 + PR_TIMER_CREATE_RESTORE_IDS_OFF = 0x0 + PR_TIMER_CREATE_RESTORE_IDS_ON = 0x1 PR_TIMING_STATISTICAL = 0x0 PR_TIMING_TIMESTAMP = 0x1 PR_TSC_ENABLE = 0x1 @@ -2724,6 +2749,7 @@ const ( PTRACE_SETREGSET = 0x4205 PTRACE_SETSIGINFO = 0x4203 PTRACE_SETSIGMASK = 0x420b + PTRACE_SET_SYSCALL_INFO = 0x4212 PTRACE_SET_SYSCALL_USER_DISPATCH_CONFIG = 0x4210 PTRACE_SINGLESTEP = 0x9 PTRACE_SYSCALL = 0x18 @@ -2787,7 +2813,7 @@ const ( RTAX_UNSPEC = 0x0 RTAX_WINDOW = 0x3 RTA_ALIGNTO = 0x4 - RTA_MAX = 0x1e + RTA_MAX = 0x1f RTCF_DIRECTSRC = 0x4000000 RTCF_DOREDIRECT = 0x1000000 RTCF_LOG = 0x2000000 @@ -2864,10 +2890,12 @@ const ( RTM_DELACTION = 0x31 RTM_DELADDR = 0x15 RTM_DELADDRLABEL = 0x49 + RTM_DELANYCAST = 0x3d RTM_DELCHAIN = 0x65 RTM_DELLINK = 0x11 RTM_DELLINKPROP = 0x6d RTM_DELMDB = 0x55 + RTM_DELMULTICAST = 0x39 RTM_DELNEIGH = 0x1d RTM_DELNETCONF = 0x51 RTM_DELNEXTHOP = 0x69 @@ -2917,11 +2945,13 @@ const ( RTM_NEWACTION = 0x30 RTM_NEWADDR = 0x14 RTM_NEWADDRLABEL = 0x48 + RTM_NEWANYCAST = 0x3c RTM_NEWCACHEREPORT = 0x60 RTM_NEWCHAIN = 0x64 RTM_NEWLINK = 0x10 RTM_NEWLINKPROP = 0x6c RTM_NEWMDB = 0x54 + RTM_NEWMULTICAST = 0x38 RTM_NEWNDUSEROPT = 0x44 RTM_NEWNEIGH = 0x1c RTM_NEWNEIGHTBL = 0x40 @@ -2970,6 +3000,7 @@ const ( RTPROT_NTK = 0xf RTPROT_OPENR = 0x63 RTPROT_OSPF = 0xbc + RTPROT_OVN = 0x54 RTPROT_RA = 0x9 RTPROT_REDIRECT = 0x1 RTPROT_RIP = 0xbd @@ -2987,11 +3018,12 @@ const ( RUSAGE_THREAD = 0x1 RWF_APPEND = 0x10 RWF_ATOMIC = 0x40 + RWF_DONTCACHE = 0x80 RWF_DSYNC = 0x2 RWF_HIPRI = 0x1 RWF_NOAPPEND = 0x20 RWF_NOWAIT = 0x8 - RWF_SUPPORTED = 0x7f + RWF_SUPPORTED = 0xff RWF_SYNC = 0x4 RWF_WRITE_LIFE_NOT_SET = 0x0 SCHED_BATCH = 0x3 @@ -3271,6 +3303,7 @@ const ( STATX_BTIME = 0x800 STATX_CTIME = 0x80 STATX_DIOALIGN = 0x2000 + STATX_DIO_READ_ALIGN = 0x20000 STATX_GID = 0x10 STATX_INO = 0x100 STATX_MNT_ID = 0x1000 @@ -3322,7 +3355,7 @@ const ( TASKSTATS_GENL_NAME = "TASKSTATS" TASKSTATS_GENL_VERSION = 0x1 TASKSTATS_TYPE_MAX = 0x6 - TASKSTATS_VERSION = 0xe + TASKSTATS_VERSION = 0x10 TCIFLUSH = 0x0 TCIOFF = 0x2 TCIOFLUSH = 0x2 @@ -3392,8 +3425,6 @@ const ( TCP_TX_DELAY = 0x25 TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 - TCP_V4_FLOW = 0x1 - TCP_V6_FLOW = 0x5 TCP_WINDOW_CLAMP = 0xa TCP_ZEROCOPY_RECEIVE = 0x23 TFD_TIMER_ABSTIME = 0x1 @@ -3503,6 +3534,7 @@ const ( TP_STATUS_WRONG_FORMAT = 0x4 TRACEFS_MAGIC = 0x74726163 TS_COMM_LEN = 0x20 + UBI_IOCECNFO = 0xc01c6f06 UDF_SUPER_MAGIC = 0x15013346 UDP_CORK = 0x1 UDP_ENCAP = 0x64 @@ -3515,8 +3547,6 @@ const ( UDP_NO_CHECK6_RX = 0x66 UDP_NO_CHECK6_TX = 0x65 UDP_SEGMENT = 0x67 - UDP_V4_FLOW = 0x2 - UDP_V6_FLOW = 0x6 UMOUNT_NOFOLLOW = 0x8 USBDEVICE_SUPER_MAGIC = 0x9fa2 UTIME_NOW = 0x3fffffff @@ -3559,7 +3589,7 @@ const ( WDIOS_TEMPPANIC = 0x4 WDIOS_UNKNOWN = -0x1 WEXITED = 0x4 - WGALLOWEDIP_A_MAX = 0x3 + WGALLOWEDIP_A_MAX = 0x4 WGDEVICE_A_MAX = 0x8 WGPEER_A_MAX = 0xa WG_CMD_MAX = 0x1 @@ -3673,6 +3703,7 @@ const ( XDP_SHARED_UMEM = 0x1 XDP_STATISTICS = 0x7 XDP_TXMD_FLAGS_CHECKSUM = 0x2 + XDP_TXMD_FLAGS_LAUNCH_TIME = 0x4 XDP_TXMD_FLAGS_TIMESTAMP = 0x1 XDP_TX_METADATA = 0x2 XDP_TX_RING = 0x3 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go index 75207613c..1c37f9fbc 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go @@ -68,6 +68,7 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + DM_MPATH_PROBE_PATHS = 0xfd12 ECCGETLAYOUT = 0x81484d11 ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 @@ -360,6 +361,7 @@ const ( SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 SO_PASSPIDFD = 0x4c + SO_PASSRIGHTS = 0x53 SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x11 @@ -372,6 +374,7 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x12 SO_RCVMARK = 0x4b + SO_RCVPRIORITY = 0x52 SO_RCVTIMEO = 0x14 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x14 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go index c68acda53..6f54d34ae 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go @@ -68,6 +68,7 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + DM_MPATH_PROBE_PATHS = 0xfd12 ECCGETLAYOUT = 0x81484d11 ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 @@ -361,6 +362,7 @@ const ( SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 SO_PASSPIDFD = 0x4c + SO_PASSRIGHTS = 0x53 SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x11 @@ -373,6 +375,7 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x12 SO_RCVMARK = 0x4b + SO_RCVPRIORITY = 0x52 SO_RCVTIMEO = 0x14 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x14 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go index a8c607ab8..783ec5c12 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go @@ -68,6 +68,7 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + DM_MPATH_PROBE_PATHS = 0xfd12 ECCGETLAYOUT = 0x81484d11 ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 @@ -366,6 +367,7 @@ const ( SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 SO_PASSPIDFD = 0x4c + SO_PASSRIGHTS = 0x53 SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x11 @@ -378,6 +380,7 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x12 SO_RCVMARK = 0x4b + SO_RCVPRIORITY = 0x52 SO_RCVTIMEO = 0x14 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x14 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go index 18563dd8d..ca83d3ba1 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go @@ -68,6 +68,7 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + DM_MPATH_PROBE_PATHS = 0xfd12 ECCGETLAYOUT = 0x81484d11 ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 @@ -359,6 +360,7 @@ const ( SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 SO_PASSPIDFD = 0x4c + SO_PASSRIGHTS = 0x53 SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x11 @@ -371,6 +373,7 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x12 SO_RCVMARK = 0x4b + SO_RCVPRIORITY = 0x52 SO_RCVTIMEO = 0x14 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x14 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go index 22912cdaa..607e611c0 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go @@ -68,6 +68,7 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + DM_MPATH_PROBE_PATHS = 0xfd12 ECCGETLAYOUT = 0x81484d11 ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 @@ -353,6 +354,7 @@ const ( SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 SO_PASSPIDFD = 0x4c + SO_PASSRIGHTS = 0x53 SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x11 @@ -365,6 +367,7 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x12 SO_RCVMARK = 0x4b + SO_RCVPRIORITY = 0x52 SO_RCVTIMEO = 0x14 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x14 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go index 29344eb37..b9cb5bd3c 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go @@ -68,6 +68,7 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + DM_MPATH_PROBE_PATHS = 0x2000fd12 ECCGETLAYOUT = 0x41484d11 ECCGETSTATS = 0x40104d12 ECHOCTL = 0x200 @@ -359,6 +360,7 @@ const ( SO_OOBINLINE = 0x100 SO_PASSCRED = 0x11 SO_PASSPIDFD = 0x4c + SO_PASSRIGHTS = 0x53 SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x12 @@ -371,6 +373,7 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x1004 SO_RCVMARK = 0x4b + SO_RCVPRIORITY = 0x52 SO_RCVTIMEO = 0x1006 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x1006 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go index 20d51fb96..65b078a63 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go @@ -68,6 +68,7 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + DM_MPATH_PROBE_PATHS = 0x2000fd12 ECCGETLAYOUT = 0x41484d11 ECCGETSTATS = 0x40104d12 ECHOCTL = 0x200 @@ -359,6 +360,7 @@ const ( SO_OOBINLINE = 0x100 SO_PASSCRED = 0x11 SO_PASSPIDFD = 0x4c + SO_PASSRIGHTS = 0x53 SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x12 @@ -371,6 +373,7 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x1004 SO_RCVMARK = 0x4b + SO_RCVPRIORITY = 0x52 SO_RCVTIMEO = 0x1006 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x1006 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go index 321b60902..5298a3033 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go @@ -68,6 +68,7 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + DM_MPATH_PROBE_PATHS = 0x2000fd12 ECCGETLAYOUT = 0x41484d11 ECCGETSTATS = 0x40104d12 ECHOCTL = 0x200 @@ -359,6 +360,7 @@ const ( SO_OOBINLINE = 0x100 SO_PASSCRED = 0x11 SO_PASSPIDFD = 0x4c + SO_PASSRIGHTS = 0x53 SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x12 @@ -371,6 +373,7 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x1004 SO_RCVMARK = 0x4b + SO_RCVPRIORITY = 0x52 SO_RCVTIMEO = 0x1006 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x1006 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go index 9bacdf1e2..7bc557c87 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go @@ -68,6 +68,7 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + DM_MPATH_PROBE_PATHS = 0x2000fd12 ECCGETLAYOUT = 0x41484d11 ECCGETSTATS = 0x40104d12 ECHOCTL = 0x200 @@ -359,6 +360,7 @@ const ( SO_OOBINLINE = 0x100 SO_PASSCRED = 0x11 SO_PASSPIDFD = 0x4c + SO_PASSRIGHTS = 0x53 SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x12 @@ -371,6 +373,7 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x1004 SO_RCVMARK = 0x4b + SO_RCVPRIORITY = 0x52 SO_RCVTIMEO = 0x1006 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x1006 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go index c22427261..152399bb0 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go @@ -68,6 +68,7 @@ const ( CS8 = 0x300 CSIZE = 0x300 CSTOPB = 0x400 + DM_MPATH_PROBE_PATHS = 0x2000fd12 ECCGETLAYOUT = 0x41484d11 ECCGETSTATS = 0x40104d12 ECHOCTL = 0x40 @@ -414,6 +415,7 @@ const ( SO_OOBINLINE = 0xa SO_PASSCRED = 0x14 SO_PASSPIDFD = 0x4c + SO_PASSRIGHTS = 0x53 SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x15 @@ -426,6 +428,7 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x10 SO_RCVMARK = 0x4b + SO_RCVPRIORITY = 0x52 SO_RCVTIMEO = 0x12 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x12 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go index 6270c8ee1..1a1ce2409 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go @@ -68,6 +68,7 @@ const ( CS8 = 0x300 CSIZE = 0x300 CSTOPB = 0x400 + DM_MPATH_PROBE_PATHS = 0x2000fd12 ECCGETLAYOUT = 0x41484d11 ECCGETSTATS = 0x40104d12 ECHOCTL = 0x40 @@ -418,6 +419,7 @@ const ( SO_OOBINLINE = 0xa SO_PASSCRED = 0x14 SO_PASSPIDFD = 0x4c + SO_PASSRIGHTS = 0x53 SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x15 @@ -430,6 +432,7 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x10 SO_RCVMARK = 0x4b + SO_RCVPRIORITY = 0x52 SO_RCVTIMEO = 0x12 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x12 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go index 9966c1941..4231a1fb5 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go @@ -68,6 +68,7 @@ const ( CS8 = 0x300 CSIZE = 0x300 CSTOPB = 0x400 + DM_MPATH_PROBE_PATHS = 0x2000fd12 ECCGETLAYOUT = 0x41484d11 ECCGETSTATS = 0x40104d12 ECHOCTL = 0x40 @@ -418,6 +419,7 @@ const ( SO_OOBINLINE = 0xa SO_PASSCRED = 0x14 SO_PASSPIDFD = 0x4c + SO_PASSRIGHTS = 0x53 SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x15 @@ -430,6 +432,7 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x10 SO_RCVMARK = 0x4b + SO_RCVPRIORITY = 0x52 SO_RCVTIMEO = 0x12 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x12 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go index 848e5fcc4..21c0e9526 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go @@ -68,6 +68,7 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + DM_MPATH_PROBE_PATHS = 0xfd12 ECCGETLAYOUT = 0x81484d11 ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 @@ -350,6 +351,7 @@ const ( SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 SO_PASSPIDFD = 0x4c + SO_PASSRIGHTS = 0x53 SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x11 @@ -362,6 +364,7 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x12 SO_RCVMARK = 0x4b + SO_RCVPRIORITY = 0x52 SO_RCVTIMEO = 0x14 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x14 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go index 669b2adb8..f00d1cd7c 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go @@ -68,6 +68,7 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + DM_MPATH_PROBE_PATHS = 0xfd12 ECCGETLAYOUT = 0x81484d11 ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 @@ -422,6 +423,7 @@ const ( SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 SO_PASSPIDFD = 0x4c + SO_PASSRIGHTS = 0x53 SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x11 @@ -434,6 +436,7 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x12 SO_RCVMARK = 0x4b + SO_RCVPRIORITY = 0x52 SO_RCVTIMEO = 0x14 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x14 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go index 4834e5751..bc8d539e6 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go @@ -71,6 +71,7 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + DM_MPATH_PROBE_PATHS = 0x2000fd12 ECCGETLAYOUT = 0x41484d11 ECCGETSTATS = 0x40104d12 ECHOCTL = 0x200 @@ -461,6 +462,7 @@ const ( SO_OOBINLINE = 0x100 SO_PASSCRED = 0x2 SO_PASSPIDFD = 0x55 + SO_PASSRIGHTS = 0x5c SO_PASSSEC = 0x1f SO_PEEK_OFF = 0x26 SO_PEERCRED = 0x40 @@ -473,6 +475,7 @@ const ( SO_RCVBUFFORCE = 0x100b SO_RCVLOWAT = 0x800 SO_RCVMARK = 0x54 + SO_RCVPRIORITY = 0x5b SO_RCVTIMEO = 0x2000 SO_RCVTIMEO_NEW = 0x44 SO_RCVTIMEO_OLD = 0x2000 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go index 24b346e1a..813c05b66 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go @@ -2512,6 +2512,90 @@ var libc_munmap_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func readv(fd int, iovecs []Iovec) (n int, err error) { + var _p0 unsafe.Pointer + if len(iovecs) > 0 { + _p0 = unsafe.Pointer(&iovecs[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall(libc_readv_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(iovecs))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_readv_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_readv readv "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func preadv(fd int, iovecs []Iovec, offset int64) (n int, err error) { + var _p0 unsafe.Pointer + if len(iovecs) > 0 { + _p0 = unsafe.Pointer(&iovecs[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall6(libc_preadv_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(iovecs)), uintptr(offset), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_preadv_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_preadv preadv "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func writev(fd int, iovecs []Iovec) (n int, err error) { + var _p0 unsafe.Pointer + if len(iovecs) > 0 { + _p0 = unsafe.Pointer(&iovecs[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall(libc_writev_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(iovecs))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_writev_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_writev writev "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pwritev(fd int, iovecs []Iovec, offset int64) (n int, err error) { + var _p0 unsafe.Pointer + if len(iovecs) > 0 { + _p0 = unsafe.Pointer(&iovecs[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall6(libc_pwritev_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(iovecs)), uintptr(offset), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pwritev_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pwritev pwritev "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := syscall_syscall(libc_fstat64_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s index ebd213100..fda328582 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s @@ -738,6 +738,26 @@ TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8 DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB) +TEXT libc_readv_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_readv(SB) +GLOBL ·libc_readv_trampoline_addr(SB), RODATA, $8 +DATA ·libc_readv_trampoline_addr(SB)/8, $libc_readv_trampoline<>(SB) + +TEXT libc_preadv_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_preadv(SB) +GLOBL ·libc_preadv_trampoline_addr(SB), RODATA, $8 +DATA ·libc_preadv_trampoline_addr(SB)/8, $libc_preadv_trampoline<>(SB) + +TEXT libc_writev_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_writev(SB) +GLOBL ·libc_writev_trampoline_addr(SB), RODATA, $8 +DATA ·libc_writev_trampoline_addr(SB)/8, $libc_writev_trampoline<>(SB) + +TEXT libc_pwritev_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pwritev(SB) +GLOBL ·libc_pwritev_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pwritev_trampoline_addr(SB)/8, $libc_pwritev_trampoline<>(SB) + TEXT libc_fstat64_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fstat64(SB) GLOBL ·libc_fstat64_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go index 824b9c2d5..e6f58f3c6 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go @@ -2512,6 +2512,90 @@ var libc_munmap_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func readv(fd int, iovecs []Iovec) (n int, err error) { + var _p0 unsafe.Pointer + if len(iovecs) > 0 { + _p0 = unsafe.Pointer(&iovecs[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall(libc_readv_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(iovecs))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_readv_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_readv readv "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func preadv(fd int, iovecs []Iovec, offset int64) (n int, err error) { + var _p0 unsafe.Pointer + if len(iovecs) > 0 { + _p0 = unsafe.Pointer(&iovecs[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall6(libc_preadv_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(iovecs)), uintptr(offset), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_preadv_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_preadv preadv "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func writev(fd int, iovecs []Iovec) (n int, err error) { + var _p0 unsafe.Pointer + if len(iovecs) > 0 { + _p0 = unsafe.Pointer(&iovecs[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall(libc_writev_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(iovecs))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_writev_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_writev writev "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pwritev(fd int, iovecs []Iovec, offset int64) (n int, err error) { + var _p0 unsafe.Pointer + if len(iovecs) > 0 { + _p0 = unsafe.Pointer(&iovecs[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall6(libc_pwritev_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(iovecs)), uintptr(offset), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pwritev_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pwritev pwritev "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := syscall_syscall(libc_fstat_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s index 4f178a229..7f8998b90 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s @@ -738,6 +738,26 @@ TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8 DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB) +TEXT libc_readv_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_readv(SB) +GLOBL ·libc_readv_trampoline_addr(SB), RODATA, $8 +DATA ·libc_readv_trampoline_addr(SB)/8, $libc_readv_trampoline<>(SB) + +TEXT libc_preadv_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_preadv(SB) +GLOBL ·libc_preadv_trampoline_addr(SB), RODATA, $8 +DATA ·libc_preadv_trampoline_addr(SB)/8, $libc_preadv_trampoline<>(SB) + +TEXT libc_writev_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_writev(SB) +GLOBL ·libc_writev_trampoline_addr(SB), RODATA, $8 +DATA ·libc_writev_trampoline_addr(SB)/8, $libc_writev_trampoline<>(SB) + +TEXT libc_pwritev_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pwritev(SB) +GLOBL ·libc_pwritev_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pwritev_trampoline_addr(SB)/8, $libc_pwritev_trampoline<>(SB) + TEXT libc_fstat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fstat(SB) GLOBL ·libc_fstat_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go index c6545413c..b4609c20c 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go @@ -72,7 +72,7 @@ import ( //go:cgo_import_dynamic libc_kill kill "libc.so" //go:cgo_import_dynamic libc_lchown lchown "libc.so" //go:cgo_import_dynamic libc_link link "libc.so" -//go:cgo_import_dynamic libc___xnet_llisten __xnet_llisten "libsocket.so" +//go:cgo_import_dynamic libc___xnet_listen __xnet_listen "libsocket.so" //go:cgo_import_dynamic libc_lstat lstat "libc.so" //go:cgo_import_dynamic libc_madvise madvise "libc.so" //go:cgo_import_dynamic libc_mkdir mkdir "libc.so" @@ -221,7 +221,7 @@ import ( //go:linkname procKill libc_kill //go:linkname procLchown libc_lchown //go:linkname procLink libc_link -//go:linkname proc__xnet_llisten libc___xnet_llisten +//go:linkname proc__xnet_listen libc___xnet_listen //go:linkname procLstat libc_lstat //go:linkname procMadvise libc_madvise //go:linkname procMkdir libc_mkdir @@ -371,7 +371,7 @@ var ( procKill, procLchown, procLink, - proc__xnet_llisten, + proc__xnet_listen, procLstat, procMadvise, procMkdir, @@ -1178,7 +1178,7 @@ func Link(path string, link string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Listen(s int, backlog int) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_llisten)), 2, uintptr(s), uintptr(backlog), 0, 0, 0, 0) + _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_listen)), 2, uintptr(s), uintptr(backlog), 0, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go index c79aaff30..aca56ee49 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go @@ -462,4 +462,5 @@ const ( SYS_GETXATTRAT = 464 SYS_LISTXATTRAT = 465 SYS_REMOVEXATTRAT = 466 + SYS_OPEN_TREE_ATTR = 467 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go index 5eb450695..2ea1ef58c 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go @@ -385,4 +385,5 @@ const ( SYS_GETXATTRAT = 464 SYS_LISTXATTRAT = 465 SYS_REMOVEXATTRAT = 466 + SYS_OPEN_TREE_ATTR = 467 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go index 05e502974..d22c8af31 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go @@ -426,4 +426,5 @@ const ( SYS_GETXATTRAT = 464 SYS_LISTXATTRAT = 465 SYS_REMOVEXATTRAT = 466 + SYS_OPEN_TREE_ATTR = 467 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go index 38c53ec51..5ee264ae9 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go @@ -329,4 +329,5 @@ const ( SYS_GETXATTRAT = 464 SYS_LISTXATTRAT = 465 SYS_REMOVEXATTRAT = 466 + SYS_OPEN_TREE_ATTR = 467 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go index 31d2e71a1..f9f03ebf5 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go @@ -325,4 +325,5 @@ const ( SYS_GETXATTRAT = 464 SYS_LISTXATTRAT = 465 SYS_REMOVEXATTRAT = 466 + SYS_OPEN_TREE_ATTR = 467 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go index f4184a336..87c2118e8 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go @@ -446,4 +446,5 @@ const ( SYS_GETXATTRAT = 4464 SYS_LISTXATTRAT = 4465 SYS_REMOVEXATTRAT = 4466 + SYS_OPEN_TREE_ATTR = 4467 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go index 05b996227..391ad102f 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go @@ -376,4 +376,5 @@ const ( SYS_GETXATTRAT = 5464 SYS_LISTXATTRAT = 5465 SYS_REMOVEXATTRAT = 5466 + SYS_OPEN_TREE_ATTR = 5467 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go index 43a256e9e..565615775 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go @@ -376,4 +376,5 @@ const ( SYS_GETXATTRAT = 5464 SYS_LISTXATTRAT = 5465 SYS_REMOVEXATTRAT = 5466 + SYS_OPEN_TREE_ATTR = 5467 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go index eea5ddfc2..0482b52e3 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go @@ -446,4 +446,5 @@ const ( SYS_GETXATTRAT = 4464 SYS_LISTXATTRAT = 4465 SYS_REMOVEXATTRAT = 4466 + SYS_OPEN_TREE_ATTR = 4467 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go index 0d777bfbb..71806f08f 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go @@ -453,4 +453,5 @@ const ( SYS_GETXATTRAT = 464 SYS_LISTXATTRAT = 465 SYS_REMOVEXATTRAT = 466 + SYS_OPEN_TREE_ATTR = 467 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go index b44636502..e35a71058 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go @@ -425,4 +425,5 @@ const ( SYS_GETXATTRAT = 464 SYS_LISTXATTRAT = 465 SYS_REMOVEXATTRAT = 466 + SYS_OPEN_TREE_ATTR = 467 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go index 0c7d21c18..2aea47670 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go @@ -425,4 +425,5 @@ const ( SYS_GETXATTRAT = 464 SYS_LISTXATTRAT = 465 SYS_REMOVEXATTRAT = 466 + SYS_OPEN_TREE_ATTR = 467 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go index 840539169..6c9bb4e56 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go @@ -330,4 +330,5 @@ const ( SYS_GETXATTRAT = 464 SYS_LISTXATTRAT = 465 SYS_REMOVEXATTRAT = 466 + SYS_OPEN_TREE_ATTR = 467 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go index fcf1b790d..680bc9915 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go @@ -391,4 +391,5 @@ const ( SYS_GETXATTRAT = 464 SYS_LISTXATTRAT = 465 SYS_REMOVEXATTRAT = 466 + SYS_OPEN_TREE_ATTR = 467 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go index 52d15b5f9..620f27105 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go @@ -404,4 +404,5 @@ const ( SYS_GETXATTRAT = 464 SYS_LISTXATTRAT = 465 SYS_REMOVEXATTRAT = 466 + SYS_OPEN_TREE_ATTR = 467 ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux.go b/vendor/golang.org/x/sys/unix/ztypes_linux.go index a46abe647..944e75a11 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux.go @@ -114,8 +114,10 @@ type Statx_t struct { Atomic_write_unit_min uint32 Atomic_write_unit_max uint32 Atomic_write_segments_max uint32 + Dio_read_offset_align uint32 + Atomic_write_unit_max_opt uint32 _ [1]uint32 - _ [9]uint64 + _ [8]uint64 } type Fsid struct { @@ -199,7 +201,8 @@ type FscryptAddKeyArg struct { Key_spec FscryptKeySpecifier Raw_size uint32 Key_id uint32 - _ [8]uint32 + Flags uint32 + _ [7]uint32 } type FscryptRemoveKeyArg struct { @@ -629,6 +632,8 @@ const ( IFA_FLAGS = 0x8 IFA_RT_PRIORITY = 0x9 IFA_TARGET_NETNSID = 0xa + IFAL_LABEL = 0x2 + IFAL_ADDRESS = 0x1 RT_SCOPE_UNIVERSE = 0x0 RT_SCOPE_SITE = 0xc8 RT_SCOPE_LINK = 0xfd @@ -686,6 +691,7 @@ const ( SizeofRtAttr = 0x4 SizeofIfInfomsg = 0x10 SizeofIfAddrmsg = 0x8 + SizeofIfAddrlblmsg = 0xc SizeofIfaCacheinfo = 0x10 SizeofRtMsg = 0xc SizeofRtNexthop = 0x8 @@ -737,6 +743,15 @@ type IfAddrmsg struct { Index uint32 } +type IfAddrlblmsg struct { + Family uint8 + _ uint8 + Prefixlen uint8 + Flags uint8 + Index uint32 + Seq uint32 +} + type IfaCacheinfo struct { Prefered uint32 Valid uint32 @@ -2226,8 +2241,11 @@ const ( NFT_PAYLOAD_LL_HEADER = 0x0 NFT_PAYLOAD_NETWORK_HEADER = 0x1 NFT_PAYLOAD_TRANSPORT_HEADER = 0x2 + NFT_PAYLOAD_INNER_HEADER = 0x3 + NFT_PAYLOAD_TUN_HEADER = 0x4 NFT_PAYLOAD_CSUM_NONE = 0x0 NFT_PAYLOAD_CSUM_INET = 0x1 + NFT_PAYLOAD_CSUM_SCTP = 0x2 NFT_PAYLOAD_L4CSUM_PSEUDOHDR = 0x1 NFTA_PAYLOAD_UNSPEC = 0x0 NFTA_PAYLOAD_DREG = 0x1 @@ -2314,6 +2332,11 @@ const ( NFT_CT_AVGPKT = 0x10 NFT_CT_ZONE = 0x11 NFT_CT_EVENTMASK = 0x12 + NFT_CT_SRC_IP = 0x13 + NFT_CT_DST_IP = 0x14 + NFT_CT_SRC_IP6 = 0x15 + NFT_CT_DST_IP6 = 0x16 + NFT_CT_ID = 0x17 NFTA_CT_UNSPEC = 0x0 NFTA_CT_DREG = 0x1 NFTA_CT_KEY = 0x2 @@ -2594,8 +2617,8 @@ const ( SOF_TIMESTAMPING_BIND_PHC = 0x8000 SOF_TIMESTAMPING_OPT_ID_TCP = 0x10000 - SOF_TIMESTAMPING_LAST = 0x20000 - SOF_TIMESTAMPING_MASK = 0x3ffff + SOF_TIMESTAMPING_LAST = 0x40000 + SOF_TIMESTAMPING_MASK = 0x7ffff SCM_TSTAMP_SND = 0x0 SCM_TSTAMP_SCHED = 0x1 @@ -3041,6 +3064,23 @@ const ( ) const ( + TCA_UNSPEC = 0x0 + TCA_KIND = 0x1 + TCA_OPTIONS = 0x2 + TCA_STATS = 0x3 + TCA_XSTATS = 0x4 + TCA_RATE = 0x5 + TCA_FCNT = 0x6 + TCA_STATS2 = 0x7 + TCA_STAB = 0x8 + TCA_PAD = 0x9 + TCA_DUMP_INVISIBLE = 0xa + TCA_CHAIN = 0xb + TCA_HW_OFFLOAD = 0xc + TCA_INGRESS_BLOCK = 0xd + TCA_EGRESS_BLOCK = 0xe + TCA_DUMP_FLAGS = 0xf + TCA_EXT_WARN_MSG = 0x10 RTNLGRP_NONE = 0x0 RTNLGRP_LINK = 0x1 RTNLGRP_NOTIFY = 0x2 @@ -3075,6 +3115,18 @@ const ( RTNLGRP_IPV6_MROUTE_R = 0x1f RTNLGRP_NEXTHOP = 0x20 RTNLGRP_BRVLAN = 0x21 + RTNLGRP_MCTP_IFADDR = 0x22 + RTNLGRP_TUNNEL = 0x23 + RTNLGRP_STATS = 0x24 + RTNLGRP_IPV4_MCADDR = 0x25 + RTNLGRP_IPV6_MCADDR = 0x26 + RTNLGRP_IPV6_ACADDR = 0x27 + TCA_ROOT_UNSPEC = 0x0 + TCA_ROOT_TAB = 0x1 + TCA_ROOT_FLAGS = 0x2 + TCA_ROOT_COUNT = 0x3 + TCA_ROOT_TIME_DELTA = 0x4 + TCA_ROOT_EXT_WARN_MSG = 0x5 ) type CapUserHeader struct { @@ -3802,7 +3854,16 @@ const ( ETHTOOL_MSG_PSE_GET = 0x24 ETHTOOL_MSG_PSE_SET = 0x25 ETHTOOL_MSG_RSS_GET = 0x26 - ETHTOOL_MSG_USER_MAX = 0x2d + ETHTOOL_MSG_PLCA_GET_CFG = 0x27 + ETHTOOL_MSG_PLCA_SET_CFG = 0x28 + ETHTOOL_MSG_PLCA_GET_STATUS = 0x29 + ETHTOOL_MSG_MM_GET = 0x2a + ETHTOOL_MSG_MM_SET = 0x2b + ETHTOOL_MSG_MODULE_FW_FLASH_ACT = 0x2c + ETHTOOL_MSG_PHY_GET = 0x2d + ETHTOOL_MSG_TSCONFIG_GET = 0x2e + ETHTOOL_MSG_TSCONFIG_SET = 0x2f + ETHTOOL_MSG_USER_MAX = 0x2f ETHTOOL_MSG_KERNEL_NONE = 0x0 ETHTOOL_MSG_STRSET_GET_REPLY = 0x1 ETHTOOL_MSG_LINKINFO_GET_REPLY = 0x2 @@ -3842,7 +3903,17 @@ const ( ETHTOOL_MSG_MODULE_NTF = 0x24 ETHTOOL_MSG_PSE_GET_REPLY = 0x25 ETHTOOL_MSG_RSS_GET_REPLY = 0x26 - ETHTOOL_MSG_KERNEL_MAX = 0x2e + ETHTOOL_MSG_PLCA_GET_CFG_REPLY = 0x27 + ETHTOOL_MSG_PLCA_GET_STATUS_REPLY = 0x28 + ETHTOOL_MSG_PLCA_NTF = 0x29 + ETHTOOL_MSG_MM_GET_REPLY = 0x2a + ETHTOOL_MSG_MM_NTF = 0x2b + ETHTOOL_MSG_MODULE_FW_FLASH_NTF = 0x2c + ETHTOOL_MSG_PHY_GET_REPLY = 0x2d + ETHTOOL_MSG_PHY_NTF = 0x2e + ETHTOOL_MSG_TSCONFIG_GET_REPLY = 0x2f + ETHTOOL_MSG_TSCONFIG_SET_REPLY = 0x30 + ETHTOOL_MSG_KERNEL_MAX = 0x30 ETHTOOL_FLAG_COMPACT_BITSETS = 0x1 ETHTOOL_FLAG_OMIT_REPLY = 0x2 ETHTOOL_FLAG_STATS = 0x4 @@ -3949,7 +4020,12 @@ const ( ETHTOOL_A_RINGS_TCP_DATA_SPLIT = 0xb ETHTOOL_A_RINGS_CQE_SIZE = 0xc ETHTOOL_A_RINGS_TX_PUSH = 0xd - ETHTOOL_A_RINGS_MAX = 0x10 + ETHTOOL_A_RINGS_RX_PUSH = 0xe + ETHTOOL_A_RINGS_TX_PUSH_BUF_LEN = 0xf + ETHTOOL_A_RINGS_TX_PUSH_BUF_LEN_MAX = 0x10 + ETHTOOL_A_RINGS_HDS_THRESH = 0x11 + ETHTOOL_A_RINGS_HDS_THRESH_MAX = 0x12 + ETHTOOL_A_RINGS_MAX = 0x12 ETHTOOL_A_CHANNELS_UNSPEC = 0x0 ETHTOOL_A_CHANNELS_HEADER = 0x1 ETHTOOL_A_CHANNELS_RX_MAX = 0x2 @@ -4015,7 +4091,9 @@ const ( ETHTOOL_A_TSINFO_TX_TYPES = 0x3 ETHTOOL_A_TSINFO_RX_FILTERS = 0x4 ETHTOOL_A_TSINFO_PHC_INDEX = 0x5 - ETHTOOL_A_TSINFO_MAX = 0x6 + ETHTOOL_A_TSINFO_STATS = 0x6 + ETHTOOL_A_TSINFO_HWTSTAMP_PROVIDER = 0x7 + ETHTOOL_A_TSINFO_MAX = 0x9 ETHTOOL_A_CABLE_TEST_UNSPEC = 0x0 ETHTOOL_A_CABLE_TEST_HEADER = 0x1 ETHTOOL_A_CABLE_TEST_MAX = 0x1 @@ -4101,6 +4179,19 @@ const ( ETHTOOL_A_TUNNEL_INFO_MAX = 0x2 ) +const ( + TCP_V4_FLOW = 0x1 + UDP_V4_FLOW = 0x2 + TCP_V6_FLOW = 0x5 + UDP_V6_FLOW = 0x6 + ESP_V4_FLOW = 0xa + ESP_V6_FLOW = 0xc + IP_USER_FLOW = 0xd + IPV6_USER_FLOW = 0xe + IPV6_FLOW = 0x11 + ETHER_FLOW = 0x12 +) + const SPEED_UNKNOWN = -0x1 type EthtoolDrvinfo struct { @@ -4613,6 +4704,7 @@ const ( NL80211_ATTR_AKM_SUITES = 0x4c NL80211_ATTR_AP_ISOLATE = 0x60 NL80211_ATTR_AP_SETTINGS_FLAGS = 0x135 + NL80211_ATTR_ASSOC_SPP_AMSDU = 0x14a NL80211_ATTR_AUTH_DATA = 0x9c NL80211_ATTR_AUTH_TYPE = 0x35 NL80211_ATTR_BANDS = 0xef @@ -4623,6 +4715,7 @@ const ( NL80211_ATTR_BSS_BASIC_RATES = 0x24 NL80211_ATTR_BSS = 0x2f NL80211_ATTR_BSS_CTS_PROT = 0x1c + NL80211_ATTR_BSS_DUMP_INCLUDE_USE_DATA = 0x147 NL80211_ATTR_BSS_HT_OPMODE = 0x6d NL80211_ATTR_BSSID = 0xf5 NL80211_ATTR_BSS_SELECT = 0xe3 @@ -4682,6 +4775,7 @@ const ( NL80211_ATTR_DTIM_PERIOD = 0xd NL80211_ATTR_DURATION = 0x57 NL80211_ATTR_EHT_CAPABILITY = 0x136 + NL80211_ATTR_EMA_RNR_ELEMS = 0x145 NL80211_ATTR_EML_CAPABILITY = 0x13d NL80211_ATTR_EXT_CAPA = 0xa9 NL80211_ATTR_EXT_CAPA_MASK = 0xaa @@ -4717,6 +4811,7 @@ const ( NL80211_ATTR_HIDDEN_SSID = 0x7e NL80211_ATTR_HT_CAPABILITY = 0x1f NL80211_ATTR_HT_CAPABILITY_MASK = 0x94 + NL80211_ATTR_HW_TIMESTAMP_ENABLED = 0x144 NL80211_ATTR_IE_ASSOC_RESP = 0x80 NL80211_ATTR_IE = 0x2a NL80211_ATTR_IE_PROBE_RESP = 0x7f @@ -4747,9 +4842,10 @@ const ( NL80211_ATTR_MAC_HINT = 0xc8 NL80211_ATTR_MAC_MASK = 0xd7 NL80211_ATTR_MAX_AP_ASSOC_STA = 0xca - NL80211_ATTR_MAX = 0x14d + NL80211_ATTR_MAX = 0x151 NL80211_ATTR_MAX_CRIT_PROT_DURATION = 0xb4 NL80211_ATTR_MAX_CSA_COUNTERS = 0xce + NL80211_ATTR_MAX_HW_TIMESTAMP_PEERS = 0x143 NL80211_ATTR_MAX_MATCH_SETS = 0x85 NL80211_ATTR_MAX_NUM_AKM_SUITES = 0x13c NL80211_ATTR_MAX_NUM_PMKIDS = 0x56 @@ -4774,9 +4870,12 @@ const ( NL80211_ATTR_MGMT_SUBTYPE = 0x29 NL80211_ATTR_MLD_ADDR = 0x13a NL80211_ATTR_MLD_CAPA_AND_OPS = 0x13e + NL80211_ATTR_MLO_LINK_DISABLED = 0x146 NL80211_ATTR_MLO_LINK_ID = 0x139 NL80211_ATTR_MLO_LINKS = 0x138 NL80211_ATTR_MLO_SUPPORT = 0x13b + NL80211_ATTR_MLO_TTLM_DLINK = 0x148 + NL80211_ATTR_MLO_TTLM_ULINK = 0x149 NL80211_ATTR_MNTR_FLAGS = 0x17 NL80211_ATTR_MPATH_INFO = 0x1b NL80211_ATTR_MPATH_NEXT_HOP = 0x1a @@ -4809,12 +4908,14 @@ const ( NL80211_ATTR_PORT_AUTHORIZED = 0x103 NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN = 0x5 NL80211_ATTR_POWER_RULE_MAX_EIRP = 0x6 + NL80211_ATTR_POWER_RULE_PSD = 0x8 NL80211_ATTR_PREV_BSSID = 0x4f NL80211_ATTR_PRIVACY = 0x46 NL80211_ATTR_PROBE_RESP = 0x91 NL80211_ATTR_PROBE_RESP_OFFLOAD = 0x90 NL80211_ATTR_PROTOCOL_FEATURES = 0xad NL80211_ATTR_PS_STATE = 0x5d + NL80211_ATTR_PUNCT_BITMAP = 0x142 NL80211_ATTR_QOS_MAP = 0xc7 NL80211_ATTR_RADAR_BACKGROUND = 0x134 NL80211_ATTR_RADAR_EVENT = 0xa8 @@ -4943,7 +5044,9 @@ const ( NL80211_ATTR_WIPHY_FREQ = 0x26 NL80211_ATTR_WIPHY_FREQ_HINT = 0xc9 NL80211_ATTR_WIPHY_FREQ_OFFSET = 0x122 + NL80211_ATTR_WIPHY_INTERFACE_COMBINATIONS = 0x14c NL80211_ATTR_WIPHY_NAME = 0x2 + NL80211_ATTR_WIPHY_RADIOS = 0x14b NL80211_ATTR_WIPHY_RETRY_LONG = 0x3e NL80211_ATTR_WIPHY_RETRY_SHORT = 0x3d NL80211_ATTR_WIPHY_RTS_THRESHOLD = 0x40 @@ -4978,6 +5081,8 @@ const ( NL80211_BAND_ATTR_IFTYPE_DATA = 0x9 NL80211_BAND_ATTR_MAX = 0xd NL80211_BAND_ATTR_RATES = 0x2 + NL80211_BAND_ATTR_S1G_CAPA = 0xd + NL80211_BAND_ATTR_S1G_MCS_NSS_SET = 0xc NL80211_BAND_ATTR_VHT_CAPA = 0x8 NL80211_BAND_ATTR_VHT_MCS_SET = 0x7 NL80211_BAND_IFTYPE_ATTR_EHT_CAP_MAC = 0x8 @@ -5001,6 +5106,10 @@ const ( NL80211_BSS_BEACON_INTERVAL = 0x4 NL80211_BSS_BEACON_TSF = 0xd NL80211_BSS_BSSID = 0x1 + NL80211_BSS_CANNOT_USE_6GHZ_PWR_MISMATCH = 0x2 + NL80211_BSS_CANNOT_USE_NSTR_NONPRIMARY = 0x1 + NL80211_BSS_CANNOT_USE_REASONS = 0x18 + NL80211_BSS_CANNOT_USE_UHB_PWR_MISMATCH = 0x2 NL80211_BSS_CAPABILITY = 0x5 NL80211_BSS_CHAIN_SIGNAL = 0x13 NL80211_BSS_CHAN_WIDTH_10 = 0x1 @@ -5032,6 +5141,9 @@ const ( NL80211_BSS_STATUS = 0x9 NL80211_BSS_STATUS_IBSS_JOINED = 0x2 NL80211_BSS_TSF = 0x3 + NL80211_BSS_USE_FOR = 0x17 + NL80211_BSS_USE_FOR_MLD_LINK = 0x2 + NL80211_BSS_USE_FOR_NORMAL = 0x1 NL80211_CHAN_HT20 = 0x1 NL80211_CHAN_HT40MINUS = 0x2 NL80211_CHAN_HT40PLUS = 0x3 @@ -5117,7 +5229,8 @@ const ( NL80211_CMD_LEAVE_IBSS = 0x2c NL80211_CMD_LEAVE_MESH = 0x45 NL80211_CMD_LEAVE_OCB = 0x6d - NL80211_CMD_MAX = 0x9b + NL80211_CMD_LINKS_REMOVED = 0x9a + NL80211_CMD_MAX = 0x9d NL80211_CMD_MICHAEL_MIC_FAILURE = 0x29 NL80211_CMD_MODIFY_LINK_STA = 0x97 NL80211_CMD_NAN_MATCH = 0x78 @@ -5161,6 +5274,7 @@ const ( NL80211_CMD_SET_COALESCE = 0x65 NL80211_CMD_SET_CQM = 0x3f NL80211_CMD_SET_FILS_AAD = 0x92 + NL80211_CMD_SET_HW_TIMESTAMP = 0x99 NL80211_CMD_SET_INTERFACE = 0x6 NL80211_CMD_SET_KEY = 0xa NL80211_CMD_SET_MAC_ACL = 0x5d @@ -5180,6 +5294,7 @@ const ( NL80211_CMD_SET_SAR_SPECS = 0x8c NL80211_CMD_SET_STATION = 0x12 NL80211_CMD_SET_TID_CONFIG = 0x89 + NL80211_CMD_SET_TID_TO_LINK_MAPPING = 0x9b NL80211_CMD_SET_TX_BITRATE_MASK = 0x39 NL80211_CMD_SET_WDS_PEER = 0x42 NL80211_CMD_SET_WIPHY = 0x2 @@ -5247,6 +5362,7 @@ const ( NL80211_EXT_FEATURE_AIRTIME_FAIRNESS = 0x21 NL80211_EXT_FEATURE_AP_PMKSA_CACHING = 0x22 NL80211_EXT_FEATURE_AQL = 0x28 + NL80211_EXT_FEATURE_AUTH_AND_DEAUTH_RANDOM_TA = 0x40 NL80211_EXT_FEATURE_BEACON_PROTECTION_CLIENT = 0x2e NL80211_EXT_FEATURE_BEACON_PROTECTION = 0x29 NL80211_EXT_FEATURE_BEACON_RATE_HE = 0x36 @@ -5262,6 +5378,7 @@ const ( NL80211_EXT_FEATURE_CQM_RSSI_LIST = 0xd NL80211_EXT_FEATURE_DATA_ACK_SIGNAL_SUPPORT = 0x1b NL80211_EXT_FEATURE_DEL_IBSS_STA = 0x2c + NL80211_EXT_FEATURE_DFS_CONCURRENT = 0x43 NL80211_EXT_FEATURE_DFS_OFFLOAD = 0x19 NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER = 0x20 NL80211_EXT_FEATURE_EXT_KEY_ID = 0x24 @@ -5281,9 +5398,12 @@ const ( NL80211_EXT_FEATURE_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION = 0x14 NL80211_EXT_FEATURE_OCE_PROBE_REQ_HIGH_TX_RATE = 0x13 NL80211_EXT_FEATURE_OPERATING_CHANNEL_VALIDATION = 0x31 + NL80211_EXT_FEATURE_OWE_OFFLOAD_AP = 0x42 + NL80211_EXT_FEATURE_OWE_OFFLOAD = 0x41 NL80211_EXT_FEATURE_POWERED_ADDR_CHANGE = 0x3d NL80211_EXT_FEATURE_PROTECTED_TWT = 0x2b NL80211_EXT_FEATURE_PROT_RANGE_NEGO_AND_MEASURE = 0x39 + NL80211_EXT_FEATURE_PUNCT = 0x3e NL80211_EXT_FEATURE_RADAR_BACKGROUND = 0x3c NL80211_EXT_FEATURE_RRM = 0x1 NL80211_EXT_FEATURE_SAE_OFFLOAD_AP = 0x33 @@ -5295,8 +5415,10 @@ const ( NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD = 0x23 NL80211_EXT_FEATURE_SCHED_SCAN_RELATIVE_RSSI = 0xc NL80211_EXT_FEATURE_SECURE_LTF = 0x37 + NL80211_EXT_FEATURE_SECURE_NAN = 0x3f NL80211_EXT_FEATURE_SECURE_RTT = 0x38 NL80211_EXT_FEATURE_SET_SCAN_DWELL = 0x5 + NL80211_EXT_FEATURE_SPP_AMSDU_SUPPORT = 0x44 NL80211_EXT_FEATURE_STA_TX_PWR = 0x25 NL80211_EXT_FEATURE_TXQS = 0x1c NL80211_EXT_FEATURE_UNSOL_BCAST_PROBE_RESP = 0x35 @@ -5343,7 +5465,10 @@ const ( NL80211_FREQUENCY_ATTR_2MHZ = 0x16 NL80211_FREQUENCY_ATTR_4MHZ = 0x17 NL80211_FREQUENCY_ATTR_8MHZ = 0x18 + NL80211_FREQUENCY_ATTR_ALLOW_6GHZ_VLP_AP = 0x21 + NL80211_FREQUENCY_ATTR_CAN_MONITOR = 0x20 NL80211_FREQUENCY_ATTR_DFS_CAC_TIME = 0xd + NL80211_FREQUENCY_ATTR_DFS_CONCURRENT = 0x1d NL80211_FREQUENCY_ATTR_DFS_STATE = 0x7 NL80211_FREQUENCY_ATTR_DFS_TIME = 0x8 NL80211_FREQUENCY_ATTR_DISABLED = 0x2 @@ -5351,12 +5476,14 @@ const ( NL80211_FREQUENCY_ATTR_GO_CONCURRENT = 0xf NL80211_FREQUENCY_ATTR_INDOOR_ONLY = 0xe NL80211_FREQUENCY_ATTR_IR_CONCURRENT = 0xf - NL80211_FREQUENCY_ATTR_MAX = 0x21 + NL80211_FREQUENCY_ATTR_MAX = 0x22 NL80211_FREQUENCY_ATTR_MAX_TX_POWER = 0x6 NL80211_FREQUENCY_ATTR_NO_10MHZ = 0x11 NL80211_FREQUENCY_ATTR_NO_160MHZ = 0xc NL80211_FREQUENCY_ATTR_NO_20MHZ = 0x10 NL80211_FREQUENCY_ATTR_NO_320MHZ = 0x1a + NL80211_FREQUENCY_ATTR_NO_6GHZ_AFC_CLIENT = 0x1f + NL80211_FREQUENCY_ATTR_NO_6GHZ_VLP_CLIENT = 0x1e NL80211_FREQUENCY_ATTR_NO_80MHZ = 0xb NL80211_FREQUENCY_ATTR_NO_EHT = 0x1b NL80211_FREQUENCY_ATTR_NO_HE = 0x13 @@ -5364,8 +5491,11 @@ const ( NL80211_FREQUENCY_ATTR_NO_HT40_PLUS = 0xa NL80211_FREQUENCY_ATTR_NO_IBSS = 0x3 NL80211_FREQUENCY_ATTR_NO_IR = 0x3 + NL80211_FREQUENCY_ATTR_NO_UHB_AFC_CLIENT = 0x1f + NL80211_FREQUENCY_ATTR_NO_UHB_VLP_CLIENT = 0x1e NL80211_FREQUENCY_ATTR_OFFSET = 0x14 NL80211_FREQUENCY_ATTR_PASSIVE_SCAN = 0x3 + NL80211_FREQUENCY_ATTR_PSD = 0x1c NL80211_FREQUENCY_ATTR_RADAR = 0x5 NL80211_FREQUENCY_ATTR_WMM = 0x12 NL80211_FTM_RESP_ATTR_CIVICLOC = 0x3 @@ -5430,6 +5560,7 @@ const ( NL80211_IFTYPE_STATION = 0x2 NL80211_IFTYPE_UNSPECIFIED = 0x0 NL80211_IFTYPE_WDS = 0x5 + NL80211_KCK_EXT_LEN_32 = 0x20 NL80211_KCK_EXT_LEN = 0x18 NL80211_KCK_LEN = 0x10 NL80211_KEK_EXT_LEN = 0x20 @@ -5458,9 +5589,10 @@ const ( NL80211_MAX_SUPP_HT_RATES = 0x4d NL80211_MAX_SUPP_RATES = 0x20 NL80211_MAX_SUPP_REG_RULES = 0x80 + NL80211_MAX_SUPP_SELECTORS = 0x80 NL80211_MBSSID_CONFIG_ATTR_EMA = 0x5 NL80211_MBSSID_CONFIG_ATTR_INDEX = 0x3 - NL80211_MBSSID_CONFIG_ATTR_MAX = 0x5 + NL80211_MBSSID_CONFIG_ATTR_MAX = 0x6 NL80211_MBSSID_CONFIG_ATTR_MAX_EMA_PROFILE_PERIODICITY = 0x2 NL80211_MBSSID_CONFIG_ATTR_MAX_INTERFACES = 0x1 NL80211_MBSSID_CONFIG_ATTR_TX_IFINDEX = 0x4 @@ -5703,11 +5835,16 @@ const ( NL80211_RADAR_PRE_CAC_EXPIRED = 0x4 NL80211_RATE_INFO_10_MHZ_WIDTH = 0xb NL80211_RATE_INFO_160_MHZ_WIDTH = 0xa + NL80211_RATE_INFO_16_MHZ_WIDTH = 0x1d + NL80211_RATE_INFO_1_MHZ_WIDTH = 0x19 + NL80211_RATE_INFO_2_MHZ_WIDTH = 0x1a NL80211_RATE_INFO_320_MHZ_WIDTH = 0x12 NL80211_RATE_INFO_40_MHZ_WIDTH = 0x3 + NL80211_RATE_INFO_4_MHZ_WIDTH = 0x1b NL80211_RATE_INFO_5_MHZ_WIDTH = 0xc NL80211_RATE_INFO_80_MHZ_WIDTH = 0x8 NL80211_RATE_INFO_80P80_MHZ_WIDTH = 0x9 + NL80211_RATE_INFO_8_MHZ_WIDTH = 0x1c NL80211_RATE_INFO_BITRATE32 = 0x5 NL80211_RATE_INFO_BITRATE = 0x1 NL80211_RATE_INFO_EHT_GI_0_8 = 0x0 @@ -5753,6 +5890,8 @@ const ( NL80211_RATE_INFO_HE_RU_ALLOC = 0x11 NL80211_RATE_INFO_MAX = 0x1d NL80211_RATE_INFO_MCS = 0x2 + NL80211_RATE_INFO_S1G_MCS = 0x17 + NL80211_RATE_INFO_S1G_NSS = 0x18 NL80211_RATE_INFO_SHORT_GI = 0x4 NL80211_RATE_INFO_VHT_MCS = 0x6 NL80211_RATE_INFO_VHT_NSS = 0x7 @@ -5770,14 +5909,19 @@ const ( NL80211_REKEY_DATA_KEK = 0x1 NL80211_REKEY_DATA_REPLAY_CTR = 0x3 NL80211_REPLAY_CTR_LEN = 0x8 + NL80211_RRF_ALLOW_6GHZ_VLP_AP = 0x1000000 NL80211_RRF_AUTO_BW = 0x800 NL80211_RRF_DFS = 0x10 + NL80211_RRF_DFS_CONCURRENT = 0x200000 NL80211_RRF_GO_CONCURRENT = 0x1000 NL80211_RRF_IR_CONCURRENT = 0x1000 NL80211_RRF_NO_160MHZ = 0x10000 NL80211_RRF_NO_320MHZ = 0x40000 + NL80211_RRF_NO_6GHZ_AFC_CLIENT = 0x800000 + NL80211_RRF_NO_6GHZ_VLP_CLIENT = 0x400000 NL80211_RRF_NO_80MHZ = 0x8000 NL80211_RRF_NO_CCK = 0x2 + NL80211_RRF_NO_EHT = 0x80000 NL80211_RRF_NO_HE = 0x20000 NL80211_RRF_NO_HT40 = 0x6000 NL80211_RRF_NO_HT40MINUS = 0x2000 @@ -5788,7 +5932,10 @@ const ( NL80211_RRF_NO_IR = 0x80 NL80211_RRF_NO_OFDM = 0x1 NL80211_RRF_NO_OUTDOOR = 0x8 + NL80211_RRF_NO_UHB_AFC_CLIENT = 0x800000 + NL80211_RRF_NO_UHB_VLP_CLIENT = 0x400000 NL80211_RRF_PASSIVE_SCAN = 0x80 + NL80211_RRF_PSD = 0x100000 NL80211_RRF_PTMP_ONLY = 0x40 NL80211_RRF_PTP_ONLY = 0x20 NL80211_RXMGMT_FLAG_ANSWERED = 0x1 @@ -5849,6 +5996,7 @@ const ( NL80211_STA_FLAG_MAX_OLD_API = 0x6 NL80211_STA_FLAG_MFP = 0x4 NL80211_STA_FLAG_SHORT_PREAMBLE = 0x2 + NL80211_STA_FLAG_SPP_AMSDU = 0x8 NL80211_STA_FLAG_TDLS_PEER = 0x6 NL80211_STA_FLAG_WME = 0x3 NL80211_STA_INFO_ACK_SIGNAL_AVG = 0x23 @@ -6007,6 +6155,13 @@ const ( NL80211_VHT_CAPABILITY_LEN = 0xc NL80211_VHT_NSS_MAX = 0x8 NL80211_WIPHY_NAME_MAXLEN = 0x40 + NL80211_WIPHY_RADIO_ATTR_FREQ_RANGE = 0x2 + NL80211_WIPHY_RADIO_ATTR_INDEX = 0x1 + NL80211_WIPHY_RADIO_ATTR_INTERFACE_COMBINATION = 0x3 + NL80211_WIPHY_RADIO_ATTR_MAX = 0x4 + NL80211_WIPHY_RADIO_FREQ_ATTR_END = 0x2 + NL80211_WIPHY_RADIO_FREQ_ATTR_MAX = 0x2 + NL80211_WIPHY_RADIO_FREQ_ATTR_START = 0x1 NL80211_WMMR_AIFSN = 0x3 NL80211_WMMR_CW_MAX = 0x2 NL80211_WMMR_CW_MIN = 0x1 @@ -6038,6 +6193,7 @@ const ( NL80211_WOWLAN_TRIG_PKT_PATTERN = 0x4 NL80211_WOWLAN_TRIG_RFKILL_RELEASE = 0x9 NL80211_WOWLAN_TRIG_TCP_CONNECTION = 0xe + NL80211_WOWLAN_TRIG_UNPROTECTED_DEAUTH_DISASSOC = 0x14 NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211 = 0xa NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211_LEN = 0xb NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023 = 0xc diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go index fd402da43..485f2d3a1 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go @@ -282,7 +282,7 @@ type Taskstats struct { Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 - _ [4]byte + _ [6]byte Cpu_count uint64 Cpu_delay_total uint64 Blkio_count uint64 @@ -338,6 +338,22 @@ type Taskstats struct { Wpcopy_delay_total uint64 Irq_count uint64 Irq_delay_total uint64 + Cpu_delay_max uint64 + Cpu_delay_min uint64 + Blkio_delay_max uint64 + Blkio_delay_min uint64 + Swapin_delay_max uint64 + Swapin_delay_min uint64 + Freepages_delay_max uint64 + Freepages_delay_min uint64 + Thrashing_delay_max uint64 + Thrashing_delay_min uint64 + Compact_delay_max uint64 + Compact_delay_min uint64 + Wpcopy_delay_max uint64 + Wpcopy_delay_min uint64 + Irq_delay_max uint64 + Irq_delay_min uint64 } type cpuMask uint32 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go index eb7a5e186..ecbd1ad8b 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go @@ -351,6 +351,22 @@ type Taskstats struct { Wpcopy_delay_total uint64 Irq_count uint64 Irq_delay_total uint64 + Cpu_delay_max uint64 + Cpu_delay_min uint64 + Blkio_delay_max uint64 + Blkio_delay_min uint64 + Swapin_delay_max uint64 + Swapin_delay_min uint64 + Freepages_delay_max uint64 + Freepages_delay_min uint64 + Thrashing_delay_max uint64 + Thrashing_delay_min uint64 + Compact_delay_max uint64 + Compact_delay_min uint64 + Wpcopy_delay_max uint64 + Wpcopy_delay_min uint64 + Irq_delay_max uint64 + Irq_delay_min uint64 } type cpuMask uint64 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go index d78ac108b..02f0463a4 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go @@ -91,7 +91,7 @@ type Stat_t struct { Gid uint32 Rdev uint64 _ uint16 - _ [4]byte + _ [6]byte Size int64 Blksize int32 _ [4]byte @@ -273,7 +273,7 @@ type Taskstats struct { Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 - _ [4]byte + _ [6]byte Cpu_count uint64 Cpu_delay_total uint64 Blkio_count uint64 @@ -329,6 +329,22 @@ type Taskstats struct { Wpcopy_delay_total uint64 Irq_count uint64 Irq_delay_total uint64 + Cpu_delay_max uint64 + Cpu_delay_min uint64 + Blkio_delay_max uint64 + Blkio_delay_min uint64 + Swapin_delay_max uint64 + Swapin_delay_min uint64 + Freepages_delay_max uint64 + Freepages_delay_min uint64 + Thrashing_delay_max uint64 + Thrashing_delay_min uint64 + Compact_delay_max uint64 + Compact_delay_min uint64 + Wpcopy_delay_max uint64 + Wpcopy_delay_min uint64 + Irq_delay_max uint64 + Irq_delay_min uint64 } type cpuMask uint32 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go index cd06d47f1..6f4d400d2 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go @@ -330,6 +330,22 @@ type Taskstats struct { Wpcopy_delay_total uint64 Irq_count uint64 Irq_delay_total uint64 + Cpu_delay_max uint64 + Cpu_delay_min uint64 + Blkio_delay_max uint64 + Blkio_delay_min uint64 + Swapin_delay_max uint64 + Swapin_delay_min uint64 + Freepages_delay_max uint64 + Freepages_delay_min uint64 + Thrashing_delay_max uint64 + Thrashing_delay_min uint64 + Compact_delay_max uint64 + Compact_delay_min uint64 + Wpcopy_delay_max uint64 + Wpcopy_delay_min uint64 + Irq_delay_max uint64 + Irq_delay_min uint64 } type cpuMask uint64 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go index 2f28fe26c..cd532cfa5 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go @@ -331,6 +331,22 @@ type Taskstats struct { Wpcopy_delay_total uint64 Irq_count uint64 Irq_delay_total uint64 + Cpu_delay_max uint64 + Cpu_delay_min uint64 + Blkio_delay_max uint64 + Blkio_delay_min uint64 + Swapin_delay_max uint64 + Swapin_delay_min uint64 + Freepages_delay_max uint64 + Freepages_delay_min uint64 + Thrashing_delay_max uint64 + Thrashing_delay_min uint64 + Compact_delay_max uint64 + Compact_delay_min uint64 + Wpcopy_delay_max uint64 + Wpcopy_delay_min uint64 + Irq_delay_max uint64 + Irq_delay_min uint64 } type cpuMask uint64 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go index 71d6cac2f..413362085 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go @@ -278,7 +278,7 @@ type Taskstats struct { Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 - _ [4]byte + _ [6]byte Cpu_count uint64 Cpu_delay_total uint64 Blkio_count uint64 @@ -334,6 +334,22 @@ type Taskstats struct { Wpcopy_delay_total uint64 Irq_count uint64 Irq_delay_total uint64 + Cpu_delay_max uint64 + Cpu_delay_min uint64 + Blkio_delay_max uint64 + Blkio_delay_min uint64 + Swapin_delay_max uint64 + Swapin_delay_min uint64 + Freepages_delay_max uint64 + Freepages_delay_min uint64 + Thrashing_delay_max uint64 + Thrashing_delay_min uint64 + Compact_delay_max uint64 + Compact_delay_min uint64 + Wpcopy_delay_max uint64 + Wpcopy_delay_min uint64 + Irq_delay_max uint64 + Irq_delay_min uint64 } type cpuMask uint32 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go index 8596d4535..eaa37eb71 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go @@ -333,6 +333,22 @@ type Taskstats struct { Wpcopy_delay_total uint64 Irq_count uint64 Irq_delay_total uint64 + Cpu_delay_max uint64 + Cpu_delay_min uint64 + Blkio_delay_max uint64 + Blkio_delay_min uint64 + Swapin_delay_max uint64 + Swapin_delay_min uint64 + Freepages_delay_max uint64 + Freepages_delay_min uint64 + Thrashing_delay_max uint64 + Thrashing_delay_min uint64 + Compact_delay_max uint64 + Compact_delay_min uint64 + Wpcopy_delay_max uint64 + Wpcopy_delay_min uint64 + Irq_delay_max uint64 + Irq_delay_min uint64 } type cpuMask uint64 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go index cd60ea186..98ae6a1e4 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go @@ -333,6 +333,22 @@ type Taskstats struct { Wpcopy_delay_total uint64 Irq_count uint64 Irq_delay_total uint64 + Cpu_delay_max uint64 + Cpu_delay_min uint64 + Blkio_delay_max uint64 + Blkio_delay_min uint64 + Swapin_delay_max uint64 + Swapin_delay_min uint64 + Freepages_delay_max uint64 + Freepages_delay_min uint64 + Thrashing_delay_max uint64 + Thrashing_delay_min uint64 + Compact_delay_max uint64 + Compact_delay_min uint64 + Wpcopy_delay_max uint64 + Wpcopy_delay_min uint64 + Irq_delay_max uint64 + Irq_delay_min uint64 } type cpuMask uint64 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go index b0ae420c4..cae196159 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go @@ -278,7 +278,7 @@ type Taskstats struct { Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 - _ [4]byte + _ [6]byte Cpu_count uint64 Cpu_delay_total uint64 Blkio_count uint64 @@ -334,6 +334,22 @@ type Taskstats struct { Wpcopy_delay_total uint64 Irq_count uint64 Irq_delay_total uint64 + Cpu_delay_max uint64 + Cpu_delay_min uint64 + Blkio_delay_max uint64 + Blkio_delay_min uint64 + Swapin_delay_max uint64 + Swapin_delay_min uint64 + Freepages_delay_max uint64 + Freepages_delay_min uint64 + Thrashing_delay_max uint64 + Thrashing_delay_min uint64 + Compact_delay_max uint64 + Compact_delay_min uint64 + Wpcopy_delay_max uint64 + Wpcopy_delay_min uint64 + Irq_delay_max uint64 + Irq_delay_min uint64 } type cpuMask uint32 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go index 835972875..6ce3b4e02 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go @@ -90,7 +90,7 @@ type Stat_t struct { Gid uint32 Rdev uint64 _ uint16 - _ [4]byte + _ [6]byte Size int64 Blksize int32 _ [4]byte @@ -285,7 +285,7 @@ type Taskstats struct { Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 - _ [4]byte + _ [6]byte Cpu_count uint64 Cpu_delay_total uint64 Blkio_count uint64 @@ -341,6 +341,22 @@ type Taskstats struct { Wpcopy_delay_total uint64 Irq_count uint64 Irq_delay_total uint64 + Cpu_delay_max uint64 + Cpu_delay_min uint64 + Blkio_delay_max uint64 + Blkio_delay_min uint64 + Swapin_delay_max uint64 + Swapin_delay_min uint64 + Freepages_delay_max uint64 + Freepages_delay_min uint64 + Thrashing_delay_max uint64 + Thrashing_delay_min uint64 + Compact_delay_max uint64 + Compact_delay_min uint64 + Wpcopy_delay_max uint64 + Wpcopy_delay_min uint64 + Irq_delay_max uint64 + Irq_delay_min uint64 } type cpuMask uint32 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go index 69eb6a5c6..c7429c6a1 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go @@ -340,6 +340,22 @@ type Taskstats struct { Wpcopy_delay_total uint64 Irq_count uint64 Irq_delay_total uint64 + Cpu_delay_max uint64 + Cpu_delay_min uint64 + Blkio_delay_max uint64 + Blkio_delay_min uint64 + Swapin_delay_max uint64 + Swapin_delay_min uint64 + Freepages_delay_max uint64 + Freepages_delay_min uint64 + Thrashing_delay_max uint64 + Thrashing_delay_min uint64 + Compact_delay_max uint64 + Compact_delay_min uint64 + Wpcopy_delay_max uint64 + Wpcopy_delay_min uint64 + Irq_delay_max uint64 + Irq_delay_min uint64 } type cpuMask uint64 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go index 5f583cb62..4bf4baf4c 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go @@ -340,6 +340,22 @@ type Taskstats struct { Wpcopy_delay_total uint64 Irq_count uint64 Irq_delay_total uint64 + Cpu_delay_max uint64 + Cpu_delay_min uint64 + Blkio_delay_max uint64 + Blkio_delay_min uint64 + Swapin_delay_max uint64 + Swapin_delay_min uint64 + Freepages_delay_max uint64 + Freepages_delay_min uint64 + Thrashing_delay_max uint64 + Thrashing_delay_min uint64 + Compact_delay_max uint64 + Compact_delay_min uint64 + Wpcopy_delay_max uint64 + Wpcopy_delay_min uint64 + Irq_delay_max uint64 + Irq_delay_min uint64 } type cpuMask uint64 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go index ad05b51a6..e9709d70a 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go @@ -358,6 +358,22 @@ type Taskstats struct { Wpcopy_delay_total uint64 Irq_count uint64 Irq_delay_total uint64 + Cpu_delay_max uint64 + Cpu_delay_min uint64 + Blkio_delay_max uint64 + Blkio_delay_min uint64 + Swapin_delay_max uint64 + Swapin_delay_min uint64 + Freepages_delay_max uint64 + Freepages_delay_min uint64 + Thrashing_delay_max uint64 + Thrashing_delay_min uint64 + Compact_delay_max uint64 + Compact_delay_min uint64 + Wpcopy_delay_max uint64 + Wpcopy_delay_min uint64 + Irq_delay_max uint64 + Irq_delay_min uint64 } type cpuMask uint64 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go index cf3ce9003..fb44268ca 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go @@ -353,6 +353,22 @@ type Taskstats struct { Wpcopy_delay_total uint64 Irq_count uint64 Irq_delay_total uint64 + Cpu_delay_max uint64 + Cpu_delay_min uint64 + Blkio_delay_max uint64 + Blkio_delay_min uint64 + Swapin_delay_max uint64 + Swapin_delay_min uint64 + Freepages_delay_max uint64 + Freepages_delay_min uint64 + Thrashing_delay_max uint64 + Thrashing_delay_min uint64 + Compact_delay_max uint64 + Compact_delay_min uint64 + Wpcopy_delay_max uint64 + Wpcopy_delay_min uint64 + Irq_delay_max uint64 + Irq_delay_min uint64 } type cpuMask uint64 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go index 590b56739..9c38265c7 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go @@ -335,6 +335,22 @@ type Taskstats struct { Wpcopy_delay_total uint64 Irq_count uint64 Irq_delay_total uint64 + Cpu_delay_max uint64 + Cpu_delay_min uint64 + Blkio_delay_max uint64 + Blkio_delay_min uint64 + Swapin_delay_max uint64 + Swapin_delay_min uint64 + Freepages_delay_max uint64 + Freepages_delay_min uint64 + Thrashing_delay_max uint64 + Thrashing_delay_min uint64 + Compact_delay_max uint64 + Compact_delay_min uint64 + Wpcopy_delay_max uint64 + Wpcopy_delay_min uint64 + Irq_delay_max uint64 + Irq_delay_min uint64 } type cpuMask uint64 diff --git a/vendor/golang.org/x/sys/windows/security_windows.go b/vendor/golang.org/x/sys/windows/security_windows.go index b6e1ab76f..a8b0364c7 100644 --- a/vendor/golang.org/x/sys/windows/security_windows.go +++ b/vendor/golang.org/x/sys/windows/security_windows.go @@ -1303,7 +1303,10 @@ func (selfRelativeSD *SECURITY_DESCRIPTOR) ToAbsolute() (absoluteSD *SECURITY_DE return nil, err } if absoluteSDSize > 0 { - absoluteSD = (*SECURITY_DESCRIPTOR)(unsafe.Pointer(&make([]byte, absoluteSDSize)[0])) + absoluteSD = new(SECURITY_DESCRIPTOR) + if unsafe.Sizeof(*absoluteSD) < uintptr(absoluteSDSize) { + panic("sizeof(SECURITY_DESCRIPTOR) too small") + } } var ( dacl *ACL @@ -1312,19 +1315,55 @@ func (selfRelativeSD *SECURITY_DESCRIPTOR) ToAbsolute() (absoluteSD *SECURITY_DE group *SID ) if daclSize > 0 { - dacl = (*ACL)(unsafe.Pointer(&make([]byte, daclSize)[0])) + dacl = (*ACL)(unsafe.Pointer(unsafe.SliceData(make([]byte, daclSize)))) } if saclSize > 0 { - sacl = (*ACL)(unsafe.Pointer(&make([]byte, saclSize)[0])) + sacl = (*ACL)(unsafe.Pointer(unsafe.SliceData(make([]byte, saclSize)))) } if ownerSize > 0 { - owner = (*SID)(unsafe.Pointer(&make([]byte, ownerSize)[0])) + owner = (*SID)(unsafe.Pointer(unsafe.SliceData(make([]byte, ownerSize)))) } if groupSize > 0 { - group = (*SID)(unsafe.Pointer(&make([]byte, groupSize)[0])) + group = (*SID)(unsafe.Pointer(unsafe.SliceData(make([]byte, groupSize)))) } + // We call into Windows via makeAbsoluteSD, which sets up + // pointers within absoluteSD that point to other chunks of memory + // we pass into makeAbsoluteSD, and that happens outside the view of the GC. + // We therefore take some care here to then verify the pointers are as we expect + // and set them explicitly in view of the GC. See https://go.dev/issue/73199. + // TODO: consider weak pointers once Go 1.24 is appropriate. See suggestion in https://go.dev/cl/663575. err = makeAbsoluteSD(selfRelativeSD, absoluteSD, &absoluteSDSize, dacl, &daclSize, sacl, &saclSize, owner, &ownerSize, group, &groupSize) + if err != nil { + // Don't return absoluteSD, which might be partially initialized. + return nil, err + } + // Before using any fields, verify absoluteSD is in the format we expect according to Windows. + // See https://learn.microsoft.com/en-us/windows/win32/secauthz/absolute-and-self-relative-security-descriptors + absControl, _, err := absoluteSD.Control() + if err != nil { + panic("absoluteSD: " + err.Error()) + } + if absControl&SE_SELF_RELATIVE != 0 { + panic("absoluteSD not in absolute format") + } + if absoluteSD.dacl != dacl { + panic("dacl pointer mismatch") + } + if absoluteSD.sacl != sacl { + panic("sacl pointer mismatch") + } + if absoluteSD.owner != owner { + panic("owner pointer mismatch") + } + if absoluteSD.group != group { + panic("group pointer mismatch") + } + absoluteSD.dacl = dacl + absoluteSD.sacl = sacl + absoluteSD.owner = owner + absoluteSD.group = group + return } diff --git a/vendor/golang.org/x/sys/windows/syscall_windows.go b/vendor/golang.org/x/sys/windows/syscall_windows.go index 4a3254386..bd5133730 100644 --- a/vendor/golang.org/x/sys/windows/syscall_windows.go +++ b/vendor/golang.org/x/sys/windows/syscall_windows.go @@ -321,6 +321,8 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys SetConsoleOutputCP(cp uint32) (err error) = kernel32.SetConsoleOutputCP //sys WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) = kernel32.WriteConsoleW //sys ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) = kernel32.ReadConsoleW +//sys GetNumberOfConsoleInputEvents(console Handle, numevents *uint32) (err error) = kernel32.GetNumberOfConsoleInputEvents +//sys FlushConsoleInputBuffer(console Handle) (err error) = kernel32.FlushConsoleInputBuffer //sys resizePseudoConsole(pconsole Handle, size uint32) (hr error) = kernel32.ResizePseudoConsole //sys CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) [failretval==InvalidHandle] = kernel32.CreateToolhelp32Snapshot //sys Module32First(snapshot Handle, moduleEntry *ModuleEntry32) (err error) = kernel32.Module32FirstW @@ -870,6 +872,7 @@ const socket_error = uintptr(^uint32(0)) //sys WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (err error) [failretval==socket_error] = ws2_32.WSARecvFrom //sys WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (err error) [failretval==socket_error] = ws2_32.WSASendTo //sys WSASocket(af int32, typ int32, protocol int32, protoInfo *WSAProtocolInfo, group uint32, flags uint32) (handle Handle, err error) [failretval==InvalidHandle] = ws2_32.WSASocketW +//sys WSADuplicateSocket(s Handle, processID uint32, info *WSAProtocolInfo) (err error) [failretval!=0] = ws2_32.WSADuplicateSocketW //sys GetHostByName(name string) (h *Hostent, err error) [failretval==nil] = ws2_32.gethostbyname //sys GetServByName(name string, proto string) (s *Servent, err error) [failretval==nil] = ws2_32.getservbyname //sys Ntohs(netshort uint16) (u uint16) = ws2_32.ntohs @@ -1698,8 +1701,9 @@ func NewNTUnicodeString(s string) (*NTUnicodeString, error) { // Slice returns a uint16 slice that aliases the data in the NTUnicodeString. func (s *NTUnicodeString) Slice() []uint16 { - slice := unsafe.Slice(s.Buffer, s.MaximumLength) - return slice[:s.Length] + // Note: this rounds the length down, if it happens + // to (incorrectly) be odd. Probably safer than rounding up. + return unsafe.Slice(s.Buffer, s.MaximumLength/2)[:s.Length/2] } func (s *NTUnicodeString) String() string { diff --git a/vendor/golang.org/x/sys/windows/types_windows.go b/vendor/golang.org/x/sys/windows/types_windows.go index 9d138de5f..358be3c7f 100644 --- a/vendor/golang.org/x/sys/windows/types_windows.go +++ b/vendor/golang.org/x/sys/windows/types_windows.go @@ -65,6 +65,22 @@ var signals = [...]string{ 15: "terminated", } +// File flags for [os.OpenFile]. The O_ prefix is used to indicate +// that these flags are specific to the OpenFile function. +const ( + O_FILE_FLAG_OPEN_NO_RECALL = FILE_FLAG_OPEN_NO_RECALL + O_FILE_FLAG_OPEN_REPARSE_POINT = FILE_FLAG_OPEN_REPARSE_POINT + O_FILE_FLAG_SESSION_AWARE = FILE_FLAG_SESSION_AWARE + O_FILE_FLAG_POSIX_SEMANTICS = FILE_FLAG_POSIX_SEMANTICS + O_FILE_FLAG_BACKUP_SEMANTICS = FILE_FLAG_BACKUP_SEMANTICS + O_FILE_FLAG_DELETE_ON_CLOSE = FILE_FLAG_DELETE_ON_CLOSE + O_FILE_FLAG_SEQUENTIAL_SCAN = FILE_FLAG_SEQUENTIAL_SCAN + O_FILE_FLAG_RANDOM_ACCESS = FILE_FLAG_RANDOM_ACCESS + O_FILE_FLAG_NO_BUFFERING = FILE_FLAG_NO_BUFFERING + O_FILE_FLAG_OVERLAPPED = FILE_FLAG_OVERLAPPED + O_FILE_FLAG_WRITE_THROUGH = FILE_FLAG_WRITE_THROUGH +) + const ( FILE_READ_DATA = 0x00000001 FILE_READ_ATTRIBUTES = 0x00000080 @@ -1074,6 +1090,7 @@ const ( IP_ADD_MEMBERSHIP = 0xc IP_DROP_MEMBERSHIP = 0xd IP_PKTINFO = 0x13 + IP_MTU_DISCOVER = 0x47 IPV6_V6ONLY = 0x1b IPV6_UNICAST_HOPS = 0x4 @@ -1083,6 +1100,7 @@ const ( IPV6_JOIN_GROUP = 0xc IPV6_LEAVE_GROUP = 0xd IPV6_PKTINFO = 0x13 + IPV6_MTU_DISCOVER = 0x47 MSG_OOB = 0x1 MSG_PEEK = 0x2 @@ -1132,6 +1150,15 @@ const ( WSASYS_STATUS_LEN = 128 ) +// enum PMTUD_STATE from ws2ipdef.h +const ( + IP_PMTUDISC_NOT_SET = 0 + IP_PMTUDISC_DO = 1 + IP_PMTUDISC_DONT = 2 + IP_PMTUDISC_PROBE = 3 + IP_PMTUDISC_MAX = 4 +) + type WSABuf struct { Len uint32 Buf *byte @@ -1146,6 +1173,22 @@ type WSAMsg struct { Flags uint32 } +type WSACMSGHDR struct { + Len uintptr + Level int32 + Type int32 +} + +type IN_PKTINFO struct { + Addr [4]byte + Ifindex uint32 +} + +type IN6_PKTINFO struct { + Addr [16]byte + Ifindex uint32 +} + // Flags for WSASocket const ( WSA_FLAG_OVERLAPPED = 0x01 @@ -1949,6 +1992,12 @@ const ( SYMBOLIC_LINK_FLAG_DIRECTORY = 0x1 ) +// FILE_ZERO_DATA_INFORMATION from winioctl.h +type FileZeroDataInformation struct { + FileOffset int64 + BeyondFinalZero int64 +} + const ( ComputerNameNetBIOS = 0 ComputerNameDnsHostname = 1 @@ -2673,6 +2722,8 @@ type CommTimeouts struct { // NTUnicodeString is a UTF-16 string for NT native APIs, corresponding to UNICODE_STRING. type NTUnicodeString struct { + // Note: Length and MaximumLength are in *bytes*, not uint16s. + // They should always be even. Length uint16 MaximumLength uint16 Buffer *uint16 @@ -3601,3 +3652,213 @@ const ( KLF_NOTELLSHELL = 0x00000080 KLF_SETFORPROCESS = 0x00000100 ) + +// Virtual Key codes +// https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes +const ( + VK_LBUTTON = 0x01 + VK_RBUTTON = 0x02 + VK_CANCEL = 0x03 + VK_MBUTTON = 0x04 + VK_XBUTTON1 = 0x05 + VK_XBUTTON2 = 0x06 + VK_BACK = 0x08 + VK_TAB = 0x09 + VK_CLEAR = 0x0C + VK_RETURN = 0x0D + VK_SHIFT = 0x10 + VK_CONTROL = 0x11 + VK_MENU = 0x12 + VK_PAUSE = 0x13 + VK_CAPITAL = 0x14 + VK_KANA = 0x15 + VK_HANGEUL = 0x15 + VK_HANGUL = 0x15 + VK_IME_ON = 0x16 + VK_JUNJA = 0x17 + VK_FINAL = 0x18 + VK_HANJA = 0x19 + VK_KANJI = 0x19 + VK_IME_OFF = 0x1A + VK_ESCAPE = 0x1B + VK_CONVERT = 0x1C + VK_NONCONVERT = 0x1D + VK_ACCEPT = 0x1E + VK_MODECHANGE = 0x1F + VK_SPACE = 0x20 + VK_PRIOR = 0x21 + VK_NEXT = 0x22 + VK_END = 0x23 + VK_HOME = 0x24 + VK_LEFT = 0x25 + VK_UP = 0x26 + VK_RIGHT = 0x27 + VK_DOWN = 0x28 + VK_SELECT = 0x29 + VK_PRINT = 0x2A + VK_EXECUTE = 0x2B + VK_SNAPSHOT = 0x2C + VK_INSERT = 0x2D + VK_DELETE = 0x2E + VK_HELP = 0x2F + VK_LWIN = 0x5B + VK_RWIN = 0x5C + VK_APPS = 0x5D + VK_SLEEP = 0x5F + VK_NUMPAD0 = 0x60 + VK_NUMPAD1 = 0x61 + VK_NUMPAD2 = 0x62 + VK_NUMPAD3 = 0x63 + VK_NUMPAD4 = 0x64 + VK_NUMPAD5 = 0x65 + VK_NUMPAD6 = 0x66 + VK_NUMPAD7 = 0x67 + VK_NUMPAD8 = 0x68 + VK_NUMPAD9 = 0x69 + VK_MULTIPLY = 0x6A + VK_ADD = 0x6B + VK_SEPARATOR = 0x6C + VK_SUBTRACT = 0x6D + VK_DECIMAL = 0x6E + VK_DIVIDE = 0x6F + VK_F1 = 0x70 + VK_F2 = 0x71 + VK_F3 = 0x72 + VK_F4 = 0x73 + VK_F5 = 0x74 + VK_F6 = 0x75 + VK_F7 = 0x76 + VK_F8 = 0x77 + VK_F9 = 0x78 + VK_F10 = 0x79 + VK_F11 = 0x7A + VK_F12 = 0x7B + VK_F13 = 0x7C + VK_F14 = 0x7D + VK_F15 = 0x7E + VK_F16 = 0x7F + VK_F17 = 0x80 + VK_F18 = 0x81 + VK_F19 = 0x82 + VK_F20 = 0x83 + VK_F21 = 0x84 + VK_F22 = 0x85 + VK_F23 = 0x86 + VK_F24 = 0x87 + VK_NUMLOCK = 0x90 + VK_SCROLL = 0x91 + VK_OEM_NEC_EQUAL = 0x92 + VK_OEM_FJ_JISHO = 0x92 + VK_OEM_FJ_MASSHOU = 0x93 + VK_OEM_FJ_TOUROKU = 0x94 + VK_OEM_FJ_LOYA = 0x95 + VK_OEM_FJ_ROYA = 0x96 + VK_LSHIFT = 0xA0 + VK_RSHIFT = 0xA1 + VK_LCONTROL = 0xA2 + VK_RCONTROL = 0xA3 + VK_LMENU = 0xA4 + VK_RMENU = 0xA5 + VK_BROWSER_BACK = 0xA6 + VK_BROWSER_FORWARD = 0xA7 + VK_BROWSER_REFRESH = 0xA8 + VK_BROWSER_STOP = 0xA9 + VK_BROWSER_SEARCH = 0xAA + VK_BROWSER_FAVORITES = 0xAB + VK_BROWSER_HOME = 0xAC + VK_VOLUME_MUTE = 0xAD + VK_VOLUME_DOWN = 0xAE + VK_VOLUME_UP = 0xAF + VK_MEDIA_NEXT_TRACK = 0xB0 + VK_MEDIA_PREV_TRACK = 0xB1 + VK_MEDIA_STOP = 0xB2 + VK_MEDIA_PLAY_PAUSE = 0xB3 + VK_LAUNCH_MAIL = 0xB4 + VK_LAUNCH_MEDIA_SELECT = 0xB5 + VK_LAUNCH_APP1 = 0xB6 + VK_LAUNCH_APP2 = 0xB7 + VK_OEM_1 = 0xBA + VK_OEM_PLUS = 0xBB + VK_OEM_COMMA = 0xBC + VK_OEM_MINUS = 0xBD + VK_OEM_PERIOD = 0xBE + VK_OEM_2 = 0xBF + VK_OEM_3 = 0xC0 + VK_OEM_4 = 0xDB + VK_OEM_5 = 0xDC + VK_OEM_6 = 0xDD + VK_OEM_7 = 0xDE + VK_OEM_8 = 0xDF + VK_OEM_AX = 0xE1 + VK_OEM_102 = 0xE2 + VK_ICO_HELP = 0xE3 + VK_ICO_00 = 0xE4 + VK_PROCESSKEY = 0xE5 + VK_ICO_CLEAR = 0xE6 + VK_OEM_RESET = 0xE9 + VK_OEM_JUMP = 0xEA + VK_OEM_PA1 = 0xEB + VK_OEM_PA2 = 0xEC + VK_OEM_PA3 = 0xED + VK_OEM_WSCTRL = 0xEE + VK_OEM_CUSEL = 0xEF + VK_OEM_ATTN = 0xF0 + VK_OEM_FINISH = 0xF1 + VK_OEM_COPY = 0xF2 + VK_OEM_AUTO = 0xF3 + VK_OEM_ENLW = 0xF4 + VK_OEM_BACKTAB = 0xF5 + VK_ATTN = 0xF6 + VK_CRSEL = 0xF7 + VK_EXSEL = 0xF8 + VK_EREOF = 0xF9 + VK_PLAY = 0xFA + VK_ZOOM = 0xFB + VK_NONAME = 0xFC + VK_PA1 = 0xFD + VK_OEM_CLEAR = 0xFE +) + +// Mouse button constants. +// https://docs.microsoft.com/en-us/windows/console/mouse-event-record-str +const ( + FROM_LEFT_1ST_BUTTON_PRESSED = 0x0001 + RIGHTMOST_BUTTON_PRESSED = 0x0002 + FROM_LEFT_2ND_BUTTON_PRESSED = 0x0004 + FROM_LEFT_3RD_BUTTON_PRESSED = 0x0008 + FROM_LEFT_4TH_BUTTON_PRESSED = 0x0010 +) + +// Control key state constaints. +// https://docs.microsoft.com/en-us/windows/console/key-event-record-str +// https://docs.microsoft.com/en-us/windows/console/mouse-event-record-str +const ( + CAPSLOCK_ON = 0x0080 + ENHANCED_KEY = 0x0100 + LEFT_ALT_PRESSED = 0x0002 + LEFT_CTRL_PRESSED = 0x0008 + NUMLOCK_ON = 0x0020 + RIGHT_ALT_PRESSED = 0x0001 + RIGHT_CTRL_PRESSED = 0x0004 + SCROLLLOCK_ON = 0x0040 + SHIFT_PRESSED = 0x0010 +) + +// Mouse event record event flags. +// https://docs.microsoft.com/en-us/windows/console/mouse-event-record-str +const ( + MOUSE_MOVED = 0x0001 + DOUBLE_CLICK = 0x0002 + MOUSE_WHEELED = 0x0004 + MOUSE_HWHEELED = 0x0008 +) + +// Input Record Event Types +// https://learn.microsoft.com/en-us/windows/console/input-record-str +const ( + FOCUS_EVENT = 0x0010 + KEY_EVENT = 0x0001 + MENU_EVENT = 0x0008 + MOUSE_EVENT = 0x0002 + WINDOW_BUFFER_SIZE_EVENT = 0x0004 +) diff --git a/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/vendor/golang.org/x/sys/windows/zsyscall_windows.go index 01c0716c2..426151a01 100644 --- a/vendor/golang.org/x/sys/windows/zsyscall_windows.go +++ b/vendor/golang.org/x/sys/windows/zsyscall_windows.go @@ -238,6 +238,7 @@ var ( procFindResourceW = modkernel32.NewProc("FindResourceW") procFindVolumeClose = modkernel32.NewProc("FindVolumeClose") procFindVolumeMountPointClose = modkernel32.NewProc("FindVolumeMountPointClose") + procFlushConsoleInputBuffer = modkernel32.NewProc("FlushConsoleInputBuffer") procFlushFileBuffers = modkernel32.NewProc("FlushFileBuffers") procFlushViewOfFile = modkernel32.NewProc("FlushViewOfFile") procFormatMessageW = modkernel32.NewProc("FormatMessageW") @@ -284,6 +285,7 @@ var ( procGetNamedPipeHandleStateW = modkernel32.NewProc("GetNamedPipeHandleStateW") procGetNamedPipeInfo = modkernel32.NewProc("GetNamedPipeInfo") procGetNamedPipeServerProcessId = modkernel32.NewProc("GetNamedPipeServerProcessId") + procGetNumberOfConsoleInputEvents = modkernel32.NewProc("GetNumberOfConsoleInputEvents") procGetOverlappedResult = modkernel32.NewProc("GetOverlappedResult") procGetPriorityClass = modkernel32.NewProc("GetPriorityClass") procGetProcAddress = modkernel32.NewProc("GetProcAddress") @@ -511,6 +513,7 @@ var ( procFreeAddrInfoW = modws2_32.NewProc("FreeAddrInfoW") procGetAddrInfoW = modws2_32.NewProc("GetAddrInfoW") procWSACleanup = modws2_32.NewProc("WSACleanup") + procWSADuplicateSocketW = modws2_32.NewProc("WSADuplicateSocketW") procWSAEnumProtocolsW = modws2_32.NewProc("WSAEnumProtocolsW") procWSAGetOverlappedResult = modws2_32.NewProc("WSAGetOverlappedResult") procWSAIoctl = modws2_32.NewProc("WSAIoctl") @@ -545,25 +548,25 @@ var ( ) func cm_Get_DevNode_Status(status *uint32, problemNumber *uint32, devInst DEVINST, flags uint32) (ret CONFIGRET) { - r0, _, _ := syscall.Syscall6(procCM_Get_DevNode_Status.Addr(), 4, uintptr(unsafe.Pointer(status)), uintptr(unsafe.Pointer(problemNumber)), uintptr(devInst), uintptr(flags), 0, 0) + r0, _, _ := syscall.SyscallN(procCM_Get_DevNode_Status.Addr(), uintptr(unsafe.Pointer(status)), uintptr(unsafe.Pointer(problemNumber)), uintptr(devInst), uintptr(flags)) ret = CONFIGRET(r0) return } func cm_Get_Device_Interface_List(interfaceClass *GUID, deviceID *uint16, buffer *uint16, bufferLen uint32, flags uint32) (ret CONFIGRET) { - r0, _, _ := syscall.Syscall6(procCM_Get_Device_Interface_ListW.Addr(), 5, uintptr(unsafe.Pointer(interfaceClass)), uintptr(unsafe.Pointer(deviceID)), uintptr(unsafe.Pointer(buffer)), uintptr(bufferLen), uintptr(flags), 0) + r0, _, _ := syscall.SyscallN(procCM_Get_Device_Interface_ListW.Addr(), uintptr(unsafe.Pointer(interfaceClass)), uintptr(unsafe.Pointer(deviceID)), uintptr(unsafe.Pointer(buffer)), uintptr(bufferLen), uintptr(flags)) ret = CONFIGRET(r0) return } func cm_Get_Device_Interface_List_Size(len *uint32, interfaceClass *GUID, deviceID *uint16, flags uint32) (ret CONFIGRET) { - r0, _, _ := syscall.Syscall6(procCM_Get_Device_Interface_List_SizeW.Addr(), 4, uintptr(unsafe.Pointer(len)), uintptr(unsafe.Pointer(interfaceClass)), uintptr(unsafe.Pointer(deviceID)), uintptr(flags), 0, 0) + r0, _, _ := syscall.SyscallN(procCM_Get_Device_Interface_List_SizeW.Addr(), uintptr(unsafe.Pointer(len)), uintptr(unsafe.Pointer(interfaceClass)), uintptr(unsafe.Pointer(deviceID)), uintptr(flags)) ret = CONFIGRET(r0) return } func cm_MapCrToWin32Err(configRet CONFIGRET, defaultWin32Error Errno) (ret Errno) { - r0, _, _ := syscall.Syscall(procCM_MapCrToWin32Err.Addr(), 2, uintptr(configRet), uintptr(defaultWin32Error), 0) + r0, _, _ := syscall.SyscallN(procCM_MapCrToWin32Err.Addr(), uintptr(configRet), uintptr(defaultWin32Error)) ret = Errno(r0) return } @@ -573,7 +576,7 @@ func AdjustTokenGroups(token Token, resetToDefault bool, newstate *Tokengroups, if resetToDefault { _p0 = 1 } - r1, _, e1 := syscall.Syscall6(procAdjustTokenGroups.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen))) + r1, _, e1 := syscall.SyscallN(procAdjustTokenGroups.Addr(), uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen))) if r1 == 0 { err = errnoErr(e1) } @@ -585,7 +588,7 @@ func AdjustTokenPrivileges(token Token, disableAllPrivileges bool, newstate *Tok if disableAllPrivileges { _p0 = 1 } - r1, _, e1 := syscall.Syscall6(procAdjustTokenPrivileges.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen))) + r1, _, e1 := syscall.SyscallN(procAdjustTokenPrivileges.Addr(), uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen))) if r1 == 0 { err = errnoErr(e1) } @@ -593,7 +596,7 @@ func AdjustTokenPrivileges(token Token, disableAllPrivileges bool, newstate *Tok } func AllocateAndInitializeSid(identAuth *SidIdentifierAuthority, subAuth byte, subAuth0 uint32, subAuth1 uint32, subAuth2 uint32, subAuth3 uint32, subAuth4 uint32, subAuth5 uint32, subAuth6 uint32, subAuth7 uint32, sid **SID) (err error) { - r1, _, e1 := syscall.Syscall12(procAllocateAndInitializeSid.Addr(), 11, uintptr(unsafe.Pointer(identAuth)), uintptr(subAuth), uintptr(subAuth0), uintptr(subAuth1), uintptr(subAuth2), uintptr(subAuth3), uintptr(subAuth4), uintptr(subAuth5), uintptr(subAuth6), uintptr(subAuth7), uintptr(unsafe.Pointer(sid)), 0) + r1, _, e1 := syscall.SyscallN(procAllocateAndInitializeSid.Addr(), uintptr(unsafe.Pointer(identAuth)), uintptr(subAuth), uintptr(subAuth0), uintptr(subAuth1), uintptr(subAuth2), uintptr(subAuth3), uintptr(subAuth4), uintptr(subAuth5), uintptr(subAuth6), uintptr(subAuth7), uintptr(unsafe.Pointer(sid))) if r1 == 0 { err = errnoErr(e1) } @@ -601,7 +604,7 @@ func AllocateAndInitializeSid(identAuth *SidIdentifierAuthority, subAuth byte, s } func buildSecurityDescriptor(owner *TRUSTEE, group *TRUSTEE, countAccessEntries uint32, accessEntries *EXPLICIT_ACCESS, countAuditEntries uint32, auditEntries *EXPLICIT_ACCESS, oldSecurityDescriptor *SECURITY_DESCRIPTOR, sizeNewSecurityDescriptor *uint32, newSecurityDescriptor **SECURITY_DESCRIPTOR) (ret error) { - r0, _, _ := syscall.Syscall9(procBuildSecurityDescriptorW.Addr(), 9, uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(countAccessEntries), uintptr(unsafe.Pointer(accessEntries)), uintptr(countAuditEntries), uintptr(unsafe.Pointer(auditEntries)), uintptr(unsafe.Pointer(oldSecurityDescriptor)), uintptr(unsafe.Pointer(sizeNewSecurityDescriptor)), uintptr(unsafe.Pointer(newSecurityDescriptor))) + r0, _, _ := syscall.SyscallN(procBuildSecurityDescriptorW.Addr(), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(countAccessEntries), uintptr(unsafe.Pointer(accessEntries)), uintptr(countAuditEntries), uintptr(unsafe.Pointer(auditEntries)), uintptr(unsafe.Pointer(oldSecurityDescriptor)), uintptr(unsafe.Pointer(sizeNewSecurityDescriptor)), uintptr(unsafe.Pointer(newSecurityDescriptor))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -609,7 +612,7 @@ func buildSecurityDescriptor(owner *TRUSTEE, group *TRUSTEE, countAccessEntries } func ChangeServiceConfig2(service Handle, infoLevel uint32, info *byte) (err error) { - r1, _, e1 := syscall.Syscall(procChangeServiceConfig2W.Addr(), 3, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(info))) + r1, _, e1 := syscall.SyscallN(procChangeServiceConfig2W.Addr(), uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(info))) if r1 == 0 { err = errnoErr(e1) } @@ -617,7 +620,7 @@ func ChangeServiceConfig2(service Handle, infoLevel uint32, info *byte) (err err } func ChangeServiceConfig(service Handle, serviceType uint32, startType uint32, errorControl uint32, binaryPathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16, displayName *uint16) (err error) { - r1, _, e1 := syscall.Syscall12(procChangeServiceConfigW.Addr(), 11, uintptr(service), uintptr(serviceType), uintptr(startType), uintptr(errorControl), uintptr(unsafe.Pointer(binaryPathName)), uintptr(unsafe.Pointer(loadOrderGroup)), uintptr(unsafe.Pointer(tagId)), uintptr(unsafe.Pointer(dependencies)), uintptr(unsafe.Pointer(serviceStartName)), uintptr(unsafe.Pointer(password)), uintptr(unsafe.Pointer(displayName)), 0) + r1, _, e1 := syscall.SyscallN(procChangeServiceConfigW.Addr(), uintptr(service), uintptr(serviceType), uintptr(startType), uintptr(errorControl), uintptr(unsafe.Pointer(binaryPathName)), uintptr(unsafe.Pointer(loadOrderGroup)), uintptr(unsafe.Pointer(tagId)), uintptr(unsafe.Pointer(dependencies)), uintptr(unsafe.Pointer(serviceStartName)), uintptr(unsafe.Pointer(password)), uintptr(unsafe.Pointer(displayName))) if r1 == 0 { err = errnoErr(e1) } @@ -625,7 +628,7 @@ func ChangeServiceConfig(service Handle, serviceType uint32, startType uint32, e } func checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) (err error) { - r1, _, e1 := syscall.Syscall(procCheckTokenMembership.Addr(), 3, uintptr(tokenHandle), uintptr(unsafe.Pointer(sidToCheck)), uintptr(unsafe.Pointer(isMember))) + r1, _, e1 := syscall.SyscallN(procCheckTokenMembership.Addr(), uintptr(tokenHandle), uintptr(unsafe.Pointer(sidToCheck)), uintptr(unsafe.Pointer(isMember))) if r1 == 0 { err = errnoErr(e1) } @@ -633,7 +636,7 @@ func checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) ( } func CloseServiceHandle(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procCloseServiceHandle.Addr(), 1, uintptr(handle), 0, 0) + r1, _, e1 := syscall.SyscallN(procCloseServiceHandle.Addr(), uintptr(handle)) if r1 == 0 { err = errnoErr(e1) } @@ -641,7 +644,7 @@ func CloseServiceHandle(handle Handle) (err error) { } func ControlService(service Handle, control uint32, status *SERVICE_STATUS) (err error) { - r1, _, e1 := syscall.Syscall(procControlService.Addr(), 3, uintptr(service), uintptr(control), uintptr(unsafe.Pointer(status))) + r1, _, e1 := syscall.SyscallN(procControlService.Addr(), uintptr(service), uintptr(control), uintptr(unsafe.Pointer(status))) if r1 == 0 { err = errnoErr(e1) } @@ -649,7 +652,7 @@ func ControlService(service Handle, control uint32, status *SERVICE_STATUS) (err } func convertSecurityDescriptorToStringSecurityDescriptor(sd *SECURITY_DESCRIPTOR, revision uint32, securityInformation SECURITY_INFORMATION, str **uint16, strLen *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procConvertSecurityDescriptorToStringSecurityDescriptorW.Addr(), 5, uintptr(unsafe.Pointer(sd)), uintptr(revision), uintptr(securityInformation), uintptr(unsafe.Pointer(str)), uintptr(unsafe.Pointer(strLen)), 0) + r1, _, e1 := syscall.SyscallN(procConvertSecurityDescriptorToStringSecurityDescriptorW.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(revision), uintptr(securityInformation), uintptr(unsafe.Pointer(str)), uintptr(unsafe.Pointer(strLen))) if r1 == 0 { err = errnoErr(e1) } @@ -657,7 +660,7 @@ func convertSecurityDescriptorToStringSecurityDescriptor(sd *SECURITY_DESCRIPTOR } func ConvertSidToStringSid(sid *SID, stringSid **uint16) (err error) { - r1, _, e1 := syscall.Syscall(procConvertSidToStringSidW.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(stringSid)), 0) + r1, _, e1 := syscall.SyscallN(procConvertSidToStringSidW.Addr(), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(stringSid))) if r1 == 0 { err = errnoErr(e1) } @@ -674,7 +677,7 @@ func convertStringSecurityDescriptorToSecurityDescriptor(str string, revision ui } func _convertStringSecurityDescriptorToSecurityDescriptor(str *uint16, revision uint32, sd **SECURITY_DESCRIPTOR, size *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procConvertStringSecurityDescriptorToSecurityDescriptorW.Addr(), 4, uintptr(unsafe.Pointer(str)), uintptr(revision), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(size)), 0, 0) + r1, _, e1 := syscall.SyscallN(procConvertStringSecurityDescriptorToSecurityDescriptorW.Addr(), uintptr(unsafe.Pointer(str)), uintptr(revision), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(size))) if r1 == 0 { err = errnoErr(e1) } @@ -682,7 +685,7 @@ func _convertStringSecurityDescriptorToSecurityDescriptor(str *uint16, revision } func ConvertStringSidToSid(stringSid *uint16, sid **SID) (err error) { - r1, _, e1 := syscall.Syscall(procConvertStringSidToSidW.Addr(), 2, uintptr(unsafe.Pointer(stringSid)), uintptr(unsafe.Pointer(sid)), 0) + r1, _, e1 := syscall.SyscallN(procConvertStringSidToSidW.Addr(), uintptr(unsafe.Pointer(stringSid)), uintptr(unsafe.Pointer(sid))) if r1 == 0 { err = errnoErr(e1) } @@ -690,7 +693,7 @@ func ConvertStringSidToSid(stringSid *uint16, sid **SID) (err error) { } func CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) { - r1, _, e1 := syscall.Syscall(procCopySid.Addr(), 3, uintptr(destSidLen), uintptr(unsafe.Pointer(destSid)), uintptr(unsafe.Pointer(srcSid))) + r1, _, e1 := syscall.SyscallN(procCopySid.Addr(), uintptr(destSidLen), uintptr(unsafe.Pointer(destSid)), uintptr(unsafe.Pointer(srcSid))) if r1 == 0 { err = errnoErr(e1) } @@ -702,7 +705,7 @@ func CreateProcessAsUser(token Token, appName *uint16, commandLine *uint16, proc if inheritHandles { _p0 = 1 } - r1, _, e1 := syscall.Syscall12(procCreateProcessAsUserW.Addr(), 11, uintptr(token), uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo)), 0) + r1, _, e1 := syscall.SyscallN(procCreateProcessAsUserW.Addr(), uintptr(token), uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo))) if r1 == 0 { err = errnoErr(e1) } @@ -710,7 +713,7 @@ func CreateProcessAsUser(token Token, appName *uint16, commandLine *uint16, proc } func CreateService(mgr Handle, serviceName *uint16, displayName *uint16, access uint32, srvType uint32, startType uint32, errCtl uint32, pathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall15(procCreateServiceW.Addr(), 13, uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(unsafe.Pointer(displayName)), uintptr(access), uintptr(srvType), uintptr(startType), uintptr(errCtl), uintptr(unsafe.Pointer(pathName)), uintptr(unsafe.Pointer(loadOrderGroup)), uintptr(unsafe.Pointer(tagId)), uintptr(unsafe.Pointer(dependencies)), uintptr(unsafe.Pointer(serviceStartName)), uintptr(unsafe.Pointer(password)), 0, 0) + r0, _, e1 := syscall.SyscallN(procCreateServiceW.Addr(), uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(unsafe.Pointer(displayName)), uintptr(access), uintptr(srvType), uintptr(startType), uintptr(errCtl), uintptr(unsafe.Pointer(pathName)), uintptr(unsafe.Pointer(loadOrderGroup)), uintptr(unsafe.Pointer(tagId)), uintptr(unsafe.Pointer(dependencies)), uintptr(unsafe.Pointer(serviceStartName)), uintptr(unsafe.Pointer(password))) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -719,7 +722,7 @@ func CreateService(mgr Handle, serviceName *uint16, displayName *uint16, access } func createWellKnownSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID, sid *SID, sizeSid *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procCreateWellKnownSid.Addr(), 4, uintptr(sidType), uintptr(unsafe.Pointer(domainSid)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sizeSid)), 0, 0) + r1, _, e1 := syscall.SyscallN(procCreateWellKnownSid.Addr(), uintptr(sidType), uintptr(unsafe.Pointer(domainSid)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sizeSid))) if r1 == 0 { err = errnoErr(e1) } @@ -727,7 +730,7 @@ func createWellKnownSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID, sid *SID, s } func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16, provtype uint32, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procCryptAcquireContextW.Addr(), 5, uintptr(unsafe.Pointer(provhandle)), uintptr(unsafe.Pointer(container)), uintptr(unsafe.Pointer(provider)), uintptr(provtype), uintptr(flags), 0) + r1, _, e1 := syscall.SyscallN(procCryptAcquireContextW.Addr(), uintptr(unsafe.Pointer(provhandle)), uintptr(unsafe.Pointer(container)), uintptr(unsafe.Pointer(provider)), uintptr(provtype), uintptr(flags)) if r1 == 0 { err = errnoErr(e1) } @@ -735,7 +738,7 @@ func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16 } func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (err error) { - r1, _, e1 := syscall.Syscall(procCryptGenRandom.Addr(), 3, uintptr(provhandle), uintptr(buflen), uintptr(unsafe.Pointer(buf))) + r1, _, e1 := syscall.SyscallN(procCryptGenRandom.Addr(), uintptr(provhandle), uintptr(buflen), uintptr(unsafe.Pointer(buf))) if r1 == 0 { err = errnoErr(e1) } @@ -743,7 +746,7 @@ func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (err error) { } func CryptReleaseContext(provhandle Handle, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall(procCryptReleaseContext.Addr(), 2, uintptr(provhandle), uintptr(flags), 0) + r1, _, e1 := syscall.SyscallN(procCryptReleaseContext.Addr(), uintptr(provhandle), uintptr(flags)) if r1 == 0 { err = errnoErr(e1) } @@ -751,7 +754,7 @@ func CryptReleaseContext(provhandle Handle, flags uint32) (err error) { } func DeleteService(service Handle) (err error) { - r1, _, e1 := syscall.Syscall(procDeleteService.Addr(), 1, uintptr(service), 0, 0) + r1, _, e1 := syscall.SyscallN(procDeleteService.Addr(), uintptr(service)) if r1 == 0 { err = errnoErr(e1) } @@ -759,7 +762,7 @@ func DeleteService(service Handle) (err error) { } func DeregisterEventSource(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procDeregisterEventSource.Addr(), 1, uintptr(handle), 0, 0) + r1, _, e1 := syscall.SyscallN(procDeregisterEventSource.Addr(), uintptr(handle)) if r1 == 0 { err = errnoErr(e1) } @@ -767,7 +770,7 @@ func DeregisterEventSource(handle Handle) (err error) { } func DuplicateTokenEx(existingToken Token, desiredAccess uint32, tokenAttributes *SecurityAttributes, impersonationLevel uint32, tokenType uint32, newToken *Token) (err error) { - r1, _, e1 := syscall.Syscall6(procDuplicateTokenEx.Addr(), 6, uintptr(existingToken), uintptr(desiredAccess), uintptr(unsafe.Pointer(tokenAttributes)), uintptr(impersonationLevel), uintptr(tokenType), uintptr(unsafe.Pointer(newToken))) + r1, _, e1 := syscall.SyscallN(procDuplicateTokenEx.Addr(), uintptr(existingToken), uintptr(desiredAccess), uintptr(unsafe.Pointer(tokenAttributes)), uintptr(impersonationLevel), uintptr(tokenType), uintptr(unsafe.Pointer(newToken))) if r1 == 0 { err = errnoErr(e1) } @@ -775,7 +778,7 @@ func DuplicateTokenEx(existingToken Token, desiredAccess uint32, tokenAttributes } func EnumDependentServices(service Handle, activityState uint32, services *ENUM_SERVICE_STATUS, buffSize uint32, bytesNeeded *uint32, servicesReturned *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procEnumDependentServicesW.Addr(), 6, uintptr(service), uintptr(activityState), uintptr(unsafe.Pointer(services)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), uintptr(unsafe.Pointer(servicesReturned))) + r1, _, e1 := syscall.SyscallN(procEnumDependentServicesW.Addr(), uintptr(service), uintptr(activityState), uintptr(unsafe.Pointer(services)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), uintptr(unsafe.Pointer(servicesReturned))) if r1 == 0 { err = errnoErr(e1) } @@ -783,7 +786,7 @@ func EnumDependentServices(service Handle, activityState uint32, services *ENUM_ } func EnumServicesStatusEx(mgr Handle, infoLevel uint32, serviceType uint32, serviceState uint32, services *byte, bufSize uint32, bytesNeeded *uint32, servicesReturned *uint32, resumeHandle *uint32, groupName *uint16) (err error) { - r1, _, e1 := syscall.Syscall12(procEnumServicesStatusExW.Addr(), 10, uintptr(mgr), uintptr(infoLevel), uintptr(serviceType), uintptr(serviceState), uintptr(unsafe.Pointer(services)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), uintptr(unsafe.Pointer(servicesReturned)), uintptr(unsafe.Pointer(resumeHandle)), uintptr(unsafe.Pointer(groupName)), 0, 0) + r1, _, e1 := syscall.SyscallN(procEnumServicesStatusExW.Addr(), uintptr(mgr), uintptr(infoLevel), uintptr(serviceType), uintptr(serviceState), uintptr(unsafe.Pointer(services)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), uintptr(unsafe.Pointer(servicesReturned)), uintptr(unsafe.Pointer(resumeHandle)), uintptr(unsafe.Pointer(groupName))) if r1 == 0 { err = errnoErr(e1) } @@ -791,13 +794,13 @@ func EnumServicesStatusEx(mgr Handle, infoLevel uint32, serviceType uint32, serv } func EqualSid(sid1 *SID, sid2 *SID) (isEqual bool) { - r0, _, _ := syscall.Syscall(procEqualSid.Addr(), 2, uintptr(unsafe.Pointer(sid1)), uintptr(unsafe.Pointer(sid2)), 0) + r0, _, _ := syscall.SyscallN(procEqualSid.Addr(), uintptr(unsafe.Pointer(sid1)), uintptr(unsafe.Pointer(sid2))) isEqual = r0 != 0 return } func FreeSid(sid *SID) (err error) { - r1, _, e1 := syscall.Syscall(procFreeSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) + r1, _, e1 := syscall.SyscallN(procFreeSid.Addr(), uintptr(unsafe.Pointer(sid))) if r1 != 0 { err = errnoErr(e1) } @@ -805,7 +808,7 @@ func FreeSid(sid *SID) (err error) { } func GetAce(acl *ACL, aceIndex uint32, pAce **ACCESS_ALLOWED_ACE) (err error) { - r1, _, e1 := syscall.Syscall(procGetAce.Addr(), 3, uintptr(unsafe.Pointer(acl)), uintptr(aceIndex), uintptr(unsafe.Pointer(pAce))) + r1, _, e1 := syscall.SyscallN(procGetAce.Addr(), uintptr(unsafe.Pointer(acl)), uintptr(aceIndex), uintptr(unsafe.Pointer(pAce))) if r1 == 0 { err = errnoErr(e1) } @@ -813,7 +816,7 @@ func GetAce(acl *ACL, aceIndex uint32, pAce **ACCESS_ALLOWED_ACE) (err error) { } func GetLengthSid(sid *SID) (len uint32) { - r0, _, _ := syscall.Syscall(procGetLengthSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) + r0, _, _ := syscall.SyscallN(procGetLengthSid.Addr(), uintptr(unsafe.Pointer(sid))) len = uint32(r0) return } @@ -828,7 +831,7 @@ func getNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, security } func _getNamedSecurityInfo(objectName *uint16, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) { - r0, _, _ := syscall.Syscall9(procGetNamedSecurityInfoW.Addr(), 8, uintptr(unsafe.Pointer(objectName)), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(sd)), 0) + r0, _, _ := syscall.SyscallN(procGetNamedSecurityInfoW.Addr(), uintptr(unsafe.Pointer(objectName)), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(sd))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -836,7 +839,7 @@ func _getNamedSecurityInfo(objectName *uint16, objectType SE_OBJECT_TYPE, securi } func getSecurityDescriptorControl(sd *SECURITY_DESCRIPTOR, control *SECURITY_DESCRIPTOR_CONTROL, revision *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorControl.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(control)), uintptr(unsafe.Pointer(revision))) + r1, _, e1 := syscall.SyscallN(procGetSecurityDescriptorControl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(control)), uintptr(unsafe.Pointer(revision))) if r1 == 0 { err = errnoErr(e1) } @@ -852,7 +855,7 @@ func getSecurityDescriptorDacl(sd *SECURITY_DESCRIPTOR, daclPresent *bool, dacl if *daclDefaulted { _p1 = 1 } - r1, _, e1 := syscall.Syscall6(procGetSecurityDescriptorDacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(&_p0)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(&_p1)), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetSecurityDescriptorDacl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(&_p0)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(&_p1))) *daclPresent = _p0 != 0 *daclDefaulted = _p1 != 0 if r1 == 0 { @@ -866,7 +869,7 @@ func getSecurityDescriptorGroup(sd *SECURITY_DESCRIPTOR, group **SID, groupDefau if *groupDefaulted { _p0 = 1 } - r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorGroup.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(&_p0))) + r1, _, e1 := syscall.SyscallN(procGetSecurityDescriptorGroup.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(&_p0))) *groupDefaulted = _p0 != 0 if r1 == 0 { err = errnoErr(e1) @@ -875,7 +878,7 @@ func getSecurityDescriptorGroup(sd *SECURITY_DESCRIPTOR, group **SID, groupDefau } func getSecurityDescriptorLength(sd *SECURITY_DESCRIPTOR) (len uint32) { - r0, _, _ := syscall.Syscall(procGetSecurityDescriptorLength.Addr(), 1, uintptr(unsafe.Pointer(sd)), 0, 0) + r0, _, _ := syscall.SyscallN(procGetSecurityDescriptorLength.Addr(), uintptr(unsafe.Pointer(sd))) len = uint32(r0) return } @@ -885,7 +888,7 @@ func getSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner **SID, ownerDefau if *ownerDefaulted { _p0 = 1 } - r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorOwner.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(&_p0))) + r1, _, e1 := syscall.SyscallN(procGetSecurityDescriptorOwner.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(&_p0))) *ownerDefaulted = _p0 != 0 if r1 == 0 { err = errnoErr(e1) @@ -894,7 +897,7 @@ func getSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner **SID, ownerDefau } func getSecurityDescriptorRMControl(sd *SECURITY_DESCRIPTOR, rmControl *uint8) (ret error) { - r0, _, _ := syscall.Syscall(procGetSecurityDescriptorRMControl.Addr(), 2, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(rmControl)), 0) + r0, _, _ := syscall.SyscallN(procGetSecurityDescriptorRMControl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(rmControl))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -910,7 +913,7 @@ func getSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent *bool, sacl if *saclDefaulted { _p1 = 1 } - r1, _, e1 := syscall.Syscall6(procGetSecurityDescriptorSacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(&_p0)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(&_p1)), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetSecurityDescriptorSacl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(&_p0)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(&_p1))) *saclPresent = _p0 != 0 *saclDefaulted = _p1 != 0 if r1 == 0 { @@ -920,7 +923,7 @@ func getSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent *bool, sacl } func getSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) { - r0, _, _ := syscall.Syscall9(procGetSecurityInfo.Addr(), 8, uintptr(handle), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(sd)), 0) + r0, _, _ := syscall.SyscallN(procGetSecurityInfo.Addr(), uintptr(handle), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(sd))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -928,25 +931,25 @@ func getSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformati } func getSidIdentifierAuthority(sid *SID) (authority *SidIdentifierAuthority) { - r0, _, _ := syscall.Syscall(procGetSidIdentifierAuthority.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) + r0, _, _ := syscall.SyscallN(procGetSidIdentifierAuthority.Addr(), uintptr(unsafe.Pointer(sid))) authority = (*SidIdentifierAuthority)(unsafe.Pointer(r0)) return } func getSidSubAuthority(sid *SID, index uint32) (subAuthority *uint32) { - r0, _, _ := syscall.Syscall(procGetSidSubAuthority.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(index), 0) + r0, _, _ := syscall.SyscallN(procGetSidSubAuthority.Addr(), uintptr(unsafe.Pointer(sid)), uintptr(index)) subAuthority = (*uint32)(unsafe.Pointer(r0)) return } func getSidSubAuthorityCount(sid *SID) (count *uint8) { - r0, _, _ := syscall.Syscall(procGetSidSubAuthorityCount.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) + r0, _, _ := syscall.SyscallN(procGetSidSubAuthorityCount.Addr(), uintptr(unsafe.Pointer(sid))) count = (*uint8)(unsafe.Pointer(r0)) return } func GetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetTokenInformation.Addr(), 5, uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), uintptr(unsafe.Pointer(returnedLen)), 0) + r1, _, e1 := syscall.SyscallN(procGetTokenInformation.Addr(), uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), uintptr(unsafe.Pointer(returnedLen))) if r1 == 0 { err = errnoErr(e1) } @@ -954,7 +957,7 @@ func GetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint } func ImpersonateSelf(impersonationlevel uint32) (err error) { - r1, _, e1 := syscall.Syscall(procImpersonateSelf.Addr(), 1, uintptr(impersonationlevel), 0, 0) + r1, _, e1 := syscall.SyscallN(procImpersonateSelf.Addr(), uintptr(impersonationlevel)) if r1 == 0 { err = errnoErr(e1) } @@ -962,7 +965,7 @@ func ImpersonateSelf(impersonationlevel uint32) (err error) { } func initializeSecurityDescriptor(absoluteSD *SECURITY_DESCRIPTOR, revision uint32) (err error) { - r1, _, e1 := syscall.Syscall(procInitializeSecurityDescriptor.Addr(), 2, uintptr(unsafe.Pointer(absoluteSD)), uintptr(revision), 0) + r1, _, e1 := syscall.SyscallN(procInitializeSecurityDescriptor.Addr(), uintptr(unsafe.Pointer(absoluteSD)), uintptr(revision)) if r1 == 0 { err = errnoErr(e1) } @@ -978,7 +981,7 @@ func InitiateSystemShutdownEx(machineName *uint16, message *uint16, timeout uint if rebootAfterShutdown { _p1 = 1 } - r1, _, e1 := syscall.Syscall6(procInitiateSystemShutdownExW.Addr(), 6, uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(message)), uintptr(timeout), uintptr(_p0), uintptr(_p1), uintptr(reason)) + r1, _, e1 := syscall.SyscallN(procInitiateSystemShutdownExW.Addr(), uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(message)), uintptr(timeout), uintptr(_p0), uintptr(_p1), uintptr(reason)) if r1 == 0 { err = errnoErr(e1) } @@ -986,7 +989,7 @@ func InitiateSystemShutdownEx(machineName *uint16, message *uint16, timeout uint } func isTokenRestricted(tokenHandle Token) (ret bool, err error) { - r0, _, e1 := syscall.Syscall(procIsTokenRestricted.Addr(), 1, uintptr(tokenHandle), 0, 0) + r0, _, e1 := syscall.SyscallN(procIsTokenRestricted.Addr(), uintptr(tokenHandle)) ret = r0 != 0 if !ret { err = errnoErr(e1) @@ -995,25 +998,25 @@ func isTokenRestricted(tokenHandle Token) (ret bool, err error) { } func isValidSecurityDescriptor(sd *SECURITY_DESCRIPTOR) (isValid bool) { - r0, _, _ := syscall.Syscall(procIsValidSecurityDescriptor.Addr(), 1, uintptr(unsafe.Pointer(sd)), 0, 0) + r0, _, _ := syscall.SyscallN(procIsValidSecurityDescriptor.Addr(), uintptr(unsafe.Pointer(sd))) isValid = r0 != 0 return } func isValidSid(sid *SID) (isValid bool) { - r0, _, _ := syscall.Syscall(procIsValidSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) + r0, _, _ := syscall.SyscallN(procIsValidSid.Addr(), uintptr(unsafe.Pointer(sid))) isValid = r0 != 0 return } func isWellKnownSid(sid *SID, sidType WELL_KNOWN_SID_TYPE) (isWellKnown bool) { - r0, _, _ := syscall.Syscall(procIsWellKnownSid.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(sidType), 0) + r0, _, _ := syscall.SyscallN(procIsWellKnownSid.Addr(), uintptr(unsafe.Pointer(sid)), uintptr(sidType)) isWellKnown = r0 != 0 return } func LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procLookupAccountNameW.Addr(), 7, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(accountName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sidLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use)), 0, 0) + r1, _, e1 := syscall.SyscallN(procLookupAccountNameW.Addr(), uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(accountName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sidLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use))) if r1 == 0 { err = errnoErr(e1) } @@ -1021,7 +1024,7 @@ func LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen } func LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procLookupAccountSidW.Addr(), 7, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use)), 0, 0) + r1, _, e1 := syscall.SyscallN(procLookupAccountSidW.Addr(), uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use))) if r1 == 0 { err = errnoErr(e1) } @@ -1029,7 +1032,7 @@ func LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint3 } func LookupPrivilegeValue(systemname *uint16, name *uint16, luid *LUID) (err error) { - r1, _, e1 := syscall.Syscall(procLookupPrivilegeValueW.Addr(), 3, uintptr(unsafe.Pointer(systemname)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid))) + r1, _, e1 := syscall.SyscallN(procLookupPrivilegeValueW.Addr(), uintptr(unsafe.Pointer(systemname)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid))) if r1 == 0 { err = errnoErr(e1) } @@ -1037,7 +1040,7 @@ func LookupPrivilegeValue(systemname *uint16, name *uint16, luid *LUID) (err err } func makeAbsoluteSD(selfRelativeSD *SECURITY_DESCRIPTOR, absoluteSD *SECURITY_DESCRIPTOR, absoluteSDSize *uint32, dacl *ACL, daclSize *uint32, sacl *ACL, saclSize *uint32, owner *SID, ownerSize *uint32, group *SID, groupSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall12(procMakeAbsoluteSD.Addr(), 11, uintptr(unsafe.Pointer(selfRelativeSD)), uintptr(unsafe.Pointer(absoluteSD)), uintptr(unsafe.Pointer(absoluteSDSize)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(daclSize)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(saclSize)), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(ownerSize)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(groupSize)), 0) + r1, _, e1 := syscall.SyscallN(procMakeAbsoluteSD.Addr(), uintptr(unsafe.Pointer(selfRelativeSD)), uintptr(unsafe.Pointer(absoluteSD)), uintptr(unsafe.Pointer(absoluteSDSize)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(daclSize)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(saclSize)), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(ownerSize)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(groupSize))) if r1 == 0 { err = errnoErr(e1) } @@ -1045,7 +1048,7 @@ func makeAbsoluteSD(selfRelativeSD *SECURITY_DESCRIPTOR, absoluteSD *SECURITY_DE } func makeSelfRelativeSD(absoluteSD *SECURITY_DESCRIPTOR, selfRelativeSD *SECURITY_DESCRIPTOR, selfRelativeSDSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procMakeSelfRelativeSD.Addr(), 3, uintptr(unsafe.Pointer(absoluteSD)), uintptr(unsafe.Pointer(selfRelativeSD)), uintptr(unsafe.Pointer(selfRelativeSDSize))) + r1, _, e1 := syscall.SyscallN(procMakeSelfRelativeSD.Addr(), uintptr(unsafe.Pointer(absoluteSD)), uintptr(unsafe.Pointer(selfRelativeSD)), uintptr(unsafe.Pointer(selfRelativeSDSize))) if r1 == 0 { err = errnoErr(e1) } @@ -1053,7 +1056,7 @@ func makeSelfRelativeSD(absoluteSD *SECURITY_DESCRIPTOR, selfRelativeSD *SECURIT } func NotifyServiceStatusChange(service Handle, notifyMask uint32, notifier *SERVICE_NOTIFY) (ret error) { - r0, _, _ := syscall.Syscall(procNotifyServiceStatusChangeW.Addr(), 3, uintptr(service), uintptr(notifyMask), uintptr(unsafe.Pointer(notifier))) + r0, _, _ := syscall.SyscallN(procNotifyServiceStatusChangeW.Addr(), uintptr(service), uintptr(notifyMask), uintptr(unsafe.Pointer(notifier))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -1061,7 +1064,7 @@ func NotifyServiceStatusChange(service Handle, notifyMask uint32, notifier *SERV } func OpenProcessToken(process Handle, access uint32, token *Token) (err error) { - r1, _, e1 := syscall.Syscall(procOpenProcessToken.Addr(), 3, uintptr(process), uintptr(access), uintptr(unsafe.Pointer(token))) + r1, _, e1 := syscall.SyscallN(procOpenProcessToken.Addr(), uintptr(process), uintptr(access), uintptr(unsafe.Pointer(token))) if r1 == 0 { err = errnoErr(e1) } @@ -1069,7 +1072,7 @@ func OpenProcessToken(process Handle, access uint32, token *Token) (err error) { } func OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procOpenSCManagerW.Addr(), 3, uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(databaseName)), uintptr(access)) + r0, _, e1 := syscall.SyscallN(procOpenSCManagerW.Addr(), uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(databaseName)), uintptr(access)) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -1078,7 +1081,7 @@ func OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (ha } func OpenService(mgr Handle, serviceName *uint16, access uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procOpenServiceW.Addr(), 3, uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(access)) + r0, _, e1 := syscall.SyscallN(procOpenServiceW.Addr(), uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(access)) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -1091,7 +1094,7 @@ func OpenThreadToken(thread Handle, access uint32, openAsSelf bool, token *Token if openAsSelf { _p0 = 1 } - r1, _, e1 := syscall.Syscall6(procOpenThreadToken.Addr(), 4, uintptr(thread), uintptr(access), uintptr(_p0), uintptr(unsafe.Pointer(token)), 0, 0) + r1, _, e1 := syscall.SyscallN(procOpenThreadToken.Addr(), uintptr(thread), uintptr(access), uintptr(_p0), uintptr(unsafe.Pointer(token))) if r1 == 0 { err = errnoErr(e1) } @@ -1099,7 +1102,7 @@ func OpenThreadToken(thread Handle, access uint32, openAsSelf bool, token *Token } func QueryServiceConfig2(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procQueryServiceConfig2W.Addr(), 5, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), 0) + r1, _, e1 := syscall.SyscallN(procQueryServiceConfig2W.Addr(), uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded))) if r1 == 0 { err = errnoErr(e1) } @@ -1107,7 +1110,7 @@ func QueryServiceConfig2(service Handle, infoLevel uint32, buff *byte, buffSize } func QueryServiceConfig(service Handle, serviceConfig *QUERY_SERVICE_CONFIG, bufSize uint32, bytesNeeded *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procQueryServiceConfigW.Addr(), 4, uintptr(service), uintptr(unsafe.Pointer(serviceConfig)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), 0, 0) + r1, _, e1 := syscall.SyscallN(procQueryServiceConfigW.Addr(), uintptr(service), uintptr(unsafe.Pointer(serviceConfig)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded))) if r1 == 0 { err = errnoErr(e1) } @@ -1119,7 +1122,7 @@ func QueryServiceDynamicInformation(service Handle, infoLevel uint32, dynamicInf if err != nil { return } - r1, _, e1 := syscall.Syscall(procQueryServiceDynamicInformation.Addr(), 3, uintptr(service), uintptr(infoLevel), uintptr(dynamicInfo)) + r1, _, e1 := syscall.SyscallN(procQueryServiceDynamicInformation.Addr(), uintptr(service), uintptr(infoLevel), uintptr(dynamicInfo)) if r1 == 0 { err = errnoErr(e1) } @@ -1127,7 +1130,7 @@ func QueryServiceDynamicInformation(service Handle, infoLevel uint32, dynamicInf } func QueryServiceLockStatus(mgr Handle, lockStatus *QUERY_SERVICE_LOCK_STATUS, bufSize uint32, bytesNeeded *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procQueryServiceLockStatusW.Addr(), 4, uintptr(mgr), uintptr(unsafe.Pointer(lockStatus)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), 0, 0) + r1, _, e1 := syscall.SyscallN(procQueryServiceLockStatusW.Addr(), uintptr(mgr), uintptr(unsafe.Pointer(lockStatus)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded))) if r1 == 0 { err = errnoErr(e1) } @@ -1135,7 +1138,7 @@ func QueryServiceLockStatus(mgr Handle, lockStatus *QUERY_SERVICE_LOCK_STATUS, b } func QueryServiceStatus(service Handle, status *SERVICE_STATUS) (err error) { - r1, _, e1 := syscall.Syscall(procQueryServiceStatus.Addr(), 2, uintptr(service), uintptr(unsafe.Pointer(status)), 0) + r1, _, e1 := syscall.SyscallN(procQueryServiceStatus.Addr(), uintptr(service), uintptr(unsafe.Pointer(status))) if r1 == 0 { err = errnoErr(e1) } @@ -1143,7 +1146,7 @@ func QueryServiceStatus(service Handle, status *SERVICE_STATUS) (err error) { } func QueryServiceStatusEx(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procQueryServiceStatusEx.Addr(), 5, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), 0) + r1, _, e1 := syscall.SyscallN(procQueryServiceStatusEx.Addr(), uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded))) if r1 == 0 { err = errnoErr(e1) } @@ -1151,7 +1154,7 @@ func QueryServiceStatusEx(service Handle, infoLevel uint32, buff *byte, buffSize } func RegCloseKey(key Handle) (regerrno error) { - r0, _, _ := syscall.Syscall(procRegCloseKey.Addr(), 1, uintptr(key), 0, 0) + r0, _, _ := syscall.SyscallN(procRegCloseKey.Addr(), uintptr(key)) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -1159,7 +1162,7 @@ func RegCloseKey(key Handle) (regerrno error) { } func RegEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, classLen *uint32, lastWriteTime *Filetime) (regerrno error) { - r0, _, _ := syscall.Syscall9(procRegEnumKeyExW.Addr(), 8, uintptr(key), uintptr(index), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(classLen)), uintptr(unsafe.Pointer(lastWriteTime)), 0) + r0, _, _ := syscall.SyscallN(procRegEnumKeyExW.Addr(), uintptr(key), uintptr(index), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(classLen)), uintptr(unsafe.Pointer(lastWriteTime))) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -1175,7 +1178,7 @@ func RegNotifyChangeKeyValue(key Handle, watchSubtree bool, notifyFilter uint32, if asynchronous { _p1 = 1 } - r0, _, _ := syscall.Syscall6(procRegNotifyChangeKeyValue.Addr(), 5, uintptr(key), uintptr(_p0), uintptr(notifyFilter), uintptr(event), uintptr(_p1), 0) + r0, _, _ := syscall.SyscallN(procRegNotifyChangeKeyValue.Addr(), uintptr(key), uintptr(_p0), uintptr(notifyFilter), uintptr(event), uintptr(_p1)) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -1183,7 +1186,7 @@ func RegNotifyChangeKeyValue(key Handle, watchSubtree bool, notifyFilter uint32, } func RegOpenKeyEx(key Handle, subkey *uint16, options uint32, desiredAccess uint32, result *Handle) (regerrno error) { - r0, _, _ := syscall.Syscall6(procRegOpenKeyExW.Addr(), 5, uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(options), uintptr(desiredAccess), uintptr(unsafe.Pointer(result)), 0) + r0, _, _ := syscall.SyscallN(procRegOpenKeyExW.Addr(), uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(options), uintptr(desiredAccess), uintptr(unsafe.Pointer(result))) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -1191,7 +1194,7 @@ func RegOpenKeyEx(key Handle, subkey *uint16, options uint32, desiredAccess uint } func RegQueryInfoKey(key Handle, class *uint16, classLen *uint32, reserved *uint32, subkeysLen *uint32, maxSubkeyLen *uint32, maxClassLen *uint32, valuesLen *uint32, maxValueNameLen *uint32, maxValueLen *uint32, saLen *uint32, lastWriteTime *Filetime) (regerrno error) { - r0, _, _ := syscall.Syscall12(procRegQueryInfoKeyW.Addr(), 12, uintptr(key), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(classLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(subkeysLen)), uintptr(unsafe.Pointer(maxSubkeyLen)), uintptr(unsafe.Pointer(maxClassLen)), uintptr(unsafe.Pointer(valuesLen)), uintptr(unsafe.Pointer(maxValueNameLen)), uintptr(unsafe.Pointer(maxValueLen)), uintptr(unsafe.Pointer(saLen)), uintptr(unsafe.Pointer(lastWriteTime))) + r0, _, _ := syscall.SyscallN(procRegQueryInfoKeyW.Addr(), uintptr(key), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(classLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(subkeysLen)), uintptr(unsafe.Pointer(maxSubkeyLen)), uintptr(unsafe.Pointer(maxClassLen)), uintptr(unsafe.Pointer(valuesLen)), uintptr(unsafe.Pointer(maxValueNameLen)), uintptr(unsafe.Pointer(maxValueLen)), uintptr(unsafe.Pointer(saLen)), uintptr(unsafe.Pointer(lastWriteTime))) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -1199,7 +1202,7 @@ func RegQueryInfoKey(key Handle, class *uint16, classLen *uint32, reserved *uint } func RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) { - r0, _, _ := syscall.Syscall6(procRegQueryValueExW.Addr(), 6, uintptr(key), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(valtype)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(buflen))) + r0, _, _ := syscall.SyscallN(procRegQueryValueExW.Addr(), uintptr(key), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(valtype)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(buflen))) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -1207,7 +1210,7 @@ func RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32 } func RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procRegisterEventSourceW.Addr(), 2, uintptr(unsafe.Pointer(uncServerName)), uintptr(unsafe.Pointer(sourceName)), 0) + r0, _, e1 := syscall.SyscallN(procRegisterEventSourceW.Addr(), uintptr(unsafe.Pointer(uncServerName)), uintptr(unsafe.Pointer(sourceName))) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -1216,7 +1219,7 @@ func RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Hand } func RegisterServiceCtrlHandlerEx(serviceName *uint16, handlerProc uintptr, context uintptr) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procRegisterServiceCtrlHandlerExW.Addr(), 3, uintptr(unsafe.Pointer(serviceName)), uintptr(handlerProc), uintptr(context)) + r0, _, e1 := syscall.SyscallN(procRegisterServiceCtrlHandlerExW.Addr(), uintptr(unsafe.Pointer(serviceName)), uintptr(handlerProc), uintptr(context)) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -1225,7 +1228,7 @@ func RegisterServiceCtrlHandlerEx(serviceName *uint16, handlerProc uintptr, cont } func ReportEvent(log Handle, etype uint16, category uint16, eventId uint32, usrSId uintptr, numStrings uint16, dataSize uint32, strings **uint16, rawData *byte) (err error) { - r1, _, e1 := syscall.Syscall9(procReportEventW.Addr(), 9, uintptr(log), uintptr(etype), uintptr(category), uintptr(eventId), uintptr(usrSId), uintptr(numStrings), uintptr(dataSize), uintptr(unsafe.Pointer(strings)), uintptr(unsafe.Pointer(rawData))) + r1, _, e1 := syscall.SyscallN(procReportEventW.Addr(), uintptr(log), uintptr(etype), uintptr(category), uintptr(eventId), uintptr(usrSId), uintptr(numStrings), uintptr(dataSize), uintptr(unsafe.Pointer(strings)), uintptr(unsafe.Pointer(rawData))) if r1 == 0 { err = errnoErr(e1) } @@ -1233,7 +1236,7 @@ func ReportEvent(log Handle, etype uint16, category uint16, eventId uint32, usrS } func RevertToSelf() (err error) { - r1, _, e1 := syscall.Syscall(procRevertToSelf.Addr(), 0, 0, 0, 0) + r1, _, e1 := syscall.SyscallN(procRevertToSelf.Addr()) if r1 == 0 { err = errnoErr(e1) } @@ -1241,7 +1244,7 @@ func RevertToSelf() (err error) { } func setEntriesInAcl(countExplicitEntries uint32, explicitEntries *EXPLICIT_ACCESS, oldACL *ACL, newACL **ACL) (ret error) { - r0, _, _ := syscall.Syscall6(procSetEntriesInAclW.Addr(), 4, uintptr(countExplicitEntries), uintptr(unsafe.Pointer(explicitEntries)), uintptr(unsafe.Pointer(oldACL)), uintptr(unsafe.Pointer(newACL)), 0, 0) + r0, _, _ := syscall.SyscallN(procSetEntriesInAclW.Addr(), uintptr(countExplicitEntries), uintptr(unsafe.Pointer(explicitEntries)), uintptr(unsafe.Pointer(oldACL)), uintptr(unsafe.Pointer(newACL))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -1249,7 +1252,7 @@ func setEntriesInAcl(countExplicitEntries uint32, explicitEntries *EXPLICIT_ACCE } func SetKernelObjectSecurity(handle Handle, securityInformation SECURITY_INFORMATION, securityDescriptor *SECURITY_DESCRIPTOR) (err error) { - r1, _, e1 := syscall.Syscall(procSetKernelObjectSecurity.Addr(), 3, uintptr(handle), uintptr(securityInformation), uintptr(unsafe.Pointer(securityDescriptor))) + r1, _, e1 := syscall.SyscallN(procSetKernelObjectSecurity.Addr(), uintptr(handle), uintptr(securityInformation), uintptr(unsafe.Pointer(securityDescriptor))) if r1 == 0 { err = errnoErr(e1) } @@ -1266,7 +1269,7 @@ func SetNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, security } func _SetNamedSecurityInfo(objectName *uint16, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) { - r0, _, _ := syscall.Syscall9(procSetNamedSecurityInfoW.Addr(), 7, uintptr(unsafe.Pointer(objectName)), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), 0, 0) + r0, _, _ := syscall.SyscallN(procSetNamedSecurityInfoW.Addr(), uintptr(unsafe.Pointer(objectName)), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -1274,7 +1277,7 @@ func _SetNamedSecurityInfo(objectName *uint16, objectType SE_OBJECT_TYPE, securi } func setSecurityDescriptorControl(sd *SECURITY_DESCRIPTOR, controlBitsOfInterest SECURITY_DESCRIPTOR_CONTROL, controlBitsToSet SECURITY_DESCRIPTOR_CONTROL) (err error) { - r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorControl.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(controlBitsOfInterest), uintptr(controlBitsToSet)) + r1, _, e1 := syscall.SyscallN(procSetSecurityDescriptorControl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(controlBitsOfInterest), uintptr(controlBitsToSet)) if r1 == 0 { err = errnoErr(e1) } @@ -1290,7 +1293,7 @@ func setSecurityDescriptorDacl(sd *SECURITY_DESCRIPTOR, daclPresent bool, dacl * if daclDefaulted { _p1 = 1 } - r1, _, e1 := syscall.Syscall6(procSetSecurityDescriptorDacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(_p0), uintptr(unsafe.Pointer(dacl)), uintptr(_p1), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetSecurityDescriptorDacl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(_p0), uintptr(unsafe.Pointer(dacl)), uintptr(_p1)) if r1 == 0 { err = errnoErr(e1) } @@ -1302,7 +1305,7 @@ func setSecurityDescriptorGroup(sd *SECURITY_DESCRIPTOR, group *SID, groupDefaul if groupDefaulted { _p0 = 1 } - r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorGroup.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(group)), uintptr(_p0)) + r1, _, e1 := syscall.SyscallN(procSetSecurityDescriptorGroup.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(group)), uintptr(_p0)) if r1 == 0 { err = errnoErr(e1) } @@ -1314,7 +1317,7 @@ func setSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner *SID, ownerDefaul if ownerDefaulted { _p0 = 1 } - r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorOwner.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(owner)), uintptr(_p0)) + r1, _, e1 := syscall.SyscallN(procSetSecurityDescriptorOwner.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(owner)), uintptr(_p0)) if r1 == 0 { err = errnoErr(e1) } @@ -1322,7 +1325,7 @@ func setSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner *SID, ownerDefaul } func setSecurityDescriptorRMControl(sd *SECURITY_DESCRIPTOR, rmControl *uint8) { - syscall.Syscall(procSetSecurityDescriptorRMControl.Addr(), 2, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(rmControl)), 0) + syscall.SyscallN(procSetSecurityDescriptorRMControl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(rmControl))) return } @@ -1335,7 +1338,7 @@ func setSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent bool, sacl * if saclDefaulted { _p1 = 1 } - r1, _, e1 := syscall.Syscall6(procSetSecurityDescriptorSacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(_p0), uintptr(unsafe.Pointer(sacl)), uintptr(_p1), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetSecurityDescriptorSacl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(_p0), uintptr(unsafe.Pointer(sacl)), uintptr(_p1)) if r1 == 0 { err = errnoErr(e1) } @@ -1343,7 +1346,7 @@ func setSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent bool, sacl * } func SetSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) { - r0, _, _ := syscall.Syscall9(procSetSecurityInfo.Addr(), 7, uintptr(handle), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), 0, 0) + r0, _, _ := syscall.SyscallN(procSetSecurityInfo.Addr(), uintptr(handle), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -1351,7 +1354,7 @@ func SetSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformati } func SetServiceStatus(service Handle, serviceStatus *SERVICE_STATUS) (err error) { - r1, _, e1 := syscall.Syscall(procSetServiceStatus.Addr(), 2, uintptr(service), uintptr(unsafe.Pointer(serviceStatus)), 0) + r1, _, e1 := syscall.SyscallN(procSetServiceStatus.Addr(), uintptr(service), uintptr(unsafe.Pointer(serviceStatus))) if r1 == 0 { err = errnoErr(e1) } @@ -1359,7 +1362,7 @@ func SetServiceStatus(service Handle, serviceStatus *SERVICE_STATUS) (err error) } func SetThreadToken(thread *Handle, token Token) (err error) { - r1, _, e1 := syscall.Syscall(procSetThreadToken.Addr(), 2, uintptr(unsafe.Pointer(thread)), uintptr(token), 0) + r1, _, e1 := syscall.SyscallN(procSetThreadToken.Addr(), uintptr(unsafe.Pointer(thread)), uintptr(token)) if r1 == 0 { err = errnoErr(e1) } @@ -1367,7 +1370,7 @@ func SetThreadToken(thread *Handle, token Token) (err error) { } func SetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procSetTokenInformation.Addr(), 4, uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetTokenInformation.Addr(), uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen)) if r1 == 0 { err = errnoErr(e1) } @@ -1375,7 +1378,7 @@ func SetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint } func StartServiceCtrlDispatcher(serviceTable *SERVICE_TABLE_ENTRY) (err error) { - r1, _, e1 := syscall.Syscall(procStartServiceCtrlDispatcherW.Addr(), 1, uintptr(unsafe.Pointer(serviceTable)), 0, 0) + r1, _, e1 := syscall.SyscallN(procStartServiceCtrlDispatcherW.Addr(), uintptr(unsafe.Pointer(serviceTable))) if r1 == 0 { err = errnoErr(e1) } @@ -1383,7 +1386,7 @@ func StartServiceCtrlDispatcher(serviceTable *SERVICE_TABLE_ENTRY) (err error) { } func StartService(service Handle, numArgs uint32, argVectors **uint16) (err error) { - r1, _, e1 := syscall.Syscall(procStartServiceW.Addr(), 3, uintptr(service), uintptr(numArgs), uintptr(unsafe.Pointer(argVectors))) + r1, _, e1 := syscall.SyscallN(procStartServiceW.Addr(), uintptr(service), uintptr(numArgs), uintptr(unsafe.Pointer(argVectors))) if r1 == 0 { err = errnoErr(e1) } @@ -1391,7 +1394,7 @@ func StartService(service Handle, numArgs uint32, argVectors **uint16) (err erro } func CertAddCertificateContextToStore(store Handle, certContext *CertContext, addDisposition uint32, storeContext **CertContext) (err error) { - r1, _, e1 := syscall.Syscall6(procCertAddCertificateContextToStore.Addr(), 4, uintptr(store), uintptr(unsafe.Pointer(certContext)), uintptr(addDisposition), uintptr(unsafe.Pointer(storeContext)), 0, 0) + r1, _, e1 := syscall.SyscallN(procCertAddCertificateContextToStore.Addr(), uintptr(store), uintptr(unsafe.Pointer(certContext)), uintptr(addDisposition), uintptr(unsafe.Pointer(storeContext))) if r1 == 0 { err = errnoErr(e1) } @@ -1399,7 +1402,7 @@ func CertAddCertificateContextToStore(store Handle, certContext *CertContext, ad } func CertCloseStore(store Handle, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall(procCertCloseStore.Addr(), 2, uintptr(store), uintptr(flags), 0) + r1, _, e1 := syscall.SyscallN(procCertCloseStore.Addr(), uintptr(store), uintptr(flags)) if r1 == 0 { err = errnoErr(e1) } @@ -1407,7 +1410,7 @@ func CertCloseStore(store Handle, flags uint32) (err error) { } func CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, encodedLen uint32) (context *CertContext, err error) { - r0, _, e1 := syscall.Syscall(procCertCreateCertificateContext.Addr(), 3, uintptr(certEncodingType), uintptr(unsafe.Pointer(certEncoded)), uintptr(encodedLen)) + r0, _, e1 := syscall.SyscallN(procCertCreateCertificateContext.Addr(), uintptr(certEncodingType), uintptr(unsafe.Pointer(certEncoded)), uintptr(encodedLen)) context = (*CertContext)(unsafe.Pointer(r0)) if context == nil { err = errnoErr(e1) @@ -1416,7 +1419,7 @@ func CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, en } func CertDeleteCertificateFromStore(certContext *CertContext) (err error) { - r1, _, e1 := syscall.Syscall(procCertDeleteCertificateFromStore.Addr(), 1, uintptr(unsafe.Pointer(certContext)), 0, 0) + r1, _, e1 := syscall.SyscallN(procCertDeleteCertificateFromStore.Addr(), uintptr(unsafe.Pointer(certContext))) if r1 == 0 { err = errnoErr(e1) } @@ -1424,13 +1427,13 @@ func CertDeleteCertificateFromStore(certContext *CertContext) (err error) { } func CertDuplicateCertificateContext(certContext *CertContext) (dupContext *CertContext) { - r0, _, _ := syscall.Syscall(procCertDuplicateCertificateContext.Addr(), 1, uintptr(unsafe.Pointer(certContext)), 0, 0) + r0, _, _ := syscall.SyscallN(procCertDuplicateCertificateContext.Addr(), uintptr(unsafe.Pointer(certContext))) dupContext = (*CertContext)(unsafe.Pointer(r0)) return } func CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (context *CertContext, err error) { - r0, _, e1 := syscall.Syscall(procCertEnumCertificatesInStore.Addr(), 2, uintptr(store), uintptr(unsafe.Pointer(prevContext)), 0) + r0, _, e1 := syscall.SyscallN(procCertEnumCertificatesInStore.Addr(), uintptr(store), uintptr(unsafe.Pointer(prevContext))) context = (*CertContext)(unsafe.Pointer(r0)) if context == nil { err = errnoErr(e1) @@ -1439,7 +1442,7 @@ func CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (contex } func CertFindCertificateInStore(store Handle, certEncodingType uint32, findFlags uint32, findType uint32, findPara unsafe.Pointer, prevCertContext *CertContext) (cert *CertContext, err error) { - r0, _, e1 := syscall.Syscall6(procCertFindCertificateInStore.Addr(), 6, uintptr(store), uintptr(certEncodingType), uintptr(findFlags), uintptr(findType), uintptr(findPara), uintptr(unsafe.Pointer(prevCertContext))) + r0, _, e1 := syscall.SyscallN(procCertFindCertificateInStore.Addr(), uintptr(store), uintptr(certEncodingType), uintptr(findFlags), uintptr(findType), uintptr(findPara), uintptr(unsafe.Pointer(prevCertContext))) cert = (*CertContext)(unsafe.Pointer(r0)) if cert == nil { err = errnoErr(e1) @@ -1448,7 +1451,7 @@ func CertFindCertificateInStore(store Handle, certEncodingType uint32, findFlags } func CertFindChainInStore(store Handle, certEncodingType uint32, findFlags uint32, findType uint32, findPara unsafe.Pointer, prevChainContext *CertChainContext) (certchain *CertChainContext, err error) { - r0, _, e1 := syscall.Syscall6(procCertFindChainInStore.Addr(), 6, uintptr(store), uintptr(certEncodingType), uintptr(findFlags), uintptr(findType), uintptr(findPara), uintptr(unsafe.Pointer(prevChainContext))) + r0, _, e1 := syscall.SyscallN(procCertFindChainInStore.Addr(), uintptr(store), uintptr(certEncodingType), uintptr(findFlags), uintptr(findType), uintptr(findPara), uintptr(unsafe.Pointer(prevChainContext))) certchain = (*CertChainContext)(unsafe.Pointer(r0)) if certchain == nil { err = errnoErr(e1) @@ -1457,18 +1460,18 @@ func CertFindChainInStore(store Handle, certEncodingType uint32, findFlags uint3 } func CertFindExtension(objId *byte, countExtensions uint32, extensions *CertExtension) (ret *CertExtension) { - r0, _, _ := syscall.Syscall(procCertFindExtension.Addr(), 3, uintptr(unsafe.Pointer(objId)), uintptr(countExtensions), uintptr(unsafe.Pointer(extensions))) + r0, _, _ := syscall.SyscallN(procCertFindExtension.Addr(), uintptr(unsafe.Pointer(objId)), uintptr(countExtensions), uintptr(unsafe.Pointer(extensions))) ret = (*CertExtension)(unsafe.Pointer(r0)) return } func CertFreeCertificateChain(ctx *CertChainContext) { - syscall.Syscall(procCertFreeCertificateChain.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0) + syscall.SyscallN(procCertFreeCertificateChain.Addr(), uintptr(unsafe.Pointer(ctx))) return } func CertFreeCertificateContext(ctx *CertContext) (err error) { - r1, _, e1 := syscall.Syscall(procCertFreeCertificateContext.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0) + r1, _, e1 := syscall.SyscallN(procCertFreeCertificateContext.Addr(), uintptr(unsafe.Pointer(ctx))) if r1 == 0 { err = errnoErr(e1) } @@ -1476,7 +1479,7 @@ func CertFreeCertificateContext(ctx *CertContext) (err error) { } func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, additionalStore Handle, para *CertChainPara, flags uint32, reserved uintptr, chainCtx **CertChainContext) (err error) { - r1, _, e1 := syscall.Syscall9(procCertGetCertificateChain.Addr(), 8, uintptr(engine), uintptr(unsafe.Pointer(leaf)), uintptr(unsafe.Pointer(time)), uintptr(additionalStore), uintptr(unsafe.Pointer(para)), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(chainCtx)), 0) + r1, _, e1 := syscall.SyscallN(procCertGetCertificateChain.Addr(), uintptr(engine), uintptr(unsafe.Pointer(leaf)), uintptr(unsafe.Pointer(time)), uintptr(additionalStore), uintptr(unsafe.Pointer(para)), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(chainCtx))) if r1 == 0 { err = errnoErr(e1) } @@ -1484,13 +1487,13 @@ func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, a } func CertGetNameString(certContext *CertContext, nameType uint32, flags uint32, typePara unsafe.Pointer, name *uint16, size uint32) (chars uint32) { - r0, _, _ := syscall.Syscall6(procCertGetNameStringW.Addr(), 6, uintptr(unsafe.Pointer(certContext)), uintptr(nameType), uintptr(flags), uintptr(typePara), uintptr(unsafe.Pointer(name)), uintptr(size)) + r0, _, _ := syscall.SyscallN(procCertGetNameStringW.Addr(), uintptr(unsafe.Pointer(certContext)), uintptr(nameType), uintptr(flags), uintptr(typePara), uintptr(unsafe.Pointer(name)), uintptr(size)) chars = uint32(r0) return } func CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptProv uintptr, flags uint32, para uintptr) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall6(procCertOpenStore.Addr(), 5, uintptr(storeProvider), uintptr(msgAndCertEncodingType), uintptr(cryptProv), uintptr(flags), uintptr(para), 0) + r0, _, e1 := syscall.SyscallN(procCertOpenStore.Addr(), uintptr(storeProvider), uintptr(msgAndCertEncodingType), uintptr(cryptProv), uintptr(flags), uintptr(para)) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -1499,7 +1502,7 @@ func CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptPr } func CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) { - r0, _, e1 := syscall.Syscall(procCertOpenSystemStoreW.Addr(), 2, uintptr(hprov), uintptr(unsafe.Pointer(name)), 0) + r0, _, e1 := syscall.SyscallN(procCertOpenSystemStoreW.Addr(), uintptr(hprov), uintptr(unsafe.Pointer(name))) store = Handle(r0) if store == 0 { err = errnoErr(e1) @@ -1508,7 +1511,7 @@ func CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) { } func CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext, para *CertChainPolicyPara, status *CertChainPolicyStatus) (err error) { - r1, _, e1 := syscall.Syscall6(procCertVerifyCertificateChainPolicy.Addr(), 4, uintptr(policyOID), uintptr(unsafe.Pointer(chain)), uintptr(unsafe.Pointer(para)), uintptr(unsafe.Pointer(status)), 0, 0) + r1, _, e1 := syscall.SyscallN(procCertVerifyCertificateChainPolicy.Addr(), uintptr(policyOID), uintptr(unsafe.Pointer(chain)), uintptr(unsafe.Pointer(para)), uintptr(unsafe.Pointer(status))) if r1 == 0 { err = errnoErr(e1) } @@ -1520,7 +1523,7 @@ func CryptAcquireCertificatePrivateKey(cert *CertContext, flags uint32, paramete if *callerFreeProvOrNCryptKey { _p0 = 1 } - r1, _, e1 := syscall.Syscall6(procCryptAcquireCertificatePrivateKey.Addr(), 6, uintptr(unsafe.Pointer(cert)), uintptr(flags), uintptr(parameters), uintptr(unsafe.Pointer(cryptProvOrNCryptKey)), uintptr(unsafe.Pointer(keySpec)), uintptr(unsafe.Pointer(&_p0))) + r1, _, e1 := syscall.SyscallN(procCryptAcquireCertificatePrivateKey.Addr(), uintptr(unsafe.Pointer(cert)), uintptr(flags), uintptr(parameters), uintptr(unsafe.Pointer(cryptProvOrNCryptKey)), uintptr(unsafe.Pointer(keySpec)), uintptr(unsafe.Pointer(&_p0))) *callerFreeProvOrNCryptKey = _p0 != 0 if r1 == 0 { err = errnoErr(e1) @@ -1529,7 +1532,7 @@ func CryptAcquireCertificatePrivateKey(cert *CertContext, flags uint32, paramete } func CryptDecodeObject(encodingType uint32, structType *byte, encodedBytes *byte, lenEncodedBytes uint32, flags uint32, decoded unsafe.Pointer, decodedLen *uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procCryptDecodeObject.Addr(), 7, uintptr(encodingType), uintptr(unsafe.Pointer(structType)), uintptr(unsafe.Pointer(encodedBytes)), uintptr(lenEncodedBytes), uintptr(flags), uintptr(decoded), uintptr(unsafe.Pointer(decodedLen)), 0, 0) + r1, _, e1 := syscall.SyscallN(procCryptDecodeObject.Addr(), uintptr(encodingType), uintptr(unsafe.Pointer(structType)), uintptr(unsafe.Pointer(encodedBytes)), uintptr(lenEncodedBytes), uintptr(flags), uintptr(decoded), uintptr(unsafe.Pointer(decodedLen))) if r1 == 0 { err = errnoErr(e1) } @@ -1537,7 +1540,7 @@ func CryptDecodeObject(encodingType uint32, structType *byte, encodedBytes *byte } func CryptProtectData(dataIn *DataBlob, name *uint16, optionalEntropy *DataBlob, reserved uintptr, promptStruct *CryptProtectPromptStruct, flags uint32, dataOut *DataBlob) (err error) { - r1, _, e1 := syscall.Syscall9(procCryptProtectData.Addr(), 7, uintptr(unsafe.Pointer(dataIn)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(optionalEntropy)), uintptr(reserved), uintptr(unsafe.Pointer(promptStruct)), uintptr(flags), uintptr(unsafe.Pointer(dataOut)), 0, 0) + r1, _, e1 := syscall.SyscallN(procCryptProtectData.Addr(), uintptr(unsafe.Pointer(dataIn)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(optionalEntropy)), uintptr(reserved), uintptr(unsafe.Pointer(promptStruct)), uintptr(flags), uintptr(unsafe.Pointer(dataOut))) if r1 == 0 { err = errnoErr(e1) } @@ -1545,7 +1548,7 @@ func CryptProtectData(dataIn *DataBlob, name *uint16, optionalEntropy *DataBlob, } func CryptQueryObject(objectType uint32, object unsafe.Pointer, expectedContentTypeFlags uint32, expectedFormatTypeFlags uint32, flags uint32, msgAndCertEncodingType *uint32, contentType *uint32, formatType *uint32, certStore *Handle, msg *Handle, context *unsafe.Pointer) (err error) { - r1, _, e1 := syscall.Syscall12(procCryptQueryObject.Addr(), 11, uintptr(objectType), uintptr(object), uintptr(expectedContentTypeFlags), uintptr(expectedFormatTypeFlags), uintptr(flags), uintptr(unsafe.Pointer(msgAndCertEncodingType)), uintptr(unsafe.Pointer(contentType)), uintptr(unsafe.Pointer(formatType)), uintptr(unsafe.Pointer(certStore)), uintptr(unsafe.Pointer(msg)), uintptr(unsafe.Pointer(context)), 0) + r1, _, e1 := syscall.SyscallN(procCryptQueryObject.Addr(), uintptr(objectType), uintptr(object), uintptr(expectedContentTypeFlags), uintptr(expectedFormatTypeFlags), uintptr(flags), uintptr(unsafe.Pointer(msgAndCertEncodingType)), uintptr(unsafe.Pointer(contentType)), uintptr(unsafe.Pointer(formatType)), uintptr(unsafe.Pointer(certStore)), uintptr(unsafe.Pointer(msg)), uintptr(unsafe.Pointer(context))) if r1 == 0 { err = errnoErr(e1) } @@ -1553,7 +1556,7 @@ func CryptQueryObject(objectType uint32, object unsafe.Pointer, expectedContentT } func CryptUnprotectData(dataIn *DataBlob, name **uint16, optionalEntropy *DataBlob, reserved uintptr, promptStruct *CryptProtectPromptStruct, flags uint32, dataOut *DataBlob) (err error) { - r1, _, e1 := syscall.Syscall9(procCryptUnprotectData.Addr(), 7, uintptr(unsafe.Pointer(dataIn)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(optionalEntropy)), uintptr(reserved), uintptr(unsafe.Pointer(promptStruct)), uintptr(flags), uintptr(unsafe.Pointer(dataOut)), 0, 0) + r1, _, e1 := syscall.SyscallN(procCryptUnprotectData.Addr(), uintptr(unsafe.Pointer(dataIn)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(optionalEntropy)), uintptr(reserved), uintptr(unsafe.Pointer(promptStruct)), uintptr(flags), uintptr(unsafe.Pointer(dataOut))) if r1 == 0 { err = errnoErr(e1) } @@ -1561,7 +1564,7 @@ func CryptUnprotectData(dataIn *DataBlob, name **uint16, optionalEntropy *DataBl } func PFXImportCertStore(pfx *CryptDataBlob, password *uint16, flags uint32) (store Handle, err error) { - r0, _, e1 := syscall.Syscall(procPFXImportCertStore.Addr(), 3, uintptr(unsafe.Pointer(pfx)), uintptr(unsafe.Pointer(password)), uintptr(flags)) + r0, _, e1 := syscall.SyscallN(procPFXImportCertStore.Addr(), uintptr(unsafe.Pointer(pfx)), uintptr(unsafe.Pointer(password)), uintptr(flags)) store = Handle(r0) if store == 0 { err = errnoErr(e1) @@ -1570,7 +1573,7 @@ func PFXImportCertStore(pfx *CryptDataBlob, password *uint16, flags uint32) (sto } func DnsNameCompare(name1 *uint16, name2 *uint16) (same bool) { - r0, _, _ := syscall.Syscall(procDnsNameCompare_W.Addr(), 2, uintptr(unsafe.Pointer(name1)), uintptr(unsafe.Pointer(name2)), 0) + r0, _, _ := syscall.SyscallN(procDnsNameCompare_W.Addr(), uintptr(unsafe.Pointer(name1)), uintptr(unsafe.Pointer(name2))) same = r0 != 0 return } @@ -1585,7 +1588,7 @@ func DnsQuery(name string, qtype uint16, options uint32, extra *byte, qrs **DNSR } func _DnsQuery(name *uint16, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status error) { - r0, _, _ := syscall.Syscall6(procDnsQuery_W.Addr(), 6, uintptr(unsafe.Pointer(name)), uintptr(qtype), uintptr(options), uintptr(unsafe.Pointer(extra)), uintptr(unsafe.Pointer(qrs)), uintptr(unsafe.Pointer(pr))) + r0, _, _ := syscall.SyscallN(procDnsQuery_W.Addr(), uintptr(unsafe.Pointer(name)), uintptr(qtype), uintptr(options), uintptr(unsafe.Pointer(extra)), uintptr(unsafe.Pointer(qrs)), uintptr(unsafe.Pointer(pr))) if r0 != 0 { status = syscall.Errno(r0) } @@ -1593,12 +1596,12 @@ func _DnsQuery(name *uint16, qtype uint16, options uint32, extra *byte, qrs **DN } func DnsRecordListFree(rl *DNSRecord, freetype uint32) { - syscall.Syscall(procDnsRecordListFree.Addr(), 2, uintptr(unsafe.Pointer(rl)), uintptr(freetype), 0) + syscall.SyscallN(procDnsRecordListFree.Addr(), uintptr(unsafe.Pointer(rl)), uintptr(freetype)) return } func DwmGetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, size uint32) (ret error) { - r0, _, _ := syscall.Syscall6(procDwmGetWindowAttribute.Addr(), 4, uintptr(hwnd), uintptr(attribute), uintptr(value), uintptr(size), 0, 0) + r0, _, _ := syscall.SyscallN(procDwmGetWindowAttribute.Addr(), uintptr(hwnd), uintptr(attribute), uintptr(value), uintptr(size)) if r0 != 0 { ret = syscall.Errno(r0) } @@ -1606,7 +1609,7 @@ func DwmGetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, si } func DwmSetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, size uint32) (ret error) { - r0, _, _ := syscall.Syscall6(procDwmSetWindowAttribute.Addr(), 4, uintptr(hwnd), uintptr(attribute), uintptr(value), uintptr(size), 0, 0) + r0, _, _ := syscall.SyscallN(procDwmSetWindowAttribute.Addr(), uintptr(hwnd), uintptr(attribute), uintptr(value), uintptr(size)) if r0 != 0 { ret = syscall.Errno(r0) } @@ -1614,7 +1617,7 @@ func DwmSetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, si } func CancelMibChangeNotify2(notificationHandle Handle) (errcode error) { - r0, _, _ := syscall.Syscall(procCancelMibChangeNotify2.Addr(), 1, uintptr(notificationHandle), 0, 0) + r0, _, _ := syscall.SyscallN(procCancelMibChangeNotify2.Addr(), uintptr(notificationHandle)) if r0 != 0 { errcode = syscall.Errno(r0) } @@ -1622,7 +1625,7 @@ func CancelMibChangeNotify2(notificationHandle Handle) (errcode error) { } func GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) { - r0, _, _ := syscall.Syscall6(procGetAdaptersAddresses.Addr(), 5, uintptr(family), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(adapterAddresses)), uintptr(unsafe.Pointer(sizePointer)), 0) + r0, _, _ := syscall.SyscallN(procGetAdaptersAddresses.Addr(), uintptr(family), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(adapterAddresses)), uintptr(unsafe.Pointer(sizePointer))) if r0 != 0 { errcode = syscall.Errno(r0) } @@ -1630,7 +1633,7 @@ func GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapter } func GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode error) { - r0, _, _ := syscall.Syscall(procGetAdaptersInfo.Addr(), 2, uintptr(unsafe.Pointer(ai)), uintptr(unsafe.Pointer(ol)), 0) + r0, _, _ := syscall.SyscallN(procGetAdaptersInfo.Addr(), uintptr(unsafe.Pointer(ai)), uintptr(unsafe.Pointer(ol))) if r0 != 0 { errcode = syscall.Errno(r0) } @@ -1638,7 +1641,7 @@ func GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode error) { } func getBestInterfaceEx(sockaddr unsafe.Pointer, pdwBestIfIndex *uint32) (errcode error) { - r0, _, _ := syscall.Syscall(procGetBestInterfaceEx.Addr(), 2, uintptr(sockaddr), uintptr(unsafe.Pointer(pdwBestIfIndex)), 0) + r0, _, _ := syscall.SyscallN(procGetBestInterfaceEx.Addr(), uintptr(sockaddr), uintptr(unsafe.Pointer(pdwBestIfIndex))) if r0 != 0 { errcode = syscall.Errno(r0) } @@ -1646,7 +1649,7 @@ func getBestInterfaceEx(sockaddr unsafe.Pointer, pdwBestIfIndex *uint32) (errcod } func GetIfEntry(pIfRow *MibIfRow) (errcode error) { - r0, _, _ := syscall.Syscall(procGetIfEntry.Addr(), 1, uintptr(unsafe.Pointer(pIfRow)), 0, 0) + r0, _, _ := syscall.SyscallN(procGetIfEntry.Addr(), uintptr(unsafe.Pointer(pIfRow))) if r0 != 0 { errcode = syscall.Errno(r0) } @@ -1654,7 +1657,7 @@ func GetIfEntry(pIfRow *MibIfRow) (errcode error) { } func GetIfEntry2Ex(level uint32, row *MibIfRow2) (errcode error) { - r0, _, _ := syscall.Syscall(procGetIfEntry2Ex.Addr(), 2, uintptr(level), uintptr(unsafe.Pointer(row)), 0) + r0, _, _ := syscall.SyscallN(procGetIfEntry2Ex.Addr(), uintptr(level), uintptr(unsafe.Pointer(row))) if r0 != 0 { errcode = syscall.Errno(r0) } @@ -1662,7 +1665,7 @@ func GetIfEntry2Ex(level uint32, row *MibIfRow2) (errcode error) { } func GetUnicastIpAddressEntry(row *MibUnicastIpAddressRow) (errcode error) { - r0, _, _ := syscall.Syscall(procGetUnicastIpAddressEntry.Addr(), 1, uintptr(unsafe.Pointer(row)), 0, 0) + r0, _, _ := syscall.SyscallN(procGetUnicastIpAddressEntry.Addr(), uintptr(unsafe.Pointer(row))) if r0 != 0 { errcode = syscall.Errno(r0) } @@ -1674,7 +1677,7 @@ func NotifyIpInterfaceChange(family uint16, callback uintptr, callerContext unsa if initialNotification { _p0 = 1 } - r0, _, _ := syscall.Syscall6(procNotifyIpInterfaceChange.Addr(), 5, uintptr(family), uintptr(callback), uintptr(callerContext), uintptr(_p0), uintptr(unsafe.Pointer(notificationHandle)), 0) + r0, _, _ := syscall.SyscallN(procNotifyIpInterfaceChange.Addr(), uintptr(family), uintptr(callback), uintptr(callerContext), uintptr(_p0), uintptr(unsafe.Pointer(notificationHandle))) if r0 != 0 { errcode = syscall.Errno(r0) } @@ -1686,7 +1689,7 @@ func NotifyUnicastIpAddressChange(family uint16, callback uintptr, callerContext if initialNotification { _p0 = 1 } - r0, _, _ := syscall.Syscall6(procNotifyUnicastIpAddressChange.Addr(), 5, uintptr(family), uintptr(callback), uintptr(callerContext), uintptr(_p0), uintptr(unsafe.Pointer(notificationHandle)), 0) + r0, _, _ := syscall.SyscallN(procNotifyUnicastIpAddressChange.Addr(), uintptr(family), uintptr(callback), uintptr(callerContext), uintptr(_p0), uintptr(unsafe.Pointer(notificationHandle))) if r0 != 0 { errcode = syscall.Errno(r0) } @@ -1694,7 +1697,7 @@ func NotifyUnicastIpAddressChange(family uint16, callback uintptr, callerContext } func AddDllDirectory(path *uint16) (cookie uintptr, err error) { - r0, _, e1 := syscall.Syscall(procAddDllDirectory.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) + r0, _, e1 := syscall.SyscallN(procAddDllDirectory.Addr(), uintptr(unsafe.Pointer(path))) cookie = uintptr(r0) if cookie == 0 { err = errnoErr(e1) @@ -1703,7 +1706,7 @@ func AddDllDirectory(path *uint16) (cookie uintptr, err error) { } func AssignProcessToJobObject(job Handle, process Handle) (err error) { - r1, _, e1 := syscall.Syscall(procAssignProcessToJobObject.Addr(), 2, uintptr(job), uintptr(process), 0) + r1, _, e1 := syscall.SyscallN(procAssignProcessToJobObject.Addr(), uintptr(job), uintptr(process)) if r1 == 0 { err = errnoErr(e1) } @@ -1711,7 +1714,7 @@ func AssignProcessToJobObject(job Handle, process Handle) (err error) { } func CancelIo(s Handle) (err error) { - r1, _, e1 := syscall.Syscall(procCancelIo.Addr(), 1, uintptr(s), 0, 0) + r1, _, e1 := syscall.SyscallN(procCancelIo.Addr(), uintptr(s)) if r1 == 0 { err = errnoErr(e1) } @@ -1719,7 +1722,7 @@ func CancelIo(s Handle) (err error) { } func CancelIoEx(s Handle, o *Overlapped) (err error) { - r1, _, e1 := syscall.Syscall(procCancelIoEx.Addr(), 2, uintptr(s), uintptr(unsafe.Pointer(o)), 0) + r1, _, e1 := syscall.SyscallN(procCancelIoEx.Addr(), uintptr(s), uintptr(unsafe.Pointer(o))) if r1 == 0 { err = errnoErr(e1) } @@ -1727,7 +1730,7 @@ func CancelIoEx(s Handle, o *Overlapped) (err error) { } func ClearCommBreak(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procClearCommBreak.Addr(), 1, uintptr(handle), 0, 0) + r1, _, e1 := syscall.SyscallN(procClearCommBreak.Addr(), uintptr(handle)) if r1 == 0 { err = errnoErr(e1) } @@ -1735,7 +1738,7 @@ func ClearCommBreak(handle Handle) (err error) { } func ClearCommError(handle Handle, lpErrors *uint32, lpStat *ComStat) (err error) { - r1, _, e1 := syscall.Syscall(procClearCommError.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(lpErrors)), uintptr(unsafe.Pointer(lpStat))) + r1, _, e1 := syscall.SyscallN(procClearCommError.Addr(), uintptr(handle), uintptr(unsafe.Pointer(lpErrors)), uintptr(unsafe.Pointer(lpStat))) if r1 == 0 { err = errnoErr(e1) } @@ -1743,7 +1746,7 @@ func ClearCommError(handle Handle, lpErrors *uint32, lpStat *ComStat) (err error } func CloseHandle(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procCloseHandle.Addr(), 1, uintptr(handle), 0, 0) + r1, _, e1 := syscall.SyscallN(procCloseHandle.Addr(), uintptr(handle)) if r1 == 0 { err = errnoErr(e1) } @@ -1751,12 +1754,12 @@ func CloseHandle(handle Handle) (err error) { } func ClosePseudoConsole(console Handle) { - syscall.Syscall(procClosePseudoConsole.Addr(), 1, uintptr(console), 0, 0) + syscall.SyscallN(procClosePseudoConsole.Addr(), uintptr(console)) return } func ConnectNamedPipe(pipe Handle, overlapped *Overlapped) (err error) { - r1, _, e1 := syscall.Syscall(procConnectNamedPipe.Addr(), 2, uintptr(pipe), uintptr(unsafe.Pointer(overlapped)), 0) + r1, _, e1 := syscall.SyscallN(procConnectNamedPipe.Addr(), uintptr(pipe), uintptr(unsafe.Pointer(overlapped))) if r1 == 0 { err = errnoErr(e1) } @@ -1764,7 +1767,7 @@ func ConnectNamedPipe(pipe Handle, overlapped *Overlapped) (err error) { } func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) { - r1, _, e1 := syscall.Syscall(procCreateDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(sa)), 0) + r1, _, e1 := syscall.SyscallN(procCreateDirectoryW.Addr(), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(sa))) if r1 == 0 { err = errnoErr(e1) } @@ -1772,7 +1775,7 @@ func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) { } func CreateEventEx(eventAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall6(procCreateEventExW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess), 0, 0) + r0, _, e1 := syscall.SyscallN(procCreateEventExW.Addr(), uintptr(unsafe.Pointer(eventAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess)) handle = Handle(r0) if handle == 0 || e1 == ERROR_ALREADY_EXISTS { err = errnoErr(e1) @@ -1781,7 +1784,7 @@ func CreateEventEx(eventAttrs *SecurityAttributes, name *uint16, flags uint32, d } func CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialState uint32, name *uint16) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall6(procCreateEventW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(manualReset), uintptr(initialState), uintptr(unsafe.Pointer(name)), 0, 0) + r0, _, e1 := syscall.SyscallN(procCreateEventW.Addr(), uintptr(unsafe.Pointer(eventAttrs)), uintptr(manualReset), uintptr(initialState), uintptr(unsafe.Pointer(name))) handle = Handle(r0) if handle == 0 || e1 == ERROR_ALREADY_EXISTS { err = errnoErr(e1) @@ -1790,7 +1793,7 @@ func CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialStat } func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall6(procCreateFileMappingW.Addr(), 6, uintptr(fhandle), uintptr(unsafe.Pointer(sa)), uintptr(prot), uintptr(maxSizeHigh), uintptr(maxSizeLow), uintptr(unsafe.Pointer(name))) + r0, _, e1 := syscall.SyscallN(procCreateFileMappingW.Addr(), uintptr(fhandle), uintptr(unsafe.Pointer(sa)), uintptr(prot), uintptr(maxSizeHigh), uintptr(maxSizeLow), uintptr(unsafe.Pointer(name))) handle = Handle(r0) if handle == 0 || e1 == ERROR_ALREADY_EXISTS { err = errnoErr(e1) @@ -1799,7 +1802,7 @@ func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxS } func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall9(procCreateFileW.Addr(), 7, uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile), 0, 0) + r0, _, e1 := syscall.SyscallN(procCreateFileW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile)) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -1808,7 +1811,7 @@ func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes } func CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr) (err error) { - r1, _, e1 := syscall.Syscall(procCreateHardLinkW.Addr(), 3, uintptr(unsafe.Pointer(filename)), uintptr(unsafe.Pointer(existingfilename)), uintptr(reserved)) + r1, _, e1 := syscall.SyscallN(procCreateHardLinkW.Addr(), uintptr(unsafe.Pointer(filename)), uintptr(unsafe.Pointer(existingfilename)), uintptr(reserved)) if r1&0xff == 0 { err = errnoErr(e1) } @@ -1816,7 +1819,7 @@ func CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr } func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uintptr, threadcnt uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall6(procCreateIoCompletionPort.Addr(), 4, uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt), 0, 0) + r0, _, e1 := syscall.SyscallN(procCreateIoCompletionPort.Addr(), uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt)) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -1825,7 +1828,7 @@ func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uintptr, thr } func CreateJobObject(jobAttr *SecurityAttributes, name *uint16) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procCreateJobObjectW.Addr(), 2, uintptr(unsafe.Pointer(jobAttr)), uintptr(unsafe.Pointer(name)), 0) + r0, _, e1 := syscall.SyscallN(procCreateJobObjectW.Addr(), uintptr(unsafe.Pointer(jobAttr)), uintptr(unsafe.Pointer(name))) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -1834,7 +1837,7 @@ func CreateJobObject(jobAttr *SecurityAttributes, name *uint16) (handle Handle, } func CreateMutexEx(mutexAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall6(procCreateMutexExW.Addr(), 4, uintptr(unsafe.Pointer(mutexAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess), 0, 0) + r0, _, e1 := syscall.SyscallN(procCreateMutexExW.Addr(), uintptr(unsafe.Pointer(mutexAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess)) handle = Handle(r0) if handle == 0 || e1 == ERROR_ALREADY_EXISTS { err = errnoErr(e1) @@ -1847,7 +1850,7 @@ func CreateMutex(mutexAttrs *SecurityAttributes, initialOwner bool, name *uint16 if initialOwner { _p0 = 1 } - r0, _, e1 := syscall.Syscall(procCreateMutexW.Addr(), 3, uintptr(unsafe.Pointer(mutexAttrs)), uintptr(_p0), uintptr(unsafe.Pointer(name))) + r0, _, e1 := syscall.SyscallN(procCreateMutexW.Addr(), uintptr(unsafe.Pointer(mutexAttrs)), uintptr(_p0), uintptr(unsafe.Pointer(name))) handle = Handle(r0) if handle == 0 || e1 == ERROR_ALREADY_EXISTS { err = errnoErr(e1) @@ -1856,7 +1859,7 @@ func CreateMutex(mutexAttrs *SecurityAttributes, initialOwner bool, name *uint16 } func CreateNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *SecurityAttributes) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall9(procCreateNamedPipeW.Addr(), 8, uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(pipeMode), uintptr(maxInstances), uintptr(outSize), uintptr(inSize), uintptr(defaultTimeout), uintptr(unsafe.Pointer(sa)), 0) + r0, _, e1 := syscall.SyscallN(procCreateNamedPipeW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(pipeMode), uintptr(maxInstances), uintptr(outSize), uintptr(inSize), uintptr(defaultTimeout), uintptr(unsafe.Pointer(sa))) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -1865,7 +1868,7 @@ func CreateNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances u } func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procCreatePipe.Addr(), 4, uintptr(unsafe.Pointer(readhandle)), uintptr(unsafe.Pointer(writehandle)), uintptr(unsafe.Pointer(sa)), uintptr(size), 0, 0) + r1, _, e1 := syscall.SyscallN(procCreatePipe.Addr(), uintptr(unsafe.Pointer(readhandle)), uintptr(unsafe.Pointer(writehandle)), uintptr(unsafe.Pointer(sa)), uintptr(size)) if r1 == 0 { err = errnoErr(e1) } @@ -1877,7 +1880,7 @@ func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityA if inheritHandles { _p0 = 1 } - r1, _, e1 := syscall.Syscall12(procCreateProcessW.Addr(), 10, uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo)), 0, 0) + r1, _, e1 := syscall.SyscallN(procCreateProcessW.Addr(), uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo))) if r1 == 0 { err = errnoErr(e1) } @@ -1885,7 +1888,7 @@ func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityA } func createPseudoConsole(size uint32, in Handle, out Handle, flags uint32, pconsole *Handle) (hr error) { - r0, _, _ := syscall.Syscall6(procCreatePseudoConsole.Addr(), 5, uintptr(size), uintptr(in), uintptr(out), uintptr(flags), uintptr(unsafe.Pointer(pconsole)), 0) + r0, _, _ := syscall.SyscallN(procCreatePseudoConsole.Addr(), uintptr(size), uintptr(in), uintptr(out), uintptr(flags), uintptr(unsafe.Pointer(pconsole))) if r0 != 0 { hr = syscall.Errno(r0) } @@ -1893,7 +1896,7 @@ func createPseudoConsole(size uint32, in Handle, out Handle, flags uint32, pcons } func CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall(procCreateSymbolicLinkW.Addr(), 3, uintptr(unsafe.Pointer(symlinkfilename)), uintptr(unsafe.Pointer(targetfilename)), uintptr(flags)) + r1, _, e1 := syscall.SyscallN(procCreateSymbolicLinkW.Addr(), uintptr(unsafe.Pointer(symlinkfilename)), uintptr(unsafe.Pointer(targetfilename)), uintptr(flags)) if r1&0xff == 0 { err = errnoErr(e1) } @@ -1901,7 +1904,7 @@ func CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags u } func CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procCreateToolhelp32Snapshot.Addr(), 2, uintptr(flags), uintptr(processId), 0) + r0, _, e1 := syscall.SyscallN(procCreateToolhelp32Snapshot.Addr(), uintptr(flags), uintptr(processId)) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -1910,7 +1913,7 @@ func CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, er } func DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procDefineDosDeviceW.Addr(), 3, uintptr(flags), uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath))) + r1, _, e1 := syscall.SyscallN(procDefineDosDeviceW.Addr(), uintptr(flags), uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath))) if r1 == 0 { err = errnoErr(e1) } @@ -1918,7 +1921,7 @@ func DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err } func DeleteFile(path *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procDeleteFileW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) + r1, _, e1 := syscall.SyscallN(procDeleteFileW.Addr(), uintptr(unsafe.Pointer(path))) if r1 == 0 { err = errnoErr(e1) } @@ -1926,12 +1929,12 @@ func DeleteFile(path *uint16) (err error) { } func deleteProcThreadAttributeList(attrlist *ProcThreadAttributeList) { - syscall.Syscall(procDeleteProcThreadAttributeList.Addr(), 1, uintptr(unsafe.Pointer(attrlist)), 0, 0) + syscall.SyscallN(procDeleteProcThreadAttributeList.Addr(), uintptr(unsafe.Pointer(attrlist))) return } func DeleteVolumeMountPoint(volumeMountPoint *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procDeleteVolumeMountPointW.Addr(), 1, uintptr(unsafe.Pointer(volumeMountPoint)), 0, 0) + r1, _, e1 := syscall.SyscallN(procDeleteVolumeMountPointW.Addr(), uintptr(unsafe.Pointer(volumeMountPoint))) if r1 == 0 { err = errnoErr(e1) } @@ -1939,7 +1942,7 @@ func DeleteVolumeMountPoint(volumeMountPoint *uint16) (err error) { } func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBufferSize uint32, outBuffer *byte, outBufferSize uint32, bytesReturned *uint32, overlapped *Overlapped) (err error) { - r1, _, e1 := syscall.Syscall9(procDeviceIoControl.Addr(), 8, uintptr(handle), uintptr(ioControlCode), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferSize), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferSize), uintptr(unsafe.Pointer(bytesReturned)), uintptr(unsafe.Pointer(overlapped)), 0) + r1, _, e1 := syscall.SyscallN(procDeviceIoControl.Addr(), uintptr(handle), uintptr(ioControlCode), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferSize), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferSize), uintptr(unsafe.Pointer(bytesReturned)), uintptr(unsafe.Pointer(overlapped))) if r1 == 0 { err = errnoErr(e1) } @@ -1947,7 +1950,7 @@ func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBuff } func DisconnectNamedPipe(pipe Handle) (err error) { - r1, _, e1 := syscall.Syscall(procDisconnectNamedPipe.Addr(), 1, uintptr(pipe), 0, 0) + r1, _, e1 := syscall.SyscallN(procDisconnectNamedPipe.Addr(), uintptr(pipe)) if r1 == 0 { err = errnoErr(e1) } @@ -1959,7 +1962,7 @@ func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetP if bInheritHandle { _p0 = 1 } - r1, _, e1 := syscall.Syscall9(procDuplicateHandle.Addr(), 7, uintptr(hSourceProcessHandle), uintptr(hSourceHandle), uintptr(hTargetProcessHandle), uintptr(unsafe.Pointer(lpTargetHandle)), uintptr(dwDesiredAccess), uintptr(_p0), uintptr(dwOptions), 0, 0) + r1, _, e1 := syscall.SyscallN(procDuplicateHandle.Addr(), uintptr(hSourceProcessHandle), uintptr(hSourceHandle), uintptr(hTargetProcessHandle), uintptr(unsafe.Pointer(lpTargetHandle)), uintptr(dwDesiredAccess), uintptr(_p0), uintptr(dwOptions)) if r1 == 0 { err = errnoErr(e1) } @@ -1967,7 +1970,7 @@ func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetP } func EscapeCommFunction(handle Handle, dwFunc uint32) (err error) { - r1, _, e1 := syscall.Syscall(procEscapeCommFunction.Addr(), 2, uintptr(handle), uintptr(dwFunc), 0) + r1, _, e1 := syscall.SyscallN(procEscapeCommFunction.Addr(), uintptr(handle), uintptr(dwFunc)) if r1 == 0 { err = errnoErr(e1) } @@ -1975,12 +1978,12 @@ func EscapeCommFunction(handle Handle, dwFunc uint32) (err error) { } func ExitProcess(exitcode uint32) { - syscall.Syscall(procExitProcess.Addr(), 1, uintptr(exitcode), 0, 0) + syscall.SyscallN(procExitProcess.Addr(), uintptr(exitcode)) return } func ExpandEnvironmentStrings(src *uint16, dst *uint16, size uint32) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procExpandEnvironmentStringsW.Addr(), 3, uintptr(unsafe.Pointer(src)), uintptr(unsafe.Pointer(dst)), uintptr(size)) + r0, _, e1 := syscall.SyscallN(procExpandEnvironmentStringsW.Addr(), uintptr(unsafe.Pointer(src)), uintptr(unsafe.Pointer(dst)), uintptr(size)) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -1989,7 +1992,7 @@ func ExpandEnvironmentStrings(src *uint16, dst *uint16, size uint32) (n uint32, } func FindClose(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procFindClose.Addr(), 1, uintptr(handle), 0, 0) + r1, _, e1 := syscall.SyscallN(procFindClose.Addr(), uintptr(handle)) if r1 == 0 { err = errnoErr(e1) } @@ -1997,7 +2000,7 @@ func FindClose(handle Handle) (err error) { } func FindCloseChangeNotification(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procFindCloseChangeNotification.Addr(), 1, uintptr(handle), 0, 0) + r1, _, e1 := syscall.SyscallN(procFindCloseChangeNotification.Addr(), uintptr(handle)) if r1 == 0 { err = errnoErr(e1) } @@ -2018,7 +2021,7 @@ func _FindFirstChangeNotification(path *uint16, watchSubtree bool, notifyFilter if watchSubtree { _p1 = 1 } - r0, _, e1 := syscall.Syscall(procFindFirstChangeNotificationW.Addr(), 3, uintptr(unsafe.Pointer(path)), uintptr(_p1), uintptr(notifyFilter)) + r0, _, e1 := syscall.SyscallN(procFindFirstChangeNotificationW.Addr(), uintptr(unsafe.Pointer(path)), uintptr(_p1), uintptr(notifyFilter)) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -2027,7 +2030,7 @@ func _FindFirstChangeNotification(path *uint16, watchSubtree bool, notifyFilter } func findFirstFile1(name *uint16, data *win32finddata1) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procFindFirstFileW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(data)), 0) + r0, _, e1 := syscall.SyscallN(procFindFirstFileW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(data))) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -2036,7 +2039,7 @@ func findFirstFile1(name *uint16, data *win32finddata1) (handle Handle, err erro } func FindFirstVolumeMountPoint(rootPathName *uint16, volumeMountPoint *uint16, bufferLength uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procFindFirstVolumeMountPointW.Addr(), 3, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength)) + r0, _, e1 := syscall.SyscallN(procFindFirstVolumeMountPointW.Addr(), uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength)) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -2045,7 +2048,7 @@ func FindFirstVolumeMountPoint(rootPathName *uint16, volumeMountPoint *uint16, b } func FindFirstVolume(volumeName *uint16, bufferLength uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procFindFirstVolumeW.Addr(), 2, uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength), 0) + r0, _, e1 := syscall.SyscallN(procFindFirstVolumeW.Addr(), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength)) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -2054,7 +2057,7 @@ func FindFirstVolume(volumeName *uint16, bufferLength uint32) (handle Handle, er } func FindNextChangeNotification(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procFindNextChangeNotification.Addr(), 1, uintptr(handle), 0, 0) + r1, _, e1 := syscall.SyscallN(procFindNextChangeNotification.Addr(), uintptr(handle)) if r1 == 0 { err = errnoErr(e1) } @@ -2062,7 +2065,7 @@ func FindNextChangeNotification(handle Handle) (err error) { } func findNextFile1(handle Handle, data *win32finddata1) (err error) { - r1, _, e1 := syscall.Syscall(procFindNextFileW.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0) + r1, _, e1 := syscall.SyscallN(procFindNextFileW.Addr(), uintptr(handle), uintptr(unsafe.Pointer(data))) if r1 == 0 { err = errnoErr(e1) } @@ -2070,7 +2073,7 @@ func findNextFile1(handle Handle, data *win32finddata1) (err error) { } func FindNextVolumeMountPoint(findVolumeMountPoint Handle, volumeMountPoint *uint16, bufferLength uint32) (err error) { - r1, _, e1 := syscall.Syscall(procFindNextVolumeMountPointW.Addr(), 3, uintptr(findVolumeMountPoint), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength)) + r1, _, e1 := syscall.SyscallN(procFindNextVolumeMountPointW.Addr(), uintptr(findVolumeMountPoint), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength)) if r1 == 0 { err = errnoErr(e1) } @@ -2078,7 +2081,7 @@ func FindNextVolumeMountPoint(findVolumeMountPoint Handle, volumeMountPoint *uin } func FindNextVolume(findVolume Handle, volumeName *uint16, bufferLength uint32) (err error) { - r1, _, e1 := syscall.Syscall(procFindNextVolumeW.Addr(), 3, uintptr(findVolume), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength)) + r1, _, e1 := syscall.SyscallN(procFindNextVolumeW.Addr(), uintptr(findVolume), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength)) if r1 == 0 { err = errnoErr(e1) } @@ -2086,7 +2089,7 @@ func FindNextVolume(findVolume Handle, volumeName *uint16, bufferLength uint32) } func findResource(module Handle, name uintptr, resType uintptr) (resInfo Handle, err error) { - r0, _, e1 := syscall.Syscall(procFindResourceW.Addr(), 3, uintptr(module), uintptr(name), uintptr(resType)) + r0, _, e1 := syscall.SyscallN(procFindResourceW.Addr(), uintptr(module), uintptr(name), uintptr(resType)) resInfo = Handle(r0) if resInfo == 0 { err = errnoErr(e1) @@ -2095,7 +2098,7 @@ func findResource(module Handle, name uintptr, resType uintptr) (resInfo Handle, } func FindVolumeClose(findVolume Handle) (err error) { - r1, _, e1 := syscall.Syscall(procFindVolumeClose.Addr(), 1, uintptr(findVolume), 0, 0) + r1, _, e1 := syscall.SyscallN(procFindVolumeClose.Addr(), uintptr(findVolume)) if r1 == 0 { err = errnoErr(e1) } @@ -2103,7 +2106,15 @@ func FindVolumeClose(findVolume Handle) (err error) { } func FindVolumeMountPointClose(findVolumeMountPoint Handle) (err error) { - r1, _, e1 := syscall.Syscall(procFindVolumeMountPointClose.Addr(), 1, uintptr(findVolumeMountPoint), 0, 0) + r1, _, e1 := syscall.SyscallN(procFindVolumeMountPointClose.Addr(), uintptr(findVolumeMountPoint)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func FlushConsoleInputBuffer(console Handle) (err error) { + r1, _, e1 := syscall.SyscallN(procFlushConsoleInputBuffer.Addr(), uintptr(console)) if r1 == 0 { err = errnoErr(e1) } @@ -2111,7 +2122,7 @@ func FindVolumeMountPointClose(findVolumeMountPoint Handle) (err error) { } func FlushFileBuffers(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procFlushFileBuffers.Addr(), 1, uintptr(handle), 0, 0) + r1, _, e1 := syscall.SyscallN(procFlushFileBuffers.Addr(), uintptr(handle)) if r1 == 0 { err = errnoErr(e1) } @@ -2119,7 +2130,7 @@ func FlushFileBuffers(handle Handle) (err error) { } func FlushViewOfFile(addr uintptr, length uintptr) (err error) { - r1, _, e1 := syscall.Syscall(procFlushViewOfFile.Addr(), 2, uintptr(addr), uintptr(length), 0) + r1, _, e1 := syscall.SyscallN(procFlushViewOfFile.Addr(), uintptr(addr), uintptr(length)) if r1 == 0 { err = errnoErr(e1) } @@ -2131,7 +2142,7 @@ func FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, bu if len(buf) > 0 { _p0 = &buf[0] } - r0, _, e1 := syscall.Syscall9(procFormatMessageW.Addr(), 7, uintptr(flags), uintptr(msgsrc), uintptr(msgid), uintptr(langid), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(args)), 0, 0) + r0, _, e1 := syscall.SyscallN(procFormatMessageW.Addr(), uintptr(flags), uintptr(msgsrc), uintptr(msgid), uintptr(langid), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(args))) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2140,7 +2151,7 @@ func FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, bu } func FreeEnvironmentStrings(envs *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procFreeEnvironmentStringsW.Addr(), 1, uintptr(unsafe.Pointer(envs)), 0, 0) + r1, _, e1 := syscall.SyscallN(procFreeEnvironmentStringsW.Addr(), uintptr(unsafe.Pointer(envs))) if r1 == 0 { err = errnoErr(e1) } @@ -2148,7 +2159,7 @@ func FreeEnvironmentStrings(envs *uint16) (err error) { } func FreeLibrary(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procFreeLibrary.Addr(), 1, uintptr(handle), 0, 0) + r1, _, e1 := syscall.SyscallN(procFreeLibrary.Addr(), uintptr(handle)) if r1 == 0 { err = errnoErr(e1) } @@ -2156,7 +2167,7 @@ func FreeLibrary(handle Handle) (err error) { } func GenerateConsoleCtrlEvent(ctrlEvent uint32, processGroupID uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGenerateConsoleCtrlEvent.Addr(), 2, uintptr(ctrlEvent), uintptr(processGroupID), 0) + r1, _, e1 := syscall.SyscallN(procGenerateConsoleCtrlEvent.Addr(), uintptr(ctrlEvent), uintptr(processGroupID)) if r1 == 0 { err = errnoErr(e1) } @@ -2164,19 +2175,19 @@ func GenerateConsoleCtrlEvent(ctrlEvent uint32, processGroupID uint32) (err erro } func GetACP() (acp uint32) { - r0, _, _ := syscall.Syscall(procGetACP.Addr(), 0, 0, 0, 0) + r0, _, _ := syscall.SyscallN(procGetACP.Addr()) acp = uint32(r0) return } func GetActiveProcessorCount(groupNumber uint16) (ret uint32) { - r0, _, _ := syscall.Syscall(procGetActiveProcessorCount.Addr(), 1, uintptr(groupNumber), 0, 0) + r0, _, _ := syscall.SyscallN(procGetActiveProcessorCount.Addr(), uintptr(groupNumber)) ret = uint32(r0) return } func GetCommModemStatus(handle Handle, lpModemStat *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetCommModemStatus.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(lpModemStat)), 0) + r1, _, e1 := syscall.SyscallN(procGetCommModemStatus.Addr(), uintptr(handle), uintptr(unsafe.Pointer(lpModemStat))) if r1 == 0 { err = errnoErr(e1) } @@ -2184,7 +2195,7 @@ func GetCommModemStatus(handle Handle, lpModemStat *uint32) (err error) { } func GetCommState(handle Handle, lpDCB *DCB) (err error) { - r1, _, e1 := syscall.Syscall(procGetCommState.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(lpDCB)), 0) + r1, _, e1 := syscall.SyscallN(procGetCommState.Addr(), uintptr(handle), uintptr(unsafe.Pointer(lpDCB))) if r1 == 0 { err = errnoErr(e1) } @@ -2192,7 +2203,7 @@ func GetCommState(handle Handle, lpDCB *DCB) (err error) { } func GetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) { - r1, _, e1 := syscall.Syscall(procGetCommTimeouts.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(timeouts)), 0) + r1, _, e1 := syscall.SyscallN(procGetCommTimeouts.Addr(), uintptr(handle), uintptr(unsafe.Pointer(timeouts))) if r1 == 0 { err = errnoErr(e1) } @@ -2200,13 +2211,13 @@ func GetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) { } func GetCommandLine() (cmd *uint16) { - r0, _, _ := syscall.Syscall(procGetCommandLineW.Addr(), 0, 0, 0, 0) + r0, _, _ := syscall.SyscallN(procGetCommandLineW.Addr()) cmd = (*uint16)(unsafe.Pointer(r0)) return } func GetComputerNameEx(nametype uint32, buf *uint16, n *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetComputerNameExW.Addr(), 3, uintptr(nametype), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n))) + r1, _, e1 := syscall.SyscallN(procGetComputerNameExW.Addr(), uintptr(nametype), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n))) if r1 == 0 { err = errnoErr(e1) } @@ -2214,7 +2225,7 @@ func GetComputerNameEx(nametype uint32, buf *uint16, n *uint32) (err error) { } func GetComputerName(buf *uint16, n *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetComputerNameW.Addr(), 2, uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n)), 0) + r1, _, e1 := syscall.SyscallN(procGetComputerNameW.Addr(), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n))) if r1 == 0 { err = errnoErr(e1) } @@ -2222,7 +2233,7 @@ func GetComputerName(buf *uint16, n *uint32) (err error) { } func GetConsoleCP() (cp uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetConsoleCP.Addr(), 0, 0, 0, 0) + r0, _, e1 := syscall.SyscallN(procGetConsoleCP.Addr()) cp = uint32(r0) if cp == 0 { err = errnoErr(e1) @@ -2231,7 +2242,7 @@ func GetConsoleCP() (cp uint32, err error) { } func GetConsoleMode(console Handle, mode *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(mode)), 0) + r1, _, e1 := syscall.SyscallN(procGetConsoleMode.Addr(), uintptr(console), uintptr(unsafe.Pointer(mode))) if r1 == 0 { err = errnoErr(e1) } @@ -2239,7 +2250,7 @@ func GetConsoleMode(console Handle, mode *uint32) (err error) { } func GetConsoleOutputCP() (cp uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetConsoleOutputCP.Addr(), 0, 0, 0, 0) + r0, _, e1 := syscall.SyscallN(procGetConsoleOutputCP.Addr()) cp = uint32(r0) if cp == 0 { err = errnoErr(e1) @@ -2248,7 +2259,7 @@ func GetConsoleOutputCP() (cp uint32, err error) { } func GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) { - r1, _, e1 := syscall.Syscall(procGetConsoleScreenBufferInfo.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(info)), 0) + r1, _, e1 := syscall.SyscallN(procGetConsoleScreenBufferInfo.Addr(), uintptr(console), uintptr(unsafe.Pointer(info))) if r1 == 0 { err = errnoErr(e1) } @@ -2256,7 +2267,7 @@ func GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) ( } func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetCurrentDirectoryW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0) + r0, _, e1 := syscall.SyscallN(procGetCurrentDirectoryW.Addr(), uintptr(buflen), uintptr(unsafe.Pointer(buf))) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2265,19 +2276,19 @@ func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) { } func GetCurrentProcessId() (pid uint32) { - r0, _, _ := syscall.Syscall(procGetCurrentProcessId.Addr(), 0, 0, 0, 0) + r0, _, _ := syscall.SyscallN(procGetCurrentProcessId.Addr()) pid = uint32(r0) return } func GetCurrentThreadId() (id uint32) { - r0, _, _ := syscall.Syscall(procGetCurrentThreadId.Addr(), 0, 0, 0, 0) + r0, _, _ := syscall.SyscallN(procGetCurrentThreadId.Addr()) id = uint32(r0) return } func GetDiskFreeSpaceEx(directoryName *uint16, freeBytesAvailableToCaller *uint64, totalNumberOfBytes *uint64, totalNumberOfFreeBytes *uint64) (err error) { - r1, _, e1 := syscall.Syscall6(procGetDiskFreeSpaceExW.Addr(), 4, uintptr(unsafe.Pointer(directoryName)), uintptr(unsafe.Pointer(freeBytesAvailableToCaller)), uintptr(unsafe.Pointer(totalNumberOfBytes)), uintptr(unsafe.Pointer(totalNumberOfFreeBytes)), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetDiskFreeSpaceExW.Addr(), uintptr(unsafe.Pointer(directoryName)), uintptr(unsafe.Pointer(freeBytesAvailableToCaller)), uintptr(unsafe.Pointer(totalNumberOfBytes)), uintptr(unsafe.Pointer(totalNumberOfFreeBytes))) if r1 == 0 { err = errnoErr(e1) } @@ -2285,13 +2296,13 @@ func GetDiskFreeSpaceEx(directoryName *uint16, freeBytesAvailableToCaller *uint6 } func GetDriveType(rootPathName *uint16) (driveType uint32) { - r0, _, _ := syscall.Syscall(procGetDriveTypeW.Addr(), 1, uintptr(unsafe.Pointer(rootPathName)), 0, 0) + r0, _, _ := syscall.SyscallN(procGetDriveTypeW.Addr(), uintptr(unsafe.Pointer(rootPathName))) driveType = uint32(r0) return } func GetEnvironmentStrings() (envs *uint16, err error) { - r0, _, e1 := syscall.Syscall(procGetEnvironmentStringsW.Addr(), 0, 0, 0, 0) + r0, _, e1 := syscall.SyscallN(procGetEnvironmentStringsW.Addr()) envs = (*uint16)(unsafe.Pointer(r0)) if envs == nil { err = errnoErr(e1) @@ -2300,7 +2311,7 @@ func GetEnvironmentStrings() (envs *uint16, err error) { } func GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetEnvironmentVariableW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buffer)), uintptr(size)) + r0, _, e1 := syscall.SyscallN(procGetEnvironmentVariableW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buffer)), uintptr(size)) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2309,7 +2320,7 @@ func GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32 } func GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetExitCodeProcess.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(exitcode)), 0) + r1, _, e1 := syscall.SyscallN(procGetExitCodeProcess.Addr(), uintptr(handle), uintptr(unsafe.Pointer(exitcode))) if r1 == 0 { err = errnoErr(e1) } @@ -2317,7 +2328,7 @@ func GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) { } func GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) { - r1, _, e1 := syscall.Syscall(procGetFileAttributesExW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(level), uintptr(unsafe.Pointer(info))) + r1, _, e1 := syscall.SyscallN(procGetFileAttributesExW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(level), uintptr(unsafe.Pointer(info))) if r1 == 0 { err = errnoErr(e1) } @@ -2325,7 +2336,7 @@ func GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) { } func GetFileAttributes(name *uint16) (attrs uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetFileAttributesW.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0) + r0, _, e1 := syscall.SyscallN(procGetFileAttributesW.Addr(), uintptr(unsafe.Pointer(name))) attrs = uint32(r0) if attrs == INVALID_FILE_ATTRIBUTES { err = errnoErr(e1) @@ -2334,7 +2345,7 @@ func GetFileAttributes(name *uint16) (attrs uint32, err error) { } func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (err error) { - r1, _, e1 := syscall.Syscall(procGetFileInformationByHandle.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0) + r1, _, e1 := syscall.SyscallN(procGetFileInformationByHandle.Addr(), uintptr(handle), uintptr(unsafe.Pointer(data))) if r1 == 0 { err = errnoErr(e1) } @@ -2342,7 +2353,7 @@ func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (e } func GetFileInformationByHandleEx(handle Handle, class uint32, outBuffer *byte, outBufferLen uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetFileInformationByHandleEx.Addr(), 4, uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferLen), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetFileInformationByHandleEx.Addr(), uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferLen)) if r1 == 0 { err = errnoErr(e1) } @@ -2350,7 +2361,7 @@ func GetFileInformationByHandleEx(handle Handle, class uint32, outBuffer *byte, } func GetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) { - r1, _, e1 := syscall.Syscall6(procGetFileTime.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetFileTime.Addr(), uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime))) if r1 == 0 { err = errnoErr(e1) } @@ -2358,7 +2369,7 @@ func GetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetim } func GetFileType(filehandle Handle) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetFileType.Addr(), 1, uintptr(filehandle), 0, 0) + r0, _, e1 := syscall.SyscallN(procGetFileType.Addr(), uintptr(filehandle)) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2367,7 +2378,7 @@ func GetFileType(filehandle Handle) (n uint32, err error) { } func GetFinalPathNameByHandle(file Handle, filePath *uint16, filePathSize uint32, flags uint32) (n uint32, err error) { - r0, _, e1 := syscall.Syscall6(procGetFinalPathNameByHandleW.Addr(), 4, uintptr(file), uintptr(unsafe.Pointer(filePath)), uintptr(filePathSize), uintptr(flags), 0, 0) + r0, _, e1 := syscall.SyscallN(procGetFinalPathNameByHandleW.Addr(), uintptr(file), uintptr(unsafe.Pointer(filePath)), uintptr(filePathSize), uintptr(flags)) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2376,7 +2387,7 @@ func GetFinalPathNameByHandle(file Handle, filePath *uint16, filePathSize uint32 } func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) (n uint32, err error) { - r0, _, e1 := syscall.Syscall6(procGetFullPathNameW.Addr(), 4, uintptr(unsafe.Pointer(path)), uintptr(buflen), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(fname)), 0, 0) + r0, _, e1 := syscall.SyscallN(procGetFullPathNameW.Addr(), uintptr(unsafe.Pointer(path)), uintptr(buflen), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(fname))) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2385,13 +2396,13 @@ func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) ( } func GetLargePageMinimum() (size uintptr) { - r0, _, _ := syscall.Syscall(procGetLargePageMinimum.Addr(), 0, 0, 0, 0) + r0, _, _ := syscall.SyscallN(procGetLargePageMinimum.Addr()) size = uintptr(r0) return } func GetLastError() (lasterr error) { - r0, _, _ := syscall.Syscall(procGetLastError.Addr(), 0, 0, 0, 0) + r0, _, _ := syscall.SyscallN(procGetLastError.Addr()) if r0 != 0 { lasterr = syscall.Errno(r0) } @@ -2399,7 +2410,7 @@ func GetLastError() (lasterr error) { } func GetLogicalDriveStrings(bufferLength uint32, buffer *uint16) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetLogicalDriveStringsW.Addr(), 2, uintptr(bufferLength), uintptr(unsafe.Pointer(buffer)), 0) + r0, _, e1 := syscall.SyscallN(procGetLogicalDriveStringsW.Addr(), uintptr(bufferLength), uintptr(unsafe.Pointer(buffer))) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2408,7 +2419,7 @@ func GetLogicalDriveStrings(bufferLength uint32, buffer *uint16) (n uint32, err } func GetLogicalDrives() (drivesBitMask uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetLogicalDrives.Addr(), 0, 0, 0, 0) + r0, _, e1 := syscall.SyscallN(procGetLogicalDrives.Addr()) drivesBitMask = uint32(r0) if drivesBitMask == 0 { err = errnoErr(e1) @@ -2417,7 +2428,7 @@ func GetLogicalDrives() (drivesBitMask uint32, err error) { } func GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetLongPathNameW.Addr(), 3, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(buf)), uintptr(buflen)) + r0, _, e1 := syscall.SyscallN(procGetLongPathNameW.Addr(), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(buf)), uintptr(buflen)) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2426,13 +2437,13 @@ func GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err er } func GetMaximumProcessorCount(groupNumber uint16) (ret uint32) { - r0, _, _ := syscall.Syscall(procGetMaximumProcessorCount.Addr(), 1, uintptr(groupNumber), 0, 0) + r0, _, _ := syscall.SyscallN(procGetMaximumProcessorCount.Addr(), uintptr(groupNumber)) ret = uint32(r0) return } func GetModuleFileName(module Handle, filename *uint16, size uint32) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetModuleFileNameW.Addr(), 3, uintptr(module), uintptr(unsafe.Pointer(filename)), uintptr(size)) + r0, _, e1 := syscall.SyscallN(procGetModuleFileNameW.Addr(), uintptr(module), uintptr(unsafe.Pointer(filename)), uintptr(size)) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2441,7 +2452,7 @@ func GetModuleFileName(module Handle, filename *uint16, size uint32) (n uint32, } func GetModuleHandleEx(flags uint32, moduleName *uint16, module *Handle) (err error) { - r1, _, e1 := syscall.Syscall(procGetModuleHandleExW.Addr(), 3, uintptr(flags), uintptr(unsafe.Pointer(moduleName)), uintptr(unsafe.Pointer(module))) + r1, _, e1 := syscall.SyscallN(procGetModuleHandleExW.Addr(), uintptr(flags), uintptr(unsafe.Pointer(moduleName)), uintptr(unsafe.Pointer(module))) if r1 == 0 { err = errnoErr(e1) } @@ -2449,7 +2460,7 @@ func GetModuleHandleEx(flags uint32, moduleName *uint16, module *Handle) (err er } func GetNamedPipeClientProcessId(pipe Handle, clientProcessID *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetNamedPipeClientProcessId.Addr(), 2, uintptr(pipe), uintptr(unsafe.Pointer(clientProcessID)), 0) + r1, _, e1 := syscall.SyscallN(procGetNamedPipeClientProcessId.Addr(), uintptr(pipe), uintptr(unsafe.Pointer(clientProcessID))) if r1 == 0 { err = errnoErr(e1) } @@ -2457,7 +2468,7 @@ func GetNamedPipeClientProcessId(pipe Handle, clientProcessID *uint32) (err erro } func GetNamedPipeHandleState(pipe Handle, state *uint32, curInstances *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32, userName *uint16, maxUserNameSize uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procGetNamedPipeHandleStateW.Addr(), 7, uintptr(pipe), uintptr(unsafe.Pointer(state)), uintptr(unsafe.Pointer(curInstances)), uintptr(unsafe.Pointer(maxCollectionCount)), uintptr(unsafe.Pointer(collectDataTimeout)), uintptr(unsafe.Pointer(userName)), uintptr(maxUserNameSize), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetNamedPipeHandleStateW.Addr(), uintptr(pipe), uintptr(unsafe.Pointer(state)), uintptr(unsafe.Pointer(curInstances)), uintptr(unsafe.Pointer(maxCollectionCount)), uintptr(unsafe.Pointer(collectDataTimeout)), uintptr(unsafe.Pointer(userName)), uintptr(maxUserNameSize)) if r1 == 0 { err = errnoErr(e1) } @@ -2465,7 +2476,7 @@ func GetNamedPipeHandleState(pipe Handle, state *uint32, curInstances *uint32, m } func GetNamedPipeInfo(pipe Handle, flags *uint32, outSize *uint32, inSize *uint32, maxInstances *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetNamedPipeInfo.Addr(), 5, uintptr(pipe), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(outSize)), uintptr(unsafe.Pointer(inSize)), uintptr(unsafe.Pointer(maxInstances)), 0) + r1, _, e1 := syscall.SyscallN(procGetNamedPipeInfo.Addr(), uintptr(pipe), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(outSize)), uintptr(unsafe.Pointer(inSize)), uintptr(unsafe.Pointer(maxInstances))) if r1 == 0 { err = errnoErr(e1) } @@ -2473,7 +2484,15 @@ func GetNamedPipeInfo(pipe Handle, flags *uint32, outSize *uint32, inSize *uint3 } func GetNamedPipeServerProcessId(pipe Handle, serverProcessID *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetNamedPipeServerProcessId.Addr(), 2, uintptr(pipe), uintptr(unsafe.Pointer(serverProcessID)), 0) + r1, _, e1 := syscall.SyscallN(procGetNamedPipeServerProcessId.Addr(), uintptr(pipe), uintptr(unsafe.Pointer(serverProcessID))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetNumberOfConsoleInputEvents(console Handle, numevents *uint32) (err error) { + r1, _, e1 := syscall.SyscallN(procGetNumberOfConsoleInputEvents.Addr(), uintptr(console), uintptr(unsafe.Pointer(numevents))) if r1 == 0 { err = errnoErr(e1) } @@ -2485,7 +2504,7 @@ func GetOverlappedResult(handle Handle, overlapped *Overlapped, done *uint32, wa if wait { _p0 = 1 } - r1, _, e1 := syscall.Syscall6(procGetOverlappedResult.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(done)), uintptr(_p0), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetOverlappedResult.Addr(), uintptr(handle), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(done)), uintptr(_p0)) if r1 == 0 { err = errnoErr(e1) } @@ -2493,7 +2512,7 @@ func GetOverlappedResult(handle Handle, overlapped *Overlapped, done *uint32, wa } func GetPriorityClass(process Handle) (ret uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetPriorityClass.Addr(), 1, uintptr(process), 0, 0) + r0, _, e1 := syscall.SyscallN(procGetPriorityClass.Addr(), uintptr(process)) ret = uint32(r0) if ret == 0 { err = errnoErr(e1) @@ -2511,7 +2530,7 @@ func GetProcAddress(module Handle, procname string) (proc uintptr, err error) { } func _GetProcAddress(module Handle, procname *byte) (proc uintptr, err error) { - r0, _, e1 := syscall.Syscall(procGetProcAddress.Addr(), 2, uintptr(module), uintptr(unsafe.Pointer(procname)), 0) + r0, _, e1 := syscall.SyscallN(procGetProcAddress.Addr(), uintptr(module), uintptr(unsafe.Pointer(procname))) proc = uintptr(r0) if proc == 0 { err = errnoErr(e1) @@ -2520,7 +2539,7 @@ func _GetProcAddress(module Handle, procname *byte) (proc uintptr, err error) { } func GetProcessId(process Handle) (id uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetProcessId.Addr(), 1, uintptr(process), 0, 0) + r0, _, e1 := syscall.SyscallN(procGetProcessId.Addr(), uintptr(process)) id = uint32(r0) if id == 0 { err = errnoErr(e1) @@ -2529,7 +2548,7 @@ func GetProcessId(process Handle) (id uint32, err error) { } func getProcessPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetProcessPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetProcessPreferredUILanguages.Addr(), uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize))) if r1 == 0 { err = errnoErr(e1) } @@ -2537,7 +2556,7 @@ func getProcessPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uin } func GetProcessShutdownParameters(level *uint32, flags *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetProcessShutdownParameters.Addr(), 2, uintptr(unsafe.Pointer(level)), uintptr(unsafe.Pointer(flags)), 0) + r1, _, e1 := syscall.SyscallN(procGetProcessShutdownParameters.Addr(), uintptr(unsafe.Pointer(level)), uintptr(unsafe.Pointer(flags))) if r1 == 0 { err = errnoErr(e1) } @@ -2545,7 +2564,7 @@ func GetProcessShutdownParameters(level *uint32, flags *uint32) (err error) { } func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error) { - r1, _, e1 := syscall.Syscall6(procGetProcessTimes.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(creationTime)), uintptr(unsafe.Pointer(exitTime)), uintptr(unsafe.Pointer(kernelTime)), uintptr(unsafe.Pointer(userTime)), 0) + r1, _, e1 := syscall.SyscallN(procGetProcessTimes.Addr(), uintptr(handle), uintptr(unsafe.Pointer(creationTime)), uintptr(unsafe.Pointer(exitTime)), uintptr(unsafe.Pointer(kernelTime)), uintptr(unsafe.Pointer(userTime))) if r1 == 0 { err = errnoErr(e1) } @@ -2553,12 +2572,12 @@ func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, } func GetProcessWorkingSetSizeEx(hProcess Handle, lpMinimumWorkingSetSize *uintptr, lpMaximumWorkingSetSize *uintptr, flags *uint32) { - syscall.Syscall6(procGetProcessWorkingSetSizeEx.Addr(), 4, uintptr(hProcess), uintptr(unsafe.Pointer(lpMinimumWorkingSetSize)), uintptr(unsafe.Pointer(lpMaximumWorkingSetSize)), uintptr(unsafe.Pointer(flags)), 0, 0) + syscall.SyscallN(procGetProcessWorkingSetSizeEx.Addr(), uintptr(hProcess), uintptr(unsafe.Pointer(lpMinimumWorkingSetSize)), uintptr(unsafe.Pointer(lpMaximumWorkingSetSize)), uintptr(unsafe.Pointer(flags))) return } func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uintptr, overlapped **Overlapped, timeout uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetQueuedCompletionStatus.Addr(), 5, uintptr(cphandle), uintptr(unsafe.Pointer(qty)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(overlapped)), uintptr(timeout), 0) + r1, _, e1 := syscall.SyscallN(procGetQueuedCompletionStatus.Addr(), uintptr(cphandle), uintptr(unsafe.Pointer(qty)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(overlapped)), uintptr(timeout)) if r1 == 0 { err = errnoErr(e1) } @@ -2566,7 +2585,7 @@ func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uintptr, overl } func GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetShortPathNameW.Addr(), 3, uintptr(unsafe.Pointer(longpath)), uintptr(unsafe.Pointer(shortpath)), uintptr(buflen)) + r0, _, e1 := syscall.SyscallN(procGetShortPathNameW.Addr(), uintptr(unsafe.Pointer(longpath)), uintptr(unsafe.Pointer(shortpath)), uintptr(buflen)) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2575,12 +2594,12 @@ func GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uin } func getStartupInfo(startupInfo *StartupInfo) { - syscall.Syscall(procGetStartupInfoW.Addr(), 1, uintptr(unsafe.Pointer(startupInfo)), 0, 0) + syscall.SyscallN(procGetStartupInfoW.Addr(), uintptr(unsafe.Pointer(startupInfo))) return } func GetStdHandle(stdhandle uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procGetStdHandle.Addr(), 1, uintptr(stdhandle), 0, 0) + r0, _, e1 := syscall.SyscallN(procGetStdHandle.Addr(), uintptr(stdhandle)) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -2589,7 +2608,7 @@ func GetStdHandle(stdhandle uint32) (handle Handle, err error) { } func getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetSystemDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0) + r0, _, e1 := syscall.SyscallN(procGetSystemDirectoryW.Addr(), uintptr(unsafe.Pointer(dir)), uintptr(dirLen)) len = uint32(r0) if len == 0 { err = errnoErr(e1) @@ -2598,7 +2617,7 @@ func getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) { } func getSystemPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetSystemPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetSystemPreferredUILanguages.Addr(), uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize))) if r1 == 0 { err = errnoErr(e1) } @@ -2606,17 +2625,17 @@ func getSystemPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint } func GetSystemTimeAsFileTime(time *Filetime) { - syscall.Syscall(procGetSystemTimeAsFileTime.Addr(), 1, uintptr(unsafe.Pointer(time)), 0, 0) + syscall.SyscallN(procGetSystemTimeAsFileTime.Addr(), uintptr(unsafe.Pointer(time))) return } func GetSystemTimePreciseAsFileTime(time *Filetime) { - syscall.Syscall(procGetSystemTimePreciseAsFileTime.Addr(), 1, uintptr(unsafe.Pointer(time)), 0, 0) + syscall.SyscallN(procGetSystemTimePreciseAsFileTime.Addr(), uintptr(unsafe.Pointer(time))) return } func getSystemWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetSystemWindowsDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0) + r0, _, e1 := syscall.SyscallN(procGetSystemWindowsDirectoryW.Addr(), uintptr(unsafe.Pointer(dir)), uintptr(dirLen)) len = uint32(r0) if len == 0 { err = errnoErr(e1) @@ -2625,7 +2644,7 @@ func getSystemWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err erro } func GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetTempPathW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0) + r0, _, e1 := syscall.SyscallN(procGetTempPathW.Addr(), uintptr(buflen), uintptr(unsafe.Pointer(buf))) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2634,7 +2653,7 @@ func GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) { } func getThreadPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetThreadPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetThreadPreferredUILanguages.Addr(), uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize))) if r1 == 0 { err = errnoErr(e1) } @@ -2642,13 +2661,13 @@ func getThreadPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint } func getTickCount64() (ms uint64) { - r0, _, _ := syscall.Syscall(procGetTickCount64.Addr(), 0, 0, 0, 0) + r0, _, _ := syscall.SyscallN(procGetTickCount64.Addr()) ms = uint64(r0) return } func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetTimeZoneInformation.Addr(), 1, uintptr(unsafe.Pointer(tzi)), 0, 0) + r0, _, e1 := syscall.SyscallN(procGetTimeZoneInformation.Addr(), uintptr(unsafe.Pointer(tzi))) rc = uint32(r0) if rc == 0xffffffff { err = errnoErr(e1) @@ -2657,7 +2676,7 @@ func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) { } func getUserPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetUserPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetUserPreferredUILanguages.Addr(), uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize))) if r1 == 0 { err = errnoErr(e1) } @@ -2665,7 +2684,7 @@ func getUserPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16 } func GetVersion() (ver uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetVersion.Addr(), 0, 0, 0, 0) + r0, _, e1 := syscall.SyscallN(procGetVersion.Addr()) ver = uint32(r0) if ver == 0 { err = errnoErr(e1) @@ -2674,7 +2693,7 @@ func GetVersion() (ver uint32, err error) { } func GetVolumeInformationByHandle(file Handle, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procGetVolumeInformationByHandleW.Addr(), 8, uintptr(file), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize), 0) + r1, _, e1 := syscall.SyscallN(procGetVolumeInformationByHandleW.Addr(), uintptr(file), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize)) if r1 == 0 { err = errnoErr(e1) } @@ -2682,7 +2701,7 @@ func GetVolumeInformationByHandle(file Handle, volumeNameBuffer *uint16, volumeN } func GetVolumeInformation(rootPathName *uint16, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procGetVolumeInformationW.Addr(), 8, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize), 0) + r1, _, e1 := syscall.SyscallN(procGetVolumeInformationW.Addr(), uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize)) if r1 == 0 { err = errnoErr(e1) } @@ -2690,7 +2709,7 @@ func GetVolumeInformation(rootPathName *uint16, volumeNameBuffer *uint16, volume } func GetVolumeNameForVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16, bufferlength uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetVolumeNameForVolumeMountPointW.Addr(), 3, uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferlength)) + r1, _, e1 := syscall.SyscallN(procGetVolumeNameForVolumeMountPointW.Addr(), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferlength)) if r1 == 0 { err = errnoErr(e1) } @@ -2698,7 +2717,7 @@ func GetVolumeNameForVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint } func GetVolumePathName(fileName *uint16, volumePathName *uint16, bufferLength uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetVolumePathNameW.Addr(), 3, uintptr(unsafe.Pointer(fileName)), uintptr(unsafe.Pointer(volumePathName)), uintptr(bufferLength)) + r1, _, e1 := syscall.SyscallN(procGetVolumePathNameW.Addr(), uintptr(unsafe.Pointer(fileName)), uintptr(unsafe.Pointer(volumePathName)), uintptr(bufferLength)) if r1 == 0 { err = errnoErr(e1) } @@ -2706,7 +2725,7 @@ func GetVolumePathName(fileName *uint16, volumePathName *uint16, bufferLength ui } func GetVolumePathNamesForVolumeName(volumeName *uint16, volumePathNames *uint16, bufferLength uint32, returnLength *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetVolumePathNamesForVolumeNameW.Addr(), 4, uintptr(unsafe.Pointer(volumeName)), uintptr(unsafe.Pointer(volumePathNames)), uintptr(bufferLength), uintptr(unsafe.Pointer(returnLength)), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetVolumePathNamesForVolumeNameW.Addr(), uintptr(unsafe.Pointer(volumeName)), uintptr(unsafe.Pointer(volumePathNames)), uintptr(bufferLength), uintptr(unsafe.Pointer(returnLength))) if r1 == 0 { err = errnoErr(e1) } @@ -2714,7 +2733,7 @@ func GetVolumePathNamesForVolumeName(volumeName *uint16, volumePathNames *uint16 } func getWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetWindowsDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0) + r0, _, e1 := syscall.SyscallN(procGetWindowsDirectoryW.Addr(), uintptr(unsafe.Pointer(dir)), uintptr(dirLen)) len = uint32(r0) if len == 0 { err = errnoErr(e1) @@ -2723,7 +2742,7 @@ func getWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) { } func initializeProcThreadAttributeList(attrlist *ProcThreadAttributeList, attrcount uint32, flags uint32, size *uintptr) (err error) { - r1, _, e1 := syscall.Syscall6(procInitializeProcThreadAttributeList.Addr(), 4, uintptr(unsafe.Pointer(attrlist)), uintptr(attrcount), uintptr(flags), uintptr(unsafe.Pointer(size)), 0, 0) + r1, _, e1 := syscall.SyscallN(procInitializeProcThreadAttributeList.Addr(), uintptr(unsafe.Pointer(attrlist)), uintptr(attrcount), uintptr(flags), uintptr(unsafe.Pointer(size))) if r1 == 0 { err = errnoErr(e1) } @@ -2735,7 +2754,7 @@ func IsWow64Process(handle Handle, isWow64 *bool) (err error) { if *isWow64 { _p0 = 1 } - r1, _, e1 := syscall.Syscall(procIsWow64Process.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(&_p0)), 0) + r1, _, e1 := syscall.SyscallN(procIsWow64Process.Addr(), uintptr(handle), uintptr(unsafe.Pointer(&_p0))) *isWow64 = _p0 != 0 if r1 == 0 { err = errnoErr(e1) @@ -2748,7 +2767,7 @@ func IsWow64Process2(handle Handle, processMachine *uint16, nativeMachine *uint1 if err != nil { return } - r1, _, e1 := syscall.Syscall(procIsWow64Process2.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(processMachine)), uintptr(unsafe.Pointer(nativeMachine))) + r1, _, e1 := syscall.SyscallN(procIsWow64Process2.Addr(), uintptr(handle), uintptr(unsafe.Pointer(processMachine)), uintptr(unsafe.Pointer(nativeMachine))) if r1 == 0 { err = errnoErr(e1) } @@ -2765,7 +2784,7 @@ func LoadLibraryEx(libname string, zero Handle, flags uintptr) (handle Handle, e } func _LoadLibraryEx(libname *uint16, zero Handle, flags uintptr) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procLoadLibraryExW.Addr(), 3, uintptr(unsafe.Pointer(libname)), uintptr(zero), uintptr(flags)) + r0, _, e1 := syscall.SyscallN(procLoadLibraryExW.Addr(), uintptr(unsafe.Pointer(libname)), uintptr(zero), uintptr(flags)) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -2783,7 +2802,7 @@ func LoadLibrary(libname string) (handle Handle, err error) { } func _LoadLibrary(libname *uint16) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procLoadLibraryW.Addr(), 1, uintptr(unsafe.Pointer(libname)), 0, 0) + r0, _, e1 := syscall.SyscallN(procLoadLibraryW.Addr(), uintptr(unsafe.Pointer(libname))) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -2792,7 +2811,7 @@ func _LoadLibrary(libname *uint16) (handle Handle, err error) { } func LoadResource(module Handle, resInfo Handle) (resData Handle, err error) { - r0, _, e1 := syscall.Syscall(procLoadResource.Addr(), 2, uintptr(module), uintptr(resInfo), 0) + r0, _, e1 := syscall.SyscallN(procLoadResource.Addr(), uintptr(module), uintptr(resInfo)) resData = Handle(r0) if resData == 0 { err = errnoErr(e1) @@ -2801,7 +2820,7 @@ func LoadResource(module Handle, resInfo Handle) (resData Handle, err error) { } func LocalAlloc(flags uint32, length uint32) (ptr uintptr, err error) { - r0, _, e1 := syscall.Syscall(procLocalAlloc.Addr(), 2, uintptr(flags), uintptr(length), 0) + r0, _, e1 := syscall.SyscallN(procLocalAlloc.Addr(), uintptr(flags), uintptr(length)) ptr = uintptr(r0) if ptr == 0 { err = errnoErr(e1) @@ -2810,7 +2829,7 @@ func LocalAlloc(flags uint32, length uint32) (ptr uintptr, err error) { } func LocalFree(hmem Handle) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procLocalFree.Addr(), 1, uintptr(hmem), 0, 0) + r0, _, e1 := syscall.SyscallN(procLocalFree.Addr(), uintptr(hmem)) handle = Handle(r0) if handle != 0 { err = errnoErr(e1) @@ -2819,7 +2838,7 @@ func LocalFree(hmem Handle) (handle Handle, err error) { } func LockFileEx(file Handle, flags uint32, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *Overlapped) (err error) { - r1, _, e1 := syscall.Syscall6(procLockFileEx.Addr(), 6, uintptr(file), uintptr(flags), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped))) + r1, _, e1 := syscall.SyscallN(procLockFileEx.Addr(), uintptr(file), uintptr(flags), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped))) if r1 == 0 { err = errnoErr(e1) } @@ -2827,7 +2846,7 @@ func LockFileEx(file Handle, flags uint32, reserved uint32, bytesLow uint32, byt } func LockResource(resData Handle) (addr uintptr, err error) { - r0, _, e1 := syscall.Syscall(procLockResource.Addr(), 1, uintptr(resData), 0, 0) + r0, _, e1 := syscall.SyscallN(procLockResource.Addr(), uintptr(resData)) addr = uintptr(r0) if addr == 0 { err = errnoErr(e1) @@ -2836,7 +2855,7 @@ func LockResource(resData Handle) (addr uintptr, err error) { } func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, err error) { - r0, _, e1 := syscall.Syscall6(procMapViewOfFile.Addr(), 5, uintptr(handle), uintptr(access), uintptr(offsetHigh), uintptr(offsetLow), uintptr(length), 0) + r0, _, e1 := syscall.SyscallN(procMapViewOfFile.Addr(), uintptr(handle), uintptr(access), uintptr(offsetHigh), uintptr(offsetLow), uintptr(length)) addr = uintptr(r0) if addr == 0 { err = errnoErr(e1) @@ -2845,7 +2864,7 @@ func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow ui } func Module32First(snapshot Handle, moduleEntry *ModuleEntry32) (err error) { - r1, _, e1 := syscall.Syscall(procModule32FirstW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(moduleEntry)), 0) + r1, _, e1 := syscall.SyscallN(procModule32FirstW.Addr(), uintptr(snapshot), uintptr(unsafe.Pointer(moduleEntry))) if r1 == 0 { err = errnoErr(e1) } @@ -2853,7 +2872,7 @@ func Module32First(snapshot Handle, moduleEntry *ModuleEntry32) (err error) { } func Module32Next(snapshot Handle, moduleEntry *ModuleEntry32) (err error) { - r1, _, e1 := syscall.Syscall(procModule32NextW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(moduleEntry)), 0) + r1, _, e1 := syscall.SyscallN(procModule32NextW.Addr(), uintptr(snapshot), uintptr(unsafe.Pointer(moduleEntry))) if r1 == 0 { err = errnoErr(e1) } @@ -2861,7 +2880,7 @@ func Module32Next(snapshot Handle, moduleEntry *ModuleEntry32) (err error) { } func MoveFileEx(from *uint16, to *uint16, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall(procMoveFileExW.Addr(), 3, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), uintptr(flags)) + r1, _, e1 := syscall.SyscallN(procMoveFileExW.Addr(), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), uintptr(flags)) if r1 == 0 { err = errnoErr(e1) } @@ -2869,7 +2888,7 @@ func MoveFileEx(from *uint16, to *uint16, flags uint32) (err error) { } func MoveFile(from *uint16, to *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procMoveFileW.Addr(), 2, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), 0) + r1, _, e1 := syscall.SyscallN(procMoveFileW.Addr(), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to))) if r1 == 0 { err = errnoErr(e1) } @@ -2877,7 +2896,7 @@ func MoveFile(from *uint16, to *uint16) (err error) { } func MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) { - r0, _, e1 := syscall.Syscall6(procMultiByteToWideChar.Addr(), 6, uintptr(codePage), uintptr(dwFlags), uintptr(unsafe.Pointer(str)), uintptr(nstr), uintptr(unsafe.Pointer(wchar)), uintptr(nwchar)) + r0, _, e1 := syscall.SyscallN(procMultiByteToWideChar.Addr(), uintptr(codePage), uintptr(dwFlags), uintptr(unsafe.Pointer(str)), uintptr(nstr), uintptr(unsafe.Pointer(wchar)), uintptr(nwchar)) nwrite = int32(r0) if nwrite == 0 { err = errnoErr(e1) @@ -2890,7 +2909,7 @@ func OpenEvent(desiredAccess uint32, inheritHandle bool, name *uint16) (handle H if inheritHandle { _p0 = 1 } - r0, _, e1 := syscall.Syscall(procOpenEventW.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name))) + r0, _, e1 := syscall.SyscallN(procOpenEventW.Addr(), uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name))) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -2903,7 +2922,7 @@ func OpenMutex(desiredAccess uint32, inheritHandle bool, name *uint16) (handle H if inheritHandle { _p0 = 1 } - r0, _, e1 := syscall.Syscall(procOpenMutexW.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name))) + r0, _, e1 := syscall.SyscallN(procOpenMutexW.Addr(), uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name))) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -2916,7 +2935,7 @@ func OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) (ha if inheritHandle { _p0 = 1 } - r0, _, e1 := syscall.Syscall(procOpenProcess.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(processId)) + r0, _, e1 := syscall.SyscallN(procOpenProcess.Addr(), uintptr(desiredAccess), uintptr(_p0), uintptr(processId)) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -2929,7 +2948,7 @@ func OpenThread(desiredAccess uint32, inheritHandle bool, threadId uint32) (hand if inheritHandle { _p0 = 1 } - r0, _, e1 := syscall.Syscall(procOpenThread.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(threadId)) + r0, _, e1 := syscall.SyscallN(procOpenThread.Addr(), uintptr(desiredAccess), uintptr(_p0), uintptr(threadId)) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -2938,7 +2957,7 @@ func OpenThread(desiredAccess uint32, inheritHandle bool, threadId uint32) (hand } func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uintptr, overlapped *Overlapped) (err error) { - r1, _, e1 := syscall.Syscall6(procPostQueuedCompletionStatus.Addr(), 4, uintptr(cphandle), uintptr(qty), uintptr(key), uintptr(unsafe.Pointer(overlapped)), 0, 0) + r1, _, e1 := syscall.SyscallN(procPostQueuedCompletionStatus.Addr(), uintptr(cphandle), uintptr(qty), uintptr(key), uintptr(unsafe.Pointer(overlapped))) if r1 == 0 { err = errnoErr(e1) } @@ -2946,7 +2965,7 @@ func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uintptr, overla } func Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) { - r1, _, e1 := syscall.Syscall(procProcess32FirstW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(procEntry)), 0) + r1, _, e1 := syscall.SyscallN(procProcess32FirstW.Addr(), uintptr(snapshot), uintptr(unsafe.Pointer(procEntry))) if r1 == 0 { err = errnoErr(e1) } @@ -2954,7 +2973,7 @@ func Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) { } func Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) { - r1, _, e1 := syscall.Syscall(procProcess32NextW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(procEntry)), 0) + r1, _, e1 := syscall.SyscallN(procProcess32NextW.Addr(), uintptr(snapshot), uintptr(unsafe.Pointer(procEntry))) if r1 == 0 { err = errnoErr(e1) } @@ -2962,7 +2981,7 @@ func Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) { } func ProcessIdToSessionId(pid uint32, sessionid *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procProcessIdToSessionId.Addr(), 2, uintptr(pid), uintptr(unsafe.Pointer(sessionid)), 0) + r1, _, e1 := syscall.SyscallN(procProcessIdToSessionId.Addr(), uintptr(pid), uintptr(unsafe.Pointer(sessionid))) if r1 == 0 { err = errnoErr(e1) } @@ -2970,7 +2989,7 @@ func ProcessIdToSessionId(pid uint32, sessionid *uint32) (err error) { } func PulseEvent(event Handle) (err error) { - r1, _, e1 := syscall.Syscall(procPulseEvent.Addr(), 1, uintptr(event), 0, 0) + r1, _, e1 := syscall.SyscallN(procPulseEvent.Addr(), uintptr(event)) if r1 == 0 { err = errnoErr(e1) } @@ -2978,7 +2997,7 @@ func PulseEvent(event Handle) (err error) { } func PurgeComm(handle Handle, dwFlags uint32) (err error) { - r1, _, e1 := syscall.Syscall(procPurgeComm.Addr(), 2, uintptr(handle), uintptr(dwFlags), 0) + r1, _, e1 := syscall.SyscallN(procPurgeComm.Addr(), uintptr(handle), uintptr(dwFlags)) if r1 == 0 { err = errnoErr(e1) } @@ -2986,7 +3005,7 @@ func PurgeComm(handle Handle, dwFlags uint32) (err error) { } func QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procQueryDosDeviceW.Addr(), 3, uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)), uintptr(max)) + r0, _, e1 := syscall.SyscallN(procQueryDosDeviceW.Addr(), uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)), uintptr(max)) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2995,7 +3014,7 @@ func QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint3 } func QueryFullProcessImageName(proc Handle, flags uint32, exeName *uint16, size *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procQueryFullProcessImageNameW.Addr(), 4, uintptr(proc), uintptr(flags), uintptr(unsafe.Pointer(exeName)), uintptr(unsafe.Pointer(size)), 0, 0) + r1, _, e1 := syscall.SyscallN(procQueryFullProcessImageNameW.Addr(), uintptr(proc), uintptr(flags), uintptr(unsafe.Pointer(exeName)), uintptr(unsafe.Pointer(size))) if r1 == 0 { err = errnoErr(e1) } @@ -3003,7 +3022,7 @@ func QueryFullProcessImageName(proc Handle, flags uint32, exeName *uint16, size } func QueryInformationJobObject(job Handle, JobObjectInformationClass int32, JobObjectInformation uintptr, JobObjectInformationLength uint32, retlen *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procQueryInformationJobObject.Addr(), 5, uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), uintptr(unsafe.Pointer(retlen)), 0) + r1, _, e1 := syscall.SyscallN(procQueryInformationJobObject.Addr(), uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), uintptr(unsafe.Pointer(retlen))) if r1 == 0 { err = errnoErr(e1) } @@ -3011,7 +3030,7 @@ func QueryInformationJobObject(job Handle, JobObjectInformationClass int32, JobO } func ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) { - r1, _, e1 := syscall.Syscall6(procReadConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(toread), uintptr(unsafe.Pointer(read)), uintptr(unsafe.Pointer(inputControl)), 0) + r1, _, e1 := syscall.SyscallN(procReadConsoleW.Addr(), uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(toread), uintptr(unsafe.Pointer(read)), uintptr(unsafe.Pointer(inputControl))) if r1 == 0 { err = errnoErr(e1) } @@ -3023,7 +3042,7 @@ func ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree if watchSubTree { _p0 = 1 } - r1, _, e1 := syscall.Syscall9(procReadDirectoryChangesW.Addr(), 8, uintptr(handle), uintptr(unsafe.Pointer(buf)), uintptr(buflen), uintptr(_p0), uintptr(mask), uintptr(unsafe.Pointer(retlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine), 0) + r1, _, e1 := syscall.SyscallN(procReadDirectoryChangesW.Addr(), uintptr(handle), uintptr(unsafe.Pointer(buf)), uintptr(buflen), uintptr(_p0), uintptr(mask), uintptr(unsafe.Pointer(retlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine)) if r1 == 0 { err = errnoErr(e1) } @@ -3035,7 +3054,7 @@ func readFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) ( if len(buf) > 0 { _p0 = &buf[0] } - r1, _, e1 := syscall.Syscall6(procReadFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0) + r1, _, e1 := syscall.SyscallN(procReadFile.Addr(), uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped))) if r1 == 0 { err = errnoErr(e1) } @@ -3043,7 +3062,7 @@ func readFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) ( } func ReadProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size uintptr, numberOfBytesRead *uintptr) (err error) { - r1, _, e1 := syscall.Syscall6(procReadProcessMemory.Addr(), 5, uintptr(process), uintptr(baseAddress), uintptr(unsafe.Pointer(buffer)), uintptr(size), uintptr(unsafe.Pointer(numberOfBytesRead)), 0) + r1, _, e1 := syscall.SyscallN(procReadProcessMemory.Addr(), uintptr(process), uintptr(baseAddress), uintptr(unsafe.Pointer(buffer)), uintptr(size), uintptr(unsafe.Pointer(numberOfBytesRead))) if r1 == 0 { err = errnoErr(e1) } @@ -3051,7 +3070,7 @@ func ReadProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size u } func ReleaseMutex(mutex Handle) (err error) { - r1, _, e1 := syscall.Syscall(procReleaseMutex.Addr(), 1, uintptr(mutex), 0, 0) + r1, _, e1 := syscall.SyscallN(procReleaseMutex.Addr(), uintptr(mutex)) if r1 == 0 { err = errnoErr(e1) } @@ -3059,7 +3078,7 @@ func ReleaseMutex(mutex Handle) (err error) { } func RemoveDirectory(path *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procRemoveDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) + r1, _, e1 := syscall.SyscallN(procRemoveDirectoryW.Addr(), uintptr(unsafe.Pointer(path))) if r1 == 0 { err = errnoErr(e1) } @@ -3067,7 +3086,7 @@ func RemoveDirectory(path *uint16) (err error) { } func RemoveDllDirectory(cookie uintptr) (err error) { - r1, _, e1 := syscall.Syscall(procRemoveDllDirectory.Addr(), 1, uintptr(cookie), 0, 0) + r1, _, e1 := syscall.SyscallN(procRemoveDllDirectory.Addr(), uintptr(cookie)) if r1 == 0 { err = errnoErr(e1) } @@ -3075,7 +3094,7 @@ func RemoveDllDirectory(cookie uintptr) (err error) { } func ResetEvent(event Handle) (err error) { - r1, _, e1 := syscall.Syscall(procResetEvent.Addr(), 1, uintptr(event), 0, 0) + r1, _, e1 := syscall.SyscallN(procResetEvent.Addr(), uintptr(event)) if r1 == 0 { err = errnoErr(e1) } @@ -3083,7 +3102,7 @@ func ResetEvent(event Handle) (err error) { } func resizePseudoConsole(pconsole Handle, size uint32) (hr error) { - r0, _, _ := syscall.Syscall(procResizePseudoConsole.Addr(), 2, uintptr(pconsole), uintptr(size), 0) + r0, _, _ := syscall.SyscallN(procResizePseudoConsole.Addr(), uintptr(pconsole), uintptr(size)) if r0 != 0 { hr = syscall.Errno(r0) } @@ -3091,7 +3110,7 @@ func resizePseudoConsole(pconsole Handle, size uint32) (hr error) { } func ResumeThread(thread Handle) (ret uint32, err error) { - r0, _, e1 := syscall.Syscall(procResumeThread.Addr(), 1, uintptr(thread), 0, 0) + r0, _, e1 := syscall.SyscallN(procResumeThread.Addr(), uintptr(thread)) ret = uint32(r0) if ret == 0xffffffff { err = errnoErr(e1) @@ -3100,7 +3119,7 @@ func ResumeThread(thread Handle) (ret uint32, err error) { } func SetCommBreak(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procSetCommBreak.Addr(), 1, uintptr(handle), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetCommBreak.Addr(), uintptr(handle)) if r1 == 0 { err = errnoErr(e1) } @@ -3108,7 +3127,7 @@ func SetCommBreak(handle Handle) (err error) { } func SetCommMask(handle Handle, dwEvtMask uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetCommMask.Addr(), 2, uintptr(handle), uintptr(dwEvtMask), 0) + r1, _, e1 := syscall.SyscallN(procSetCommMask.Addr(), uintptr(handle), uintptr(dwEvtMask)) if r1 == 0 { err = errnoErr(e1) } @@ -3116,7 +3135,7 @@ func SetCommMask(handle Handle, dwEvtMask uint32) (err error) { } func SetCommState(handle Handle, lpDCB *DCB) (err error) { - r1, _, e1 := syscall.Syscall(procSetCommState.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(lpDCB)), 0) + r1, _, e1 := syscall.SyscallN(procSetCommState.Addr(), uintptr(handle), uintptr(unsafe.Pointer(lpDCB))) if r1 == 0 { err = errnoErr(e1) } @@ -3124,7 +3143,7 @@ func SetCommState(handle Handle, lpDCB *DCB) (err error) { } func SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) { - r1, _, e1 := syscall.Syscall(procSetCommTimeouts.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(timeouts)), 0) + r1, _, e1 := syscall.SyscallN(procSetCommTimeouts.Addr(), uintptr(handle), uintptr(unsafe.Pointer(timeouts))) if r1 == 0 { err = errnoErr(e1) } @@ -3132,7 +3151,7 @@ func SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) { } func SetConsoleCP(cp uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetConsoleCP.Addr(), 1, uintptr(cp), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetConsoleCP.Addr(), uintptr(cp)) if r1 == 0 { err = errnoErr(e1) } @@ -3140,7 +3159,7 @@ func SetConsoleCP(cp uint32) (err error) { } func setConsoleCursorPosition(console Handle, position uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetConsoleCursorPosition.Addr(), 2, uintptr(console), uintptr(position), 0) + r1, _, e1 := syscall.SyscallN(procSetConsoleCursorPosition.Addr(), uintptr(console), uintptr(position)) if r1 == 0 { err = errnoErr(e1) } @@ -3148,7 +3167,7 @@ func setConsoleCursorPosition(console Handle, position uint32) (err error) { } func SetConsoleMode(console Handle, mode uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetConsoleMode.Addr(), 2, uintptr(console), uintptr(mode), 0) + r1, _, e1 := syscall.SyscallN(procSetConsoleMode.Addr(), uintptr(console), uintptr(mode)) if r1 == 0 { err = errnoErr(e1) } @@ -3156,7 +3175,7 @@ func SetConsoleMode(console Handle, mode uint32) (err error) { } func SetConsoleOutputCP(cp uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetConsoleOutputCP.Addr(), 1, uintptr(cp), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetConsoleOutputCP.Addr(), uintptr(cp)) if r1 == 0 { err = errnoErr(e1) } @@ -3164,7 +3183,7 @@ func SetConsoleOutputCP(cp uint32) (err error) { } func SetCurrentDirectory(path *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procSetCurrentDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetCurrentDirectoryW.Addr(), uintptr(unsafe.Pointer(path))) if r1 == 0 { err = errnoErr(e1) } @@ -3172,7 +3191,7 @@ func SetCurrentDirectory(path *uint16) (err error) { } func SetDefaultDllDirectories(directoryFlags uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetDefaultDllDirectories.Addr(), 1, uintptr(directoryFlags), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetDefaultDllDirectories.Addr(), uintptr(directoryFlags)) if r1 == 0 { err = errnoErr(e1) } @@ -3189,7 +3208,7 @@ func SetDllDirectory(path string) (err error) { } func _SetDllDirectory(path *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procSetDllDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetDllDirectoryW.Addr(), uintptr(unsafe.Pointer(path))) if r1 == 0 { err = errnoErr(e1) } @@ -3197,7 +3216,7 @@ func _SetDllDirectory(path *uint16) (err error) { } func SetEndOfFile(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procSetEndOfFile.Addr(), 1, uintptr(handle), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetEndOfFile.Addr(), uintptr(handle)) if r1 == 0 { err = errnoErr(e1) } @@ -3205,7 +3224,7 @@ func SetEndOfFile(handle Handle) (err error) { } func SetEnvironmentVariable(name *uint16, value *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procSetEnvironmentVariableW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(value)), 0) + r1, _, e1 := syscall.SyscallN(procSetEnvironmentVariableW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(value))) if r1 == 0 { err = errnoErr(e1) } @@ -3213,13 +3232,13 @@ func SetEnvironmentVariable(name *uint16, value *uint16) (err error) { } func SetErrorMode(mode uint32) (ret uint32) { - r0, _, _ := syscall.Syscall(procSetErrorMode.Addr(), 1, uintptr(mode), 0, 0) + r0, _, _ := syscall.SyscallN(procSetErrorMode.Addr(), uintptr(mode)) ret = uint32(r0) return } func SetEvent(event Handle) (err error) { - r1, _, e1 := syscall.Syscall(procSetEvent.Addr(), 1, uintptr(event), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetEvent.Addr(), uintptr(event)) if r1 == 0 { err = errnoErr(e1) } @@ -3227,7 +3246,7 @@ func SetEvent(event Handle) (err error) { } func SetFileAttributes(name *uint16, attrs uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetFileAttributesW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(attrs), 0) + r1, _, e1 := syscall.SyscallN(procSetFileAttributesW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(attrs)) if r1 == 0 { err = errnoErr(e1) } @@ -3235,7 +3254,7 @@ func SetFileAttributes(name *uint16, attrs uint32) (err error) { } func SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error) { - r1, _, e1 := syscall.Syscall(procSetFileCompletionNotificationModes.Addr(), 2, uintptr(handle), uintptr(flags), 0) + r1, _, e1 := syscall.SyscallN(procSetFileCompletionNotificationModes.Addr(), uintptr(handle), uintptr(flags)) if r1 == 0 { err = errnoErr(e1) } @@ -3243,7 +3262,7 @@ func SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error) } func SetFileInformationByHandle(handle Handle, class uint32, inBuffer *byte, inBufferLen uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procSetFileInformationByHandle.Addr(), 4, uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferLen), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetFileInformationByHandle.Addr(), uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferLen)) if r1 == 0 { err = errnoErr(e1) } @@ -3251,7 +3270,7 @@ func SetFileInformationByHandle(handle Handle, class uint32, inBuffer *byte, inB } func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, err error) { - r0, _, e1 := syscall.Syscall6(procSetFilePointer.Addr(), 4, uintptr(handle), uintptr(lowoffset), uintptr(unsafe.Pointer(highoffsetptr)), uintptr(whence), 0, 0) + r0, _, e1 := syscall.SyscallN(procSetFilePointer.Addr(), uintptr(handle), uintptr(lowoffset), uintptr(unsafe.Pointer(highoffsetptr)), uintptr(whence)) newlowoffset = uint32(r0) if newlowoffset == 0xffffffff { err = errnoErr(e1) @@ -3260,7 +3279,7 @@ func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence } func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) { - r1, _, e1 := syscall.Syscall6(procSetFileTime.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetFileTime.Addr(), uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime))) if r1 == 0 { err = errnoErr(e1) } @@ -3268,7 +3287,7 @@ func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetim } func SetFileValidData(handle Handle, validDataLength int64) (err error) { - r1, _, e1 := syscall.Syscall(procSetFileValidData.Addr(), 2, uintptr(handle), uintptr(validDataLength), 0) + r1, _, e1 := syscall.SyscallN(procSetFileValidData.Addr(), uintptr(handle), uintptr(validDataLength)) if r1 == 0 { err = errnoErr(e1) } @@ -3276,7 +3295,7 @@ func SetFileValidData(handle Handle, validDataLength int64) (err error) { } func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetHandleInformation.Addr(), 3, uintptr(handle), uintptr(mask), uintptr(flags)) + r1, _, e1 := syscall.SyscallN(procSetHandleInformation.Addr(), uintptr(handle), uintptr(mask), uintptr(flags)) if r1 == 0 { err = errnoErr(e1) } @@ -3284,7 +3303,7 @@ func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) } func SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobObjectInformation uintptr, JobObjectInformationLength uint32) (ret int, err error) { - r0, _, e1 := syscall.Syscall6(procSetInformationJobObject.Addr(), 4, uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), 0, 0) + r0, _, e1 := syscall.SyscallN(procSetInformationJobObject.Addr(), uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength)) ret = int(r0) if ret == 0 { err = errnoErr(e1) @@ -3293,7 +3312,7 @@ func SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobOb } func SetNamedPipeHandleState(pipe Handle, state *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procSetNamedPipeHandleState.Addr(), 4, uintptr(pipe), uintptr(unsafe.Pointer(state)), uintptr(unsafe.Pointer(maxCollectionCount)), uintptr(unsafe.Pointer(collectDataTimeout)), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetNamedPipeHandleState.Addr(), uintptr(pipe), uintptr(unsafe.Pointer(state)), uintptr(unsafe.Pointer(maxCollectionCount)), uintptr(unsafe.Pointer(collectDataTimeout))) if r1 == 0 { err = errnoErr(e1) } @@ -3301,7 +3320,7 @@ func SetNamedPipeHandleState(pipe Handle, state *uint32, maxCollectionCount *uin } func SetPriorityClass(process Handle, priorityClass uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetPriorityClass.Addr(), 2, uintptr(process), uintptr(priorityClass), 0) + r1, _, e1 := syscall.SyscallN(procSetPriorityClass.Addr(), uintptr(process), uintptr(priorityClass)) if r1 == 0 { err = errnoErr(e1) } @@ -3313,7 +3332,7 @@ func SetProcessPriorityBoost(process Handle, disable bool) (err error) { if disable { _p0 = 1 } - r1, _, e1 := syscall.Syscall(procSetProcessPriorityBoost.Addr(), 2, uintptr(process), uintptr(_p0), 0) + r1, _, e1 := syscall.SyscallN(procSetProcessPriorityBoost.Addr(), uintptr(process), uintptr(_p0)) if r1 == 0 { err = errnoErr(e1) } @@ -3321,7 +3340,7 @@ func SetProcessPriorityBoost(process Handle, disable bool) (err error) { } func SetProcessShutdownParameters(level uint32, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetProcessShutdownParameters.Addr(), 2, uintptr(level), uintptr(flags), 0) + r1, _, e1 := syscall.SyscallN(procSetProcessShutdownParameters.Addr(), uintptr(level), uintptr(flags)) if r1 == 0 { err = errnoErr(e1) } @@ -3329,7 +3348,7 @@ func SetProcessShutdownParameters(level uint32, flags uint32) (err error) { } func SetProcessWorkingSetSizeEx(hProcess Handle, dwMinimumWorkingSetSize uintptr, dwMaximumWorkingSetSize uintptr, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procSetProcessWorkingSetSizeEx.Addr(), 4, uintptr(hProcess), uintptr(dwMinimumWorkingSetSize), uintptr(dwMaximumWorkingSetSize), uintptr(flags), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetProcessWorkingSetSizeEx.Addr(), uintptr(hProcess), uintptr(dwMinimumWorkingSetSize), uintptr(dwMaximumWorkingSetSize), uintptr(flags)) if r1 == 0 { err = errnoErr(e1) } @@ -3337,7 +3356,7 @@ func SetProcessWorkingSetSizeEx(hProcess Handle, dwMinimumWorkingSetSize uintptr } func SetStdHandle(stdhandle uint32, handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procSetStdHandle.Addr(), 2, uintptr(stdhandle), uintptr(handle), 0) + r1, _, e1 := syscall.SyscallN(procSetStdHandle.Addr(), uintptr(stdhandle), uintptr(handle)) if r1 == 0 { err = errnoErr(e1) } @@ -3345,7 +3364,7 @@ func SetStdHandle(stdhandle uint32, handle Handle) (err error) { } func SetVolumeLabel(rootPathName *uint16, volumeName *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procSetVolumeLabelW.Addr(), 2, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeName)), 0) + r1, _, e1 := syscall.SyscallN(procSetVolumeLabelW.Addr(), uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeName))) if r1 == 0 { err = errnoErr(e1) } @@ -3353,7 +3372,7 @@ func SetVolumeLabel(rootPathName *uint16, volumeName *uint16) (err error) { } func SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procSetVolumeMountPointW.Addr(), 2, uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), 0) + r1, _, e1 := syscall.SyscallN(procSetVolumeMountPointW.Addr(), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName))) if r1 == 0 { err = errnoErr(e1) } @@ -3361,7 +3380,7 @@ func SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err erro } func SetupComm(handle Handle, dwInQueue uint32, dwOutQueue uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetupComm.Addr(), 3, uintptr(handle), uintptr(dwInQueue), uintptr(dwOutQueue)) + r1, _, e1 := syscall.SyscallN(procSetupComm.Addr(), uintptr(handle), uintptr(dwInQueue), uintptr(dwOutQueue)) if r1 == 0 { err = errnoErr(e1) } @@ -3369,7 +3388,7 @@ func SetupComm(handle Handle, dwInQueue uint32, dwOutQueue uint32) (err error) { } func SizeofResource(module Handle, resInfo Handle) (size uint32, err error) { - r0, _, e1 := syscall.Syscall(procSizeofResource.Addr(), 2, uintptr(module), uintptr(resInfo), 0) + r0, _, e1 := syscall.SyscallN(procSizeofResource.Addr(), uintptr(module), uintptr(resInfo)) size = uint32(r0) if size == 0 { err = errnoErr(e1) @@ -3382,13 +3401,13 @@ func SleepEx(milliseconds uint32, alertable bool) (ret uint32) { if alertable { _p0 = 1 } - r0, _, _ := syscall.Syscall(procSleepEx.Addr(), 2, uintptr(milliseconds), uintptr(_p0), 0) + r0, _, _ := syscall.SyscallN(procSleepEx.Addr(), uintptr(milliseconds), uintptr(_p0)) ret = uint32(r0) return } func TerminateJobObject(job Handle, exitCode uint32) (err error) { - r1, _, e1 := syscall.Syscall(procTerminateJobObject.Addr(), 2, uintptr(job), uintptr(exitCode), 0) + r1, _, e1 := syscall.SyscallN(procTerminateJobObject.Addr(), uintptr(job), uintptr(exitCode)) if r1 == 0 { err = errnoErr(e1) } @@ -3396,7 +3415,7 @@ func TerminateJobObject(job Handle, exitCode uint32) (err error) { } func TerminateProcess(handle Handle, exitcode uint32) (err error) { - r1, _, e1 := syscall.Syscall(procTerminateProcess.Addr(), 2, uintptr(handle), uintptr(exitcode), 0) + r1, _, e1 := syscall.SyscallN(procTerminateProcess.Addr(), uintptr(handle), uintptr(exitcode)) if r1 == 0 { err = errnoErr(e1) } @@ -3404,7 +3423,7 @@ func TerminateProcess(handle Handle, exitcode uint32) (err error) { } func Thread32First(snapshot Handle, threadEntry *ThreadEntry32) (err error) { - r1, _, e1 := syscall.Syscall(procThread32First.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry)), 0) + r1, _, e1 := syscall.SyscallN(procThread32First.Addr(), uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry))) if r1 == 0 { err = errnoErr(e1) } @@ -3412,7 +3431,7 @@ func Thread32First(snapshot Handle, threadEntry *ThreadEntry32) (err error) { } func Thread32Next(snapshot Handle, threadEntry *ThreadEntry32) (err error) { - r1, _, e1 := syscall.Syscall(procThread32Next.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry)), 0) + r1, _, e1 := syscall.SyscallN(procThread32Next.Addr(), uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry))) if r1 == 0 { err = errnoErr(e1) } @@ -3420,7 +3439,7 @@ func Thread32Next(snapshot Handle, threadEntry *ThreadEntry32) (err error) { } func UnlockFileEx(file Handle, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *Overlapped) (err error) { - r1, _, e1 := syscall.Syscall6(procUnlockFileEx.Addr(), 5, uintptr(file), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped)), 0) + r1, _, e1 := syscall.SyscallN(procUnlockFileEx.Addr(), uintptr(file), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped))) if r1 == 0 { err = errnoErr(e1) } @@ -3428,7 +3447,7 @@ func UnlockFileEx(file Handle, reserved uint32, bytesLow uint32, bytesHigh uint3 } func UnmapViewOfFile(addr uintptr) (err error) { - r1, _, e1 := syscall.Syscall(procUnmapViewOfFile.Addr(), 1, uintptr(addr), 0, 0) + r1, _, e1 := syscall.SyscallN(procUnmapViewOfFile.Addr(), uintptr(addr)) if r1 == 0 { err = errnoErr(e1) } @@ -3436,7 +3455,7 @@ func UnmapViewOfFile(addr uintptr) (err error) { } func updateProcThreadAttribute(attrlist *ProcThreadAttributeList, flags uint32, attr uintptr, value unsafe.Pointer, size uintptr, prevvalue unsafe.Pointer, returnedsize *uintptr) (err error) { - r1, _, e1 := syscall.Syscall9(procUpdateProcThreadAttribute.Addr(), 7, uintptr(unsafe.Pointer(attrlist)), uintptr(flags), uintptr(attr), uintptr(value), uintptr(size), uintptr(prevvalue), uintptr(unsafe.Pointer(returnedsize)), 0, 0) + r1, _, e1 := syscall.SyscallN(procUpdateProcThreadAttribute.Addr(), uintptr(unsafe.Pointer(attrlist)), uintptr(flags), uintptr(attr), uintptr(value), uintptr(size), uintptr(prevvalue), uintptr(unsafe.Pointer(returnedsize))) if r1 == 0 { err = errnoErr(e1) } @@ -3444,7 +3463,7 @@ func updateProcThreadAttribute(attrlist *ProcThreadAttributeList, flags uint32, } func VirtualAlloc(address uintptr, size uintptr, alloctype uint32, protect uint32) (value uintptr, err error) { - r0, _, e1 := syscall.Syscall6(procVirtualAlloc.Addr(), 4, uintptr(address), uintptr(size), uintptr(alloctype), uintptr(protect), 0, 0) + r0, _, e1 := syscall.SyscallN(procVirtualAlloc.Addr(), uintptr(address), uintptr(size), uintptr(alloctype), uintptr(protect)) value = uintptr(r0) if value == 0 { err = errnoErr(e1) @@ -3453,7 +3472,7 @@ func VirtualAlloc(address uintptr, size uintptr, alloctype uint32, protect uint3 } func VirtualFree(address uintptr, size uintptr, freetype uint32) (err error) { - r1, _, e1 := syscall.Syscall(procVirtualFree.Addr(), 3, uintptr(address), uintptr(size), uintptr(freetype)) + r1, _, e1 := syscall.SyscallN(procVirtualFree.Addr(), uintptr(address), uintptr(size), uintptr(freetype)) if r1 == 0 { err = errnoErr(e1) } @@ -3461,7 +3480,7 @@ func VirtualFree(address uintptr, size uintptr, freetype uint32) (err error) { } func VirtualLock(addr uintptr, length uintptr) (err error) { - r1, _, e1 := syscall.Syscall(procVirtualLock.Addr(), 2, uintptr(addr), uintptr(length), 0) + r1, _, e1 := syscall.SyscallN(procVirtualLock.Addr(), uintptr(addr), uintptr(length)) if r1 == 0 { err = errnoErr(e1) } @@ -3469,7 +3488,7 @@ func VirtualLock(addr uintptr, length uintptr) (err error) { } func VirtualProtect(address uintptr, size uintptr, newprotect uint32, oldprotect *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procVirtualProtect.Addr(), 4, uintptr(address), uintptr(size), uintptr(newprotect), uintptr(unsafe.Pointer(oldprotect)), 0, 0) + r1, _, e1 := syscall.SyscallN(procVirtualProtect.Addr(), uintptr(address), uintptr(size), uintptr(newprotect), uintptr(unsafe.Pointer(oldprotect))) if r1 == 0 { err = errnoErr(e1) } @@ -3477,7 +3496,7 @@ func VirtualProtect(address uintptr, size uintptr, newprotect uint32, oldprotect } func VirtualProtectEx(process Handle, address uintptr, size uintptr, newProtect uint32, oldProtect *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procVirtualProtectEx.Addr(), 5, uintptr(process), uintptr(address), uintptr(size), uintptr(newProtect), uintptr(unsafe.Pointer(oldProtect)), 0) + r1, _, e1 := syscall.SyscallN(procVirtualProtectEx.Addr(), uintptr(process), uintptr(address), uintptr(size), uintptr(newProtect), uintptr(unsafe.Pointer(oldProtect))) if r1 == 0 { err = errnoErr(e1) } @@ -3485,7 +3504,7 @@ func VirtualProtectEx(process Handle, address uintptr, size uintptr, newProtect } func VirtualQuery(address uintptr, buffer *MemoryBasicInformation, length uintptr) (err error) { - r1, _, e1 := syscall.Syscall(procVirtualQuery.Addr(), 3, uintptr(address), uintptr(unsafe.Pointer(buffer)), uintptr(length)) + r1, _, e1 := syscall.SyscallN(procVirtualQuery.Addr(), uintptr(address), uintptr(unsafe.Pointer(buffer)), uintptr(length)) if r1 == 0 { err = errnoErr(e1) } @@ -3493,7 +3512,7 @@ func VirtualQuery(address uintptr, buffer *MemoryBasicInformation, length uintpt } func VirtualQueryEx(process Handle, address uintptr, buffer *MemoryBasicInformation, length uintptr) (err error) { - r1, _, e1 := syscall.Syscall6(procVirtualQueryEx.Addr(), 4, uintptr(process), uintptr(address), uintptr(unsafe.Pointer(buffer)), uintptr(length), 0, 0) + r1, _, e1 := syscall.SyscallN(procVirtualQueryEx.Addr(), uintptr(process), uintptr(address), uintptr(unsafe.Pointer(buffer)), uintptr(length)) if r1 == 0 { err = errnoErr(e1) } @@ -3501,7 +3520,7 @@ func VirtualQueryEx(process Handle, address uintptr, buffer *MemoryBasicInformat } func VirtualUnlock(addr uintptr, length uintptr) (err error) { - r1, _, e1 := syscall.Syscall(procVirtualUnlock.Addr(), 2, uintptr(addr), uintptr(length), 0) + r1, _, e1 := syscall.SyscallN(procVirtualUnlock.Addr(), uintptr(addr), uintptr(length)) if r1 == 0 { err = errnoErr(e1) } @@ -3509,13 +3528,13 @@ func VirtualUnlock(addr uintptr, length uintptr) (err error) { } func WTSGetActiveConsoleSessionId() (sessionID uint32) { - r0, _, _ := syscall.Syscall(procWTSGetActiveConsoleSessionId.Addr(), 0, 0, 0, 0) + r0, _, _ := syscall.SyscallN(procWTSGetActiveConsoleSessionId.Addr()) sessionID = uint32(r0) return } func WaitCommEvent(handle Handle, lpEvtMask *uint32, lpOverlapped *Overlapped) (err error) { - r1, _, e1 := syscall.Syscall(procWaitCommEvent.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(lpEvtMask)), uintptr(unsafe.Pointer(lpOverlapped))) + r1, _, e1 := syscall.SyscallN(procWaitCommEvent.Addr(), uintptr(handle), uintptr(unsafe.Pointer(lpEvtMask)), uintptr(unsafe.Pointer(lpOverlapped))) if r1 == 0 { err = errnoErr(e1) } @@ -3527,7 +3546,7 @@ func waitForMultipleObjects(count uint32, handles uintptr, waitAll bool, waitMil if waitAll { _p0 = 1 } - r0, _, e1 := syscall.Syscall6(procWaitForMultipleObjects.Addr(), 4, uintptr(count), uintptr(handles), uintptr(_p0), uintptr(waitMilliseconds), 0, 0) + r0, _, e1 := syscall.SyscallN(procWaitForMultipleObjects.Addr(), uintptr(count), uintptr(handles), uintptr(_p0), uintptr(waitMilliseconds)) event = uint32(r0) if event == 0xffffffff { err = errnoErr(e1) @@ -3536,7 +3555,7 @@ func waitForMultipleObjects(count uint32, handles uintptr, waitAll bool, waitMil } func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, err error) { - r0, _, e1 := syscall.Syscall(procWaitForSingleObject.Addr(), 2, uintptr(handle), uintptr(waitMilliseconds), 0) + r0, _, e1 := syscall.SyscallN(procWaitForSingleObject.Addr(), uintptr(handle), uintptr(waitMilliseconds)) event = uint32(r0) if event == 0xffffffff { err = errnoErr(e1) @@ -3545,7 +3564,7 @@ func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, } func WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) { - r1, _, e1 := syscall.Syscall6(procWriteConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(towrite), uintptr(unsafe.Pointer(written)), uintptr(unsafe.Pointer(reserved)), 0) + r1, _, e1 := syscall.SyscallN(procWriteConsoleW.Addr(), uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(towrite), uintptr(unsafe.Pointer(written)), uintptr(unsafe.Pointer(reserved))) if r1 == 0 { err = errnoErr(e1) } @@ -3557,7 +3576,7 @@ func writeFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) if len(buf) > 0 { _p0 = &buf[0] } - r1, _, e1 := syscall.Syscall6(procWriteFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0) + r1, _, e1 := syscall.SyscallN(procWriteFile.Addr(), uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped))) if r1 == 0 { err = errnoErr(e1) } @@ -3565,7 +3584,7 @@ func writeFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) } func WriteProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size uintptr, numberOfBytesWritten *uintptr) (err error) { - r1, _, e1 := syscall.Syscall6(procWriteProcessMemory.Addr(), 5, uintptr(process), uintptr(baseAddress), uintptr(unsafe.Pointer(buffer)), uintptr(size), uintptr(unsafe.Pointer(numberOfBytesWritten)), 0) + r1, _, e1 := syscall.SyscallN(procWriteProcessMemory.Addr(), uintptr(process), uintptr(baseAddress), uintptr(unsafe.Pointer(buffer)), uintptr(size), uintptr(unsafe.Pointer(numberOfBytesWritten))) if r1 == 0 { err = errnoErr(e1) } @@ -3573,7 +3592,7 @@ func WriteProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size } func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (err error) { - r1, _, e1 := syscall.Syscall9(procAcceptEx.Addr(), 8, uintptr(ls), uintptr(as), uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(overlapped)), 0) + r1, _, e1 := syscall.SyscallN(procAcceptEx.Addr(), uintptr(ls), uintptr(as), uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(overlapped))) if r1 == 0 { err = errnoErr(e1) } @@ -3581,12 +3600,12 @@ func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32 } func GetAcceptExSockaddrs(buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, lrsa **RawSockaddrAny, lrsalen *int32, rrsa **RawSockaddrAny, rrsalen *int32) { - syscall.Syscall9(procGetAcceptExSockaddrs.Addr(), 8, uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(lrsa)), uintptr(unsafe.Pointer(lrsalen)), uintptr(unsafe.Pointer(rrsa)), uintptr(unsafe.Pointer(rrsalen)), 0) + syscall.SyscallN(procGetAcceptExSockaddrs.Addr(), uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(lrsa)), uintptr(unsafe.Pointer(lrsalen)), uintptr(unsafe.Pointer(rrsa)), uintptr(unsafe.Pointer(rrsalen))) return } func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procTransmitFile.Addr(), 7, uintptr(s), uintptr(handle), uintptr(bytesToWrite), uintptr(bytsPerSend), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(transmitFileBuf)), uintptr(flags), 0, 0) + r1, _, e1 := syscall.SyscallN(procTransmitFile.Addr(), uintptr(s), uintptr(handle), uintptr(bytesToWrite), uintptr(bytsPerSend), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(transmitFileBuf)), uintptr(flags)) if r1 == 0 { err = errnoErr(e1) } @@ -3594,7 +3613,7 @@ func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint } func NetApiBufferFree(buf *byte) (neterr error) { - r0, _, _ := syscall.Syscall(procNetApiBufferFree.Addr(), 1, uintptr(unsafe.Pointer(buf)), 0, 0) + r0, _, _ := syscall.SyscallN(procNetApiBufferFree.Addr(), uintptr(unsafe.Pointer(buf))) if r0 != 0 { neterr = syscall.Errno(r0) } @@ -3602,7 +3621,7 @@ func NetApiBufferFree(buf *byte) (neterr error) { } func NetGetJoinInformation(server *uint16, name **uint16, bufType *uint32) (neterr error) { - r0, _, _ := syscall.Syscall(procNetGetJoinInformation.Addr(), 3, uintptr(unsafe.Pointer(server)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bufType))) + r0, _, _ := syscall.SyscallN(procNetGetJoinInformation.Addr(), uintptr(unsafe.Pointer(server)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bufType))) if r0 != 0 { neterr = syscall.Errno(r0) } @@ -3610,7 +3629,7 @@ func NetGetJoinInformation(server *uint16, name **uint16, bufType *uint32) (nete } func NetUserEnum(serverName *uint16, level uint32, filter uint32, buf **byte, prefMaxLen uint32, entriesRead *uint32, totalEntries *uint32, resumeHandle *uint32) (neterr error) { - r0, _, _ := syscall.Syscall9(procNetUserEnum.Addr(), 8, uintptr(unsafe.Pointer(serverName)), uintptr(level), uintptr(filter), uintptr(unsafe.Pointer(buf)), uintptr(prefMaxLen), uintptr(unsafe.Pointer(entriesRead)), uintptr(unsafe.Pointer(totalEntries)), uintptr(unsafe.Pointer(resumeHandle)), 0) + r0, _, _ := syscall.SyscallN(procNetUserEnum.Addr(), uintptr(unsafe.Pointer(serverName)), uintptr(level), uintptr(filter), uintptr(unsafe.Pointer(buf)), uintptr(prefMaxLen), uintptr(unsafe.Pointer(entriesRead)), uintptr(unsafe.Pointer(totalEntries)), uintptr(unsafe.Pointer(resumeHandle))) if r0 != 0 { neterr = syscall.Errno(r0) } @@ -3618,7 +3637,7 @@ func NetUserEnum(serverName *uint16, level uint32, filter uint32, buf **byte, pr } func NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **byte) (neterr error) { - r0, _, _ := syscall.Syscall6(procNetUserGetInfo.Addr(), 4, uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)), uintptr(level), uintptr(unsafe.Pointer(buf)), 0, 0) + r0, _, _ := syscall.SyscallN(procNetUserGetInfo.Addr(), uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)), uintptr(level), uintptr(unsafe.Pointer(buf))) if r0 != 0 { neterr = syscall.Errno(r0) } @@ -3626,7 +3645,7 @@ func NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **by } func NtCreateFile(handle *Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, allocationSize *int64, attributes uint32, share uint32, disposition uint32, options uint32, eabuffer uintptr, ealength uint32) (ntstatus error) { - r0, _, _ := syscall.Syscall12(procNtCreateFile.Addr(), 11, uintptr(unsafe.Pointer(handle)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(unsafe.Pointer(allocationSize)), uintptr(attributes), uintptr(share), uintptr(disposition), uintptr(options), uintptr(eabuffer), uintptr(ealength), 0) + r0, _, _ := syscall.SyscallN(procNtCreateFile.Addr(), uintptr(unsafe.Pointer(handle)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(unsafe.Pointer(allocationSize)), uintptr(attributes), uintptr(share), uintptr(disposition), uintptr(options), uintptr(eabuffer), uintptr(ealength)) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3634,7 +3653,7 @@ func NtCreateFile(handle *Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO } func NtCreateNamedPipeFile(pipe *Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, share uint32, disposition uint32, options uint32, typ uint32, readMode uint32, completionMode uint32, maxInstances uint32, inboundQuota uint32, outputQuota uint32, timeout *int64) (ntstatus error) { - r0, _, _ := syscall.Syscall15(procNtCreateNamedPipeFile.Addr(), 14, uintptr(unsafe.Pointer(pipe)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(share), uintptr(disposition), uintptr(options), uintptr(typ), uintptr(readMode), uintptr(completionMode), uintptr(maxInstances), uintptr(inboundQuota), uintptr(outputQuota), uintptr(unsafe.Pointer(timeout)), 0) + r0, _, _ := syscall.SyscallN(procNtCreateNamedPipeFile.Addr(), uintptr(unsafe.Pointer(pipe)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(share), uintptr(disposition), uintptr(options), uintptr(typ), uintptr(readMode), uintptr(completionMode), uintptr(maxInstances), uintptr(inboundQuota), uintptr(outputQuota), uintptr(unsafe.Pointer(timeout))) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3642,7 +3661,7 @@ func NtCreateNamedPipeFile(pipe *Handle, access uint32, oa *OBJECT_ATTRIBUTES, i } func NtQueryInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.Pointer, procInfoLen uint32, retLen *uint32) (ntstatus error) { - r0, _, _ := syscall.Syscall6(procNtQueryInformationProcess.Addr(), 5, uintptr(proc), uintptr(procInfoClass), uintptr(procInfo), uintptr(procInfoLen), uintptr(unsafe.Pointer(retLen)), 0) + r0, _, _ := syscall.SyscallN(procNtQueryInformationProcess.Addr(), uintptr(proc), uintptr(procInfoClass), uintptr(procInfo), uintptr(procInfoLen), uintptr(unsafe.Pointer(retLen))) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3650,7 +3669,7 @@ func NtQueryInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe } func NtQuerySystemInformation(sysInfoClass int32, sysInfo unsafe.Pointer, sysInfoLen uint32, retLen *uint32) (ntstatus error) { - r0, _, _ := syscall.Syscall6(procNtQuerySystemInformation.Addr(), 4, uintptr(sysInfoClass), uintptr(sysInfo), uintptr(sysInfoLen), uintptr(unsafe.Pointer(retLen)), 0, 0) + r0, _, _ := syscall.SyscallN(procNtQuerySystemInformation.Addr(), uintptr(sysInfoClass), uintptr(sysInfo), uintptr(sysInfoLen), uintptr(unsafe.Pointer(retLen))) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3658,7 +3677,7 @@ func NtQuerySystemInformation(sysInfoClass int32, sysInfo unsafe.Pointer, sysInf } func NtSetInformationFile(handle Handle, iosb *IO_STATUS_BLOCK, inBuffer *byte, inBufferLen uint32, class uint32) (ntstatus error) { - r0, _, _ := syscall.Syscall6(procNtSetInformationFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(iosb)), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferLen), uintptr(class), 0) + r0, _, _ := syscall.SyscallN(procNtSetInformationFile.Addr(), uintptr(handle), uintptr(unsafe.Pointer(iosb)), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferLen), uintptr(class)) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3666,7 +3685,7 @@ func NtSetInformationFile(handle Handle, iosb *IO_STATUS_BLOCK, inBuffer *byte, } func NtSetInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.Pointer, procInfoLen uint32) (ntstatus error) { - r0, _, _ := syscall.Syscall6(procNtSetInformationProcess.Addr(), 4, uintptr(proc), uintptr(procInfoClass), uintptr(procInfo), uintptr(procInfoLen), 0, 0) + r0, _, _ := syscall.SyscallN(procNtSetInformationProcess.Addr(), uintptr(proc), uintptr(procInfoClass), uintptr(procInfo), uintptr(procInfoLen)) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3674,7 +3693,7 @@ func NtSetInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.P } func NtSetSystemInformation(sysInfoClass int32, sysInfo unsafe.Pointer, sysInfoLen uint32) (ntstatus error) { - r0, _, _ := syscall.Syscall(procNtSetSystemInformation.Addr(), 3, uintptr(sysInfoClass), uintptr(sysInfo), uintptr(sysInfoLen)) + r0, _, _ := syscall.SyscallN(procNtSetSystemInformation.Addr(), uintptr(sysInfoClass), uintptr(sysInfo), uintptr(sysInfoLen)) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3682,13 +3701,13 @@ func NtSetSystemInformation(sysInfoClass int32, sysInfo unsafe.Pointer, sysInfoL } func RtlAddFunctionTable(functionTable *RUNTIME_FUNCTION, entryCount uint32, baseAddress uintptr) (ret bool) { - r0, _, _ := syscall.Syscall(procRtlAddFunctionTable.Addr(), 3, uintptr(unsafe.Pointer(functionTable)), uintptr(entryCount), uintptr(baseAddress)) + r0, _, _ := syscall.SyscallN(procRtlAddFunctionTable.Addr(), uintptr(unsafe.Pointer(functionTable)), uintptr(entryCount), uintptr(baseAddress)) ret = r0 != 0 return } func RtlDefaultNpAcl(acl **ACL) (ntstatus error) { - r0, _, _ := syscall.Syscall(procRtlDefaultNpAcl.Addr(), 1, uintptr(unsafe.Pointer(acl)), 0, 0) + r0, _, _ := syscall.SyscallN(procRtlDefaultNpAcl.Addr(), uintptr(unsafe.Pointer(acl))) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3696,13 +3715,13 @@ func RtlDefaultNpAcl(acl **ACL) (ntstatus error) { } func RtlDeleteFunctionTable(functionTable *RUNTIME_FUNCTION) (ret bool) { - r0, _, _ := syscall.Syscall(procRtlDeleteFunctionTable.Addr(), 1, uintptr(unsafe.Pointer(functionTable)), 0, 0) + r0, _, _ := syscall.SyscallN(procRtlDeleteFunctionTable.Addr(), uintptr(unsafe.Pointer(functionTable))) ret = r0 != 0 return } func RtlDosPathNameToNtPathName(dosName *uint16, ntName *NTUnicodeString, ntFileNamePart *uint16, relativeName *RTL_RELATIVE_NAME) (ntstatus error) { - r0, _, _ := syscall.Syscall6(procRtlDosPathNameToNtPathName_U_WithStatus.Addr(), 4, uintptr(unsafe.Pointer(dosName)), uintptr(unsafe.Pointer(ntName)), uintptr(unsafe.Pointer(ntFileNamePart)), uintptr(unsafe.Pointer(relativeName)), 0, 0) + r0, _, _ := syscall.SyscallN(procRtlDosPathNameToNtPathName_U_WithStatus.Addr(), uintptr(unsafe.Pointer(dosName)), uintptr(unsafe.Pointer(ntName)), uintptr(unsafe.Pointer(ntFileNamePart)), uintptr(unsafe.Pointer(relativeName))) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3710,7 +3729,7 @@ func RtlDosPathNameToNtPathName(dosName *uint16, ntName *NTUnicodeString, ntFile } func RtlDosPathNameToRelativeNtPathName(dosName *uint16, ntName *NTUnicodeString, ntFileNamePart *uint16, relativeName *RTL_RELATIVE_NAME) (ntstatus error) { - r0, _, _ := syscall.Syscall6(procRtlDosPathNameToRelativeNtPathName_U_WithStatus.Addr(), 4, uintptr(unsafe.Pointer(dosName)), uintptr(unsafe.Pointer(ntName)), uintptr(unsafe.Pointer(ntFileNamePart)), uintptr(unsafe.Pointer(relativeName)), 0, 0) + r0, _, _ := syscall.SyscallN(procRtlDosPathNameToRelativeNtPathName_U_WithStatus.Addr(), uintptr(unsafe.Pointer(dosName)), uintptr(unsafe.Pointer(ntName)), uintptr(unsafe.Pointer(ntFileNamePart)), uintptr(unsafe.Pointer(relativeName))) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3718,18 +3737,18 @@ func RtlDosPathNameToRelativeNtPathName(dosName *uint16, ntName *NTUnicodeString } func RtlGetCurrentPeb() (peb *PEB) { - r0, _, _ := syscall.Syscall(procRtlGetCurrentPeb.Addr(), 0, 0, 0, 0) + r0, _, _ := syscall.SyscallN(procRtlGetCurrentPeb.Addr()) peb = (*PEB)(unsafe.Pointer(r0)) return } func rtlGetNtVersionNumbers(majorVersion *uint32, minorVersion *uint32, buildNumber *uint32) { - syscall.Syscall(procRtlGetNtVersionNumbers.Addr(), 3, uintptr(unsafe.Pointer(majorVersion)), uintptr(unsafe.Pointer(minorVersion)), uintptr(unsafe.Pointer(buildNumber))) + syscall.SyscallN(procRtlGetNtVersionNumbers.Addr(), uintptr(unsafe.Pointer(majorVersion)), uintptr(unsafe.Pointer(minorVersion)), uintptr(unsafe.Pointer(buildNumber))) return } func rtlGetVersion(info *OsVersionInfoEx) (ntstatus error) { - r0, _, _ := syscall.Syscall(procRtlGetVersion.Addr(), 1, uintptr(unsafe.Pointer(info)), 0, 0) + r0, _, _ := syscall.SyscallN(procRtlGetVersion.Addr(), uintptr(unsafe.Pointer(info))) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3737,23 +3756,23 @@ func rtlGetVersion(info *OsVersionInfoEx) (ntstatus error) { } func RtlInitString(destinationString *NTString, sourceString *byte) { - syscall.Syscall(procRtlInitString.Addr(), 2, uintptr(unsafe.Pointer(destinationString)), uintptr(unsafe.Pointer(sourceString)), 0) + syscall.SyscallN(procRtlInitString.Addr(), uintptr(unsafe.Pointer(destinationString)), uintptr(unsafe.Pointer(sourceString))) return } func RtlInitUnicodeString(destinationString *NTUnicodeString, sourceString *uint16) { - syscall.Syscall(procRtlInitUnicodeString.Addr(), 2, uintptr(unsafe.Pointer(destinationString)), uintptr(unsafe.Pointer(sourceString)), 0) + syscall.SyscallN(procRtlInitUnicodeString.Addr(), uintptr(unsafe.Pointer(destinationString)), uintptr(unsafe.Pointer(sourceString))) return } func rtlNtStatusToDosErrorNoTeb(ntstatus NTStatus) (ret syscall.Errno) { - r0, _, _ := syscall.Syscall(procRtlNtStatusToDosErrorNoTeb.Addr(), 1, uintptr(ntstatus), 0, 0) + r0, _, _ := syscall.SyscallN(procRtlNtStatusToDosErrorNoTeb.Addr(), uintptr(ntstatus)) ret = syscall.Errno(r0) return } func clsidFromString(lpsz *uint16, pclsid *GUID) (ret error) { - r0, _, _ := syscall.Syscall(procCLSIDFromString.Addr(), 2, uintptr(unsafe.Pointer(lpsz)), uintptr(unsafe.Pointer(pclsid)), 0) + r0, _, _ := syscall.SyscallN(procCLSIDFromString.Addr(), uintptr(unsafe.Pointer(lpsz)), uintptr(unsafe.Pointer(pclsid))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -3761,7 +3780,7 @@ func clsidFromString(lpsz *uint16, pclsid *GUID) (ret error) { } func coCreateGuid(pguid *GUID) (ret error) { - r0, _, _ := syscall.Syscall(procCoCreateGuid.Addr(), 1, uintptr(unsafe.Pointer(pguid)), 0, 0) + r0, _, _ := syscall.SyscallN(procCoCreateGuid.Addr(), uintptr(unsafe.Pointer(pguid))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -3769,7 +3788,7 @@ func coCreateGuid(pguid *GUID) (ret error) { } func CoGetObject(name *uint16, bindOpts *BIND_OPTS3, guid *GUID, functionTable **uintptr) (ret error) { - r0, _, _ := syscall.Syscall6(procCoGetObject.Addr(), 4, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bindOpts)), uintptr(unsafe.Pointer(guid)), uintptr(unsafe.Pointer(functionTable)), 0, 0) + r0, _, _ := syscall.SyscallN(procCoGetObject.Addr(), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bindOpts)), uintptr(unsafe.Pointer(guid)), uintptr(unsafe.Pointer(functionTable))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -3777,7 +3796,7 @@ func CoGetObject(name *uint16, bindOpts *BIND_OPTS3, guid *GUID, functionTable * } func CoInitializeEx(reserved uintptr, coInit uint32) (ret error) { - r0, _, _ := syscall.Syscall(procCoInitializeEx.Addr(), 2, uintptr(reserved), uintptr(coInit), 0) + r0, _, _ := syscall.SyscallN(procCoInitializeEx.Addr(), uintptr(reserved), uintptr(coInit)) if r0 != 0 { ret = syscall.Errno(r0) } @@ -3785,23 +3804,23 @@ func CoInitializeEx(reserved uintptr, coInit uint32) (ret error) { } func CoTaskMemFree(address unsafe.Pointer) { - syscall.Syscall(procCoTaskMemFree.Addr(), 1, uintptr(address), 0, 0) + syscall.SyscallN(procCoTaskMemFree.Addr(), uintptr(address)) return } func CoUninitialize() { - syscall.Syscall(procCoUninitialize.Addr(), 0, 0, 0, 0) + syscall.SyscallN(procCoUninitialize.Addr()) return } func stringFromGUID2(rguid *GUID, lpsz *uint16, cchMax int32) (chars int32) { - r0, _, _ := syscall.Syscall(procStringFromGUID2.Addr(), 3, uintptr(unsafe.Pointer(rguid)), uintptr(unsafe.Pointer(lpsz)), uintptr(cchMax)) + r0, _, _ := syscall.SyscallN(procStringFromGUID2.Addr(), uintptr(unsafe.Pointer(rguid)), uintptr(unsafe.Pointer(lpsz)), uintptr(cchMax)) chars = int32(r0) return } func EnumProcessModules(process Handle, module *Handle, cb uint32, cbNeeded *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procEnumProcessModules.Addr(), 4, uintptr(process), uintptr(unsafe.Pointer(module)), uintptr(cb), uintptr(unsafe.Pointer(cbNeeded)), 0, 0) + r1, _, e1 := syscall.SyscallN(procEnumProcessModules.Addr(), uintptr(process), uintptr(unsafe.Pointer(module)), uintptr(cb), uintptr(unsafe.Pointer(cbNeeded))) if r1 == 0 { err = errnoErr(e1) } @@ -3809,7 +3828,7 @@ func EnumProcessModules(process Handle, module *Handle, cb uint32, cbNeeded *uin } func EnumProcessModulesEx(process Handle, module *Handle, cb uint32, cbNeeded *uint32, filterFlag uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procEnumProcessModulesEx.Addr(), 5, uintptr(process), uintptr(unsafe.Pointer(module)), uintptr(cb), uintptr(unsafe.Pointer(cbNeeded)), uintptr(filterFlag), 0) + r1, _, e1 := syscall.SyscallN(procEnumProcessModulesEx.Addr(), uintptr(process), uintptr(unsafe.Pointer(module)), uintptr(cb), uintptr(unsafe.Pointer(cbNeeded)), uintptr(filterFlag)) if r1 == 0 { err = errnoErr(e1) } @@ -3817,7 +3836,7 @@ func EnumProcessModulesEx(process Handle, module *Handle, cb uint32, cbNeeded *u } func enumProcesses(processIds *uint32, nSize uint32, bytesReturned *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procEnumProcesses.Addr(), 3, uintptr(unsafe.Pointer(processIds)), uintptr(nSize), uintptr(unsafe.Pointer(bytesReturned))) + r1, _, e1 := syscall.SyscallN(procEnumProcesses.Addr(), uintptr(unsafe.Pointer(processIds)), uintptr(nSize), uintptr(unsafe.Pointer(bytesReturned))) if r1 == 0 { err = errnoErr(e1) } @@ -3825,7 +3844,7 @@ func enumProcesses(processIds *uint32, nSize uint32, bytesReturned *uint32) (err } func GetModuleBaseName(process Handle, module Handle, baseName *uint16, size uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetModuleBaseNameW.Addr(), 4, uintptr(process), uintptr(module), uintptr(unsafe.Pointer(baseName)), uintptr(size), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetModuleBaseNameW.Addr(), uintptr(process), uintptr(module), uintptr(unsafe.Pointer(baseName)), uintptr(size)) if r1 == 0 { err = errnoErr(e1) } @@ -3833,7 +3852,7 @@ func GetModuleBaseName(process Handle, module Handle, baseName *uint16, size uin } func GetModuleFileNameEx(process Handle, module Handle, filename *uint16, size uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetModuleFileNameExW.Addr(), 4, uintptr(process), uintptr(module), uintptr(unsafe.Pointer(filename)), uintptr(size), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetModuleFileNameExW.Addr(), uintptr(process), uintptr(module), uintptr(unsafe.Pointer(filename)), uintptr(size)) if r1 == 0 { err = errnoErr(e1) } @@ -3841,7 +3860,7 @@ func GetModuleFileNameEx(process Handle, module Handle, filename *uint16, size u } func GetModuleInformation(process Handle, module Handle, modinfo *ModuleInfo, cb uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetModuleInformation.Addr(), 4, uintptr(process), uintptr(module), uintptr(unsafe.Pointer(modinfo)), uintptr(cb), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetModuleInformation.Addr(), uintptr(process), uintptr(module), uintptr(unsafe.Pointer(modinfo)), uintptr(cb)) if r1 == 0 { err = errnoErr(e1) } @@ -3849,7 +3868,7 @@ func GetModuleInformation(process Handle, module Handle, modinfo *ModuleInfo, cb } func QueryWorkingSetEx(process Handle, pv uintptr, cb uint32) (err error) { - r1, _, e1 := syscall.Syscall(procQueryWorkingSetEx.Addr(), 3, uintptr(process), uintptr(pv), uintptr(cb)) + r1, _, e1 := syscall.SyscallN(procQueryWorkingSetEx.Addr(), uintptr(process), uintptr(pv), uintptr(cb)) if r1 == 0 { err = errnoErr(e1) } @@ -3861,7 +3880,7 @@ func SubscribeServiceChangeNotifications(service Handle, eventType uint32, callb if ret != nil { return } - r0, _, _ := syscall.Syscall6(procSubscribeServiceChangeNotifications.Addr(), 5, uintptr(service), uintptr(eventType), uintptr(callback), uintptr(callbackCtx), uintptr(unsafe.Pointer(subscription)), 0) + r0, _, _ := syscall.SyscallN(procSubscribeServiceChangeNotifications.Addr(), uintptr(service), uintptr(eventType), uintptr(callback), uintptr(callbackCtx), uintptr(unsafe.Pointer(subscription))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -3873,12 +3892,12 @@ func UnsubscribeServiceChangeNotifications(subscription uintptr) (err error) { if err != nil { return } - syscall.Syscall(procUnsubscribeServiceChangeNotifications.Addr(), 1, uintptr(subscription), 0, 0) + syscall.SyscallN(procUnsubscribeServiceChangeNotifications.Addr(), uintptr(subscription)) return } func GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetUserNameExW.Addr(), 3, uintptr(nameFormat), uintptr(unsafe.Pointer(nameBuffre)), uintptr(unsafe.Pointer(nSize))) + r1, _, e1 := syscall.SyscallN(procGetUserNameExW.Addr(), uintptr(nameFormat), uintptr(unsafe.Pointer(nameBuffre)), uintptr(unsafe.Pointer(nSize))) if r1&0xff == 0 { err = errnoErr(e1) } @@ -3886,7 +3905,7 @@ func GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err er } func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint32, translatedName *uint16, nSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procTranslateNameW.Addr(), 5, uintptr(unsafe.Pointer(accName)), uintptr(accNameFormat), uintptr(desiredNameFormat), uintptr(unsafe.Pointer(translatedName)), uintptr(unsafe.Pointer(nSize)), 0) + r1, _, e1 := syscall.SyscallN(procTranslateNameW.Addr(), uintptr(unsafe.Pointer(accName)), uintptr(accNameFormat), uintptr(desiredNameFormat), uintptr(unsafe.Pointer(translatedName)), uintptr(unsafe.Pointer(nSize))) if r1&0xff == 0 { err = errnoErr(e1) } @@ -3894,7 +3913,7 @@ func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint } func SetupDiBuildDriverInfoList(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverType SPDIT) (err error) { - r1, _, e1 := syscall.Syscall(procSetupDiBuildDriverInfoList.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(driverType)) + r1, _, e1 := syscall.SyscallN(procSetupDiBuildDriverInfoList.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(driverType)) if r1 == 0 { err = errnoErr(e1) } @@ -3902,7 +3921,7 @@ func SetupDiBuildDriverInfoList(deviceInfoSet DevInfo, deviceInfoData *DevInfoDa } func SetupDiCallClassInstaller(installFunction DI_FUNCTION, deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (err error) { - r1, _, e1 := syscall.Syscall(procSetupDiCallClassInstaller.Addr(), 3, uintptr(installFunction), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData))) + r1, _, e1 := syscall.SyscallN(procSetupDiCallClassInstaller.Addr(), uintptr(installFunction), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData))) if r1 == 0 { err = errnoErr(e1) } @@ -3910,7 +3929,7 @@ func SetupDiCallClassInstaller(installFunction DI_FUNCTION, deviceInfoSet DevInf } func SetupDiCancelDriverInfoSearch(deviceInfoSet DevInfo) (err error) { - r1, _, e1 := syscall.Syscall(procSetupDiCancelDriverInfoSearch.Addr(), 1, uintptr(deviceInfoSet), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetupDiCancelDriverInfoSearch.Addr(), uintptr(deviceInfoSet)) if r1 == 0 { err = errnoErr(e1) } @@ -3918,7 +3937,7 @@ func SetupDiCancelDriverInfoSearch(deviceInfoSet DevInfo) (err error) { } func setupDiClassGuidsFromNameEx(className *uint16, classGuidList *GUID, classGuidListSize uint32, requiredSize *uint32, machineName *uint16, reserved uintptr) (err error) { - r1, _, e1 := syscall.Syscall6(procSetupDiClassGuidsFromNameExW.Addr(), 6, uintptr(unsafe.Pointer(className)), uintptr(unsafe.Pointer(classGuidList)), uintptr(classGuidListSize), uintptr(unsafe.Pointer(requiredSize)), uintptr(unsafe.Pointer(machineName)), uintptr(reserved)) + r1, _, e1 := syscall.SyscallN(procSetupDiClassGuidsFromNameExW.Addr(), uintptr(unsafe.Pointer(className)), uintptr(unsafe.Pointer(classGuidList)), uintptr(classGuidListSize), uintptr(unsafe.Pointer(requiredSize)), uintptr(unsafe.Pointer(machineName)), uintptr(reserved)) if r1 == 0 { err = errnoErr(e1) } @@ -3926,7 +3945,7 @@ func setupDiClassGuidsFromNameEx(className *uint16, classGuidList *GUID, classGu } func setupDiClassNameFromGuidEx(classGUID *GUID, className *uint16, classNameSize uint32, requiredSize *uint32, machineName *uint16, reserved uintptr) (err error) { - r1, _, e1 := syscall.Syscall6(procSetupDiClassNameFromGuidExW.Addr(), 6, uintptr(unsafe.Pointer(classGUID)), uintptr(unsafe.Pointer(className)), uintptr(classNameSize), uintptr(unsafe.Pointer(requiredSize)), uintptr(unsafe.Pointer(machineName)), uintptr(reserved)) + r1, _, e1 := syscall.SyscallN(procSetupDiClassNameFromGuidExW.Addr(), uintptr(unsafe.Pointer(classGUID)), uintptr(unsafe.Pointer(className)), uintptr(classNameSize), uintptr(unsafe.Pointer(requiredSize)), uintptr(unsafe.Pointer(machineName)), uintptr(reserved)) if r1 == 0 { err = errnoErr(e1) } @@ -3934,7 +3953,7 @@ func setupDiClassNameFromGuidEx(classGUID *GUID, className *uint16, classNameSiz } func setupDiCreateDeviceInfoListEx(classGUID *GUID, hwndParent uintptr, machineName *uint16, reserved uintptr) (handle DevInfo, err error) { - r0, _, e1 := syscall.Syscall6(procSetupDiCreateDeviceInfoListExW.Addr(), 4, uintptr(unsafe.Pointer(classGUID)), uintptr(hwndParent), uintptr(unsafe.Pointer(machineName)), uintptr(reserved), 0, 0) + r0, _, e1 := syscall.SyscallN(procSetupDiCreateDeviceInfoListExW.Addr(), uintptr(unsafe.Pointer(classGUID)), uintptr(hwndParent), uintptr(unsafe.Pointer(machineName)), uintptr(reserved)) handle = DevInfo(r0) if handle == DevInfo(InvalidHandle) { err = errnoErr(e1) @@ -3943,7 +3962,7 @@ func setupDiCreateDeviceInfoListEx(classGUID *GUID, hwndParent uintptr, machineN } func setupDiCreateDeviceInfo(deviceInfoSet DevInfo, DeviceName *uint16, classGUID *GUID, DeviceDescription *uint16, hwndParent uintptr, CreationFlags DICD, deviceInfoData *DevInfoData) (err error) { - r1, _, e1 := syscall.Syscall9(procSetupDiCreateDeviceInfoW.Addr(), 7, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(DeviceName)), uintptr(unsafe.Pointer(classGUID)), uintptr(unsafe.Pointer(DeviceDescription)), uintptr(hwndParent), uintptr(CreationFlags), uintptr(unsafe.Pointer(deviceInfoData)), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetupDiCreateDeviceInfoW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(DeviceName)), uintptr(unsafe.Pointer(classGUID)), uintptr(unsafe.Pointer(DeviceDescription)), uintptr(hwndParent), uintptr(CreationFlags), uintptr(unsafe.Pointer(deviceInfoData))) if r1 == 0 { err = errnoErr(e1) } @@ -3951,7 +3970,7 @@ func setupDiCreateDeviceInfo(deviceInfoSet DevInfo, DeviceName *uint16, classGUI } func SetupDiDestroyDeviceInfoList(deviceInfoSet DevInfo) (err error) { - r1, _, e1 := syscall.Syscall(procSetupDiDestroyDeviceInfoList.Addr(), 1, uintptr(deviceInfoSet), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetupDiDestroyDeviceInfoList.Addr(), uintptr(deviceInfoSet)) if r1 == 0 { err = errnoErr(e1) } @@ -3959,7 +3978,7 @@ func SetupDiDestroyDeviceInfoList(deviceInfoSet DevInfo) (err error) { } func SetupDiDestroyDriverInfoList(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverType SPDIT) (err error) { - r1, _, e1 := syscall.Syscall(procSetupDiDestroyDriverInfoList.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(driverType)) + r1, _, e1 := syscall.SyscallN(procSetupDiDestroyDriverInfoList.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(driverType)) if r1 == 0 { err = errnoErr(e1) } @@ -3967,7 +3986,7 @@ func SetupDiDestroyDriverInfoList(deviceInfoSet DevInfo, deviceInfoData *DevInfo } func setupDiEnumDeviceInfo(deviceInfoSet DevInfo, memberIndex uint32, deviceInfoData *DevInfoData) (err error) { - r1, _, e1 := syscall.Syscall(procSetupDiEnumDeviceInfo.Addr(), 3, uintptr(deviceInfoSet), uintptr(memberIndex), uintptr(unsafe.Pointer(deviceInfoData))) + r1, _, e1 := syscall.SyscallN(procSetupDiEnumDeviceInfo.Addr(), uintptr(deviceInfoSet), uintptr(memberIndex), uintptr(unsafe.Pointer(deviceInfoData))) if r1 == 0 { err = errnoErr(e1) } @@ -3975,7 +3994,7 @@ func setupDiEnumDeviceInfo(deviceInfoSet DevInfo, memberIndex uint32, deviceInfo } func setupDiEnumDriverInfo(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverType SPDIT, memberIndex uint32, driverInfoData *DrvInfoData) (err error) { - r1, _, e1 := syscall.Syscall6(procSetupDiEnumDriverInfoW.Addr(), 5, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(driverType), uintptr(memberIndex), uintptr(unsafe.Pointer(driverInfoData)), 0) + r1, _, e1 := syscall.SyscallN(procSetupDiEnumDriverInfoW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(driverType), uintptr(memberIndex), uintptr(unsafe.Pointer(driverInfoData))) if r1 == 0 { err = errnoErr(e1) } @@ -3983,7 +4002,7 @@ func setupDiEnumDriverInfo(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, d } func setupDiGetClassDevsEx(classGUID *GUID, Enumerator *uint16, hwndParent uintptr, Flags DIGCF, deviceInfoSet DevInfo, machineName *uint16, reserved uintptr) (handle DevInfo, err error) { - r0, _, e1 := syscall.Syscall9(procSetupDiGetClassDevsExW.Addr(), 7, uintptr(unsafe.Pointer(classGUID)), uintptr(unsafe.Pointer(Enumerator)), uintptr(hwndParent), uintptr(Flags), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(machineName)), uintptr(reserved), 0, 0) + r0, _, e1 := syscall.SyscallN(procSetupDiGetClassDevsExW.Addr(), uintptr(unsafe.Pointer(classGUID)), uintptr(unsafe.Pointer(Enumerator)), uintptr(hwndParent), uintptr(Flags), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(machineName)), uintptr(reserved)) handle = DevInfo(r0) if handle == DevInfo(InvalidHandle) { err = errnoErr(e1) @@ -3992,7 +4011,7 @@ func setupDiGetClassDevsEx(classGUID *GUID, Enumerator *uint16, hwndParent uintp } func SetupDiGetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, classInstallParams *ClassInstallHeader, classInstallParamsSize uint32, requiredSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procSetupDiGetClassInstallParamsW.Addr(), 5, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(classInstallParams)), uintptr(classInstallParamsSize), uintptr(unsafe.Pointer(requiredSize)), 0) + r1, _, e1 := syscall.SyscallN(procSetupDiGetClassInstallParamsW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(classInstallParams)), uintptr(classInstallParamsSize), uintptr(unsafe.Pointer(requiredSize))) if r1 == 0 { err = errnoErr(e1) } @@ -4000,7 +4019,7 @@ func SetupDiGetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfo } func setupDiGetDeviceInfoListDetail(deviceInfoSet DevInfo, deviceInfoSetDetailData *DevInfoListDetailData) (err error) { - r1, _, e1 := syscall.Syscall(procSetupDiGetDeviceInfoListDetailW.Addr(), 2, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoSetDetailData)), 0) + r1, _, e1 := syscall.SyscallN(procSetupDiGetDeviceInfoListDetailW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoSetDetailData))) if r1 == 0 { err = errnoErr(e1) } @@ -4008,7 +4027,7 @@ func setupDiGetDeviceInfoListDetail(deviceInfoSet DevInfo, deviceInfoSetDetailDa } func setupDiGetDeviceInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, deviceInstallParams *DevInstallParams) (err error) { - r1, _, e1 := syscall.Syscall(procSetupDiGetDeviceInstallParamsW.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(deviceInstallParams))) + r1, _, e1 := syscall.SyscallN(procSetupDiGetDeviceInstallParamsW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(deviceInstallParams))) if r1 == 0 { err = errnoErr(e1) } @@ -4016,7 +4035,7 @@ func setupDiGetDeviceInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInf } func setupDiGetDeviceInstanceId(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, instanceId *uint16, instanceIdSize uint32, instanceIdRequiredSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procSetupDiGetDeviceInstanceIdW.Addr(), 5, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(instanceId)), uintptr(instanceIdSize), uintptr(unsafe.Pointer(instanceIdRequiredSize)), 0) + r1, _, e1 := syscall.SyscallN(procSetupDiGetDeviceInstanceIdW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(instanceId)), uintptr(instanceIdSize), uintptr(unsafe.Pointer(instanceIdRequiredSize))) if r1 == 0 { err = errnoErr(e1) } @@ -4024,7 +4043,7 @@ func setupDiGetDeviceInstanceId(deviceInfoSet DevInfo, deviceInfoData *DevInfoDa } func setupDiGetDeviceProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, propertyKey *DEVPROPKEY, propertyType *DEVPROPTYPE, propertyBuffer *byte, propertyBufferSize uint32, requiredSize *uint32, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procSetupDiGetDevicePropertyW.Addr(), 8, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(propertyKey)), uintptr(unsafe.Pointer(propertyType)), uintptr(unsafe.Pointer(propertyBuffer)), uintptr(propertyBufferSize), uintptr(unsafe.Pointer(requiredSize)), uintptr(flags), 0) + r1, _, e1 := syscall.SyscallN(procSetupDiGetDevicePropertyW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(propertyKey)), uintptr(unsafe.Pointer(propertyType)), uintptr(unsafe.Pointer(propertyBuffer)), uintptr(propertyBufferSize), uintptr(unsafe.Pointer(requiredSize)), uintptr(flags)) if r1 == 0 { err = errnoErr(e1) } @@ -4032,7 +4051,7 @@ func setupDiGetDeviceProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData } func setupDiGetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, property SPDRP, propertyRegDataType *uint32, propertyBuffer *byte, propertyBufferSize uint32, requiredSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procSetupDiGetDeviceRegistryPropertyW.Addr(), 7, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(property), uintptr(unsafe.Pointer(propertyRegDataType)), uintptr(unsafe.Pointer(propertyBuffer)), uintptr(propertyBufferSize), uintptr(unsafe.Pointer(requiredSize)), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetupDiGetDeviceRegistryPropertyW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(property), uintptr(unsafe.Pointer(propertyRegDataType)), uintptr(unsafe.Pointer(propertyBuffer)), uintptr(propertyBufferSize), uintptr(unsafe.Pointer(requiredSize))) if r1 == 0 { err = errnoErr(e1) } @@ -4040,7 +4059,7 @@ func setupDiGetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *Dev } func setupDiGetDriverInfoDetail(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverInfoData *DrvInfoData, driverInfoDetailData *DrvInfoDetailData, driverInfoDetailDataSize uint32, requiredSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procSetupDiGetDriverInfoDetailW.Addr(), 6, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(driverInfoData)), uintptr(unsafe.Pointer(driverInfoDetailData)), uintptr(driverInfoDetailDataSize), uintptr(unsafe.Pointer(requiredSize))) + r1, _, e1 := syscall.SyscallN(procSetupDiGetDriverInfoDetailW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(driverInfoData)), uintptr(unsafe.Pointer(driverInfoDetailData)), uintptr(driverInfoDetailDataSize), uintptr(unsafe.Pointer(requiredSize))) if r1 == 0 { err = errnoErr(e1) } @@ -4048,7 +4067,7 @@ func setupDiGetDriverInfoDetail(deviceInfoSet DevInfo, deviceInfoData *DevInfoDa } func setupDiGetSelectedDevice(deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (err error) { - r1, _, e1 := syscall.Syscall(procSetupDiGetSelectedDevice.Addr(), 2, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), 0) + r1, _, e1 := syscall.SyscallN(procSetupDiGetSelectedDevice.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData))) if r1 == 0 { err = errnoErr(e1) } @@ -4056,7 +4075,7 @@ func setupDiGetSelectedDevice(deviceInfoSet DevInfo, deviceInfoData *DevInfoData } func setupDiGetSelectedDriver(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverInfoData *DrvInfoData) (err error) { - r1, _, e1 := syscall.Syscall(procSetupDiGetSelectedDriverW.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(driverInfoData))) + r1, _, e1 := syscall.SyscallN(procSetupDiGetSelectedDriverW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(driverInfoData))) if r1 == 0 { err = errnoErr(e1) } @@ -4064,7 +4083,7 @@ func setupDiGetSelectedDriver(deviceInfoSet DevInfo, deviceInfoData *DevInfoData } func SetupDiOpenDevRegKey(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, Scope DICS_FLAG, HwProfile uint32, KeyType DIREG, samDesired uint32) (key Handle, err error) { - r0, _, e1 := syscall.Syscall6(procSetupDiOpenDevRegKey.Addr(), 6, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(Scope), uintptr(HwProfile), uintptr(KeyType), uintptr(samDesired)) + r0, _, e1 := syscall.SyscallN(procSetupDiOpenDevRegKey.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(Scope), uintptr(HwProfile), uintptr(KeyType), uintptr(samDesired)) key = Handle(r0) if key == InvalidHandle { err = errnoErr(e1) @@ -4073,7 +4092,7 @@ func SetupDiOpenDevRegKey(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, Sc } func SetupDiSetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, classInstallParams *ClassInstallHeader, classInstallParamsSize uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procSetupDiSetClassInstallParamsW.Addr(), 4, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(classInstallParams)), uintptr(classInstallParamsSize), 0, 0) + r1, _, e1 := syscall.SyscallN(procSetupDiSetClassInstallParamsW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(classInstallParams)), uintptr(classInstallParamsSize)) if r1 == 0 { err = errnoErr(e1) } @@ -4081,7 +4100,7 @@ func SetupDiSetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfo } func SetupDiSetDeviceInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, deviceInstallParams *DevInstallParams) (err error) { - r1, _, e1 := syscall.Syscall(procSetupDiSetDeviceInstallParamsW.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(deviceInstallParams))) + r1, _, e1 := syscall.SyscallN(procSetupDiSetDeviceInstallParamsW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(deviceInstallParams))) if r1 == 0 { err = errnoErr(e1) } @@ -4089,7 +4108,7 @@ func SetupDiSetDeviceInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInf } func setupDiSetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, property SPDRP, propertyBuffer *byte, propertyBufferSize uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procSetupDiSetDeviceRegistryPropertyW.Addr(), 5, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(property), uintptr(unsafe.Pointer(propertyBuffer)), uintptr(propertyBufferSize), 0) + r1, _, e1 := syscall.SyscallN(procSetupDiSetDeviceRegistryPropertyW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(property), uintptr(unsafe.Pointer(propertyBuffer)), uintptr(propertyBufferSize)) if r1 == 0 { err = errnoErr(e1) } @@ -4097,7 +4116,7 @@ func setupDiSetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *Dev } func SetupDiSetSelectedDevice(deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (err error) { - r1, _, e1 := syscall.Syscall(procSetupDiSetSelectedDevice.Addr(), 2, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), 0) + r1, _, e1 := syscall.SyscallN(procSetupDiSetSelectedDevice.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData))) if r1 == 0 { err = errnoErr(e1) } @@ -4105,7 +4124,7 @@ func SetupDiSetSelectedDevice(deviceInfoSet DevInfo, deviceInfoData *DevInfoData } func SetupDiSetSelectedDriver(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverInfoData *DrvInfoData) (err error) { - r1, _, e1 := syscall.Syscall(procSetupDiSetSelectedDriverW.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(driverInfoData))) + r1, _, e1 := syscall.SyscallN(procSetupDiSetSelectedDriverW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(driverInfoData))) if r1 == 0 { err = errnoErr(e1) } @@ -4113,7 +4132,7 @@ func SetupDiSetSelectedDriver(deviceInfoSet DevInfo, deviceInfoData *DevInfoData } func setupUninstallOEMInf(infFileName *uint16, flags SUOI, reserved uintptr) (err error) { - r1, _, e1 := syscall.Syscall(procSetupUninstallOEMInfW.Addr(), 3, uintptr(unsafe.Pointer(infFileName)), uintptr(flags), uintptr(reserved)) + r1, _, e1 := syscall.SyscallN(procSetupUninstallOEMInfW.Addr(), uintptr(unsafe.Pointer(infFileName)), uintptr(flags), uintptr(reserved)) if r1 == 0 { err = errnoErr(e1) } @@ -4121,7 +4140,7 @@ func setupUninstallOEMInf(infFileName *uint16, flags SUOI, reserved uintptr) (er } func commandLineToArgv(cmd *uint16, argc *int32) (argv **uint16, err error) { - r0, _, e1 := syscall.Syscall(procCommandLineToArgvW.Addr(), 2, uintptr(unsafe.Pointer(cmd)), uintptr(unsafe.Pointer(argc)), 0) + r0, _, e1 := syscall.SyscallN(procCommandLineToArgvW.Addr(), uintptr(unsafe.Pointer(cmd)), uintptr(unsafe.Pointer(argc))) argv = (**uint16)(unsafe.Pointer(r0)) if argv == nil { err = errnoErr(e1) @@ -4130,7 +4149,7 @@ func commandLineToArgv(cmd *uint16, argc *int32) (argv **uint16, err error) { } func shGetKnownFolderPath(id *KNOWNFOLDERID, flags uint32, token Token, path **uint16) (ret error) { - r0, _, _ := syscall.Syscall6(procSHGetKnownFolderPath.Addr(), 4, uintptr(unsafe.Pointer(id)), uintptr(flags), uintptr(token), uintptr(unsafe.Pointer(path)), 0, 0) + r0, _, _ := syscall.SyscallN(procSHGetKnownFolderPath.Addr(), uintptr(unsafe.Pointer(id)), uintptr(flags), uintptr(token), uintptr(unsafe.Pointer(path))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -4138,7 +4157,7 @@ func shGetKnownFolderPath(id *KNOWNFOLDERID, flags uint32, token Token, path **u } func ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int32) (err error) { - r1, _, e1 := syscall.Syscall6(procShellExecuteW.Addr(), 6, uintptr(hwnd), uintptr(unsafe.Pointer(verb)), uintptr(unsafe.Pointer(file)), uintptr(unsafe.Pointer(args)), uintptr(unsafe.Pointer(cwd)), uintptr(showCmd)) + r1, _, e1 := syscall.SyscallN(procShellExecuteW.Addr(), uintptr(hwnd), uintptr(unsafe.Pointer(verb)), uintptr(unsafe.Pointer(file)), uintptr(unsafe.Pointer(args)), uintptr(unsafe.Pointer(cwd)), uintptr(showCmd)) if r1 <= 32 { err = errnoErr(e1) } @@ -4146,12 +4165,12 @@ func ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *ui } func EnumChildWindows(hwnd HWND, enumFunc uintptr, param unsafe.Pointer) { - syscall.Syscall(procEnumChildWindows.Addr(), 3, uintptr(hwnd), uintptr(enumFunc), uintptr(param)) + syscall.SyscallN(procEnumChildWindows.Addr(), uintptr(hwnd), uintptr(enumFunc), uintptr(param)) return } func EnumWindows(enumFunc uintptr, param unsafe.Pointer) (err error) { - r1, _, e1 := syscall.Syscall(procEnumWindows.Addr(), 2, uintptr(enumFunc), uintptr(param), 0) + r1, _, e1 := syscall.SyscallN(procEnumWindows.Addr(), uintptr(enumFunc), uintptr(param)) if r1 == 0 { err = errnoErr(e1) } @@ -4159,7 +4178,7 @@ func EnumWindows(enumFunc uintptr, param unsafe.Pointer) (err error) { } func ExitWindowsEx(flags uint32, reason uint32) (err error) { - r1, _, e1 := syscall.Syscall(procExitWindowsEx.Addr(), 2, uintptr(flags), uintptr(reason), 0) + r1, _, e1 := syscall.SyscallN(procExitWindowsEx.Addr(), uintptr(flags), uintptr(reason)) if r1 == 0 { err = errnoErr(e1) } @@ -4167,7 +4186,7 @@ func ExitWindowsEx(flags uint32, reason uint32) (err error) { } func GetClassName(hwnd HWND, className *uint16, maxCount int32) (copied int32, err error) { - r0, _, e1 := syscall.Syscall(procGetClassNameW.Addr(), 3, uintptr(hwnd), uintptr(unsafe.Pointer(className)), uintptr(maxCount)) + r0, _, e1 := syscall.SyscallN(procGetClassNameW.Addr(), uintptr(hwnd), uintptr(unsafe.Pointer(className)), uintptr(maxCount)) copied = int32(r0) if copied == 0 { err = errnoErr(e1) @@ -4176,19 +4195,19 @@ func GetClassName(hwnd HWND, className *uint16, maxCount int32) (copied int32, e } func GetDesktopWindow() (hwnd HWND) { - r0, _, _ := syscall.Syscall(procGetDesktopWindow.Addr(), 0, 0, 0, 0) + r0, _, _ := syscall.SyscallN(procGetDesktopWindow.Addr()) hwnd = HWND(r0) return } func GetForegroundWindow() (hwnd HWND) { - r0, _, _ := syscall.Syscall(procGetForegroundWindow.Addr(), 0, 0, 0, 0) + r0, _, _ := syscall.SyscallN(procGetForegroundWindow.Addr()) hwnd = HWND(r0) return } func GetGUIThreadInfo(thread uint32, info *GUIThreadInfo) (err error) { - r1, _, e1 := syscall.Syscall(procGetGUIThreadInfo.Addr(), 2, uintptr(thread), uintptr(unsafe.Pointer(info)), 0) + r1, _, e1 := syscall.SyscallN(procGetGUIThreadInfo.Addr(), uintptr(thread), uintptr(unsafe.Pointer(info))) if r1 == 0 { err = errnoErr(e1) } @@ -4196,19 +4215,19 @@ func GetGUIThreadInfo(thread uint32, info *GUIThreadInfo) (err error) { } func GetKeyboardLayout(tid uint32) (hkl Handle) { - r0, _, _ := syscall.Syscall(procGetKeyboardLayout.Addr(), 1, uintptr(tid), 0, 0) + r0, _, _ := syscall.SyscallN(procGetKeyboardLayout.Addr(), uintptr(tid)) hkl = Handle(r0) return } func GetShellWindow() (shellWindow HWND) { - r0, _, _ := syscall.Syscall(procGetShellWindow.Addr(), 0, 0, 0, 0) + r0, _, _ := syscall.SyscallN(procGetShellWindow.Addr()) shellWindow = HWND(r0) return } func GetWindowThreadProcessId(hwnd HWND, pid *uint32) (tid uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetWindowThreadProcessId.Addr(), 2, uintptr(hwnd), uintptr(unsafe.Pointer(pid)), 0) + r0, _, e1 := syscall.SyscallN(procGetWindowThreadProcessId.Addr(), uintptr(hwnd), uintptr(unsafe.Pointer(pid))) tid = uint32(r0) if tid == 0 { err = errnoErr(e1) @@ -4217,25 +4236,25 @@ func GetWindowThreadProcessId(hwnd HWND, pid *uint32) (tid uint32, err error) { } func IsWindow(hwnd HWND) (isWindow bool) { - r0, _, _ := syscall.Syscall(procIsWindow.Addr(), 1, uintptr(hwnd), 0, 0) + r0, _, _ := syscall.SyscallN(procIsWindow.Addr(), uintptr(hwnd)) isWindow = r0 != 0 return } func IsWindowUnicode(hwnd HWND) (isUnicode bool) { - r0, _, _ := syscall.Syscall(procIsWindowUnicode.Addr(), 1, uintptr(hwnd), 0, 0) + r0, _, _ := syscall.SyscallN(procIsWindowUnicode.Addr(), uintptr(hwnd)) isUnicode = r0 != 0 return } func IsWindowVisible(hwnd HWND) (isVisible bool) { - r0, _, _ := syscall.Syscall(procIsWindowVisible.Addr(), 1, uintptr(hwnd), 0, 0) + r0, _, _ := syscall.SyscallN(procIsWindowVisible.Addr(), uintptr(hwnd)) isVisible = r0 != 0 return } func LoadKeyboardLayout(name *uint16, flags uint32) (hkl Handle, err error) { - r0, _, e1 := syscall.Syscall(procLoadKeyboardLayoutW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(flags), 0) + r0, _, e1 := syscall.SyscallN(procLoadKeyboardLayoutW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(flags)) hkl = Handle(r0) if hkl == 0 { err = errnoErr(e1) @@ -4244,7 +4263,7 @@ func LoadKeyboardLayout(name *uint16, flags uint32) (hkl Handle, err error) { } func MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) { - r0, _, e1 := syscall.Syscall6(procMessageBoxW.Addr(), 4, uintptr(hwnd), uintptr(unsafe.Pointer(text)), uintptr(unsafe.Pointer(caption)), uintptr(boxtype), 0, 0) + r0, _, e1 := syscall.SyscallN(procMessageBoxW.Addr(), uintptr(hwnd), uintptr(unsafe.Pointer(text)), uintptr(unsafe.Pointer(caption)), uintptr(boxtype)) ret = int32(r0) if ret == 0 { err = errnoErr(e1) @@ -4253,13 +4272,13 @@ func MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret i } func ToUnicodeEx(vkey uint32, scancode uint32, keystate *byte, pwszBuff *uint16, cchBuff int32, flags uint32, hkl Handle) (ret int32) { - r0, _, _ := syscall.Syscall9(procToUnicodeEx.Addr(), 7, uintptr(vkey), uintptr(scancode), uintptr(unsafe.Pointer(keystate)), uintptr(unsafe.Pointer(pwszBuff)), uintptr(cchBuff), uintptr(flags), uintptr(hkl), 0, 0) + r0, _, _ := syscall.SyscallN(procToUnicodeEx.Addr(), uintptr(vkey), uintptr(scancode), uintptr(unsafe.Pointer(keystate)), uintptr(unsafe.Pointer(pwszBuff)), uintptr(cchBuff), uintptr(flags), uintptr(hkl)) ret = int32(r0) return } func UnloadKeyboardLayout(hkl Handle) (err error) { - r1, _, e1 := syscall.Syscall(procUnloadKeyboardLayout.Addr(), 1, uintptr(hkl), 0, 0) + r1, _, e1 := syscall.SyscallN(procUnloadKeyboardLayout.Addr(), uintptr(hkl)) if r1 == 0 { err = errnoErr(e1) } @@ -4271,7 +4290,7 @@ func CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) ( if inheritExisting { _p0 = 1 } - r1, _, e1 := syscall.Syscall(procCreateEnvironmentBlock.Addr(), 3, uintptr(unsafe.Pointer(block)), uintptr(token), uintptr(_p0)) + r1, _, e1 := syscall.SyscallN(procCreateEnvironmentBlock.Addr(), uintptr(unsafe.Pointer(block)), uintptr(token), uintptr(_p0)) if r1 == 0 { err = errnoErr(e1) } @@ -4279,7 +4298,7 @@ func CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) ( } func DestroyEnvironmentBlock(block *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procDestroyEnvironmentBlock.Addr(), 1, uintptr(unsafe.Pointer(block)), 0, 0) + r1, _, e1 := syscall.SyscallN(procDestroyEnvironmentBlock.Addr(), uintptr(unsafe.Pointer(block))) if r1 == 0 { err = errnoErr(e1) } @@ -4287,7 +4306,7 @@ func DestroyEnvironmentBlock(block *uint16) (err error) { } func GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetUserProfileDirectoryW.Addr(), 3, uintptr(t), uintptr(unsafe.Pointer(dir)), uintptr(unsafe.Pointer(dirLen))) + r1, _, e1 := syscall.SyscallN(procGetUserProfileDirectoryW.Addr(), uintptr(t), uintptr(unsafe.Pointer(dir)), uintptr(unsafe.Pointer(dirLen))) if r1 == 0 { err = errnoErr(e1) } @@ -4304,7 +4323,7 @@ func GetFileVersionInfoSize(filename string, zeroHandle *Handle) (bufSize uint32 } func _GetFileVersionInfoSize(filename *uint16, zeroHandle *Handle) (bufSize uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetFileVersionInfoSizeW.Addr(), 2, uintptr(unsafe.Pointer(filename)), uintptr(unsafe.Pointer(zeroHandle)), 0) + r0, _, e1 := syscall.SyscallN(procGetFileVersionInfoSizeW.Addr(), uintptr(unsafe.Pointer(filename)), uintptr(unsafe.Pointer(zeroHandle))) bufSize = uint32(r0) if bufSize == 0 { err = errnoErr(e1) @@ -4322,7 +4341,7 @@ func GetFileVersionInfo(filename string, handle uint32, bufSize uint32, buffer u } func _GetFileVersionInfo(filename *uint16, handle uint32, bufSize uint32, buffer unsafe.Pointer) (err error) { - r1, _, e1 := syscall.Syscall6(procGetFileVersionInfoW.Addr(), 4, uintptr(unsafe.Pointer(filename)), uintptr(handle), uintptr(bufSize), uintptr(buffer), 0, 0) + r1, _, e1 := syscall.SyscallN(procGetFileVersionInfoW.Addr(), uintptr(unsafe.Pointer(filename)), uintptr(handle), uintptr(bufSize), uintptr(buffer)) if r1 == 0 { err = errnoErr(e1) } @@ -4339,7 +4358,7 @@ func VerQueryValue(block unsafe.Pointer, subBlock string, pointerToBufferPointer } func _VerQueryValue(block unsafe.Pointer, subBlock *uint16, pointerToBufferPointer unsafe.Pointer, bufSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procVerQueryValueW.Addr(), 4, uintptr(block), uintptr(unsafe.Pointer(subBlock)), uintptr(pointerToBufferPointer), uintptr(unsafe.Pointer(bufSize)), 0, 0) + r1, _, e1 := syscall.SyscallN(procVerQueryValueW.Addr(), uintptr(block), uintptr(unsafe.Pointer(subBlock)), uintptr(pointerToBufferPointer), uintptr(unsafe.Pointer(bufSize))) if r1 == 0 { err = errnoErr(e1) } @@ -4347,7 +4366,7 @@ func _VerQueryValue(block unsafe.Pointer, subBlock *uint16, pointerToBufferPoint } func TimeBeginPeriod(period uint32) (err error) { - r1, _, e1 := syscall.Syscall(proctimeBeginPeriod.Addr(), 1, uintptr(period), 0, 0) + r1, _, e1 := syscall.SyscallN(proctimeBeginPeriod.Addr(), uintptr(period)) if r1 != 0 { err = errnoErr(e1) } @@ -4355,7 +4374,7 @@ func TimeBeginPeriod(period uint32) (err error) { } func TimeEndPeriod(period uint32) (err error) { - r1, _, e1 := syscall.Syscall(proctimeEndPeriod.Addr(), 1, uintptr(period), 0, 0) + r1, _, e1 := syscall.SyscallN(proctimeEndPeriod.Addr(), uintptr(period)) if r1 != 0 { err = errnoErr(e1) } @@ -4363,7 +4382,7 @@ func TimeEndPeriod(period uint32) (err error) { } func WinVerifyTrustEx(hwnd HWND, actionId *GUID, data *WinTrustData) (ret error) { - r0, _, _ := syscall.Syscall(procWinVerifyTrustEx.Addr(), 3, uintptr(hwnd), uintptr(unsafe.Pointer(actionId)), uintptr(unsafe.Pointer(data))) + r0, _, _ := syscall.SyscallN(procWinVerifyTrustEx.Addr(), uintptr(hwnd), uintptr(unsafe.Pointer(actionId)), uintptr(unsafe.Pointer(data))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -4371,12 +4390,12 @@ func WinVerifyTrustEx(hwnd HWND, actionId *GUID, data *WinTrustData) (ret error) } func FreeAddrInfoW(addrinfo *AddrinfoW) { - syscall.Syscall(procFreeAddrInfoW.Addr(), 1, uintptr(unsafe.Pointer(addrinfo)), 0, 0) + syscall.SyscallN(procFreeAddrInfoW.Addr(), uintptr(unsafe.Pointer(addrinfo))) return } func GetAddrInfoW(nodename *uint16, servicename *uint16, hints *AddrinfoW, result **AddrinfoW) (sockerr error) { - r0, _, _ := syscall.Syscall6(procGetAddrInfoW.Addr(), 4, uintptr(unsafe.Pointer(nodename)), uintptr(unsafe.Pointer(servicename)), uintptr(unsafe.Pointer(hints)), uintptr(unsafe.Pointer(result)), 0, 0) + r0, _, _ := syscall.SyscallN(procGetAddrInfoW.Addr(), uintptr(unsafe.Pointer(nodename)), uintptr(unsafe.Pointer(servicename)), uintptr(unsafe.Pointer(hints)), uintptr(unsafe.Pointer(result))) if r0 != 0 { sockerr = syscall.Errno(r0) } @@ -4384,15 +4403,23 @@ func GetAddrInfoW(nodename *uint16, servicename *uint16, hints *AddrinfoW, resul } func WSACleanup() (err error) { - r1, _, e1 := syscall.Syscall(procWSACleanup.Addr(), 0, 0, 0, 0) + r1, _, e1 := syscall.SyscallN(procWSACleanup.Addr()) if r1 == socket_error { err = errnoErr(e1) } return } +func WSADuplicateSocket(s Handle, processID uint32, info *WSAProtocolInfo) (err error) { + r1, _, e1 := syscall.SyscallN(procWSADuplicateSocketW.Addr(), uintptr(s), uintptr(processID), uintptr(unsafe.Pointer(info))) + if r1 != 0 { + err = errnoErr(e1) + } + return +} + func WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferLength *uint32) (n int32, err error) { - r0, _, e1 := syscall.Syscall(procWSAEnumProtocolsW.Addr(), 3, uintptr(unsafe.Pointer(protocols)), uintptr(unsafe.Pointer(protocolBuffer)), uintptr(unsafe.Pointer(bufferLength))) + r0, _, e1 := syscall.SyscallN(procWSAEnumProtocolsW.Addr(), uintptr(unsafe.Pointer(protocols)), uintptr(unsafe.Pointer(protocolBuffer)), uintptr(unsafe.Pointer(bufferLength))) n = int32(r0) if n == -1 { err = errnoErr(e1) @@ -4405,7 +4432,7 @@ func WSAGetOverlappedResult(h Handle, o *Overlapped, bytes *uint32, wait bool, f if wait { _p0 = 1 } - r1, _, e1 := syscall.Syscall6(procWSAGetOverlappedResult.Addr(), 5, uintptr(h), uintptr(unsafe.Pointer(o)), uintptr(unsafe.Pointer(bytes)), uintptr(_p0), uintptr(unsafe.Pointer(flags)), 0) + r1, _, e1 := syscall.SyscallN(procWSAGetOverlappedResult.Addr(), uintptr(h), uintptr(unsafe.Pointer(o)), uintptr(unsafe.Pointer(bytes)), uintptr(_p0), uintptr(unsafe.Pointer(flags))) if r1 == 0 { err = errnoErr(e1) } @@ -4413,7 +4440,7 @@ func WSAGetOverlappedResult(h Handle, o *Overlapped, bytes *uint32, wait bool, f } func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) { - r1, _, e1 := syscall.Syscall9(procWSAIoctl.Addr(), 9, uintptr(s), uintptr(iocc), uintptr(unsafe.Pointer(inbuf)), uintptr(cbif), uintptr(unsafe.Pointer(outbuf)), uintptr(cbob), uintptr(unsafe.Pointer(cbbr)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine)) + r1, _, e1 := syscall.SyscallN(procWSAIoctl.Addr(), uintptr(s), uintptr(iocc), uintptr(unsafe.Pointer(inbuf)), uintptr(cbif), uintptr(unsafe.Pointer(outbuf)), uintptr(cbob), uintptr(unsafe.Pointer(cbbr)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine)) if r1 == socket_error { err = errnoErr(e1) } @@ -4421,7 +4448,7 @@ func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbo } func WSALookupServiceBegin(querySet *WSAQUERYSET, flags uint32, handle *Handle) (err error) { - r1, _, e1 := syscall.Syscall(procWSALookupServiceBeginW.Addr(), 3, uintptr(unsafe.Pointer(querySet)), uintptr(flags), uintptr(unsafe.Pointer(handle))) + r1, _, e1 := syscall.SyscallN(procWSALookupServiceBeginW.Addr(), uintptr(unsafe.Pointer(querySet)), uintptr(flags), uintptr(unsafe.Pointer(handle))) if r1 == socket_error { err = errnoErr(e1) } @@ -4429,7 +4456,7 @@ func WSALookupServiceBegin(querySet *WSAQUERYSET, flags uint32, handle *Handle) } func WSALookupServiceEnd(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procWSALookupServiceEnd.Addr(), 1, uintptr(handle), 0, 0) + r1, _, e1 := syscall.SyscallN(procWSALookupServiceEnd.Addr(), uintptr(handle)) if r1 == socket_error { err = errnoErr(e1) } @@ -4437,7 +4464,7 @@ func WSALookupServiceEnd(handle Handle) (err error) { } func WSALookupServiceNext(handle Handle, flags uint32, size *int32, querySet *WSAQUERYSET) (err error) { - r1, _, e1 := syscall.Syscall6(procWSALookupServiceNextW.Addr(), 4, uintptr(handle), uintptr(flags), uintptr(unsafe.Pointer(size)), uintptr(unsafe.Pointer(querySet)), 0, 0) + r1, _, e1 := syscall.SyscallN(procWSALookupServiceNextW.Addr(), uintptr(handle), uintptr(flags), uintptr(unsafe.Pointer(size)), uintptr(unsafe.Pointer(querySet))) if r1 == socket_error { err = errnoErr(e1) } @@ -4445,7 +4472,7 @@ func WSALookupServiceNext(handle Handle, flags uint32, size *int32, querySet *WS } func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (err error) { - r1, _, e1 := syscall.Syscall9(procWSARecv.Addr(), 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0) + r1, _, e1 := syscall.SyscallN(procWSARecv.Addr(), uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) if r1 == socket_error { err = errnoErr(e1) } @@ -4453,7 +4480,7 @@ func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32 } func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (err error) { - r1, _, e1 := syscall.Syscall9(procWSARecvFrom.Addr(), 9, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) + r1, _, e1 := syscall.SyscallN(procWSARecvFrom.Addr(), uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) if r1 == socket_error { err = errnoErr(e1) } @@ -4461,7 +4488,7 @@ func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *ui } func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (err error) { - r1, _, e1 := syscall.Syscall9(procWSASend.Addr(), 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0) + r1, _, e1 := syscall.SyscallN(procWSASend.Addr(), uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) if r1 == socket_error { err = errnoErr(e1) } @@ -4469,7 +4496,7 @@ func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, } func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (err error) { - r1, _, e1 := syscall.Syscall9(procWSASendTo.Addr(), 9, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(to)), uintptr(tolen), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) + r1, _, e1 := syscall.SyscallN(procWSASendTo.Addr(), uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(to)), uintptr(tolen), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) if r1 == socket_error { err = errnoErr(e1) } @@ -4477,7 +4504,7 @@ func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32 } func WSASocket(af int32, typ int32, protocol int32, protoInfo *WSAProtocolInfo, group uint32, flags uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall6(procWSASocketW.Addr(), 6, uintptr(af), uintptr(typ), uintptr(protocol), uintptr(unsafe.Pointer(protoInfo)), uintptr(group), uintptr(flags)) + r0, _, e1 := syscall.SyscallN(procWSASocketW.Addr(), uintptr(af), uintptr(typ), uintptr(protocol), uintptr(unsafe.Pointer(protoInfo)), uintptr(group), uintptr(flags)) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -4486,7 +4513,7 @@ func WSASocket(af int32, typ int32, protocol int32, protoInfo *WSAProtocolInfo, } func WSAStartup(verreq uint32, data *WSAData) (sockerr error) { - r0, _, _ := syscall.Syscall(procWSAStartup.Addr(), 2, uintptr(verreq), uintptr(unsafe.Pointer(data)), 0) + r0, _, _ := syscall.SyscallN(procWSAStartup.Addr(), uintptr(verreq), uintptr(unsafe.Pointer(data))) if r0 != 0 { sockerr = syscall.Errno(r0) } @@ -4494,7 +4521,7 @@ func WSAStartup(verreq uint32, data *WSAData) (sockerr error) { } func bind(s Handle, name unsafe.Pointer, namelen int32) (err error) { - r1, _, e1 := syscall.Syscall(procbind.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen)) + r1, _, e1 := syscall.SyscallN(procbind.Addr(), uintptr(s), uintptr(name), uintptr(namelen)) if r1 == socket_error { err = errnoErr(e1) } @@ -4502,7 +4529,7 @@ func bind(s Handle, name unsafe.Pointer, namelen int32) (err error) { } func Closesocket(s Handle) (err error) { - r1, _, e1 := syscall.Syscall(procclosesocket.Addr(), 1, uintptr(s), 0, 0) + r1, _, e1 := syscall.SyscallN(procclosesocket.Addr(), uintptr(s)) if r1 == socket_error { err = errnoErr(e1) } @@ -4510,7 +4537,7 @@ func Closesocket(s Handle) (err error) { } func connect(s Handle, name unsafe.Pointer, namelen int32) (err error) { - r1, _, e1 := syscall.Syscall(procconnect.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen)) + r1, _, e1 := syscall.SyscallN(procconnect.Addr(), uintptr(s), uintptr(name), uintptr(namelen)) if r1 == socket_error { err = errnoErr(e1) } @@ -4527,7 +4554,7 @@ func GetHostByName(name string) (h *Hostent, err error) { } func _GetHostByName(name *byte) (h *Hostent, err error) { - r0, _, e1 := syscall.Syscall(procgethostbyname.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0) + r0, _, e1 := syscall.SyscallN(procgethostbyname.Addr(), uintptr(unsafe.Pointer(name))) h = (*Hostent)(unsafe.Pointer(r0)) if h == nil { err = errnoErr(e1) @@ -4536,7 +4563,7 @@ func _GetHostByName(name *byte) (h *Hostent, err error) { } func getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) { - r1, _, e1 := syscall.Syscall(procgetpeername.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + r1, _, e1 := syscall.SyscallN(procgetpeername.Addr(), uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if r1 == socket_error { err = errnoErr(e1) } @@ -4553,7 +4580,7 @@ func GetProtoByName(name string) (p *Protoent, err error) { } func _GetProtoByName(name *byte) (p *Protoent, err error) { - r0, _, e1 := syscall.Syscall(procgetprotobyname.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0) + r0, _, e1 := syscall.SyscallN(procgetprotobyname.Addr(), uintptr(unsafe.Pointer(name))) p = (*Protoent)(unsafe.Pointer(r0)) if p == nil { err = errnoErr(e1) @@ -4576,7 +4603,7 @@ func GetServByName(name string, proto string) (s *Servent, err error) { } func _GetServByName(name *byte, proto *byte) (s *Servent, err error) { - r0, _, e1 := syscall.Syscall(procgetservbyname.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(proto)), 0) + r0, _, e1 := syscall.SyscallN(procgetservbyname.Addr(), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(proto))) s = (*Servent)(unsafe.Pointer(r0)) if s == nil { err = errnoErr(e1) @@ -4585,7 +4612,7 @@ func _GetServByName(name *byte, proto *byte) (s *Servent, err error) { } func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) { - r1, _, e1 := syscall.Syscall(procgetsockname.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + r1, _, e1 := syscall.SyscallN(procgetsockname.Addr(), uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if r1 == socket_error { err = errnoErr(e1) } @@ -4593,7 +4620,7 @@ func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) { } func Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int32) (err error) { - r1, _, e1 := syscall.Syscall6(procgetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(unsafe.Pointer(optlen)), 0) + r1, _, e1 := syscall.SyscallN(procgetsockopt.Addr(), uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(unsafe.Pointer(optlen))) if r1 == socket_error { err = errnoErr(e1) } @@ -4601,7 +4628,7 @@ func Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int3 } func listen(s Handle, backlog int32) (err error) { - r1, _, e1 := syscall.Syscall(proclisten.Addr(), 2, uintptr(s), uintptr(backlog), 0) + r1, _, e1 := syscall.SyscallN(proclisten.Addr(), uintptr(s), uintptr(backlog)) if r1 == socket_error { err = errnoErr(e1) } @@ -4609,7 +4636,7 @@ func listen(s Handle, backlog int32) (err error) { } func Ntohs(netshort uint16) (u uint16) { - r0, _, _ := syscall.Syscall(procntohs.Addr(), 1, uintptr(netshort), 0, 0) + r0, _, _ := syscall.SyscallN(procntohs.Addr(), uintptr(netshort)) u = uint16(r0) return } @@ -4619,7 +4646,7 @@ func recvfrom(s Handle, buf []byte, flags int32, from *RawSockaddrAny, fromlen * if len(buf) > 0 { _p0 = &buf[0] } - r0, _, e1 := syscall.Syscall6(procrecvfrom.Addr(), 6, uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + r0, _, e1 := syscall.SyscallN(procrecvfrom.Addr(), uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int32(r0) if n == -1 { err = errnoErr(e1) @@ -4632,7 +4659,7 @@ func sendto(s Handle, buf []byte, flags int32, to unsafe.Pointer, tolen int32) ( if len(buf) > 0 { _p0 = &buf[0] } - r1, _, e1 := syscall.Syscall6(procsendto.Addr(), 6, uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(tolen)) + r1, _, e1 := syscall.SyscallN(procsendto.Addr(), uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(tolen)) if r1 == socket_error { err = errnoErr(e1) } @@ -4640,7 +4667,7 @@ func sendto(s Handle, buf []byte, flags int32, to unsafe.Pointer, tolen int32) ( } func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (err error) { - r1, _, e1 := syscall.Syscall6(procsetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(optlen), 0) + r1, _, e1 := syscall.SyscallN(procsetsockopt.Addr(), uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(optlen)) if r1 == socket_error { err = errnoErr(e1) } @@ -4648,7 +4675,7 @@ func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32 } func shutdown(s Handle, how int32) (err error) { - r1, _, e1 := syscall.Syscall(procshutdown.Addr(), 2, uintptr(s), uintptr(how), 0) + r1, _, e1 := syscall.SyscallN(procshutdown.Addr(), uintptr(s), uintptr(how)) if r1 == socket_error { err = errnoErr(e1) } @@ -4656,7 +4683,7 @@ func shutdown(s Handle, how int32) (err error) { } func socket(af int32, typ int32, protocol int32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procsocket.Addr(), 3, uintptr(af), uintptr(typ), uintptr(protocol)) + r0, _, e1 := syscall.SyscallN(procsocket.Addr(), uintptr(af), uintptr(typ), uintptr(protocol)) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -4665,7 +4692,7 @@ func socket(af int32, typ int32, protocol int32) (handle Handle, err error) { } func WTSEnumerateSessions(handle Handle, reserved uint32, version uint32, sessions **WTS_SESSION_INFO, count *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procWTSEnumerateSessionsW.Addr(), 5, uintptr(handle), uintptr(reserved), uintptr(version), uintptr(unsafe.Pointer(sessions)), uintptr(unsafe.Pointer(count)), 0) + r1, _, e1 := syscall.SyscallN(procWTSEnumerateSessionsW.Addr(), uintptr(handle), uintptr(reserved), uintptr(version), uintptr(unsafe.Pointer(sessions)), uintptr(unsafe.Pointer(count))) if r1 == 0 { err = errnoErr(e1) } @@ -4673,12 +4700,12 @@ func WTSEnumerateSessions(handle Handle, reserved uint32, version uint32, sessio } func WTSFreeMemory(ptr uintptr) { - syscall.Syscall(procWTSFreeMemory.Addr(), 1, uintptr(ptr), 0, 0) + syscall.SyscallN(procWTSFreeMemory.Addr(), uintptr(ptr)) return } func WTSQueryUserToken(session uint32, token *Token) (err error) { - r1, _, e1 := syscall.Syscall(procWTSQueryUserToken.Addr(), 2, uintptr(session), uintptr(unsafe.Pointer(token)), 0) + r1, _, e1 := syscall.SyscallN(procWTSQueryUserToken.Addr(), uintptr(session), uintptr(unsafe.Pointer(token))) if r1 == 0 { err = errnoErr(e1) } diff --git a/vendor/golang.org/x/text/unicode/bidi/core.go b/vendor/golang.org/x/text/unicode/bidi/core.go index 9d2ae547b..fb8273236 100644 --- a/vendor/golang.org/x/text/unicode/bidi/core.go +++ b/vendor/golang.org/x/text/unicode/bidi/core.go @@ -427,13 +427,6 @@ type isolatingRunSequence struct { func (i *isolatingRunSequence) Len() int { return len(i.indexes) } -func maxLevel(a, b level) level { - if a > b { - return a - } - return b -} - // Rule X10, second bullet: Determine the start-of-sequence (sos) and end-of-sequence (eos) types, // either L or R, for each isolating run sequence. func (p *paragraph) isolatingRunSequence(indexes []int) *isolatingRunSequence { @@ -474,8 +467,8 @@ func (p *paragraph) isolatingRunSequence(indexes []int) *isolatingRunSequence { indexes: indexes, types: types, level: level, - sos: typeForLevel(maxLevel(prevLevel, level)), - eos: typeForLevel(maxLevel(succLevel, level)), + sos: typeForLevel(max(prevLevel, level)), + eos: typeForLevel(max(succLevel, level)), } } diff --git a/vendor/google.golang.org/protobuf/encoding/prototext/decode.go b/vendor/google.golang.org/protobuf/encoding/prototext/decode.go index 24bc98ac4..b53805056 100644 --- a/vendor/google.golang.org/protobuf/encoding/prototext/decode.go +++ b/vendor/google.golang.org/protobuf/encoding/prototext/decode.go @@ -185,11 +185,6 @@ func (d decoder) unmarshalMessage(m protoreflect.Message, checkDelims bool) erro } else if xtErr != nil && xtErr != protoregistry.NotFound { return d.newError(tok.Pos(), "unable to resolve [%s]: %v", tok.RawString(), xtErr) } - if flags.ProtoLegacy { - if fd != nil && fd.IsWeak() && fd.Message().IsPlaceholder() { - fd = nil // reset since the weak reference is not linked in - } - } // Handle unknown fields. if fd == nil { diff --git a/vendor/google.golang.org/protobuf/encoding/protowire/wire.go b/vendor/google.golang.org/protobuf/encoding/protowire/wire.go index e942bc983..743bfb81d 100644 --- a/vendor/google.golang.org/protobuf/encoding/protowire/wire.go +++ b/vendor/google.golang.org/protobuf/encoding/protowire/wire.go @@ -371,7 +371,31 @@ func ConsumeVarint(b []byte) (v uint64, n int) { func SizeVarint(v uint64) int { // This computes 1 + (bits.Len64(v)-1)/7. // 9/64 is a good enough approximation of 1/7 - return int(9*uint32(bits.Len64(v))+64) / 64 + // + // The Go compiler can translate the bits.LeadingZeros64 call into the LZCNT + // instruction, which is very fast on CPUs from the last few years. The + // specific way of expressing the calculation matches C++ Protobuf, see + // https://godbolt.org/z/4P3h53oM4 for the C++ code and how gcc/clang + // optimize that function for GOAMD64=v1 and GOAMD64=v3 (-march=haswell). + + // By OR'ing v with 1, we guarantee that v is never 0, without changing the + // result of SizeVarint. LZCNT is not defined for 0, meaning the compiler + // needs to add extra instructions to handle that case. + // + // The Go compiler currently (go1.24.4) does not make use of this knowledge. + // This opportunity (removing the XOR instruction, which handles the 0 case) + // results in a small (1%) performance win across CPU architectures. + // + // Independently of avoiding the 0 case, we need the v |= 1 line because + // it allows the Go compiler to eliminate an extra XCHGL barrier. + v |= 1 + + // It would be clearer to write log2value := 63 - uint32(...), but + // writing uint32(...) ^ 63 is much more efficient (-14% ARM, -20% Intel). + // Proof of identity for our value range [0..63]: + // https://go.dev/play/p/Pdn9hEWYakX + log2value := uint32(bits.LeadingZeros64(v)) ^ 63 + return int((log2value*9 + (64 + 9)) / 64) } // AppendFixed32 appends v to b as a little-endian uint32. 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 ff6a38360..04696351e 100644 Binary files a/vendor/google.golang.org/protobuf/internal/editiondefaults/editions_defaults.binpb and b/vendor/google.golang.org/protobuf/internal/editiondefaults/editions_defaults.binpb differ diff --git a/vendor/google.golang.org/protobuf/internal/editionssupport/editions.go b/vendor/google.golang.org/protobuf/internal/editionssupport/editions.go index 029a6a12d..bf1aba0e8 100644 --- a/vendor/google.golang.org/protobuf/internal/editionssupport/editions.go +++ b/vendor/google.golang.org/protobuf/internal/editionssupport/editions.go @@ -5,9 +5,14 @@ // Package editionssupport defines constants for editions that are supported. package editionssupport -import descriptorpb "google.golang.org/protobuf/types/descriptorpb" +import "google.golang.org/protobuf/types/descriptorpb" const ( Minimum = descriptorpb.Edition_EDITION_PROTO2 Maximum = descriptorpb.Edition_EDITION_2023 + + // MaximumKnown is the maximum edition that is known to Go Protobuf, but not + // declared as supported. In other words: end users cannot use it, but + // testprotos inside Go Protobuf can. + MaximumKnown = descriptorpb.Edition_EDITION_2024 ) 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 7e87c7604..669133d04 100644 --- a/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go +++ b/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go @@ -26,7 +26,7 @@ var byteType = reflect.TypeOf(byte(0)) // The type is the underlying field type (e.g., a repeated field may be // represented by []T, but the Go type passed in is just T). // A list of enum value descriptors must be provided for enum fields. -// This does not populate the Enum or Message (except for weak message). +// This does not populate the Enum or Message. // // This function is a best effort attempt; parsing errors are ignored. func Unmarshal(tag string, goType reflect.Type, evs protoreflect.EnumValueDescriptors) protoreflect.FieldDescriptor { @@ -109,9 +109,6 @@ func Unmarshal(tag string, goType reflect.Type, evs protoreflect.EnumValueDescri } case s == "packed": f.L1.EditionFeatures.IsPacked = true - case strings.HasPrefix(s, "weak="): - f.L1.IsWeak = true - f.L1.Message = filedesc.PlaceholderMessage(protoreflect.FullName(s[len("weak="):])) case strings.HasPrefix(s, "def="): // The default tag is special in that everything afterwards is the // default regardless of the presence of commas. @@ -183,9 +180,6 @@ func Marshal(fd protoreflect.FieldDescriptor, enumName string) string { // the exact same semantics from the previous generator. tag = append(tag, "json="+jsonName) } - if fd.IsWeak() { - tag = append(tag, "weak="+string(fd.Message().FullName())) - } // The previous implementation does not tag extension fields as proto3, // even when the field is defined in a proto3 file. Match that behavior // for consistency. diff --git a/vendor/google.golang.org/protobuf/internal/errors/is_go112.go b/vendor/google.golang.org/protobuf/internal/errors/is_go112.go deleted file mode 100644 index fbcd34920..000000000 --- a/vendor/google.golang.org/protobuf/internal/errors/is_go112.go +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2020 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.13 -// +build !go1.13 - -package errors - -import "reflect" - -// Is is a copy of Go 1.13's errors.Is for use with older Go versions. -func Is(err, target error) bool { - if target == nil { - return err == target - } - - isComparable := reflect.TypeOf(target).Comparable() - for { - if isComparable && err == target { - return true - } - if x, ok := err.(interface{ Is(error) bool }); ok && x.Is(target) { - return true - } - if err = unwrap(err); err == nil { - return false - } - } -} - -func unwrap(err error) error { - u, ok := err.(interface { - Unwrap() error - }) - if !ok { - return nil - } - return u.Unwrap() -} diff --git a/vendor/google.golang.org/protobuf/internal/errors/is_go113.go b/vendor/google.golang.org/protobuf/internal/errors/is_go113.go deleted file mode 100644 index 5e72f1cde..000000000 --- a/vendor/google.golang.org/protobuf/internal/errors/is_go113.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2020 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.13 -// +build go1.13 - -package errors - -import "errors" - -// Is is errors.Is. -func Is(err, target error) bool { return errors.Is(err, target) } diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc.go index df53ff40b..688aabe43 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/desc.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc.go @@ -19,7 +19,6 @@ import ( "google.golang.org/protobuf/internal/pragma" "google.golang.org/protobuf/internal/strs" "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" ) // Edition is an Enum for proto2.Edition @@ -32,6 +31,7 @@ const ( EditionProto2 Edition = 998 EditionProto3 Edition = 999 Edition2023 Edition = 1000 + Edition2024 Edition = 1001 EditionUnsupported Edition = 100000 ) @@ -77,31 +77,48 @@ type ( Locations SourceLocations } + // EditionFeatures is a frequently-instantiated struct, so please take care + // to minimize padding when adding new fields to this struct (add them in + // the right place/order). EditionFeatures struct { + // StripEnumPrefix determines if the plugin generates enum value + // constants as-is, with their prefix stripped, or both variants. + StripEnumPrefix int + // IsFieldPresence is true if field_presence is EXPLICIT // https://protobuf.dev/editions/features/#field_presence IsFieldPresence bool + // IsFieldPresence is true if field_presence is LEGACY_REQUIRED // https://protobuf.dev/editions/features/#field_presence IsLegacyRequired bool + // IsOpenEnum is true if enum_type is OPEN // https://protobuf.dev/editions/features/#enum_type IsOpenEnum bool + // IsPacked is true if repeated_field_encoding is PACKED // https://protobuf.dev/editions/features/#repeated_field_encoding IsPacked bool + // IsUTF8Validated is true if utf_validation is VERIFY // https://protobuf.dev/editions/features/#utf8_validation IsUTF8Validated bool + // IsDelimitedEncoded is true if message_encoding is DELIMITED // https://protobuf.dev/editions/features/#message_encoding IsDelimitedEncoded bool + // IsJSONCompliant is true if json_format is ALLOW // https://protobuf.dev/editions/features/#json_format IsJSONCompliant bool + // GenerateLegacyUnmarshalJSON determines if the plugin generates the // UnmarshalJSON([]byte) error method for enums. GenerateLegacyUnmarshalJSON bool + // APILevel controls which API (Open, Hybrid or Opaque) should be used + // for generated code (.pb.go files). + APILevel int } ) @@ -257,7 +274,7 @@ type ( Kind protoreflect.Kind StringName stringName IsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto - IsWeak 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 @@ -350,7 +367,8 @@ func (fd *Field) IsPacked() bool { return fd.L1.EditionFeatures.IsPacked } func (fd *Field) IsExtension() bool { return false } -func (fd *Field) IsWeak() bool { return fd.L1.IsWeak } +func (fd *Field) IsWeak() bool { return false } +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 { @@ -376,11 +394,6 @@ func (fd *Field) Enum() protoreflect.EnumDescriptor { return fd.L1.Enum } func (fd *Field) Message() protoreflect.MessageDescriptor { - if fd.L1.IsWeak { - if d, _ := protoregistry.GlobalFiles.FindDescriptorByName(fd.L1.Message.FullName()); d != nil { - return d.(protoreflect.MessageDescriptor) - } - } return fd.L1.Message } func (fd *Field) IsMapEntry() bool { @@ -425,6 +438,7 @@ type ( Extendee protoreflect.MessageDescriptor Cardinality protoreflect.Cardinality Kind protoreflect.Kind + IsLazy bool EditionFeatures EditionFeatures } ExtensionL2 struct { @@ -465,6 +479,7 @@ func (xd *Extension) IsPacked() bool { } 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 } 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 8a57d60b0..d2f549497 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go @@ -495,6 +495,8 @@ func (xd *Extension) unmarshalOptions(b []byte) { 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) 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 e56c91a8d..d4c94458b 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go @@ -32,11 +32,6 @@ func (file *File) resolveMessages() { for j := range md.L2.Fields.List { fd := &md.L2.Fields.List[j] - // Weak fields are resolved upon actual use. - if fd.L1.IsWeak { - continue - } - // Resolve message field dependency. switch fd.L1.Kind { case protoreflect.EnumKind: @@ -150,8 +145,6 @@ func (fd *File) unmarshalFull(b []byte) { switch num { case genid.FileDescriptorProto_PublicDependency_field_number: fd.L2.Imports[v].IsPublic = true - case genid.FileDescriptorProto_WeakDependency_field_number: - fd.L2.Imports[v].IsWeak = true } case protowire.BytesType: v, m := protowire.ConsumeBytes(b) @@ -502,8 +495,8 @@ func (fd *Field) unmarshalOptions(b []byte) { switch num { case genid.FieldOptions_Packed_field_number: 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.EditionFeatures.IsUTF8Validated = protowire.DecodeBool(v) } diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/editions.go b/vendor/google.golang.org/protobuf/internal/filedesc/editions.go index 11f5f356b..a0aad2777 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/editions.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/editions.go @@ -32,6 +32,14 @@ func unmarshalGoFeature(b []byte, parent EditionFeatures) EditionFeatures { v, m := protowire.ConsumeVarint(b) b = b[m:] parent.GenerateLegacyUnmarshalJSON = protowire.DecodeBool(v) + case genid.GoFeatures_ApiLevel_field_number: + v, m := protowire.ConsumeVarint(b) + b = b[m:] + parent.APILevel = int(v) + case genid.GoFeatures_StripEnumPrefix_field_number: + v, m := protowire.ConsumeVarint(b) + b = b[m:] + parent.StripEnumPrefix = int(v) default: panic(fmt.Sprintf("unkown field number %d while unmarshalling GoFeatures", num)) } @@ -61,6 +69,12 @@ func unmarshalFeatureSet(b []byte, parent EditionFeatures) EditionFeatures { parent.IsDelimitedEncoded = v == genid.FeatureSet_DELIMITED_enum_value case genid.FeatureSet_JsonFormat_field_number: parent.IsJSONCompliant = v == genid.FeatureSet_ALLOW_enum_value + case genid.FeatureSet_EnforceNamingStyle_field_number: + // EnforceNamingStyle is enforced in protoc, languages other than C++ + // are not supposed to do anything with this feature. + case genid.FeatureSet_DefaultSymbolVisibility_field_number: + // DefaultSymbolVisibility is enforced in protoc, runtimes should not + // inspect this value. default: panic(fmt.Sprintf("unkown field number %d while unmarshalling FeatureSet", num)) } @@ -68,7 +82,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) } } diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/presence.go b/vendor/google.golang.org/protobuf/internal/filedesc/presence.go new file mode 100644 index 000000000..a12ec9791 --- /dev/null +++ b/vendor/google.golang.org/protobuf/internal/filedesc/presence.go @@ -0,0 +1,33 @@ +// Copyright 2025 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 filedesc + +import "google.golang.org/protobuf/reflect/protoreflect" + +// UsePresenceForField reports whether the presence bitmap should be used for +// the specified field. +func UsePresenceForField(fd protoreflect.FieldDescriptor) (usePresence, canBeLazy bool) { + switch { + case fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic(): + // Oneof fields never use the presence bitmap. + // + // Synthetic oneofs are an exception: Those are used to implement proto3 + // optional fields and hence should follow non-oneof field semantics. + return false, false + + case fd.IsMap(): + // Map-typed fields never use the presence bitmap. + return false, false + + case fd.Kind() == protoreflect.MessageKind || fd.Kind() == protoreflect.GroupKind: + // Lazy fields always use the presence bitmap (only messages can be lazy). + isLazy := fd.(interface{ IsLazy() bool }).IsLazy() + return isLazy, isLazy + + default: + // If the field has presence, use the presence bitmap. + return fd.HasPresence(), false + } +} diff --git a/vendor/google.golang.org/protobuf/internal/filetype/build.go b/vendor/google.golang.org/protobuf/internal/filetype/build.go index ba83fea44..e1b4130bd 100644 --- a/vendor/google.golang.org/protobuf/internal/filetype/build.go +++ b/vendor/google.golang.org/protobuf/internal/filetype/build.go @@ -63,7 +63,7 @@ type Builder struct { // message declarations in "flattened ordering". // // Dependencies are Go types for enums or messages referenced by - // message fields (excluding weak fields), for parent extended messages of + // message fields, for parent extended messages of // extension fields, for enums or messages referenced by extension fields, // and for input and output messages referenced by service methods. // Dependencies must come after declarations, but the ordering of diff --git a/vendor/google.golang.org/protobuf/internal/flags/flags.go b/vendor/google.golang.org/protobuf/internal/flags/flags.go index 58372dd34..a06ccabc2 100644 --- a/vendor/google.golang.org/protobuf/internal/flags/flags.go +++ b/vendor/google.golang.org/protobuf/internal/flags/flags.go @@ -6,7 +6,7 @@ package flags // ProtoLegacy specifies whether to enable support for legacy functionality -// such as MessageSets, weak fields, and various other obscure behavior +// such as MessageSets, and various other obscure behavior // that is necessary to maintain backwards compatibility with proto1 or // the pre-release variants of proto2 and proto3. // 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 f30ab6b58..950a6a325 100644 --- a/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go +++ b/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go @@ -34,6 +34,19 @@ const ( Edition_EDITION_MAX_enum_value = 2147483647 ) +// Full and short names for google.protobuf.SymbolVisibility. +const ( + SymbolVisibility_enum_fullname = "google.protobuf.SymbolVisibility" + SymbolVisibility_enum_name = "SymbolVisibility" +) + +// Enum values for google.protobuf.SymbolVisibility. +const ( + SymbolVisibility_VISIBILITY_UNSET_enum_value = 0 + SymbolVisibility_VISIBILITY_LOCAL_enum_value = 1 + SymbolVisibility_VISIBILITY_EXPORT_enum_value = 2 +) + // Names for google.protobuf.FileDescriptorSet. const ( FileDescriptorSet_message_name protoreflect.Name = "FileDescriptorSet" @@ -65,6 +78,7 @@ const ( FileDescriptorProto_Dependency_field_name protoreflect.Name = "dependency" FileDescriptorProto_PublicDependency_field_name protoreflect.Name = "public_dependency" FileDescriptorProto_WeakDependency_field_name protoreflect.Name = "weak_dependency" + FileDescriptorProto_OptionDependency_field_name protoreflect.Name = "option_dependency" FileDescriptorProto_MessageType_field_name protoreflect.Name = "message_type" FileDescriptorProto_EnumType_field_name protoreflect.Name = "enum_type" FileDescriptorProto_Service_field_name protoreflect.Name = "service" @@ -79,6 +93,7 @@ const ( FileDescriptorProto_Dependency_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.dependency" FileDescriptorProto_PublicDependency_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.public_dependency" FileDescriptorProto_WeakDependency_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.weak_dependency" + FileDescriptorProto_OptionDependency_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.option_dependency" FileDescriptorProto_MessageType_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.message_type" FileDescriptorProto_EnumType_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.enum_type" FileDescriptorProto_Service_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.service" @@ -96,6 +111,7 @@ const ( FileDescriptorProto_Dependency_field_number protoreflect.FieldNumber = 3 FileDescriptorProto_PublicDependency_field_number protoreflect.FieldNumber = 10 FileDescriptorProto_WeakDependency_field_number protoreflect.FieldNumber = 11 + FileDescriptorProto_OptionDependency_field_number protoreflect.FieldNumber = 15 FileDescriptorProto_MessageType_field_number protoreflect.FieldNumber = 4 FileDescriptorProto_EnumType_field_number protoreflect.FieldNumber = 5 FileDescriptorProto_Service_field_number protoreflect.FieldNumber = 6 @@ -124,6 +140,7 @@ const ( DescriptorProto_Options_field_name protoreflect.Name = "options" DescriptorProto_ReservedRange_field_name protoreflect.Name = "reserved_range" DescriptorProto_ReservedName_field_name protoreflect.Name = "reserved_name" + DescriptorProto_Visibility_field_name protoreflect.Name = "visibility" DescriptorProto_Name_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.name" DescriptorProto_Field_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.field" @@ -135,6 +152,7 @@ const ( DescriptorProto_Options_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.options" DescriptorProto_ReservedRange_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.reserved_range" DescriptorProto_ReservedName_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.reserved_name" + DescriptorProto_Visibility_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.visibility" ) // Field numbers for google.protobuf.DescriptorProto. @@ -149,6 +167,7 @@ const ( DescriptorProto_Options_field_number protoreflect.FieldNumber = 7 DescriptorProto_ReservedRange_field_number protoreflect.FieldNumber = 9 DescriptorProto_ReservedName_field_number protoreflect.FieldNumber = 10 + DescriptorProto_Visibility_field_number protoreflect.FieldNumber = 11 ) // Names for google.protobuf.DescriptorProto.ExtensionRange. @@ -388,12 +407,14 @@ const ( EnumDescriptorProto_Options_field_name protoreflect.Name = "options" EnumDescriptorProto_ReservedRange_field_name protoreflect.Name = "reserved_range" EnumDescriptorProto_ReservedName_field_name protoreflect.Name = "reserved_name" + EnumDescriptorProto_Visibility_field_name protoreflect.Name = "visibility" EnumDescriptorProto_Name_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.name" EnumDescriptorProto_Value_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.value" EnumDescriptorProto_Options_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.options" EnumDescriptorProto_ReservedRange_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.reserved_range" EnumDescriptorProto_ReservedName_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.reserved_name" + EnumDescriptorProto_Visibility_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.visibility" ) // Field numbers for google.protobuf.EnumDescriptorProto. @@ -403,6 +424,7 @@ const ( EnumDescriptorProto_Options_field_number protoreflect.FieldNumber = 3 EnumDescriptorProto_ReservedRange_field_number protoreflect.FieldNumber = 4 EnumDescriptorProto_ReservedName_field_number protoreflect.FieldNumber = 5 + EnumDescriptorProto_Visibility_field_number protoreflect.FieldNumber = 6 ) // Names for google.protobuf.EnumDescriptorProto.EnumReservedRange. @@ -1008,29 +1030,35 @@ const ( // Field names for google.protobuf.FeatureSet. const ( - FeatureSet_FieldPresence_field_name protoreflect.Name = "field_presence" - FeatureSet_EnumType_field_name protoreflect.Name = "enum_type" - FeatureSet_RepeatedFieldEncoding_field_name protoreflect.Name = "repeated_field_encoding" - FeatureSet_Utf8Validation_field_name protoreflect.Name = "utf8_validation" - FeatureSet_MessageEncoding_field_name protoreflect.Name = "message_encoding" - FeatureSet_JsonFormat_field_name protoreflect.Name = "json_format" - - FeatureSet_FieldPresence_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.field_presence" - FeatureSet_EnumType_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.enum_type" - FeatureSet_RepeatedFieldEncoding_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.repeated_field_encoding" - FeatureSet_Utf8Validation_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.utf8_validation" - FeatureSet_MessageEncoding_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.message_encoding" - FeatureSet_JsonFormat_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.json_format" + FeatureSet_FieldPresence_field_name protoreflect.Name = "field_presence" + FeatureSet_EnumType_field_name protoreflect.Name = "enum_type" + FeatureSet_RepeatedFieldEncoding_field_name protoreflect.Name = "repeated_field_encoding" + FeatureSet_Utf8Validation_field_name protoreflect.Name = "utf8_validation" + FeatureSet_MessageEncoding_field_name protoreflect.Name = "message_encoding" + FeatureSet_JsonFormat_field_name protoreflect.Name = "json_format" + FeatureSet_EnforceNamingStyle_field_name protoreflect.Name = "enforce_naming_style" + FeatureSet_DefaultSymbolVisibility_field_name protoreflect.Name = "default_symbol_visibility" + + FeatureSet_FieldPresence_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.field_presence" + FeatureSet_EnumType_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.enum_type" + FeatureSet_RepeatedFieldEncoding_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.repeated_field_encoding" + FeatureSet_Utf8Validation_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.utf8_validation" + FeatureSet_MessageEncoding_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.message_encoding" + FeatureSet_JsonFormat_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.json_format" + FeatureSet_EnforceNamingStyle_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.enforce_naming_style" + FeatureSet_DefaultSymbolVisibility_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.default_symbol_visibility" ) // Field numbers for google.protobuf.FeatureSet. const ( - FeatureSet_FieldPresence_field_number protoreflect.FieldNumber = 1 - FeatureSet_EnumType_field_number protoreflect.FieldNumber = 2 - FeatureSet_RepeatedFieldEncoding_field_number protoreflect.FieldNumber = 3 - FeatureSet_Utf8Validation_field_number protoreflect.FieldNumber = 4 - FeatureSet_MessageEncoding_field_number protoreflect.FieldNumber = 5 - FeatureSet_JsonFormat_field_number protoreflect.FieldNumber = 6 + FeatureSet_FieldPresence_field_number protoreflect.FieldNumber = 1 + FeatureSet_EnumType_field_number protoreflect.FieldNumber = 2 + FeatureSet_RepeatedFieldEncoding_field_number protoreflect.FieldNumber = 3 + FeatureSet_Utf8Validation_field_number protoreflect.FieldNumber = 4 + FeatureSet_MessageEncoding_field_number protoreflect.FieldNumber = 5 + FeatureSet_JsonFormat_field_number protoreflect.FieldNumber = 6 + FeatureSet_EnforceNamingStyle_field_number protoreflect.FieldNumber = 7 + FeatureSet_DefaultSymbolVisibility_field_number protoreflect.FieldNumber = 8 ) // Full and short names for google.protobuf.FeatureSet.FieldPresence. @@ -1112,6 +1140,40 @@ const ( FeatureSet_LEGACY_BEST_EFFORT_enum_value = 2 ) +// Full and short names for google.protobuf.FeatureSet.EnforceNamingStyle. +const ( + FeatureSet_EnforceNamingStyle_enum_fullname = "google.protobuf.FeatureSet.EnforceNamingStyle" + FeatureSet_EnforceNamingStyle_enum_name = "EnforceNamingStyle" +) + +// Enum values for google.protobuf.FeatureSet.EnforceNamingStyle. +const ( + FeatureSet_ENFORCE_NAMING_STYLE_UNKNOWN_enum_value = 0 + FeatureSet_STYLE2024_enum_value = 1 + FeatureSet_STYLE_LEGACY_enum_value = 2 +) + +// Names for google.protobuf.FeatureSet.VisibilityFeature. +const ( + FeatureSet_VisibilityFeature_message_name protoreflect.Name = "VisibilityFeature" + FeatureSet_VisibilityFeature_message_fullname protoreflect.FullName = "google.protobuf.FeatureSet.VisibilityFeature" +) + +// Full and short names for google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility. +const ( + FeatureSet_VisibilityFeature_DefaultSymbolVisibility_enum_fullname = "google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility" + FeatureSet_VisibilityFeature_DefaultSymbolVisibility_enum_name = "DefaultSymbolVisibility" +) + +// Enum values for google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility. +const ( + FeatureSet_VisibilityFeature_DEFAULT_SYMBOL_VISIBILITY_UNKNOWN_enum_value = 0 + FeatureSet_VisibilityFeature_EXPORT_ALL_enum_value = 1 + FeatureSet_VisibilityFeature_EXPORT_TOP_LEVEL_enum_value = 2 + FeatureSet_VisibilityFeature_LOCAL_ALL_enum_value = 3 + FeatureSet_VisibilityFeature_STRICT_enum_value = 4 +) + // Names for google.protobuf.FeatureSetDefaults. const ( FeatureSetDefaults_message_name protoreflect.Name = "FeatureSetDefaults" 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 9a652a2b4..f5ee7f5c2 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 @@ -12,20 +12,59 @@ import ( 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_ApiLevel_field_name protoreflect.Name = "api_level" + GoFeatures_StripEnumPrefix_field_name protoreflect.Name = "strip_enum_prefix" - 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" + GoFeatures_ApiLevel_field_fullname protoreflect.FullName = "pb.GoFeatures.api_level" + GoFeatures_StripEnumPrefix_field_fullname protoreflect.FullName = "pb.GoFeatures.strip_enum_prefix" ) -// Field numbers for google.protobuf.GoFeatures. +// Field numbers for pb.GoFeatures. const ( GoFeatures_LegacyUnmarshalJsonEnum_field_number protoreflect.FieldNumber = 1 + GoFeatures_ApiLevel_field_number protoreflect.FieldNumber = 2 + GoFeatures_StripEnumPrefix_field_number protoreflect.FieldNumber = 3 +) + +// Full and short names for pb.GoFeatures.APILevel. +const ( + GoFeatures_APILevel_enum_fullname = "pb.GoFeatures.APILevel" + GoFeatures_APILevel_enum_name = "APILevel" +) + +// Enum values for pb.GoFeatures.APILevel. +const ( + GoFeatures_API_LEVEL_UNSPECIFIED_enum_value = 0 + GoFeatures_API_OPEN_enum_value = 1 + GoFeatures_API_HYBRID_enum_value = 2 + GoFeatures_API_OPAQUE_enum_value = 3 +) + +// Full and short names for pb.GoFeatures.StripEnumPrefix. +const ( + GoFeatures_StripEnumPrefix_enum_fullname = "pb.GoFeatures.StripEnumPrefix" + GoFeatures_StripEnumPrefix_enum_name = "StripEnumPrefix" +) + +// Enum values for pb.GoFeatures.StripEnumPrefix. +const ( + GoFeatures_STRIP_ENUM_PREFIX_UNSPECIFIED_enum_value = 0 + GoFeatures_STRIP_ENUM_PREFIX_KEEP_enum_value = 1 + GoFeatures_STRIP_ENUM_PREFIX_GENERATE_BOTH_enum_value = 2 + GoFeatures_STRIP_ENUM_PREFIX_STRIP_enum_value = 3 +) + +// Extension numbers +const ( + FeatureSet_Go_ext_number protoreflect.FieldNumber = 1002 ) diff --git a/vendor/google.golang.org/protobuf/internal/genid/goname.go b/vendor/google.golang.org/protobuf/internal/genid/goname.go index 693d2e9e1..99bb95baf 100644 --- a/vendor/google.golang.org/protobuf/internal/genid/goname.go +++ b/vendor/google.golang.org/protobuf/internal/genid/goname.go @@ -11,15 +11,10 @@ const ( SizeCache_goname = "sizeCache" SizeCacheA_goname = "XXX_sizecache" - WeakFields_goname = "weakFields" - WeakFieldsA_goname = "XXX_weak" - UnknownFields_goname = "unknownFields" UnknownFieldsA_goname = "XXX_unrecognized" ExtensionFields_goname = "extensionFields" ExtensionFieldsA_goname = "XXX_InternalExtensions" ExtensionFieldsB_goname = "XXX_extensions" - - WeakFieldPrefix_goname = "XXX_weak_" ) 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/name.go b/vendor/google.golang.org/protobuf/internal/genid/name.go new file mode 100644 index 000000000..224f33930 --- /dev/null +++ b/vendor/google.golang.org/protobuf/internal/genid/name.go @@ -0,0 +1,12 @@ +// 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 genid + +const ( + NoUnkeyedLiteral_goname = "noUnkeyedLiteral" + NoUnkeyedLiteralA_goname = "XXX_NoUnkeyedLiteral" + + BuilderSuffix_goname = "_builder" +) 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_opaque.go b/vendor/google.golang.org/protobuf/internal/impl/api_export_opaque.go new file mode 100644 index 000000000..6075d6f69 --- /dev/null +++ b/vendor/google.golang.org/protobuf/internal/impl/api_export_opaque.go @@ -0,0 +1,128 @@ +// 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 ( + "strconv" + "sync/atomic" + "unsafe" + + "google.golang.org/protobuf/reflect/protoreflect" +) + +func (Export) UnmarshalField(msg any, fieldNum int32) { + UnmarshalField(msg.(protoreflect.ProtoMessage).ProtoReflect(), protoreflect.FieldNumber(fieldNum)) +} + +// Present checks the presence set for a certain field number (zero +// based, ordered by appearance in original proto file). part is +// a pointer to the correct element in the bitmask array, num is the +// field number unaltered. Example (field number 70 -> part = +// &m.XXX_presence[1], num = 70) +func (Export) Present(part *uint32, num uint32) bool { + // This hook will read an unprotected shadow presence set if + // we're unning under the race detector + raceDetectHookPresent(part, num) + return atomic.LoadUint32(part)&(1<<(num%32)) > 0 +} + +// SetPresent adds a field to the presence set. part is a pointer to +// the relevant element in the array and num is the field number +// unaltered. size is the number of fields in the protocol +// buffer. +func (Export) SetPresent(part *uint32, num uint32, size uint32) { + // This hook will mutate an unprotected shadow presence set if + // we're running under the race detector + raceDetectHookSetPresent(part, num, presenceSize(size)) + for { + old := atomic.LoadUint32(part) + if atomic.CompareAndSwapUint32(part, old, old|(1<<(num%32))) { + return + } + } +} + +// SetPresentNonAtomic is like SetPresent, but operates non-atomically. +// It is meant for use by builder methods, where the message is known not +// to be accessible yet by other goroutines. +func (Export) SetPresentNonAtomic(part *uint32, num uint32, size uint32) { + // This hook will mutate an unprotected shadow presence set if + // we're running under the race detector + raceDetectHookSetPresent(part, num, presenceSize(size)) + *part |= 1 << (num % 32) +} + +// ClearPresence removes a field from the presence set. part is a +// pointer to the relevant element in the presence array and num is +// the field number unaltered. +func (Export) ClearPresent(part *uint32, num uint32) { + // This hook will mutate an unprotected shadow presence set if + // we're running under the race detector + raceDetectHookClearPresent(part, num) + for { + old := atomic.LoadUint32(part) + if atomic.CompareAndSwapUint32(part, old, old&^(1<<(num%32))) { + return + } + } +} + +// interfaceToPointer takes a pointer to an empty interface whose value is a +// pointer type, and converts it into a "pointer" that points to the same +// target +func interfaceToPointer(i *any) pointer { + return pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]} +} + +func (p pointer) atomicGetPointer() pointer { + return pointer{p: atomic.LoadPointer((*unsafe.Pointer)(p.p))} +} + +func (p pointer) atomicSetPointer(q pointer) { + atomic.StorePointer((*unsafe.Pointer)(p.p), q.p) +} + +// AtomicCheckPointerIsNil takes an interface (which is a pointer to a +// pointer) and returns true if the pointed-to pointer is nil (using an +// atomic load). This function is inlineable and, on x86, just becomes a +// simple load and compare. +func (Export) AtomicCheckPointerIsNil(ptr any) bool { + return interfaceToPointer(&ptr).atomicGetPointer().IsNil() +} + +// AtomicSetPointer takes two interfaces (first is a pointer to a pointer, +// second is a pointer) and atomically sets the second pointer into location +// referenced by first pointer. Unfortunately, atomicSetPointer() does not inline +// (even on x86), so this does not become a simple store on x86. +func (Export) AtomicSetPointer(dstPtr, valPtr any) { + interfaceToPointer(&dstPtr).atomicSetPointer(interfaceToPointer(&valPtr)) +} + +// AtomicLoadPointer loads the pointer at the location pointed at by src, +// and stores that pointer value into the location pointed at by dst. +func (Export) AtomicLoadPointer(ptr Pointer, dst Pointer) { + *(*unsafe.Pointer)(unsafe.Pointer(dst)) = atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(ptr))) +} + +// AtomicInitializePointer makes ptr and dst point to the same value. +// +// If *ptr is a nil pointer, it sets *ptr = *dst. +// +// If *ptr is a non-nil pointer, it sets *dst = *ptr. +func (Export) AtomicInitializePointer(ptr Pointer, dst Pointer) { + if !atomic.CompareAndSwapPointer((*unsafe.Pointer)(ptr), unsafe.Pointer(nil), *(*unsafe.Pointer)(dst)) { + *(*unsafe.Pointer)(unsafe.Pointer(dst)) = atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(ptr))) + } +} + +// MessageFieldStringOf returns the field formatted as a string, +// either as the field name if resolvable otherwise as a decimal string. +func (Export) MessageFieldStringOf(md protoreflect.MessageDescriptor, n protoreflect.FieldNumber) string { + fd := md.Fields().ByNumber(n) + if fd != nil { + return string(fd.Name()) + } + return strconv.Itoa(int(n)) +} diff --git a/vendor/google.golang.org/protobuf/internal/impl/bitmap.go b/vendor/google.golang.org/protobuf/internal/impl/bitmap.go new file mode 100644 index 000000000..ea276547c --- /dev/null +++ b/vendor/google.golang.org/protobuf/internal/impl/bitmap.go @@ -0,0 +1,34 @@ +// 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 !race + +package impl + +// There is no additional data as we're not running under race detector. +type RaceDetectHookData struct{} + +// Empty stubs for when not using the race detector. Calls to these from index.go should be optimized away. +func (presence) raceDetectHookPresent(num uint32) {} +func (presence) raceDetectHookSetPresent(num uint32, size presenceSize) {} +func (presence) raceDetectHookClearPresent(num uint32) {} +func (presence) raceDetectHookAllocAndCopy(src presence) {} + +// raceDetectHookPresent is called by the generated file interface +// (*proto.internalFuncs) Present to optionally read an unprotected +// shadow bitmap when race detection is enabled. In regular code it is +// a noop. +func raceDetectHookPresent(field *uint32, num uint32) {} + +// raceDetectHookSetPresent is called by the generated file interface +// (*proto.internalFuncs) SetPresent to optionally write an unprotected +// shadow bitmap when race detection is enabled. In regular code it is +// a noop. +func raceDetectHookSetPresent(field *uint32, num uint32, size presenceSize) {} + +// raceDetectHookClearPresent is called by the generated file interface +// (*proto.internalFuncs) ClearPresent to optionally write an unprotected +// shadow bitmap when race detection is enabled. In regular code it is +// a noop. +func raceDetectHookClearPresent(field *uint32, num uint32) {} diff --git a/vendor/google.golang.org/protobuf/internal/impl/bitmap_race.go b/vendor/google.golang.org/protobuf/internal/impl/bitmap_race.go new file mode 100644 index 000000000..e9a27583a --- /dev/null +++ b/vendor/google.golang.org/protobuf/internal/impl/bitmap_race.go @@ -0,0 +1,126 @@ +// 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 race + +package impl + +// When running under race detector, we add a presence map of bytes, that we can access +// in the hook functions so that we trigger the race detection whenever we have concurrent +// Read-Writes or Write-Writes. The race detector does not otherwise detect invalid concurrent +// access to lazy fields as all updates of bitmaps and pointers are done using atomic operations. +type RaceDetectHookData struct { + shadowPresence *[]byte +} + +// Hooks for presence bitmap operations that allocate, read and write the shadowPresence +// using non-atomic operations. +func (data *RaceDetectHookData) raceDetectHookAlloc(size presenceSize) { + sp := make([]byte, size) + atomicStoreShadowPresence(&data.shadowPresence, &sp) +} + +func (p presence) raceDetectHookPresent(num uint32) { + data := p.toRaceDetectData() + if data == nil { + return + } + sp := atomicLoadShadowPresence(&data.shadowPresence) + if sp != nil { + _ = (*sp)[num] + } +} + +func (p presence) raceDetectHookSetPresent(num uint32, size presenceSize) { + data := p.toRaceDetectData() + if data == nil { + return + } + sp := atomicLoadShadowPresence(&data.shadowPresence) + if sp == nil { + data.raceDetectHookAlloc(size) + sp = atomicLoadShadowPresence(&data.shadowPresence) + } + (*sp)[num] = 1 +} + +func (p presence) raceDetectHookClearPresent(num uint32) { + data := p.toRaceDetectData() + if data == nil { + return + } + sp := atomicLoadShadowPresence(&data.shadowPresence) + if sp != nil { + (*sp)[num] = 0 + + } +} + +// raceDetectHookAllocAndCopy allocates a new shadowPresence slice at lazy and copies +// shadowPresence bytes from src to lazy. +func (p presence) raceDetectHookAllocAndCopy(q presence) { + sData := q.toRaceDetectData() + dData := p.toRaceDetectData() + if sData == nil { + return + } + srcSp := atomicLoadShadowPresence(&sData.shadowPresence) + if srcSp == nil { + atomicStoreShadowPresence(&dData.shadowPresence, nil) + return + } + n := len(*srcSp) + dSlice := make([]byte, n) + atomicStoreShadowPresence(&dData.shadowPresence, &dSlice) + for i := 0; i < n; i++ { + dSlice[i] = (*srcSp)[i] + } +} + +// raceDetectHookPresent is called by the generated file interface +// (*proto.internalFuncs) Present to optionally read an unprotected +// shadow bitmap when race detection is enabled. In regular code it is +// a noop. +func raceDetectHookPresent(field *uint32, num uint32) { + data := findPointerToRaceDetectData(field, num) + if data == nil { + return + } + sp := atomicLoadShadowPresence(&data.shadowPresence) + if sp != nil { + _ = (*sp)[num] + } +} + +// raceDetectHookSetPresent is called by the generated file interface +// (*proto.internalFuncs) SetPresent to optionally write an unprotected +// shadow bitmap when race detection is enabled. In regular code it is +// a noop. +func raceDetectHookSetPresent(field *uint32, num uint32, size presenceSize) { + data := findPointerToRaceDetectData(field, num) + if data == nil { + return + } + sp := atomicLoadShadowPresence(&data.shadowPresence) + if sp == nil { + data.raceDetectHookAlloc(size) + sp = atomicLoadShadowPresence(&data.shadowPresence) + } + (*sp)[num] = 1 +} + +// raceDetectHookClearPresent is called by the generated file interface +// (*proto.internalFuncs) ClearPresent to optionally write an unprotected +// shadow bitmap when race detection is enabled. In regular code it is +// a noop. +func raceDetectHookClearPresent(field *uint32, num uint32) { + data := findPointerToRaceDetectData(field, num) + if data == nil { + return + } + sp := atomicLoadShadowPresence(&data.shadowPresence) + if sp != nil { + (*sp)[num] = 0 + } +} diff --git a/vendor/google.golang.org/protobuf/internal/impl/checkinit.go b/vendor/google.golang.org/protobuf/internal/impl/checkinit.go index f29e6a8fa..fe2c719ce 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/checkinit.go +++ b/vendor/google.golang.org/protobuf/internal/impl/checkinit.go @@ -35,6 +35,12 @@ func (mi *MessageInfo) checkInitializedPointer(p pointer) error { } return nil } + + var presence presence + if mi.presenceOffset.IsValid() { + presence = p.Apply(mi.presenceOffset).PresenceInfo() + } + if mi.extensionOffset.IsValid() { e := p.Apply(mi.extensionOffset).Extensions() if err := mi.isInitExtensions(e); err != nil { @@ -45,6 +51,33 @@ func (mi *MessageInfo) checkInitializedPointer(p pointer) error { if !f.isRequired && f.funcs.isInit == nil { continue } + + if f.presenceIndex != noPresence { + if !presence.Present(f.presenceIndex) { + if f.isRequired { + return errors.RequiredNotSet(string(mi.Desc.Fields().ByNumber(f.num).FullName())) + } + continue + } + if f.funcs.isInit != nil { + f.mi.init() + if f.mi.needsInitCheck { + if f.isLazy && p.Apply(f.offset).AtomicGetPointer().IsNil() { + lazy := *p.Apply(mi.lazyOffset).LazyInfoPtr() + if !lazy.AllowedPartial() { + // Nothing to see here, it was checked on unmarshal + continue + } + mi.lazyUnmarshal(p, f.num) + } + if err := f.funcs.isInit(p.Apply(f.offset), f); err != nil { + return err + } + } + } + continue + } + fptr := p.Apply(f.offset) if f.isPointer && fptr.Elem().IsNil() { if f.isRequired { 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 4bb0a7a20..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 { @@ -158,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) } @@ -174,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 78ee47e44..d14d7d93c 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_field.go +++ b/vendor/google.golang.org/protobuf/internal/impl/codec_field.go @@ -5,15 +5,12 @@ package impl import ( - "fmt" "reflect" - "sync" "google.golang.org/protobuf/encoding/protowire" "google.golang.org/protobuf/internal/errors" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" "google.golang.org/protobuf/runtime/protoiface" ) @@ -65,6 +62,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 } @@ -118,78 +118,6 @@ func (mi *MessageInfo) initOneofFieldCoders(od protoreflect.OneofDescriptor, si } } -func makeWeakMessageFieldCoder(fd protoreflect.FieldDescriptor) pointerCoderFuncs { - var once sync.Once - var messageType protoreflect.MessageType - lazyInit := func() { - once.Do(func() { - messageName := fd.Message().FullName() - messageType, _ = protoregistry.GlobalTypes.FindMessageByName(messageName) - }) - } - - return pointerCoderFuncs{ - size: func(p pointer, f *coderFieldInfo, opts marshalOptions) int { - m, ok := p.WeakFields().get(f.num) - if !ok { - return 0 - } - lazyInit() - if messageType == nil { - panic(fmt.Sprintf("weak message %v is not linked in", fd.Message().FullName())) - } - return sizeMessage(m, f.tagsize, opts) - }, - marshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { - m, ok := p.WeakFields().get(f.num) - if !ok { - return b, nil - } - lazyInit() - if messageType == nil { - panic(fmt.Sprintf("weak message %v is not linked in", fd.Message().FullName())) - } - return appendMessage(b, m, f.wiretag, opts) - }, - unmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) { - fs := p.WeakFields() - m, ok := fs.get(f.num) - if !ok { - lazyInit() - if messageType == nil { - return unmarshalOutput{}, errUnknown - } - m = messageType.New().Interface() - fs.set(f.num, m) - } - return consumeMessage(b, m, wtyp, opts) - }, - isInit: func(p pointer, f *coderFieldInfo) error { - m, ok := p.WeakFields().get(f.num) - if !ok { - return nil - } - return proto.CheckInitialized(m) - }, - merge: func(dst, src pointer, f *coderFieldInfo, opts mergeOptions) { - sm, ok := src.WeakFields().get(f.num) - if !ok { - return - } - dm, ok := dst.WeakFields().get(f.num) - if !ok { - lazyInit() - if messageType == nil { - panic(fmt.Sprintf("weak message %v is not linked in", fd.Message().FullName())) - } - dm = messageType.New().Interface() - dst.WeakFields().set(f.num, dm) - } - opts.Merge(dm, sm) - }, - } -} - func makeMessageFieldCoder(fd protoreflect.FieldDescriptor, ft reflect.Type) pointerCoderFuncs { if mi := getMessageInfo(ft); mi != nil { funcs := pointerCoderFuncs{ diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_field_opaque.go b/vendor/google.golang.org/protobuf/internal/impl/codec_field_opaque.go new file mode 100644 index 000000000..76818ea25 --- /dev/null +++ b/vendor/google.golang.org/protobuf/internal/impl/codec_field_opaque.go @@ -0,0 +1,264 @@ +// 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 ( + "fmt" + "reflect" + + "google.golang.org/protobuf/encoding/protowire" + "google.golang.org/protobuf/internal/errors" + "google.golang.org/protobuf/reflect/protoreflect" +) + +func makeOpaqueMessageFieldCoder(fd protoreflect.FieldDescriptor, ft reflect.Type) (*MessageInfo, pointerCoderFuncs) { + mi := getMessageInfo(ft) + if mi == nil { + panic(fmt.Sprintf("invalid field: %v: unsupported message type %v", fd.FullName(), ft)) + } + switch fd.Kind() { + case protoreflect.MessageKind: + return mi, pointerCoderFuncs{ + size: sizeOpaqueMessage, + marshal: appendOpaqueMessage, + unmarshal: consumeOpaqueMessage, + isInit: isInitOpaqueMessage, + merge: mergeOpaqueMessage, + } + case protoreflect.GroupKind: + return mi, pointerCoderFuncs{ + size: sizeOpaqueGroup, + marshal: appendOpaqueGroup, + unmarshal: consumeOpaqueGroup, + isInit: isInitOpaqueMessage, + merge: mergeOpaqueMessage, + } + } + panic("unexpected field kind") +} + +func sizeOpaqueMessage(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { + return protowire.SizeBytes(f.mi.sizePointer(p.AtomicGetPointer(), opts)) + f.tagsize +} + +func appendOpaqueMessage(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { + mp := p.AtomicGetPointer() + calculatedSize := f.mi.sizePointer(mp, opts) + b = protowire.AppendVarint(b, f.wiretag) + b = protowire.AppendVarint(b, uint64(calculatedSize)) + before := len(b) + b, err := f.mi.marshalAppendPointer(b, mp, opts) + if measuredSize := len(b) - before; calculatedSize != measuredSize && err == nil { + return nil, errors.MismatchedSizeCalculation(calculatedSize, measuredSize) + } + return b, err +} + +func consumeOpaqueMessage(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { + if wtyp != protowire.BytesType { + return out, errUnknown + } + v, n := protowire.ConsumeBytes(b) + if n < 0 { + return out, errDecode + } + mp := p.AtomicGetPointer() + if mp.IsNil() { + mp = p.AtomicSetPointerIfNil(pointerOfValue(reflect.New(f.mi.GoReflectType.Elem()))) + } + o, err := f.mi.unmarshalPointer(v, mp, 0, opts) + if err != nil { + return out, err + } + out.n = n + out.initialized = o.initialized + return out, nil +} + +func isInitOpaqueMessage(p pointer, f *coderFieldInfo) error { + mp := p.AtomicGetPointer() + if mp.IsNil() { + return nil + } + return f.mi.checkInitializedPointer(mp) +} + +func mergeOpaqueMessage(dst, src pointer, f *coderFieldInfo, opts mergeOptions) { + dstmp := dst.AtomicGetPointer() + if dstmp.IsNil() { + dstmp = dst.AtomicSetPointerIfNil(pointerOfValue(reflect.New(f.mi.GoReflectType.Elem()))) + } + f.mi.mergePointer(dstmp, src.AtomicGetPointer(), opts) +} + +func sizeOpaqueGroup(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { + return 2*f.tagsize + f.mi.sizePointer(p.AtomicGetPointer(), opts) +} + +func appendOpaqueGroup(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { + b = protowire.AppendVarint(b, f.wiretag) // start group + b, err := f.mi.marshalAppendPointer(b, p.AtomicGetPointer(), opts) + b = protowire.AppendVarint(b, f.wiretag+1) // end group + return b, err +} + +func consumeOpaqueGroup(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { + if wtyp != protowire.StartGroupType { + return out, errUnknown + } + mp := p.AtomicGetPointer() + if mp.IsNil() { + mp = p.AtomicSetPointerIfNil(pointerOfValue(reflect.New(f.mi.GoReflectType.Elem()))) + } + o, e := f.mi.unmarshalPointer(b, mp, f.num, opts) + return o, e +} + +func makeOpaqueRepeatedMessageFieldCoder(fd protoreflect.FieldDescriptor, ft reflect.Type) (*MessageInfo, pointerCoderFuncs) { + if ft.Kind() != reflect.Ptr || ft.Elem().Kind() != reflect.Slice { + panic(fmt.Sprintf("invalid field: %v: unsupported type for opaque repeated message: %v", fd.FullName(), ft)) + } + mt := ft.Elem().Elem() // *[]*T -> *T + mi := getMessageInfo(mt) + if mi == nil { + panic(fmt.Sprintf("invalid field: %v: unsupported message type %v", fd.FullName(), mt)) + } + switch fd.Kind() { + case protoreflect.MessageKind: + return mi, pointerCoderFuncs{ + size: sizeOpaqueMessageSlice, + marshal: appendOpaqueMessageSlice, + unmarshal: consumeOpaqueMessageSlice, + isInit: isInitOpaqueMessageSlice, + merge: mergeOpaqueMessageSlice, + } + case protoreflect.GroupKind: + return mi, pointerCoderFuncs{ + size: sizeOpaqueGroupSlice, + marshal: appendOpaqueGroupSlice, + unmarshal: consumeOpaqueGroupSlice, + isInit: isInitOpaqueMessageSlice, + merge: mergeOpaqueMessageSlice, + } + } + panic("unexpected field kind") +} + +func sizeOpaqueMessageSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { + s := p.AtomicGetPointer().PointerSlice() + n := 0 + for _, v := range s { + n += protowire.SizeBytes(f.mi.sizePointer(v, opts)) + f.tagsize + } + return n +} + +func appendOpaqueMessageSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { + s := p.AtomicGetPointer().PointerSlice() + var err error + for _, v := range s { + 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 +} + +func consumeOpaqueMessageSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { + if wtyp != protowire.BytesType { + return out, errUnknown + } + v, n := protowire.ConsumeBytes(b) + if n < 0 { + return out, errDecode + } + mp := pointerOfValue(reflect.New(f.mi.GoReflectType.Elem())) + o, err := f.mi.unmarshalPointer(v, mp, 0, opts) + if err != nil { + return out, err + } + sp := p.AtomicGetPointer() + if sp.IsNil() { + sp = p.AtomicSetPointerIfNil(pointerOfValue(reflect.New(f.ft.Elem()))) + } + sp.AppendPointerSlice(mp) + out.n = n + out.initialized = o.initialized + return out, nil +} + +func isInitOpaqueMessageSlice(p pointer, f *coderFieldInfo) error { + sp := p.AtomicGetPointer() + if sp.IsNil() { + return nil + } + s := sp.PointerSlice() + for _, v := range s { + if err := f.mi.checkInitializedPointer(v); err != nil { + return err + } + } + return nil +} + +func mergeOpaqueMessageSlice(dst, src pointer, f *coderFieldInfo, opts mergeOptions) { + ds := dst.AtomicGetPointer() + if ds.IsNil() { + ds = dst.AtomicSetPointerIfNil(pointerOfValue(reflect.New(f.ft.Elem()))) + } + for _, sp := range src.AtomicGetPointer().PointerSlice() { + dm := pointerOfValue(reflect.New(f.mi.GoReflectType.Elem())) + f.mi.mergePointer(dm, sp, opts) + ds.AppendPointerSlice(dm) + } +} + +func sizeOpaqueGroupSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { + s := p.AtomicGetPointer().PointerSlice() + n := 0 + for _, v := range s { + n += 2*f.tagsize + f.mi.sizePointer(v, opts) + } + return n +} + +func appendOpaqueGroupSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { + s := p.AtomicGetPointer().PointerSlice() + var err error + for _, v := range s { + b = protowire.AppendVarint(b, f.wiretag) // start group + b, err = f.mi.marshalAppendPointer(b, v, opts) + if err != nil { + return b, err + } + b = protowire.AppendVarint(b, f.wiretag+1) // end group + } + return b, nil +} + +func consumeOpaqueGroupSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { + if wtyp != protowire.StartGroupType { + return out, errUnknown + } + mp := pointerOfValue(reflect.New(f.mi.GoReflectType.Elem())) + out, err = f.mi.unmarshalPointer(b, mp, f.num, opts) + if err != nil { + return out, err + } + sp := p.AtomicGetPointer() + if sp.IsNil() { + sp = p.AtomicSetPointerIfNil(pointerOfValue(reflect.New(f.ft.Elem()))) + } + sp.AppendPointerSlice(mp) + return out, err +} 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 fb35f0bae..229c69801 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_map.go +++ b/vendor/google.golang.org/protobuf/internal/impl/codec_map.go @@ -94,7 +94,7 @@ func sizeMap(mapv reflect.Value, mapi *mapInfo, f *coderFieldInfo, opts marshalO return 0 } n := 0 - iter := mapRange(mapv) + iter := mapv.MapRange() for iter.Next() { key := mapi.conv.keyConv.PBValueOf(iter.Key()).MapKey() keySize := mapi.keyFuncs.size(key.Value(), mapKeyTagSize, opts) @@ -281,7 +281,7 @@ func appendMap(b []byte, mapv reflect.Value, mapi *mapInfo, f *coderFieldInfo, o if opts.Deterministic() { return appendMapDeterministic(b, mapv, mapi, f, opts) } - iter := mapRange(mapv) + iter := mapv.MapRange() for iter.Next() { var err error b = protowire.AppendVarint(b, f.wiretag) @@ -328,7 +328,7 @@ func isInitMap(mapv reflect.Value, mapi *mapInfo, f *coderFieldInfo) error { if !mi.needsInitCheck { return nil } - iter := mapRange(mapv) + iter := mapv.MapRange() for iter.Next() { val := pointerOfValue(iter.Value()) if err := mi.checkInitializedPointer(val); err != nil { @@ -336,7 +336,7 @@ func isInitMap(mapv reflect.Value, mapi *mapInfo, f *coderFieldInfo) error { } } } else { - iter := mapRange(mapv) + iter := mapv.MapRange() for iter.Next() { val := mapi.conv.valConv.PBValueOf(iter.Value()) if err := mapi.valFuncs.isInit(val); err != nil { @@ -356,7 +356,7 @@ func mergeMap(dst, src pointer, f *coderFieldInfo, opts mergeOptions) { if dstm.IsNil() { dstm.Set(reflect.MakeMap(f.ft)) } - iter := mapRange(srcm) + iter := srcm.MapRange() for iter.Next() { dstm.SetMapIndex(iter.Key(), iter.Value()) } @@ -371,7 +371,7 @@ func mergeMapOfBytes(dst, src pointer, f *coderFieldInfo, opts mergeOptions) { if dstm.IsNil() { dstm.Set(reflect.MakeMap(f.ft)) } - iter := mapRange(srcm) + iter := srcm.MapRange() for iter.Next() { dstm.SetMapIndex(iter.Key(), reflect.ValueOf(append(emptyBuf[:], iter.Value().Bytes()...))) } @@ -386,7 +386,7 @@ func mergeMapOfMessage(dst, src pointer, f *coderFieldInfo, opts mergeOptions) { if dstm.IsNil() { dstm.Set(reflect.MakeMap(f.ft)) } - iter := mapRange(srcm) + iter := srcm.MapRange() for iter.Next() { val := reflect.New(f.ft.Elem().Elem()) if f.mi != nil { diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_map_go111.go b/vendor/google.golang.org/protobuf/internal/impl/codec_map_go111.go deleted file mode 100644 index 4b15493f2..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_map_go111.go +++ /dev/null @@ -1,38 +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 !go1.12 -// +build !go1.12 - -package impl - -import "reflect" - -type mapIter struct { - v reflect.Value - keys []reflect.Value -} - -// mapRange provides a less-efficient equivalent to -// the Go 1.12 reflect.Value.MapRange method. -func mapRange(v reflect.Value) *mapIter { - return &mapIter{v: v} -} - -func (i *mapIter) Next() bool { - if i.keys == nil { - i.keys = i.v.MapKeys() - } else { - i.keys = i.keys[1:] - } - return len(i.keys) > 0 -} - -func (i *mapIter) Key() reflect.Value { - return i.keys[0] -} - -func (i *mapIter) Value() reflect.Value { - return i.v.MapIndex(i.keys[0]) -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_map_go112.go b/vendor/google.golang.org/protobuf/internal/impl/codec_map_go112.go deleted file mode 100644 index 0b31b66ea..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_map_go112.go +++ /dev/null @@ -1,12 +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 go1.12 -// +build go1.12 - -package impl - -import "reflect" - -func mapRange(v reflect.Value) *reflect.MapIter { return v.MapRange() } 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..f78b57b04 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_message.go +++ b/vendor/google.golang.org/protobuf/internal/impl/codec_message.go @@ -32,6 +32,10 @@ type coderMessageInfo struct { needsInitCheck bool isMessageSet bool numRequiredFields uint8 + + lazyOffset offset + presenceOffset offset + presenceSize presenceSize } type coderFieldInfo struct { @@ -45,12 +49,19 @@ type coderFieldInfo struct { tagsize int // size of the varint-encoded tag isPointer bool // true if IsNil may be called on the struct field isRequired bool // true if field is required + + isLazy bool + presenceIndex uint32 } +const noPresence = 0xffffffff + func (mi *MessageInfo) makeCoderMethods(t reflect.Type, si structInfo) { mi.sizecacheOffset = invalidOffset mi.unknownOffset = invalidOffset mi.extensionOffset = invalidOffset + mi.lazyOffset = invalidOffset + mi.presenceOffset = si.presenceOffset if si.sizecacheOffset.IsValid() && si.sizecacheType == sizecacheType { mi.sizecacheOffset = si.sizecacheOffset @@ -107,12 +118,9 @@ func (mi *MessageInfo) makeCoderMethods(t reflect.Type, si structInfo) { }, } case isOneof: - fieldOffset = offsetOf(fs, mi.Exporter) - case fd.IsWeak(): - fieldOffset = si.weakOffset - funcs = makeWeakMessageFieldCoder(fd) + fieldOffset = offsetOf(fs) default: - fieldOffset = offsetOf(fs, mi.Exporter) + fieldOffset = offsetOf(fs) childMessage, funcs = fieldCoder(fd, ft) } cf := &preallocFields[i] @@ -127,6 +135,8 @@ func (mi *MessageInfo) makeCoderMethods(t reflect.Type, si structInfo) { validation: newFieldValidationInfo(mi, si, fd, ft), isPointer: fd.Cardinality() == protoreflect.Repeated || fd.HasPresence(), isRequired: fd.Cardinality() == protoreflect.Required, + + presenceIndex: noPresence, } mi.orderedCoderFields = append(mi.orderedCoderFields, cf) mi.coderFields[cf.num] = cf @@ -189,6 +199,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_message_opaque.go b/vendor/google.golang.org/protobuf/internal/impl/codec_message_opaque.go new file mode 100644 index 000000000..bdad12a9b --- /dev/null +++ b/vendor/google.golang.org/protobuf/internal/impl/codec_message_opaque.go @@ -0,0 +1,154 @@ +// 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 ( + "fmt" + "reflect" + "sort" + + "google.golang.org/protobuf/encoding/protowire" + "google.golang.org/protobuf/internal/encoding/messageset" + "google.golang.org/protobuf/internal/filedesc" + "google.golang.org/protobuf/internal/order" + "google.golang.org/protobuf/reflect/protoreflect" + piface "google.golang.org/protobuf/runtime/protoiface" +) + +func (mi *MessageInfo) makeOpaqueCoderMethods(t reflect.Type, si opaqueStructInfo) { + mi.sizecacheOffset = si.sizecacheOffset + mi.unknownOffset = si.unknownOffset + mi.unknownPtrKind = si.unknownType.Kind() == reflect.Ptr + mi.extensionOffset = si.extensionOffset + mi.lazyOffset = si.lazyOffset + mi.presenceOffset = si.presenceOffset + + mi.coderFields = make(map[protowire.Number]*coderFieldInfo) + fields := mi.Desc.Fields() + for i := 0; i < fields.Len(); i++ { + fd := fields.Get(i) + + fs := si.fieldsByNumber[fd.Number()] + if fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic() { + fs = si.oneofsByName[fd.ContainingOneof().Name()] + } + ft := fs.Type + var wiretag uint64 + if !fd.IsPacked() { + wiretag = protowire.EncodeTag(fd.Number(), wireTypes[fd.Kind()]) + } else { + wiretag = protowire.EncodeTag(fd.Number(), protowire.BytesType) + } + var fieldOffset offset + var funcs pointerCoderFuncs + var childMessage *MessageInfo + switch { + case fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic(): + fieldOffset = offsetOf(fs) + case fd.Message() != nil && !fd.IsMap(): + fieldOffset = offsetOf(fs) + if fd.IsList() { + childMessage, funcs = makeOpaqueRepeatedMessageFieldCoder(fd, ft) + } else { + childMessage, funcs = makeOpaqueMessageFieldCoder(fd, ft) + } + default: + fieldOffset = offsetOf(fs) + childMessage, funcs = fieldCoder(fd, ft) + } + cf := &coderFieldInfo{ + num: fd.Number(), + offset: fieldOffset, + wiretag: wiretag, + ft: ft, + tagsize: protowire.SizeVarint(wiretag), + funcs: funcs, + mi: childMessage, + validation: newFieldValidationInfo(mi, si.structInfo, fd, ft), + isPointer: (fd.Cardinality() == protoreflect.Repeated || + fd.Kind() == protoreflect.MessageKind || + fd.Kind() == protoreflect.GroupKind), + isRequired: fd.Cardinality() == protoreflect.Required, + presenceIndex: noPresence, + } + + // TODO: Use presence for all fields. + // + // In some cases, such as maps, presence means only "might be set" rather + // than "is definitely set", but every field should have a presence bit to + // permit us to skip over definitely-unset fields at marshal time. + + var hasPresence bool + hasPresence, cf.isLazy = filedesc.UsePresenceForField(fd) + + if hasPresence { + cf.presenceIndex, mi.presenceSize = presenceIndex(mi.Desc, fd) + } + + mi.orderedCoderFields = append(mi.orderedCoderFields, cf) + mi.coderFields[cf.num] = cf + } + for i, oneofs := 0, mi.Desc.Oneofs(); i < oneofs.Len(); i++ { + if od := oneofs.Get(i); !od.IsSynthetic() { + mi.initOneofFieldCoders(od, si.structInfo) + } + } + if messageset.IsMessageSet(mi.Desc) { + if !mi.extensionOffset.IsValid() { + panic(fmt.Sprintf("%v: MessageSet with no extensions field", mi.Desc.FullName())) + } + if !mi.unknownOffset.IsValid() { + panic(fmt.Sprintf("%v: MessageSet with no unknown field", mi.Desc.FullName())) + } + mi.isMessageSet = true + } + sort.Slice(mi.orderedCoderFields, func(i, j int) bool { + return mi.orderedCoderFields[i].num < mi.orderedCoderFields[j].num + }) + + var maxDense protoreflect.FieldNumber + for _, cf := range mi.orderedCoderFields { + if cf.num >= 16 && cf.num >= 2*maxDense { + break + } + maxDense = cf.num + } + mi.denseCoderFields = make([]*coderFieldInfo, maxDense+1) + for _, cf := range mi.orderedCoderFields { + if int(cf.num) > len(mi.denseCoderFields) { + break + } + mi.denseCoderFields[cf.num] = cf + } + + // To preserve compatibility with historic wire output, marshal oneofs last. + if mi.Desc.Oneofs().Len() > 0 { + sort.Slice(mi.orderedCoderFields, func(i, j int) bool { + fi := fields.ByNumber(mi.orderedCoderFields[i].num) + fj := fields.ByNumber(mi.orderedCoderFields[j].num) + return order.LegacyFieldOrder(fi, fj) + }) + } + + mi.needsInitCheck = needsInitCheck(mi.Desc) + if mi.methods.Marshal == nil && mi.methods.Size == nil { + mi.methods.Flags |= piface.SupportMarshalDeterministic + mi.methods.Marshal = mi.marshal + mi.methods.Size = mi.size + } + if mi.methods.Unmarshal == nil { + mi.methods.Flags |= piface.SupportUnmarshalDiscardUnknown + mi.methods.Unmarshal = mi.unmarshal + } + if mi.methods.CheckInitialized == nil { + mi.methods.CheckInitialized = mi.checkInitialized + } + if mi.methods.Merge == nil { + mi.methods.Merge = mi.merge + } + if mi.methods.Equal == nil { + mi.methods.Equal = equal + } +} 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 e06ece55a..f72ddd882 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/convert.go +++ b/vendor/google.golang.org/protobuf/internal/impl/convert.go @@ -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_map.go b/vendor/google.golang.org/protobuf/internal/impl/convert_map.go index 304244a65..e4580b3ac 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/convert_map.go +++ b/vendor/google.golang.org/protobuf/internal/impl/convert_map.go @@ -101,7 +101,7 @@ func (ms *mapReflect) Mutable(k protoreflect.MapKey) protoreflect.Value { return v } func (ms *mapReflect) Range(f func(protoreflect.MapKey, protoreflect.Value) bool) { - iter := mapRange(ms.v) + iter := ms.v.MapRange() for iter.Next() { k := ms.keyConv.PBValueOf(iter.Key()).MapKey() v := ms.valConv.PBValueOf(iter.Value()) diff --git a/vendor/google.golang.org/protobuf/internal/impl/decode.go b/vendor/google.golang.org/protobuf/internal/impl/decode.go index cda0520c2..e0dd21fa5 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/decode.go +++ b/vendor/google.golang.org/protobuf/internal/impl/decode.go @@ -34,6 +34,8 @@ func (o unmarshalOptions) Options() proto.UnmarshalOptions { AllowPartial: true, DiscardUnknown: o.DiscardUnknown(), Resolver: o.resolver, + + NoLazyDecoding: o.NoLazyDecoding(), } } @@ -41,13 +43,26 @@ func (o unmarshalOptions) DiscardUnknown() bool { return o.flags&protoiface.UnmarshalDiscardUnknown != 0 } -func (o unmarshalOptions) IsDefault() bool { - return o.flags == 0 && o.resolver == protoregistry.GlobalTypes +func (o unmarshalOptions) AliasBuffer() bool { return o.flags&protoiface.UnmarshalAliasBuffer != 0 } +func (o unmarshalOptions) Validated() bool { return o.flags&protoiface.UnmarshalValidated != 0 } +func (o unmarshalOptions) NoLazyDecoding() bool { + return o.flags&protoiface.UnmarshalNoLazyDecoding != 0 +} + +func (o unmarshalOptions) CanBeLazy() bool { + if o.resolver != protoregistry.GlobalTypes { + return false + } + // We ignore the UnmarshalInvalidateSizeCache even though it's not in the default set + return (o.flags & ^(protoiface.UnmarshalAliasBuffer | protoiface.UnmarshalValidated | protoiface.UnmarshalCheckRequired)) == 0 } var lazyUnmarshalOptions = unmarshalOptions{ resolver: protoregistry.GlobalTypes, - depth: protowire.DefaultRecursionLimit, + + flags: protoiface.UnmarshalAliasBuffer | protoiface.UnmarshalValidated, + + depth: protowire.DefaultRecursionLimit, } type unmarshalOutput struct { @@ -94,9 +109,30 @@ func (mi *MessageInfo) unmarshalPointer(b []byte, p pointer, groupTag protowire. if flags.ProtoLegacy && mi.isMessageSet { return unmarshalMessageSet(mi, b, p, opts) } + + lazyDecoding := LazyEnabled() // default + if opts.NoLazyDecoding() { + lazyDecoding = false // explicitly disabled + } + if mi.lazyOffset.IsValid() && lazyDecoding { + return mi.unmarshalPointerLazy(b, p, groupTag, opts) + } + return mi.unmarshalPointerEager(b, p, groupTag, opts) +} + +// unmarshalPointerEager is the message unmarshalling function for all messages that are not lazy. +// The corresponding function for Lazy is in google_lazy.go. +func (mi *MessageInfo) unmarshalPointerEager(b []byte, p pointer, groupTag protowire.Number, opts unmarshalOptions) (out unmarshalOutput, err error) { + initialized := true var requiredMask uint64 var exts *map[int32]ExtensionField + + var presence presence + if mi.presenceOffset.IsValid() { + presence = p.Apply(mi.presenceOffset).PresenceInfo() + } + start := len(b) for len(b) > 0 { // Parse the tag (field number and wire type). @@ -154,6 +190,11 @@ func (mi *MessageInfo) unmarshalPointer(b []byte, p pointer, groupTag protowire. if f.funcs.isInit != nil && !o.initialized { initialized = false } + + if f.presenceIndex != noPresence { + presence.SetPresentUnatomic(f.presenceIndex, mi.presenceSize) + } + default: // Possible extension. if exts == nil && mi.extensionOffset.IsValid() { @@ -222,7 +263,7 @@ func (mi *MessageInfo) unmarshalExtension(b []byte, num protowire.Number, wtyp p return out, errUnknown } if flags.LazyUnmarshalExtensions { - if opts.IsDefault() && x.canLazy(xt) { + if opts.CanBeLazy() && x.canLazy(xt) { out, valid := skipExtension(b, xi, num, wtyp, opts) switch valid { case ValidationValid: @@ -270,6 +311,13 @@ func skipExtension(b []byte, xi *extensionFieldInfo, num protowire.Number, wtyp if n < 0 { return out, ValidationUnknown } + + if opts.Validated() { + out.initialized = true + out.n = n + return out, ValidationValid + } + out, st := xi.validation.mi.validate(v, 0, opts) out.n = n return out, st diff --git a/vendor/google.golang.org/protobuf/internal/impl/encode.go b/vendor/google.golang.org/protobuf/internal/impl/encode.go index febd21224..b2e212291 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/encode.go +++ b/vendor/google.golang.org/protobuf/internal/impl/encode.go @@ -10,7 +10,8 @@ import ( "sync/atomic" "google.golang.org/protobuf/internal/flags" - proto "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/internal/protolazy" + "google.golang.org/protobuf/proto" piface "google.golang.org/protobuf/runtime/protoiface" ) @@ -71,11 +72,39 @@ func (mi *MessageInfo) sizePointerSlow(p pointer, opts marshalOptions) (size int e := p.Apply(mi.extensionOffset).Extensions() size += mi.sizeExtensions(e, opts) } + + var lazy **protolazy.XXX_lazyUnmarshalInfo + var presence presence + if mi.presenceOffset.IsValid() { + presence = p.Apply(mi.presenceOffset).PresenceInfo() + if mi.lazyOffset.IsValid() { + lazy = p.Apply(mi.lazyOffset).LazyInfoPtr() + } + } + for _, f := range mi.orderedCoderFields { if f.funcs.size == nil { continue } fptr := p.Apply(f.offset) + + if f.presenceIndex != noPresence { + if !presence.Present(f.presenceIndex) { + continue + } + + if f.isLazy && fptr.AtomicGetPointer().IsNil() { + if lazyFields(opts) { + size += (*lazy).SizeField(uint32(f.num)) + continue + } else { + mi.lazyUnmarshal(p, f.num) + } + } + size += f.funcs.size(fptr, f, opts) + continue + } + if f.isPointer && fptr.Elem().IsNil() { continue } @@ -134,11 +163,52 @@ func (mi *MessageInfo) marshalAppendPointer(b []byte, p pointer, opts marshalOpt return b, err } } + + var lazy **protolazy.XXX_lazyUnmarshalInfo + var presence presence + if mi.presenceOffset.IsValid() { + presence = p.Apply(mi.presenceOffset).PresenceInfo() + if mi.lazyOffset.IsValid() { + lazy = p.Apply(mi.lazyOffset).LazyInfoPtr() + } + } + for _, f := range mi.orderedCoderFields { if f.funcs.marshal == nil { continue } fptr := p.Apply(f.offset) + + if f.presenceIndex != noPresence { + if !presence.Present(f.presenceIndex) { + continue + } + if f.isLazy { + // Be careful, this field needs to be read atomically, like for a get + if f.isPointer && fptr.AtomicGetPointer().IsNil() { + if lazyFields(opts) { + b, _ = (*lazy).AppendField(b, uint32(f.num)) + continue + } else { + mi.lazyUnmarshal(p, f.num) + } + } + + b, err = f.funcs.marshal(b, fptr, f, opts) + if err != nil { + return b, err + } + continue + } else if f.isPointer && fptr.Elem().IsNil() { + continue + } + b, err = f.funcs.marshal(b, fptr, f, opts) + if err != nil { + return b, err + } + continue + } + if f.isPointer && fptr.Elem().IsNil() { continue } @@ -163,6 +233,14 @@ func fullyLazyExtensions(opts marshalOptions) bool { return opts.flags&piface.MarshalDeterministic == 0 } +// lazyFields returns true if we should attempt to keep fields lazy over size and marshal. +func lazyFields(opts marshalOptions) bool { + // When deterministic marshaling is requested, force an unmarshal for lazy + // fields 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 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/lazy.go b/vendor/google.golang.org/protobuf/internal/impl/lazy.go new file mode 100644 index 000000000..c7de31e24 --- /dev/null +++ b/vendor/google.golang.org/protobuf/internal/impl/lazy.go @@ -0,0 +1,433 @@ +// 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 ( + "fmt" + "math/bits" + "os" + "reflect" + "sort" + "sync/atomic" + + "google.golang.org/protobuf/encoding/protowire" + "google.golang.org/protobuf/internal/errors" + "google.golang.org/protobuf/internal/protolazy" + "google.golang.org/protobuf/reflect/protoreflect" + preg "google.golang.org/protobuf/reflect/protoregistry" + piface "google.golang.org/protobuf/runtime/protoiface" +) + +var enableLazy int32 = func() int32 { + if os.Getenv("GOPROTODEBUG") == "nolazy" { + return 0 + } + return 1 +}() + +// EnableLazyUnmarshal enables lazy unmarshaling. +func EnableLazyUnmarshal(enable bool) { + if enable { + atomic.StoreInt32(&enableLazy, 1) + return + } + atomic.StoreInt32(&enableLazy, 0) +} + +// LazyEnabled reports whether lazy unmarshalling is currently enabled. +func LazyEnabled() bool { + return atomic.LoadInt32(&enableLazy) != 0 +} + +// UnmarshalField unmarshals a field in a message. +func UnmarshalField(m interface{}, num protowire.Number) { + switch m := m.(type) { + case *messageState: + m.messageInfo().lazyUnmarshal(m.pointer(), num) + case *messageReflectWrapper: + m.messageInfo().lazyUnmarshal(m.pointer(), num) + default: + panic(fmt.Sprintf("unsupported wrapper type %T", m)) + } +} + +func (mi *MessageInfo) lazyUnmarshal(p pointer, num protoreflect.FieldNumber) { + var f *coderFieldInfo + if int(num) < len(mi.denseCoderFields) { + f = mi.denseCoderFields[num] + } else { + f = mi.coderFields[num] + } + if f == nil { + panic(fmt.Sprintf("lazyUnmarshal: field info for %v.%v", mi.Desc.FullName(), num)) + } + lazy := *p.Apply(mi.lazyOffset).LazyInfoPtr() + start, end, found, _, multipleEntries := lazy.FindFieldInProto(uint32(num)) + if !found && multipleEntries == nil { + panic(fmt.Sprintf("lazyUnmarshal: can't find field data for %v.%v", mi.Desc.FullName(), num)) + } + // The actual pointer in the message can not be set until the whole struct is filled in, otherwise we will have races. + // Create another pointer and set it atomically, if we won the race and the pointer in the original message is still nil. + fp := pointerOfValue(reflect.New(f.ft)) + if multipleEntries != nil { + for _, entry := range multipleEntries { + mi.unmarshalField(lazy.Buffer()[entry.Start:entry.End], fp, f, lazy, lazy.UnmarshalFlags()) + } + } else { + mi.unmarshalField(lazy.Buffer()[start:end], fp, f, lazy, lazy.UnmarshalFlags()) + } + p.Apply(f.offset).AtomicSetPointerIfNil(fp.Elem()) +} + +func (mi *MessageInfo) unmarshalField(b []byte, p pointer, f *coderFieldInfo, lazyInfo *protolazy.XXX_lazyUnmarshalInfo, flags piface.UnmarshalInputFlags) error { + opts := lazyUnmarshalOptions + opts.flags |= flags + for len(b) > 0 { + // Parse the tag (field number and wire type). + var tag uint64 + if b[0] < 0x80 { + tag = uint64(b[0]) + b = b[1:] + } else if len(b) >= 2 && b[1] < 128 { + tag = uint64(b[0]&0x7f) + uint64(b[1])<<7 + b = b[2:] + } else { + var n int + tag, n = protowire.ConsumeVarint(b) + if n < 0 { + return errors.New("invalid wire data") + } + b = b[n:] + } + var num protowire.Number + if n := tag >> 3; n < uint64(protowire.MinValidNumber) || n > uint64(protowire.MaxValidNumber) { + return errors.New("invalid wire data") + } else { + num = protowire.Number(n) + } + wtyp := protowire.Type(tag & 7) + if num == f.num { + o, err := f.funcs.unmarshal(b, p, wtyp, f, opts) + if err == nil { + b = b[o.n:] + continue + } + if err != errUnknown { + return err + } + } + n := protowire.ConsumeFieldValue(num, wtyp, b) + if n < 0 { + return errors.New("invalid wire data") + } + b = b[n:] + } + return nil +} + +func (mi *MessageInfo) skipField(b []byte, f *coderFieldInfo, wtyp protowire.Type, opts unmarshalOptions) (out unmarshalOutput, _ ValidationStatus) { + fmi := f.validation.mi + if fmi == nil { + fd := mi.Desc.Fields().ByNumber(f.num) + if fd == nil { + return out, ValidationUnknown + } + messageName := fd.Message().FullName() + messageType, err := preg.GlobalTypes.FindMessageByName(messageName) + if err != nil { + return out, ValidationUnknown + } + var ok bool + fmi, ok = messageType.(*MessageInfo) + if !ok { + return out, ValidationUnknown + } + } + fmi.init() + switch f.validation.typ { + case validationTypeMessage: + if wtyp != protowire.BytesType { + return out, ValidationWrongWireType + } + v, n := protowire.ConsumeBytes(b) + if n < 0 { + return out, ValidationInvalid + } + out, st := fmi.validate(v, 0, opts) + out.n = n + return out, st + case validationTypeGroup: + if wtyp != protowire.StartGroupType { + return out, ValidationWrongWireType + } + out, st := fmi.validate(b, f.num, opts) + return out, st + default: + return out, ValidationUnknown + } +} + +// unmarshalPointerLazy is similar to unmarshalPointerEager, but it +// specifically handles lazy unmarshalling. it expects lazyOffset and +// presenceOffset to both be valid. +func (mi *MessageInfo) unmarshalPointerLazy(b []byte, p pointer, groupTag protowire.Number, opts unmarshalOptions) (out unmarshalOutput, err error) { + initialized := true + var requiredMask uint64 + var lazy **protolazy.XXX_lazyUnmarshalInfo + var presence presence + var lazyIndex []protolazy.IndexEntry + var lastNum protowire.Number + outOfOrder := false + lazyDecode := false + presence = p.Apply(mi.presenceOffset).PresenceInfo() + lazy = p.Apply(mi.lazyOffset).LazyInfoPtr() + if !presence.AnyPresent(mi.presenceSize) { + if opts.CanBeLazy() { + // If the message contains existing data, we need to merge into it. + // Lazy unmarshaling doesn't merge, so only enable it when the + // message is empty (has no presence bitmap). + lazyDecode = true + if *lazy == nil { + *lazy = &protolazy.XXX_lazyUnmarshalInfo{} + } + (*lazy).SetUnmarshalFlags(opts.flags) + if !opts.AliasBuffer() { + // Make a copy of the buffer for lazy unmarshaling. + // Set the AliasBuffer flag so recursive unmarshal + // operations reuse the copy. + b = append([]byte{}, b...) + opts.flags |= piface.UnmarshalAliasBuffer + } + (*lazy).SetBuffer(b) + } + } + // Track special handling of lazy fields. + // + // In the common case, all fields are lazyValidateOnly (and lazyFields remains nil). + // In the event that validation for a field fails, this map tracks handling of the field. + type lazyAction uint8 + const ( + lazyValidateOnly lazyAction = iota // validate the field only + lazyUnmarshalNow // eagerly unmarshal the field + lazyUnmarshalLater // unmarshal the field after the message is fully processed + ) + var lazyFields map[*coderFieldInfo]lazyAction + var exts *map[int32]ExtensionField + start := len(b) + pos := 0 + for len(b) > 0 { + // Parse the tag (field number and wire type). + var tag uint64 + if b[0] < 0x80 { + tag = uint64(b[0]) + b = b[1:] + } else if len(b) >= 2 && b[1] < 128 { + tag = uint64(b[0]&0x7f) + uint64(b[1])<<7 + b = b[2:] + } else { + var n int + tag, n = protowire.ConsumeVarint(b) + if n < 0 { + return out, errDecode + } + b = b[n:] + } + var num protowire.Number + if n := tag >> 3; n < uint64(protowire.MinValidNumber) || n > uint64(protowire.MaxValidNumber) { + return out, errors.New("invalid field number") + } else { + num = protowire.Number(n) + } + wtyp := protowire.Type(tag & 7) + + if wtyp == protowire.EndGroupType { + if num != groupTag { + return out, errors.New("mismatching end group marker") + } + groupTag = 0 + break + } + + var f *coderFieldInfo + if int(num) < len(mi.denseCoderFields) { + f = mi.denseCoderFields[num] + } else { + f = mi.coderFields[num] + } + var n int + err := errUnknown + discardUnknown := false + Field: + switch { + case f != nil: + if f.funcs.unmarshal == nil { + break + } + if f.isLazy && lazyDecode { + switch { + case lazyFields == nil || lazyFields[f] == lazyValidateOnly: + // Attempt to validate this field and leave it for later lazy unmarshaling. + o, valid := mi.skipField(b, f, wtyp, opts) + switch valid { + case ValidationValid: + // Skip over the valid field and continue. + err = nil + presence.SetPresentUnatomic(f.presenceIndex, mi.presenceSize) + requiredMask |= f.validation.requiredBit + if !o.initialized { + initialized = false + } + n = o.n + break Field + case ValidationInvalid: + return out, errors.New("invalid proto wire format") + case ValidationWrongWireType: + break Field + case ValidationUnknown: + if lazyFields == nil { + lazyFields = make(map[*coderFieldInfo]lazyAction) + } + if presence.Present(f.presenceIndex) { + // We were unable to determine if the field is valid or not, + // and we've already skipped over at least one instance of this + // field. Clear the presence bit (so if we stop decoding early, + // we don't leave a partially-initialized field around) and flag + // the field for unmarshaling before we return. + presence.ClearPresent(f.presenceIndex) + lazyFields[f] = lazyUnmarshalLater + discardUnknown = true + break Field + } else { + // We were unable to determine if the field is valid or not, + // but this is the first time we've seen it. Flag it as needing + // eager unmarshaling and fall through to the eager unmarshal case below. + lazyFields[f] = lazyUnmarshalNow + } + } + case lazyFields[f] == lazyUnmarshalLater: + // This field will be unmarshaled in a separate pass below. + // Skip over it here. + discardUnknown = true + break Field + default: + // Eagerly unmarshal the field. + } + } + if f.isLazy && !lazyDecode && presence.Present(f.presenceIndex) { + if p.Apply(f.offset).AtomicGetPointer().IsNil() { + mi.lazyUnmarshal(p, f.num) + } + } + var o unmarshalOutput + o, err = f.funcs.unmarshal(b, p.Apply(f.offset), wtyp, f, opts) + n = o.n + if err != nil { + break + } + requiredMask |= f.validation.requiredBit + if f.funcs.isInit != nil && !o.initialized { + initialized = false + } + if f.presenceIndex != noPresence { + presence.SetPresentUnatomic(f.presenceIndex, mi.presenceSize) + } + default: + // Possible extension. + if exts == nil && mi.extensionOffset.IsValid() { + exts = p.Apply(mi.extensionOffset).Extensions() + if *exts == nil { + *exts = make(map[int32]ExtensionField) + } + } + if exts == nil { + break + } + var o unmarshalOutput + o, err = mi.unmarshalExtension(b, num, wtyp, *exts, opts) + if err != nil { + break + } + n = o.n + if !o.initialized { + initialized = false + } + } + if err != nil { + if err != errUnknown { + return out, err + } + n = protowire.ConsumeFieldValue(num, wtyp, b) + if n < 0 { + return out, errDecode + } + if !discardUnknown && !opts.DiscardUnknown() && mi.unknownOffset.IsValid() { + u := mi.mutableUnknownBytes(p) + *u = protowire.AppendTag(*u, num, wtyp) + *u = append(*u, b[:n]...) + } + } + b = b[n:] + end := start - len(b) + if lazyDecode && f != nil && f.isLazy { + if num != lastNum { + lazyIndex = append(lazyIndex, protolazy.IndexEntry{ + FieldNum: uint32(num), + Start: uint32(pos), + End: uint32(end), + }) + } else { + i := len(lazyIndex) - 1 + lazyIndex[i].End = uint32(end) + lazyIndex[i].MultipleContiguous = true + } + } + if num < lastNum { + outOfOrder = true + } + pos = end + lastNum = num + } + if groupTag != 0 { + return out, errors.New("missing end group marker") + } + if lazyFields != nil { + // Some fields failed validation, and now need to be unmarshaled. + for f, action := range lazyFields { + if action != lazyUnmarshalLater { + continue + } + initialized = false + if *lazy == nil { + *lazy = &protolazy.XXX_lazyUnmarshalInfo{} + } + if err := mi.unmarshalField((*lazy).Buffer(), p.Apply(f.offset), f, *lazy, opts.flags); err != nil { + return out, err + } + presence.SetPresentUnatomic(f.presenceIndex, mi.presenceSize) + } + } + if lazyDecode { + if outOfOrder { + sort.Slice(lazyIndex, func(i, j int) bool { + return lazyIndex[i].FieldNum < lazyIndex[j].FieldNum || + (lazyIndex[i].FieldNum == lazyIndex[j].FieldNum && + lazyIndex[i].Start < lazyIndex[j].Start) + }) + } + if *lazy == nil { + *lazy = &protolazy.XXX_lazyUnmarshalInfo{} + } + + (*lazy).SetIndex(lazyIndex) + } + if mi.numRequiredFields > 0 && bits.OnesCount64(requiredMask) != int(mi.numRequiredFields) { + initialized = false + } + if initialized { + out.initialized = true + } + out.n = start - len(b) + return out, nil +} 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 6e8677ee6..b6849d669 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go +++ b/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go @@ -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_message.go b/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go index bf0b6049b..a51dffbe2 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go +++ b/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go @@ -310,12 +310,9 @@ func aberrantAppendField(md *filedesc.Message, goType reflect.Type, tag, tagKey, fd.L0.Parent = md fd.L0.Index = n - if fd.L1.IsWeak || fd.L1.EditionFeatures.IsPacked { + if 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.EditionFeatures.IsPacked { opts.Set(opts.Descriptor().Fields().ByName("packed"), protoreflect.ValueOfBool(fd.L1.EditionFeatures.IsPacked)) } diff --git a/vendor/google.golang.org/protobuf/internal/impl/merge.go b/vendor/google.golang.org/protobuf/internal/impl/merge.go index 7e65f64f2..8ffdce67d 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/merge.go +++ b/vendor/google.golang.org/protobuf/internal/impl/merge.go @@ -41,11 +41,38 @@ func (mi *MessageInfo) mergePointer(dst, src pointer, opts mergeOptions) { if src.IsNil() { return } + + var presenceSrc presence + var presenceDst presence + if mi.presenceOffset.IsValid() { + presenceSrc = src.Apply(mi.presenceOffset).PresenceInfo() + presenceDst = dst.Apply(mi.presenceOffset).PresenceInfo() + } + for _, f := range mi.orderedCoderFields { if f.funcs.merge == nil { continue } sfptr := src.Apply(f.offset) + + if f.presenceIndex != noPresence { + if !presenceSrc.Present(f.presenceIndex) { + continue + } + dfptr := dst.Apply(f.offset) + if f.isLazy { + if sfptr.AtomicGetPointer().IsNil() { + mi.lazyUnmarshal(src, f.num) + } + if presenceDst.Present(f.presenceIndex) && dfptr.AtomicGetPointer().IsNil() { + mi.lazyUnmarshal(dst, f.num) + } + } + f.funcs.merge(dst.Apply(f.offset), sfptr, f, opts) + presenceDst.SetPresentUnatomic(f.presenceIndex, mi.presenceSize) + continue + } + if f.isPointer && sfptr.Elem().IsNil() { continue } diff --git a/vendor/google.golang.org/protobuf/internal/impl/message.go b/vendor/google.golang.org/protobuf/internal/impl/message.go index 019399d45..d50423dcb 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/message.go +++ b/vendor/google.golang.org/protobuf/internal/impl/message.go @@ -14,7 +14,6 @@ import ( "google.golang.org/protobuf/internal/genid" "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" ) // MessageInfo provides protobuf related functionality for a given Go type @@ -30,8 +29,8 @@ 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. @@ -79,6 +78,9 @@ func (mi *MessageInfo) initOnce() { if mi.initDone == 1 { return } + if opaqueInitHook(mi) { + return + } t := mi.GoReflectType if t.Kind() != reflect.Ptr && t.Elem().Kind() != reflect.Struct { @@ -117,7 +119,6 @@ type ( var ( sizecacheType = reflect.TypeOf(SizeCache(0)) - weakFieldsType = reflect.TypeOf(WeakFields(nil)) unknownFieldsAType = reflect.TypeOf(unknownFieldsA(nil)) unknownFieldsBType = reflect.TypeOf(unknownFieldsB(nil)) extensionFieldsType = reflect.TypeOf(ExtensionFields(nil)) @@ -126,13 +127,14 @@ var ( type structInfo struct { sizecacheOffset offset sizecacheType reflect.Type - weakOffset offset - weakType reflect.Type unknownOffset offset unknownType reflect.Type extensionOffset offset extensionType reflect.Type + lazyOffset offset + presenceOffset offset + fieldsByNumber map[protoreflect.FieldNumber]reflect.StructField oneofsByName map[protoreflect.Name]reflect.StructField oneofWrappersByType map[reflect.Type]protoreflect.FieldNumber @@ -142,9 +144,10 @@ type structInfo struct { func (mi *MessageInfo) makeStructInfo(t reflect.Type) structInfo { si := structInfo{ sizecacheOffset: invalidOffset, - weakOffset: invalidOffset, unknownOffset: invalidOffset, extensionOffset: invalidOffset, + lazyOffset: invalidOffset, + presenceOffset: invalidOffset, fieldsByNumber: map[protoreflect.FieldNumber]reflect.StructField{}, oneofsByName: map[protoreflect.Name]reflect.StructField{}, @@ -157,24 +160,23 @@ fieldLoop: switch f := t.Field(i); f.Name { case genid.SizeCache_goname, genid.SizeCacheA_goname: if f.Type == sizecacheType { - si.sizecacheOffset = offsetOf(f, mi.Exporter) + si.sizecacheOffset = offsetOf(f) si.sizecacheType = f.Type } - case genid.WeakFields_goname, genid.WeakFieldsA_goname: - if f.Type == weakFieldsType { - si.weakOffset = offsetOf(f, mi.Exporter) - si.weakType = f.Type - } case genid.UnknownFields_goname, genid.UnknownFieldsA_goname: if f.Type == unknownFieldsAType || f.Type == unknownFieldsBType { - si.unknownOffset = offsetOf(f, mi.Exporter) + si.unknownOffset = offsetOf(f) si.unknownType = f.Type } case genid.ExtensionFields_goname, genid.ExtensionFieldsA_goname, genid.ExtensionFieldsB_goname: if f.Type == extensionFieldsType { - si.extensionOffset = offsetOf(f, mi.Exporter) + si.extensionOffset = offsetOf(f) si.extensionType = f.Type } + case "lazyFields", "XXX_lazyUnmarshalInfo": + si.lazyOffset = offsetOf(f) + case "XXX_presence": + si.presenceOffset = offsetOf(f) default: for _, s := range strings.Split(f.Tag.Get("protobuf"), ",") { if len(s) > 0 && strings.Trim(s, "0123456789") == "" { @@ -244,9 +246,6 @@ func (mi *MessageInfo) Message(i int) protoreflect.MessageType { mi.init() fd := mi.Desc.Fields().Get(i) switch { - case fd.IsWeak(): - mt, _ := protoregistry.GlobalTypes.FindMessageByName(fd.Message().FullName()) - return mt case fd.IsMap(): return mapEntryType{fd.Message(), mi.fieldTypes[fd.Number()]} default: diff --git a/vendor/google.golang.org/protobuf/internal/impl/message_opaque.go b/vendor/google.golang.org/protobuf/internal/impl/message_opaque.go new file mode 100644 index 000000000..5a439daac --- /dev/null +++ b/vendor/google.golang.org/protobuf/internal/impl/message_opaque.go @@ -0,0 +1,598 @@ +// 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 ( + "fmt" + "math" + "reflect" + "strings" + "sync/atomic" + + "google.golang.org/protobuf/internal/filedesc" + "google.golang.org/protobuf/reflect/protoreflect" +) + +type opaqueStructInfo struct { + structInfo +} + +// isOpaque determines whether a protobuf message type is on the Opaque API. It +// checks whether the type is a Go struct that protoc-gen-go would generate. +// +// This function only detects newly generated messages from the v2 +// implementation of protoc-gen-go. It is unable to classify generated messages +// that are too old or those that are generated by a different generator +// such as protoc-gen-gogo. +func isOpaque(t reflect.Type) bool { + // The current detection mechanism is to simply check the first field + // for a struct tag with the "protogen" key. + if t.Kind() == reflect.Struct && t.NumField() > 0 { + pgt := t.Field(0).Tag.Get("protogen") + return strings.HasPrefix(pgt, "opaque.") + } + return false +} + +func opaqueInitHook(mi *MessageInfo) bool { + mt := mi.GoReflectType.Elem() + si := opaqueStructInfo{ + structInfo: mi.makeStructInfo(mt), + } + + if !isOpaque(mt) { + return false + } + + defer atomic.StoreUint32(&mi.initDone, 1) + + mi.fields = map[protoreflect.FieldNumber]*fieldInfo{} + fds := mi.Desc.Fields() + for i := 0; i < fds.Len(); i++ { + fd := fds.Get(i) + fs := si.fieldsByNumber[fd.Number()] + var fi fieldInfo + usePresence, _ := filedesc.UsePresenceForField(fd) + + switch { + case fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic(): + // Oneofs are no different for opaque. + fi = fieldInfoForOneof(fd, si.oneofsByName[fd.ContainingOneof().Name()], mi.Exporter, si.oneofWrappersByNumber[fd.Number()]) + case fd.IsMap(): + fi = mi.fieldInfoForMapOpaque(si, fd, fs) + case fd.IsList() && fd.Message() == nil && usePresence: + fi = mi.fieldInfoForScalarListOpaque(si, fd, fs) + case fd.IsList() && fd.Message() == nil: + // Proto3 lists without presence can use same access methods as open + fi = fieldInfoForList(fd, fs, mi.Exporter) + case fd.IsList() && usePresence: + fi = mi.fieldInfoForMessageListOpaque(si, fd, fs) + case fd.IsList(): + // Proto3 opaque messages that does not need presence bitmap. + // Different representation than open struct, but same logic + fi = mi.fieldInfoForMessageListOpaqueNoPresence(si, fd, fs) + case fd.Message() != nil && usePresence: + fi = mi.fieldInfoForMessageOpaque(si, fd, fs) + case fd.Message() != nil: + // Proto3 messages without presence can use same access methods as open + fi = fieldInfoForMessage(fd, fs, mi.Exporter) + default: + fi = mi.fieldInfoForScalarOpaque(si, fd, fs) + } + mi.fields[fd.Number()] = &fi + } + mi.oneofs = map[protoreflect.Name]*oneofInfo{} + for i := 0; i < mi.Desc.Oneofs().Len(); i++ { + od := mi.Desc.Oneofs().Get(i) + mi.oneofs[od.Name()] = makeOneofInfoOpaque(mi, od, si.structInfo, mi.Exporter) + } + + mi.denseFields = make([]*fieldInfo, fds.Len()*2) + for i := 0; i < fds.Len(); i++ { + if fd := fds.Get(i); int(fd.Number()) < len(mi.denseFields) { + mi.denseFields[fd.Number()] = mi.fields[fd.Number()] + } + } + + for i := 0; i < fds.Len(); { + fd := fds.Get(i) + if od := fd.ContainingOneof(); od != nil && !fd.ContainingOneof().IsSynthetic() { + mi.rangeInfos = append(mi.rangeInfos, mi.oneofs[od.Name()]) + i += od.Fields().Len() + } else { + mi.rangeInfos = append(mi.rangeInfos, mi.fields[fd.Number()]) + i++ + } + } + + mi.makeExtensionFieldsFunc(mt, si.structInfo) + mi.makeUnknownFieldsFunc(mt, si.structInfo) + mi.makeOpaqueCoderMethods(mt, si) + mi.makeFieldTypes(si.structInfo) + + return true +} + +func makeOneofInfoOpaque(mi *MessageInfo, od protoreflect.OneofDescriptor, si structInfo, x exporter) *oneofInfo { + oi := &oneofInfo{oneofDesc: od} + if od.IsSynthetic() { + fd := od.Fields().Get(0) + index, _ := presenceIndex(mi.Desc, fd) + oi.which = func(p pointer) protoreflect.FieldNumber { + if p.IsNil() { + return 0 + } + if !mi.present(p, index) { + return 0 + } + return od.Fields().Get(0).Number() + } + return oi + } + // Dispatch to non-opaque oneof implementation for non-synthetic oneofs. + return makeOneofInfo(od, si, x) +} + +func (mi *MessageInfo) fieldInfoForMapOpaque(si opaqueStructInfo, fd protoreflect.FieldDescriptor, fs reflect.StructField) fieldInfo { + ft := fs.Type + if ft.Kind() != reflect.Map { + panic(fmt.Sprintf("invalid type: got %v, want map kind", ft)) + } + fieldOffset := offsetOf(fs) + conv := NewConverter(ft, fd) + return fieldInfo{ + fieldDesc: fd, + has: func(p pointer) bool { + if p.IsNil() { + return false + } + // Don't bother checking presence bits, since we need to + // look at the map length even if the presence bit is set. + rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() + return rv.Len() > 0 + }, + clear: func(p pointer) { + rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() + rv.Set(reflect.Zero(rv.Type())) + }, + get: func(p pointer) protoreflect.Value { + if p.IsNil() { + return conv.Zero() + } + rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() + if rv.Len() == 0 { + return conv.Zero() + } + return conv.PBValueOf(rv) + }, + set: func(p pointer, v protoreflect.Value) { + pv := conv.GoValueOf(v) + if pv.IsNil() { + panic(fmt.Sprintf("invalid value: setting map field to read-only value")) + } + rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() + rv.Set(pv) + }, + mutable: func(p pointer) protoreflect.Value { + v := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() + if v.IsNil() { + v.Set(reflect.MakeMap(fs.Type)) + } + return conv.PBValueOf(v) + }, + newField: func() protoreflect.Value { + return conv.New() + }, + } +} + +func (mi *MessageInfo) fieldInfoForScalarListOpaque(si opaqueStructInfo, fd protoreflect.FieldDescriptor, fs reflect.StructField) fieldInfo { + ft := fs.Type + if ft.Kind() != reflect.Slice { + panic(fmt.Sprintf("invalid type: got %v, want slice kind", ft)) + } + conv := NewConverter(reflect.PtrTo(ft), fd) + fieldOffset := offsetOf(fs) + index, _ := presenceIndex(mi.Desc, fd) + return fieldInfo{ + fieldDesc: fd, + has: func(p pointer) bool { + if p.IsNil() { + return false + } + rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() + return rv.Len() > 0 + }, + clear: func(p pointer) { + rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() + rv.Set(reflect.Zero(rv.Type())) + }, + get: func(p pointer) protoreflect.Value { + if p.IsNil() { + return conv.Zero() + } + rv := p.Apply(fieldOffset).AsValueOf(fs.Type) + if rv.Elem().Len() == 0 { + return conv.Zero() + } + return conv.PBValueOf(rv) + }, + set: func(p pointer, v protoreflect.Value) { + pv := conv.GoValueOf(v) + if pv.IsNil() { + panic(fmt.Sprintf("invalid value: setting repeated field to read-only value")) + } + mi.setPresent(p, index) + rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() + rv.Set(pv.Elem()) + }, + mutable: func(p pointer) protoreflect.Value { + mi.setPresent(p, index) + return conv.PBValueOf(p.Apply(fieldOffset).AsValueOf(fs.Type)) + }, + newField: func() protoreflect.Value { + return conv.New() + }, + } +} + +func (mi *MessageInfo) fieldInfoForMessageListOpaque(si opaqueStructInfo, fd protoreflect.FieldDescriptor, fs reflect.StructField) fieldInfo { + ft := fs.Type + if ft.Kind() != reflect.Ptr || ft.Elem().Kind() != reflect.Slice { + panic(fmt.Sprintf("invalid type: got %v, want slice kind", ft)) + } + conv := NewConverter(ft, fd) + fieldOffset := offsetOf(fs) + index, _ := presenceIndex(mi.Desc, fd) + fieldNumber := fd.Number() + return fieldInfo{ + fieldDesc: fd, + has: func(p pointer) bool { + if p.IsNil() { + return false + } + if !mi.present(p, index) { + return false + } + sp := p.Apply(fieldOffset).AtomicGetPointer() + if sp.IsNil() { + // Lazily unmarshal this field. + mi.lazyUnmarshal(p, fieldNumber) + sp = p.Apply(fieldOffset).AtomicGetPointer() + } + rv := sp.AsValueOf(fs.Type.Elem()) + return rv.Elem().Len() > 0 + }, + clear: func(p pointer) { + fp := p.Apply(fieldOffset) + sp := fp.AtomicGetPointer() + if sp.IsNil() { + sp = fp.AtomicSetPointerIfNil(pointerOfValue(reflect.New(fs.Type.Elem()))) + mi.setPresent(p, index) + } + rv := sp.AsValueOf(fs.Type.Elem()) + rv.Elem().Set(reflect.Zero(rv.Type().Elem())) + }, + get: func(p pointer) protoreflect.Value { + if p.IsNil() { + return conv.Zero() + } + if !mi.present(p, index) { + return conv.Zero() + } + sp := p.Apply(fieldOffset).AtomicGetPointer() + if sp.IsNil() { + // Lazily unmarshal this field. + mi.lazyUnmarshal(p, fieldNumber) + sp = p.Apply(fieldOffset).AtomicGetPointer() + } + rv := sp.AsValueOf(fs.Type.Elem()) + if rv.Elem().Len() == 0 { + return conv.Zero() + } + return conv.PBValueOf(rv) + }, + set: func(p pointer, v protoreflect.Value) { + fp := p.Apply(fieldOffset) + sp := fp.AtomicGetPointer() + if sp.IsNil() { + sp = fp.AtomicSetPointerIfNil(pointerOfValue(reflect.New(fs.Type.Elem()))) + mi.setPresent(p, index) + } + rv := sp.AsValueOf(fs.Type.Elem()) + val := conv.GoValueOf(v) + if val.IsNil() { + panic(fmt.Sprintf("invalid value: setting repeated field to read-only value")) + } else { + rv.Elem().Set(val.Elem()) + } + }, + mutable: func(p pointer) protoreflect.Value { + fp := p.Apply(fieldOffset) + sp := fp.AtomicGetPointer() + if sp.IsNil() { + if mi.present(p, index) { + // Lazily unmarshal this field. + mi.lazyUnmarshal(p, fieldNumber) + sp = p.Apply(fieldOffset).AtomicGetPointer() + } else { + sp = fp.AtomicSetPointerIfNil(pointerOfValue(reflect.New(fs.Type.Elem()))) + mi.setPresent(p, index) + } + } + rv := sp.AsValueOf(fs.Type.Elem()) + return conv.PBValueOf(rv) + }, + newField: func() protoreflect.Value { + return conv.New() + }, + } +} + +func (mi *MessageInfo) fieldInfoForMessageListOpaqueNoPresence(si opaqueStructInfo, fd protoreflect.FieldDescriptor, fs reflect.StructField) fieldInfo { + ft := fs.Type + if ft.Kind() != reflect.Ptr || ft.Elem().Kind() != reflect.Slice { + panic(fmt.Sprintf("invalid type: got %v, want slice kind", ft)) + } + conv := NewConverter(ft, fd) + fieldOffset := offsetOf(fs) + return fieldInfo{ + fieldDesc: fd, + has: func(p pointer) bool { + if p.IsNil() { + return false + } + rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() + if rv.IsNil() { + return false + } + return rv.Elem().Len() > 0 + }, + clear: func(p pointer) { + rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() + if !rv.IsNil() { + rv.Elem().Set(reflect.Zero(rv.Type().Elem())) + } + }, + get: func(p pointer) protoreflect.Value { + if p.IsNil() { + return conv.Zero() + } + rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() + if rv.IsNil() { + return conv.Zero() + } + if rv.Elem().Len() == 0 { + return conv.Zero() + } + return conv.PBValueOf(rv) + }, + set: func(p pointer, v protoreflect.Value) { + rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() + if rv.IsNil() { + rv.Set(reflect.New(fs.Type.Elem())) + } + val := conv.GoValueOf(v) + if val.IsNil() { + panic(fmt.Sprintf("invalid value: setting repeated field to read-only value")) + } else { + rv.Elem().Set(val.Elem()) + } + }, + mutable: func(p pointer) protoreflect.Value { + rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() + if rv.IsNil() { + rv.Set(reflect.New(fs.Type.Elem())) + } + return conv.PBValueOf(rv) + }, + newField: func() protoreflect.Value { + return conv.New() + }, + } +} + +func (mi *MessageInfo) fieldInfoForScalarOpaque(si opaqueStructInfo, fd protoreflect.FieldDescriptor, fs reflect.StructField) fieldInfo { + ft := fs.Type + nullable := fd.HasPresence() + if oneof := fd.ContainingOneof(); oneof != nil && oneof.IsSynthetic() { + nullable = true + } + deref := false + if nullable && ft.Kind() == reflect.Ptr { + ft = ft.Elem() + deref = true + } + conv := NewConverter(ft, fd) + fieldOffset := offsetOf(fs) + index, _ := presenceIndex(mi.Desc, fd) + var getter func(p pointer) protoreflect.Value + if !nullable { + getter = getterForDirectScalar(fd, fs, conv, fieldOffset) + } else { + getter = getterForOpaqueNullableScalar(mi, index, fd, fs, conv, fieldOffset) + } + return fieldInfo{ + fieldDesc: fd, + has: func(p pointer) bool { + if p.IsNil() { + return false + } + if nullable { + return mi.present(p, index) + } + rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() + switch rv.Kind() { + case reflect.Bool: + return rv.Bool() + case reflect.Int32, reflect.Int64: + return rv.Int() != 0 + case reflect.Uint32, reflect.Uint64: + return rv.Uint() != 0 + case reflect.Float32, reflect.Float64: + return rv.Float() != 0 || math.Signbit(rv.Float()) + case reflect.String, reflect.Slice: + return rv.Len() > 0 + default: + panic(fmt.Sprintf("invalid type: %v", rv.Type())) // should never happen + } + }, + clear: func(p pointer) { + if nullable { + mi.clearPresent(p, index) + } + // This is only valuable for bytes and strings, but we do it unconditionally. + rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() + rv.Set(reflect.Zero(rv.Type())) + }, + get: getter, + // TODO: Implement unsafe fast path for set? + set: func(p pointer, v protoreflect.Value) { + rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() + if deref { + if rv.IsNil() { + rv.Set(reflect.New(ft)) + } + rv = rv.Elem() + } + + rv.Set(conv.GoValueOf(v)) + if nullable && rv.Kind() == reflect.Slice && rv.IsNil() { + rv.Set(emptyBytes) + } + if nullable { + mi.setPresent(p, index) + } + }, + newField: func() protoreflect.Value { + return conv.New() + }, + } +} + +func (mi *MessageInfo) fieldInfoForMessageOpaque(si opaqueStructInfo, fd protoreflect.FieldDescriptor, fs reflect.StructField) fieldInfo { + ft := fs.Type + conv := NewConverter(ft, fd) + fieldOffset := offsetOf(fs) + index, _ := presenceIndex(mi.Desc, fd) + fieldNumber := fd.Number() + elemType := fs.Type.Elem() + return fieldInfo{ + fieldDesc: fd, + has: func(p pointer) bool { + if p.IsNil() { + return false + } + return mi.present(p, index) + }, + clear: func(p pointer) { + mi.clearPresent(p, index) + p.Apply(fieldOffset).AtomicSetNilPointer() + }, + get: func(p pointer) protoreflect.Value { + if p.IsNil() || !mi.present(p, index) { + return conv.Zero() + } + fp := p.Apply(fieldOffset) + mp := fp.AtomicGetPointer() + if mp.IsNil() { + // Lazily unmarshal this field. + mi.lazyUnmarshal(p, fieldNumber) + mp = fp.AtomicGetPointer() + } + rv := mp.AsValueOf(elemType) + return conv.PBValueOf(rv) + }, + set: func(p pointer, v protoreflect.Value) { + val := pointerOfValue(conv.GoValueOf(v)) + if val.IsNil() { + panic("invalid nil pointer") + } + p.Apply(fieldOffset).AtomicSetPointer(val) + mi.setPresent(p, index) + }, + mutable: func(p pointer) protoreflect.Value { + fp := p.Apply(fieldOffset) + mp := fp.AtomicGetPointer() + if mp.IsNil() { + if mi.present(p, index) { + // Lazily unmarshal this field. + mi.lazyUnmarshal(p, fieldNumber) + mp = fp.AtomicGetPointer() + } else { + mp = pointerOfValue(conv.GoValueOf(conv.New())) + fp.AtomicSetPointer(mp) + mi.setPresent(p, index) + } + } + return conv.PBValueOf(mp.AsValueOf(fs.Type.Elem())) + }, + newMessage: func() protoreflect.Message { + return conv.New().Message() + }, + newField: func() protoreflect.Value { + return conv.New() + }, + } +} + +// A presenceList wraps a List, updating presence bits as necessary when the +// list contents change. +type presenceList struct { + pvalueList + setPresence func(bool) +} +type pvalueList interface { + protoreflect.List + //Unwrapper +} + +func (list presenceList) Append(v protoreflect.Value) { + list.pvalueList.Append(v) + list.setPresence(true) +} +func (list presenceList) Truncate(i int) { + list.pvalueList.Truncate(i) + list.setPresence(i > 0) +} + +// presenceIndex returns the index to pass to presence functions. +// +// TODO: field.Desc.Index() would be simpler, and would give space to record the presence of oneof fields. +func presenceIndex(md protoreflect.MessageDescriptor, fd protoreflect.FieldDescriptor) (uint32, presenceSize) { + found := false + var index, numIndices uint32 + for i := 0; i < md.Fields().Len(); i++ { + f := md.Fields().Get(i) + if f == fd { + found = true + index = numIndices + } + if f.ContainingOneof() == nil || isLastOneofField(f) { + numIndices++ + } + } + if !found { + panic(fmt.Sprintf("BUG: %v not in %v", fd.Name(), md.FullName())) + } + return index, presenceSize(numIndices) +} + +func isLastOneofField(fd protoreflect.FieldDescriptor) bool { + fields := fd.ContainingOneof().Fields() + return fields.Get(fields.Len()-1) == fd +} + +func (mi *MessageInfo) setPresent(p pointer, index uint32) { + p.Apply(mi.presenceOffset).PresenceInfo().SetPresent(index, mi.presenceSize) +} + +func (mi *MessageInfo) clearPresent(p pointer, index uint32) { + p.Apply(mi.presenceOffset).PresenceInfo().ClearPresent(index) +} + +func (mi *MessageInfo) present(p pointer, index uint32) bool { + return p.Apply(mi.presenceOffset).PresenceInfo().Present(index) +} diff --git a/vendor/google.golang.org/protobuf/internal/impl/message_opaque_gen.go b/vendor/google.golang.org/protobuf/internal/impl/message_opaque_gen.go new file mode 100644 index 000000000..a69825699 --- /dev/null +++ b/vendor/google.golang.org/protobuf/internal/impl/message_opaque_gen.go @@ -0,0 +1,132 @@ +// 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. + +// Code generated by generate-types. DO NOT EDIT. + +package impl + +import ( + "reflect" + + "google.golang.org/protobuf/reflect/protoreflect" +) + +func getterForOpaqueNullableScalar(mi *MessageInfo, index uint32, fd protoreflect.FieldDescriptor, fs reflect.StructField, conv Converter, fieldOffset offset) func(p pointer) protoreflect.Value { + ft := fs.Type + if ft.Kind() == reflect.Ptr { + ft = ft.Elem() + } + if fd.Kind() == protoreflect.EnumKind { + // Enums for nullable opaque types. + return func(p pointer) protoreflect.Value { + if p.IsNil() || !mi.present(p, index) { + return conv.Zero() + } + rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() + return conv.PBValueOf(rv) + } + } + switch ft.Kind() { + case reflect.Bool: + return func(p pointer) protoreflect.Value { + if p.IsNil() || !mi.present(p, index) { + return conv.Zero() + } + x := p.Apply(fieldOffset).Bool() + return protoreflect.ValueOfBool(*x) + } + case reflect.Int32: + return func(p pointer) protoreflect.Value { + if p.IsNil() || !mi.present(p, index) { + return conv.Zero() + } + x := p.Apply(fieldOffset).Int32() + return protoreflect.ValueOfInt32(*x) + } + case reflect.Uint32: + return func(p pointer) protoreflect.Value { + if p.IsNil() || !mi.present(p, index) { + return conv.Zero() + } + x := p.Apply(fieldOffset).Uint32() + return protoreflect.ValueOfUint32(*x) + } + case reflect.Int64: + return func(p pointer) protoreflect.Value { + if p.IsNil() || !mi.present(p, index) { + return conv.Zero() + } + x := p.Apply(fieldOffset).Int64() + return protoreflect.ValueOfInt64(*x) + } + case reflect.Uint64: + return func(p pointer) protoreflect.Value { + if p.IsNil() || !mi.present(p, index) { + return conv.Zero() + } + x := p.Apply(fieldOffset).Uint64() + return protoreflect.ValueOfUint64(*x) + } + case reflect.Float32: + return func(p pointer) protoreflect.Value { + if p.IsNil() || !mi.present(p, index) { + return conv.Zero() + } + x := p.Apply(fieldOffset).Float32() + return protoreflect.ValueOfFloat32(*x) + } + case reflect.Float64: + return func(p pointer) protoreflect.Value { + if p.IsNil() || !mi.present(p, index) { + return conv.Zero() + } + x := p.Apply(fieldOffset).Float64() + return protoreflect.ValueOfFloat64(*x) + } + case reflect.String: + if fd.Kind() == protoreflect.BytesKind { + return func(p pointer) protoreflect.Value { + if p.IsNil() || !mi.present(p, index) { + return conv.Zero() + } + x := p.Apply(fieldOffset).StringPtr() + if *x == nil { + return conv.Zero() + } + if len(**x) == 0 { + return protoreflect.ValueOfBytes(nil) + } + return protoreflect.ValueOfBytes([]byte(**x)) + } + } + return func(p pointer) protoreflect.Value { + if p.IsNil() || !mi.present(p, index) { + return conv.Zero() + } + x := p.Apply(fieldOffset).StringPtr() + if *x == nil { + return conv.Zero() + } + return protoreflect.ValueOfString(**x) + } + case reflect.Slice: + if fd.Kind() == protoreflect.StringKind { + return func(p pointer) protoreflect.Value { + if p.IsNil() || !mi.present(p, index) { + return conv.Zero() + } + x := p.Apply(fieldOffset).Bytes() + return protoreflect.ValueOfString(string(*x)) + } + } + return func(p pointer) protoreflect.Value { + if p.IsNil() || !mi.present(p, index) { + return conv.Zero() + } + x := p.Apply(fieldOffset).Bytes() + return protoreflect.ValueOfBytes(*x) + } + } + panic("unexpected protobuf kind: " + ft.Kind().String()) +} 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 ecb4623d7..0d20132fa 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go +++ b/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go @@ -72,8 +72,6 @@ func (mi *MessageInfo) makeKnownFieldsFunc(si structInfo) { fi = fieldInfoForMap(fd, fs, mi.Exporter) case fd.IsList(): fi = fieldInfoForList(fd, fs, mi.Exporter) - case fd.IsWeak(): - fi = fieldInfoForWeakMessage(fd, si.weakOffset) case fd.Message() != nil: fi = fieldInfoForMessage(fd, fs, mi.Exporter) default: @@ -205,6 +203,11 @@ func (mi *MessageInfo) makeFieldTypes(si structInfo) { case fd.IsList(): if fd.Enum() != nil || fd.Message() != nil { ft = fs.Type.Elem() + + if ft.Kind() == reflect.Slice { + ft = ft.Elem() + } + } isMessage = fd.Message() != nil case fd.Enum() != nil: @@ -214,9 +217,6 @@ func (mi *MessageInfo) makeFieldTypes(si structInfo) { } case fd.Message() != nil: ft = fs.Type - if fd.IsWeak() { - ft = nil - } isMessage = true } if isMessage && ft != nil && ft.Kind() != reflect.Ptr { diff --git a/vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go b/vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go index 986322b19..68d4ae32e 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go +++ b/vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go @@ -8,11 +8,8 @@ import ( "fmt" "math" "reflect" - "sync" - "google.golang.org/protobuf/internal/flags" "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" ) type fieldInfo struct { @@ -76,7 +73,7 @@ func fieldInfoForOneof(fd protoreflect.FieldDescriptor, fs reflect.StructField, isMessage := fd.Message() != nil // TODO: Implement unsafe fast path? - fieldOffset := offsetOf(fs, x) + fieldOffset := offsetOf(fs) return fieldInfo{ // NOTE: The logic below intentionally assumes that oneof fields are // well-formatted. That is, the oneof interface never contains a @@ -152,7 +149,7 @@ func fieldInfoForMap(fd protoreflect.FieldDescriptor, fs reflect.StructField, x conv := NewConverter(ft, fd) // TODO: Implement unsafe fast path? - fieldOffset := offsetOf(fs, x) + fieldOffset := offsetOf(fs) return fieldInfo{ fieldDesc: fd, has: func(p pointer) bool { @@ -205,7 +202,7 @@ func fieldInfoForList(fd protoreflect.FieldDescriptor, fs reflect.StructField, x conv := NewConverter(reflect.PtrTo(ft), fd) // TODO: Implement unsafe fast path? - fieldOffset := offsetOf(fs, x) + fieldOffset := offsetOf(fs) return fieldInfo{ fieldDesc: fd, has: func(p pointer) bool { @@ -256,6 +253,7 @@ func fieldInfoForScalar(fd protoreflect.FieldDescriptor, fs reflect.StructField, ft := fs.Type nullable := fd.HasPresence() isBytes := ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 + var getter func(p pointer) protoreflect.Value if nullable { if ft.Kind() != reflect.Ptr && ft.Kind() != reflect.Slice { // This never occurs for generated message types. @@ -268,19 +266,25 @@ func fieldInfoForScalar(fd protoreflect.FieldDescriptor, fs reflect.StructField, } } conv := NewConverter(ft, fd) + fieldOffset := offsetOf(fs) + + // Generate specialized getter functions to avoid going through reflect.Value + if nullable { + getter = getterForNullableScalar(fd, fs, conv, fieldOffset) + } else { + getter = getterForDirectScalar(fd, fs, conv, fieldOffset) + } - // TODO: Implement unsafe fast path? - fieldOffset := offsetOf(fs, x) return fieldInfo{ fieldDesc: fd, has: func(p pointer) bool { if p.IsNil() { return false } - rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() if nullable { - return !rv.IsNil() + return !p.Apply(fieldOffset).Elem().IsNil() } + rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() switch rv.Kind() { case reflect.Bool: return rv.Bool() @@ -300,21 +304,8 @@ func fieldInfoForScalar(fd protoreflect.FieldDescriptor, fs reflect.StructField, rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() rv.Set(reflect.Zero(rv.Type())) }, - get: func(p pointer) protoreflect.Value { - if p.IsNil() { - return conv.Zero() - } - rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() - if nullable { - if rv.IsNil() { - return conv.Zero() - } - if rv.Kind() == reflect.Ptr { - rv = rv.Elem() - } - } - return conv.PBValueOf(rv) - }, + get: getter, + // TODO: Implement unsafe fast path for set? set: func(p pointer, v protoreflect.Value) { rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() if nullable && rv.Kind() == reflect.Ptr { @@ -338,85 +329,12 @@ func fieldInfoForScalar(fd protoreflect.FieldDescriptor, fs reflect.StructField, } } -func fieldInfoForWeakMessage(fd protoreflect.FieldDescriptor, weakOffset offset) fieldInfo { - if !flags.ProtoLegacy { - panic("no support for proto1 weak fields") - } - - var once sync.Once - var messageType protoreflect.MessageType - lazyInit := func() { - once.Do(func() { - messageName := fd.Message().FullName() - messageType, _ = protoregistry.GlobalTypes.FindMessageByName(messageName) - if messageType == nil { - panic(fmt.Sprintf("weak message %v for field %v is not linked in", messageName, fd.FullName())) - } - }) - } - - num := fd.Number() - return fieldInfo{ - fieldDesc: fd, - has: func(p pointer) bool { - if p.IsNil() { - return false - } - _, ok := p.Apply(weakOffset).WeakFields().get(num) - return ok - }, - clear: func(p pointer) { - p.Apply(weakOffset).WeakFields().clear(num) - }, - get: func(p pointer) protoreflect.Value { - lazyInit() - if p.IsNil() { - return protoreflect.ValueOfMessage(messageType.Zero()) - } - m, ok := p.Apply(weakOffset).WeakFields().get(num) - if !ok { - return protoreflect.ValueOfMessage(messageType.Zero()) - } - return protoreflect.ValueOfMessage(m.ProtoReflect()) - }, - set: func(p pointer, v protoreflect.Value) { - lazyInit() - m := v.Message() - if m.Descriptor() != messageType.Descriptor() { - if got, want := m.Descriptor().FullName(), messageType.Descriptor().FullName(); got != want { - panic(fmt.Sprintf("field %v has mismatching message descriptor: got %v, want %v", fd.FullName(), got, want)) - } - panic(fmt.Sprintf("field %v has mismatching message descriptor: %v", fd.FullName(), m.Descriptor().FullName())) - } - p.Apply(weakOffset).WeakFields().set(num, m.Interface()) - }, - mutable: func(p pointer) protoreflect.Value { - lazyInit() - fs := p.Apply(weakOffset).WeakFields() - m, ok := fs.get(num) - if !ok { - m = messageType.New().Interface() - fs.set(num, m) - } - return protoreflect.ValueOfMessage(m.ProtoReflect()) - }, - newMessage: func() protoreflect.Message { - lazyInit() - return messageType.New() - }, - newField: func() protoreflect.Value { - lazyInit() - return protoreflect.ValueOfMessage(messageType.New()) - }, - } -} - func fieldInfoForMessage(fd protoreflect.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo { ft := fs.Type conv := NewConverter(ft, fd) // TODO: Implement unsafe fast path? - fieldOffset := offsetOf(fs, x) + fieldOffset := offsetOf(fs) return fieldInfo{ fieldDesc: fd, has: func(p pointer) bool { @@ -425,7 +343,7 @@ func fieldInfoForMessage(fd protoreflect.FieldDescriptor, fs reflect.StructField } rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() if fs.Type.Kind() != reflect.Ptr { - return !isZero(rv) + return !rv.IsZero() } return !rv.IsNil() }, @@ -472,7 +390,7 @@ func makeOneofInfo(od protoreflect.OneofDescriptor, si structInfo, x exporter) * oi := &oneofInfo{oneofDesc: od} if od.IsSynthetic() { fs := si.fieldsByNumber[od.Fields().Get(0).Number()] - fieldOffset := offsetOf(fs, x) + fieldOffset := offsetOf(fs) oi.which = func(p pointer) protoreflect.FieldNumber { if p.IsNil() { return 0 @@ -485,7 +403,7 @@ func makeOneofInfo(od protoreflect.OneofDescriptor, si structInfo, x exporter) * } } else { fs := si.oneofsByName[od.Name()] - fieldOffset := offsetOf(fs, x) + fieldOffset := offsetOf(fs) oi.which = func(p pointer) protoreflect.FieldNumber { if p.IsNil() { return 0 @@ -503,41 +421,3 @@ func makeOneofInfo(od protoreflect.OneofDescriptor, si structInfo, x exporter) * } return oi } - -// isZero is identical to reflect.Value.IsZero. -// TODO: Remove this when Go1.13 is the minimally supported Go version. -func isZero(v reflect.Value) bool { - switch v.Kind() { - case reflect.Bool: - return !v.Bool() - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return v.Uint() == 0 - case reflect.Float32, reflect.Float64: - return math.Float64bits(v.Float()) == 0 - case reflect.Complex64, reflect.Complex128: - c := v.Complex() - return math.Float64bits(real(c)) == 0 && math.Float64bits(imag(c)) == 0 - case reflect.Array: - for i := 0; i < v.Len(); i++ { - if !isZero(v.Index(i)) { - return false - } - } - return true - case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice, reflect.UnsafePointer: - return v.IsNil() - case reflect.String: - return v.Len() == 0 - case reflect.Struct: - for i := 0; i < v.NumField(); i++ { - if !isZero(v.Field(i)) { - return false - } - } - return true - default: - panic(&reflect.ValueError{Method: "reflect.Value.IsZero", Kind: v.Kind()}) - } -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/message_reflect_field_gen.go b/vendor/google.golang.org/protobuf/internal/impl/message_reflect_field_gen.go new file mode 100644 index 000000000..af5e063a1 --- /dev/null +++ b/vendor/google.golang.org/protobuf/internal/impl/message_reflect_field_gen.go @@ -0,0 +1,273 @@ +// 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. + +// Code generated by generate-types. DO NOT EDIT. + +package impl + +import ( + "reflect" + + "google.golang.org/protobuf/reflect/protoreflect" +) + +func getterForNullableScalar(fd protoreflect.FieldDescriptor, fs reflect.StructField, conv Converter, fieldOffset offset) func(p pointer) protoreflect.Value { + ft := fs.Type + if ft.Kind() == reflect.Ptr { + ft = ft.Elem() + } + if fd.Kind() == protoreflect.EnumKind { + elemType := fs.Type.Elem() + // Enums for nullable types. + return func(p pointer) protoreflect.Value { + if p.IsNil() { + return conv.Zero() + } + rv := p.Apply(fieldOffset).Elem().AsValueOf(elemType) + if rv.IsNil() { + return conv.Zero() + } + return conv.PBValueOf(rv.Elem()) + } + } + switch ft.Kind() { + case reflect.Bool: + return func(p pointer) protoreflect.Value { + if p.IsNil() { + return conv.Zero() + } + x := p.Apply(fieldOffset).BoolPtr() + if *x == nil { + return conv.Zero() + } + return protoreflect.ValueOfBool(**x) + } + case reflect.Int32: + return func(p pointer) protoreflect.Value { + if p.IsNil() { + return conv.Zero() + } + x := p.Apply(fieldOffset).Int32Ptr() + if *x == nil { + return conv.Zero() + } + return protoreflect.ValueOfInt32(**x) + } + case reflect.Uint32: + return func(p pointer) protoreflect.Value { + if p.IsNil() { + return conv.Zero() + } + x := p.Apply(fieldOffset).Uint32Ptr() + if *x == nil { + return conv.Zero() + } + return protoreflect.ValueOfUint32(**x) + } + case reflect.Int64: + return func(p pointer) protoreflect.Value { + if p.IsNil() { + return conv.Zero() + } + x := p.Apply(fieldOffset).Int64Ptr() + if *x == nil { + return conv.Zero() + } + return protoreflect.ValueOfInt64(**x) + } + case reflect.Uint64: + return func(p pointer) protoreflect.Value { + if p.IsNil() { + return conv.Zero() + } + x := p.Apply(fieldOffset).Uint64Ptr() + if *x == nil { + return conv.Zero() + } + return protoreflect.ValueOfUint64(**x) + } + case reflect.Float32: + return func(p pointer) protoreflect.Value { + if p.IsNil() { + return conv.Zero() + } + x := p.Apply(fieldOffset).Float32Ptr() + if *x == nil { + return conv.Zero() + } + return protoreflect.ValueOfFloat32(**x) + } + case reflect.Float64: + return func(p pointer) protoreflect.Value { + if p.IsNil() { + return conv.Zero() + } + x := p.Apply(fieldOffset).Float64Ptr() + if *x == nil { + return conv.Zero() + } + return protoreflect.ValueOfFloat64(**x) + } + case reflect.String: + if fd.Kind() == protoreflect.BytesKind { + return func(p pointer) protoreflect.Value { + if p.IsNil() { + return conv.Zero() + } + x := p.Apply(fieldOffset).StringPtr() + if *x == nil { + return conv.Zero() + } + if len(**x) == 0 { + return protoreflect.ValueOfBytes(nil) + } + return protoreflect.ValueOfBytes([]byte(**x)) + } + } + return func(p pointer) protoreflect.Value { + if p.IsNil() { + return conv.Zero() + } + x := p.Apply(fieldOffset).StringPtr() + if *x == nil { + return conv.Zero() + } + return protoreflect.ValueOfString(**x) + } + case reflect.Slice: + if fd.Kind() == protoreflect.StringKind { + return func(p pointer) protoreflect.Value { + if p.IsNil() { + return conv.Zero() + } + x := p.Apply(fieldOffset).Bytes() + if len(*x) == 0 { + return conv.Zero() + } + return protoreflect.ValueOfString(string(*x)) + } + } + return func(p pointer) protoreflect.Value { + if p.IsNil() { + return conv.Zero() + } + x := p.Apply(fieldOffset).Bytes() + if *x == nil { + return conv.Zero() + } + return protoreflect.ValueOfBytes(*x) + } + } + panic("unexpected protobuf kind: " + ft.Kind().String()) +} + +func getterForDirectScalar(fd protoreflect.FieldDescriptor, fs reflect.StructField, conv Converter, fieldOffset offset) func(p pointer) protoreflect.Value { + ft := fs.Type + if fd.Kind() == protoreflect.EnumKind { + // Enums for non nullable types. + return func(p pointer) protoreflect.Value { + if p.IsNil() { + return conv.Zero() + } + rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() + return conv.PBValueOf(rv) + } + } + switch ft.Kind() { + case reflect.Bool: + return func(p pointer) protoreflect.Value { + if p.IsNil() { + return conv.Zero() + } + x := p.Apply(fieldOffset).Bool() + return protoreflect.ValueOfBool(*x) + } + case reflect.Int32: + return func(p pointer) protoreflect.Value { + if p.IsNil() { + return conv.Zero() + } + x := p.Apply(fieldOffset).Int32() + return protoreflect.ValueOfInt32(*x) + } + case reflect.Uint32: + return func(p pointer) protoreflect.Value { + if p.IsNil() { + return conv.Zero() + } + x := p.Apply(fieldOffset).Uint32() + return protoreflect.ValueOfUint32(*x) + } + case reflect.Int64: + return func(p pointer) protoreflect.Value { + if p.IsNil() { + return conv.Zero() + } + x := p.Apply(fieldOffset).Int64() + return protoreflect.ValueOfInt64(*x) + } + case reflect.Uint64: + return func(p pointer) protoreflect.Value { + if p.IsNil() { + return conv.Zero() + } + x := p.Apply(fieldOffset).Uint64() + return protoreflect.ValueOfUint64(*x) + } + case reflect.Float32: + return func(p pointer) protoreflect.Value { + if p.IsNil() { + return conv.Zero() + } + x := p.Apply(fieldOffset).Float32() + return protoreflect.ValueOfFloat32(*x) + } + case reflect.Float64: + return func(p pointer) protoreflect.Value { + if p.IsNil() { + return conv.Zero() + } + x := p.Apply(fieldOffset).Float64() + return protoreflect.ValueOfFloat64(*x) + } + case reflect.String: + if fd.Kind() == protoreflect.BytesKind { + return func(p pointer) protoreflect.Value { + if p.IsNil() { + return conv.Zero() + } + x := p.Apply(fieldOffset).String() + if len(*x) == 0 { + return protoreflect.ValueOfBytes(nil) + } + return protoreflect.ValueOfBytes([]byte(*x)) + } + } + return func(p pointer) protoreflect.Value { + if p.IsNil() { + return conv.Zero() + } + x := p.Apply(fieldOffset).String() + return protoreflect.ValueOfString(*x) + } + case reflect.Slice: + if fd.Kind() == protoreflect.StringKind { + return func(p pointer) protoreflect.Value { + if p.IsNil() { + return conv.Zero() + } + x := p.Apply(fieldOffset).Bytes() + return protoreflect.ValueOfString(string(*x)) + } + } + return func(p pointer) protoreflect.Value { + if p.IsNil() { + return conv.Zero() + } + x := p.Apply(fieldOffset).Bytes() + return protoreflect.ValueOfBytes(*x) + } + } + panic("unexpected protobuf kind: " + ft.Kind().String()) +} 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 da685e8a2..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 any - -// 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 any) 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) any { - 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 5f20ca5d8..62f8bf663 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go +++ b/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go @@ -2,15 +2,14 @@ // 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" "sync/atomic" "unsafe" + + "google.golang.org/protobuf/internal/protolazy" ) const UnsafeEnabled = true @@ -23,7 +22,7 @@ type Pointer unsafe.Pointer type offset uintptr // offsetOf returns a field offset for the struct field. -func offsetOf(f reflect.StructField, x exporter) offset { +func offsetOf(f reflect.StructField) offset { return offset(f.Offset) } @@ -112,8 +111,14 @@ func (p pointer) StringSlice() *[]string { return (*[]string)(p.p func (p pointer) Bytes() *[]byte { return (*[]byte)(p.p) } func (p pointer) BytesPtr() **[]byte { return (**[]byte)(p.p) } func (p pointer) BytesSlice() *[][]byte { return (*[][]byte)(p.p) } -func (p pointer) WeakFields() *weakFields { return (*weakFields)(p.p) } func (p pointer) Extensions() *map[int32]ExtensionField { return (*map[int32]ExtensionField)(p.p) } +func (p pointer) LazyInfoPtr() **protolazy.XXX_lazyUnmarshalInfo { + return (**protolazy.XXX_lazyUnmarshalInfo)(p.p) +} + +func (p pointer) PresenceInfo() presence { + return presence{P: p.p} +} func (p pointer) Elem() pointer { return pointer{p: *(*unsafe.Pointer)(p.p)} diff --git a/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe_opaque.go b/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe_opaque.go new file mode 100644 index 000000000..38aa7b7dc --- /dev/null +++ b/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe_opaque.go @@ -0,0 +1,42 @@ +// 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 ( + "sync/atomic" + "unsafe" +) + +func (p pointer) AtomicGetPointer() pointer { + return pointer{p: atomic.LoadPointer((*unsafe.Pointer)(p.p))} +} + +func (p pointer) AtomicSetPointer(v pointer) { + atomic.StorePointer((*unsafe.Pointer)(p.p), v.p) +} + +func (p pointer) AtomicSetNilPointer() { + atomic.StorePointer((*unsafe.Pointer)(p.p), unsafe.Pointer(nil)) +} + +func (p pointer) AtomicSetPointerIfNil(v pointer) pointer { + if atomic.CompareAndSwapPointer((*unsafe.Pointer)(p.p), unsafe.Pointer(nil), v.p) { + return v + } + return pointer{p: atomic.LoadPointer((*unsafe.Pointer)(p.p))} +} + +type atomicV1MessageInfo struct{ p Pointer } + +func (mi *atomicV1MessageInfo) Get() Pointer { + return Pointer(atomic.LoadPointer((*unsafe.Pointer)(&mi.p))) +} + +func (mi *atomicV1MessageInfo) SetIfNil(p Pointer) Pointer { + if atomic.CompareAndSwapPointer((*unsafe.Pointer)(&mi.p), nil, unsafe.Pointer(p)) { + return p + } + return mi.Get() +} diff --git a/vendor/google.golang.org/protobuf/internal/impl/presence.go b/vendor/google.golang.org/protobuf/internal/impl/presence.go new file mode 100644 index 000000000..443afe81c --- /dev/null +++ b/vendor/google.golang.org/protobuf/internal/impl/presence.go @@ -0,0 +1,139 @@ +// 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 ( + "sync/atomic" + "unsafe" +) + +// presenceSize represents the size of a presence set, which should be the largest index of the set+1 +type presenceSize uint32 + +// presence is the internal representation of the bitmap array in a generated protobuf +type presence struct { + // This is a pointer to the beginning of an array of uint32 + P unsafe.Pointer +} + +func (p presence) toElem(num uint32) (ret *uint32) { + const ( + bitsPerByte = 8 + siz = unsafe.Sizeof(*ret) + ) + // p.P points to an array of uint32, num is the bit in this array that the + // caller wants to check/manipulate. Calculate the index in the array that + // contains this specific bit. E.g.: 76 / 32 = 2 (integer division). + offset := uintptr(num) / (siz * bitsPerByte) * siz + return (*uint32)(unsafe.Pointer(uintptr(p.P) + offset)) +} + +// Present checks for the presence of a specific field number in a presence set. +func (p presence) Present(num uint32) bool { + return Export{}.Present(p.toElem(num), num) +} + +// SetPresent adds presence for a specific field number in a presence set. +func (p presence) SetPresent(num uint32, size presenceSize) { + Export{}.SetPresent(p.toElem(num), num, uint32(size)) +} + +// SetPresentUnatomic adds presence for a specific field number in a presence set without using +// atomic operations. Only to be called during unmarshaling. +func (p presence) SetPresentUnatomic(num uint32, size presenceSize) { + Export{}.SetPresentNonAtomic(p.toElem(num), num, uint32(size)) +} + +// ClearPresent removes presence for a specific field number in a presence set. +func (p presence) ClearPresent(num uint32) { + Export{}.ClearPresent(p.toElem(num), num) +} + +// LoadPresenceCache (together with PresentInCache) allows for a +// cached version of checking for presence without re-reading the word +// for every field. It is optimized for efficiency and assumes no +// simltaneous mutation of the presence set (or at least does not have +// a problem with simultaneous mutation giving inconsistent results). +func (p presence) LoadPresenceCache() (current uint32) { + if p.P == nil { + return 0 + } + return atomic.LoadUint32((*uint32)(p.P)) +} + +// PresentInCache reads presence from a cached word in the presence +// bitmap. It caches up a new word if the bit is outside the +// word. This is for really fast iteration through bitmaps in cases +// where we either know that the bitmap will not be altered, or we +// don't care about inconsistencies caused by simultaneous writes. +func (p presence) PresentInCache(num uint32, cachedElement *uint32, current *uint32) bool { + if num/32 != *cachedElement { + o := uintptr(num/32) * unsafe.Sizeof(uint32(0)) + q := (*uint32)(unsafe.Pointer(uintptr(p.P) + o)) + *current = atomic.LoadUint32(q) + *cachedElement = num / 32 + } + return (*current & (1 << (num % 32))) > 0 +} + +// AnyPresent checks if any field is marked as present in the bitmap. +func (p presence) AnyPresent(size presenceSize) bool { + n := uintptr((size + 31) / 32) + for j := uintptr(0); j < n; j++ { + o := j * unsafe.Sizeof(uint32(0)) + q := (*uint32)(unsafe.Pointer(uintptr(p.P) + o)) + b := atomic.LoadUint32(q) + if b > 0 { + return true + } + } + return false +} + +// toRaceDetectData finds the preceding RaceDetectHookData in a +// message by using pointer arithmetic. As the type of the presence +// set (bitmap) varies with the number of fields in the protobuf, we +// can not have a struct type containing the array and the +// RaceDetectHookData. instead the RaceDetectHookData is placed +// immediately before the bitmap array, and we find it by walking +// backwards in the struct. +// +// This method is only called from the race-detect version of the code, +// so RaceDetectHookData is never an empty struct. +func (p presence) toRaceDetectData() *RaceDetectHookData { + var template struct { + d RaceDetectHookData + a [1]uint32 + } + o := (uintptr(unsafe.Pointer(&template.a)) - uintptr(unsafe.Pointer(&template.d))) + return (*RaceDetectHookData)(unsafe.Pointer(uintptr(p.P) - o)) +} + +func atomicLoadShadowPresence(p **[]byte) *[]byte { + return (*[]byte)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) +} +func atomicStoreShadowPresence(p **[]byte, v *[]byte) { + atomic.CompareAndSwapPointer((*unsafe.Pointer)(unsafe.Pointer(p)), nil, unsafe.Pointer(v)) +} + +// findPointerToRaceDetectData finds the preceding RaceDetectHookData +// in a message by using pointer arithmetic. For the methods called +// directy from generated code, we don't have a pointer to the +// beginning of the presence set, but a pointer inside the array. As +// we know the index of the bit we're manipulating (num), we can +// calculate which element of the array ptr is pointing to. With that +// information we find the preceding RaceDetectHookData and can +// manipulate the shadow bitmap. +// +// This method is only called from the race-detect version of the +// code, so RaceDetectHookData is never an empty struct. +func findPointerToRaceDetectData(ptr *uint32, num uint32) *RaceDetectHookData { + var template struct { + d RaceDetectHookData + a [1]uint32 + } + o := (uintptr(unsafe.Pointer(&template.a)) - uintptr(unsafe.Pointer(&template.d))) + uintptr(num/32)*unsafe.Sizeof(uint32(0)) + return (*RaceDetectHookData)(unsafe.Pointer(uintptr(unsafe.Pointer(ptr)) - o)) +} diff --git a/vendor/google.golang.org/protobuf/internal/impl/validate.go b/vendor/google.golang.org/protobuf/internal/impl/validate.go index a24e6bbd7..7b2995dde 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/validate.go +++ b/vendor/google.golang.org/protobuf/internal/impl/validate.go @@ -37,6 +37,10 @@ const ( // ValidationValid indicates that unmarshaling the message will succeed. ValidationValid + + // ValidationWrongWireType indicates that a validated field does not have + // the expected wire type. + ValidationWrongWireType ) func (v ValidationStatus) String() string { @@ -149,11 +153,23 @@ func newValidationInfo(fd protoreflect.FieldDescriptor, ft reflect.Type) validat switch fd.Kind() { case protoreflect.MessageKind: vi.typ = validationTypeMessage + + if ft.Kind() == reflect.Ptr { + // Repeated opaque message fields are *[]*T. + ft = ft.Elem() + } + if ft.Kind() == reflect.Slice { vi.mi = getMessageInfo(ft.Elem()) } case protoreflect.GroupKind: vi.typ = validationTypeGroup + + if ft.Kind() == reflect.Ptr { + // Repeated opaque message fields are *[]*T. + ft = ft.Elem() + } + if ft.Kind() == reflect.Slice { vi.mi = getMessageInfo(ft.Elem()) } @@ -195,9 +211,7 @@ func newValidationInfo(fd protoreflect.FieldDescriptor, ft reflect.Type) validat switch fd.Kind() { case protoreflect.MessageKind: vi.typ = validationTypeMessage - if !fd.IsWeak() { - vi.mi = getMessageInfo(ft) - } + vi.mi = getMessageInfo(ft) case protoreflect.GroupKind: vi.typ = validationTypeGroup vi.mi = getMessageInfo(ft) @@ -304,26 +318,6 @@ State: } if f != nil { vi = f.validation - if vi.typ == validationTypeMessage && vi.mi == nil { - // Probable weak field. - // - // TODO: Consider storing the results of this lookup somewhere - // rather than recomputing it on every validation. - fd := st.mi.Desc.Fields().ByNumber(num) - if fd == nil || !fd.IsWeak() { - break - } - messageName := fd.Message().FullName() - messageType, err := protoregistry.GlobalTypes.FindMessageByName(messageName) - switch err { - case nil: - vi.mi, _ = messageType.(*MessageInfo) - case protoregistry.NotFound: - vi.typ = validationTypeBytes - default: - return out, ValidationUnknown - } - } break } // Possible extension field. diff --git a/vendor/google.golang.org/protobuf/internal/impl/weak.go b/vendor/google.golang.org/protobuf/internal/impl/weak.go deleted file mode 100644 index eb79a7ba9..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/weak.go +++ /dev/null @@ -1,74 +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. - -package impl - -import ( - "fmt" - - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" -) - -// weakFields adds methods to the exported WeakFields type for internal use. -// -// The exported type is an alias to an unnamed type, so methods can't be -// defined directly on it. -type weakFields WeakFields - -func (w weakFields) get(num protoreflect.FieldNumber) (protoreflect.ProtoMessage, bool) { - m, ok := w[int32(num)] - return m, ok -} - -func (w *weakFields) set(num protoreflect.FieldNumber, m protoreflect.ProtoMessage) { - if *w == nil { - *w = make(weakFields) - } - (*w)[int32(num)] = m -} - -func (w *weakFields) clear(num protoreflect.FieldNumber) { - delete(*w, int32(num)) -} - -func (Export) HasWeak(w WeakFields, num protoreflect.FieldNumber) bool { - _, ok := w[int32(num)] - return ok -} - -func (Export) ClearWeak(w *WeakFields, num protoreflect.FieldNumber) { - delete(*w, int32(num)) -} - -func (Export) GetWeak(w WeakFields, num protoreflect.FieldNumber, name protoreflect.FullName) protoreflect.ProtoMessage { - if m, ok := w[int32(num)]; ok { - return m - } - mt, _ := protoregistry.GlobalTypes.FindMessageByName(name) - if mt == nil { - panic(fmt.Sprintf("message %v for weak field is not linked in", name)) - } - return mt.Zero().Interface() -} - -func (Export) SetWeak(w *WeakFields, num protoreflect.FieldNumber, name protoreflect.FullName, m protoreflect.ProtoMessage) { - if m != nil { - mt, _ := protoregistry.GlobalTypes.FindMessageByName(name) - if mt == nil { - panic(fmt.Sprintf("message %v for weak field is not linked in", name)) - } - if mt != m.ProtoReflect().Type() { - panic(fmt.Sprintf("invalid message type for weak field: got %T, want %T", m, mt.Zero().Interface())) - } - } - if m == nil || !m.ProtoReflect().IsValid() { - delete(*w, int32(num)) - return - } - if *w == nil { - *w = make(weakFields) - } - (*w)[int32(num)] = m -} diff --git a/vendor/google.golang.org/protobuf/internal/protolazy/bufferreader.go b/vendor/google.golang.org/protobuf/internal/protolazy/bufferreader.go new file mode 100644 index 000000000..82e5cab4a --- /dev/null +++ b/vendor/google.golang.org/protobuf/internal/protolazy/bufferreader.go @@ -0,0 +1,364 @@ +// 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. + +// Helper code for parsing a protocol buffer + +package protolazy + +import ( + "errors" + "fmt" + "io" + + "google.golang.org/protobuf/encoding/protowire" +) + +// BufferReader is a structure encapsulating a protobuf and a current position +type BufferReader struct { + Buf []byte + Pos int +} + +// NewBufferReader creates a new BufferRead from a protobuf +func NewBufferReader(buf []byte) BufferReader { + return BufferReader{Buf: buf, Pos: 0} +} + +var errOutOfBounds = errors.New("protobuf decoding: out of bounds") +var errOverflow = errors.New("proto: integer overflow") + +func (b *BufferReader) DecodeVarintSlow() (x uint64, err error) { + i := b.Pos + l := len(b.Buf) + + for shift := uint(0); shift < 64; shift += 7 { + if i >= l { + err = io.ErrUnexpectedEOF + return + } + v := b.Buf[i] + i++ + x |= (uint64(v) & 0x7F) << shift + if v < 0x80 { + b.Pos = i + return + } + } + + // The number is too large to represent in a 64-bit value. + err = errOverflow + return +} + +// decodeVarint decodes a varint at the current position +func (b *BufferReader) DecodeVarint() (x uint64, err error) { + i := b.Pos + buf := b.Buf + + if i >= len(buf) { + return 0, io.ErrUnexpectedEOF + } else if buf[i] < 0x80 { + b.Pos++ + return uint64(buf[i]), nil + } else if len(buf)-i < 10 { + return b.DecodeVarintSlow() + } + + var v uint64 + // we already checked the first byte + x = uint64(buf[i]) & 127 + i++ + + v = uint64(buf[i]) + i++ + x |= (v & 127) << 7 + if v < 128 { + goto done + } + + v = uint64(buf[i]) + i++ + x |= (v & 127) << 14 + if v < 128 { + goto done + } + + v = uint64(buf[i]) + i++ + x |= (v & 127) << 21 + if v < 128 { + goto done + } + + v = uint64(buf[i]) + i++ + x |= (v & 127) << 28 + if v < 128 { + goto done + } + + v = uint64(buf[i]) + i++ + x |= (v & 127) << 35 + if v < 128 { + goto done + } + + v = uint64(buf[i]) + i++ + x |= (v & 127) << 42 + if v < 128 { + goto done + } + + v = uint64(buf[i]) + i++ + x |= (v & 127) << 49 + if v < 128 { + goto done + } + + v = uint64(buf[i]) + i++ + x |= (v & 127) << 56 + if v < 128 { + goto done + } + + v = uint64(buf[i]) + i++ + x |= (v & 127) << 63 + if v < 128 { + goto done + } + + return 0, errOverflow + +done: + b.Pos = i + return +} + +// decodeVarint32 decodes a varint32 at the current position +func (b *BufferReader) DecodeVarint32() (x uint32, err error) { + i := b.Pos + buf := b.Buf + + if i >= len(buf) { + return 0, io.ErrUnexpectedEOF + } else if buf[i] < 0x80 { + b.Pos++ + return uint32(buf[i]), nil + } else if len(buf)-i < 5 { + v, err := b.DecodeVarintSlow() + return uint32(v), err + } + + var v uint32 + // we already checked the first byte + x = uint32(buf[i]) & 127 + i++ + + v = uint32(buf[i]) + i++ + x |= (v & 127) << 7 + if v < 128 { + goto done + } + + v = uint32(buf[i]) + i++ + x |= (v & 127) << 14 + if v < 128 { + goto done + } + + v = uint32(buf[i]) + i++ + x |= (v & 127) << 21 + if v < 128 { + goto done + } + + v = uint32(buf[i]) + i++ + x |= (v & 127) << 28 + if v < 128 { + goto done + } + + return 0, errOverflow + +done: + b.Pos = i + return +} + +// skipValue skips a value in the protobuf, based on the specified tag +func (b *BufferReader) SkipValue(tag uint32) (err error) { + wireType := tag & 0x7 + switch protowire.Type(wireType) { + case protowire.VarintType: + err = b.SkipVarint() + case protowire.Fixed64Type: + err = b.SkipFixed64() + case protowire.BytesType: + var n uint32 + n, err = b.DecodeVarint32() + if err == nil { + err = b.Skip(int(n)) + } + case protowire.StartGroupType: + err = b.SkipGroup(tag) + case protowire.Fixed32Type: + err = b.SkipFixed32() + default: + err = fmt.Errorf("Unexpected wire type (%d)", wireType) + } + return +} + +// skipGroup skips a group with the specified tag. It executes efficiently using a tag stack +func (b *BufferReader) SkipGroup(tag uint32) (err error) { + tagStack := make([]uint32, 0, 16) + tagStack = append(tagStack, tag) + var n uint32 + for len(tagStack) > 0 { + tag, err = b.DecodeVarint32() + if err != nil { + return err + } + switch protowire.Type(tag & 0x7) { + case protowire.VarintType: + err = b.SkipVarint() + case protowire.Fixed64Type: + err = b.Skip(8) + case protowire.BytesType: + n, err = b.DecodeVarint32() + if err == nil { + err = b.Skip(int(n)) + } + case protowire.StartGroupType: + tagStack = append(tagStack, tag) + case protowire.Fixed32Type: + err = b.SkipFixed32() + case protowire.EndGroupType: + if protoFieldNumber(tagStack[len(tagStack)-1]) == protoFieldNumber(tag) { + tagStack = tagStack[:len(tagStack)-1] + } else { + err = fmt.Errorf("end group tag %d does not match begin group tag %d at pos %d", + protoFieldNumber(tag), protoFieldNumber(tagStack[len(tagStack)-1]), b.Pos) + } + } + if err != nil { + return err + } + } + return nil +} + +// skipVarint effiently skips a varint +func (b *BufferReader) SkipVarint() (err error) { + i := b.Pos + + if len(b.Buf)-i < 10 { + // Use DecodeVarintSlow() to check for buffer overflow, but ignore result + if _, err := b.DecodeVarintSlow(); err != nil { + return err + } + return nil + } + + if b.Buf[i] < 0x80 { + goto out + } + i++ + + if b.Buf[i] < 0x80 { + goto out + } + i++ + + if b.Buf[i] < 0x80 { + goto out + } + i++ + + if b.Buf[i] < 0x80 { + goto out + } + i++ + + if b.Buf[i] < 0x80 { + goto out + } + i++ + + if b.Buf[i] < 0x80 { + goto out + } + i++ + + if b.Buf[i] < 0x80 { + goto out + } + i++ + + if b.Buf[i] < 0x80 { + goto out + } + i++ + + if b.Buf[i] < 0x80 { + goto out + } + i++ + + if b.Buf[i] < 0x80 { + goto out + } + return errOverflow + +out: + b.Pos = i + 1 + return nil +} + +// skip skips the specified number of bytes +func (b *BufferReader) Skip(n int) (err error) { + if len(b.Buf) < b.Pos+n { + return io.ErrUnexpectedEOF + } + b.Pos += n + return +} + +// skipFixed64 skips a fixed64 +func (b *BufferReader) SkipFixed64() (err error) { + return b.Skip(8) +} + +// skipFixed32 skips a fixed32 +func (b *BufferReader) SkipFixed32() (err error) { + return b.Skip(4) +} + +// skipBytes skips a set of bytes +func (b *BufferReader) SkipBytes() (err error) { + n, err := b.DecodeVarint32() + if err != nil { + return err + } + return b.Skip(int(n)) +} + +// Done returns whether we are at the end of the protobuf +func (b *BufferReader) Done() bool { + return b.Pos == len(b.Buf) +} + +// Remaining returns how many bytes remain +func (b *BufferReader) Remaining() int { + return len(b.Buf) - b.Pos +} diff --git a/vendor/google.golang.org/protobuf/internal/protolazy/lazy.go b/vendor/google.golang.org/protobuf/internal/protolazy/lazy.go new file mode 100644 index 000000000..ff4d4834b --- /dev/null +++ b/vendor/google.golang.org/protobuf/internal/protolazy/lazy.go @@ -0,0 +1,359 @@ +// 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 protolazy contains internal data structures for lazy message decoding. +package protolazy + +import ( + "fmt" + "sort" + + "google.golang.org/protobuf/encoding/protowire" + piface "google.golang.org/protobuf/runtime/protoiface" +) + +// IndexEntry is the structure for an index of the fields in a message of a +// proto (not descending to sub-messages) +type IndexEntry struct { + FieldNum uint32 + // first byte of this tag/field + Start uint32 + // first byte after a contiguous sequence of bytes for this tag/field, which could + // include a single encoding of the field, or multiple encodings for the field + End uint32 + // True if this protobuf segment includes multiple encodings of the field + MultipleContiguous bool +} + +// XXX_lazyUnmarshalInfo has information about a particular lazily decoded message +// +// Deprecated: Do not use. This will be deleted in the near future. +type XXX_lazyUnmarshalInfo struct { + // Index of fields and their positions in the protobuf for this + // message. Make index be a pointer to a slice so it can be updated + // atomically. The index pointer is only set once (lazily when/if + // the index is first needed), and must always be SET and LOADED + // ATOMICALLY. + index *[]IndexEntry + // The protobuf associated with this lazily decoded message. It is + // only set during proto.Unmarshal(). It doesn't need to be set and + // loaded atomically, since any simultaneous set (Unmarshal) and read + // (during a get) would already be a race in the app code. + Protobuf []byte + // The flags present when Unmarshal was originally called for this particular message + unmarshalFlags piface.UnmarshalInputFlags +} + +// The Buffer and SetBuffer methods let v2/internal/impl interact with +// XXX_lazyUnmarshalInfo via an interface, to avoid an import cycle. + +// Buffer returns the lazy unmarshal buffer. +// +// Deprecated: Do not use. This will be deleted in the near future. +func (lazy *XXX_lazyUnmarshalInfo) Buffer() []byte { + return lazy.Protobuf +} + +// SetBuffer sets the lazy unmarshal buffer. +// +// Deprecated: Do not use. This will be deleted in the near future. +func (lazy *XXX_lazyUnmarshalInfo) SetBuffer(b []byte) { + lazy.Protobuf = b +} + +// SetUnmarshalFlags is called to set a copy of the original unmarshalInputFlags. +// The flags should reflect how Unmarshal was called. +func (lazy *XXX_lazyUnmarshalInfo) SetUnmarshalFlags(f piface.UnmarshalInputFlags) { + lazy.unmarshalFlags = f +} + +// UnmarshalFlags returns the original unmarshalInputFlags. +func (lazy *XXX_lazyUnmarshalInfo) UnmarshalFlags() piface.UnmarshalInputFlags { + return lazy.unmarshalFlags +} + +// AllowedPartial returns true if the user originally unmarshalled this message with +// AllowPartial set to true +func (lazy *XXX_lazyUnmarshalInfo) AllowedPartial() bool { + return (lazy.unmarshalFlags & piface.UnmarshalCheckRequired) == 0 +} + +func protoFieldNumber(tag uint32) uint32 { + return tag >> 3 +} + +// buildIndex builds an index of the specified protobuf, return the index +// array and an error. +func buildIndex(buf []byte) ([]IndexEntry, error) { + index := make([]IndexEntry, 0, 16) + var lastProtoFieldNum uint32 + var outOfOrder bool + + var r BufferReader = NewBufferReader(buf) + + for !r.Done() { + var tag uint32 + var err error + var curPos = r.Pos + // INLINED: tag, err = r.DecodeVarint32() + { + i := r.Pos + buf := r.Buf + + if i >= len(buf) { + return nil, errOutOfBounds + } else if buf[i] < 0x80 { + r.Pos++ + tag = uint32(buf[i]) + } else if r.Remaining() < 5 { + var v uint64 + v, err = r.DecodeVarintSlow() + tag = uint32(v) + } else { + var v uint32 + // we already checked the first byte + tag = uint32(buf[i]) & 127 + i++ + + v = uint32(buf[i]) + i++ + tag |= (v & 127) << 7 + if v < 128 { + goto done + } + + v = uint32(buf[i]) + i++ + tag |= (v & 127) << 14 + if v < 128 { + goto done + } + + v = uint32(buf[i]) + i++ + tag |= (v & 127) << 21 + if v < 128 { + goto done + } + + v = uint32(buf[i]) + i++ + tag |= (v & 127) << 28 + if v < 128 { + goto done + } + + return nil, errOutOfBounds + + done: + r.Pos = i + } + } + // DONE: tag, err = r.DecodeVarint32() + + fieldNum := protoFieldNumber(tag) + if fieldNum < lastProtoFieldNum { + outOfOrder = true + } + + // Skip the current value -- will skip over an entire group as well. + // INLINED: err = r.SkipValue(tag) + wireType := tag & 0x7 + switch protowire.Type(wireType) { + case protowire.VarintType: + // INLINED: err = r.SkipVarint() + i := r.Pos + + if len(r.Buf)-i < 10 { + // Use DecodeVarintSlow() to skip while + // checking for buffer overflow, but ignore result + _, err = r.DecodeVarintSlow() + goto out2 + } + if r.Buf[i] < 0x80 { + goto out + } + i++ + + if r.Buf[i] < 0x80 { + goto out + } + i++ + + if r.Buf[i] < 0x80 { + goto out + } + i++ + + if r.Buf[i] < 0x80 { + goto out + } + i++ + + if r.Buf[i] < 0x80 { + goto out + } + i++ + + if r.Buf[i] < 0x80 { + goto out + } + i++ + + if r.Buf[i] < 0x80 { + goto out + } + i++ + + if r.Buf[i] < 0x80 { + goto out + } + i++ + + if r.Buf[i] < 0x80 { + goto out + } + i++ + + if r.Buf[i] < 0x80 { + goto out + } + return nil, errOverflow + out: + r.Pos = i + 1 + // DONE: err = r.SkipVarint() + case protowire.Fixed64Type: + err = r.SkipFixed64() + case protowire.BytesType: + var n uint32 + n, err = r.DecodeVarint32() + if err == nil { + err = r.Skip(int(n)) + } + case protowire.StartGroupType: + err = r.SkipGroup(tag) + case protowire.Fixed32Type: + err = r.SkipFixed32() + default: + err = fmt.Errorf("Unexpected wire type (%d)", wireType) + } + // DONE: err = r.SkipValue(tag) + + out2: + if err != nil { + return nil, err + } + if fieldNum != lastProtoFieldNum { + index = append(index, IndexEntry{FieldNum: fieldNum, + Start: uint32(curPos), + End: uint32(r.Pos)}, + ) + } else { + index[len(index)-1].End = uint32(r.Pos) + index[len(index)-1].MultipleContiguous = true + } + lastProtoFieldNum = fieldNum + } + if outOfOrder { + sort.Slice(index, func(i, j int) bool { + return index[i].FieldNum < index[j].FieldNum || + (index[i].FieldNum == index[j].FieldNum && + index[i].Start < index[j].Start) + }) + } + return index, nil +} + +func (lazy *XXX_lazyUnmarshalInfo) SizeField(num uint32) (size int) { + start, end, found, _, multipleEntries := lazy.FindFieldInProto(num) + if multipleEntries != nil { + for _, entry := range multipleEntries { + size += int(entry.End - entry.Start) + } + return size + } + if !found { + return 0 + } + return int(end - start) +} + +func (lazy *XXX_lazyUnmarshalInfo) AppendField(b []byte, num uint32) ([]byte, bool) { + start, end, found, _, multipleEntries := lazy.FindFieldInProto(num) + if multipleEntries != nil { + for _, entry := range multipleEntries { + b = append(b, lazy.Protobuf[entry.Start:entry.End]...) + } + return b, true + } + if !found { + return nil, false + } + b = append(b, lazy.Protobuf[start:end]...) + return b, true +} + +func (lazy *XXX_lazyUnmarshalInfo) SetIndex(index []IndexEntry) { + atomicStoreIndex(&lazy.index, &index) +} + +// FindFieldInProto looks for field fieldNum in lazyUnmarshalInfo information +// (including protobuf), returns startOffset/endOffset/found. +func (lazy *XXX_lazyUnmarshalInfo) FindFieldInProto(fieldNum uint32) (start, end uint32, found, multipleContiguous bool, multipleEntries []IndexEntry) { + if lazy.Protobuf == nil { + // There is no backing protobuf for this message -- it was made from a builder + return 0, 0, false, false, nil + } + index := atomicLoadIndex(&lazy.index) + if index == nil { + r, err := buildIndex(lazy.Protobuf) + if err != nil { + panic(fmt.Sprintf("findFieldInfo: error building index when looking for field %d: %v", fieldNum, err)) + } + // lazy.index is a pointer to the slice returned by BuildIndex + index = &r + atomicStoreIndex(&lazy.index, index) + } + return lookupField(index, fieldNum) +} + +// lookupField returns the offset at which the indicated field starts using +// the index, offset immediately after field ends (including all instances of +// a repeated field), and bools indicating if field was found and if there +// are multiple encodings of the field in the byte range. +// +// To hande the uncommon case where there are repeated encodings for the same +// field which are not consecutive in the protobuf (so we need to returns +// multiple start/end offsets), we also return a slice multipleEntries. If +// multipleEntries is non-nil, then multiple entries were found, and the +// values in the slice should be used, rather than start/end/found. +func lookupField(indexp *[]IndexEntry, fieldNum uint32) (start, end uint32, found bool, multipleContiguous bool, multipleEntries []IndexEntry) { + // The pointer indexp to the index was already loaded atomically. + // The slice is uniquely associated with the pointer, so it doesn't + // need to be loaded atomically. + index := *indexp + for i, entry := range index { + if fieldNum == entry.FieldNum { + if i < len(index)-1 && entry.FieldNum == index[i+1].FieldNum { + // Handle the uncommon case where there are + // repeated entries for the same field which + // are not contiguous in the protobuf. + multiple := make([]IndexEntry, 1, 2) + multiple[0] = IndexEntry{fieldNum, entry.Start, entry.End, entry.MultipleContiguous} + i++ + for i < len(index) && index[i].FieldNum == fieldNum { + multiple = append(multiple, IndexEntry{fieldNum, index[i].Start, index[i].End, index[i].MultipleContiguous}) + i++ + } + return 0, 0, false, false, multiple + + } + return entry.Start, entry.End, true, entry.MultipleContiguous, nil + } + if fieldNum < entry.FieldNum { + return 0, 0, false, false, nil + } + } + return 0, 0, false, false, nil +} diff --git a/vendor/google.golang.org/protobuf/internal/protolazy/pointer_unsafe.go b/vendor/google.golang.org/protobuf/internal/protolazy/pointer_unsafe.go new file mode 100644 index 000000000..dc2a64ca6 --- /dev/null +++ b/vendor/google.golang.org/protobuf/internal/protolazy/pointer_unsafe.go @@ -0,0 +1,17 @@ +// 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 protolazy + +import ( + "sync/atomic" + "unsafe" +) + +func atomicLoadIndex(p **[]IndexEntry) *[]IndexEntry { + return (*[]IndexEntry)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) +} +func atomicStoreIndex(p **[]IndexEntry, v *[]IndexEntry) { + atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) +} 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_go121.go b/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe.go similarity index 96% rename from vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go121.go rename to vendor/google.golang.org/protobuf/internal/strs/strings_unsafe.go index 60166f2ba..42dd6f70c 100644 --- a/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go121.go +++ b/vendor/google.golang.org/protobuf/internal/strs/strings_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 && go1.21 -// +build !purego,!appengine,go1.21 - package strs import ( 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 deleted file mode 100644 index a008acd09..000000000 --- a/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go120.go +++ /dev/null @@ -1,95 +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 && !go1.21 -// +build !purego,!appengine,!go1.21 - -package strs - -import ( - "unsafe" - - "google.golang.org/protobuf/reflect/protoreflect" -) - -type ( - stringHeader struct { - Data unsafe.Pointer - Len int - } - sliceHeader struct { - Data unsafe.Pointer - Len int - Cap int - } -) - -// UnsafeString returns an unsafe string reference of b. -// The caller must treat the input slice as immutable. -// -// WARNING: Use carefully. The returned result must not leak to the end user -// unless the input slice is provably immutable. -func UnsafeString(b []byte) (s string) { - src := (*sliceHeader)(unsafe.Pointer(&b)) - dst := (*stringHeader)(unsafe.Pointer(&s)) - dst.Data = src.Data - dst.Len = src.Len - return s -} - -// UnsafeBytes returns an unsafe bytes slice reference of s. -// The caller must treat returned slice as immutable. -// -// WARNING: Use carefully. The returned result must not leak to the end user. -func UnsafeBytes(s string) (b []byte) { - src := (*stringHeader)(unsafe.Pointer(&s)) - dst := (*sliceHeader)(unsafe.Pointer(&b)) - dst.Data = src.Data - dst.Len = src.Len - dst.Cap = src.Len - return b -} - -// Builder builds a set of strings with shared lifetime. -// This differs from strings.Builder, which is for building a single string. -type Builder struct { - buf []byte -} - -// AppendFullName is equivalent to protoreflect.FullName.Append, -// but optimized for large batches where each name has a shared lifetime. -func (sb *Builder) AppendFullName(prefix protoreflect.FullName, name protoreflect.Name) protoreflect.FullName { - n := len(prefix) + len(".") + len(name) - if len(prefix) == 0 { - n -= len(".") - } - sb.grow(n) - sb.buf = append(sb.buf, prefix...) - sb.buf = append(sb.buf, '.') - sb.buf = append(sb.buf, name...) - return protoreflect.FullName(sb.last(n)) -} - -// MakeString is equivalent to string(b), but optimized for large batches -// with a shared lifetime. -func (sb *Builder) MakeString(b []byte) string { - sb.grow(len(b)) - sb.buf = append(sb.buf, b...) - return sb.last(len(b)) -} - -func (sb *Builder) grow(n int) { - if cap(sb.buf)-len(sb.buf) >= n { - return - } - - // Unlike strings.Builder, we do not need to copy over the contents - // of the old buffer since our builder provides no API for - // retrieving previously created strings. - sb.buf = make([]byte, 0, 2*(cap(sb.buf)+n)) -} - -func (sb *Builder) last(n int) string { - return UnsafeString(sb.buf[len(sb.buf)-n:]) -} diff --git a/vendor/google.golang.org/protobuf/internal/version/version.go b/vendor/google.golang.org/protobuf/internal/version/version.go index dbbf1f686..a53364c59 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 = 34 - Patch = 2 + Minor = 36 + Patch = 7 PreRelease = "" ) diff --git a/vendor/google.golang.org/protobuf/proto/decode.go b/vendor/google.golang.org/protobuf/proto/decode.go index d75a6534c..4cbf1aeaf 100644 --- a/vendor/google.golang.org/protobuf/proto/decode.go +++ b/vendor/google.golang.org/protobuf/proto/decode.go @@ -8,7 +8,6 @@ import ( "google.golang.org/protobuf/encoding/protowire" "google.golang.org/protobuf/internal/encoding/messageset" "google.golang.org/protobuf/internal/errors" - "google.golang.org/protobuf/internal/flags" "google.golang.org/protobuf/internal/genid" "google.golang.org/protobuf/internal/pragma" "google.golang.org/protobuf/reflect/protoreflect" @@ -47,6 +46,12 @@ type UnmarshalOptions struct { // RecursionLimit limits how deeply messages may be nested. // If zero, a default limit is applied. RecursionLimit int + + // + // NoLazyDecoding turns off lazy decoding, which otherwise is enabled by + // default. Lazy decoding only affects submessages (annotated with [lazy = + // true] in the .proto file) within messages that use the Opaque API. + NoLazyDecoding bool } // Unmarshal parses the wire-format message in b and places the result in m. @@ -104,6 +109,16 @@ func (o UnmarshalOptions) unmarshal(b []byte, m protoreflect.Message) (out proto if o.DiscardUnknown { in.Flags |= protoiface.UnmarshalDiscardUnknown } + + if !allowPartial { + // This does not affect how current unmarshal functions work, it just allows them + // to record this for lazy the decoding case. + in.Flags |= protoiface.UnmarshalCheckRequired + } + if o.NoLazyDecoding { + in.Flags |= protoiface.UnmarshalNoLazyDecoding + } + out, err = methods.Unmarshal(in) } else { o.RecursionLimit-- @@ -156,10 +171,6 @@ func (o UnmarshalOptions) unmarshalMessageSlow(b []byte, m protoreflect.Message) var err error if fd == nil { err = errUnknown - } else if flags.ProtoLegacy { - if fd.IsWeak() && fd.Message().IsPlaceholder() { - err = errUnknown // weak referent is not linked in - } } // Parse the field value. diff --git a/vendor/google.golang.org/protobuf/proto/encode.go b/vendor/google.golang.org/protobuf/proto/encode.go index 1f847bcc3..f0473c586 100644 --- a/vendor/google.golang.org/protobuf/proto/encode.go +++ b/vendor/google.golang.org/protobuf/proto/encode.go @@ -63,7 +63,8 @@ type MarshalOptions struct { // options (except for UseCachedSize itself). // // 2. The message and all its submessages have not changed in any - // way since the Size call. + // way since the Size call. For lazily decoded messages, accessing + // a message results in decoding the message, which is a change. // // If either of these invariants is violated, // the results are undefined and may include panics or corrupted output. 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 d248f2928..78445d116 100644 --- a/vendor/google.golang.org/protobuf/proto/extension.go +++ b/vendor/google.golang.org/protobuf/proto/extension.go @@ -39,6 +39,48 @@ 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. +// +// 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 { @@ -51,6 +93,35 @@ func GetExtension(m Message, xt protoreflect.ExtensionType) any { // 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. +// +// 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) diff --git a/vendor/google.golang.org/protobuf/proto/merge.go b/vendor/google.golang.org/protobuf/proto/merge.go index 3c6fe5780..ef55b97dd 100644 --- a/vendor/google.golang.org/protobuf/proto/merge.go +++ b/vendor/google.golang.org/protobuf/proto/merge.go @@ -59,6 +59,12 @@ func Clone(m Message) Message { return dst.Interface() } +// CloneOf returns a deep copy of m. If the top-level message is invalid, +// it returns an invalid message as well. +func CloneOf[M Message](m M) M { + return Clone(m).(M) +} + // mergeOptions provides a namespace for merge functions, and can be // exported in the future if we add user-visible merge options. type mergeOptions struct{} diff --git a/vendor/google.golang.org/protobuf/proto/size.go b/vendor/google.golang.org/protobuf/proto/size.go index 052fb5ae3..c8675806c 100644 --- a/vendor/google.golang.org/protobuf/proto/size.go +++ b/vendor/google.golang.org/protobuf/proto/size.go @@ -12,11 +12,19 @@ import ( ) // Size returns the size in bytes of the wire-format encoding of m. +// +// Note that Size might return more bytes than Marshal will write in the case of +// lazily decoded messages that arrive in non-minimal wire format: see +// https://protobuf.dev/reference/go/size/ for more details. func Size(m Message) int { return MarshalOptions{}.Size(m) } // Size returns the size in bytes of the wire-format encoding of m. +// +// Note that Size might return more bytes than Marshal will write in the case of +// lazily decoded messages that arrive in non-minimal wire format: see +// https://protobuf.dev/reference/go/size/ for more details. func (o MarshalOptions) Size(m Message) int { // Treat a nil message interface as an empty message; nothing to output. if m == nil { diff --git a/vendor/google.golang.org/protobuf/proto/wrapperopaque.go b/vendor/google.golang.org/protobuf/proto/wrapperopaque.go new file mode 100644 index 000000000..267fd0f1f --- /dev/null +++ b/vendor/google.golang.org/protobuf/proto/wrapperopaque.go @@ -0,0 +1,80 @@ +// 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 proto + +// ValueOrNil returns nil if has is false, or a pointer to a new variable +// containing the value returned by the specified getter. +// +// This function is similar to the wrappers (proto.Int32(), proto.String(), +// etc.), but is generic (works for any field type) and works with the hasser +// and getter of a field, as opposed to a value. +// +// This is convenient when populating builder fields. +// +// Example: +// +// hop := attr.GetDirectHop() +// injectedRoute := ripb.InjectedRoute_builder{ +// Prefixes: route.GetPrefixes(), +// NextHop: proto.ValueOrNil(hop.HasAddress(), hop.GetAddress), +// } +func ValueOrNil[T any](has bool, getter func() T) *T { + if !has { + return nil + } + v := getter() + return &v +} + +// ValueOrDefault returns the protobuf message val if val is not nil, otherwise +// it returns a pointer to an empty val message. +// +// This function allows for translating code from the old Open Struct API to the +// new Opaque API. +// +// The old Open Struct API represented oneof fields with a wrapper struct: +// +// var signedImg *accountpb.SignedImage +// profile := &accountpb.Profile{ +// // The Avatar oneof will be set, with an empty SignedImage. +// Avatar: &accountpb.Profile_SignedImage{signedImg}, +// } +// +// The new Opaque API treats oneof fields like regular fields, there are no more +// wrapper structs: +// +// var signedImg *accountpb.SignedImage +// profile := &accountpb.Profile{} +// profile.SetSignedImage(signedImg) +// +// For convenience, the Opaque API also offers Builders, which allow for a +// direct translation of struct initialization. However, because Builders use +// nilness to represent field presence (but there is no non-nil wrapper struct +// anymore), Builders cannot distinguish between an unset oneof and a set oneof +// with nil message. The above code would need to be translated with help of the +// ValueOrDefault function to retain the same behavior: +// +// var signedImg *accountpb.SignedImage +// return &accountpb.Profile_builder{ +// SignedImage: proto.ValueOrDefault(signedImg), +// }.Build() +func ValueOrDefault[T interface { + *P + Message +}, P any](val T) T { + if val == nil { + return T(new(P)) + } + return val +} + +// ValueOrDefaultBytes is like ValueOrDefault but for working with fields of +// type []byte. +func ValueOrDefaultBytes(val []byte) []byte { + if val == nil { + return []byte{} + } + return val +} diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go b/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go index 8fbecb4f5..823dbf3ba 100644 --- a/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go +++ b/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go @@ -13,6 +13,8 @@ package protodesc import ( + "strings" + "google.golang.org/protobuf/internal/editionssupport" "google.golang.org/protobuf/internal/errors" "google.golang.org/protobuf/internal/filedesc" @@ -102,13 +104,17 @@ func (o FileOptions) New(fd *descriptorpb.FileDescriptorProto, r Resolver) (prot default: return nil, errors.New("invalid syntax: %q", fd.GetSyntax()) } - 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() if f.L1.Path == "" { return nil, errors.New("file path must be populated") } + if f.L1.Syntax == protoreflect.Editions && (fd.GetEdition() < editionssupport.Minimum || fd.GetEdition() > editionssupport.Maximum) { + // Allow cmd/protoc-gen-go/testdata to use any edition for easier + // testing of upcoming edition features. + if !strings.HasPrefix(fd.GetName(), "cmd/protoc-gen-go/testdata/") { + return nil, errors.New("use of edition %v not yet supported by the Go Protobuf runtime", fd.GetEdition()) + } + } f.L1.Package = protoreflect.FullName(fd.GetPackage()) if !f.L1.Package.IsValid() && f.L1.Package != "" { return nil, errors.New("invalid package: %q", f.L1.Package) @@ -126,17 +132,11 @@ func (o FileOptions) New(fd *descriptorpb.FileDescriptorProto, r Resolver) (prot } f.L2.Imports[i].IsPublic = true } - for _, i := range fd.GetWeakDependency() { - if !(0 <= i && int(i) < len(f.L2.Imports)) || f.L2.Imports[i].IsWeak { - return nil, errors.New("invalid or duplicate weak import index: %d", i) - } - f.L2.Imports[i].IsWeak = true - } imps := importSet{f.Path(): true} for i, path := range fd.GetDependency() { imp := &f.L2.Imports[i] f, err := r.FindFileByPath(path) - if err == protoregistry.NotFound && (o.AllowUnresolvable || imp.IsWeak) { + if err == protoregistry.NotFound && o.AllowUnresolvable { f = filedesc.PlaceholderFile(path) } else if err != nil { return nil, errors.New("could not resolve import %q: %v", path, 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 856175542..9da34998b 100644 --- a/vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go +++ b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go @@ -149,7 +149,7 @@ func (r descsByName) initFieldsFromDescriptorProto(fds []*descriptorpb.FieldDesc 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.IsLazy = opts.GetLazy() if opts.Packed != nil { f.L1.EditionFeatures.IsPacked = opts.GetPacked() } @@ -214,6 +214,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 f3cebab29..ff692436e 100644 --- a/vendor/google.golang.org/protobuf/reflect/protodesc/desc_resolve.go +++ b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_resolve.go @@ -43,7 +43,7 @@ func (r *resolver) resolveMessageDependencies(ms []filedesc.Message, mds []*desc o.L1.Fields.List = append(o.L1.Fields.List, f) } - 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 { + if f.L1.Kind, f.L1.Enum, f.L1.Message, err = r.findTarget(f.Kind(), f.Parent().FullName(), partialName(fd.GetTypeName())); 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()) { @@ -73,10 +73,10 @@ func (r *resolver) resolveMessageDependencies(ms []filedesc.Message, mds []*desc func (r *resolver) resolveExtensionDependencies(xs []filedesc.Extension, xds []*descriptorpb.FieldDescriptorProto) (err error) { for i, xd := range xds { x := &xs[i] - if x.L1.Extendee, err = r.findMessageDescriptor(x.Parent().FullName(), partialName(xd.GetExtendee()), false); err != nil { + if x.L1.Extendee, err = r.findMessageDescriptor(x.Parent().FullName(), partialName(xd.GetExtendee())); err != nil { return errors.New("extension field %q cannot resolve extendee: %v", x.FullName(), err) } - if x.L1.Kind, x.L2.Enum, x.L2.Message, err = r.findTarget(x.Kind(), x.Parent().FullName(), partialName(xd.GetTypeName()), false); err != nil { + if x.L1.Kind, x.L2.Enum, x.L2.Message, err = r.findTarget(x.Kind(), x.Parent().FullName(), partialName(xd.GetTypeName())); err != nil { return errors.New("extension field %q cannot resolve type: %v", x.FullName(), err) } if xd.DefaultValue != nil { @@ -95,11 +95,11 @@ func (r *resolver) resolveServiceDependencies(ss []filedesc.Service, sds []*desc s := &ss[i] for j, md := range sd.GetMethod() { m := &s.L2.Methods.List[j] - m.L1.Input, err = r.findMessageDescriptor(m.Parent().FullName(), partialName(md.GetInputType()), false) + m.L1.Input, err = r.findMessageDescriptor(m.Parent().FullName(), partialName(md.GetInputType())) if err != nil { return errors.New("service method %q cannot resolve input: %v", m.FullName(), err) } - m.L1.Output, err = r.findMessageDescriptor(s.FullName(), partialName(md.GetOutputType()), false) + m.L1.Output, err = r.findMessageDescriptor(s.FullName(), partialName(md.GetOutputType())) if err != nil { return errors.New("service method %q cannot resolve output: %v", m.FullName(), err) } @@ -111,16 +111,16 @@ func (r *resolver) resolveServiceDependencies(ss []filedesc.Service, sds []*desc // findTarget finds an enum or message descriptor if k is an enum, message, // group, or unknown. If unknown, and the name could be resolved, the kind // returned kind is set based on the type of the resolved descriptor. -func (r *resolver) findTarget(k protoreflect.Kind, scope protoreflect.FullName, ref partialName, isWeak bool) (protoreflect.Kind, protoreflect.EnumDescriptor, protoreflect.MessageDescriptor, error) { +func (r *resolver) findTarget(k protoreflect.Kind, scope protoreflect.FullName, ref partialName) (protoreflect.Kind, protoreflect.EnumDescriptor, protoreflect.MessageDescriptor, error) { switch k { case protoreflect.EnumKind: - ed, err := r.findEnumDescriptor(scope, ref, isWeak) + ed, err := r.findEnumDescriptor(scope, ref) if err != nil { return 0, nil, nil, err } return k, ed, nil, nil case protoreflect.MessageKind, protoreflect.GroupKind: - md, err := r.findMessageDescriptor(scope, ref, isWeak) + md, err := r.findMessageDescriptor(scope, ref) if err != nil { return 0, nil, nil, err } @@ -129,7 +129,7 @@ func (r *resolver) findTarget(k protoreflect.Kind, scope protoreflect.FullName, // Handle unspecified kinds (possible with parsers that operate // on a per-file basis without knowledge of dependencies). d, err := r.findDescriptor(scope, ref) - if err == protoregistry.NotFound && (r.allowUnresolvable || isWeak) { + if err == protoregistry.NotFound && r.allowUnresolvable { return k, filedesc.PlaceholderEnum(ref.FullName()), filedesc.PlaceholderMessage(ref.FullName()), nil } else if err == protoregistry.NotFound { return 0, nil, nil, errors.New("%q not found", ref.FullName()) @@ -206,9 +206,9 @@ func (r *resolver) findDescriptor(scope protoreflect.FullName, ref partialName) } } -func (r *resolver) findEnumDescriptor(scope protoreflect.FullName, ref partialName, isWeak bool) (protoreflect.EnumDescriptor, error) { +func (r *resolver) findEnumDescriptor(scope protoreflect.FullName, ref partialName) (protoreflect.EnumDescriptor, error) { d, err := r.findDescriptor(scope, ref) - if err == protoregistry.NotFound && (r.allowUnresolvable || isWeak) { + if err == protoregistry.NotFound && r.allowUnresolvable { return filedesc.PlaceholderEnum(ref.FullName()), nil } else if err == protoregistry.NotFound { return nil, errors.New("%q not found", ref.FullName()) @@ -222,9 +222,9 @@ func (r *resolver) findEnumDescriptor(scope protoreflect.FullName, ref partialNa return ed, nil } -func (r *resolver) findMessageDescriptor(scope protoreflect.FullName, ref partialName, isWeak bool) (protoreflect.MessageDescriptor, error) { +func (r *resolver) findMessageDescriptor(scope protoreflect.FullName, ref partialName) (protoreflect.MessageDescriptor, error) { d, err := r.findDescriptor(scope, ref) - if err == protoregistry.NotFound && (r.allowUnresolvable || isWeak) { + if err == protoregistry.NotFound && r.allowUnresolvable { return filedesc.PlaceholderMessage(ref.FullName()), nil } else if err == protoregistry.NotFound { return nil, errors.New("%q not found", ref.FullName()) 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 6de31c2eb..c343d9227 100644 --- a/vendor/google.golang.org/protobuf/reflect/protodesc/desc_validate.go +++ b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_validate.go @@ -149,12 +149,6 @@ func validateMessageDeclarations(file *filedesc.File, ms []filedesc.Message, mds return errors.New("message field %q under proto3 optional semantics must be within a single element oneof", f.FullName()) } } - 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.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()) } @@ -199,9 +193,6 @@ func validateMessageDeclarations(file *filedesc.File, ms []filedesc.Message, mds if f.Cardinality() != protoreflect.Optional { return errors.New("message field %q belongs in a oneof and must be optional", f.FullName()) } - if f.IsWeak() { - return errors.New("message field %q belongs in a oneof and must not be a weak reference", f.FullName()) - } } } @@ -254,9 +245,6 @@ func validateExtensionDeclarations(f *filedesc.File, xs []filedesc.Extension, xd return errors.New("extension field %q has an invalid number: %d", x.FullName(), x.Number()) } } - if xd.GetOptions().GetWeak() { - return errors.New("extension field %q cannot be a weak reference", x.FullName()) - } if x.IsPacked() && !isPackable(x) { return errors.New("extension field %q is not packable", x.FullName()) } diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/editions.go b/vendor/google.golang.org/protobuf/reflect/protodesc/editions.go index 804830eda..697a61b29 100644 --- a/vendor/google.golang.org/protobuf/reflect/protodesc/editions.go +++ b/vendor/google.golang.org/protobuf/reflect/protodesc/editions.go @@ -11,10 +11,11 @@ import ( "google.golang.org/protobuf/internal/editiondefaults" "google.golang.org/protobuf/internal/filedesc" + "google.golang.org/protobuf/internal/genid" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/types/descriptorpb" - gofeaturespb "google.golang.org/protobuf/types/gofeaturespb" + "google.golang.org/protobuf/types/gofeaturespb" ) var defaults = &descriptorpb.FeatureSetDefaults{} @@ -43,6 +44,8 @@ func toEditionProto(ed filedesc.Edition) descriptorpb.Edition { return descriptorpb.Edition_EDITION_PROTO3 case filedesc.Edition2023: return descriptorpb.Edition_EDITION_2023 + case filedesc.Edition2024: + return descriptorpb.Edition_EDITION_2024 default: panic(fmt.Sprintf("unknown value for edition: %v", ed)) } @@ -123,10 +126,43 @@ func mergeEditionFeatures(parentDesc protoreflect.Descriptor, child *descriptorp parentFS.IsJSONCompliant = *jf == descriptorpb.FeatureSet_ALLOW } - if goFeatures, ok := proto.GetExtension(child, gofeaturespb.E_Go).(*gofeaturespb.GoFeatures); ok && goFeatures != nil { - if luje := goFeatures.LegacyUnmarshalJsonEnum; luje != nil { - parentFS.GenerateLegacyUnmarshalJSON = *luje - } + // We must not use proto.GetExtension(child, gofeaturespb.E_Go) + // because that only works for messages we generated, but not for + // dynamicpb messages. See golang/protobuf#1669. + // + // Further, we harden this code against adversarial inputs: a + // service which accepts descriptors from a possibly malicious + // source shouldn't crash. + goFeatures := child.ProtoReflect().Get(gofeaturespb.E_Go.TypeDescriptor()) + if !goFeatures.IsValid() { + return parentFS + } + gf, ok := goFeatures.Interface().(protoreflect.Message) + if !ok { + return parentFS + } + // gf.Interface() could be *dynamicpb.Message or *gofeaturespb.GoFeatures. + fields := gf.Descriptor().Fields() + + if fd := fields.ByNumber(genid.GoFeatures_LegacyUnmarshalJsonEnum_field_number); fd != nil && + !fd.IsList() && + fd.Kind() == protoreflect.BoolKind && + gf.Has(fd) { + parentFS.GenerateLegacyUnmarshalJSON = gf.Get(fd).Bool() + } + + if fd := fields.ByNumber(genid.GoFeatures_StripEnumPrefix_field_number); fd != nil && + !fd.IsList() && + fd.Kind() == protoreflect.EnumKind && + gf.Has(fd) { + parentFS.StripEnumPrefix = int(gf.Get(fd).Enum()) + } + + if fd := fields.ByNumber(genid.GoFeatures_ApiLevel_field_number); fd != nil && + !fd.IsList() && + fd.Kind() == protoreflect.EnumKind && + gf.Has(fd) { + parentFS.APILevel = int(gf.Get(fd).Enum()) } return parentFS diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go b/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go index a5de8d400..9b880aa8c 100644 --- a/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go +++ b/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go @@ -32,9 +32,6 @@ func ToFileDescriptorProto(file protoreflect.FileDescriptor) *descriptorpb.FileD if imp.IsPublic { p.PublicDependency = append(p.PublicDependency, int32(i)) } - if imp.IsWeak { - p.WeakDependency = append(p.WeakDependency, int32(i)) - } } for i, locs := 0, file.SourceLocations(); i < locs.Len(); i++ { loc := locs.Get(i) 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/source_gen.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go index ea154eec4..730331e66 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go @@ -21,6 +21,8 @@ func (p *SourcePath) appendFileDescriptorProto(b []byte) []byte { b = p.appendRepeatedField(b, "public_dependency", nil) case 11: b = p.appendRepeatedField(b, "weak_dependency", nil) + case 15: + b = p.appendRepeatedField(b, "option_dependency", nil) case 4: b = p.appendRepeatedField(b, "message_type", (*SourcePath).appendDescriptorProto) case 5: @@ -66,6 +68,8 @@ func (p *SourcePath) appendDescriptorProto(b []byte) []byte { b = p.appendRepeatedField(b, "reserved_range", (*SourcePath).appendDescriptorProto_ReservedRange) case 10: b = p.appendRepeatedField(b, "reserved_name", nil) + case 11: + b = p.appendSingularField(b, "visibility", nil) } return b } @@ -85,6 +89,8 @@ func (p *SourcePath) appendEnumDescriptorProto(b []byte) []byte { b = p.appendRepeatedField(b, "reserved_range", (*SourcePath).appendEnumDescriptorProto_EnumReservedRange) case 5: b = p.appendRepeatedField(b, "reserved_name", nil) + case 6: + b = p.appendSingularField(b, "visibility", nil) } return b } @@ -398,6 +404,10 @@ func (p *SourcePath) appendFeatureSet(b []byte) []byte { b = p.appendSingularField(b, "message_encoding", nil) case 6: b = p.appendSingularField(b, "json_format", nil) + case 7: + b = p.appendSingularField(b, "enforce_naming_style", nil) + case 8: + b = p.appendSingularField(b, "default_symbol_visibility", nil) } 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 cd8fadbaf..cd7fbc87a 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go @@ -68,7 +68,7 @@ type Descriptor interface { // dependency is not resolved, in which case only name information is known. // // Placeholder types may only be returned by the following accessors - // as a result of unresolved dependencies or weak imports: + // as a result of unresolved dependencies: // // ╔═══════════════════════════════════╤═════════════════════╗ // ║ Accessor │ Descriptor ║ @@ -168,11 +168,7 @@ type FileImport struct { // The current file and the imported file must be within proto package. IsPublic bool - // IsWeak reports whether this is a weak import, which does not impose - // a direct dependency on the target file. - // - // Weak imports are a legacy proto1 feature. Equivalent behavior is - // achieved using proto2 extension fields or proto3 Any messages. + // Deprecated: support for weak fields has been removed. IsWeak bool } @@ -325,9 +321,7 @@ type FieldDescriptor interface { // specified in the source .proto file. HasOptionalKeyword() bool - // IsWeak reports whether this is a weak field, which does not impose a - // direct dependency on the target type. - // If true, then Message returns a placeholder type. + // Deprecated: support for weak fields has been removed. IsWeak() bool // IsPacked reports whether repeated primitive numeric kinds should be diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value.go index a7b0d06ff..a4b78acef 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/value.go +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/value.go @@ -152,7 +152,7 @@ type Message interface { // This method may return nil. // // The returned methods type is identical to - // google.golang.org/protobuf/runtime/protoiface.Methods. + // [google.golang.org/protobuf/runtime/protoiface.Methods]. // Consult the protoiface package documentation for details. ProtoMethods() *methods } 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 75f83a2af..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 any // 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 any) 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() any { - return v.iface -} diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go121.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe.go similarity index 96% rename from vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go121.go rename to vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe.go index f7d386990..fe17f3722 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go121.go +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_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 && go1.21 -// +build !purego,!appengine,go1.21 - package protoreflect import ( 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 deleted file mode 100644 index 7f3583ead..000000000 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go120.go +++ /dev/null @@ -1,99 +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 && !go1.21 -// +build !purego,!appengine,!go1.21 - -package protoreflect - -import ( - "unsafe" - - "google.golang.org/protobuf/internal/pragma" -) - -type ( - stringHeader struct { - Data unsafe.Pointer - Len int - } - sliceHeader struct { - Data unsafe.Pointer - Len int - Cap int - } - ifaceHeader struct { - Type unsafe.Pointer - Data unsafe.Pointer - } -) - -var ( - nilType = typeOf(nil) - boolType = typeOf(*new(bool)) - int32Type = typeOf(*new(int32)) - int64Type = typeOf(*new(int64)) - uint32Type = typeOf(*new(uint32)) - uint64Type = typeOf(*new(uint64)) - float32Type = typeOf(*new(float32)) - float64Type = typeOf(*new(float64)) - stringType = typeOf(*new(string)) - bytesType = typeOf(*new([]byte)) - enumType = typeOf(*new(EnumNumber)) -) - -// 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 any) unsafe.Pointer { - return (*ifaceHeader)(unsafe.Pointer(&t)).Type -} - -// value is a union where only one type can be represented at a time. -// The struct is 24B large on 64-bit systems and requires the minimum storage -// necessary to represent each possible type. -// -// The Go GC needs to be able to scan variables containing pointers. -// As such, pointers and non-pointers cannot be intermixed. -type value struct { - pragma.DoNotCompare // 0B - - // typ stores the type of the value as a pointer to the Go type. - typ unsafe.Pointer // 8B - - // ptr stores the data pointer for a String, Bytes, or interface value. - ptr unsafe.Pointer // 8B - - // num stores a Bool, Int32, Int64, Uint32, Uint64, Float32, Float64, or - // Enum value as a raw uint64. - // - // It is also used to store the length of a String or Bytes value; - // the capacity is ignored. - num uint64 // 8B -} - -func valueOfString(v string) Value { - p := (*stringHeader)(unsafe.Pointer(&v)) - return Value{typ: stringType, ptr: p.Data, num: uint64(len(v))} -} -func valueOfBytes(v []byte) Value { - p := (*sliceHeader)(unsafe.Pointer(&v)) - return Value{typ: bytesType, ptr: p.Data, num: uint64(len(v))} -} -func valueOfIface(v any) Value { - p := (*ifaceHeader)(unsafe.Pointer(&v)) - return Value{typ: p.Type, ptr: p.Data} -} - -func (v Value) getString() (x string) { - *(*stringHeader)(unsafe.Pointer(&x)) = stringHeader{Data: v.ptr, Len: int(v.num)} - return x -} -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 any) { - *(*ifaceHeader)(unsafe.Pointer(&x)) = ifaceHeader{Type: v.typ, Data: v.ptr} - return x -} diff --git a/vendor/google.golang.org/protobuf/runtime/protoiface/methods.go b/vendor/google.golang.org/protobuf/runtime/protoiface/methods.go index 44cf467d8..28e9e9f03 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. @@ -119,6 +122,22 @@ type UnmarshalInputFlags = uint8 const ( UnmarshalDiscardUnknown UnmarshalInputFlags = 1 << iota + + // UnmarshalAliasBuffer permits unmarshal operations to alias the input buffer. + // The unmarshaller must not modify the contents of the buffer. + UnmarshalAliasBuffer + + // UnmarshalValidated indicates that validation has already been + // performed on the input buffer. + UnmarshalValidated + + // UnmarshalCheckRequired is set if this unmarshal operation ultimately will care if required fields are + // initialized. + UnmarshalCheckRequired + + // UnmarshalNoLazyDecoding is set if this unmarshal operation should not use + // lazy decoding, even when otherwise available. + UnmarshalNoLazyDecoding ) // UnmarshalOutputFlags are output from the Unmarshal method. @@ -166,3 +185,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/runtime/protoimpl/impl.go b/vendor/google.golang.org/protobuf/runtime/protoimpl/impl.go index 4a1ab7fb3..93df1b569 100644 --- a/vendor/google.golang.org/protobuf/runtime/protoimpl/impl.go +++ b/vendor/google.golang.org/protobuf/runtime/protoimpl/impl.go @@ -15,6 +15,7 @@ import ( "google.golang.org/protobuf/internal/filedesc" "google.golang.org/protobuf/internal/filetype" "google.golang.org/protobuf/internal/impl" + "google.golang.org/protobuf/internal/protolazy" ) // UnsafeEnabled specifies whether package unsafe can be used. @@ -39,6 +40,9 @@ type ( ExtensionFieldV1 = impl.ExtensionField Pointer = impl.Pointer + + LazyUnmarshalInfo = *protolazy.XXX_lazyUnmarshalInfo + RaceDetectHookData = impl.RaceDetectHookData ) var X impl.Export 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 9403eb075..6843b0bea 100644 --- a/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go +++ b/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go @@ -46,6 +46,7 @@ import ( protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" + unsafe "unsafe" ) // The full set of known editions. @@ -69,7 +70,7 @@ const ( Edition_EDITION_2023 Edition = 1000 Edition_EDITION_2024 Edition = 1001 // Placeholder editions for testing feature resolution. These should not be - // used or relyed on outside of tests. + // used or relied on outside of tests. Edition_EDITION_1_TEST_ONLY Edition = 1 Edition_EDITION_2_TEST_ONLY Edition = 2 Edition_EDITION_99997_TEST_ONLY Edition = 99997 @@ -150,6 +151,70 @@ func (Edition) EnumDescriptor() ([]byte, []int) { return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{0} } +// Describes the 'visibility' of a symbol with respect to the proto import +// system. Symbols can only be imported when the visibility rules do not prevent +// it (ex: local symbols cannot be imported). Visibility modifiers can only set +// on `message` and `enum` as they are the only types available to be referenced +// from other files. +type SymbolVisibility int32 + +const ( + SymbolVisibility_VISIBILITY_UNSET SymbolVisibility = 0 + SymbolVisibility_VISIBILITY_LOCAL SymbolVisibility = 1 + SymbolVisibility_VISIBILITY_EXPORT SymbolVisibility = 2 +) + +// Enum value maps for SymbolVisibility. +var ( + SymbolVisibility_name = map[int32]string{ + 0: "VISIBILITY_UNSET", + 1: "VISIBILITY_LOCAL", + 2: "VISIBILITY_EXPORT", + } + SymbolVisibility_value = map[string]int32{ + "VISIBILITY_UNSET": 0, + "VISIBILITY_LOCAL": 1, + "VISIBILITY_EXPORT": 2, + } +) + +func (x SymbolVisibility) Enum() *SymbolVisibility { + p := new(SymbolVisibility) + *p = x + return p +} + +func (x SymbolVisibility) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SymbolVisibility) Descriptor() protoreflect.EnumDescriptor { + return file_google_protobuf_descriptor_proto_enumTypes[1].Descriptor() +} + +func (SymbolVisibility) Type() protoreflect.EnumType { + return &file_google_protobuf_descriptor_proto_enumTypes[1] +} + +func (x SymbolVisibility) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *SymbolVisibility) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = SymbolVisibility(num) + return nil +} + +// Deprecated: Use SymbolVisibility.Descriptor instead. +func (SymbolVisibility) EnumDescriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{1} +} + // The verification state of the extension range. type ExtensionRangeOptions_VerificationState int32 @@ -182,11 +247,11 @@ func (x ExtensionRangeOptions_VerificationState) String() string { } func (ExtensionRangeOptions_VerificationState) Descriptor() protoreflect.EnumDescriptor { - return file_google_protobuf_descriptor_proto_enumTypes[1].Descriptor() + return file_google_protobuf_descriptor_proto_enumTypes[2].Descriptor() } func (ExtensionRangeOptions_VerificationState) Type() protoreflect.EnumType { - return &file_google_protobuf_descriptor_proto_enumTypes[1] + return &file_google_protobuf_descriptor_proto_enumTypes[2] } func (x ExtensionRangeOptions_VerificationState) Number() protoreflect.EnumNumber { @@ -298,11 +363,11 @@ func (x FieldDescriptorProto_Type) String() string { } func (FieldDescriptorProto_Type) Descriptor() protoreflect.EnumDescriptor { - return file_google_protobuf_descriptor_proto_enumTypes[2].Descriptor() + return file_google_protobuf_descriptor_proto_enumTypes[3].Descriptor() } func (FieldDescriptorProto_Type) Type() protoreflect.EnumType { - return &file_google_protobuf_descriptor_proto_enumTypes[2] + return &file_google_protobuf_descriptor_proto_enumTypes[3] } func (x FieldDescriptorProto_Type) Number() protoreflect.EnumNumber { @@ -361,11 +426,11 @@ func (x FieldDescriptorProto_Label) String() string { } func (FieldDescriptorProto_Label) Descriptor() protoreflect.EnumDescriptor { - return file_google_protobuf_descriptor_proto_enumTypes[3].Descriptor() + return file_google_protobuf_descriptor_proto_enumTypes[4].Descriptor() } func (FieldDescriptorProto_Label) Type() protoreflect.EnumType { - return &file_google_protobuf_descriptor_proto_enumTypes[3] + return &file_google_protobuf_descriptor_proto_enumTypes[4] } func (x FieldDescriptorProto_Label) Number() protoreflect.EnumNumber { @@ -422,11 +487,11 @@ func (x FileOptions_OptimizeMode) String() string { } func (FileOptions_OptimizeMode) Descriptor() protoreflect.EnumDescriptor { - return file_google_protobuf_descriptor_proto_enumTypes[4].Descriptor() + return file_google_protobuf_descriptor_proto_enumTypes[5].Descriptor() } func (FileOptions_OptimizeMode) Type() protoreflect.EnumType { - return &file_google_protobuf_descriptor_proto_enumTypes[4] + return &file_google_protobuf_descriptor_proto_enumTypes[5] } func (x FileOptions_OptimizeMode) Number() protoreflect.EnumNumber { @@ -488,11 +553,11 @@ func (x FieldOptions_CType) String() string { } func (FieldOptions_CType) Descriptor() protoreflect.EnumDescriptor { - return file_google_protobuf_descriptor_proto_enumTypes[5].Descriptor() + return file_google_protobuf_descriptor_proto_enumTypes[6].Descriptor() } func (FieldOptions_CType) Type() protoreflect.EnumType { - return &file_google_protobuf_descriptor_proto_enumTypes[5] + return &file_google_protobuf_descriptor_proto_enumTypes[6] } func (x FieldOptions_CType) Number() protoreflect.EnumNumber { @@ -550,11 +615,11 @@ func (x FieldOptions_JSType) String() string { } func (FieldOptions_JSType) Descriptor() protoreflect.EnumDescriptor { - return file_google_protobuf_descriptor_proto_enumTypes[6].Descriptor() + return file_google_protobuf_descriptor_proto_enumTypes[7].Descriptor() } func (FieldOptions_JSType) Type() protoreflect.EnumType { - return &file_google_protobuf_descriptor_proto_enumTypes[6] + return &file_google_protobuf_descriptor_proto_enumTypes[7] } func (x FieldOptions_JSType) Number() protoreflect.EnumNumber { @@ -577,8 +642,6 @@ func (FieldOptions_JSType) EnumDescriptor() ([]byte, []int) { } // If set to RETENTION_SOURCE, the option will be omitted from the binary. -// Note: as of January 2023, support for this is in progress and does not yet -// have an effect (b/264593489). type FieldOptions_OptionRetention int32 const ( @@ -612,11 +675,11 @@ func (x FieldOptions_OptionRetention) String() string { } func (FieldOptions_OptionRetention) Descriptor() protoreflect.EnumDescriptor { - return file_google_protobuf_descriptor_proto_enumTypes[7].Descriptor() + return file_google_protobuf_descriptor_proto_enumTypes[8].Descriptor() } func (FieldOptions_OptionRetention) Type() protoreflect.EnumType { - return &file_google_protobuf_descriptor_proto_enumTypes[7] + return &file_google_protobuf_descriptor_proto_enumTypes[8] } func (x FieldOptions_OptionRetention) Number() protoreflect.EnumNumber { @@ -640,8 +703,7 @@ func (FieldOptions_OptionRetention) EnumDescriptor() ([]byte, []int) { // This indicates the types of entities that the field may apply to when used // as an option. If it is unset, then the field may be freely used as an -// option on any kind of entity. Note: as of January 2023, support for this is -// in progress and does not yet have an effect (b/264593489). +// option on any kind of entity. type FieldOptions_OptionTargetType int32 const ( @@ -696,11 +758,11 @@ func (x FieldOptions_OptionTargetType) String() string { } func (FieldOptions_OptionTargetType) Descriptor() protoreflect.EnumDescriptor { - return file_google_protobuf_descriptor_proto_enumTypes[8].Descriptor() + return file_google_protobuf_descriptor_proto_enumTypes[9].Descriptor() } func (FieldOptions_OptionTargetType) Type() protoreflect.EnumType { - return &file_google_protobuf_descriptor_proto_enumTypes[8] + return &file_google_protobuf_descriptor_proto_enumTypes[9] } func (x FieldOptions_OptionTargetType) Number() protoreflect.EnumNumber { @@ -758,11 +820,11 @@ func (x MethodOptions_IdempotencyLevel) String() string { } func (MethodOptions_IdempotencyLevel) Descriptor() protoreflect.EnumDescriptor { - return file_google_protobuf_descriptor_proto_enumTypes[9].Descriptor() + return file_google_protobuf_descriptor_proto_enumTypes[10].Descriptor() } func (MethodOptions_IdempotencyLevel) Type() protoreflect.EnumType { - return &file_google_protobuf_descriptor_proto_enumTypes[9] + return &file_google_protobuf_descriptor_proto_enumTypes[10] } func (x MethodOptions_IdempotencyLevel) Number() protoreflect.EnumNumber { @@ -820,11 +882,11 @@ func (x FeatureSet_FieldPresence) String() string { } func (FeatureSet_FieldPresence) Descriptor() protoreflect.EnumDescriptor { - return file_google_protobuf_descriptor_proto_enumTypes[10].Descriptor() + return file_google_protobuf_descriptor_proto_enumTypes[11].Descriptor() } func (FeatureSet_FieldPresence) Type() protoreflect.EnumType { - return &file_google_protobuf_descriptor_proto_enumTypes[10] + return &file_google_protobuf_descriptor_proto_enumTypes[11] } func (x FeatureSet_FieldPresence) Number() protoreflect.EnumNumber { @@ -879,11 +941,11 @@ func (x FeatureSet_EnumType) String() string { } func (FeatureSet_EnumType) Descriptor() protoreflect.EnumDescriptor { - return file_google_protobuf_descriptor_proto_enumTypes[11].Descriptor() + return file_google_protobuf_descriptor_proto_enumTypes[12].Descriptor() } func (FeatureSet_EnumType) Type() protoreflect.EnumType { - return &file_google_protobuf_descriptor_proto_enumTypes[11] + return &file_google_protobuf_descriptor_proto_enumTypes[12] } func (x FeatureSet_EnumType) Number() protoreflect.EnumNumber { @@ -938,11 +1000,11 @@ func (x FeatureSet_RepeatedFieldEncoding) String() string { } func (FeatureSet_RepeatedFieldEncoding) Descriptor() protoreflect.EnumDescriptor { - return file_google_protobuf_descriptor_proto_enumTypes[12].Descriptor() + return file_google_protobuf_descriptor_proto_enumTypes[13].Descriptor() } func (FeatureSet_RepeatedFieldEncoding) Type() protoreflect.EnumType { - return &file_google_protobuf_descriptor_proto_enumTypes[12] + return &file_google_protobuf_descriptor_proto_enumTypes[13] } func (x FeatureSet_RepeatedFieldEncoding) Number() protoreflect.EnumNumber { @@ -997,11 +1059,11 @@ func (x FeatureSet_Utf8Validation) String() string { } func (FeatureSet_Utf8Validation) Descriptor() protoreflect.EnumDescriptor { - return file_google_protobuf_descriptor_proto_enumTypes[13].Descriptor() + return file_google_protobuf_descriptor_proto_enumTypes[14].Descriptor() } func (FeatureSet_Utf8Validation) Type() protoreflect.EnumType { - return &file_google_protobuf_descriptor_proto_enumTypes[13] + return &file_google_protobuf_descriptor_proto_enumTypes[14] } func (x FeatureSet_Utf8Validation) Number() protoreflect.EnumNumber { @@ -1056,11 +1118,11 @@ func (x FeatureSet_MessageEncoding) String() string { } func (FeatureSet_MessageEncoding) Descriptor() protoreflect.EnumDescriptor { - return file_google_protobuf_descriptor_proto_enumTypes[14].Descriptor() + return file_google_protobuf_descriptor_proto_enumTypes[15].Descriptor() } func (FeatureSet_MessageEncoding) Type() protoreflect.EnumType { - return &file_google_protobuf_descriptor_proto_enumTypes[14] + return &file_google_protobuf_descriptor_proto_enumTypes[15] } func (x FeatureSet_MessageEncoding) Number() protoreflect.EnumNumber { @@ -1115,11 +1177,11 @@ func (x FeatureSet_JsonFormat) String() string { } func (FeatureSet_JsonFormat) Descriptor() protoreflect.EnumDescriptor { - return file_google_protobuf_descriptor_proto_enumTypes[15].Descriptor() + return file_google_protobuf_descriptor_proto_enumTypes[16].Descriptor() } func (FeatureSet_JsonFormat) Type() protoreflect.EnumType { - return &file_google_protobuf_descriptor_proto_enumTypes[15] + return &file_google_protobuf_descriptor_proto_enumTypes[16] } func (x FeatureSet_JsonFormat) Number() protoreflect.EnumNumber { @@ -1141,6 +1203,136 @@ func (FeatureSet_JsonFormat) EnumDescriptor() ([]byte, []int) { return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{19, 5} } +type FeatureSet_EnforceNamingStyle int32 + +const ( + FeatureSet_ENFORCE_NAMING_STYLE_UNKNOWN FeatureSet_EnforceNamingStyle = 0 + FeatureSet_STYLE2024 FeatureSet_EnforceNamingStyle = 1 + FeatureSet_STYLE_LEGACY FeatureSet_EnforceNamingStyle = 2 +) + +// Enum value maps for FeatureSet_EnforceNamingStyle. +var ( + FeatureSet_EnforceNamingStyle_name = map[int32]string{ + 0: "ENFORCE_NAMING_STYLE_UNKNOWN", + 1: "STYLE2024", + 2: "STYLE_LEGACY", + } + FeatureSet_EnforceNamingStyle_value = map[string]int32{ + "ENFORCE_NAMING_STYLE_UNKNOWN": 0, + "STYLE2024": 1, + "STYLE_LEGACY": 2, + } +) + +func (x FeatureSet_EnforceNamingStyle) Enum() *FeatureSet_EnforceNamingStyle { + p := new(FeatureSet_EnforceNamingStyle) + *p = x + return p +} + +func (x FeatureSet_EnforceNamingStyle) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (FeatureSet_EnforceNamingStyle) Descriptor() protoreflect.EnumDescriptor { + return file_google_protobuf_descriptor_proto_enumTypes[17].Descriptor() +} + +func (FeatureSet_EnforceNamingStyle) Type() protoreflect.EnumType { + return &file_google_protobuf_descriptor_proto_enumTypes[17] +} + +func (x FeatureSet_EnforceNamingStyle) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *FeatureSet_EnforceNamingStyle) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = FeatureSet_EnforceNamingStyle(num) + return nil +} + +// Deprecated: Use FeatureSet_EnforceNamingStyle.Descriptor instead. +func (FeatureSet_EnforceNamingStyle) EnumDescriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{19, 6} +} + +type FeatureSet_VisibilityFeature_DefaultSymbolVisibility int32 + +const ( + FeatureSet_VisibilityFeature_DEFAULT_SYMBOL_VISIBILITY_UNKNOWN FeatureSet_VisibilityFeature_DefaultSymbolVisibility = 0 + // Default pre-EDITION_2024, all UNSET visibility are export. + FeatureSet_VisibilityFeature_EXPORT_ALL FeatureSet_VisibilityFeature_DefaultSymbolVisibility = 1 + // All top-level symbols default to export, nested default to local. + FeatureSet_VisibilityFeature_EXPORT_TOP_LEVEL FeatureSet_VisibilityFeature_DefaultSymbolVisibility = 2 + // All symbols default to local. + FeatureSet_VisibilityFeature_LOCAL_ALL FeatureSet_VisibilityFeature_DefaultSymbolVisibility = 3 + // All symbols local by default. Nested types cannot be exported. + // With special case caveat for message { enum {} reserved 1 to max; } + // This is the recommended setting for new protos. + FeatureSet_VisibilityFeature_STRICT FeatureSet_VisibilityFeature_DefaultSymbolVisibility = 4 +) + +// Enum value maps for FeatureSet_VisibilityFeature_DefaultSymbolVisibility. +var ( + FeatureSet_VisibilityFeature_DefaultSymbolVisibility_name = map[int32]string{ + 0: "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN", + 1: "EXPORT_ALL", + 2: "EXPORT_TOP_LEVEL", + 3: "LOCAL_ALL", + 4: "STRICT", + } + FeatureSet_VisibilityFeature_DefaultSymbolVisibility_value = map[string]int32{ + "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": 0, + "EXPORT_ALL": 1, + "EXPORT_TOP_LEVEL": 2, + "LOCAL_ALL": 3, + "STRICT": 4, + } +) + +func (x FeatureSet_VisibilityFeature_DefaultSymbolVisibility) Enum() *FeatureSet_VisibilityFeature_DefaultSymbolVisibility { + p := new(FeatureSet_VisibilityFeature_DefaultSymbolVisibility) + *p = x + return p +} + +func (x FeatureSet_VisibilityFeature_DefaultSymbolVisibility) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (FeatureSet_VisibilityFeature_DefaultSymbolVisibility) Descriptor() protoreflect.EnumDescriptor { + return file_google_protobuf_descriptor_proto_enumTypes[18].Descriptor() +} + +func (FeatureSet_VisibilityFeature_DefaultSymbolVisibility) Type() protoreflect.EnumType { + return &file_google_protobuf_descriptor_proto_enumTypes[18] +} + +func (x FeatureSet_VisibilityFeature_DefaultSymbolVisibility) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *FeatureSet_VisibilityFeature_DefaultSymbolVisibility) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = FeatureSet_VisibilityFeature_DefaultSymbolVisibility(num) + return nil +} + +// Deprecated: Use FeatureSet_VisibilityFeature_DefaultSymbolVisibility.Descriptor instead. +func (FeatureSet_VisibilityFeature_DefaultSymbolVisibility) EnumDescriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{19, 0, 0} +} + // Represents the identified object's effect on the element in the original // .proto file. type GeneratedCodeInfo_Annotation_Semantic int32 @@ -1179,11 +1371,11 @@ func (x GeneratedCodeInfo_Annotation_Semantic) String() string { } func (GeneratedCodeInfo_Annotation_Semantic) Descriptor() protoreflect.EnumDescriptor { - return file_google_protobuf_descriptor_proto_enumTypes[16].Descriptor() + return file_google_protobuf_descriptor_proto_enumTypes[19].Descriptor() } func (GeneratedCodeInfo_Annotation_Semantic) Type() protoreflect.EnumType { - return &file_google_protobuf_descriptor_proto_enumTypes[16] + return &file_google_protobuf_descriptor_proto_enumTypes[19] } func (x GeneratedCodeInfo_Annotation_Semantic) Number() protoreflect.EnumNumber { @@ -1208,20 +1400,18 @@ func (GeneratedCodeInfo_Annotation_Semantic) EnumDescriptor() ([]byte, []int) { // The protocol compiler can output a FileDescriptorSet containing the .proto // files it parses. type FileDescriptorSet struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - File []*FileDescriptorProto `protobuf:"bytes,1,rep,name=file" json:"file,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + File []*FileDescriptorProto `protobuf:"bytes,1,rep,name=file" json:"file,omitempty"` + extensionFields protoimpl.ExtensionFields + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } 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 { @@ -1232,7 +1422,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) @@ -1256,12 +1446,9 @@ func (x *FileDescriptorSet) GetFile() []*FileDescriptorProto { // Describes a complete .proto file. type FileDescriptorProto struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` // file name, relative to root of source tree - Package *string `protobuf:"bytes,2,opt,name=package" json:"package,omitempty"` // e.g. "foo", "foo.bar", etc. + state protoimpl.MessageState `protogen:"open.v1"` + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` // file name, relative to root of source tree + Package *string `protobuf:"bytes,2,opt,name=package" json:"package,omitempty"` // e.g. "foo", "foo.bar", etc. // Names of files imported by this file. Dependency []string `protobuf:"bytes,3,rep,name=dependency" json:"dependency,omitempty"` // Indexes of the public imported files in the dependency list above. @@ -1269,6 +1456,9 @@ type FileDescriptorProto struct { // Indexes of the weak imported files in the dependency list. // For Google-internal migration only. Do not use. WeakDependency []int32 `protobuf:"varint,11,rep,name=weak_dependency,json=weakDependency" json:"weak_dependency,omitempty"` + // Names of files imported by this file purely for the purpose of providing + // option extensions. These are excluded from the dependency list above. + OptionDependency []string `protobuf:"bytes,15,rep,name=option_dependency,json=optionDependency" json:"option_dependency,omitempty"` // All top-level definitions in this file. MessageType []*DescriptorProto `protobuf:"bytes,4,rep,name=message_type,json=messageType" json:"message_type,omitempty"` EnumType []*EnumDescriptorProto `protobuf:"bytes,5,rep,name=enum_type,json=enumType" json:"enum_type,omitempty"` @@ -1284,18 +1474,24 @@ type FileDescriptorProto struct { // The supported values are "proto2", "proto3", and "editions". // // If `edition` is present, this value must be "editions". + // WARNING: This field should only be used by protobuf plugins or special + // cases like the proto compiler. Other uses are discouraged and + // developers should rely on the protoreflect APIs for their client language. Syntax *string `protobuf:"bytes,12,opt,name=syntax" json:"syntax,omitempty"` // The edition of the proto file. - Edition *Edition `protobuf:"varint,14,opt,name=edition,enum=google.protobuf.Edition" json:"edition,omitempty"` + // WARNING: This field should only be used by protobuf plugins or special + // cases like the proto compiler. Other uses are discouraged and + // developers should rely on the protoreflect APIs for their client language. + Edition *Edition `protobuf:"varint,14,opt,name=edition,enum=google.protobuf.Edition" json:"edition,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } 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 { @@ -1306,7 +1502,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) @@ -1356,6 +1552,13 @@ func (x *FileDescriptorProto) GetWeakDependency() []int32 { return nil } +func (x *FileDescriptorProto) GetOptionDependency() []string { + if x != nil { + return x.OptionDependency + } + return nil +} + func (x *FileDescriptorProto) GetMessageType() []*DescriptorProto { if x != nil { return x.MessageType @@ -1414,10 +1617,7 @@ func (x *FileDescriptorProto) GetEdition() Edition { // Describes a message type. type DescriptorProto struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` Field []*FieldDescriptorProto `protobuf:"bytes,2,rep,name=field" json:"field,omitempty"` Extension []*FieldDescriptorProto `protobuf:"bytes,6,rep,name=extension" json:"extension,omitempty"` @@ -1430,15 +1630,17 @@ type DescriptorProto struct { // Reserved field names, which may not be used by fields in the same message. // A given name may only be reserved once. ReservedName []string `protobuf:"bytes,10,rep,name=reserved_name,json=reservedName" json:"reserved_name,omitempty"` + // Support for `export` and `local` keywords on enums. + Visibility *SymbolVisibility `protobuf:"varint,11,opt,name=visibility,enum=google.protobuf.SymbolVisibility" json:"visibility,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } 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 { @@ -1449,7 +1651,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) @@ -1534,12 +1736,15 @@ func (x *DescriptorProto) GetReservedName() []string { return nil } -type ExtensionRangeOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - extensionFields protoimpl.ExtensionFields +func (x *DescriptorProto) GetVisibility() SymbolVisibility { + if x != nil && x.Visibility != nil { + return *x.Visibility + } + return SymbolVisibility_VISIBILITY_UNSET +} +type ExtensionRangeOptions struct { + state protoimpl.MessageState `protogen:"open.v1"` // 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"` // For external users: DO NOT USE. We are in the process of open sourcing @@ -1551,7 +1756,10 @@ type ExtensionRangeOptions struct { // The verification state of the range. // TODO: flip the default to DECLARATION once all empty ranges // are marked as UNVERIFIED. - Verification *ExtensionRangeOptions_VerificationState `protobuf:"varint,3,opt,name=verification,enum=google.protobuf.ExtensionRangeOptions_VerificationState,def=1" json:"verification,omitempty"` + Verification *ExtensionRangeOptions_VerificationState `protobuf:"varint,3,opt,name=verification,enum=google.protobuf.ExtensionRangeOptions_VerificationState,def=1" json:"verification,omitempty"` + extensionFields protoimpl.ExtensionFields + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } // Default values for ExtensionRangeOptions fields. @@ -1561,11 +1769,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 { @@ -1576,7 +1782,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) @@ -1621,10 +1827,7 @@ func (x *ExtensionRangeOptions) GetVerification() ExtensionRangeOptions_Verifica // Describes a field within a message. type FieldDescriptorProto struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` Number *int32 `protobuf:"varint,3,opt,name=number" json:"number,omitempty"` Label *FieldDescriptorProto_Label `protobuf:"varint,4,opt,name=label,enum=google.protobuf.FieldDescriptorProto_Label" json:"label,omitempty"` @@ -1676,15 +1879,15 @@ type FieldDescriptorProto struct { // Proto2 optional fields do not set this flag, because they already indicate // optional with `LABEL_OPTIONAL`. Proto3Optional *bool `protobuf:"varint,17,opt,name=proto3_optional,json=proto3Optional" json:"proto3_optional,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } 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 { @@ -1695,7 +1898,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) @@ -1789,21 +1992,18 @@ func (x *FieldDescriptorProto) GetProto3Optional() bool { // Describes a oneof. type OneofDescriptorProto struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Options *OneofOptions `protobuf:"bytes,2,opt,name=options" json:"options,omitempty"` unknownFields protoimpl.UnknownFields - - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Options *OneofOptions `protobuf:"bytes,2,opt,name=options" json:"options,omitempty"` + sizeCache protoimpl.SizeCache } 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 { @@ -1814,7 +2014,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) @@ -1845,10 +2045,7 @@ func (x *OneofDescriptorProto) GetOptions() *OneofOptions { // Describes an enum type. type EnumDescriptorProto struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` Value []*EnumValueDescriptorProto `protobuf:"bytes,2,rep,name=value" json:"value,omitempty"` Options *EnumOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` @@ -1859,15 +2056,17 @@ type EnumDescriptorProto struct { // Reserved enum value names, which may not be reused. A given name may only // be reserved once. ReservedName []string `protobuf:"bytes,5,rep,name=reserved_name,json=reservedName" json:"reserved_name,omitempty"` + // Support for `export` and `local` keywords on enums. + Visibility *SymbolVisibility `protobuf:"varint,6,opt,name=visibility,enum=google.protobuf.SymbolVisibility" json:"visibility,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } 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 { @@ -1878,7 +2077,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) @@ -1928,24 +2127,28 @@ func (x *EnumDescriptorProto) GetReservedName() []string { return nil } +func (x *EnumDescriptorProto) GetVisibility() SymbolVisibility { + if x != nil && x.Visibility != nil { + return *x.Visibility + } + return SymbolVisibility_VISIBILITY_UNSET +} + // Describes a value within an enum. type EnumValueDescriptorProto struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Number *int32 `protobuf:"varint,2,opt,name=number" json:"number,omitempty"` + Options *EnumValueOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` unknownFields protoimpl.UnknownFields - - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Number *int32 `protobuf:"varint,2,opt,name=number" json:"number,omitempty"` - Options *EnumValueOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` + sizeCache protoimpl.SizeCache } 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 { @@ -1956,7 +2159,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) @@ -1994,22 +2197,19 @@ func (x *EnumValueDescriptorProto) GetOptions() *EnumValueOptions { // Describes a service. type ServiceDescriptorProto struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Method []*MethodDescriptorProto `protobuf:"bytes,2,rep,name=method" json:"method,omitempty"` + Options *ServiceOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` unknownFields protoimpl.UnknownFields - - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Method []*MethodDescriptorProto `protobuf:"bytes,2,rep,name=method" json:"method,omitempty"` - Options *ServiceOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` + sizeCache protoimpl.SizeCache } 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 { @@ -2020,7 +2220,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) @@ -2058,11 +2258,8 @@ func (x *ServiceDescriptorProto) GetOptions() *ServiceOptions { // Describes a method of a service. type MethodDescriptorProto struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` // Input and output type names. These are resolved in the same way as // FieldDescriptorProto.type_name, but must refer to a message type. InputType *string `protobuf:"bytes,2,opt,name=input_type,json=inputType" json:"input_type,omitempty"` @@ -2072,6 +2269,8 @@ type MethodDescriptorProto struct { ClientStreaming *bool `protobuf:"varint,5,opt,name=client_streaming,json=clientStreaming,def=0" json:"client_streaming,omitempty"` // Identifies if server streams multiple server messages ServerStreaming *bool `protobuf:"varint,6,opt,name=server_streaming,json=serverStreaming,def=0" json:"server_streaming,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } // Default values for MethodDescriptorProto fields. @@ -2082,11 +2281,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 { @@ -2097,7 +2294,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) @@ -2155,11 +2352,7 @@ func (x *MethodDescriptorProto) GetServerStreaming() bool { } type FileOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - extensionFields protoimpl.ExtensionFields - + state protoimpl.MessageState `protogen:"open.v1"` // Sets the Java package where classes generated from this .proto will be // placed. By default, the proto package is used, but this is often // inappropriate because proto packages do not normally start with backwards @@ -2247,10 +2440,16 @@ type FileOptions struct { // determining the ruby package. RubyPackage *string `protobuf:"bytes,45,opt,name=ruby_package,json=rubyPackage" json:"ruby_package,omitempty"` // Any features defined in the specific edition. + // WARNING: This field should only be used by protobuf plugins or special + // cases like the proto compiler. Other uses are discouraged and + // developers should rely on the protoreflect APIs for their client language. Features *FeatureSet `protobuf:"bytes,50,opt,name=features" json:"features,omitempty"` // The parser stores options it doesn't recognize here. // See the documentation for the "Options" section above. UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + extensionFields protoimpl.ExtensionFields + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } // Default values for FileOptions fields. @@ -2267,11 +2466,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 { @@ -2282,7 +2479,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) @@ -2446,11 +2643,7 @@ func (x *FileOptions) GetUninterpretedOption() []*UninterpretedOption { } type MessageOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - extensionFields protoimpl.ExtensionFields - + state protoimpl.MessageState `protogen:"open.v1"` // Set true to use the old proto1 MessageSet wire format for extensions. // This is provided for backwards-compatibility with the MessageSet wire // format. You should not use this for any other reason: It's less @@ -2520,9 +2713,15 @@ type MessageOptions struct { // Deprecated: Marked as deprecated in google/protobuf/descriptor.proto. DeprecatedLegacyJsonFieldConflicts *bool `protobuf:"varint,11,opt,name=deprecated_legacy_json_field_conflicts,json=deprecatedLegacyJsonFieldConflicts" json:"deprecated_legacy_json_field_conflicts,omitempty"` // Any features defined in the specific edition. + // WARNING: This field should only be used by protobuf plugins or special + // cases like the proto compiler. Other uses are discouraged and + // developers should rely on the protoreflect APIs for their client language. Features *FeatureSet `protobuf:"bytes,12,opt,name=features" json:"features,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"` + extensionFields protoimpl.ExtensionFields + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } // Default values for MessageOptions fields. @@ -2534,11 +2733,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 { @@ -2549,7 +2746,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) @@ -2615,17 +2812,14 @@ func (x *MessageOptions) GetUninterpretedOption() []*UninterpretedOption { } type FieldOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - extensionFields protoimpl.ExtensionFields - + state protoimpl.MessageState `protogen:"open.v1"` + // NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. // The ctype option instructs the C++ code generator to use a different // representation of the field than it normally would. See the specific // options below. This option is only implemented to support use of // [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of - // type "bytes" in the open source release -- sorry, we'll try to include - // other types in a future version! + // type "bytes" in the open source release. + // TODO: make ctype actually deprecated. Ctype *FieldOptions_CType `protobuf:"varint,1,opt,name=ctype,enum=google.protobuf.FieldOptions_CType,def=0" json:"ctype,omitempty"` // The packed option can be enabled for repeated primitive fields to enable // a more efficient representation on the wire. Rather than repeatedly @@ -2688,10 +2882,16 @@ 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. + // WARNING: This field should only be used by protobuf plugins or special + // cases like the proto compiler. Other uses are discouraged and + // developers should rely on the protoreflect APIs for their client language. 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"` + extensionFields protoimpl.ExtensionFields + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } // Default values for FieldOptions fields. @@ -2707,11 +2907,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 { @@ -2722,7 +2920,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) @@ -2836,24 +3034,24 @@ func (x *FieldOptions) GetUninterpretedOption() []*UninterpretedOption { } type OneofOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - extensionFields protoimpl.ExtensionFields - + state protoimpl.MessageState `protogen:"open.v1"` // Any features defined in the specific edition. + // WARNING: This field should only be used by protobuf plugins or special + // cases like the proto compiler. Other uses are discouraged and + // developers should rely on the protoreflect APIs for their client language. Features *FeatureSet `protobuf:"bytes,1,opt,name=features" json:"features,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"` + extensionFields protoimpl.ExtensionFields + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } 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 { @@ -2864,7 +3062,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) @@ -2894,11 +3092,7 @@ func (x *OneofOptions) GetUninterpretedOption() []*UninterpretedOption { } type EnumOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - extensionFields protoimpl.ExtensionFields - + state protoimpl.MessageState `protogen:"open.v1"` // Set this option to true to allow mapping different tag names to the same // value. AllowAlias *bool `protobuf:"varint,2,opt,name=allow_alias,json=allowAlias" json:"allow_alias,omitempty"` @@ -2917,9 +3111,15 @@ type EnumOptions struct { // Deprecated: Marked as deprecated in google/protobuf/descriptor.proto. DeprecatedLegacyJsonFieldConflicts *bool `protobuf:"varint,6,opt,name=deprecated_legacy_json_field_conflicts,json=deprecatedLegacyJsonFieldConflicts" json:"deprecated_legacy_json_field_conflicts,omitempty"` // Any features defined in the specific edition. + // WARNING: This field should only be used by protobuf plugins or special + // cases like the proto compiler. Other uses are discouraged and + // developers should rely on the protoreflect APIs for their client language. Features *FeatureSet `protobuf:"bytes,7,opt,name=features" json:"features,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"` + extensionFields protoimpl.ExtensionFields + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } // Default values for EnumOptions fields. @@ -2929,11 +3129,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 { @@ -2944,7 +3142,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) @@ -2996,17 +3194,16 @@ func (x *EnumOptions) GetUninterpretedOption() []*UninterpretedOption { } type EnumValueOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - extensionFields protoimpl.ExtensionFields - + state protoimpl.MessageState `protogen:"open.v1"` // Is this enum value deprecated? // Depending on the target platform, this can emit Deprecated annotations // for the enum value, or it will be completely ignored; in the very least, // this is a formalization for deprecating enum values. Deprecated *bool `protobuf:"varint,1,opt,name=deprecated,def=0" json:"deprecated,omitempty"` // Any features defined in the specific edition. + // WARNING: This field should only be used by protobuf plugins or special + // cases like the proto compiler. Other uses are discouraged and + // developers should rely on the protoreflect APIs for their client language. Features *FeatureSet `protobuf:"bytes,2,opt,name=features" json:"features,omitempty"` // Indicate that fields annotated with this enum value should not be printed // out when using debug formats, e.g. when the field contains sensitive @@ -3016,6 +3213,9 @@ type EnumValueOptions struct { 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"` + extensionFields protoimpl.ExtensionFields + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } // Default values for EnumValueOptions fields. @@ -3026,11 +3226,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 { @@ -3041,7 +3239,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) @@ -3092,12 +3290,11 @@ func (x *EnumValueOptions) GetUninterpretedOption() []*UninterpretedOption { } type ServiceOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - extensionFields protoimpl.ExtensionFields - + state protoimpl.MessageState `protogen:"open.v1"` // Any features defined in the specific edition. + // WARNING: This field should only be used by protobuf plugins or special + // cases like the proto compiler. Other uses are discouraged and + // developers should rely on the protoreflect APIs for their client language. Features *FeatureSet `protobuf:"bytes,34,opt,name=features" json:"features,omitempty"` // Is this service deprecated? // Depending on the target platform, this can emit Deprecated annotations @@ -3106,6 +3303,9 @@ type ServiceOptions struct { Deprecated *bool `protobuf:"varint,33,opt,name=deprecated,def=0" json:"deprecated,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"` + extensionFields protoimpl.ExtensionFields + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } // Default values for ServiceOptions fields. @@ -3115,11 +3315,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 { @@ -3130,7 +3328,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) @@ -3167,11 +3365,7 @@ func (x *ServiceOptions) GetUninterpretedOption() []*UninterpretedOption { } type MethodOptions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - extensionFields protoimpl.ExtensionFields - + state protoimpl.MessageState `protogen:"open.v1"` // Is this method deprecated? // Depending on the target platform, this can emit Deprecated annotations // for the method, or it will be completely ignored; in the very least, @@ -3179,9 +3373,15 @@ type MethodOptions struct { Deprecated *bool `protobuf:"varint,33,opt,name=deprecated,def=0" json:"deprecated,omitempty"` IdempotencyLevel *MethodOptions_IdempotencyLevel `protobuf:"varint,34,opt,name=idempotency_level,json=idempotencyLevel,enum=google.protobuf.MethodOptions_IdempotencyLevel,def=0" json:"idempotency_level,omitempty"` // Any features defined in the specific edition. + // WARNING: This field should only be used by protobuf plugins or special + // cases like the proto compiler. Other uses are discouraged and + // developers should rely on the protoreflect APIs for their client language. Features *FeatureSet `protobuf:"bytes,35,opt,name=features" json:"features,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"` + extensionFields protoimpl.ExtensionFields + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } // Default values for MethodOptions fields. @@ -3192,11 +3392,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 { @@ -3207,7 +3405,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) @@ -3257,11 +3455,8 @@ func (x *MethodOptions) GetUninterpretedOption() []*UninterpretedOption { // or produced by Descriptor::CopyTo()) will never have UninterpretedOptions // in them. type UninterpretedOption struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name []*UninterpretedOption_NamePart `protobuf:"bytes,2,rep,name=name" json:"name,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Name []*UninterpretedOption_NamePart `protobuf:"bytes,2,rep,name=name" json:"name,omitempty"` // The value of the uninterpreted option, in whatever type the tokenizer // identified it as during parsing. Exactly one of these should be set. IdentifierValue *string `protobuf:"bytes,3,opt,name=identifier_value,json=identifierValue" json:"identifier_value,omitempty"` @@ -3270,15 +3465,15 @@ type UninterpretedOption struct { DoubleValue *float64 `protobuf:"fixed64,6,opt,name=double_value,json=doubleValue" json:"double_value,omitempty"` StringValue []byte `protobuf:"bytes,7,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` AggregateValue *string `protobuf:"bytes,8,opt,name=aggregate_value,json=aggregateValue" json:"aggregate_value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } 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 { @@ -3289,7 +3484,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) @@ -3360,26 +3555,25 @@ func (x *UninterpretedOption) GetAggregateValue() string { // be designed and implemented to handle this, hopefully before we ever hit a // conflict here. type FeatureSet struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - extensionFields protoimpl.ExtensionFields - - FieldPresence *FeatureSet_FieldPresence `protobuf:"varint,1,opt,name=field_presence,json=fieldPresence,enum=google.protobuf.FeatureSet_FieldPresence" json:"field_presence,omitempty"` - EnumType *FeatureSet_EnumType `protobuf:"varint,2,opt,name=enum_type,json=enumType,enum=google.protobuf.FeatureSet_EnumType" json:"enum_type,omitempty"` - RepeatedFieldEncoding *FeatureSet_RepeatedFieldEncoding `protobuf:"varint,3,opt,name=repeated_field_encoding,json=repeatedFieldEncoding,enum=google.protobuf.FeatureSet_RepeatedFieldEncoding" json:"repeated_field_encoding,omitempty"` - Utf8Validation *FeatureSet_Utf8Validation `protobuf:"varint,4,opt,name=utf8_validation,json=utf8Validation,enum=google.protobuf.FeatureSet_Utf8Validation" json:"utf8_validation,omitempty"` - MessageEncoding *FeatureSet_MessageEncoding `protobuf:"varint,5,opt,name=message_encoding,json=messageEncoding,enum=google.protobuf.FeatureSet_MessageEncoding" json:"message_encoding,omitempty"` - JsonFormat *FeatureSet_JsonFormat `protobuf:"varint,6,opt,name=json_format,json=jsonFormat,enum=google.protobuf.FeatureSet_JsonFormat" json:"json_format,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + FieldPresence *FeatureSet_FieldPresence `protobuf:"varint,1,opt,name=field_presence,json=fieldPresence,enum=google.protobuf.FeatureSet_FieldPresence" json:"field_presence,omitempty"` + EnumType *FeatureSet_EnumType `protobuf:"varint,2,opt,name=enum_type,json=enumType,enum=google.protobuf.FeatureSet_EnumType" json:"enum_type,omitempty"` + RepeatedFieldEncoding *FeatureSet_RepeatedFieldEncoding `protobuf:"varint,3,opt,name=repeated_field_encoding,json=repeatedFieldEncoding,enum=google.protobuf.FeatureSet_RepeatedFieldEncoding" json:"repeated_field_encoding,omitempty"` + Utf8Validation *FeatureSet_Utf8Validation `protobuf:"varint,4,opt,name=utf8_validation,json=utf8Validation,enum=google.protobuf.FeatureSet_Utf8Validation" json:"utf8_validation,omitempty"` + MessageEncoding *FeatureSet_MessageEncoding `protobuf:"varint,5,opt,name=message_encoding,json=messageEncoding,enum=google.protobuf.FeatureSet_MessageEncoding" json:"message_encoding,omitempty"` + JsonFormat *FeatureSet_JsonFormat `protobuf:"varint,6,opt,name=json_format,json=jsonFormat,enum=google.protobuf.FeatureSet_JsonFormat" json:"json_format,omitempty"` + EnforceNamingStyle *FeatureSet_EnforceNamingStyle `protobuf:"varint,7,opt,name=enforce_naming_style,json=enforceNamingStyle,enum=google.protobuf.FeatureSet_EnforceNamingStyle" json:"enforce_naming_style,omitempty"` + DefaultSymbolVisibility *FeatureSet_VisibilityFeature_DefaultSymbolVisibility `protobuf:"varint,8,opt,name=default_symbol_visibility,json=defaultSymbolVisibility,enum=google.protobuf.FeatureSet_VisibilityFeature_DefaultSymbolVisibility" json:"default_symbol_visibility,omitempty"` + extensionFields protoimpl.ExtensionFields + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } 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 { @@ -3390,7 +3584,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) @@ -3447,15 +3641,26 @@ func (x *FeatureSet) GetJsonFormat() FeatureSet_JsonFormat { return FeatureSet_JSON_FORMAT_UNKNOWN } +func (x *FeatureSet) GetEnforceNamingStyle() FeatureSet_EnforceNamingStyle { + if x != nil && x.EnforceNamingStyle != nil { + return *x.EnforceNamingStyle + } + return FeatureSet_ENFORCE_NAMING_STYLE_UNKNOWN +} + +func (x *FeatureSet) GetDefaultSymbolVisibility() FeatureSet_VisibilityFeature_DefaultSymbolVisibility { + if x != nil && x.DefaultSymbolVisibility != nil { + return *x.DefaultSymbolVisibility + } + return FeatureSet_VisibilityFeature_DEFAULT_SYMBOL_VISIBILITY_UNKNOWN +} + // A compiled specification for the defaults of a set of features. These // messages are generated from FeatureSet extensions and can be used to seed // feature resolution. The resolution with this object becomes a simple search // for the closest matching edition, followed by proto merges. type FeatureSetDefaults struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` Defaults []*FeatureSetDefaults_FeatureSetEditionDefault `protobuf:"bytes,1,rep,name=defaults" json:"defaults,omitempty"` // The minimum supported edition (inclusive) when this was constructed. // Editions before this will not have defaults. @@ -3463,15 +3668,15 @@ type FeatureSetDefaults struct { // The maximum known edition (inclusive) when this was constructed. Editions // after this will not have reliable defaults. MaximumEdition *Edition `protobuf:"varint,5,opt,name=maximum_edition,json=maximumEdition,enum=google.protobuf.Edition" json:"maximum_edition,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } 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 { @@ -3482,7 +3687,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) @@ -3521,10 +3726,7 @@ func (x *FeatureSetDefaults) GetMaximumEdition() Edition { // Encapsulates information about the original source file from which a // FileDescriptorProto was generated. type SourceCodeInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` // A Location identifies a piece of source code in a .proto file which // corresponds to a particular definition. This information is intended // to be useful to IDEs, code indexers, documentation generators, and similar @@ -3573,16 +3775,17 @@ type SourceCodeInfo struct { // - Code which tries to interpret locations should probably be designed to // ignore those that it doesn't understand, as more types of locations could // be recorded in the future. - Location []*SourceCodeInfo_Location `protobuf:"bytes,1,rep,name=location" json:"location,omitempty"` + Location []*SourceCodeInfo_Location `protobuf:"bytes,1,rep,name=location" json:"location,omitempty"` + extensionFields protoimpl.ExtensionFields + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } 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 { @@ -3593,7 +3796,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) @@ -3619,22 +3822,19 @@ func (x *SourceCodeInfo) GetLocation() []*SourceCodeInfo_Location { // file. A GeneratedCodeInfo message is associated with only one generated // source file, but may contain references to different source .proto files. type GeneratedCodeInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` // An Annotation connects some span of text in generated code to an element // of its generating .proto file. - Annotation []*GeneratedCodeInfo_Annotation `protobuf:"bytes,1,rep,name=annotation" json:"annotation,omitempty"` + Annotation []*GeneratedCodeInfo_Annotation `protobuf:"bytes,1,rep,name=annotation" json:"annotation,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } 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 { @@ -3645,7 +3845,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) @@ -3668,22 +3868,19 @@ func (x *GeneratedCodeInfo) GetAnnotation() []*GeneratedCodeInfo_Annotation { } type DescriptorProto_ExtensionRange struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` // Inclusive. + End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` // Exclusive. + Options *ExtensionRangeOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` unknownFields protoimpl.UnknownFields - - Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` // Inclusive. - End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` // Exclusive. - Options *ExtensionRangeOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` + sizeCache protoimpl.SizeCache } 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 { @@ -3694,7 +3891,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) @@ -3734,21 +3931,18 @@ func (x *DescriptorProto_ExtensionRange) GetOptions() *ExtensionRangeOptions { // fields or extension ranges in the same message. Reserved ranges may // not overlap. type DescriptorProto_ReservedRange struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` // Inclusive. + End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` // Exclusive. unknownFields protoimpl.UnknownFields - - Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` // Inclusive. - End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` // Exclusive. + sizeCache protoimpl.SizeCache } 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 { @@ -3759,7 +3953,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) @@ -3789,10 +3983,7 @@ func (x *DescriptorProto_ReservedRange) GetEnd() int32 { } type ExtensionRangeOptions_Declaration struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` // The extension number declared within the extension range. Number *int32 `protobuf:"varint,1,opt,name=number" json:"number,omitempty"` // The fully-qualified name of the extension field. There must be a leading @@ -3808,16 +3999,16 @@ type ExtensionRangeOptions_Declaration struct { Reserved *bool `protobuf:"varint,5,opt,name=reserved" json:"reserved,omitempty"` // If true, indicates that the extension must be defined as repeated. // Otherwise the extension must be defined as optional. - Repeated *bool `protobuf:"varint,6,opt,name=repeated" json:"repeated,omitempty"` + Repeated *bool `protobuf:"varint,6,opt,name=repeated" json:"repeated,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } 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 { @@ -3828,7 +4019,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) @@ -3885,21 +4076,18 @@ func (x *ExtensionRangeOptions_Declaration) GetRepeated() bool { // is inclusive such that it can appropriately represent the entire int32 // domain. type EnumDescriptorProto_EnumReservedRange struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` // Inclusive. + End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` // Inclusive. unknownFields protoimpl.UnknownFields - - Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` // Inclusive. - End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` // Inclusive. + sizeCache protoimpl.SizeCache } 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 { @@ -3910,7 +4098,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) @@ -3940,21 +4128,18 @@ func (x *EnumDescriptorProto_EnumReservedRange) GetEnd() int32 { } type FieldOptions_EditionDefault struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Edition *Edition `protobuf:"varint,3,opt,name=edition,enum=google.protobuf.Edition" json:"edition,omitempty"` + Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` // Textproto value. unknownFields protoimpl.UnknownFields - - Edition *Edition `protobuf:"varint,3,opt,name=edition,enum=google.protobuf.Edition" json:"edition,omitempty"` - Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` // Textproto value. + sizeCache protoimpl.SizeCache } 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 { @@ -3965,7 +4150,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) @@ -3996,10 +4181,7 @@ func (x *FieldOptions_EditionDefault) GetValue() string { // Information about the support window of a feature. type FieldOptions_FeatureSupport struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` // 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. @@ -4014,15 +4196,15 @@ type FieldOptions_FeatureSupport struct { // 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"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *FieldOptions_FeatureSupport) Reset() { *x = FieldOptions_FeatureSupport{} - 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[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FieldOptions_FeatureSupport) String() string { @@ -4033,7 +4215,7 @@ func (*FieldOptions_FeatureSupport) ProtoMessage() {} func (x *FieldOptions_FeatureSupport) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_descriptor_proto_msgTypes[28] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -4082,21 +4264,18 @@ func (x *FieldOptions_FeatureSupport) GetEditionRemoved() Edition { // E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents // "foo.(bar.baz).moo". type UninterpretedOption_NamePart struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + NamePart *string `protobuf:"bytes,1,req,name=name_part,json=namePart" json:"name_part,omitempty"` + IsExtension *bool `protobuf:"varint,2,req,name=is_extension,json=isExtension" json:"is_extension,omitempty"` unknownFields protoimpl.UnknownFields - - NamePart *string `protobuf:"bytes,1,req,name=name_part,json=namePart" json:"name_part,omitempty"` - IsExtension *bool `protobuf:"varint,2,req,name=is_extension,json=isExtension" json:"is_extension,omitempty"` + sizeCache protoimpl.SizeCache } func (x *UninterpretedOption_NamePart) Reset() { *x = UninterpretedOption_NamePart{} - 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[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *UninterpretedOption_NamePart) String() string { @@ -4107,7 +4286,7 @@ func (*UninterpretedOption_NamePart) ProtoMessage() {} func (x *UninterpretedOption_NamePart) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_descriptor_proto_msgTypes[29] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -4136,29 +4315,62 @@ func (x *UninterpretedOption_NamePart) GetIsExtension() bool { return false } +type FeatureSet_VisibilityFeature struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *FeatureSet_VisibilityFeature) Reset() { + *x = FeatureSet_VisibilityFeature{} + mi := &file_google_protobuf_descriptor_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FeatureSet_VisibilityFeature) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FeatureSet_VisibilityFeature) ProtoMessage() {} + +func (x *FeatureSet_VisibilityFeature) ProtoReflect() protoreflect.Message { + 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) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FeatureSet_VisibilityFeature.ProtoReflect.Descriptor instead. +func (*FeatureSet_VisibilityFeature) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{19, 0} +} + // A map from every known edition with a unique set of defaults to its // defaults. Not all editions may be contained here. For a given edition, // the defaults at the closest matching edition ordered at or before it should // be used. This field must be in strict ascending order by edition. type FeatureSetDefaults_FeatureSetEditionDefault struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Edition *Edition `protobuf:"varint,3,opt,name=edition,enum=google.protobuf.Edition" json:"edition,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + 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"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *FeatureSetDefaults_FeatureSetEditionDefault) Reset() { *x = FeatureSetDefaults_FeatureSetEditionDefault{} - 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 *FeatureSetDefaults_FeatureSetEditionDefault) String() string { @@ -4168,8 +4380,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[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) @@ -4206,10 +4418,7 @@ func (x *FeatureSetDefaults_FeatureSetEditionDefault) GetFixedFeatures() *Featur } type SourceCodeInfo_Location struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` // Identifies which part of the FileDescriptorProto was defined at this // location. // @@ -4301,15 +4510,15 @@ type SourceCodeInfo_Location struct { LeadingComments *string `protobuf:"bytes,3,opt,name=leading_comments,json=leadingComments" json:"leading_comments,omitempty"` TrailingComments *string `protobuf:"bytes,4,opt,name=trailing_comments,json=trailingComments" json:"trailing_comments,omitempty"` LeadingDetachedComments []string `protobuf:"bytes,6,rep,name=leading_detached_comments,json=leadingDetachedComments" json:"leading_detached_comments,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *SourceCodeInfo_Location) Reset() { *x = SourceCodeInfo_Location{} - 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 *SourceCodeInfo_Location) String() string { @@ -4319,8 +4528,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[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) @@ -4371,10 +4580,7 @@ func (x *SourceCodeInfo_Location) GetLeadingDetachedComments() []string { } type GeneratedCodeInfo_Annotation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` // Identifies the element in the original source .proto file. This field // is formatted the same as SourceCodeInfo.Location.path. Path []int32 `protobuf:"varint,1,rep,packed,name=path" json:"path,omitempty"` @@ -4386,17 +4592,17 @@ type GeneratedCodeInfo_Annotation struct { // Identifies the ending offset in bytes in the generated code that // relates to the identified object. The end offset should be one past // the last relevant byte (so the length of the text = end - begin). - End *int32 `protobuf:"varint,4,opt,name=end" json:"end,omitempty"` - Semantic *GeneratedCodeInfo_Annotation_Semantic `protobuf:"varint,5,opt,name=semantic,enum=google.protobuf.GeneratedCodeInfo_Annotation_Semantic" json:"semantic,omitempty"` + End *int32 `protobuf:"varint,4,opt,name=end" json:"end,omitempty"` + Semantic *GeneratedCodeInfo_Annotation_Semantic `protobuf:"varint,5,opt,name=semantic,enum=google.protobuf.GeneratedCodeInfo_Annotation_Semantic" json:"semantic,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *GeneratedCodeInfo_Annotation) Reset() { *x = GeneratedCodeInfo_Annotation{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[32] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *GeneratedCodeInfo_Annotation) String() string { @@ -4406,8 +4612,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[32] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_google_protobuf_descriptor_proto_msgTypes[33] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -4459,925 +4665,547 @@ func (x *GeneratedCodeInfo_Annotation) GetSemantic() GeneratedCodeInfo_Annotatio var File_google_protobuf_descriptor_proto protoreflect.FileDescriptor -var file_google_protobuf_descriptor_proto_rawDesc = []byte{ - 0x0a, 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, 0x12, 0x0f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x22, 0x4d, 0x0a, 0x11, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x6f, 0x72, 0x53, 0x65, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x04, 0x66, 0x69, - 0x6c, 0x65, 0x22, 0x98, 0x05, 0x0a, 0x13, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, - 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x65, - 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x65, - 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x2b, 0x0a, 0x11, 0x70, 0x75, 0x62, 0x6c, - 0x69, 0x63, 0x5f, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x0a, 0x20, - 0x03, 0x28, 0x05, 0x52, 0x10, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x44, 0x65, 0x70, 0x65, 0x6e, - 0x64, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x27, 0x0a, 0x0f, 0x77, 0x65, 0x61, 0x6b, 0x5f, 0x64, 0x65, - 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0e, - 0x77, 0x65, 0x61, 0x6b, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x43, - 0x0a, 0x0c, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, - 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x09, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x08, 0x65, 0x6e, - 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x43, 0x0a, 0x09, 0x65, 0x78, 0x74, - 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, - 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x52, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x36, - 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x49, 0x0a, 0x10, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1f, 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, 0x52, 0x0e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, - 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x18, 0x0c, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x12, 0x32, 0x0a, 0x07, 0x65, 0x64, 0x69, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0e, 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, 0x22, 0xb9, 0x06, - 0x0a, 0x0f, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x05, 0x66, 0x69, 0x65, - 0x6c, 0x64, 0x12, 0x43, 0x0a, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, - 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x09, 0x65, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x41, 0x0a, 0x0b, 0x6e, 0x65, 0x73, 0x74, 0x65, - 0x64, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x0a, - 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x09, 0x65, 0x6e, - 0x75, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x52, 0x08, 0x65, 0x6e, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x58, 0x0a, - 0x0f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, - 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x0e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x44, 0x0a, 0x0a, 0x6f, 0x6e, 0x65, 0x6f, 0x66, - 0x5f, 0x64, 0x65, 0x63, 0x6c, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, - 0x65, 0x6f, 0x66, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x52, 0x09, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x44, 0x65, 0x63, 0x6c, 0x12, 0x39, 0x0a, - 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, - 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x55, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x64, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x2e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, - 0x52, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, - 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, - 0x4e, 0x61, 0x6d, 0x65, 0x1a, 0x7a, 0x0a, 0x0e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, - 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x12, 0x40, - 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x26, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, - 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x1a, 0x37, 0x0a, 0x0d, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, - 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x22, 0xcc, 0x04, 0x0a, 0x15, 0x45, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 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, 0x12, 0x59, 0x0a, - 0x0b, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, - 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x6c, 0x61, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x03, 0x88, 0x01, 0x02, 0x52, 0x0b, 0x64, 0x65, 0x63, - 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x73, 0x18, 0x32, 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, 0x6d, 0x0a, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x38, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, - 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x3a, 0x0a, 0x55, 0x4e, 0x56, 0x45, 0x52, 0x49, 0x46, 0x49, 0x45, 0x44, 0x42, 0x03, 0x88, - 0x01, 0x02, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x1a, 0x94, 0x01, 0x0a, 0x0b, 0x44, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x75, 0x6c, 0x6c, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x75, 0x6c, - 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, - 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, - 0x64, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x22, 0x34, 0x0a, 0x11, 0x56, 0x65, 0x72, 0x69, 0x66, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0f, 0x0a, 0x0b, - 0x44, 0x45, 0x43, 0x4c, 0x41, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x00, 0x12, 0x0e, 0x0a, - 0x0a, 0x55, 0x4e, 0x56, 0x45, 0x52, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x01, 0x2a, 0x09, 0x08, - 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0xc1, 0x06, 0x0a, 0x14, 0x46, 0x69, 0x65, - 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x41, 0x0a, - 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, - 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, - 0x12, 0x3e, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x79, 0x70, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, - 0x08, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x65, 0x66, - 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0c, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, - 0x0a, 0x0b, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x09, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x0a, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, - 0x1b, 0x0a, 0x09, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x6a, 0x73, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x07, - 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 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, 0x52, 0x07, 0x6f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, - 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x22, 0xb6, - 0x02, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, - 0x44, 0x4f, 0x55, 0x42, 0x4c, 0x45, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, - 0x5f, 0x46, 0x4c, 0x4f, 0x41, 0x54, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, - 0x5f, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, - 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x04, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, - 0x45, 0x5f, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, 0x05, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, - 0x45, 0x5f, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x10, 0x06, 0x12, 0x10, 0x0a, 0x0c, 0x54, - 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x10, 0x07, 0x12, 0x0d, 0x0a, - 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x10, 0x08, 0x12, 0x0f, 0x0a, 0x0b, - 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x09, 0x12, 0x0e, 0x0a, - 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x0a, 0x12, 0x10, 0x0a, - 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0x0b, 0x12, - 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x59, 0x54, 0x45, 0x53, 0x10, 0x0c, 0x12, - 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, 0x0d, - 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x10, 0x0e, 0x12, - 0x11, 0x0a, 0x0d, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, - 0x10, 0x0f, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x46, 0x49, 0x58, 0x45, - 0x44, 0x36, 0x34, 0x10, 0x10, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x49, - 0x4e, 0x54, 0x33, 0x32, 0x10, 0x11, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, - 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x12, 0x22, 0x43, 0x0a, 0x05, 0x4c, 0x61, 0x62, 0x65, 0x6c, - 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, - 0x41, 0x4c, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x52, 0x45, - 0x50, 0x45, 0x41, 0x54, 0x45, 0x44, 0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, 0x45, - 0x4c, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x49, 0x52, 0x45, 0x44, 0x10, 0x02, 0x22, 0x63, 0x0a, 0x14, - 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, - 0x66, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x22, 0xe3, 0x02, 0x0a, 0x13, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3f, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, - 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x36, - 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x5d, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x64, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x36, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, - 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x1a, 0x3b, 0x0a, 0x11, 0x45, 0x6e, - 0x75, 0x6d, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, - 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x22, 0x83, 0x01, 0x0a, 0x18, 0x45, 0x6e, 0x75, 0x6d, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, - 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, - 0x12, 0x3b, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x21, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xa7, 0x01, - 0x0a, 0x16, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3e, 0x0a, 0x06, - 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, - 0x65, 0x74, 0x68, 0x6f, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x39, 0x0a, 0x07, - 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, - 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x89, 0x02, 0x0a, 0x15, 0x4d, 0x65, 0x74, 0x68, - 0x6f, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x69, 0x6e, 0x70, 0x75, 0x74, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x75, 0x74, 0x70, 0x75, - 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 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, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, - 0x30, 0x0a, 0x10, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, - 0x69, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, - 0x52, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, - 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, 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, - 0x75, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x6a, 0x61, 0x76, 0x61, 0x4f, 0x75, 0x74, 0x65, 0x72, 0x43, - 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x13, 0x6a, 0x61, 0x76, 0x61, - 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, - 0x0a, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, 0x6a, 0x61, - 0x76, 0x61, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, - 0x44, 0x0a, 0x1d, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, - 0x5f, 0x65, 0x71, 0x75, 0x61, 0x6c, 0x73, 0x5f, 0x61, 0x6e, 0x64, 0x5f, 0x68, 0x61, 0x73, 0x68, - 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, 0x19, 0x6a, 0x61, 0x76, 0x61, - 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x45, 0x71, 0x75, 0x61, 0x6c, 0x73, 0x41, 0x6e, - 0x64, 0x48, 0x61, 0x73, 0x68, 0x12, 0x3a, 0x0a, 0x16, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x73, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x75, 0x74, 0x66, 0x38, 0x18, - 0x1b, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x13, 0x6a, 0x61, - 0x76, 0x61, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x55, 0x74, 0x66, - 0x38, 0x12, 0x53, 0x0a, 0x0c, 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x5f, 0x66, 0x6f, - 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x29, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x4d, 0x6f, - 0x64, 0x65, 0x3a, 0x05, 0x53, 0x50, 0x45, 0x45, 0x44, 0x52, 0x0b, 0x6f, 0x70, 0x74, 0x69, 0x6d, - 0x69, 0x7a, 0x65, 0x46, 0x6f, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x6f, 0x5f, 0x70, 0x61, 0x63, - 0x6b, 0x61, 0x67, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x6f, 0x50, 0x61, - 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x35, 0x0a, 0x13, 0x63, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x65, - 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x10, 0x20, 0x01, - 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, 0x63, 0x63, 0x47, 0x65, 0x6e, - 0x65, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x39, 0x0a, 0x15, - 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, - 0x73, 0x65, 0x52, 0x13, 0x6a, 0x61, 0x76, 0x61, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x35, 0x0a, 0x13, 0x70, 0x79, 0x5f, 0x67, 0x65, - 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x12, - 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, 0x70, 0x79, 0x47, - 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x25, - 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x17, 0x20, 0x01, - 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, - 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x2e, 0x0a, 0x10, 0x63, 0x63, 0x5f, 0x65, 0x6e, 0x61, 0x62, - 0x6c, 0x65, 0x5f, 0x61, 0x72, 0x65, 0x6e, 0x61, 0x73, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x08, 0x3a, - 0x04, 0x74, 0x72, 0x75, 0x65, 0x52, 0x0e, 0x63, 0x63, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x41, - 0x72, 0x65, 0x6e, 0x61, 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x6f, 0x62, 0x6a, 0x63, 0x5f, 0x63, 0x6c, - 0x61, 0x73, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x24, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0f, 0x6f, 0x62, 0x6a, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, - 0x78, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x25, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x63, 0x73, 0x68, - 0x61, 0x72, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x21, 0x0a, 0x0c, - 0x73, 0x77, 0x69, 0x66, 0x74, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x27, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0b, 0x73, 0x77, 0x69, 0x66, 0x74, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, - 0x28, 0x0a, 0x10, 0x70, 0x68, 0x70, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x70, 0x72, 0x65, - 0x66, 0x69, 0x78, 0x18, 0x28, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x70, 0x68, 0x70, 0x43, 0x6c, - 0x61, 0x73, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x68, 0x70, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x29, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0c, 0x70, 0x68, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x34, - 0x0a, 0x16, 0x70, 0x68, 0x70, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x6e, - 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x2c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, - 0x70, 0x68, 0x70, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4e, 0x61, 0x6d, 0x65, 0x73, - 0x70, 0x61, 0x63, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x75, 0x62, 0x79, 0x5f, 0x70, 0x61, 0x63, - 0x6b, 0x61, 0x67, 0x65, 0x18, 0x2d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x72, 0x75, 0x62, 0x79, - 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, - 0x72, 0x65, 0x73, 0x18, 0x32, 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, 0x3a, 0x0a, 0x0c, 0x4f, 0x70, - 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x50, - 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, 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, 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, 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, - 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, - 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, 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, - 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, -} +const file_google_protobuf_descriptor_proto_rawDesc = "" + + "\n" + + " google/protobuf/descriptor.proto\x12\x0fgoogle.protobuf\"[\n" + + "\x11FileDescriptorSet\x128\n" + + "\x04file\x18\x01 \x03(\v2$.google.protobuf.FileDescriptorProtoR\x04file*\f\b\x80\xec\xca\xff\x01\x10\x81\xec\xca\xff\x01\"\xc5\x05\n" + + "\x13FileDescriptorProto\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x18\n" + + "\apackage\x18\x02 \x01(\tR\apackage\x12\x1e\n" + + "\n" + + "dependency\x18\x03 \x03(\tR\n" + + "dependency\x12+\n" + + "\x11public_dependency\x18\n" + + " \x03(\x05R\x10publicDependency\x12'\n" + + "\x0fweak_dependency\x18\v \x03(\x05R\x0eweakDependency\x12+\n" + + "\x11option_dependency\x18\x0f \x03(\tR\x10optionDependency\x12C\n" + + "\fmessage_type\x18\x04 \x03(\v2 .google.protobuf.DescriptorProtoR\vmessageType\x12A\n" + + "\tenum_type\x18\x05 \x03(\v2$.google.protobuf.EnumDescriptorProtoR\benumType\x12A\n" + + "\aservice\x18\x06 \x03(\v2'.google.protobuf.ServiceDescriptorProtoR\aservice\x12C\n" + + "\textension\x18\a \x03(\v2%.google.protobuf.FieldDescriptorProtoR\textension\x126\n" + + "\aoptions\x18\b \x01(\v2\x1c.google.protobuf.FileOptionsR\aoptions\x12I\n" + + "\x10source_code_info\x18\t \x01(\v2\x1f.google.protobuf.SourceCodeInfoR\x0esourceCodeInfo\x12\x16\n" + + "\x06syntax\x18\f \x01(\tR\x06syntax\x122\n" + + "\aedition\x18\x0e \x01(\x0e2\x18.google.protobuf.EditionR\aedition\"\xfc\x06\n" + + "\x0fDescriptorProto\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12;\n" + + "\x05field\x18\x02 \x03(\v2%.google.protobuf.FieldDescriptorProtoR\x05field\x12C\n" + + "\textension\x18\x06 \x03(\v2%.google.protobuf.FieldDescriptorProtoR\textension\x12A\n" + + "\vnested_type\x18\x03 \x03(\v2 .google.protobuf.DescriptorProtoR\n" + + "nestedType\x12A\n" + + "\tenum_type\x18\x04 \x03(\v2$.google.protobuf.EnumDescriptorProtoR\benumType\x12X\n" + + "\x0fextension_range\x18\x05 \x03(\v2/.google.protobuf.DescriptorProto.ExtensionRangeR\x0eextensionRange\x12D\n" + + "\n" + + "oneof_decl\x18\b \x03(\v2%.google.protobuf.OneofDescriptorProtoR\toneofDecl\x129\n" + + "\aoptions\x18\a \x01(\v2\x1f.google.protobuf.MessageOptionsR\aoptions\x12U\n" + + "\x0ereserved_range\x18\t \x03(\v2..google.protobuf.DescriptorProto.ReservedRangeR\rreservedRange\x12#\n" + + "\rreserved_name\x18\n" + + " \x03(\tR\freservedName\x12A\n" + + "\n" + + "visibility\x18\v \x01(\x0e2!.google.protobuf.SymbolVisibilityR\n" + + "visibility\x1az\n" + + "\x0eExtensionRange\x12\x14\n" + + "\x05start\x18\x01 \x01(\x05R\x05start\x12\x10\n" + + "\x03end\x18\x02 \x01(\x05R\x03end\x12@\n" + + "\aoptions\x18\x03 \x01(\v2&.google.protobuf.ExtensionRangeOptionsR\aoptions\x1a7\n" + + "\rReservedRange\x12\x14\n" + + "\x05start\x18\x01 \x01(\x05R\x05start\x12\x10\n" + + "\x03end\x18\x02 \x01(\x05R\x03end\"\xcc\x04\n" + + "\x15ExtensionRangeOptions\x12X\n" + + "\x14uninterpreted_option\x18\xe7\a \x03(\v2$.google.protobuf.UninterpretedOptionR\x13uninterpretedOption\x12Y\n" + + "\vdeclaration\x18\x02 \x03(\v22.google.protobuf.ExtensionRangeOptions.DeclarationB\x03\x88\x01\x02R\vdeclaration\x127\n" + + "\bfeatures\x182 \x01(\v2\x1b.google.protobuf.FeatureSetR\bfeatures\x12m\n" + + "\fverification\x18\x03 \x01(\x0e28.google.protobuf.ExtensionRangeOptions.VerificationState:\n" + + "UNVERIFIEDB\x03\x88\x01\x02R\fverification\x1a\x94\x01\n" + + "\vDeclaration\x12\x16\n" + + "\x06number\x18\x01 \x01(\x05R\x06number\x12\x1b\n" + + "\tfull_name\x18\x02 \x01(\tR\bfullName\x12\x12\n" + + "\x04type\x18\x03 \x01(\tR\x04type\x12\x1a\n" + + "\breserved\x18\x05 \x01(\bR\breserved\x12\x1a\n" + + "\brepeated\x18\x06 \x01(\bR\brepeatedJ\x04\b\x04\x10\x05\"4\n" + + "\x11VerificationState\x12\x0f\n" + + "\vDECLARATION\x10\x00\x12\x0e\n" + + "\n" + + "UNVERIFIED\x10\x01*\t\b\xe8\a\x10\x80\x80\x80\x80\x02\"\xc1\x06\n" + + "\x14FieldDescriptorProto\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x16\n" + + "\x06number\x18\x03 \x01(\x05R\x06number\x12A\n" + + "\x05label\x18\x04 \x01(\x0e2+.google.protobuf.FieldDescriptorProto.LabelR\x05label\x12>\n" + + "\x04type\x18\x05 \x01(\x0e2*.google.protobuf.FieldDescriptorProto.TypeR\x04type\x12\x1b\n" + + "\ttype_name\x18\x06 \x01(\tR\btypeName\x12\x1a\n" + + "\bextendee\x18\x02 \x01(\tR\bextendee\x12#\n" + + "\rdefault_value\x18\a \x01(\tR\fdefaultValue\x12\x1f\n" + + "\voneof_index\x18\t \x01(\x05R\n" + + "oneofIndex\x12\x1b\n" + + "\tjson_name\x18\n" + + " \x01(\tR\bjsonName\x127\n" + + "\aoptions\x18\b \x01(\v2\x1d.google.protobuf.FieldOptionsR\aoptions\x12'\n" + + "\x0fproto3_optional\x18\x11 \x01(\bR\x0eproto3Optional\"\xb6\x02\n" + + "\x04Type\x12\x0f\n" + + "\vTYPE_DOUBLE\x10\x01\x12\x0e\n" + + "\n" + + "TYPE_FLOAT\x10\x02\x12\x0e\n" + + "\n" + + "TYPE_INT64\x10\x03\x12\x0f\n" + + "\vTYPE_UINT64\x10\x04\x12\x0e\n" + + "\n" + + "TYPE_INT32\x10\x05\x12\x10\n" + + "\fTYPE_FIXED64\x10\x06\x12\x10\n" + + "\fTYPE_FIXED32\x10\a\x12\r\n" + + "\tTYPE_BOOL\x10\b\x12\x0f\n" + + "\vTYPE_STRING\x10\t\x12\x0e\n" + + "\n" + + "TYPE_GROUP\x10\n" + + "\x12\x10\n" + + "\fTYPE_MESSAGE\x10\v\x12\x0e\n" + + "\n" + + "TYPE_BYTES\x10\f\x12\x0f\n" + + "\vTYPE_UINT32\x10\r\x12\r\n" + + "\tTYPE_ENUM\x10\x0e\x12\x11\n" + + "\rTYPE_SFIXED32\x10\x0f\x12\x11\n" + + "\rTYPE_SFIXED64\x10\x10\x12\x0f\n" + + "\vTYPE_SINT32\x10\x11\x12\x0f\n" + + "\vTYPE_SINT64\x10\x12\"C\n" + + "\x05Label\x12\x12\n" + + "\x0eLABEL_OPTIONAL\x10\x01\x12\x12\n" + + "\x0eLABEL_REPEATED\x10\x03\x12\x12\n" + + "\x0eLABEL_REQUIRED\x10\x02\"c\n" + + "\x14OneofDescriptorProto\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x127\n" + + "\aoptions\x18\x02 \x01(\v2\x1d.google.protobuf.OneofOptionsR\aoptions\"\xa6\x03\n" + + "\x13EnumDescriptorProto\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12?\n" + + "\x05value\x18\x02 \x03(\v2).google.protobuf.EnumValueDescriptorProtoR\x05value\x126\n" + + "\aoptions\x18\x03 \x01(\v2\x1c.google.protobuf.EnumOptionsR\aoptions\x12]\n" + + "\x0ereserved_range\x18\x04 \x03(\v26.google.protobuf.EnumDescriptorProto.EnumReservedRangeR\rreservedRange\x12#\n" + + "\rreserved_name\x18\x05 \x03(\tR\freservedName\x12A\n" + + "\n" + + "visibility\x18\x06 \x01(\x0e2!.google.protobuf.SymbolVisibilityR\n" + + "visibility\x1a;\n" + + "\x11EnumReservedRange\x12\x14\n" + + "\x05start\x18\x01 \x01(\x05R\x05start\x12\x10\n" + + "\x03end\x18\x02 \x01(\x05R\x03end\"\x83\x01\n" + + "\x18EnumValueDescriptorProto\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x16\n" + + "\x06number\x18\x02 \x01(\x05R\x06number\x12;\n" + + "\aoptions\x18\x03 \x01(\v2!.google.protobuf.EnumValueOptionsR\aoptions\"\xa7\x01\n" + + "\x16ServiceDescriptorProto\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12>\n" + + "\x06method\x18\x02 \x03(\v2&.google.protobuf.MethodDescriptorProtoR\x06method\x129\n" + + "\aoptions\x18\x03 \x01(\v2\x1f.google.protobuf.ServiceOptionsR\aoptions\"\x89\x02\n" + + "\x15MethodDescriptorProto\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1d\n" + + "\n" + + "input_type\x18\x02 \x01(\tR\tinputType\x12\x1f\n" + + "\voutput_type\x18\x03 \x01(\tR\n" + + "outputType\x128\n" + + "\aoptions\x18\x04 \x01(\v2\x1e.google.protobuf.MethodOptionsR\aoptions\x120\n" + + "\x10client_streaming\x18\x05 \x01(\b:\x05falseR\x0fclientStreaming\x120\n" + + "\x10server_streaming\x18\x06 \x01(\b:\x05falseR\x0fserverStreaming\"\xad\t\n" + + "\vFileOptions\x12!\n" + + "\fjava_package\x18\x01 \x01(\tR\vjavaPackage\x120\n" + + "\x14java_outer_classname\x18\b \x01(\tR\x12javaOuterClassname\x125\n" + + "\x13java_multiple_files\x18\n" + + " \x01(\b:\x05falseR\x11javaMultipleFiles\x12D\n" + + "\x1djava_generate_equals_and_hash\x18\x14 \x01(\bB\x02\x18\x01R\x19javaGenerateEqualsAndHash\x12:\n" + + "\x16java_string_check_utf8\x18\x1b \x01(\b:\x05falseR\x13javaStringCheckUtf8\x12S\n" + + "\foptimize_for\x18\t \x01(\x0e2).google.protobuf.FileOptions.OptimizeMode:\x05SPEEDR\voptimizeFor\x12\x1d\n" + + "\n" + + "go_package\x18\v \x01(\tR\tgoPackage\x125\n" + + "\x13cc_generic_services\x18\x10 \x01(\b:\x05falseR\x11ccGenericServices\x129\n" + + "\x15java_generic_services\x18\x11 \x01(\b:\x05falseR\x13javaGenericServices\x125\n" + + "\x13py_generic_services\x18\x12 \x01(\b:\x05falseR\x11pyGenericServices\x12%\n" + + "\n" + + "deprecated\x18\x17 \x01(\b:\x05falseR\n" + + "deprecated\x12.\n" + + "\x10cc_enable_arenas\x18\x1f \x01(\b:\x04trueR\x0eccEnableArenas\x12*\n" + + "\x11objc_class_prefix\x18$ \x01(\tR\x0fobjcClassPrefix\x12)\n" + + "\x10csharp_namespace\x18% \x01(\tR\x0fcsharpNamespace\x12!\n" + + "\fswift_prefix\x18' \x01(\tR\vswiftPrefix\x12(\n" + + "\x10php_class_prefix\x18( \x01(\tR\x0ephpClassPrefix\x12#\n" + + "\rphp_namespace\x18) \x01(\tR\fphpNamespace\x124\n" + + "\x16php_metadata_namespace\x18, \x01(\tR\x14phpMetadataNamespace\x12!\n" + + "\fruby_package\x18- \x01(\tR\vrubyPackage\x127\n" + + "\bfeatures\x182 \x01(\v2\x1b.google.protobuf.FeatureSetR\bfeatures\x12X\n" + + "\x14uninterpreted_option\x18\xe7\a \x03(\v2$.google.protobuf.UninterpretedOptionR\x13uninterpretedOption\":\n" + + "\fOptimizeMode\x12\t\n" + + "\x05SPEED\x10\x01\x12\r\n" + + "\tCODE_SIZE\x10\x02\x12\x10\n" + + "\fLITE_RUNTIME\x10\x03*\t\b\xe8\a\x10\x80\x80\x80\x80\x02J\x04\b*\x10+J\x04\b&\x10'R\x14php_generic_services\"\xf4\x03\n" + + "\x0eMessageOptions\x12<\n" + + "\x17message_set_wire_format\x18\x01 \x01(\b:\x05falseR\x14messageSetWireFormat\x12L\n" + + "\x1fno_standard_descriptor_accessor\x18\x02 \x01(\b:\x05falseR\x1cnoStandardDescriptorAccessor\x12%\n" + + "\n" + + "deprecated\x18\x03 \x01(\b:\x05falseR\n" + + "deprecated\x12\x1b\n" + + "\tmap_entry\x18\a \x01(\bR\bmapEntry\x12V\n" + + "&deprecated_legacy_json_field_conflicts\x18\v \x01(\bB\x02\x18\x01R\"deprecatedLegacyJsonFieldConflicts\x127\n" + + "\bfeatures\x18\f \x01(\v2\x1b.google.protobuf.FeatureSetR\bfeatures\x12X\n" + + "\x14uninterpreted_option\x18\xe7\a \x03(\v2$.google.protobuf.UninterpretedOptionR\x13uninterpretedOption*\t\b\xe8\a\x10\x80\x80\x80\x80\x02J\x04\b\x04\x10\x05J\x04\b\x05\x10\x06J\x04\b\x06\x10\aJ\x04\b\b\x10\tJ\x04\b\t\x10\n" + + "\"\x9d\r\n" + + "\fFieldOptions\x12A\n" + + "\x05ctype\x18\x01 \x01(\x0e2#.google.protobuf.FieldOptions.CType:\x06STRINGR\x05ctype\x12\x16\n" + + "\x06packed\x18\x02 \x01(\bR\x06packed\x12G\n" + + "\x06jstype\x18\x06 \x01(\x0e2$.google.protobuf.FieldOptions.JSType:\tJS_NORMALR\x06jstype\x12\x19\n" + + "\x04lazy\x18\x05 \x01(\b:\x05falseR\x04lazy\x12.\n" + + "\x0funverified_lazy\x18\x0f \x01(\b:\x05falseR\x0eunverifiedLazy\x12%\n" + + "\n" + + "deprecated\x18\x03 \x01(\b:\x05falseR\n" + + "deprecated\x12\x19\n" + + "\x04weak\x18\n" + + " \x01(\b:\x05falseR\x04weak\x12(\n" + + "\fdebug_redact\x18\x10 \x01(\b:\x05falseR\vdebugRedact\x12K\n" + + "\tretention\x18\x11 \x01(\x0e2-.google.protobuf.FieldOptions.OptionRetentionR\tretention\x12H\n" + + "\atargets\x18\x13 \x03(\x0e2..google.protobuf.FieldOptions.OptionTargetTypeR\atargets\x12W\n" + + "\x10edition_defaults\x18\x14 \x03(\v2,.google.protobuf.FieldOptions.EditionDefaultR\x0feditionDefaults\x127\n" + + "\bfeatures\x18\x15 \x01(\v2\x1b.google.protobuf.FeatureSetR\bfeatures\x12U\n" + + "\x0ffeature_support\x18\x16 \x01(\v2,.google.protobuf.FieldOptions.FeatureSupportR\x0efeatureSupport\x12X\n" + + "\x14uninterpreted_option\x18\xe7\a \x03(\v2$.google.protobuf.UninterpretedOptionR\x13uninterpretedOption\x1aZ\n" + + "\x0eEditionDefault\x122\n" + + "\aedition\x18\x03 \x01(\x0e2\x18.google.protobuf.EditionR\aedition\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value\x1a\x96\x02\n" + + "\x0eFeatureSupport\x12G\n" + + "\x12edition_introduced\x18\x01 \x01(\x0e2\x18.google.protobuf.EditionR\x11editionIntroduced\x12G\n" + + "\x12edition_deprecated\x18\x02 \x01(\x0e2\x18.google.protobuf.EditionR\x11editionDeprecated\x12/\n" + + "\x13deprecation_warning\x18\x03 \x01(\tR\x12deprecationWarning\x12A\n" + + "\x0fedition_removed\x18\x04 \x01(\x0e2\x18.google.protobuf.EditionR\x0eeditionRemoved\"/\n" + + "\x05CType\x12\n" + + "\n" + + "\x06STRING\x10\x00\x12\b\n" + + "\x04CORD\x10\x01\x12\x10\n" + + "\fSTRING_PIECE\x10\x02\"5\n" + + "\x06JSType\x12\r\n" + + "\tJS_NORMAL\x10\x00\x12\r\n" + + "\tJS_STRING\x10\x01\x12\r\n" + + "\tJS_NUMBER\x10\x02\"U\n" + + "\x0fOptionRetention\x12\x15\n" + + "\x11RETENTION_UNKNOWN\x10\x00\x12\x15\n" + + "\x11RETENTION_RUNTIME\x10\x01\x12\x14\n" + + "\x10RETENTION_SOURCE\x10\x02\"\x8c\x02\n" + + "\x10OptionTargetType\x12\x17\n" + + "\x13TARGET_TYPE_UNKNOWN\x10\x00\x12\x14\n" + + "\x10TARGET_TYPE_FILE\x10\x01\x12\x1f\n" + + "\x1bTARGET_TYPE_EXTENSION_RANGE\x10\x02\x12\x17\n" + + "\x13TARGET_TYPE_MESSAGE\x10\x03\x12\x15\n" + + "\x11TARGET_TYPE_FIELD\x10\x04\x12\x15\n" + + "\x11TARGET_TYPE_ONEOF\x10\x05\x12\x14\n" + + "\x10TARGET_TYPE_ENUM\x10\x06\x12\x1a\n" + + "\x16TARGET_TYPE_ENUM_ENTRY\x10\a\x12\x17\n" + + "\x13TARGET_TYPE_SERVICE\x10\b\x12\x16\n" + + "\x12TARGET_TYPE_METHOD\x10\t*\t\b\xe8\a\x10\x80\x80\x80\x80\x02J\x04\b\x04\x10\x05J\x04\b\x12\x10\x13\"\xac\x01\n" + + "\fOneofOptions\x127\n" + + "\bfeatures\x18\x01 \x01(\v2\x1b.google.protobuf.FeatureSetR\bfeatures\x12X\n" + + "\x14uninterpreted_option\x18\xe7\a \x03(\v2$.google.protobuf.UninterpretedOptionR\x13uninterpretedOption*\t\b\xe8\a\x10\x80\x80\x80\x80\x02\"\xd1\x02\n" + + "\vEnumOptions\x12\x1f\n" + + "\vallow_alias\x18\x02 \x01(\bR\n" + + "allowAlias\x12%\n" + + "\n" + + "deprecated\x18\x03 \x01(\b:\x05falseR\n" + + "deprecated\x12V\n" + + "&deprecated_legacy_json_field_conflicts\x18\x06 \x01(\bB\x02\x18\x01R\"deprecatedLegacyJsonFieldConflicts\x127\n" + + "\bfeatures\x18\a \x01(\v2\x1b.google.protobuf.FeatureSetR\bfeatures\x12X\n" + + "\x14uninterpreted_option\x18\xe7\a \x03(\v2$.google.protobuf.UninterpretedOptionR\x13uninterpretedOption*\t\b\xe8\a\x10\x80\x80\x80\x80\x02J\x04\b\x05\x10\x06\"\xd8\x02\n" + + "\x10EnumValueOptions\x12%\n" + + "\n" + + "deprecated\x18\x01 \x01(\b:\x05falseR\n" + + "deprecated\x127\n" + + "\bfeatures\x18\x02 \x01(\v2\x1b.google.protobuf.FeatureSetR\bfeatures\x12(\n" + + "\fdebug_redact\x18\x03 \x01(\b:\x05falseR\vdebugRedact\x12U\n" + + "\x0ffeature_support\x18\x04 \x01(\v2,.google.protobuf.FieldOptions.FeatureSupportR\x0efeatureSupport\x12X\n" + + "\x14uninterpreted_option\x18\xe7\a \x03(\v2$.google.protobuf.UninterpretedOptionR\x13uninterpretedOption*\t\b\xe8\a\x10\x80\x80\x80\x80\x02\"\xd5\x01\n" + + "\x0eServiceOptions\x127\n" + + "\bfeatures\x18\" \x01(\v2\x1b.google.protobuf.FeatureSetR\bfeatures\x12%\n" + + "\n" + + "deprecated\x18! \x01(\b:\x05falseR\n" + + "deprecated\x12X\n" + + "\x14uninterpreted_option\x18\xe7\a \x03(\v2$.google.protobuf.UninterpretedOptionR\x13uninterpretedOption*\t\b\xe8\a\x10\x80\x80\x80\x80\x02\"\x99\x03\n" + + "\rMethodOptions\x12%\n" + + "\n" + + "deprecated\x18! \x01(\b:\x05falseR\n" + + "deprecated\x12q\n" + + "\x11idempotency_level\x18\" \x01(\x0e2/.google.protobuf.MethodOptions.IdempotencyLevel:\x13IDEMPOTENCY_UNKNOWNR\x10idempotencyLevel\x127\n" + + "\bfeatures\x18# \x01(\v2\x1b.google.protobuf.FeatureSetR\bfeatures\x12X\n" + + "\x14uninterpreted_option\x18\xe7\a \x03(\v2$.google.protobuf.UninterpretedOptionR\x13uninterpretedOption\"P\n" + + "\x10IdempotencyLevel\x12\x17\n" + + "\x13IDEMPOTENCY_UNKNOWN\x10\x00\x12\x13\n" + + "\x0fNO_SIDE_EFFECTS\x10\x01\x12\x0e\n" + + "\n" + + "IDEMPOTENT\x10\x02*\t\b\xe8\a\x10\x80\x80\x80\x80\x02\"\x9a\x03\n" + + "\x13UninterpretedOption\x12A\n" + + "\x04name\x18\x02 \x03(\v2-.google.protobuf.UninterpretedOption.NamePartR\x04name\x12)\n" + + "\x10identifier_value\x18\x03 \x01(\tR\x0fidentifierValue\x12,\n" + + "\x12positive_int_value\x18\x04 \x01(\x04R\x10positiveIntValue\x12,\n" + + "\x12negative_int_value\x18\x05 \x01(\x03R\x10negativeIntValue\x12!\n" + + "\fdouble_value\x18\x06 \x01(\x01R\vdoubleValue\x12!\n" + + "\fstring_value\x18\a \x01(\fR\vstringValue\x12'\n" + + "\x0faggregate_value\x18\b \x01(\tR\x0eaggregateValue\x1aJ\n" + + "\bNamePart\x12\x1b\n" + + "\tname_part\x18\x01 \x02(\tR\bnamePart\x12!\n" + + "\fis_extension\x18\x02 \x02(\bR\visExtension\"\x8e\x0f\n" + + "\n" + + "FeatureSet\x12\x91\x01\n" + + "\x0efield_presence\x18\x01 \x01(\x0e2).google.protobuf.FeatureSet.FieldPresenceB?\x88\x01\x01\x98\x01\x04\x98\x01\x01\xa2\x01\r\x12\bEXPLICIT\x18\x84\a\xa2\x01\r\x12\bIMPLICIT\x18\xe7\a\xa2\x01\r\x12\bEXPLICIT\x18\xe8\a\xb2\x01\x03\b\xe8\aR\rfieldPresence\x12l\n" + + "\tenum_type\x18\x02 \x01(\x0e2$.google.protobuf.FeatureSet.EnumTypeB)\x88\x01\x01\x98\x01\x06\x98\x01\x01\xa2\x01\v\x12\x06CLOSED\x18\x84\a\xa2\x01\t\x12\x04OPEN\x18\xe7\a\xb2\x01\x03\b\xe8\aR\benumType\x12\x98\x01\n" + + "\x17repeated_field_encoding\x18\x03 \x01(\x0e21.google.protobuf.FeatureSet.RepeatedFieldEncodingB-\x88\x01\x01\x98\x01\x04\x98\x01\x01\xa2\x01\r\x12\bEXPANDED\x18\x84\a\xa2\x01\v\x12\x06PACKED\x18\xe7\a\xb2\x01\x03\b\xe8\aR\x15repeatedFieldEncoding\x12~\n" + + "\x0futf8_validation\x18\x04 \x01(\x0e2*.google.protobuf.FeatureSet.Utf8ValidationB)\x88\x01\x01\x98\x01\x04\x98\x01\x01\xa2\x01\t\x12\x04NONE\x18\x84\a\xa2\x01\v\x12\x06VERIFY\x18\xe7\a\xb2\x01\x03\b\xe8\aR\x0eutf8Validation\x12~\n" + + "\x10message_encoding\x18\x05 \x01(\x0e2+.google.protobuf.FeatureSet.MessageEncodingB&\x88\x01\x01\x98\x01\x04\x98\x01\x01\xa2\x01\x14\x12\x0fLENGTH_PREFIXED\x18\x84\a\xb2\x01\x03\b\xe8\aR\x0fmessageEncoding\x12\x82\x01\n" + + "\vjson_format\x18\x06 \x01(\x0e2&.google.protobuf.FeatureSet.JsonFormatB9\x88\x01\x01\x98\x01\x03\x98\x01\x06\x98\x01\x01\xa2\x01\x17\x12\x12LEGACY_BEST_EFFORT\x18\x84\a\xa2\x01\n" + + "\x12\x05ALLOW\x18\xe7\a\xb2\x01\x03\b\xe8\aR\n" + + "jsonFormat\x12\xab\x01\n" + + "\x14enforce_naming_style\x18\a \x01(\x0e2..google.protobuf.FeatureSet.EnforceNamingStyleBI\x88\x01\x02\x98\x01\x01\x98\x01\x02\x98\x01\x03\x98\x01\x04\x98\x01\x05\x98\x01\x06\x98\x01\a\x98\x01\b\x98\x01\t\xa2\x01\x11\x12\fSTYLE_LEGACY\x18\x84\a\xa2\x01\x0e\x12\tSTYLE2024\x18\xe9\a\xb2\x01\x03\b\xe9\aR\x12enforceNamingStyle\x12\xb9\x01\n" + + "\x19default_symbol_visibility\x18\b \x01(\x0e2E.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibilityB6\x88\x01\x02\x98\x01\x01\xa2\x01\x0f\x12\n" + + "EXPORT_ALL\x18\x84\a\xa2\x01\x15\x12\x10EXPORT_TOP_LEVEL\x18\xe9\a\xb2\x01\x03\b\xe9\aR\x17defaultSymbolVisibility\x1a\xa1\x01\n" + + "\x11VisibilityFeature\"\x81\x01\n" + + "\x17DefaultSymbolVisibility\x12%\n" + + "!DEFAULT_SYMBOL_VISIBILITY_UNKNOWN\x10\x00\x12\x0e\n" + + "\n" + + "EXPORT_ALL\x10\x01\x12\x14\n" + + "\x10EXPORT_TOP_LEVEL\x10\x02\x12\r\n" + + "\tLOCAL_ALL\x10\x03\x12\n" + + "\n" + + "\x06STRICT\x10\x04J\b\b\x01\x10\x80\x80\x80\x80\x02\"\\\n" + + "\rFieldPresence\x12\x1a\n" + + "\x16FIELD_PRESENCE_UNKNOWN\x10\x00\x12\f\n" + + "\bEXPLICIT\x10\x01\x12\f\n" + + "\bIMPLICIT\x10\x02\x12\x13\n" + + "\x0fLEGACY_REQUIRED\x10\x03\"7\n" + + "\bEnumType\x12\x15\n" + + "\x11ENUM_TYPE_UNKNOWN\x10\x00\x12\b\n" + + "\x04OPEN\x10\x01\x12\n" + + "\n" + + "\x06CLOSED\x10\x02\"V\n" + + "\x15RepeatedFieldEncoding\x12#\n" + + "\x1fREPEATED_FIELD_ENCODING_UNKNOWN\x10\x00\x12\n" + + "\n" + + "\x06PACKED\x10\x01\x12\f\n" + + "\bEXPANDED\x10\x02\"I\n" + + "\x0eUtf8Validation\x12\x1b\n" + + "\x17UTF8_VALIDATION_UNKNOWN\x10\x00\x12\n" + + "\n" + + "\x06VERIFY\x10\x02\x12\b\n" + + "\x04NONE\x10\x03\"\x04\b\x01\x10\x01\"S\n" + + "\x0fMessageEncoding\x12\x1c\n" + + "\x18MESSAGE_ENCODING_UNKNOWN\x10\x00\x12\x13\n" + + "\x0fLENGTH_PREFIXED\x10\x01\x12\r\n" + + "\tDELIMITED\x10\x02\"H\n" + + "\n" + + "JsonFormat\x12\x17\n" + + "\x13JSON_FORMAT_UNKNOWN\x10\x00\x12\t\n" + + "\x05ALLOW\x10\x01\x12\x16\n" + + "\x12LEGACY_BEST_EFFORT\x10\x02\"W\n" + + "\x12EnforceNamingStyle\x12 \n" + + "\x1cENFORCE_NAMING_STYLE_UNKNOWN\x10\x00\x12\r\n" + + "\tSTYLE2024\x10\x01\x12\x10\n" + + "\fSTYLE_LEGACY\x10\x02*\x06\b\xe8\a\x10\x8bN*\x06\b\x8bN\x10\x90N*\x06\b\x90N\x10\x91NJ\x06\b\xe7\a\x10\xe8\a\"\xef\x03\n" + + "\x12FeatureSetDefaults\x12X\n" + + "\bdefaults\x18\x01 \x03(\v2<.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefaultR\bdefaults\x12A\n" + + "\x0fminimum_edition\x18\x04 \x01(\x0e2\x18.google.protobuf.EditionR\x0eminimumEdition\x12A\n" + + "\x0fmaximum_edition\x18\x05 \x01(\x0e2\x18.google.protobuf.EditionR\x0emaximumEdition\x1a\xf8\x01\n" + + "\x18FeatureSetEditionDefault\x122\n" + + "\aedition\x18\x03 \x01(\x0e2\x18.google.protobuf.EditionR\aedition\x12N\n" + + "\x14overridable_features\x18\x04 \x01(\v2\x1b.google.protobuf.FeatureSetR\x13overridableFeatures\x12B\n" + + "\x0efixed_features\x18\x05 \x01(\v2\x1b.google.protobuf.FeatureSetR\rfixedFeaturesJ\x04\b\x01\x10\x02J\x04\b\x02\x10\x03R\bfeatures\"\xb5\x02\n" + + "\x0eSourceCodeInfo\x12D\n" + + "\blocation\x18\x01 \x03(\v2(.google.protobuf.SourceCodeInfo.LocationR\blocation\x1a\xce\x01\n" + + "\bLocation\x12\x16\n" + + "\x04path\x18\x01 \x03(\x05B\x02\x10\x01R\x04path\x12\x16\n" + + "\x04span\x18\x02 \x03(\x05B\x02\x10\x01R\x04span\x12)\n" + + "\x10leading_comments\x18\x03 \x01(\tR\x0fleadingComments\x12+\n" + + "\x11trailing_comments\x18\x04 \x01(\tR\x10trailingComments\x12:\n" + + "\x19leading_detached_comments\x18\x06 \x03(\tR\x17leadingDetachedComments*\f\b\x80\xec\xca\xff\x01\x10\x81\xec\xca\xff\x01\"\xd0\x02\n" + + "\x11GeneratedCodeInfo\x12M\n" + + "\n" + + "annotation\x18\x01 \x03(\v2-.google.protobuf.GeneratedCodeInfo.AnnotationR\n" + + "annotation\x1a\xeb\x01\n" + + "\n" + + "Annotation\x12\x16\n" + + "\x04path\x18\x01 \x03(\x05B\x02\x10\x01R\x04path\x12\x1f\n" + + "\vsource_file\x18\x02 \x01(\tR\n" + + "sourceFile\x12\x14\n" + + "\x05begin\x18\x03 \x01(\x05R\x05begin\x12\x10\n" + + "\x03end\x18\x04 \x01(\x05R\x03end\x12R\n" + + "\bsemantic\x18\x05 \x01(\x0e26.google.protobuf.GeneratedCodeInfo.Annotation.SemanticR\bsemantic\"(\n" + + "\bSemantic\x12\b\n" + + "\x04NONE\x10\x00\x12\a\n" + + "\x03SET\x10\x01\x12\t\n" + + "\x05ALIAS\x10\x02*\xa7\x02\n" + + "\aEdition\x12\x13\n" + + "\x0fEDITION_UNKNOWN\x10\x00\x12\x13\n" + + "\x0eEDITION_LEGACY\x10\x84\a\x12\x13\n" + + "\x0eEDITION_PROTO2\x10\xe6\a\x12\x13\n" + + "\x0eEDITION_PROTO3\x10\xe7\a\x12\x11\n" + + "\fEDITION_2023\x10\xe8\a\x12\x11\n" + + "\fEDITION_2024\x10\xe9\a\x12\x17\n" + + "\x13EDITION_1_TEST_ONLY\x10\x01\x12\x17\n" + + "\x13EDITION_2_TEST_ONLY\x10\x02\x12\x1d\n" + + "\x17EDITION_99997_TEST_ONLY\x10\x9d\x8d\x06\x12\x1d\n" + + "\x17EDITION_99998_TEST_ONLY\x10\x9e\x8d\x06\x12\x1d\n" + + "\x17EDITION_99999_TEST_ONLY\x10\x9f\x8d\x06\x12\x13\n" + + "\vEDITION_MAX\x10\xff\xff\xff\xff\a*U\n" + + "\x10SymbolVisibility\x12\x14\n" + + "\x10VISIBILITY_UNSET\x10\x00\x12\x14\n" + + "\x10VISIBILITY_LOCAL\x10\x01\x12\x15\n" + + "\x11VISIBILITY_EXPORT\x10\x02B~\n" + + "\x13com.google.protobufB\x10DescriptorProtosH\x01Z-google.golang.org/protobuf/types/descriptorpb\xf8\x01\x01\xa2\x02\x03GPB\xaa\x02\x1aGoogle.Protobuf.Reflection" var ( file_google_protobuf_descriptor_proto_rawDescOnce sync.Once - file_google_protobuf_descriptor_proto_rawDescData = file_google_protobuf_descriptor_proto_rawDesc + file_google_protobuf_descriptor_proto_rawDescData []byte ) func file_google_protobuf_descriptor_proto_rawDescGZIP() []byte { file_google_protobuf_descriptor_proto_rawDescOnce.Do(func() { - file_google_protobuf_descriptor_proto_rawDescData = protoimpl.X.CompressGZIP(file_google_protobuf_descriptor_proto_rawDescData) + file_google_protobuf_descriptor_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_google_protobuf_descriptor_proto_rawDesc), len(file_google_protobuf_descriptor_proto_rawDesc))) }) return file_google_protobuf_descriptor_proto_rawDescData } -var file_google_protobuf_descriptor_proto_enumTypes = make([]protoimpl.EnumInfo, 17) -var file_google_protobuf_descriptor_proto_msgTypes = make([]protoimpl.MessageInfo, 33) +var file_google_protobuf_descriptor_proto_enumTypes = make([]protoimpl.EnumInfo, 20) +var file_google_protobuf_descriptor_proto_msgTypes = make([]protoimpl.MessageInfo, 34) 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 - (FieldDescriptorProto_Label)(0), // 3: google.protobuf.FieldDescriptorProto.Label - (FileOptions_OptimizeMode)(0), // 4: google.protobuf.FileOptions.OptimizeMode - (FieldOptions_CType)(0), // 5: google.protobuf.FieldOptions.CType - (FieldOptions_JSType)(0), // 6: google.protobuf.FieldOptions.JSType - (FieldOptions_OptionRetention)(0), // 7: google.protobuf.FieldOptions.OptionRetention - (FieldOptions_OptionTargetType)(0), // 8: google.protobuf.FieldOptions.OptionTargetType - (MethodOptions_IdempotencyLevel)(0), // 9: google.protobuf.MethodOptions.IdempotencyLevel - (FeatureSet_FieldPresence)(0), // 10: google.protobuf.FeatureSet.FieldPresence - (FeatureSet_EnumType)(0), // 11: google.protobuf.FeatureSet.EnumType - (FeatureSet_RepeatedFieldEncoding)(0), // 12: google.protobuf.FeatureSet.RepeatedFieldEncoding - (FeatureSet_Utf8Validation)(0), // 13: google.protobuf.FeatureSet.Utf8Validation - (FeatureSet_MessageEncoding)(0), // 14: google.protobuf.FeatureSet.MessageEncoding - (FeatureSet_JsonFormat)(0), // 15: google.protobuf.FeatureSet.JsonFormat - (GeneratedCodeInfo_Annotation_Semantic)(0), // 16: google.protobuf.GeneratedCodeInfo.Annotation.Semantic - (*FileDescriptorSet)(nil), // 17: google.protobuf.FileDescriptorSet - (*FileDescriptorProto)(nil), // 18: google.protobuf.FileDescriptorProto - (*DescriptorProto)(nil), // 19: google.protobuf.DescriptorProto - (*ExtensionRangeOptions)(nil), // 20: google.protobuf.ExtensionRangeOptions - (*FieldDescriptorProto)(nil), // 21: google.protobuf.FieldDescriptorProto - (*OneofDescriptorProto)(nil), // 22: google.protobuf.OneofDescriptorProto - (*EnumDescriptorProto)(nil), // 23: google.protobuf.EnumDescriptorProto - (*EnumValueDescriptorProto)(nil), // 24: google.protobuf.EnumValueDescriptorProto - (*ServiceDescriptorProto)(nil), // 25: google.protobuf.ServiceDescriptorProto - (*MethodDescriptorProto)(nil), // 26: google.protobuf.MethodDescriptorProto - (*FileOptions)(nil), // 27: google.protobuf.FileOptions - (*MessageOptions)(nil), // 28: google.protobuf.MessageOptions - (*FieldOptions)(nil), // 29: google.protobuf.FieldOptions - (*OneofOptions)(nil), // 30: google.protobuf.OneofOptions - (*EnumOptions)(nil), // 31: google.protobuf.EnumOptions - (*EnumValueOptions)(nil), // 32: google.protobuf.EnumValueOptions - (*ServiceOptions)(nil), // 33: google.protobuf.ServiceOptions - (*MethodOptions)(nil), // 34: google.protobuf.MethodOptions - (*UninterpretedOption)(nil), // 35: google.protobuf.UninterpretedOption - (*FeatureSet)(nil), // 36: google.protobuf.FeatureSet - (*FeatureSetDefaults)(nil), // 37: google.protobuf.FeatureSetDefaults - (*SourceCodeInfo)(nil), // 38: google.protobuf.SourceCodeInfo - (*GeneratedCodeInfo)(nil), // 39: google.protobuf.GeneratedCodeInfo - (*DescriptorProto_ExtensionRange)(nil), // 40: google.protobuf.DescriptorProto.ExtensionRange - (*DescriptorProto_ReservedRange)(nil), // 41: google.protobuf.DescriptorProto.ReservedRange - (*ExtensionRangeOptions_Declaration)(nil), // 42: google.protobuf.ExtensionRangeOptions.Declaration - (*EnumDescriptorProto_EnumReservedRange)(nil), // 43: google.protobuf.EnumDescriptorProto.EnumReservedRange - (*FieldOptions_EditionDefault)(nil), // 44: google.protobuf.FieldOptions.EditionDefault - (*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 + (Edition)(0), // 0: google.protobuf.Edition + (SymbolVisibility)(0), // 1: google.protobuf.SymbolVisibility + (ExtensionRangeOptions_VerificationState)(0), // 2: google.protobuf.ExtensionRangeOptions.VerificationState + (FieldDescriptorProto_Type)(0), // 3: google.protobuf.FieldDescriptorProto.Type + (FieldDescriptorProto_Label)(0), // 4: google.protobuf.FieldDescriptorProto.Label + (FileOptions_OptimizeMode)(0), // 5: google.protobuf.FileOptions.OptimizeMode + (FieldOptions_CType)(0), // 6: google.protobuf.FieldOptions.CType + (FieldOptions_JSType)(0), // 7: google.protobuf.FieldOptions.JSType + (FieldOptions_OptionRetention)(0), // 8: google.protobuf.FieldOptions.OptionRetention + (FieldOptions_OptionTargetType)(0), // 9: google.protobuf.FieldOptions.OptionTargetType + (MethodOptions_IdempotencyLevel)(0), // 10: google.protobuf.MethodOptions.IdempotencyLevel + (FeatureSet_FieldPresence)(0), // 11: google.protobuf.FeatureSet.FieldPresence + (FeatureSet_EnumType)(0), // 12: google.protobuf.FeatureSet.EnumType + (FeatureSet_RepeatedFieldEncoding)(0), // 13: google.protobuf.FeatureSet.RepeatedFieldEncoding + (FeatureSet_Utf8Validation)(0), // 14: google.protobuf.FeatureSet.Utf8Validation + (FeatureSet_MessageEncoding)(0), // 15: google.protobuf.FeatureSet.MessageEncoding + (FeatureSet_JsonFormat)(0), // 16: google.protobuf.FeatureSet.JsonFormat + (FeatureSet_EnforceNamingStyle)(0), // 17: google.protobuf.FeatureSet.EnforceNamingStyle + (FeatureSet_VisibilityFeature_DefaultSymbolVisibility)(0), // 18: google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility + (GeneratedCodeInfo_Annotation_Semantic)(0), // 19: google.protobuf.GeneratedCodeInfo.Annotation.Semantic + (*FileDescriptorSet)(nil), // 20: google.protobuf.FileDescriptorSet + (*FileDescriptorProto)(nil), // 21: google.protobuf.FileDescriptorProto + (*DescriptorProto)(nil), // 22: google.protobuf.DescriptorProto + (*ExtensionRangeOptions)(nil), // 23: google.protobuf.ExtensionRangeOptions + (*FieldDescriptorProto)(nil), // 24: google.protobuf.FieldDescriptorProto + (*OneofDescriptorProto)(nil), // 25: google.protobuf.OneofDescriptorProto + (*EnumDescriptorProto)(nil), // 26: google.protobuf.EnumDescriptorProto + (*EnumValueDescriptorProto)(nil), // 27: google.protobuf.EnumValueDescriptorProto + (*ServiceDescriptorProto)(nil), // 28: google.protobuf.ServiceDescriptorProto + (*MethodDescriptorProto)(nil), // 29: google.protobuf.MethodDescriptorProto + (*FileOptions)(nil), // 30: google.protobuf.FileOptions + (*MessageOptions)(nil), // 31: google.protobuf.MessageOptions + (*FieldOptions)(nil), // 32: google.protobuf.FieldOptions + (*OneofOptions)(nil), // 33: google.protobuf.OneofOptions + (*EnumOptions)(nil), // 34: google.protobuf.EnumOptions + (*EnumValueOptions)(nil), // 35: google.protobuf.EnumValueOptions + (*ServiceOptions)(nil), // 36: google.protobuf.ServiceOptions + (*MethodOptions)(nil), // 37: google.protobuf.MethodOptions + (*UninterpretedOption)(nil), // 38: google.protobuf.UninterpretedOption + (*FeatureSet)(nil), // 39: google.protobuf.FeatureSet + (*FeatureSetDefaults)(nil), // 40: google.protobuf.FeatureSetDefaults + (*SourceCodeInfo)(nil), // 41: google.protobuf.SourceCodeInfo + (*GeneratedCodeInfo)(nil), // 42: google.protobuf.GeneratedCodeInfo + (*DescriptorProto_ExtensionRange)(nil), // 43: google.protobuf.DescriptorProto.ExtensionRange + (*DescriptorProto_ReservedRange)(nil), // 44: google.protobuf.DescriptorProto.ReservedRange + (*ExtensionRangeOptions_Declaration)(nil), // 45: google.protobuf.ExtensionRangeOptions.Declaration + (*EnumDescriptorProto_EnumReservedRange)(nil), // 46: google.protobuf.EnumDescriptorProto.EnumReservedRange + (*FieldOptions_EditionDefault)(nil), // 47: google.protobuf.FieldOptions.EditionDefault + (*FieldOptions_FeatureSupport)(nil), // 48: google.protobuf.FieldOptions.FeatureSupport + (*UninterpretedOption_NamePart)(nil), // 49: google.protobuf.UninterpretedOption.NamePart + (*FeatureSet_VisibilityFeature)(nil), // 50: google.protobuf.FeatureSet.VisibilityFeature + (*FeatureSetDefaults_FeatureSetEditionDefault)(nil), // 51: google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + (*SourceCodeInfo_Location)(nil), // 52: google.protobuf.SourceCodeInfo.Location + (*GeneratedCodeInfo_Annotation)(nil), // 53: google.protobuf.GeneratedCodeInfo.Annotation } var file_google_protobuf_descriptor_proto_depIdxs = []int32{ - 18, // 0: google.protobuf.FileDescriptorSet.file:type_name -> google.protobuf.FileDescriptorProto - 19, // 1: google.protobuf.FileDescriptorProto.message_type:type_name -> google.protobuf.DescriptorProto - 23, // 2: google.protobuf.FileDescriptorProto.enum_type:type_name -> google.protobuf.EnumDescriptorProto - 25, // 3: google.protobuf.FileDescriptorProto.service:type_name -> google.protobuf.ServiceDescriptorProto - 21, // 4: google.protobuf.FileDescriptorProto.extension:type_name -> google.protobuf.FieldDescriptorProto - 27, // 5: google.protobuf.FileDescriptorProto.options:type_name -> google.protobuf.FileOptions - 38, // 6: google.protobuf.FileDescriptorProto.source_code_info:type_name -> google.protobuf.SourceCodeInfo + 21, // 0: google.protobuf.FileDescriptorSet.file:type_name -> google.protobuf.FileDescriptorProto + 22, // 1: google.protobuf.FileDescriptorProto.message_type:type_name -> google.protobuf.DescriptorProto + 26, // 2: google.protobuf.FileDescriptorProto.enum_type:type_name -> google.protobuf.EnumDescriptorProto + 28, // 3: google.protobuf.FileDescriptorProto.service:type_name -> google.protobuf.ServiceDescriptorProto + 24, // 4: google.protobuf.FileDescriptorProto.extension:type_name -> google.protobuf.FieldDescriptorProto + 30, // 5: google.protobuf.FileDescriptorProto.options:type_name -> google.protobuf.FileOptions + 41, // 6: google.protobuf.FileDescriptorProto.source_code_info:type_name -> google.protobuf.SourceCodeInfo 0, // 7: google.protobuf.FileDescriptorProto.edition:type_name -> google.protobuf.Edition - 21, // 8: google.protobuf.DescriptorProto.field:type_name -> google.protobuf.FieldDescriptorProto - 21, // 9: google.protobuf.DescriptorProto.extension:type_name -> google.protobuf.FieldDescriptorProto - 19, // 10: google.protobuf.DescriptorProto.nested_type:type_name -> google.protobuf.DescriptorProto - 23, // 11: google.protobuf.DescriptorProto.enum_type:type_name -> google.protobuf.EnumDescriptorProto - 40, // 12: google.protobuf.DescriptorProto.extension_range:type_name -> google.protobuf.DescriptorProto.ExtensionRange - 22, // 13: google.protobuf.DescriptorProto.oneof_decl:type_name -> google.protobuf.OneofDescriptorProto - 28, // 14: google.protobuf.DescriptorProto.options:type_name -> google.protobuf.MessageOptions - 41, // 15: google.protobuf.DescriptorProto.reserved_range:type_name -> google.protobuf.DescriptorProto.ReservedRange - 35, // 16: google.protobuf.ExtensionRangeOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 42, // 17: google.protobuf.ExtensionRangeOptions.declaration:type_name -> google.protobuf.ExtensionRangeOptions.Declaration - 36, // 18: google.protobuf.ExtensionRangeOptions.features:type_name -> google.protobuf.FeatureSet - 1, // 19: google.protobuf.ExtensionRangeOptions.verification:type_name -> google.protobuf.ExtensionRangeOptions.VerificationState - 3, // 20: google.protobuf.FieldDescriptorProto.label:type_name -> google.protobuf.FieldDescriptorProto.Label - 2, // 21: google.protobuf.FieldDescriptorProto.type:type_name -> google.protobuf.FieldDescriptorProto.Type - 29, // 22: google.protobuf.FieldDescriptorProto.options:type_name -> google.protobuf.FieldOptions - 30, // 23: google.protobuf.OneofDescriptorProto.options:type_name -> google.protobuf.OneofOptions - 24, // 24: google.protobuf.EnumDescriptorProto.value:type_name -> google.protobuf.EnumValueDescriptorProto - 31, // 25: google.protobuf.EnumDescriptorProto.options:type_name -> google.protobuf.EnumOptions - 43, // 26: google.protobuf.EnumDescriptorProto.reserved_range:type_name -> google.protobuf.EnumDescriptorProto.EnumReservedRange - 32, // 27: google.protobuf.EnumValueDescriptorProto.options:type_name -> google.protobuf.EnumValueOptions - 26, // 28: google.protobuf.ServiceDescriptorProto.method:type_name -> google.protobuf.MethodDescriptorProto - 33, // 29: google.protobuf.ServiceDescriptorProto.options:type_name -> google.protobuf.ServiceOptions - 34, // 30: google.protobuf.MethodDescriptorProto.options:type_name -> google.protobuf.MethodOptions - 4, // 31: google.protobuf.FileOptions.optimize_for:type_name -> google.protobuf.FileOptions.OptimizeMode - 36, // 32: google.protobuf.FileOptions.features:type_name -> google.protobuf.FeatureSet - 35, // 33: google.protobuf.FileOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 36, // 34: google.protobuf.MessageOptions.features:type_name -> google.protobuf.FeatureSet - 35, // 35: google.protobuf.MessageOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 5, // 36: google.protobuf.FieldOptions.ctype:type_name -> google.protobuf.FieldOptions.CType - 6, // 37: google.protobuf.FieldOptions.jstype:type_name -> google.protobuf.FieldOptions.JSType - 7, // 38: google.protobuf.FieldOptions.retention:type_name -> google.protobuf.FieldOptions.OptionRetention - 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 - 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 + 24, // 8: google.protobuf.DescriptorProto.field:type_name -> google.protobuf.FieldDescriptorProto + 24, // 9: google.protobuf.DescriptorProto.extension:type_name -> google.protobuf.FieldDescriptorProto + 22, // 10: google.protobuf.DescriptorProto.nested_type:type_name -> google.protobuf.DescriptorProto + 26, // 11: google.protobuf.DescriptorProto.enum_type:type_name -> google.protobuf.EnumDescriptorProto + 43, // 12: google.protobuf.DescriptorProto.extension_range:type_name -> google.protobuf.DescriptorProto.ExtensionRange + 25, // 13: google.protobuf.DescriptorProto.oneof_decl:type_name -> google.protobuf.OneofDescriptorProto + 31, // 14: google.protobuf.DescriptorProto.options:type_name -> google.protobuf.MessageOptions + 44, // 15: google.protobuf.DescriptorProto.reserved_range:type_name -> google.protobuf.DescriptorProto.ReservedRange + 1, // 16: google.protobuf.DescriptorProto.visibility:type_name -> google.protobuf.SymbolVisibility + 38, // 17: google.protobuf.ExtensionRangeOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 45, // 18: google.protobuf.ExtensionRangeOptions.declaration:type_name -> google.protobuf.ExtensionRangeOptions.Declaration + 39, // 19: google.protobuf.ExtensionRangeOptions.features:type_name -> google.protobuf.FeatureSet + 2, // 20: google.protobuf.ExtensionRangeOptions.verification:type_name -> google.protobuf.ExtensionRangeOptions.VerificationState + 4, // 21: google.protobuf.FieldDescriptorProto.label:type_name -> google.protobuf.FieldDescriptorProto.Label + 3, // 22: google.protobuf.FieldDescriptorProto.type:type_name -> google.protobuf.FieldDescriptorProto.Type + 32, // 23: google.protobuf.FieldDescriptorProto.options:type_name -> google.protobuf.FieldOptions + 33, // 24: google.protobuf.OneofDescriptorProto.options:type_name -> google.protobuf.OneofOptions + 27, // 25: google.protobuf.EnumDescriptorProto.value:type_name -> google.protobuf.EnumValueDescriptorProto + 34, // 26: google.protobuf.EnumDescriptorProto.options:type_name -> google.protobuf.EnumOptions + 46, // 27: google.protobuf.EnumDescriptorProto.reserved_range:type_name -> google.protobuf.EnumDescriptorProto.EnumReservedRange + 1, // 28: google.protobuf.EnumDescriptorProto.visibility:type_name -> google.protobuf.SymbolVisibility + 35, // 29: google.protobuf.EnumValueDescriptorProto.options:type_name -> google.protobuf.EnumValueOptions + 29, // 30: google.protobuf.ServiceDescriptorProto.method:type_name -> google.protobuf.MethodDescriptorProto + 36, // 31: google.protobuf.ServiceDescriptorProto.options:type_name -> google.protobuf.ServiceOptions + 37, // 32: google.protobuf.MethodDescriptorProto.options:type_name -> google.protobuf.MethodOptions + 5, // 33: google.protobuf.FileOptions.optimize_for:type_name -> google.protobuf.FileOptions.OptimizeMode + 39, // 34: google.protobuf.FileOptions.features:type_name -> google.protobuf.FeatureSet + 38, // 35: google.protobuf.FileOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 39, // 36: google.protobuf.MessageOptions.features:type_name -> google.protobuf.FeatureSet + 38, // 37: google.protobuf.MessageOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 6, // 38: google.protobuf.FieldOptions.ctype:type_name -> google.protobuf.FieldOptions.CType + 7, // 39: google.protobuf.FieldOptions.jstype:type_name -> google.protobuf.FieldOptions.JSType + 8, // 40: google.protobuf.FieldOptions.retention:type_name -> google.protobuf.FieldOptions.OptionRetention + 9, // 41: google.protobuf.FieldOptions.targets:type_name -> google.protobuf.FieldOptions.OptionTargetType + 47, // 42: google.protobuf.FieldOptions.edition_defaults:type_name -> google.protobuf.FieldOptions.EditionDefault + 39, // 43: google.protobuf.FieldOptions.features:type_name -> google.protobuf.FeatureSet + 48, // 44: google.protobuf.FieldOptions.feature_support:type_name -> google.protobuf.FieldOptions.FeatureSupport + 38, // 45: google.protobuf.FieldOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 39, // 46: google.protobuf.OneofOptions.features:type_name -> google.protobuf.FeatureSet + 38, // 47: google.protobuf.OneofOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 39, // 48: google.protobuf.EnumOptions.features:type_name -> google.protobuf.FeatureSet + 38, // 49: google.protobuf.EnumOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 39, // 50: google.protobuf.EnumValueOptions.features:type_name -> google.protobuf.FeatureSet + 48, // 51: google.protobuf.EnumValueOptions.feature_support:type_name -> google.protobuf.FieldOptions.FeatureSupport + 38, // 52: google.protobuf.EnumValueOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 39, // 53: google.protobuf.ServiceOptions.features:type_name -> google.protobuf.FeatureSet + 38, // 54: google.protobuf.ServiceOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 10, // 55: google.protobuf.MethodOptions.idempotency_level:type_name -> google.protobuf.MethodOptions.IdempotencyLevel + 39, // 56: google.protobuf.MethodOptions.features:type_name -> google.protobuf.FeatureSet + 38, // 57: google.protobuf.MethodOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 49, // 58: google.protobuf.UninterpretedOption.name:type_name -> google.protobuf.UninterpretedOption.NamePart + 11, // 59: google.protobuf.FeatureSet.field_presence:type_name -> google.protobuf.FeatureSet.FieldPresence + 12, // 60: google.protobuf.FeatureSet.enum_type:type_name -> google.protobuf.FeatureSet.EnumType + 13, // 61: google.protobuf.FeatureSet.repeated_field_encoding:type_name -> google.protobuf.FeatureSet.RepeatedFieldEncoding + 14, // 62: google.protobuf.FeatureSet.utf8_validation:type_name -> google.protobuf.FeatureSet.Utf8Validation + 15, // 63: google.protobuf.FeatureSet.message_encoding:type_name -> google.protobuf.FeatureSet.MessageEncoding + 16, // 64: google.protobuf.FeatureSet.json_format:type_name -> google.protobuf.FeatureSet.JsonFormat + 17, // 65: google.protobuf.FeatureSet.enforce_naming_style:type_name -> google.protobuf.FeatureSet.EnforceNamingStyle + 18, // 66: google.protobuf.FeatureSet.default_symbol_visibility:type_name -> google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility + 51, // 67: google.protobuf.FeatureSetDefaults.defaults:type_name -> google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + 0, // 68: google.protobuf.FeatureSetDefaults.minimum_edition:type_name -> google.protobuf.Edition + 0, // 69: google.protobuf.FeatureSetDefaults.maximum_edition:type_name -> google.protobuf.Edition + 52, // 70: google.protobuf.SourceCodeInfo.location:type_name -> google.protobuf.SourceCodeInfo.Location + 53, // 71: google.protobuf.GeneratedCodeInfo.annotation:type_name -> google.protobuf.GeneratedCodeInfo.Annotation + 23, // 72: google.protobuf.DescriptorProto.ExtensionRange.options:type_name -> google.protobuf.ExtensionRangeOptions + 0, // 73: google.protobuf.FieldOptions.EditionDefault.edition:type_name -> google.protobuf.Edition + 0, // 74: google.protobuf.FieldOptions.FeatureSupport.edition_introduced:type_name -> google.protobuf.Edition + 0, // 75: google.protobuf.FieldOptions.FeatureSupport.edition_deprecated:type_name -> google.protobuf.Edition + 0, // 76: google.protobuf.FieldOptions.FeatureSupport.edition_removed:type_name -> google.protobuf.Edition + 0, // 77: google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.edition:type_name -> google.protobuf.Edition + 39, // 78: google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.overridable_features:type_name -> google.protobuf.FeatureSet + 39, // 79: google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fixed_features:type_name -> google.protobuf.FeatureSet + 19, // 80: google.protobuf.GeneratedCodeInfo.Annotation.semantic:type_name -> google.protobuf.GeneratedCodeInfo.Annotation.Semantic + 81, // [81:81] is the sub-list for method output_type + 81, // [81:81] is the sub-list for method input_type + 81, // [81:81] is the sub-list for extension type_name + 81, // [81:81] is the sub-list for extension extendee + 0, // [0:81] is the sub-list for field type_name } func init() { file_google_protobuf_descriptor_proto_init() } @@ -5385,431 +5213,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 any, i int) any { - 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 any, i int) any { - 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 any, i int) any { - 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 any, i int) any { - 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 any, i int) any { - 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 any, i int) any { - 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 any, i int) any { - 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 any, i int) any { - 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 any, i int) any { - 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 any, i int) any { - 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 any, i int) any { - 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 any, i int) any { - 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 any, i int) any { - 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 any, i int) any { - 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 any, i int) any { - 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 any, i int) any { - 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 any, i int) any { - 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 any, i int) any { - 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 any, i int) any { - 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 any, i int) any { - 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 any, i int) any { - 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 any, i int) any { - 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 any, i int) any { - 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 any, i int) any { - 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 any, i int) any { - 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 any, i int) any { - 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 any, i int) any { - 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 any, i int) any { - 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 any, i int) any { - switch v := v.(*FieldOptions_FeatureSupport); 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 any, i int) any { - 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[30].Exporter = func(v any, i int) any { - 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[31].Exporter = func(v any, i int) any { - 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[32].Exporter = func(v any, i int) any { - 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: 33, + RawDescriptor: unsafe.Slice(unsafe.StringData(file_google_protobuf_descriptor_proto_rawDesc), len(file_google_protobuf_descriptor_proto_rawDesc)), + NumEnums: 20, + NumMessages: 34, NumExtensions: 0, NumServices: 0, }, @@ -5819,7 +5229,6 @@ func file_google_protobuf_descriptor_proto_init() { MessageInfos: file_google_protobuf_descriptor_proto_msgTypes, }.Build() File_google_protobuf_descriptor_proto = out.File - file_google_protobuf_descriptor_proto_rawDesc = nil file_google_protobuf_descriptor_proto_goTypes = nil file_google_protobuf_descriptor_proto_depIdxs = nil } 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 a2ca940c5..37e712b6b 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 @@ -16,24 +16,153 @@ import ( descriptorpb "google.golang.org/protobuf/types/descriptorpb" reflect "reflect" sync "sync" + unsafe "unsafe" ) -type GoFeatures struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields +type GoFeatures_APILevel int32 + +const ( + // API_LEVEL_UNSPECIFIED results in selecting the OPEN API, + // but needs to be a separate value to distinguish between + // an explicitly set api level or a missing api level. + GoFeatures_API_LEVEL_UNSPECIFIED GoFeatures_APILevel = 0 + GoFeatures_API_OPEN GoFeatures_APILevel = 1 + GoFeatures_API_HYBRID GoFeatures_APILevel = 2 + GoFeatures_API_OPAQUE GoFeatures_APILevel = 3 +) + +// Enum value maps for GoFeatures_APILevel. +var ( + GoFeatures_APILevel_name = map[int32]string{ + 0: "API_LEVEL_UNSPECIFIED", + 1: "API_OPEN", + 2: "API_HYBRID", + 3: "API_OPAQUE", + } + GoFeatures_APILevel_value = map[string]int32{ + "API_LEVEL_UNSPECIFIED": 0, + "API_OPEN": 1, + "API_HYBRID": 2, + "API_OPAQUE": 3, + } +) + +func (x GoFeatures_APILevel) Enum() *GoFeatures_APILevel { + p := new(GoFeatures_APILevel) + *p = x + return p +} + +func (x GoFeatures_APILevel) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (GoFeatures_APILevel) Descriptor() protoreflect.EnumDescriptor { + return file_google_protobuf_go_features_proto_enumTypes[0].Descriptor() +} + +func (GoFeatures_APILevel) Type() protoreflect.EnumType { + return &file_google_protobuf_go_features_proto_enumTypes[0] +} + +func (x GoFeatures_APILevel) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *GoFeatures_APILevel) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = GoFeatures_APILevel(num) + return nil +} + +// Deprecated: Use GoFeatures_APILevel.Descriptor instead. +func (GoFeatures_APILevel) EnumDescriptor() ([]byte, []int) { + return file_google_protobuf_go_features_proto_rawDescGZIP(), []int{0, 0} +} +type GoFeatures_StripEnumPrefix int32 + +const ( + GoFeatures_STRIP_ENUM_PREFIX_UNSPECIFIED GoFeatures_StripEnumPrefix = 0 + GoFeatures_STRIP_ENUM_PREFIX_KEEP GoFeatures_StripEnumPrefix = 1 + GoFeatures_STRIP_ENUM_PREFIX_GENERATE_BOTH GoFeatures_StripEnumPrefix = 2 + GoFeatures_STRIP_ENUM_PREFIX_STRIP GoFeatures_StripEnumPrefix = 3 +) + +// Enum value maps for GoFeatures_StripEnumPrefix. +var ( + GoFeatures_StripEnumPrefix_name = map[int32]string{ + 0: "STRIP_ENUM_PREFIX_UNSPECIFIED", + 1: "STRIP_ENUM_PREFIX_KEEP", + 2: "STRIP_ENUM_PREFIX_GENERATE_BOTH", + 3: "STRIP_ENUM_PREFIX_STRIP", + } + GoFeatures_StripEnumPrefix_value = map[string]int32{ + "STRIP_ENUM_PREFIX_UNSPECIFIED": 0, + "STRIP_ENUM_PREFIX_KEEP": 1, + "STRIP_ENUM_PREFIX_GENERATE_BOTH": 2, + "STRIP_ENUM_PREFIX_STRIP": 3, + } +) + +func (x GoFeatures_StripEnumPrefix) Enum() *GoFeatures_StripEnumPrefix { + p := new(GoFeatures_StripEnumPrefix) + *p = x + return p +} + +func (x GoFeatures_StripEnumPrefix) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (GoFeatures_StripEnumPrefix) Descriptor() protoreflect.EnumDescriptor { + return file_google_protobuf_go_features_proto_enumTypes[1].Descriptor() +} + +func (GoFeatures_StripEnumPrefix) Type() protoreflect.EnumType { + return &file_google_protobuf_go_features_proto_enumTypes[1] +} + +func (x GoFeatures_StripEnumPrefix) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *GoFeatures_StripEnumPrefix) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = GoFeatures_StripEnumPrefix(num) + return nil +} + +// Deprecated: Use GoFeatures_StripEnumPrefix.Descriptor instead. +func (GoFeatures_StripEnumPrefix) EnumDescriptor() ([]byte, []int) { + return file_google_protobuf_go_features_proto_rawDescGZIP(), []int{0, 1} +} + +type GoFeatures struct { + state protoimpl.MessageState `protogen:"open.v1"` // Whether or not to generate the deprecated UnmarshalJSON method for enums. + // Can only be true for proto using the Open Struct api. LegacyUnmarshalJsonEnum *bool `protobuf:"varint,1,opt,name=legacy_unmarshal_json_enum,json=legacyUnmarshalJsonEnum" json:"legacy_unmarshal_json_enum,omitempty"` + // One of OPEN, HYBRID or OPAQUE. + ApiLevel *GoFeatures_APILevel `protobuf:"varint,2,opt,name=api_level,json=apiLevel,enum=pb.GoFeatures_APILevel" json:"api_level,omitempty"` + StripEnumPrefix *GoFeatures_StripEnumPrefix `protobuf:"varint,3,opt,name=strip_enum_prefix,json=stripEnumPrefix,enum=pb.GoFeatures_StripEnumPrefix" json:"strip_enum_prefix,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *GoFeatures) Reset() { *x = GoFeatures{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_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 { @@ -44,7 +173,7 @@ func (*GoFeatures) ProtoMessage() {} func (x *GoFeatures) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_go_features_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) @@ -66,6 +195,20 @@ func (x *GoFeatures) GetLegacyUnmarshalJsonEnum() bool { return false } +func (x *GoFeatures) GetApiLevel() GoFeatures_APILevel { + if x != nil && x.ApiLevel != nil { + return *x.ApiLevel + } + return GoFeatures_API_LEVEL_UNSPECIFIED +} + +func (x *GoFeatures) GetStripEnumPrefix() GoFeatures_StripEnumPrefix { + if x != nil && x.StripEnumPrefix != nil { + return *x.StripEnumPrefix + } + return GoFeatures_STRIP_ENUM_PREFIX_UNSPECIFIED +} + var file_google_protobuf_go_features_proto_extTypes = []protoimpl.ExtensionInfo{ { ExtendedType: (*descriptorpb.FeatureSet)(nil), @@ -85,59 +228,60 @@ var ( 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, -} +const file_google_protobuf_go_features_proto_rawDesc = "" + + "\n" + + "!google/protobuf/go_features.proto\x12\x02pb\x1a google/protobuf/descriptor.proto\"\xab\x05\n" + + "\n" + + "GoFeatures\x12\xbe\x01\n" + + "\x1alegacy_unmarshal_json_enum\x18\x01 \x01(\bB\x80\x01\x88\x01\x01\x98\x01\x06\x98\x01\x01\xa2\x01\t\x12\x04true\x18\x84\a\xa2\x01\n" + + "\x12\x05false\x18\xe7\a\xb2\x01[\b\xe8\a\x10\xe8\a\x1aSThe legacy UnmarshalJSON API is deprecated and will be removed in a future edition.R\x17legacyUnmarshalJsonEnum\x12t\n" + + "\tapi_level\x18\x02 \x01(\x0e2\x17.pb.GoFeatures.APILevelB>\x88\x01\x01\x98\x01\x03\x98\x01\x01\xa2\x01\x1a\x12\x15API_LEVEL_UNSPECIFIED\x18\x84\a\xa2\x01\x0f\x12\n" + + "API_OPAQUE\x18\xe9\a\xb2\x01\x03\b\xe8\aR\bapiLevel\x12|\n" + + "\x11strip_enum_prefix\x18\x03 \x01(\x0e2\x1e.pb.GoFeatures.StripEnumPrefixB0\x88\x01\x01\x98\x01\x06\x98\x01\a\x98\x01\x01\xa2\x01\x1b\x12\x16STRIP_ENUM_PREFIX_KEEP\x18\x84\a\xb2\x01\x03\b\xe9\aR\x0fstripEnumPrefix\"S\n" + + "\bAPILevel\x12\x19\n" + + "\x15API_LEVEL_UNSPECIFIED\x10\x00\x12\f\n" + + "\bAPI_OPEN\x10\x01\x12\x0e\n" + + "\n" + + "API_HYBRID\x10\x02\x12\x0e\n" + + "\n" + + "API_OPAQUE\x10\x03\"\x92\x01\n" + + "\x0fStripEnumPrefix\x12!\n" + + "\x1dSTRIP_ENUM_PREFIX_UNSPECIFIED\x10\x00\x12\x1a\n" + + "\x16STRIP_ENUM_PREFIX_KEEP\x10\x01\x12#\n" + + "\x1fSTRIP_ENUM_PREFIX_GENERATE_BOTH\x10\x02\x12\x1b\n" + + "\x17STRIP_ENUM_PREFIX_STRIP\x10\x03:<\n" + + "\x02go\x12\x1b.google.protobuf.FeatureSet\x18\xea\a \x01(\v2\x0e.pb.GoFeaturesR\x02goB/Z-google.golang.org/protobuf/types/gofeaturespb" var ( file_google_protobuf_go_features_proto_rawDescOnce sync.Once - file_google_protobuf_go_features_proto_rawDescData = file_google_protobuf_go_features_proto_rawDesc + file_google_protobuf_go_features_proto_rawDescData []byte ) 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) + file_google_protobuf_go_features_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_google_protobuf_go_features_proto_rawDesc), len(file_google_protobuf_go_features_proto_rawDesc))) }) return file_google_protobuf_go_features_proto_rawDescData } +var file_google_protobuf_go_features_proto_enumTypes = make([]protoimpl.EnumInfo, 2) 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 + (GoFeatures_APILevel)(0), // 0: pb.GoFeatures.APILevel + (GoFeatures_StripEnumPrefix)(0), // 1: pb.GoFeatures.StripEnumPrefix + (*GoFeatures)(nil), // 2: pb.GoFeatures + (*descriptorpb.FeatureSet)(nil), // 3: google.protobuf.FeatureSet } 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 - 0, // [0:1] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 0, // 0: pb.GoFeatures.api_level:type_name -> pb.GoFeatures.APILevel + 1, // 1: pb.GoFeatures.strip_enum_prefix:type_name -> pb.GoFeatures.StripEnumPrefix + 3, // 2: pb.go:extendee -> google.protobuf.FeatureSet + 2, // 3: pb.go:type_name -> pb.GoFeatures + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 3, // [3:4] is the sub-list for extension type_name + 2, // [2:3] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name } func init() { file_google_protobuf_go_features_proto_init() } @@ -145,37 +289,23 @@ func file_google_protobuf_go_features_proto_init() { if File_google_protobuf_go_features_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_google_protobuf_go_features_proto_msgTypes[0].Exporter = func(v any, i int) any { - 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_google_protobuf_go_features_proto_rawDesc, - NumEnums: 0, + RawDescriptor: unsafe.Slice(unsafe.StringData(file_google_protobuf_go_features_proto_rawDesc), len(file_google_protobuf_go_features_proto_rawDesc)), + NumEnums: 2, NumMessages: 1, NumExtensions: 1, NumServices: 0, }, GoTypes: file_google_protobuf_go_features_proto_goTypes, DependencyIndexes: file_google_protobuf_go_features_proto_depIdxs, + EnumInfos: file_google_protobuf_go_features_proto_enumTypes, MessageInfos: file_google_protobuf_go_features_proto_msgTypes, ExtensionInfos: file_google_protobuf_go_features_proto_extTypes, }.Build() 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/known/anypb/any.pb.go b/vendor/google.golang.org/protobuf/types/known/anypb/any.pb.go index 7172b43d3..1ff0d1494 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 @@ -122,6 +122,7 @@ import ( reflect "reflect" strings "strings" sync "sync" + unsafe "unsafe" ) // `Any` contains an arbitrary serialized protocol buffer message along with a @@ -210,10 +211,7 @@ import ( // "value": "1.212s" // } type Any struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` // A URL/resource name that uniquely identifies the type of the serialized // protocol buffer message. This string must contain at least // one "/" character. The last segment of the URL's path must represent @@ -244,7 +242,9 @@ type Any struct { // used with implementation specific semantics. TypeUrl string `protobuf:"bytes,1,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"` // Must be a valid serialized protocol buffer of the above specified type. - Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } // New marshals src into a new Any instance. @@ -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) @@ -414,32 +412,22 @@ func (x *Any) GetValue() []byte { var File_google_protobuf_any_proto protoreflect.FileDescriptor -var file_google_protobuf_any_proto_rawDesc = []byte{ - 0x0a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0x36, 0x0a, 0x03, - 0x41, 0x6e, 0x79, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, 0x79, 0x70, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x14, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x42, 0x76, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x08, 0x41, 0x6e, 0x79, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2c, 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, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x2f, - 0x61, 0x6e, 0x79, 0x70, 0x62, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, - 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, -} +const file_google_protobuf_any_proto_rawDesc = "" + + "\n" + + "\x19google/protobuf/any.proto\x12\x0fgoogle.protobuf\"6\n" + + "\x03Any\x12\x19\n" + + "\btype_url\x18\x01 \x01(\tR\atypeUrl\x12\x14\n" + + "\x05value\x18\x02 \x01(\fR\x05valueBv\n" + + "\x13com.google.protobufB\bAnyProtoP\x01Z,google.golang.org/protobuf/types/known/anypb\xa2\x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.WellKnownTypesb\x06proto3" var ( file_google_protobuf_any_proto_rawDescOnce sync.Once - file_google_protobuf_any_proto_rawDescData = file_google_protobuf_any_proto_rawDesc + file_google_protobuf_any_proto_rawDescData []byte ) func file_google_protobuf_any_proto_rawDescGZIP() []byte { file_google_protobuf_any_proto_rawDescOnce.Do(func() { - file_google_protobuf_any_proto_rawDescData = protoimpl.X.CompressGZIP(file_google_protobuf_any_proto_rawDescData) + file_google_protobuf_any_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_google_protobuf_any_proto_rawDesc), len(file_google_protobuf_any_proto_rawDesc))) }) return file_google_protobuf_any_proto_rawDescData } @@ -461,25 +449,11 @@ 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 any, i int) any { - 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{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_google_protobuf_any_proto_rawDesc, + RawDescriptor: unsafe.Slice(unsafe.StringData(file_google_protobuf_any_proto_rawDesc), len(file_google_protobuf_any_proto_rawDesc)), NumEnums: 0, NumMessages: 1, NumExtensions: 0, @@ -490,7 +464,6 @@ func file_google_protobuf_any_proto_init() { MessageInfos: file_google_protobuf_any_proto_msgTypes, }.Build() File_google_protobuf_any_proto = out.File - file_google_protobuf_any_proto_rawDesc = nil file_google_protobuf_any_proto_goTypes = nil file_google_protobuf_any_proto_depIdxs = nil } 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 1b71bcd91..ca2e7b38f 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 @@ -80,6 +80,7 @@ import ( reflect "reflect" sync "sync" time "time" + unsafe "unsafe" ) // A Duration represents a signed, fixed-length span of time represented @@ -141,10 +142,7 @@ import ( // be expressed in JSON format as "3.000000001s", and 3 seconds and 1 // microsecond should be expressed in JSON format as "3.000001s". type Duration struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` // Signed seconds of the span of time. Must be from -315,576,000,000 // to +315,576,000,000 inclusive. Note: these bounds are computed from: // 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years @@ -155,7 +153,9 @@ type Duration struct { // of one second or more, a non-zero value for the `nanos` field must be // of the same sign as the `seconds` field. Must be from -999,999,999 // to +999,999,999 inclusive. - Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` + Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } // New constructs a new Duration from the provided time.Duration. @@ -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) @@ -291,33 +289,22 @@ func (x *Duration) GetNanos() int32 { var File_google_protobuf_duration_proto protoreflect.FileDescriptor -var file_google_protobuf_duration_proto_rawDesc = []byte{ - 0x0a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x0f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x22, 0x3a, 0x0a, 0x08, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, - 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, - 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x42, 0x83, 0x01, - 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x0d, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x31, 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, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x2f, 0x64, - 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x70, 0x62, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, - 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, - 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} +const file_google_protobuf_duration_proto_rawDesc = "" + + "\n" + + "\x1egoogle/protobuf/duration.proto\x12\x0fgoogle.protobuf\":\n" + + "\bDuration\x12\x18\n" + + "\aseconds\x18\x01 \x01(\x03R\aseconds\x12\x14\n" + + "\x05nanos\x18\x02 \x01(\x05R\x05nanosB\x83\x01\n" + + "\x13com.google.protobufB\rDurationProtoP\x01Z1google.golang.org/protobuf/types/known/durationpb\xf8\x01\x01\xa2\x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.WellKnownTypesb\x06proto3" var ( file_google_protobuf_duration_proto_rawDescOnce sync.Once - file_google_protobuf_duration_proto_rawDescData = file_google_protobuf_duration_proto_rawDesc + file_google_protobuf_duration_proto_rawDescData []byte ) func file_google_protobuf_duration_proto_rawDescGZIP() []byte { file_google_protobuf_duration_proto_rawDescOnce.Do(func() { - file_google_protobuf_duration_proto_rawDescData = protoimpl.X.CompressGZIP(file_google_protobuf_duration_proto_rawDescData) + file_google_protobuf_duration_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_google_protobuf_duration_proto_rawDesc), len(file_google_protobuf_duration_proto_rawDesc))) }) return file_google_protobuf_duration_proto_rawDescData } @@ -339,25 +326,11 @@ 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 any, i int) any { - 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{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_google_protobuf_duration_proto_rawDesc, + RawDescriptor: unsafe.Slice(unsafe.StringData(file_google_protobuf_duration_proto_rawDesc), len(file_google_protobuf_duration_proto_rawDesc)), NumEnums: 0, NumMessages: 1, NumExtensions: 0, @@ -368,7 +341,6 @@ func file_google_protobuf_duration_proto_init() { MessageInfos: file_google_protobuf_duration_proto_msgTypes, }.Build() File_google_protobuf_duration_proto = out.File - file_google_protobuf_duration_proto_rawDesc = nil file_google_protobuf_duration_proto_goTypes = nil file_google_protobuf_duration_proto_depIdxs = 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 83a5a645b..06d584c14 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 @@ -78,6 +78,7 @@ import ( reflect "reflect" sync "sync" time "time" + unsafe "unsafe" ) // A Timestamp represents a point in time independent of any time zone or local @@ -170,10 +171,7 @@ import ( // http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() // ) to obtain a formatter capable of generating timestamps in this format. type Timestamp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` // Represents seconds of UTC time since Unix epoch // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to // 9999-12-31T23:59:59Z inclusive. @@ -182,7 +180,9 @@ type Timestamp struct { // second values with fractions must still have non-negative nanos values // that count forward in time. Must be from 0 to 999,999,999 // inclusive. - Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` + Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } // Now constructs a new Timestamp from the current time. @@ -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) @@ -300,33 +298,22 @@ func (x *Timestamp) GetNanos() int32 { var File_google_protobuf_timestamp_proto protoreflect.FileDescriptor -var file_google_protobuf_timestamp_proto_rawDesc = []byte{ - 0x0a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x0f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x22, 0x3b, 0x0a, 0x09, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, - 0x18, 0x0a, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x61, 0x6e, - 0x6f, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x42, - 0x85, 0x01, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x0e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 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, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, - 0x6e, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x70, 0x62, 0xf8, 0x01, 0x01, - 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, - 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} +const file_google_protobuf_timestamp_proto_rawDesc = "" + + "\n" + + "\x1fgoogle/protobuf/timestamp.proto\x12\x0fgoogle.protobuf\";\n" + + "\tTimestamp\x12\x18\n" + + "\aseconds\x18\x01 \x01(\x03R\aseconds\x12\x14\n" + + "\x05nanos\x18\x02 \x01(\x05R\x05nanosB\x85\x01\n" + + "\x13com.google.protobufB\x0eTimestampProtoP\x01Z2google.golang.org/protobuf/types/known/timestamppb\xf8\x01\x01\xa2\x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.WellKnownTypesb\x06proto3" var ( file_google_protobuf_timestamp_proto_rawDescOnce sync.Once - file_google_protobuf_timestamp_proto_rawDescData = file_google_protobuf_timestamp_proto_rawDesc + file_google_protobuf_timestamp_proto_rawDescData []byte ) func file_google_protobuf_timestamp_proto_rawDescGZIP() []byte { file_google_protobuf_timestamp_proto_rawDescOnce.Do(func() { - file_google_protobuf_timestamp_proto_rawDescData = protoimpl.X.CompressGZIP(file_google_protobuf_timestamp_proto_rawDescData) + file_google_protobuf_timestamp_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_google_protobuf_timestamp_proto_rawDesc), len(file_google_protobuf_timestamp_proto_rawDesc))) }) return file_google_protobuf_timestamp_proto_rawDescData } @@ -348,25 +335,11 @@ 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 any, i int) any { - 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{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_google_protobuf_timestamp_proto_rawDesc, + RawDescriptor: unsafe.Slice(unsafe.StringData(file_google_protobuf_timestamp_proto_rawDesc), len(file_google_protobuf_timestamp_proto_rawDesc)), NumEnums: 0, NumMessages: 1, NumExtensions: 0, @@ -377,7 +350,6 @@ func file_google_protobuf_timestamp_proto_init() { MessageInfos: file_google_protobuf_timestamp_proto_msgTypes, }.Build() File_google_protobuf_timestamp_proto = out.File - file_google_protobuf_timestamp_proto_rawDesc = nil file_google_protobuf_timestamp_proto_goTypes = nil file_google_protobuf_timestamp_proto_depIdxs = nil } diff --git a/vendor/modules.txt b/vendor/modules.txt index 3a9b2c319..8f3d0b91f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,15 +1,15 @@ -# github.com/IBM/idemix v0.0.2-0.20231011101252-a4feda90f3f7 -## explicit; go 1.19 +# github.com/IBM/idemix v0.0.2-0.20240913182345-72941a5f41cd +## explicit; go 1.22.6 github.com/IBM/idemix/bccsp/schemes/dlog/crypto github.com/IBM/idemix/bccsp/schemes/dlog/crypto/translator/amcl # github.com/IBM/idemix/bccsp/schemes/weak-bb v0.0.0-20240612072411-114d281b442d ## explicit; go 1.19 github.com/IBM/idemix/bccsp/schemes/weak-bb -# github.com/IBM/idemix/bccsp/types v0.0.0-20240612072411-114d281b442d -## explicit; go 1.19 +# github.com/IBM/idemix/bccsp/types v0.0.0-20240913182345-72941a5f41cd +## explicit; go 1.22.6 github.com/IBM/idemix/bccsp/types -# github.com/IBM/mathlib v0.0.3-0.20231011094432-44ee0eb539da -## explicit; go 1.18 +# github.com/IBM/mathlib v0.0.3-0.20250709075152-a138079496c3 +## explicit; go 1.23.0 github.com/IBM/mathlib github.com/IBM/mathlib/driver github.com/IBM/mathlib/driver/amcl @@ -22,10 +22,10 @@ github.com/Knetic/govaluate # github.com/beorn7/perks v1.0.1 ## explicit; go 1.11 github.com/beorn7/perks/quantile -# github.com/bits-and-blooms/bitset v1.13.0 +# github.com/bits-and-blooms/bitset v1.20.0 ## explicit; go 1.16 github.com/bits-and-blooms/bitset -# 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/cloudflare/cfssl v1.4.1 @@ -54,30 +54,30 @@ github.com/cloudflare/cfssl/signer github.com/cloudflare/cfssl/signer/local github.com/cloudflare/cfssl/signer/remote github.com/cloudflare/cfssl/signer/universal -# github.com/consensys/bavard v0.1.13 -## explicit; go 1.15 -github.com/consensys/bavard -# github.com/consensys/gnark-crypto v0.12.1 -## explicit; go 1.18 +# github.com/consensys/gnark-crypto v0.19.2 +## explicit; go 1.23.0 github.com/consensys/gnark-crypto/ecc github.com/consensys/gnark-crypto/ecc/bls12-377 github.com/consensys/gnark-crypto/ecc/bls12-377/fp github.com/consensys/gnark-crypto/ecc/bls12-377/fr +github.com/consensys/gnark-crypto/ecc/bls12-377/hash_to_curve github.com/consensys/gnark-crypto/ecc/bls12-377/internal/fptower github.com/consensys/gnark-crypto/ecc/bls12-381 github.com/consensys/gnark-crypto/ecc/bls12-381/fp github.com/consensys/gnark-crypto/ecc/bls12-381/fr +github.com/consensys/gnark-crypto/ecc/bls12-381/hash_to_curve github.com/consensys/gnark-crypto/ecc/bls12-381/internal/fptower github.com/consensys/gnark-crypto/ecc/bn254 github.com/consensys/gnark-crypto/ecc/bn254/fp github.com/consensys/gnark-crypto/ecc/bn254/fr +github.com/consensys/gnark-crypto/ecc/bn254/hash_to_curve github.com/consensys/gnark-crypto/ecc/bn254/internal/fptower -github.com/consensys/gnark-crypto/field/generator/config -github.com/consensys/gnark-crypto/field/generator/internal/addchain +github.com/consensys/gnark-crypto/field/asm/element_4w +github.com/consensys/gnark-crypto/field/asm/element_6w github.com/consensys/gnark-crypto/field/hash github.com/consensys/gnark-crypto/field/pool -github.com/consensys/gnark-crypto/internal/generator/config github.com/consensys/gnark-crypto/internal/parallel +github.com/consensys/gnark-crypto/utils/cpu # github.com/davecgh/go-spew v1.1.1 ## explicit github.com/davecgh/go-spew/spew @@ -119,8 +119,8 @@ github.com/google/certificate-transparency-go/jsonclient github.com/google/certificate-transparency-go/tls github.com/google/certificate-transparency-go/x509 github.com/google/certificate-transparency-go/x509/pkix -# github.com/google/go-cmp v0.6.0 -## explicit; go 1.13 +# github.com/google/go-cmp v0.7.0 +## explicit; go 1.21 github.com/google/go-cmp/cmp github.com/google/go-cmp/cmp/internal/diff github.com/google/go-cmp/cmp/internal/flags @@ -170,8 +170,8 @@ github.com/hyperledger/fabric-lib-go/common/metrics/namer github.com/hyperledger/fabric-lib-go/common/metrics/prometheus github.com/hyperledger/fabric-lib-go/common/metrics/statsd github.com/hyperledger/fabric-lib-go/healthz -# github.com/inconshreveable/mousetrap v1.0.0 -## explicit +# github.com/inconshreveable/mousetrap v1.1.0 +## explicit; go 1.18 github.com/inconshreveable/mousetrap # github.com/jinzhu/copier v0.3.5 ## explicit; go 1.13 @@ -209,41 +209,18 @@ github.com/miekg/pkcs11 # github.com/mitchellh/mapstructure v1.5.0 ## explicit; go 1.14 github.com/mitchellh/mapstructure -# github.com/mmcloughlin/addchain v0.4.0 -## explicit; go 1.16 -github.com/mmcloughlin/addchain -github.com/mmcloughlin/addchain/acc -github.com/mmcloughlin/addchain/acc/ast -github.com/mmcloughlin/addchain/acc/ir -github.com/mmcloughlin/addchain/acc/parse -github.com/mmcloughlin/addchain/acc/parse/internal/parser -github.com/mmcloughlin/addchain/acc/pass -github.com/mmcloughlin/addchain/acc/printer -github.com/mmcloughlin/addchain/alg -github.com/mmcloughlin/addchain/alg/contfrac -github.com/mmcloughlin/addchain/alg/dict -github.com/mmcloughlin/addchain/alg/ensemble -github.com/mmcloughlin/addchain/alg/exec -github.com/mmcloughlin/addchain/alg/heuristic -github.com/mmcloughlin/addchain/alg/opt -github.com/mmcloughlin/addchain/internal/bigint -github.com/mmcloughlin/addchain/internal/bigints -github.com/mmcloughlin/addchain/internal/bigvector -github.com/mmcloughlin/addchain/internal/container/heap -github.com/mmcloughlin/addchain/internal/errutil -github.com/mmcloughlin/addchain/internal/print -github.com/mmcloughlin/addchain/meta -# github.com/nxadm/tail v1.4.4 +# github.com/nxadm/tail v1.4.8 ## explicit; go 1.13 github.com/nxadm/tail github.com/nxadm/tail/ratelimiter github.com/nxadm/tail/util github.com/nxadm/tail/watch github.com/nxadm/tail/winfile -# github.com/onsi/ginkgo v1.14.2 -## explicit; go 1.13 +# github.com/onsi/ginkgo v1.16.5 +## explicit; go 1.16 github.com/onsi/ginkgo github.com/onsi/ginkgo/config +github.com/onsi/ginkgo/formatter github.com/onsi/ginkgo/internal/codelocation github.com/onsi/ginkgo/internal/containernode github.com/onsi/ginkgo/internal/failer @@ -261,14 +238,15 @@ github.com/onsi/ginkgo/reporters/stenographer github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty github.com/onsi/ginkgo/types -# github.com/onsi/gomega v1.31.0 -## explicit; go 1.20 +# github.com/onsi/gomega v1.38.2 +## explicit; go 1.23.0 github.com/onsi/gomega github.com/onsi/gomega/format github.com/onsi/gomega/gbytes github.com/onsi/gomega/internal github.com/onsi/gomega/internal/gutil github.com/onsi/gomega/matchers +github.com/onsi/gomega/matchers/internal/miter github.com/onsi/gomega/matchers/support/goraph/bipartitegraph github.com/onsi/gomega/matchers/support/goraph/edge github.com/onsi/gomega/matchers/support/goraph/node @@ -315,24 +293,25 @@ 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.5.0 +# github.com/spf13/cobra v1.8.1 ## explicit; go 1.15 github.com/spf13/cobra # github.com/spf13/jwalterweatherman v1.1.0 ## explicit github.com/spf13/jwalterweatherman -# github.com/spf13/pflag v1.0.5 +# github.com/spf13/pflag v1.0.6 ## explicit; go 1.12 github.com/spf13/pflag # github.com/spf13/viper v1.7.0 ## explicit; go 1.12 github.com/spf13/viper -# github.com/stretchr/objx v0.5.0 -## explicit; go 1.12 -github.com/stretchr/objx -# github.com/stretchr/testify v1.8.4 +# github.com/stretchr/objx v0.5.2 ## explicit; go 1.20 +github.com/stretchr/objx +# github.com/stretchr/testify v1.11.1 +## explicit; go 1.17 github.com/stretchr/testify/assert +github.com/stretchr/testify/assert/yaml github.com/stretchr/testify/mock # github.com/subosito/gotenv v1.6.0 ## explicit; go 1.18 @@ -370,8 +349,11 @@ go.uber.org/zap/internal/pool go.uber.org/zap/internal/stacktrace go.uber.org/zap/zapcore go.uber.org/zap/zapgrpc -# golang.org/x/crypto v0.36.0 -## explicit; go 1.23.0 +# go.yaml.in/yaml/v3 v3.0.4 +## explicit; go 1.16 +go.yaml.in/yaml/v3 +# golang.org/x/crypto v0.43.0 +## explicit; go 1.24.0 golang.org/x/crypto/bcrypt golang.org/x/crypto/blake2b golang.org/x/crypto/blowfish @@ -382,21 +364,21 @@ golang.org/x/crypto/ocsp golang.org/x/crypto/pkcs12 golang.org/x/crypto/pkcs12/internal/rc2 golang.org/x/crypto/sha3 -# golang.org/x/net v0.38.0 -## explicit; go 1.23.0 +# golang.org/x/net v0.45.0 +## explicit; go 1.24.0 golang.org/x/net/context golang.org/x/net/context/ctxhttp golang.org/x/net/html golang.org/x/net/html/atom golang.org/x/net/html/charset golang.org/x/net/idna -# golang.org/x/sys v0.31.0 -## explicit; go 1.23.0 +# golang.org/x/sys v0.37.0 +## explicit; go 1.24.0 golang.org/x/sys/cpu golang.org/x/sys/unix golang.org/x/sys/windows -# golang.org/x/text v0.23.0 -## explicit; go 1.23.0 +# golang.org/x/text v0.30.0 +## explicit; go 1.24.0 golang.org/x/text/encoding golang.org/x/text/encoding/charmap golang.org/x/text/encoding/htmlindex @@ -417,12 +399,12 @@ golang.org/x/text/secure/bidirule golang.org/x/text/transform golang.org/x/text/unicode/bidi golang.org/x/text/unicode/norm -# google.golang.org/grpc v1.64.1 -## explicit; go 1.19 +# google.golang.org/grpc v1.65.0 +## explicit; go 1.21 google.golang.org/grpc/grpclog google.golang.org/grpc/internal/grpclog -# google.golang.org/protobuf v1.34.2 -## explicit; go 1.20 +# google.golang.org/protobuf v1.36.7 +## explicit; go 1.22 google.golang.org/protobuf/encoding/prototext google.golang.org/protobuf/encoding/protowire google.golang.org/protobuf/internal/descfmt @@ -442,6 +424,7 @@ google.golang.org/protobuf/internal/genid google.golang.org/protobuf/internal/impl google.golang.org/protobuf/internal/order google.golang.org/protobuf/internal/pragma +google.golang.org/protobuf/internal/protolazy google.golang.org/protobuf/internal/set google.golang.org/protobuf/internal/strs google.golang.org/protobuf/internal/version @@ -474,7 +457,3 @@ gopkg.in/yaml.v2 # gopkg.in/yaml.v3 v3.0.1 ## explicit gopkg.in/yaml.v3 -# rsc.io/tmplfunc v0.0.3 -## explicit; go 1.17 -rsc.io/tmplfunc -rsc.io/tmplfunc/internal/parse diff --git a/vendor/rsc.io/tmplfunc/LICENSE b/vendor/rsc.io/tmplfunc/LICENSE deleted file mode 100644 index 6a66aea5e..000000000 --- a/vendor/rsc.io/tmplfunc/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2009 The Go Authors. 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 Google Inc. 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 -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(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/rsc.io/tmplfunc/README.md b/vendor/rsc.io/tmplfunc/README.md deleted file mode 100644 index 8e3d917c4..000000000 --- a/vendor/rsc.io/tmplfunc/README.md +++ /dev/null @@ -1,8 +0,0 @@ -[![Documentation](https://pkg.go.dev/badge/rsc.io/tmplfunc.svg)](https://pkg.go.dev/rsc.io/tmplfunc) - -Package tmplfunc provides an extension of Go templates -in which templates can be invoked as if they were functions. - -See the [package documentation](https://pkg.go.dev/rsc.io/tmplfunc) for details. - - diff --git a/vendor/rsc.io/tmplfunc/func.go b/vendor/rsc.io/tmplfunc/func.go deleted file mode 100644 index 4366d1f4f..000000000 --- a/vendor/rsc.io/tmplfunc/func.go +++ /dev/null @@ -1,205 +0,0 @@ -// Copyright 2021 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 tmplfunc - -import ( - "bytes" - "fmt" - "reflect" - "regexp" - "strings" - - "rsc.io/tmplfunc/internal/parse" - - htmltemplate "html/template" - texttemplate "text/template" -) - -var validNameRE = regexp.MustCompile(`\A[_\pL][_\pL\p{Nd}]*\z`) -var validArgNameRE = regexp.MustCompile(`\A[_\pL][_\pL\p{Nd}]*(\.\.\.|\?)?\z`) - -func funcs(t Template, names, texts []string) error { - var leftDelim, rightDelim string - switch t := t.(type) { - case nil: - return fmt.Errorf("tmplfunc: nil Template") - default: - return fmt.Errorf("tmplfunc: non-template type %T", t) - case *texttemplate.Template: - leftDelim = reflect.ValueOf(t).Elem().FieldByName("leftDelim").String() - rightDelim = reflect.ValueOf(t).Elem().FieldByName("rightDelim").String() - case *htmltemplate.Template: - leftDelim = reflect.ValueOf(t).Elem().FieldByName("text").Elem().FieldByName("leftDelim").String() - rightDelim = reflect.ValueOf(t).Elem().FieldByName("text").Elem().FieldByName("rightDelim").String() - } - - trees := make(map[string]*parse.Tree) - for i, text := range texts { - t := parse.New(names[i], nil) - t.Mode = parse.SkipFuncCheck - _, err := t.Parse(text, leftDelim, rightDelim, trees) - if err != nil { - return err - } - } - - // Install functions for named templates as appropriate. - funcs := make(map[string]interface{}) - for name := range trees { - if err := addFunc(t, name, funcs); err != nil { - return err - } - } - - switch t := t.(type) { - case *texttemplate.Template: - t.Funcs(funcs) - case *htmltemplate.Template: - t.Funcs(funcs) - } - - return nil -} - -// Funcs installs functions for all the templates in the set containing t. -// After using t.Clone it is necessary to call Funcs on the result to arrange -// for the functions to invoke the cloned templates and not the originals. -func Funcs(t Template) error { - funcs := make(map[string]interface{}) - switch t := t.(type) { - case *texttemplate.Template: - for _, t1 := range t.Templates() { - if err := addFunc(t, t1.Name(), funcs); err != nil { - return err - } - } - t.Funcs(funcs) - case *htmltemplate.Template: - for _, t1 := range t.Templates() { - if err := addFunc(t, t1.Name(), funcs); err != nil { - return err - } - } - t.Funcs(funcs) - } - return nil -} - -func addFunc(t Template, name string, funcs map[string]interface{}) error { - fn, bundle, err := bundler(name) - if err != nil { - return err - } - if fn == "" { - return nil - } - switch t := t.(type) { - case *texttemplate.Template: - funcs[fn] = func(args ...interface{}) (string, error) { - t := t.Lookup(name) - if t == nil { - return "", fmt.Errorf("lost template %q", name) - } - arg, err := bundle(args) - if err != nil { - return "", err - } - var buf bytes.Buffer - err = t.Execute(&buf, arg) - if err != nil { - return "", err - } - return buf.String(), nil - } - case *htmltemplate.Template: - funcs[fn] = func(args ...interface{}) (htmltemplate.HTML, error) { - t := t.Lookup(name) - if t == nil { - return "", fmt.Errorf("lost template %q", name) - } - arg, err := bundle(args) - if err != nil { - return "", err - } - var buf bytes.Buffer - err = t.Execute(&buf, arg) - if err != nil { - return "", err - } - return htmltemplate.HTML(buf.String()), nil - } - } - return nil -} - -func bundler(name string) (fn string, bundle func(args []interface{}) (interface{}, error), err error) { - f := strings.Fields(name) - if len(f) == 0 || !validNameRE.MatchString(f[0]) { - return "", nil, nil - } - - fn = f[0] - if len(f) == 1 { - bundle = func(args []interface{}) (interface{}, error) { - if len(args) == 0 { - return nil, nil - } - if len(args) == 1 { - return args[0], nil - } - return nil, fmt.Errorf("too many arguments in call to template %s", fn) - } - } else { - sawQ := false - for i, argName := range f[1:] { - if !validArgNameRE.MatchString(argName) { - return "", nil, fmt.Errorf("invalid template name %q: invalid argument name %s", name, argName) - } - if strings.HasSuffix(argName, "...") { - if i != len(f)-2 { - return "", nil, fmt.Errorf("invalid template name %q: %s is not last argument", name, argName) - } - break - } - if strings.HasSuffix(argName, "?") { - sawQ = true - continue - } - if sawQ { - return "", nil, fmt.Errorf("invalid template name %q: required %s after optional %s", name, argName, f[i]) - } - } - - bundle = func(args []interface{}) (interface{}, error) { - m := make(map[string]interface{}) - for _, argName := range f[1:] { - if strings.HasSuffix(argName, "...") { - m[strings.TrimSuffix(argName, "...")] = args - args = nil - break - } - if strings.HasSuffix(argName, "?") { - prefix := strings.TrimSuffix(argName, "?") - if len(args) == 0 { - m[prefix] = nil - } else { - m[prefix], args = args[0], args[1:] - } - continue - } - if len(args) == 0 { - return nil, fmt.Errorf("too few arguments in call to template %s", fn) - } - m[argName], args = args[0], args[1:] - } - if len(args) > 0 { - return nil, fmt.Errorf("too many arguments in call to template %s", fn) - } - return m, nil - } - } - - return fn, bundle, nil -} diff --git a/vendor/rsc.io/tmplfunc/internal/parse/lex.go b/vendor/rsc.io/tmplfunc/internal/parse/lex.go deleted file mode 100644 index 6784071b1..000000000 --- a/vendor/rsc.io/tmplfunc/internal/parse/lex.go +++ /dev/null @@ -1,671 +0,0 @@ -// Copyright 2011 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 parse - -import ( - "fmt" - "strings" - "unicode" - "unicode/utf8" -) - -// item represents a token or text string returned from the scanner. -type item struct { - typ itemType // The type of this item. - pos Pos // The starting position, in bytes, of this item in the input string. - val string // The value of this item. - line int // The line number at the start of this item. -} - -func (i item) String() string { - switch { - case i.typ == itemEOF: - return "EOF" - case i.typ == itemError: - return i.val - case i.typ > itemKeyword: - return fmt.Sprintf("<%s>", i.val) - case len(i.val) > 10: - return fmt.Sprintf("%.10q...", i.val) - } - return fmt.Sprintf("%q", i.val) -} - -// itemType identifies the type of lex items. -type itemType int - -const ( - itemError itemType = iota // error occurred; value is text of error - itemBool // boolean constant - itemChar // printable ASCII character; grab bag for comma etc. - itemCharConstant // character constant - itemComment // comment text - itemComplex // complex constant (1+2i); imaginary is just a number - itemAssign // equals ('=') introducing an assignment - itemDeclare // colon-equals (':=') introducing a declaration - itemEOF - itemField // alphanumeric identifier starting with '.' - itemIdentifier // alphanumeric identifier not starting with '.' - itemLeftDelim // left action delimiter - itemLeftParen // '(' inside action - itemNumber // simple number, including imaginary - itemPipe // pipe symbol - itemRawString // raw quoted string (includes quotes) - itemRightDelim // right action delimiter - itemRightParen // ')' inside action - itemSpace // run of spaces separating arguments - itemString // quoted string (includes quotes) - itemText // plain text - itemVariable // variable starting with '$', such as '$' or '$1' or '$hello' - // Keywords appear after all the rest. - itemKeyword // used only to delimit the keywords - itemBlock // block keyword - itemDot // the cursor, spelled '.' - itemDefine // define keyword - itemElse // else keyword - itemEnd // end keyword - itemIf // if keyword - itemNil // the untyped nil constant, easiest to treat as a keyword - itemRange // range keyword - itemTemplate // template keyword - itemWith // with keyword -) - -var key = map[string]itemType{ - ".": itemDot, - "block": itemBlock, - "define": itemDefine, - "else": itemElse, - "end": itemEnd, - "if": itemIf, - "range": itemRange, - "nil": itemNil, - "template": itemTemplate, - "with": itemWith, -} - -const eof = -1 - -// Trimming spaces. -// If the action begins "{{- " rather than "{{", then all space/tab/newlines -// preceding the action are trimmed; conversely if it ends " -}}" the -// leading spaces are trimmed. This is done entirely in the lexer; the -// parser never sees it happen. We require an ASCII space (' ', \t, \r, \n) -// to be present to avoid ambiguity with things like "{{-3}}". It reads -// better with the space present anyway. For simplicity, only ASCII -// does the job. -const ( - spaceChars = " \t\r\n" // These are the space characters defined by Go itself. - trimMarker = '-' // Attached to left/right delimiter, trims trailing spaces from preceding/following text. - trimMarkerLen = Pos(1 + 1) // marker plus space before or after -) - -// stateFn represents the state of the scanner as a function that returns the next state. -type stateFn func(*lexer) stateFn - -// lexer holds the state of the scanner. -type lexer struct { - name string // the name of the input; used only for error reports - input string // the string being scanned - leftDelim string // start of action - rightDelim string // end of action - emitComment bool // emit itemComment tokens. - pos Pos // current position in the input - start Pos // start position of this item - width Pos // width of last rune read from input - items chan item // channel of scanned items - parenDepth int // nesting depth of ( ) exprs - line int // 1+number of newlines seen - startLine int // start line of this item -} - -// next returns the next rune in the input. -func (l *lexer) next() rune { - if int(l.pos) >= len(l.input) { - l.width = 0 - return eof - } - r, w := utf8.DecodeRuneInString(l.input[l.pos:]) - l.width = Pos(w) - l.pos += l.width - if r == '\n' { - l.line++ - } - return r -} - -// peek returns but does not consume the next rune in the input. -func (l *lexer) peek() rune { - r := l.next() - l.backup() - return r -} - -// backup steps back one rune. Can only be called once per call of next. -func (l *lexer) backup() { - l.pos -= l.width - // Correct newline count. - if l.width == 1 && l.input[l.pos] == '\n' { - l.line-- - } -} - -// emit passes an item back to the client. -func (l *lexer) emit(t itemType) { - l.items <- item{t, l.start, l.input[l.start:l.pos], l.startLine} - l.start = l.pos - l.startLine = l.line -} - -// ignore skips over the pending input before this point. -func (l *lexer) ignore() { - l.line += strings.Count(l.input[l.start:l.pos], "\n") - l.start = l.pos - l.startLine = l.line -} - -// accept consumes the next rune if it's from the valid set. -func (l *lexer) accept(valid string) bool { - if strings.ContainsRune(valid, l.next()) { - return true - } - l.backup() - return false -} - -// acceptRun consumes a run of runes from the valid set. -func (l *lexer) acceptRun(valid string) { - for strings.ContainsRune(valid, l.next()) { - } - l.backup() -} - -// errorf returns an error token and terminates the scan by passing -// back a nil pointer that will be the next state, terminating l.nextItem. -func (l *lexer) errorf(format string, args ...interface{}) stateFn { - l.items <- item{itemError, l.start, fmt.Sprintf(format, args...), l.startLine} - return nil -} - -// nextItem returns the next item from the input. -// Called by the parser, not in the lexing goroutine. -func (l *lexer) nextItem() item { - return <-l.items -} - -// drain drains the output so the lexing goroutine will exit. -// Called by the parser, not in the lexing goroutine. -func (l *lexer) drain() { - for range l.items { - } -} - -// lex creates a new scanner for the input string. -func lex(name, input, left, right string, emitComment bool) *lexer { - if left == "" { - left = leftDelim - } - if right == "" { - right = rightDelim - } - l := &lexer{ - name: name, - input: input, - leftDelim: left, - rightDelim: right, - emitComment: emitComment, - items: make(chan item), - line: 1, - startLine: 1, - } - go l.run() - return l -} - -// run runs the state machine for the lexer. -func (l *lexer) run() { - for state := lexText; state != nil; { - state = state(l) - } - close(l.items) -} - -// state functions - -const ( - leftDelim = "{{" - rightDelim = "}}" - leftComment = "/*" - rightComment = "*/" -) - -// lexText scans until an opening action delimiter, "{{". -func lexText(l *lexer) stateFn { - l.width = 0 - if x := strings.Index(l.input[l.pos:], l.leftDelim); x >= 0 { - ldn := Pos(len(l.leftDelim)) - l.pos += Pos(x) - trimLength := Pos(0) - if hasLeftTrimMarker(l.input[l.pos+ldn:]) { - trimLength = rightTrimLength(l.input[l.start:l.pos]) - } - l.pos -= trimLength - if l.pos > l.start { - l.line += strings.Count(l.input[l.start:l.pos], "\n") - l.emit(itemText) - } - l.pos += trimLength - l.ignore() - return lexLeftDelim - } - l.pos = Pos(len(l.input)) - // Correctly reached EOF. - if l.pos > l.start { - l.line += strings.Count(l.input[l.start:l.pos], "\n") - l.emit(itemText) - } - l.emit(itemEOF) - return nil -} - -// rightTrimLength returns the length of the spaces at the end of the string. -func rightTrimLength(s string) Pos { - return Pos(len(s) - len(strings.TrimRight(s, spaceChars))) -} - -// atRightDelim reports whether the lexer is at a right delimiter, possibly preceded by a trim marker. -func (l *lexer) atRightDelim() (delim, trimSpaces bool) { - if hasRightTrimMarker(l.input[l.pos:]) && strings.HasPrefix(l.input[l.pos+trimMarkerLen:], l.rightDelim) { // With trim marker. - return true, true - } - if strings.HasPrefix(l.input[l.pos:], l.rightDelim) { // Without trim marker. - return true, false - } - return false, false -} - -// leftTrimLength returns the length of the spaces at the beginning of the string. -func leftTrimLength(s string) Pos { - return Pos(len(s) - len(strings.TrimLeft(s, spaceChars))) -} - -// lexLeftDelim scans the left delimiter, which is known to be present, possibly with a trim marker. -func lexLeftDelim(l *lexer) stateFn { - l.pos += Pos(len(l.leftDelim)) - trimSpace := hasLeftTrimMarker(l.input[l.pos:]) - afterMarker := Pos(0) - if trimSpace { - afterMarker = trimMarkerLen - } - if strings.HasPrefix(l.input[l.pos+afterMarker:], leftComment) { - l.pos += afterMarker - l.ignore() - return lexComment - } - l.emit(itemLeftDelim) - l.pos += afterMarker - l.ignore() - l.parenDepth = 0 - return lexInsideAction -} - -// lexComment scans a comment. The left comment marker is known to be present. -func lexComment(l *lexer) stateFn { - l.pos += Pos(len(leftComment)) - i := strings.Index(l.input[l.pos:], rightComment) - if i < 0 { - return l.errorf("unclosed comment") - } - l.pos += Pos(i + len(rightComment)) - delim, trimSpace := l.atRightDelim() - if !delim { - return l.errorf("comment ends before closing delimiter") - } - if l.emitComment { - l.emit(itemComment) - } - if trimSpace { - l.pos += trimMarkerLen - } - l.pos += Pos(len(l.rightDelim)) - if trimSpace { - l.pos += leftTrimLength(l.input[l.pos:]) - } - l.ignore() - return lexText -} - -// lexRightDelim scans the right delimiter, which is known to be present, possibly with a trim marker. -func lexRightDelim(l *lexer) stateFn { - trimSpace := hasRightTrimMarker(l.input[l.pos:]) - if trimSpace { - l.pos += trimMarkerLen - l.ignore() - } - l.pos += Pos(len(l.rightDelim)) - l.emit(itemRightDelim) - if trimSpace { - l.pos += leftTrimLength(l.input[l.pos:]) - l.ignore() - } - return lexText -} - -// lexInsideAction scans the elements inside action delimiters. -func lexInsideAction(l *lexer) stateFn { - // Either number, quoted string, or identifier. - // Spaces separate arguments; runs of spaces turn into itemSpace. - // Pipe symbols separate and are emitted. - delim, _ := l.atRightDelim() - if delim { - if l.parenDepth == 0 { - return lexRightDelim - } - return l.errorf("unclosed left paren") - } - switch r := l.next(); { - case r == eof: - return l.errorf("unclosed action") - case isSpace(r): - l.backup() // Put space back in case we have " -}}". - return lexSpace - case r == '=': - l.emit(itemAssign) - case r == ':': - if l.next() != '=' { - return l.errorf("expected :=") - } - l.emit(itemDeclare) - case r == '|': - l.emit(itemPipe) - case r == '"': - return lexQuote - case r == '`': - return lexRawQuote - case r == '$': - return lexVariable - case r == '\'': - return lexChar - case r == '.': - // special look-ahead for ".field" so we don't break l.backup(). - if l.pos < Pos(len(l.input)) { - r := l.input[l.pos] - if r < '0' || '9' < r { - return lexField - } - } - fallthrough // '.' can start a number. - case r == '+' || r == '-' || ('0' <= r && r <= '9'): - l.backup() - return lexNumber - case isAlphaNumeric(r): - l.backup() - return lexIdentifier - case r == '(': - l.emit(itemLeftParen) - l.parenDepth++ - case r == ')': - l.emit(itemRightParen) - l.parenDepth-- - if l.parenDepth < 0 { - return l.errorf("unexpected right paren %#U", r) - } - case r <= unicode.MaxASCII && unicode.IsPrint(r): - l.emit(itemChar) - default: - return l.errorf("unrecognized character in action: %#U", r) - } - return lexInsideAction -} - -// lexSpace scans a run of space characters. -// We have not consumed the first space, which is known to be present. -// Take care if there is a trim-marked right delimiter, which starts with a space. -func lexSpace(l *lexer) stateFn { - var r rune - var numSpaces int - for { - r = l.peek() - if !isSpace(r) { - break - } - l.next() - numSpaces++ - } - // Be careful about a trim-marked closing delimiter, which has a minus - // after a space. We know there is a space, so check for the '-' that might follow. - if hasRightTrimMarker(l.input[l.pos-1:]) && strings.HasPrefix(l.input[l.pos-1+trimMarkerLen:], l.rightDelim) { - l.backup() // Before the space. - if numSpaces == 1 { - return lexRightDelim // On the delim, so go right to that. - } - } - l.emit(itemSpace) - return lexInsideAction -} - -// lexIdentifier scans an alphanumeric. -func lexIdentifier(l *lexer) stateFn { -Loop: - for { - switch r := l.next(); { - case isAlphaNumeric(r): - // absorb. - default: - l.backup() - word := l.input[l.start:l.pos] - if !l.atTerminator() { - return l.errorf("bad character %#U", r) - } - switch { - case key[word] > itemKeyword: - l.emit(key[word]) - case word[0] == '.': - l.emit(itemField) - case word == "true", word == "false": - l.emit(itemBool) - default: - l.emit(itemIdentifier) - } - break Loop - } - } - return lexInsideAction -} - -// lexField scans a field: .Alphanumeric. -// The . has been scanned. -func lexField(l *lexer) stateFn { - return lexFieldOrVariable(l, itemField) -} - -// lexVariable scans a Variable: $Alphanumeric. -// The $ has been scanned. -func lexVariable(l *lexer) stateFn { - if l.atTerminator() { // Nothing interesting follows -> "$". - l.emit(itemVariable) - return lexInsideAction - } - return lexFieldOrVariable(l, itemVariable) -} - -// lexVariable scans a field or variable: [.$]Alphanumeric. -// The . or $ has been scanned. -func lexFieldOrVariable(l *lexer, typ itemType) stateFn { - if l.atTerminator() { // Nothing interesting follows -> "." or "$". - if typ == itemVariable { - l.emit(itemVariable) - } else { - l.emit(itemDot) - } - return lexInsideAction - } - var r rune - for { - r = l.next() - if !isAlphaNumeric(r) { - l.backup() - break - } - } - if !l.atTerminator() { - return l.errorf("bad character %#U", r) - } - l.emit(typ) - return lexInsideAction -} - -// atTerminator reports whether the input is at valid termination character to -// appear after an identifier. Breaks .X.Y into two pieces. Also catches cases -// like "$x+2" not being acceptable without a space, in case we decide one -// day to implement arithmetic. -func (l *lexer) atTerminator() bool { - r := l.peek() - if isSpace(r) { - return true - } - switch r { - case eof, '.', ',', '|', ':', ')', '(': - return true - } - // Does r start the delimiter? This can be ambiguous (with delim=="//", $x/2 will - // succeed but should fail) but only in extremely rare cases caused by willfully - // bad choice of delimiter. - if rd, _ := utf8.DecodeRuneInString(l.rightDelim); rd == r { - return true - } - return false -} - -// lexChar scans a character constant. The initial quote is already -// scanned. Syntax checking is done by the parser. -func lexChar(l *lexer) stateFn { -Loop: - for { - switch l.next() { - case '\\': - if r := l.next(); r != eof && r != '\n' { - break - } - fallthrough - case eof, '\n': - return l.errorf("unterminated character constant") - case '\'': - break Loop - } - } - l.emit(itemCharConstant) - return lexInsideAction -} - -// lexNumber scans a number: decimal, octal, hex, float, or imaginary. This -// isn't a perfect number scanner - for instance it accepts "." and "0x0.2" -// and "089" - but when it's wrong the input is invalid and the parser (via -// strconv) will notice. -func lexNumber(l *lexer) stateFn { - if !l.scanNumber() { - return l.errorf("bad number syntax: %q", l.input[l.start:l.pos]) - } - if sign := l.peek(); sign == '+' || sign == '-' { - // Complex: 1+2i. No spaces, must end in 'i'. - if !l.scanNumber() || l.input[l.pos-1] != 'i' { - return l.errorf("bad number syntax: %q", l.input[l.start:l.pos]) - } - l.emit(itemComplex) - } else { - l.emit(itemNumber) - } - return lexInsideAction -} - -func (l *lexer) scanNumber() bool { - // Optional leading sign. - l.accept("+-") - // Is it hex? - digits := "0123456789_" - if l.accept("0") { - // Note: Leading 0 does not mean octal in floats. - if l.accept("xX") { - digits = "0123456789abcdefABCDEF_" - } else if l.accept("oO") { - digits = "01234567_" - } else if l.accept("bB") { - digits = "01_" - } - } - l.acceptRun(digits) - if l.accept(".") { - l.acceptRun(digits) - } - if len(digits) == 10+1 && l.accept("eE") { - l.accept("+-") - l.acceptRun("0123456789_") - } - if len(digits) == 16+6+1 && l.accept("pP") { - l.accept("+-") - l.acceptRun("0123456789_") - } - // Is it imaginary? - l.accept("i") - // Next thing mustn't be alphanumeric. - if isAlphaNumeric(l.peek()) { - l.next() - return false - } - return true -} - -// lexQuote scans a quoted string. -func lexQuote(l *lexer) stateFn { -Loop: - for { - switch l.next() { - case '\\': - if r := l.next(); r != eof && r != '\n' { - break - } - fallthrough - case eof, '\n': - return l.errorf("unterminated quoted string") - case '"': - break Loop - } - } - l.emit(itemString) - return lexInsideAction -} - -// lexRawQuote scans a raw quoted string. -func lexRawQuote(l *lexer) stateFn { -Loop: - for { - switch l.next() { - case eof: - return l.errorf("unterminated raw quoted string") - case '`': - break Loop - } - } - l.emit(itemRawString) - return lexInsideAction -} - -// isSpace reports whether r is a space character. -func isSpace(r rune) bool { - return r == ' ' || r == '\t' || r == '\r' || r == '\n' -} - -// isAlphaNumeric reports whether r is an alphabetic, digit, or underscore. -func isAlphaNumeric(r rune) bool { - return r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r) -} - -func hasLeftTrimMarker(s string) bool { - return len(s) >= 2 && s[0] == trimMarker && isSpace(rune(s[1])) -} - -func hasRightTrimMarker(s string) bool { - return len(s) >= 2 && isSpace(rune(s[0])) && s[1] == trimMarker -} diff --git a/vendor/rsc.io/tmplfunc/internal/parse/node.go b/vendor/rsc.io/tmplfunc/internal/parse/node.go deleted file mode 100644 index 177482f9b..000000000 --- a/vendor/rsc.io/tmplfunc/internal/parse/node.go +++ /dev/null @@ -1,972 +0,0 @@ -// Copyright 2011 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. - -// Parse nodes. - -package parse - -import ( - "fmt" - "strconv" - "strings" -) - -var textFormat = "%s" // Changed to "%q" in tests for better error messages. - -// A Node is an element in the parse tree. The interface is trivial. -// The interface contains an unexported method so that only -// types local to this package can satisfy it. -type Node interface { - Type() NodeType - String() string - // Copy does a deep copy of the Node and all its components. - // To avoid type assertions, some XxxNodes also have specialized - // CopyXxx methods that return *XxxNode. - Copy() Node - Position() Pos // byte position of start of node in full original input string - // tree returns the containing *Tree. - // It is unexported so all implementations of Node are in this package. - tree() *Tree - // writeTo writes the String output to the builder. - writeTo(*strings.Builder) -} - -// NodeType identifies the type of a parse tree node. -type NodeType int - -// Pos represents a byte position in the original input text from which -// this template was parsed. -type Pos int - -func (p Pos) Position() Pos { - return p -} - -// Type returns itself and provides an easy default implementation -// for embedding in a Node. Embedded in all non-trivial Nodes. -func (t NodeType) Type() NodeType { - return t -} - -const ( - NodeText NodeType = iota // Plain text. - NodeAction // A non-control action such as a field evaluation. - NodeBool // A boolean constant. - NodeChain // A sequence of field accesses. - NodeCommand // An element of a pipeline. - NodeDot // The cursor, dot. - nodeElse // An else action. Not added to tree. - nodeEnd // An end action. Not added to tree. - NodeField // A field or method name. - NodeIdentifier // An identifier; always a function name. - NodeIf // An if action. - NodeList // A list of Nodes. - NodeNil // An untyped nil constant. - NodeNumber // A numerical constant. - NodePipe // A pipeline of commands. - NodeRange // A range action. - NodeString // A string constant. - NodeTemplate // A template invocation action. - NodeVariable // A $ variable. - NodeWith // A with action. - NodeComment // A comment. -) - -// Nodes. - -// ListNode holds a sequence of nodes. -type ListNode struct { - NodeType - Pos - tr *Tree - Nodes []Node // The element nodes in lexical order. -} - -func (t *Tree) newList(pos Pos) *ListNode { - return &ListNode{tr: t, NodeType: NodeList, Pos: pos} -} - -func (l *ListNode) append(n Node) { - l.Nodes = append(l.Nodes, n) -} - -func (l *ListNode) tree() *Tree { - return l.tr -} - -func (l *ListNode) String() string { - var sb strings.Builder - l.writeTo(&sb) - return sb.String() -} - -func (l *ListNode) writeTo(sb *strings.Builder) { - for _, n := range l.Nodes { - n.writeTo(sb) - } -} - -func (l *ListNode) CopyList() *ListNode { - if l == nil { - return l - } - n := l.tr.newList(l.Pos) - for _, elem := range l.Nodes { - n.append(elem.Copy()) - } - return n -} - -func (l *ListNode) Copy() Node { - return l.CopyList() -} - -// TextNode holds plain text. -type TextNode struct { - NodeType - Pos - tr *Tree - Text []byte // The text; may span newlines. -} - -func (t *Tree) newText(pos Pos, text string) *TextNode { - return &TextNode{tr: t, NodeType: NodeText, Pos: pos, Text: []byte(text)} -} - -func (t *TextNode) String() string { - return fmt.Sprintf(textFormat, t.Text) -} - -func (t *TextNode) writeTo(sb *strings.Builder) { - sb.WriteString(t.String()) -} - -func (t *TextNode) tree() *Tree { - return t.tr -} - -func (t *TextNode) Copy() Node { - return &TextNode{tr: t.tr, NodeType: NodeText, Pos: t.Pos, Text: append([]byte{}, t.Text...)} -} - -// CommentNode holds a comment. -type CommentNode struct { - NodeType - Pos - tr *Tree - Text string // Comment text. -} - -func (t *Tree) newComment(pos Pos, text string) *CommentNode { - return &CommentNode{tr: t, NodeType: NodeComment, Pos: pos, Text: text} -} - -func (c *CommentNode) String() string { - var sb strings.Builder - c.writeTo(&sb) - return sb.String() -} - -func (c *CommentNode) writeTo(sb *strings.Builder) { - sb.WriteString("{{") - sb.WriteString(c.Text) - sb.WriteString("}}") -} - -func (c *CommentNode) tree() *Tree { - return c.tr -} - -func (c *CommentNode) Copy() Node { - return &CommentNode{tr: c.tr, NodeType: NodeComment, Pos: c.Pos, Text: c.Text} -} - -// PipeNode holds a pipeline with optional declaration -type PipeNode struct { - NodeType - Pos - tr *Tree - Line int // The line number in the input. Deprecated: Kept for compatibility. - IsAssign bool // The variables are being assigned, not declared. - Decl []*VariableNode // Variables in lexical order. - Cmds []*CommandNode // The commands in lexical order. -} - -func (t *Tree) newPipeline(pos Pos, line int, vars []*VariableNode) *PipeNode { - return &PipeNode{tr: t, NodeType: NodePipe, Pos: pos, Line: line, Decl: vars} -} - -func (p *PipeNode) append(command *CommandNode) { - p.Cmds = append(p.Cmds, command) -} - -func (p *PipeNode) String() string { - var sb strings.Builder - p.writeTo(&sb) - return sb.String() -} - -func (p *PipeNode) writeTo(sb *strings.Builder) { - if len(p.Decl) > 0 { - for i, v := range p.Decl { - if i > 0 { - sb.WriteString(", ") - } - v.writeTo(sb) - } - sb.WriteString(" := ") - } - for i, c := range p.Cmds { - if i > 0 { - sb.WriteString(" | ") - } - c.writeTo(sb) - } -} - -func (p *PipeNode) tree() *Tree { - return p.tr -} - -func (p *PipeNode) CopyPipe() *PipeNode { - if p == nil { - return p - } - vars := make([]*VariableNode, len(p.Decl)) - for i, d := range p.Decl { - vars[i] = d.Copy().(*VariableNode) - } - n := p.tr.newPipeline(p.Pos, p.Line, vars) - n.IsAssign = p.IsAssign - for _, c := range p.Cmds { - n.append(c.Copy().(*CommandNode)) - } - return n -} - -func (p *PipeNode) Copy() Node { - return p.CopyPipe() -} - -// ActionNode holds an action (something bounded by delimiters). -// Control actions have their own nodes; ActionNode represents simple -// ones such as field evaluations and parenthesized pipelines. -type ActionNode struct { - NodeType - Pos - tr *Tree - Line int // The line number in the input. Deprecated: Kept for compatibility. - Pipe *PipeNode // The pipeline in the action. -} - -func (t *Tree) newAction(pos Pos, line int, pipe *PipeNode) *ActionNode { - return &ActionNode{tr: t, NodeType: NodeAction, Pos: pos, Line: line, Pipe: pipe} -} - -func (a *ActionNode) String() string { - var sb strings.Builder - a.writeTo(&sb) - return sb.String() -} - -func (a *ActionNode) writeTo(sb *strings.Builder) { - sb.WriteString("{{") - a.Pipe.writeTo(sb) - sb.WriteString("}}") -} - -func (a *ActionNode) tree() *Tree { - return a.tr -} - -func (a *ActionNode) Copy() Node { - return a.tr.newAction(a.Pos, a.Line, a.Pipe.CopyPipe()) - -} - -// CommandNode holds a command (a pipeline inside an evaluating action). -type CommandNode struct { - NodeType - Pos - tr *Tree - Args []Node // Arguments in lexical order: Identifier, field, or constant. -} - -func (t *Tree) newCommand(pos Pos) *CommandNode { - return &CommandNode{tr: t, NodeType: NodeCommand, Pos: pos} -} - -func (c *CommandNode) append(arg Node) { - c.Args = append(c.Args, arg) -} - -func (c *CommandNode) String() string { - var sb strings.Builder - c.writeTo(&sb) - return sb.String() -} - -func (c *CommandNode) writeTo(sb *strings.Builder) { - for i, arg := range c.Args { - if i > 0 { - sb.WriteByte(' ') - } - if arg, ok := arg.(*PipeNode); ok { - sb.WriteByte('(') - arg.writeTo(sb) - sb.WriteByte(')') - continue - } - arg.writeTo(sb) - } -} - -func (c *CommandNode) tree() *Tree { - return c.tr -} - -func (c *CommandNode) Copy() Node { - if c == nil { - return c - } - n := c.tr.newCommand(c.Pos) - for _, c := range c.Args { - n.append(c.Copy()) - } - return n -} - -// IdentifierNode holds an identifier. -type IdentifierNode struct { - NodeType - Pos - tr *Tree - Ident string // The identifier's name. -} - -// NewIdentifier returns a new IdentifierNode with the given identifier name. -func NewIdentifier(ident string) *IdentifierNode { - return &IdentifierNode{NodeType: NodeIdentifier, Ident: ident} -} - -// SetPos sets the position. NewIdentifier is a public method so we can't modify its signature. -// Chained for convenience. -// TODO: fix one day? -func (i *IdentifierNode) SetPos(pos Pos) *IdentifierNode { - i.Pos = pos - return i -} - -// SetTree sets the parent tree for the node. NewIdentifier is a public method so we can't modify its signature. -// Chained for convenience. -// TODO: fix one day? -func (i *IdentifierNode) SetTree(t *Tree) *IdentifierNode { - i.tr = t - return i -} - -func (i *IdentifierNode) String() string { - return i.Ident -} - -func (i *IdentifierNode) writeTo(sb *strings.Builder) { - sb.WriteString(i.String()) -} - -func (i *IdentifierNode) tree() *Tree { - return i.tr -} - -func (i *IdentifierNode) Copy() Node { - return NewIdentifier(i.Ident).SetTree(i.tr).SetPos(i.Pos) -} - -// VariableNode holds a list of variable names, possibly with chained field -// accesses. The dollar sign is part of the (first) name. -type VariableNode struct { - NodeType - Pos - tr *Tree - Ident []string // Variable name and fields in lexical order. -} - -func (t *Tree) newVariable(pos Pos, ident string) *VariableNode { - return &VariableNode{tr: t, NodeType: NodeVariable, Pos: pos, Ident: strings.Split(ident, ".")} -} - -func (v *VariableNode) String() string { - var sb strings.Builder - v.writeTo(&sb) - return sb.String() -} - -func (v *VariableNode) writeTo(sb *strings.Builder) { - for i, id := range v.Ident { - if i > 0 { - sb.WriteByte('.') - } - sb.WriteString(id) - } -} - -func (v *VariableNode) tree() *Tree { - return v.tr -} - -func (v *VariableNode) Copy() Node { - return &VariableNode{tr: v.tr, NodeType: NodeVariable, Pos: v.Pos, Ident: append([]string{}, v.Ident...)} -} - -// DotNode holds the special identifier '.'. -type DotNode struct { - NodeType - Pos - tr *Tree -} - -func (t *Tree) newDot(pos Pos) *DotNode { - return &DotNode{tr: t, NodeType: NodeDot, Pos: pos} -} - -func (d *DotNode) Type() NodeType { - // Override method on embedded NodeType for API compatibility. - // TODO: Not really a problem; could change API without effect but - // api tool complains. - return NodeDot -} - -func (d *DotNode) String() string { - return "." -} - -func (d *DotNode) writeTo(sb *strings.Builder) { - sb.WriteString(d.String()) -} - -func (d *DotNode) tree() *Tree { - return d.tr -} - -func (d *DotNode) Copy() Node { - return d.tr.newDot(d.Pos) -} - -// NilNode holds the special identifier 'nil' representing an untyped nil constant. -type NilNode struct { - NodeType - Pos - tr *Tree -} - -func (t *Tree) newNil(pos Pos) *NilNode { - return &NilNode{tr: t, NodeType: NodeNil, Pos: pos} -} - -func (n *NilNode) Type() NodeType { - // Override method on embedded NodeType for API compatibility. - // TODO: Not really a problem; could change API without effect but - // api tool complains. - return NodeNil -} - -func (n *NilNode) String() string { - return "nil" -} - -func (n *NilNode) writeTo(sb *strings.Builder) { - sb.WriteString(n.String()) -} - -func (n *NilNode) tree() *Tree { - return n.tr -} - -func (n *NilNode) Copy() Node { - return n.tr.newNil(n.Pos) -} - -// FieldNode holds a field (identifier starting with '.'). -// The names may be chained ('.x.y'). -// The period is dropped from each ident. -type FieldNode struct { - NodeType - Pos - tr *Tree - Ident []string // The identifiers in lexical order. -} - -func (t *Tree) newField(pos Pos, ident string) *FieldNode { - return &FieldNode{tr: t, NodeType: NodeField, Pos: pos, Ident: strings.Split(ident[1:], ".")} // [1:] to drop leading period -} - -func (f *FieldNode) String() string { - var sb strings.Builder - f.writeTo(&sb) - return sb.String() -} - -func (f *FieldNode) writeTo(sb *strings.Builder) { - for _, id := range f.Ident { - sb.WriteByte('.') - sb.WriteString(id) - } -} - -func (f *FieldNode) tree() *Tree { - return f.tr -} - -func (f *FieldNode) Copy() Node { - return &FieldNode{tr: f.tr, NodeType: NodeField, Pos: f.Pos, Ident: append([]string{}, f.Ident...)} -} - -// ChainNode holds a term followed by a chain of field accesses (identifier starting with '.'). -// The names may be chained ('.x.y'). -// The periods are dropped from each ident. -type ChainNode struct { - NodeType - Pos - tr *Tree - Node Node - Field []string // The identifiers in lexical order. -} - -func (t *Tree) newChain(pos Pos, node Node) *ChainNode { - return &ChainNode{tr: t, NodeType: NodeChain, Pos: pos, Node: node} -} - -// Add adds the named field (which should start with a period) to the end of the chain. -func (c *ChainNode) Add(field string) { - if len(field) == 0 || field[0] != '.' { - panic("no dot in field") - } - field = field[1:] // Remove leading dot. - if field == "" { - panic("empty field") - } - c.Field = append(c.Field, field) -} - -func (c *ChainNode) String() string { - var sb strings.Builder - c.writeTo(&sb) - return sb.String() -} - -func (c *ChainNode) writeTo(sb *strings.Builder) { - if _, ok := c.Node.(*PipeNode); ok { - sb.WriteByte('(') - c.Node.writeTo(sb) - sb.WriteByte(')') - } else { - c.Node.writeTo(sb) - } - for _, field := range c.Field { - sb.WriteByte('.') - sb.WriteString(field) - } -} - -func (c *ChainNode) tree() *Tree { - return c.tr -} - -func (c *ChainNode) Copy() Node { - return &ChainNode{tr: c.tr, NodeType: NodeChain, Pos: c.Pos, Node: c.Node, Field: append([]string{}, c.Field...)} -} - -// BoolNode holds a boolean constant. -type BoolNode struct { - NodeType - Pos - tr *Tree - True bool // The value of the boolean constant. -} - -func (t *Tree) newBool(pos Pos, true bool) *BoolNode { - return &BoolNode{tr: t, NodeType: NodeBool, Pos: pos, True: true} -} - -func (b *BoolNode) String() string { - if b.True { - return "true" - } - return "false" -} - -func (b *BoolNode) writeTo(sb *strings.Builder) { - sb.WriteString(b.String()) -} - -func (b *BoolNode) tree() *Tree { - return b.tr -} - -func (b *BoolNode) Copy() Node { - return b.tr.newBool(b.Pos, b.True) -} - -// NumberNode holds a number: signed or unsigned integer, float, or complex. -// The value is parsed and stored under all the types that can represent the value. -// This simulates in a small amount of code the behavior of Go's ideal constants. -type NumberNode struct { - NodeType - Pos - tr *Tree - IsInt bool // Number has an integral value. - IsUint bool // Number has an unsigned integral value. - IsFloat bool // Number has a floating-point value. - IsComplex bool // Number is complex. - Int64 int64 // The signed integer value. - Uint64 uint64 // The unsigned integer value. - Float64 float64 // The floating-point value. - Complex128 complex128 // The complex value. - Text string // The original textual representation from the input. -} - -func (t *Tree) newNumber(pos Pos, text string, typ itemType) (*NumberNode, error) { - n := &NumberNode{tr: t, NodeType: NodeNumber, Pos: pos, Text: text} - switch typ { - case itemCharConstant: - rune, _, tail, err := strconv.UnquoteChar(text[1:], text[0]) - if err != nil { - return nil, err - } - if tail != "'" { - return nil, fmt.Errorf("malformed character constant: %s", text) - } - n.Int64 = int64(rune) - n.IsInt = true - n.Uint64 = uint64(rune) - n.IsUint = true - n.Float64 = float64(rune) // odd but those are the rules. - n.IsFloat = true - return n, nil - case itemComplex: - // fmt.Sscan can parse the pair, so let it do the work. - if _, err := fmt.Sscan(text, &n.Complex128); err != nil { - return nil, err - } - n.IsComplex = true - n.simplifyComplex() - return n, nil - } - // Imaginary constants can only be complex unless they are zero. - if len(text) > 0 && text[len(text)-1] == 'i' { - f, err := strconv.ParseFloat(text[:len(text)-1], 64) - if err == nil { - n.IsComplex = true - n.Complex128 = complex(0, f) - n.simplifyComplex() - return n, nil - } - } - // Do integer test first so we get 0x123 etc. - u, err := strconv.ParseUint(text, 0, 64) // will fail for -0; fixed below. - if err == nil { - n.IsUint = true - n.Uint64 = u - } - i, err := strconv.ParseInt(text, 0, 64) - if err == nil { - n.IsInt = true - n.Int64 = i - if i == 0 { - n.IsUint = true // in case of -0. - n.Uint64 = u - } - } - // If an integer extraction succeeded, promote the float. - if n.IsInt { - n.IsFloat = true - n.Float64 = float64(n.Int64) - } else if n.IsUint { - n.IsFloat = true - n.Float64 = float64(n.Uint64) - } else { - f, err := strconv.ParseFloat(text, 64) - if err == nil { - // If we parsed it as a float but it looks like an integer, - // it's a huge number too large to fit in an int. Reject it. - if !strings.ContainsAny(text, ".eEpP") { - return nil, fmt.Errorf("integer overflow: %q", text) - } - n.IsFloat = true - n.Float64 = f - // If a floating-point extraction succeeded, extract the int if needed. - if !n.IsInt && float64(int64(f)) == f { - n.IsInt = true - n.Int64 = int64(f) - } - if !n.IsUint && float64(uint64(f)) == f { - n.IsUint = true - n.Uint64 = uint64(f) - } - } - } - if !n.IsInt && !n.IsUint && !n.IsFloat { - return nil, fmt.Errorf("illegal number syntax: %q", text) - } - return n, nil -} - -// simplifyComplex pulls out any other types that are represented by the complex number. -// These all require that the imaginary part be zero. -func (n *NumberNode) simplifyComplex() { - n.IsFloat = imag(n.Complex128) == 0 - if n.IsFloat { - n.Float64 = real(n.Complex128) - n.IsInt = float64(int64(n.Float64)) == n.Float64 - if n.IsInt { - n.Int64 = int64(n.Float64) - } - n.IsUint = float64(uint64(n.Float64)) == n.Float64 - if n.IsUint { - n.Uint64 = uint64(n.Float64) - } - } -} - -func (n *NumberNode) String() string { - return n.Text -} - -func (n *NumberNode) writeTo(sb *strings.Builder) { - sb.WriteString(n.String()) -} - -func (n *NumberNode) tree() *Tree { - return n.tr -} - -func (n *NumberNode) Copy() Node { - nn := new(NumberNode) - *nn = *n // Easy, fast, correct. - return nn -} - -// StringNode holds a string constant. The value has been "unquoted". -type StringNode struct { - NodeType - Pos - tr *Tree - Quoted string // The original text of the string, with quotes. - Text string // The string, after quote processing. -} - -func (t *Tree) newString(pos Pos, orig, text string) *StringNode { - return &StringNode{tr: t, NodeType: NodeString, Pos: pos, Quoted: orig, Text: text} -} - -func (s *StringNode) String() string { - return s.Quoted -} - -func (s *StringNode) writeTo(sb *strings.Builder) { - sb.WriteString(s.String()) -} - -func (s *StringNode) tree() *Tree { - return s.tr -} - -func (s *StringNode) Copy() Node { - return s.tr.newString(s.Pos, s.Quoted, s.Text) -} - -// endNode represents an {{end}} action. -// It does not appear in the final parse tree. -type endNode struct { - NodeType - Pos - tr *Tree -} - -func (t *Tree) newEnd(pos Pos) *endNode { - return &endNode{tr: t, NodeType: nodeEnd, Pos: pos} -} - -func (e *endNode) String() string { - return "{{end}}" -} - -func (e *endNode) writeTo(sb *strings.Builder) { - sb.WriteString(e.String()) -} - -func (e *endNode) tree() *Tree { - return e.tr -} - -func (e *endNode) Copy() Node { - return e.tr.newEnd(e.Pos) -} - -// elseNode represents an {{else}} action. Does not appear in the final tree. -type elseNode struct { - NodeType - Pos - tr *Tree - Line int // The line number in the input. Deprecated: Kept for compatibility. -} - -func (t *Tree) newElse(pos Pos, line int) *elseNode { - return &elseNode{tr: t, NodeType: nodeElse, Pos: pos, Line: line} -} - -func (e *elseNode) Type() NodeType { - return nodeElse -} - -func (e *elseNode) String() string { - return "{{else}}" -} - -func (e *elseNode) writeTo(sb *strings.Builder) { - sb.WriteString(e.String()) -} - -func (e *elseNode) tree() *Tree { - return e.tr -} - -func (e *elseNode) Copy() Node { - return e.tr.newElse(e.Pos, e.Line) -} - -// BranchNode is the common representation of if, range, and with. -type BranchNode struct { - NodeType - Pos - tr *Tree - Line int // The line number in the input. Deprecated: Kept for compatibility. - Pipe *PipeNode // The pipeline to be evaluated. - List *ListNode // What to execute if the value is non-empty. - ElseList *ListNode // What to execute if the value is empty (nil if absent). -} - -func (b *BranchNode) String() string { - var sb strings.Builder - b.writeTo(&sb) - return sb.String() -} - -func (b *BranchNode) writeTo(sb *strings.Builder) { - name := "" - switch b.NodeType { - case NodeIf: - name = "if" - case NodeRange: - name = "range" - case NodeWith: - name = "with" - default: - panic("unknown branch type") - } - sb.WriteString("{{") - sb.WriteString(name) - sb.WriteByte(' ') - b.Pipe.writeTo(sb) - sb.WriteString("}}") - b.List.writeTo(sb) - if b.ElseList != nil { - sb.WriteString("{{else}}") - b.ElseList.writeTo(sb) - } - sb.WriteString("{{end}}") -} - -func (b *BranchNode) tree() *Tree { - return b.tr -} - -func (b *BranchNode) Copy() Node { - switch b.NodeType { - case NodeIf: - return b.tr.newIf(b.Pos, b.Line, b.Pipe, b.List, b.ElseList) - case NodeRange: - return b.tr.newRange(b.Pos, b.Line, b.Pipe, b.List, b.ElseList) - case NodeWith: - return b.tr.newWith(b.Pos, b.Line, b.Pipe, b.List, b.ElseList) - default: - panic("unknown branch type") - } -} - -// IfNode represents an {{if}} action and its commands. -type IfNode struct { - BranchNode -} - -func (t *Tree) newIf(pos Pos, line int, pipe *PipeNode, list, elseList *ListNode) *IfNode { - return &IfNode{BranchNode{tr: t, NodeType: NodeIf, Pos: pos, Line: line, Pipe: pipe, List: list, ElseList: elseList}} -} - -func (i *IfNode) Copy() Node { - return i.tr.newIf(i.Pos, i.Line, i.Pipe.CopyPipe(), i.List.CopyList(), i.ElseList.CopyList()) -} - -// RangeNode represents a {{range}} action and its commands. -type RangeNode struct { - BranchNode -} - -func (t *Tree) newRange(pos Pos, line int, pipe *PipeNode, list, elseList *ListNode) *RangeNode { - return &RangeNode{BranchNode{tr: t, NodeType: NodeRange, Pos: pos, Line: line, Pipe: pipe, List: list, ElseList: elseList}} -} - -func (r *RangeNode) Copy() Node { - return r.tr.newRange(r.Pos, r.Line, r.Pipe.CopyPipe(), r.List.CopyList(), r.ElseList.CopyList()) -} - -// WithNode represents a {{with}} action and its commands. -type WithNode struct { - BranchNode -} - -func (t *Tree) newWith(pos Pos, line int, pipe *PipeNode, list, elseList *ListNode) *WithNode { - return &WithNode{BranchNode{tr: t, NodeType: NodeWith, Pos: pos, Line: line, Pipe: pipe, List: list, ElseList: elseList}} -} - -func (w *WithNode) Copy() Node { - return w.tr.newWith(w.Pos, w.Line, w.Pipe.CopyPipe(), w.List.CopyList(), w.ElseList.CopyList()) -} - -// TemplateNode represents a {{template}} action. -type TemplateNode struct { - NodeType - Pos - tr *Tree - Line int // The line number in the input. Deprecated: Kept for compatibility. - Name string // The name of the template (unquoted). - Pipe *PipeNode // The command to evaluate as dot for the template. -} - -func (t *Tree) newTemplate(pos Pos, line int, name string, pipe *PipeNode) *TemplateNode { - return &TemplateNode{tr: t, NodeType: NodeTemplate, Pos: pos, Line: line, Name: name, Pipe: pipe} -} - -func (t *TemplateNode) String() string { - var sb strings.Builder - t.writeTo(&sb) - return sb.String() -} - -func (t *TemplateNode) writeTo(sb *strings.Builder) { - sb.WriteString("{{template ") - sb.WriteString(strconv.Quote(t.Name)) - if t.Pipe != nil { - sb.WriteByte(' ') - t.Pipe.writeTo(sb) - } - sb.WriteString("}}") -} - -func (t *TemplateNode) tree() *Tree { - return t.tr -} - -func (t *TemplateNode) Copy() Node { - return t.tr.newTemplate(t.Pos, t.Line, t.Name, t.Pipe.CopyPipe()) -} diff --git a/vendor/rsc.io/tmplfunc/internal/parse/parse.go b/vendor/rsc.io/tmplfunc/internal/parse/parse.go deleted file mode 100644 index 1a63961c1..000000000 --- a/vendor/rsc.io/tmplfunc/internal/parse/parse.go +++ /dev/null @@ -1,756 +0,0 @@ -// Copyright 2011 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 parse builds parse trees for templates as defined by text/template -// and html/template. Clients should use those packages to construct templates -// rather than this one, which provides shared internal data structures not -// intended for general use. -package parse - -import ( - "bytes" - "fmt" - "runtime" - "strconv" - "strings" -) - -// Tree is the representation of a single parsed template. -type Tree struct { - Name string // name of the template represented by the tree. - ParseName string // name of the top-level template during parsing, for error messages. - Root *ListNode // top-level root of the tree. - Mode Mode // parsing mode. - text string // text parsed to create the template (or its parent) - // Parsing only; cleared after parse. - funcs []map[string]interface{} - lex *lexer - token [3]item // three-token lookahead for parser. - peekCount int - vars []string // variables defined at the moment. - treeSet map[string]*Tree - actionLine int // line of left delim starting action - mode Mode -} - -// A mode value is a set of flags (or 0). Modes control parser behavior. -type Mode uint - -const ( - ParseComments Mode = 1 << iota // parse comments and add them to AST - SkipFuncCheck // do not check that functions are defined -) - -// Copy returns a copy of the Tree. Any parsing state is discarded. -func (t *Tree) Copy() *Tree { - if t == nil { - return nil - } - return &Tree{ - Name: t.Name, - ParseName: t.ParseName, - Root: t.Root.CopyList(), - text: t.text, - } -} - -// Parse returns a map from template name to parse.Tree, created by parsing the -// templates described in the argument string. The top-level template will be -// given the specified name. If an error is encountered, parsing stops and an -// empty map is returned with the error. -func Parse(name, text, leftDelim, rightDelim string, funcs ...map[string]interface{}) (map[string]*Tree, error) { - treeSet := make(map[string]*Tree) - t := New(name) - t.text = text - _, err := t.Parse(text, leftDelim, rightDelim, treeSet, funcs...) - return treeSet, err -} - -// next returns the next token. -func (t *Tree) next() item { - if t.peekCount > 0 { - t.peekCount-- - } else { - t.token[0] = t.lex.nextItem() - } - return t.token[t.peekCount] -} - -// backup backs the input stream up one token. -func (t *Tree) backup() { - t.peekCount++ -} - -// backup2 backs the input stream up two tokens. -// The zeroth token is already there. -func (t *Tree) backup2(t1 item) { - t.token[1] = t1 - t.peekCount = 2 -} - -// backup3 backs the input stream up three tokens -// The zeroth token is already there. -func (t *Tree) backup3(t2, t1 item) { // Reverse order: we're pushing back. - t.token[1] = t1 - t.token[2] = t2 - t.peekCount = 3 -} - -// peek returns but does not consume the next token. -func (t *Tree) peek() item { - if t.peekCount > 0 { - return t.token[t.peekCount-1] - } - t.peekCount = 1 - t.token[0] = t.lex.nextItem() - return t.token[0] -} - -// nextNonSpace returns the next non-space token. -func (t *Tree) nextNonSpace() (token item) { - for { - token = t.next() - if token.typ != itemSpace { - break - } - } - return token -} - -// peekNonSpace returns but does not consume the next non-space token. -func (t *Tree) peekNonSpace() item { - token := t.nextNonSpace() - t.backup() - return token -} - -// Parsing. - -// New allocates a new parse tree with the given name. -func New(name string, funcs ...map[string]interface{}) *Tree { - return &Tree{ - Name: name, - funcs: funcs, - } -} - -// ErrorContext returns a textual representation of the location of the node in the input text. -// The receiver is only used when the node does not have a pointer to the tree inside, -// which can occur in old code. -func (t *Tree) ErrorContext(n Node) (location, context string) { - pos := int(n.Position()) - tree := n.tree() - if tree == nil { - tree = t - } - text := tree.text[:pos] - byteNum := strings.LastIndex(text, "\n") - if byteNum == -1 { - byteNum = pos // On first line. - } else { - byteNum++ // After the newline. - byteNum = pos - byteNum - } - lineNum := 1 + strings.Count(text, "\n") - context = n.String() - return fmt.Sprintf("%s:%d:%d", tree.ParseName, lineNum, byteNum), context -} - -// errorf formats the error and terminates processing. -func (t *Tree) errorf(format string, args ...interface{}) { - t.Root = nil - format = fmt.Sprintf("template: %s:%d: %s", t.ParseName, t.token[0].line, format) - panic(fmt.Errorf(format, args...)) -} - -// error terminates processing. -func (t *Tree) error(err error) { - t.errorf("%s", err) -} - -// expect consumes the next token and guarantees it has the required type. -func (t *Tree) expect(expected itemType, context string) item { - token := t.nextNonSpace() - if token.typ != expected { - t.unexpected(token, context) - } - return token -} - -// expectOneOf consumes the next token and guarantees it has one of the required types. -func (t *Tree) expectOneOf(expected1, expected2 itemType, context string) item { - token := t.nextNonSpace() - if token.typ != expected1 && token.typ != expected2 { - t.unexpected(token, context) - } - return token -} - -// unexpected complains about the token and terminates processing. -func (t *Tree) unexpected(token item, context string) { - if token.typ == itemError { - extra := "" - if t.actionLine != 0 && t.actionLine != token.line { - extra = fmt.Sprintf(" in action started at %s:%d", t.ParseName, t.actionLine) - if strings.HasSuffix(token.val, " action") { - extra = extra[len(" in action"):] // avoid "action in action" - } - } - t.errorf("%s%s", token, extra) - } - t.errorf("unexpected %s in %s", token, context) -} - -// recover is the handler that turns panics into returns from the top level of Parse. -func (t *Tree) recover(errp *error) { - e := recover() - if e != nil { - if _, ok := e.(runtime.Error); ok { - panic(e) - } - if t != nil { - t.lex.drain() - t.stopParse() - } - *errp = e.(error) - } -} - -// startParse initializes the parser, using the lexer. -func (t *Tree) startParse(funcs []map[string]interface{}, lex *lexer, treeSet map[string]*Tree) { - t.Root = nil - t.lex = lex - t.vars = []string{"$"} - t.funcs = funcs - t.treeSet = treeSet -} - -// stopParse terminates parsing. -func (t *Tree) stopParse() { - t.lex = nil - t.vars = nil - t.funcs = nil - t.treeSet = nil -} - -// Parse parses the template definition string to construct a representation of -// the template for execution. If either action delimiter string is empty, the -// default ("{{" or "}}") is used. Embedded template definitions are added to -// the treeSet map. -func (t *Tree) Parse(text, leftDelim, rightDelim string, treeSet map[string]*Tree, funcs ...map[string]interface{}) (tree *Tree, err error) { - defer t.recover(&err) - t.ParseName = t.Name - emitComment := t.Mode&ParseComments != 0 - t.startParse(funcs, lex(t.Name, text, leftDelim, rightDelim, emitComment), treeSet) - t.text = text - t.parse() - t.add() - t.stopParse() - return t, nil -} - -// add adds tree to t.treeSet. -func (t *Tree) add() { - tree := t.treeSet[t.Name] - if tree == nil || IsEmptyTree(tree.Root) { - t.treeSet[t.Name] = t - return - } - if !IsEmptyTree(t.Root) { - t.errorf("template: multiple definition of template %q", t.Name) - } -} - -// IsEmptyTree reports whether this tree (node) is empty of everything but space or comments. -func IsEmptyTree(n Node) bool { - switch n := n.(type) { - case nil: - return true - case *ActionNode: - case *CommentNode: - return true - case *IfNode: - case *ListNode: - for _, node := range n.Nodes { - if !IsEmptyTree(node) { - return false - } - } - return true - case *RangeNode: - case *TemplateNode: - case *TextNode: - return len(bytes.TrimSpace(n.Text)) == 0 - case *WithNode: - default: - panic("unknown node: " + n.String()) - } - return false -} - -// parse is the top-level parser for a template, essentially the same -// as itemList except it also parses {{define}} actions. -// It runs to EOF. -func (t *Tree) parse() { - t.Root = t.newList(t.peek().pos) - for t.peek().typ != itemEOF { - if t.peek().typ == itemLeftDelim { - delim := t.next() - if t.nextNonSpace().typ == itemDefine { - newT := New("definition") // name will be updated once we know it. - newT.text = t.text - newT.Mode = t.Mode - newT.ParseName = t.ParseName - newT.startParse(t.funcs, t.lex, t.treeSet) - newT.parseDefinition() - continue - } - t.backup2(delim) - } - switch n := t.textOrAction(); n.Type() { - case nodeEnd, nodeElse: - t.errorf("unexpected %s", n) - default: - t.Root.append(n) - } - } -} - -// parseDefinition parses a {{define}} ... {{end}} template definition and -// installs the definition in t.treeSet. The "define" keyword has already -// been scanned. -func (t *Tree) parseDefinition() { - const context = "define clause" - name := t.expectOneOf(itemString, itemRawString, context) - var err error - t.Name, err = strconv.Unquote(name.val) - if err != nil { - t.error(err) - } - t.expect(itemRightDelim, context) - var end Node - t.Root, end = t.itemList() - if end.Type() != nodeEnd { - t.errorf("unexpected %s in %s", end, context) - } - t.add() - t.stopParse() -} - -// itemList: -// textOrAction* -// Terminates at {{end}} or {{else}}, returned separately. -func (t *Tree) itemList() (list *ListNode, next Node) { - list = t.newList(t.peekNonSpace().pos) - for t.peekNonSpace().typ != itemEOF { - n := t.textOrAction() - switch n.Type() { - case nodeEnd, nodeElse: - return list, n - } - list.append(n) - } - t.errorf("unexpected EOF") - return -} - -// textOrAction: -// text | comment | action -func (t *Tree) textOrAction() Node { - switch token := t.nextNonSpace(); token.typ { - case itemText: - return t.newText(token.pos, token.val) - case itemLeftDelim: - t.actionLine = token.line - defer t.clearActionLine() - return t.action() - case itemComment: - return t.newComment(token.pos, token.val) - default: - t.unexpected(token, "input") - } - return nil -} - -func (t *Tree) clearActionLine() { - t.actionLine = 0 -} - -// Action: -// control -// command ("|" command)* -// Left delim is past. Now get actions. -// First word could be a keyword such as range. -func (t *Tree) action() (n Node) { - switch token := t.nextNonSpace(); token.typ { - case itemBlock: - return t.blockControl() - case itemElse: - return t.elseControl() - case itemEnd: - return t.endControl() - case itemIf: - return t.ifControl() - case itemRange: - return t.rangeControl() - case itemTemplate: - return t.templateControl() - case itemWith: - return t.withControl() - } - t.backup() - token := t.peek() - // Do not pop variables; they persist until "end". - return t.newAction(token.pos, token.line, t.pipeline("command", itemRightDelim)) -} - -// Pipeline: -// declarations? command ('|' command)* -func (t *Tree) pipeline(context string, end itemType) (pipe *PipeNode) { - token := t.peekNonSpace() - pipe = t.newPipeline(token.pos, token.line, nil) - // Are there declarations or assignments? -decls: - if v := t.peekNonSpace(); v.typ == itemVariable { - t.next() - // Since space is a token, we need 3-token look-ahead here in the worst case: - // in "$x foo" we need to read "foo" (as opposed to ":=") to know that $x is an - // argument variable rather than a declaration. So remember the token - // adjacent to the variable so we can push it back if necessary. - tokenAfterVariable := t.peek() - next := t.peekNonSpace() - switch { - case next.typ == itemAssign, next.typ == itemDeclare: - pipe.IsAssign = next.typ == itemAssign - t.nextNonSpace() - pipe.Decl = append(pipe.Decl, t.newVariable(v.pos, v.val)) - t.vars = append(t.vars, v.val) - case next.typ == itemChar && next.val == ",": - t.nextNonSpace() - pipe.Decl = append(pipe.Decl, t.newVariable(v.pos, v.val)) - t.vars = append(t.vars, v.val) - if context == "range" && len(pipe.Decl) < 2 { - switch t.peekNonSpace().typ { - case itemVariable, itemRightDelim, itemRightParen: - // second initialized variable in a range pipeline - goto decls - default: - t.errorf("range can only initialize variables") - } - } - t.errorf("too many declarations in %s", context) - case tokenAfterVariable.typ == itemSpace: - t.backup3(v, tokenAfterVariable) - default: - t.backup2(v) - } - } - for { - switch token := t.nextNonSpace(); token.typ { - case end: - // At this point, the pipeline is complete - t.checkPipeline(pipe, context) - return - case itemBool, itemCharConstant, itemComplex, itemDot, itemField, itemIdentifier, - itemNumber, itemNil, itemRawString, itemString, itemVariable, itemLeftParen: - t.backup() - pipe.append(t.command()) - default: - t.unexpected(token, context) - } - } -} - -func (t *Tree) checkPipeline(pipe *PipeNode, context string) { - // Reject empty pipelines - if len(pipe.Cmds) == 0 { - t.errorf("missing value for %s", context) - } - // Only the first command of a pipeline can start with a non executable operand - for i, c := range pipe.Cmds[1:] { - switch c.Args[0].Type() { - case NodeBool, NodeDot, NodeNil, NodeNumber, NodeString: - // With A|B|C, pipeline stage 2 is B - t.errorf("non executable command in pipeline stage %d", i+2) - } - } -} - -func (t *Tree) parseControl(allowElseIf bool, context string) (pos Pos, line int, pipe *PipeNode, list, elseList *ListNode) { - defer t.popVars(len(t.vars)) - pipe = t.pipeline(context, itemRightDelim) - var next Node - list, next = t.itemList() - switch next.Type() { - case nodeEnd: //done - case nodeElse: - if allowElseIf { - // Special case for "else if". If the "else" is followed immediately by an "if", - // the elseControl will have left the "if" token pending. Treat - // {{if a}}_{{else if b}}_{{end}} - // as - // {{if a}}_{{else}}{{if b}}_{{end}}{{end}}. - // To do this, parse the if as usual and stop at it {{end}}; the subsequent{{end}} - // is assumed. This technique works even for long if-else-if chains. - // TODO: Should we allow else-if in with and range? - if t.peek().typ == itemIf { - t.next() // Consume the "if" token. - elseList = t.newList(next.Position()) - elseList.append(t.ifControl()) - // Do not consume the next item - only one {{end}} required. - break - } - } - elseList, next = t.itemList() - if next.Type() != nodeEnd { - t.errorf("expected end; found %s", next) - } - } - return pipe.Position(), pipe.Line, pipe, list, elseList -} - -// If: -// {{if pipeline}} itemList {{end}} -// {{if pipeline}} itemList {{else}} itemList {{end}} -// If keyword is past. -func (t *Tree) ifControl() Node { - return t.newIf(t.parseControl(true, "if")) -} - -// Range: -// {{range pipeline}} itemList {{end}} -// {{range pipeline}} itemList {{else}} itemList {{end}} -// Range keyword is past. -func (t *Tree) rangeControl() Node { - return t.newRange(t.parseControl(false, "range")) -} - -// With: -// {{with pipeline}} itemList {{end}} -// {{with pipeline}} itemList {{else}} itemList {{end}} -// If keyword is past. -func (t *Tree) withControl() Node { - return t.newWith(t.parseControl(false, "with")) -} - -// End: -// {{end}} -// End keyword is past. -func (t *Tree) endControl() Node { - return t.newEnd(t.expect(itemRightDelim, "end").pos) -} - -// Else: -// {{else}} -// Else keyword is past. -func (t *Tree) elseControl() Node { - // Special case for "else if". - peek := t.peekNonSpace() - if peek.typ == itemIf { - // We see "{{else if ... " but in effect rewrite it to {{else}}{{if ... ". - return t.newElse(peek.pos, peek.line) - } - token := t.expect(itemRightDelim, "else") - return t.newElse(token.pos, token.line) -} - -// Block: -// {{block stringValue pipeline}} -// Block keyword is past. -// The name must be something that can evaluate to a string. -// The pipeline is mandatory. -func (t *Tree) blockControl() Node { - const context = "block clause" - - token := t.nextNonSpace() - name := t.parseTemplateName(token, context) - pipe := t.pipeline(context, itemRightDelim) - - block := New(name) // name will be updated once we know it. - block.text = t.text - block.Mode = t.Mode - block.ParseName = t.ParseName - block.startParse(t.funcs, t.lex, t.treeSet) - var end Node - block.Root, end = block.itemList() - if end.Type() != nodeEnd { - t.errorf("unexpected %s in %s", end, context) - } - block.add() - block.stopParse() - - return t.newTemplate(token.pos, token.line, name, pipe) -} - -// Template: -// {{template stringValue pipeline}} -// Template keyword is past. The name must be something that can evaluate -// to a string. -func (t *Tree) templateControl() Node { - const context = "template clause" - token := t.nextNonSpace() - name := t.parseTemplateName(token, context) - var pipe *PipeNode - if t.nextNonSpace().typ != itemRightDelim { - t.backup() - // Do not pop variables; they persist until "end". - pipe = t.pipeline(context, itemRightDelim) - } - return t.newTemplate(token.pos, token.line, name, pipe) -} - -func (t *Tree) parseTemplateName(token item, context string) (name string) { - switch token.typ { - case itemString, itemRawString: - s, err := strconv.Unquote(token.val) - if err != nil { - t.error(err) - } - name = s - default: - t.unexpected(token, context) - } - return -} - -// command: -// operand (space operand)* -// space-separated arguments up to a pipeline character or right delimiter. -// we consume the pipe character but leave the right delim to terminate the action. -func (t *Tree) command() *CommandNode { - cmd := t.newCommand(t.peekNonSpace().pos) - for { - t.peekNonSpace() // skip leading spaces. - operand := t.operand() - if operand != nil { - cmd.append(operand) - } - switch token := t.next(); token.typ { - case itemSpace: - continue - case itemRightDelim, itemRightParen: - t.backup() - case itemPipe: - // nothing here; break loop below - default: - t.unexpected(token, "operand") - } - break - } - if len(cmd.Args) == 0 { - t.errorf("empty command") - } - return cmd -} - -// operand: -// term .Field* -// An operand is a space-separated component of a command, -// a term possibly followed by field accesses. -// A nil return means the next item is not an operand. -func (t *Tree) operand() Node { - node := t.term() - if node == nil { - return nil - } - if t.peek().typ == itemField { - chain := t.newChain(t.peek().pos, node) - for t.peek().typ == itemField { - chain.Add(t.next().val) - } - // Compatibility with original API: If the term is of type NodeField - // or NodeVariable, just put more fields on the original. - // Otherwise, keep the Chain node. - // Obvious parsing errors involving literal values are detected here. - // More complex error cases will have to be handled at execution time. - switch node.Type() { - case NodeField: - node = t.newField(chain.Position(), chain.String()) - case NodeVariable: - node = t.newVariable(chain.Position(), chain.String()) - case NodeBool, NodeString, NodeNumber, NodeNil, NodeDot: - t.errorf("unexpected . after term %q", node.String()) - default: - node = chain - } - } - return node -} - -// term: -// literal (number, string, nil, boolean) -// function (identifier) -// . -// .Field -// $ -// '(' pipeline ')' -// A term is a simple "expression". -// A nil return means the next item is not a term. -func (t *Tree) term() Node { - switch token := t.nextNonSpace(); token.typ { - case itemIdentifier: - checkFunc := t.Mode&SkipFuncCheck == 0 - if checkFunc && !t.hasFunction(token.val) { - t.errorf("function %q not defined", token.val) - } - return NewIdentifier(token.val).SetTree(t).SetPos(token.pos) - case itemDot: - return t.newDot(token.pos) - case itemNil: - return t.newNil(token.pos) - case itemVariable: - return t.useVar(token.pos, token.val) - case itemField: - return t.newField(token.pos, token.val) - case itemBool: - return t.newBool(token.pos, token.val == "true") - case itemCharConstant, itemComplex, itemNumber: - number, err := t.newNumber(token.pos, token.val, token.typ) - if err != nil { - t.error(err) - } - return number - case itemLeftParen: - return t.pipeline("parenthesized pipeline", itemRightParen) - case itemString, itemRawString: - s, err := strconv.Unquote(token.val) - if err != nil { - t.error(err) - } - return t.newString(token.pos, token.val, s) - } - t.backup() - return nil -} - -// hasFunction reports if a function name exists in the Tree's maps. -func (t *Tree) hasFunction(name string) bool { - for _, funcMap := range t.funcs { - if funcMap == nil { - continue - } - if funcMap[name] != nil { - return true - } - } - return false -} - -// popVars trims the variable list to the specified length -func (t *Tree) popVars(n int) { - t.vars = t.vars[:n] -} - -// useVar returns a node for a variable reference. It errors if the -// variable is not defined. -func (t *Tree) useVar(pos Pos, name string) Node { - v := t.newVariable(pos, name) - for _, varName := range t.vars { - if varName == v.Ident[0] { - return v - } - } - t.errorf("undefined variable %q", v.Ident[0]) - return nil -} diff --git a/vendor/rsc.io/tmplfunc/tmpl.go b/vendor/rsc.io/tmplfunc/tmpl.go deleted file mode 100644 index a10cbc53b..000000000 --- a/vendor/rsc.io/tmplfunc/tmpl.go +++ /dev/null @@ -1,213 +0,0 @@ -// Copyright 2021 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 tmplfunc provides an extension of Go templates -// in which templates can be invoked as if they were functions. -// -// For example, after parsing -// -// {{define "link url text"}}{{.text}}{{end}} -// -// this package installs a function named link allowing the template -// to be invoked as -// -// {{link "https://golang.org" "the Go language"}} -// -// instead of the longer-form (assuming an appropriate function named dict) -// -// {{template "link" (dict "url" "https://golang.org" "text" "the Go language")}} -// -// Function Definitions -// -// The function installed for a given template depends on the name of the -// defined template, which can include not just a function name but also -// a list of parameter names. The function name and parameter names must -// consist only of letters, digits, and underscores, with a leading non-digit. -// -// If there is no parameter list, then the function is expected to take -// at most one argument, made available in the template body as “.” (dot). -// If such a function is called with no arguments, dot will be a nil interface value. -// -// If there is a parameter list, then the function requires an argument for -// each parameter, except for optional and variadic parameters, explained below. -// Inside the template, the top-level value “.” is a map[string]interface{} in which -// each parameter name is mapped to the corresponding argument value. -// A parameter x can therefore be accessed as {{(index . "x")}} or, more concisely, {{.x}}. -// -// The first special case in parameter handling is that -// a parameter can be made optional by adding a “?” suffix after its name. -// If the argument list ends before that parameter, the corresponding map entry -// will be present and set to a nil value. -// The second special case is that a parameter can be made variadic -// by adding a “...” suffix after its name. -// The corresponding map entry contains a []interface{} holding the -// zero or more arguments corresponding to that parameter. -// -// In the parameter list, required parameters must precede optional parameters, -// which must in turn precede any variadic parameter. -// -// For example, we can revise the link template given earlier to make the -// link text optional, substituting the URL when the text is omitted: -// -// {{define "link url text?"}}{{or .text .url}}{{end}} -// -// The Go home page is {{link "https://golang.org"}}. -// -// Usage -// -// This package is meant to be used with templates from either the -// text/template or html/template packages. Given a *template.Template -// variable t, substitute: -// -// t.Parse(text) -> tmplfunc.Parse(t, text) -// t.ParseFiles(list) -> tmplfunc.ParseFiles(t, list) -// t.ParseGlob(pattern) -> tmplfunc.ParseGlob(t, pattern) -// -// Parse, ParseFiles, and ParseGlob parse the new templates but also add -// functions that invoke them, named according to the function signatures. -// Templates can only invoke functions for templates that have already been -// defined or that are being defined in the same Parse, ParseFiles, or ParseGlob call. -// For example, templates in two files x.tmpl and y.tmpl can call each other -// only if ParseFiles or ParseGlob is used to parse both files in a single call. -// Otherwise, the parsing of the first file will report that calls to templates in -// the second file are calling unknown functions. -// -// When used with the html/template package, all function-invoked template -// calls are treated as invoking templates producing HTML. In order to use a -// template that produces some other kind of text fragment, the template must -// be invoked directly using the {{template "name"}} form, not as a function call. -package tmplfunc - -import ( - "fmt" - "io/ioutil" - "path/filepath" - - htmltemplate "html/template" - texttemplate "text/template" -) - -// A Template is a *template.Template, where template refers to either -// the html/template or text/template package. -type Template interface { - // Method here only to make most types that are not a *template.Template - // not implement the interface. The requirement here is to be one of the two - // template types, not just to have this single method. - DefinedTemplates() string - Name() string -} - -// Parse is like t.Parse(text), adding functions for the templates defined in text. -func Parse(t Template, text string) error { - if err := funcs(t, []string{t.Name()}, []string{text}); err != nil { - return err - } - var err error - switch t := t.(type) { - case *texttemplate.Template: - _, err = t.Parse(text) - case *htmltemplate.Template: - _, err = t.Parse(text) - } - return err -} - -// ParseFiles is like t.ParseFiles(filenames...), adding functions for the parsed templates. -func ParseFiles(t Template, filenames ...string) error { - return parseFiles(t, readFileOS, filenames...) -} - -// parseFiles is the helper for the method and function. If the argument -// template is nil, it is created from the first file. -func parseFiles(t Template, readFile func(string) (string, []byte, error), filenames ...string) error { - if len(filenames) == 0 { - // Not really a problem, but be consistent. - return fmt.Errorf("tmplfunc: no files named in call to ParseFiles") - } - - var names []string - var texts []string - for _, filename := range filenames { - name, b, err := readFile(filename) - if err != nil { - return err - } - names = append(names, name) - texts = append(texts, string(b)) - } - - err := funcs(t, names, texts) - if err != nil { - return err - } - - switch t := t.(type) { - case *texttemplate.Template: - for i, name := range names { - var tmpl *texttemplate.Template - if name == t.Name() { - tmpl = t - } else { - tmpl = t.New(name) - } - if _, err := tmpl.Parse(texts[i]); err != nil { - return err - } - } - - case *htmltemplate.Template: - for i, name := range names { - var tmpl *htmltemplate.Template - if name == t.Name() { - tmpl = t - } else { - tmpl = t.New(name) - } - if _, err := tmpl.Parse(texts[i]); err != nil { - return err - } - } - } - - return nil -} - -// ParseGlob is like t.ParseGlob(pattern), adding functions for the parsed templates. -func ParseGlob(t Template, pattern string) error { - filenames, err := filepath.Glob(pattern) - if err != nil { - return err - } - if len(filenames) == 0 { - return fmt.Errorf("tmplfunc: pattern matches no files: %#q", pattern) - } - return parseFiles(t, readFileOS, filenames...) -} - -func must(err error) { - if err != nil { - panic(err) - } -} - -// MustParse is like Parse but panics on error. -func MustParse(t Template, text string) { - must(Parse(t, text)) -} - -// MustParseFiles is like ParseFiles but panics on error. -func MustParseFiles(t Template, filenames ...string) { - must(ParseFiles(t, filenames...)) -} - -// MustParseGlob is like ParseGlob but panics on error. -func MustParseGlob(t Template, pattern string) { - must(ParseGlob(t, pattern)) -} - -func readFileOS(file string) (name string, b []byte, err error) { - name = filepath.Base(file) - b, err = ioutil.ReadFile(file) - return -}