mirror of
https://github.com/kubenetworks/kubevpn.git
synced 2025-10-19 21:54:44 +08:00
feat: upgrade syncthing version
This commit is contained in:
67
go.mod
67
go.mod
@@ -35,21 +35,21 @@ require (
|
||||
github.com/sirupsen/logrus v1.9.3
|
||||
github.com/spf13/cobra v1.8.1
|
||||
github.com/spf13/pflag v1.0.5
|
||||
github.com/syncthing/syncthing v1.27.7
|
||||
github.com/syncthing/syncthing v1.27.12
|
||||
github.com/thejerf/suture/v4 v4.0.5
|
||||
go.uber.org/automaxprocs v1.5.3
|
||||
golang.org/x/crypto v0.25.0
|
||||
golang.org/x/net v0.27.0
|
||||
golang.org/x/oauth2 v0.18.0
|
||||
golang.org/x/sync v0.7.0
|
||||
golang.org/x/sys v0.22.0
|
||||
golang.org/x/text v0.16.0
|
||||
golang.org/x/time v0.5.0
|
||||
golang.org/x/crypto v0.28.0
|
||||
golang.org/x/net v0.30.0
|
||||
golang.org/x/oauth2 v0.21.0
|
||||
golang.org/x/sync v0.8.0
|
||||
golang.org/x/sys v0.26.0
|
||||
golang.org/x/text v0.19.0
|
||||
golang.org/x/time v0.6.0
|
||||
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2
|
||||
golang.zx2c4.com/wireguard v0.0.0-20220920152132-bb719d3a6e2c
|
||||
golang.zx2c4.com/wireguard/windows v0.5.3
|
||||
google.golang.org/grpc v1.62.1
|
||||
google.golang.org/protobuf v1.33.0
|
||||
google.golang.org/protobuf v1.34.2
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1
|
||||
gvisor.dev/gvisor v0.0.0-20240722211153-64c016c92987
|
||||
k8s.io/api v0.31.0-alpha.0
|
||||
@@ -67,8 +67,7 @@ require (
|
||||
|
||||
require (
|
||||
cel.dev/expr v0.15.0 // indirect
|
||||
cloud.google.com/go/compute v1.25.1 // indirect
|
||||
cloud.google.com/go/compute/metadata v0.2.3 // indirect
|
||||
cloud.google.com/go/compute/metadata v0.3.0 // indirect
|
||||
dario.cat/mergo v1.0.0 // indirect
|
||||
filippo.io/edwards25519 v1.1.0 // indirect
|
||||
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible // indirect
|
||||
@@ -101,8 +100,8 @@ require (
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/bits-and-blooms/bitset v1.13.0 // indirect
|
||||
github.com/calmh/incontainer v1.0.0 // indirect
|
||||
github.com/calmh/xdr v1.1.0 // indirect
|
||||
github.com/ccding/go-stun v0.1.4 // indirect
|
||||
github.com/calmh/xdr v1.2.0 // indirect
|
||||
github.com/ccding/go-stun v0.1.5 // indirect
|
||||
github.com/census-instrumentation/opencensus-proto v0.4.1 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/chai2010/gettext-go v1.0.2 // indirect
|
||||
@@ -135,17 +134,17 @@ require (
|
||||
github.com/fvbommel/sortorder v1.1.0 // indirect
|
||||
github.com/fxamacker/cbor/v2 v2.6.0 // indirect
|
||||
github.com/gaissmai/bart v0.11.1 // indirect
|
||||
github.com/go-asn1-ber/asn1-ber v1.5.5 // indirect
|
||||
github.com/go-asn1-ber/asn1-ber v1.5.7 // indirect
|
||||
github.com/go-errors/errors v1.5.1 // indirect
|
||||
github.com/go-json-experiment/json v0.0.0-20231102232822-2e55bd4e08b0 // indirect
|
||||
github.com/go-ldap/ldap/v3 v3.4.6 // indirect
|
||||
github.com/go-ldap/ldap/v3 v3.4.8 // indirect
|
||||
github.com/go-logr/logr v1.4.2 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-ole/go-ole v1.3.0 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
||||
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
||||
github.com/go-openapi/swag v0.23.0 // indirect
|
||||
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
|
||||
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
|
||||
github.com/gobwas/glob v0.2.3 // indirect
|
||||
github.com/godbus/dbus/v5 v5.1.1-0.20230522191255-76236955d466 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
@@ -158,14 +157,14 @@ require (
|
||||
github.com/google/go-cmp v0.6.0 // indirect
|
||||
github.com/google/gofuzz v1.2.0 // indirect
|
||||
github.com/google/nftables v0.2.1-0.20240414091927-5e242ec57806 // indirect
|
||||
github.com/google/pprof v0.0.0-20240409012703-83162a5b38cd // indirect
|
||||
github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 // indirect
|
||||
github.com/google/s2a-go v0.1.7 // indirect
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
|
||||
github.com/googleapis/gax-go/v2 v2.12.3 // indirect
|
||||
github.com/gorilla/mux v1.8.1 // indirect
|
||||
github.com/gorilla/websocket v1.5.1 // indirect
|
||||
github.com/greatroar/blobloom v0.7.2 // indirect
|
||||
github.com/greatroar/blobloom v0.8.0 // indirect
|
||||
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
|
||||
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
@@ -177,7 +176,7 @@ require (
|
||||
github.com/imdario/mergo v0.3.16 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/infobloxopen/go-trees v0.0.0-20221216143356-66ceba885ebc // indirect
|
||||
github.com/jackpal/gateway v1.0.14 // indirect
|
||||
github.com/jackpal/gateway v1.0.15 // indirect
|
||||
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
|
||||
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
|
||||
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
|
||||
@@ -191,14 +190,13 @@ require (
|
||||
github.com/julienschmidt/httprouter v1.3.0 // indirect
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
|
||||
github.com/klauspost/compress v1.17.7 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.15 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
|
||||
github.com/mdlayher/netlink v1.7.2 // indirect
|
||||
github.com/mdlayher/socket v0.5.0 // indirect
|
||||
github.com/miekg/pkcs11 v1.1.1 // indirect
|
||||
github.com/minio/sha256-simd v1.0.1 // indirect
|
||||
github.com/miscreant/miscreant.go v0.0.0-20200214223636-26d376326b75 // indirect
|
||||
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
@@ -216,14 +214,14 @@ require (
|
||||
github.com/morikuni/aec v1.0.0 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
|
||||
github.com/onsi/ginkgo/v2 v2.17.1 // indirect
|
||||
github.com/onsi/ginkgo/v2 v2.20.0 // indirect
|
||||
github.com/opencontainers/go-digest v1.0.0 // indirect
|
||||
github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492 // indirect
|
||||
github.com/opentracing/opentracing-go v1.2.0 // indirect
|
||||
github.com/openzipkin-contrib/zipkin-go-opentracing v0.5.0 // indirect
|
||||
github.com/openzipkin/zipkin-go v0.4.2 // indirect
|
||||
github.com/oschwald/geoip2-golang v1.9.0 // indirect
|
||||
github.com/oschwald/maxminddb-golang v1.12.0 // indirect
|
||||
github.com/oschwald/geoip2-golang v1.11.0 // indirect
|
||||
github.com/oschwald/maxminddb-golang v1.13.1 // indirect
|
||||
github.com/outcaste-io/ristretto v0.2.3 // indirect
|
||||
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
|
||||
github.com/philhofer/fwd v1.1.2 // indirect
|
||||
@@ -232,14 +230,15 @@ require (
|
||||
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
|
||||
github.com/prometheus/client_golang v1.19.1 // indirect
|
||||
github.com/prometheus/client_model v0.6.1 // indirect
|
||||
github.com/prometheus/common v0.52.2 // indirect
|
||||
github.com/prometheus/procfs v0.13.0 // indirect
|
||||
github.com/quic-go/quic-go v0.42.0 // indirect
|
||||
github.com/prometheus/common v0.55.0 // indirect
|
||||
github.com/prometheus/procfs v0.15.1 // indirect
|
||||
github.com/quic-go/quic-go v0.46.0 // indirect
|
||||
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
|
||||
github.com/rivo/uniseg v0.4.7 // indirect
|
||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||
github.com/secure-systems-lab/go-securesystemslib v0.8.0 // indirect
|
||||
github.com/shirou/gopsutil/v3 v3.24.3 // indirect
|
||||
github.com/shirou/gopsutil/v4 v4.24.7 // indirect
|
||||
github.com/shoenig/go-m1cpu v0.1.6 // indirect
|
||||
github.com/stretchr/objx v0.5.2 // indirect
|
||||
github.com/stretchr/testify v1.9.0 // indirect
|
||||
github.com/syncthing/notify v0.0.0-20210616190510-c6b7342338d2 // indirect
|
||||
@@ -247,6 +246,8 @@ require (
|
||||
github.com/tailscale/netlink v1.1.1-0.20240822203006-4d49adab4de7 // indirect
|
||||
github.com/theupdateframework/notary v0.7.0 // indirect
|
||||
github.com/tinylib/msgp v1.1.9 // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.12 // indirect
|
||||
github.com/tklauser/numcpus v0.6.1 // indirect
|
||||
github.com/vishvananda/netns v0.0.4 // indirect
|
||||
github.com/vitrun/qart v0.0.0-20160531060029-bf64b92db6b0 // indirect
|
||||
github.com/x448/float16 v0.8.4 // indirect
|
||||
@@ -263,6 +264,7 @@ require (
|
||||
go.opentelemetry.io/otel v1.24.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.21.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.24.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.22.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.24.0 // indirect
|
||||
go.starlark.net v0.0.0-20240329153429-e6e8e7ce1b7a // indirect
|
||||
go.uber.org/atomic v1.11.0 // indirect
|
||||
@@ -271,14 +273,13 @@ require (
|
||||
go.uber.org/zap v1.27.0 // indirect
|
||||
go4.org/mem v0.0.0-20220726221520-4f986261bf13 // indirect
|
||||
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect
|
||||
golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 // indirect
|
||||
golang.org/x/mod v0.19.0 // indirect
|
||||
golang.org/x/term v0.22.0 // indirect
|
||||
golang.org/x/tools v0.23.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa // indirect
|
||||
golang.org/x/mod v0.21.0 // indirect
|
||||
golang.org/x/term v0.25.0 // indirect
|
||||
golang.org/x/tools v0.26.0 // indirect
|
||||
golang.org/x/xerrors v0.0.0-20240716161551-93cc26a95ae9 // indirect
|
||||
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
|
||||
google.golang.org/api v0.172.0 // indirect
|
||||
google.golang.org/appengine v1.6.8 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20240401170217-c3f982113cda // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect
|
||||
gopkg.in/DataDog/dd-trace-go.v1 v1.62.0 // indirect
|
||||
|
151
go.sum
151
go.sum
@@ -1,10 +1,8 @@
|
||||
cel.dev/expr v0.15.0 h1:O1jzfJCQBfL5BFoYktaxwIhuttaQPsVWerH9/EEKx0w=
|
||||
cel.dev/expr v0.15.0/go.mod h1:TRSuuV7DlVCE/uwv5QbAiW/v8l5O8C4eEPHeu7gf7Sg=
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go/compute v1.25.1 h1:ZRpHJedLtTpKgr3RV1Fx23NuaAEN1Zfx9hw1u4aJdjU=
|
||||
cloud.google.com/go/compute v1.25.1/go.mod h1:oopOIR53ly6viBYxaDhBfJwzUAxf1zE//uf3IB011ls=
|
||||
cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY=
|
||||
cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA=
|
||||
cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc=
|
||||
cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k=
|
||||
dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=
|
||||
dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
|
||||
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
||||
@@ -72,7 +70,6 @@ github.com/Shopify/logrus-bugsnag v0.0.0-20170309145241-6dbc35f2c30d h1:hi6J4K6D
|
||||
github.com/Shopify/logrus-bugsnag v0.0.0-20170309145241-6dbc35f2c30d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ=
|
||||
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/alexbrainman/sspi v0.0.0-20210105120005-909beea2cc74/go.mod h1:cEWa1LVoE5KvSD9ONXsZrj0z6KqySlCCNKHlLzbqAt4=
|
||||
github.com/alexbrainman/sspi v0.0.0-20231016080023-1a75b4708caa h1:LHTHcTQiSGT7VVbI0o4wBRNQIgn917usHWOd6VAffYI=
|
||||
github.com/alexbrainman/sspi v0.0.0-20231016080023-1a75b4708caa/go.mod h1:cEWa1LVoE5KvSD9ONXsZrj0z6KqySlCCNKHlLzbqAt4=
|
||||
github.com/antonmedv/expr v1.15.5 h1:y0Iz3cEwmpRz5/r3w4qQR0MfIqJGdGM1zbhD/v0G5Vg=
|
||||
@@ -101,13 +98,13 @@ github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0 h1:nvj0OLI3YqYXe
|
||||
github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE=
|
||||
github.com/calmh/incontainer v1.0.0 h1:g2cTUtZuFGmMGX8GoykPkN1Judj2uw8/3/aEtq4Z/rg=
|
||||
github.com/calmh/incontainer v1.0.0/go.mod h1:eOhqnw15c9X+4RNBe0W3HlUZFfX16O0EDsCOInTndHY=
|
||||
github.com/calmh/xdr v1.1.0 h1:U/Dd4CXNLoo8EiQ4ulJUXkgO1/EyQLgDKLgpY1SOoJE=
|
||||
github.com/calmh/xdr v1.1.0/go.mod h1:E8sz2ByAdXC8MbANf1LCRYzedSnnc+/sXXJs/PVqoeg=
|
||||
github.com/ccding/go-stun v0.1.4 h1:lC0co3Q3vjAuu2Jz098WivVPBPbemYFqbwE1syoka4M=
|
||||
github.com/ccding/go-stun v0.1.4/go.mod h1:cCZjJ1J3WFSJV6Wj8Y9Di8JMTsEXh6uv2eNmLzKaUeM=
|
||||
github.com/calmh/xdr v1.2.0 h1:GaGSNH4ZDw9kNdYqle6+RcAENiaQ8/611Ok+jQbBEeU=
|
||||
github.com/calmh/xdr v1.2.0/go.mod h1:vO5+lCx/8xz7Ekd/ZLf+xuy7c1x6FMO1pBJyjDebwyg=
|
||||
github.com/ccding/go-stun v0.1.5 h1:qEM367nnezmj7dv+SdT52prv5x6HUTG3nlrjX5aitlo=
|
||||
github.com/ccding/go-stun v0.1.5/go.mod h1:cCZjJ1J3WFSJV6Wj8Y9Di8JMTsEXh6uv2eNmLzKaUeM=
|
||||
github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4=
|
||||
github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM=
|
||||
github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
|
||||
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
|
||||
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/census-instrumentation/opencensus-proto v0.4.1 h1:iKLQ0xPNFxR/2hzXZMrBo8f1j86j5WHzznCCQxV/b8g=
|
||||
github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw=
|
||||
@@ -235,15 +232,16 @@ github.com/fxamacker/cbor/v2 v2.6.0 h1:sU6J2usfADwWlYDAFhZBQ6TnLFBHxgesMrQfQgk1t
|
||||
github.com/fxamacker/cbor/v2 v2.6.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
|
||||
github.com/gaissmai/bart v0.11.1 h1:5Uv5XwsaFBRo4E5VBcb9TzY8B7zxFf+U7isDxqOrRfc=
|
||||
github.com/gaissmai/bart v0.11.1/go.mod h1:KHeYECXQiBjTzQz/om2tqn3sZF1J7hw9m6z41ftj3fg=
|
||||
github.com/go-asn1-ber/asn1-ber v1.5.5 h1:MNHlNMBDgEKD4TcKr36vQN68BA00aDfjIt3/bD50WnA=
|
||||
github.com/go-asn1-ber/asn1-ber v1.5.5/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
|
||||
github.com/go-asn1-ber/asn1-ber v1.5.7 h1:DTX+lbVTWaTw1hQ+PbZPlnDZPEIs0SS/GCZAl535dDk=
|
||||
github.com/go-asn1-ber/asn1-ber v1.5.7/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
|
||||
github.com/go-errors/errors v1.5.1 h1:ZwEMSLRCapFLflTpT7NKaAc7ukJ8ZPEjzlxt8rPN8bk=
|
||||
github.com/go-errors/errors v1.5.1/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
|
||||
github.com/go-json-experiment/json v0.0.0-20231102232822-2e55bd4e08b0 h1:ymLjT4f35nQbASLnvxEde4XOBL+Sn7rFuV+FOJqkljg=
|
||||
github.com/go-json-experiment/json v0.0.0-20231102232822-2e55bd4e08b0/go.mod h1:6daplAwHHGbUGib4990V3Il26O0OC4aRyvewaaAihaA=
|
||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-ldap/ldap/v3 v3.4.6 h1:ert95MdbiG7aWo/oPYp9btL3KJlMPKnP58r09rI8T+A=
|
||||
github.com/go-ldap/ldap/v3 v3.4.6/go.mod h1:IGMQANNtxpsOzj7uUAMjpGBaOVTC4DYyIy8VsTdxmtc=
|
||||
github.com/go-ldap/ldap/v3 v3.4.8 h1:loKJyspcRezt2Q3ZRMq2p/0v8iOurlmeXDPw6fikSvQ=
|
||||
github.com/go-ldap/ldap/v3 v3.4.8/go.mod h1:qS3Sjlu76eHfHGpUdWkAXQTw4beih+cHsco2jXlIXrk=
|
||||
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.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||
@@ -267,8 +265,8 @@ github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfC
|
||||
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
github.com/go-task/slim-sprig 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/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y=
|
||||
github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8=
|
||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||
@@ -332,15 +330,14 @@ github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo
|
||||
github.com/google/nftables v0.2.1-0.20240414091927-5e242ec57806 h1:wG8RYIyctLhdFk6Vl1yPGtSRtwGpVkWyZww1OCil2MI=
|
||||
github.com/google/nftables v0.2.1-0.20240414091927-5e242ec57806/go.mod h1:Beg6V6zZ3oEn0JuiUQ4wqwuyqqzasOltcoXPtgLbFp4=
|
||||
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/pprof v0.0.0-20240409012703-83162a5b38cd h1:gbpYu9NMq8jhDVbvlGkMFWCjLFlqqEZjEmObmhUy6Vo=
|
||||
github.com/google/pprof v0.0.0-20240409012703-83162a5b38cd/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw=
|
||||
github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 h1:FKHo8hFI3A+7w0aUQuYXQ+6EN5stWmeY/AZqtM8xk9k=
|
||||
github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo=
|
||||
github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o=
|
||||
github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw=
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
|
||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs=
|
||||
@@ -358,8 +355,8 @@ github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/z
|
||||
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
|
||||
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
|
||||
github.com/greatroar/blobloom v0.7.2 h1:F30MGLHOcb4zr0pwCPTcKdlTM70rEgkf+LzdUPc5ss8=
|
||||
github.com/greatroar/blobloom v0.7.2/go.mod h1:mjMJ1hh1wjGVfr93QIHJ6FfDNVrA0IELv8OvMHJxHKs=
|
||||
github.com/greatroar/blobloom v0.8.0 h1:I9RlEkfqK9/6f1v9mFmDYegDQ/x0mISCpiNpAm23Pt4=
|
||||
github.com/greatroar/blobloom v0.8.0/go.mod h1:mjMJ1hh1wjGVfr93QIHJ6FfDNVrA0IELv8OvMHJxHKs=
|
||||
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 h1:+ngKgrYPPJrOjhax5N+uePQ0Fh1Z7PheYoUI/0nzkPA=
|
||||
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo=
|
||||
@@ -397,8 +394,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2
|
||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||
github.com/infobloxopen/go-trees v0.0.0-20221216143356-66ceba885ebc h1:RhT2pjLo3EVRmldbEcBdeRA7CGPWsNEJC+Y/N1aXQbg=
|
||||
github.com/infobloxopen/go-trees v0.0.0-20221216143356-66ceba885ebc/go.mod h1:BaIJzjD2ZnHmx2acPF6XfGLPzNCMiBbMRqJr+8/8uRI=
|
||||
github.com/jackpal/gateway v1.0.14 h1:6ZfIuFvnvWrS59hHbvZGR/R33ojV2LASBODomt7zlJU=
|
||||
github.com/jackpal/gateway v1.0.14/go.mod h1:6c8LjW+FVESFmwxaXySkt7fU98Yv806ADS3OY6Cvh2U=
|
||||
github.com/jackpal/gateway v1.0.15 h1:yb4Gltgr8ApHWWnSyybnDL1vURbqw7ooo7IIL5VZSeg=
|
||||
github.com/jackpal/gateway v1.0.15/go.mod h1:dbyEDcDhHUh9EmjB9ung81elMUZfG0SoNc2TfTbcj4c=
|
||||
github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus=
|
||||
github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc=
|
||||
github.com/jcmturner/aescts/v2 v2.0.0 h1:9YKLH6ey7H4eDBXW8khjYslgyqG2xZikXP0EQFKrle8=
|
||||
@@ -447,8 +444,6 @@ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg=
|
||||
github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
|
||||
github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM=
|
||||
github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||
@@ -464,6 +459,7 @@ github.com/libp2p/go-netroute v0.2.1 h1:V8kVrpD8GK0Riv15/7VN6RbUQ3URNZVosw7H2v9t
|
||||
github.com/libp2p/go-netroute v0.2.1/go.mod h1:hraioZr0fhBjG0ZRXJJ6Zj2IVEVNx6tDTFQfSmcq7mQ=
|
||||
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de h1:9TO3cAIGXtEhnIaL+V+BEER86oLrvS+kWobKpbJuye0=
|
||||
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE=
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4=
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
|
||||
github.com/magiconair/properties v1.5.3/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
|
||||
@@ -489,8 +485,6 @@ github.com/miekg/dns v1.1.58/go.mod h1:Ypv+3b/KadlvW9vJfXOTf300O4UqaHFzFCuHz+rPk
|
||||
github.com/miekg/pkcs11 v1.0.2/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs=
|
||||
github.com/miekg/pkcs11 v1.1.1 h1:Ugu9pdy6vAYku5DEpVWVFPYnzV+bxB+iRdbuFSu7TvU=
|
||||
github.com/miekg/pkcs11 v1.1.1/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs=
|
||||
github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM=
|
||||
github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8=
|
||||
github.com/miscreant/miscreant.go v0.0.0-20200214223636-26d376326b75 h1:cUVxyR+UfmdEAZGJ8IiKld1O0dbGotEnkMolG5hfMSY=
|
||||
github.com/miscreant/miscreant.go v0.0.0-20200214223636-26d376326b75/go.mod h1:pBbZyGwC5i16IBkjVKoy/sznA8jPD/K9iedwe1ESE6w=
|
||||
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ=
|
||||
@@ -546,15 +540,15 @@ github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vv
|
||||
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.17.1 h1:V++EzdbhI4ZV4ev0UTIj0PzhzOcReJFyJaLjtSF55M8=
|
||||
github.com/onsi/ginkgo/v2 v2.17.1/go.mod h1:llBI3WDLL9Z6taip6f33H76YcWtJv+7R3HigUjbIBOs=
|
||||
github.com/onsi/ginkgo/v2 v2.20.0 h1:PE84V2mHqoT1sglvHc8ZdQtPcwmvvt29WLEEO3xmdZw=
|
||||
github.com/onsi/ginkgo/v2 v2.20.0/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI=
|
||||
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
||||
github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA=
|
||||
github.com/onsi/gomega v1.10.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.32.0 h1:JRYU78fJ1LPxlckP6Txi/EYqJvjtMrDC04/MM5XRHPk=
|
||||
github.com/onsi/gomega v1.32.0/go.mod h1:a4x4gW6Pz2yK1MAmvluYme5lvYTn61afQ2ETw/8n4Lg=
|
||||
github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
|
||||
github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY=
|
||||
github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
|
||||
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
|
||||
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
|
||||
@@ -570,10 +564,10 @@ github.com/openzipkin-contrib/zipkin-go-opentracing v0.5.0 h1:uhcF5Jd7rP9DVEL10S
|
||||
github.com/openzipkin-contrib/zipkin-go-opentracing v0.5.0/go.mod h1:+oCZ5GXXr7KPI/DNOQORPTq5AWHfALJj9c72b0+YsEY=
|
||||
github.com/openzipkin/zipkin-go v0.4.2 h1:zjqfqHjUpPmB3c1GlCvvgsM1G4LkvqQbBDueDOCg/jA=
|
||||
github.com/openzipkin/zipkin-go v0.4.2/go.mod h1:ZeVkFjuuBiSy13y8vpSDCjMi9GoI3hPpCJSBx/EYFhY=
|
||||
github.com/oschwald/geoip2-golang v1.9.0 h1:uvD3O6fXAXs+usU+UGExshpdP13GAqp4GBrzN7IgKZc=
|
||||
github.com/oschwald/geoip2-golang v1.9.0/go.mod h1:BHK6TvDyATVQhKNbQBdrj9eAvuwOMi2zSFXizL3K81Y=
|
||||
github.com/oschwald/maxminddb-golang v1.12.0 h1:9FnTOD0YOhP7DGxGsq4glzpGy5+w7pq50AS6wALUMYs=
|
||||
github.com/oschwald/maxminddb-golang v1.12.0/go.mod h1:q0Nob5lTCqyQ8WT6FYgS1L7PXKVVbgiymefNwIjPzgY=
|
||||
github.com/oschwald/geoip2-golang v1.11.0 h1:hNENhCn1Uyzhf9PTmquXENiWS6AlxAEnBII6r8krA3w=
|
||||
github.com/oschwald/geoip2-golang v1.11.0/go.mod h1:P9zG+54KPEFOliZ29i7SeYZ/GM6tfEL+rgSn03hYuUo=
|
||||
github.com/oschwald/maxminddb-golang v1.13.1 h1:G3wwjdN9JmIK2o/ermkHM+98oX5fS+k5MbwsmL4MRQE=
|
||||
github.com/oschwald/maxminddb-golang v1.13.1/go.mod h1:K4pgV9N/GcK694KSTmVSDTODk4IsCNThNdTmnaBZ/F8=
|
||||
github.com/outcaste-io/ristretto v0.2.3 h1:AK4zt/fJ76kjlYObOeNwh4T3asEuaCmp26pOvUOL9w0=
|
||||
github.com/outcaste-io/ristretto v0.2.3/go.mod h1:W8HywhmtlopSB1jeMg3JtdIhf+DYkLAr0VN/s4+MHac=
|
||||
github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8=
|
||||
@@ -592,7 +586,6 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
|
||||
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU=
|
||||
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
|
||||
github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g=
|
||||
@@ -614,16 +607,16 @@ github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQy
|
||||
github.com/prometheus/common v0.0.0-20180110214958-89604d197083/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
|
||||
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||
github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc=
|
||||
github.com/prometheus/common v0.52.2 h1:LW8Vk7BccEdONfrJBDffQGRtpSzi5CQaRZGtboOO2ck=
|
||||
github.com/prometheus/common v0.52.2/go.mod h1:lrWtQx+iDfn2mbH5GUzlH9TSHyfZpHkSiG1W7y3sF2Q=
|
||||
github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc=
|
||||
github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8=
|
||||
github.com/prometheus/procfs v0.0.0-20180125133057-cb4147076ac7/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||
github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ=
|
||||
github.com/prometheus/procfs v0.13.0 h1:GqzLlQyfsPbaEHaQkO7tbDlriv/4o5Hudv6OXHGKX7o=
|
||||
github.com/prometheus/procfs v0.13.0/go.mod h1:cd4PFCR54QLnGKPaKGA6l+cfuNXtht43ZKY6tow0Y1g=
|
||||
github.com/quic-go/quic-go v0.42.0 h1:uSfdap0eveIl8KXnipv9K7nlwZ5IqLlYOpJ58u5utpM=
|
||||
github.com/quic-go/quic-go v0.42.0/go.mod h1:132kz4kL3F9vxhW3CtQJLDVwcFe5wdWeJXXijhsO57M=
|
||||
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
|
||||
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
|
||||
github.com/quic-go/quic-go v0.46.0 h1:uuwLClEEyk1DNvchH8uCByQVjo3yKL9opKulExNDs7Y=
|
||||
github.com/quic-go/quic-go v0.46.0/go.mod h1:1dLehS7TIR64+vxGR70GDcatWTOtMX2PUtnKsjbTurI=
|
||||
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM=
|
||||
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
||||
github.com/richardartoul/molecule v1.0.1-0.20221107223329-32cfee06a052 h1:Qp27Idfgi6ACvFQat5+VJvlYToylpM/hcyLBI3WaKPA=
|
||||
@@ -641,9 +634,11 @@ github.com/secure-systems-lab/go-securesystemslib v0.8.0 h1:mr5An6X45Kb2nddcFlbm
|
||||
github.com/secure-systems-lab/go-securesystemslib v0.8.0/go.mod h1:UH2VZVuJfCYR8WgMlCU1uFsOUU+KeyrTWcSS73NBOzU=
|
||||
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
|
||||
github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I=
|
||||
github.com/shirou/gopsutil/v3 v3.24.3 h1:eoUGJSmdfLzJ3mxIhmOAhgKEKgQkeOwKpz1NbhVnuPE=
|
||||
github.com/shirou/gopsutil/v3 v3.24.3/go.mod h1:JpND7O217xa72ewWz9zN2eIIkPWsDN/3pl0H8Qt0uwg=
|
||||
github.com/shirou/gopsutil/v4 v4.24.7 h1:V9UGTK4gQ8HvcnPKf6Zt3XHyQq/peaekfxpJ2HSocJk=
|
||||
github.com/shirou/gopsutil/v4 v4.24.7/go.mod h1:0uW/073rP7FYLOkvxolUQM5rMOLTNmRXnFKafpb71rw=
|
||||
github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM=
|
||||
github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ=
|
||||
github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU=
|
||||
github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k=
|
||||
github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
@@ -688,15 +683,14 @@ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1F
|
||||
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.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8=
|
||||
github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0=
|
||||
github.com/syncthing/notify v0.0.0-20210616190510-c6b7342338d2 h1:F4snRP//nIuTTW9LYEzVH4HVwDG9T3M4t8y/2nqMbiY=
|
||||
github.com/syncthing/notify v0.0.0-20210616190510-c6b7342338d2/go.mod h1:J0q59IWjLtpRIJulohwqEZvjzwOfTEPp8SVhDJl+y0Y=
|
||||
github.com/syncthing/syncthing v1.27.7 h1:N06QpAUPQi2VaB+X0wko5h8JtH3qJP5Dd4MYq952pEw=
|
||||
github.com/syncthing/syncthing v1.27.7/go.mod h1:bMhGhc70k3UFszFhmCVNxM5bOsDfhxYMHvj4lWlIYBk=
|
||||
github.com/syncthing/syncthing v1.27.12 h1:zY2cdf20CxgAero+oyUNyf57xezVy723ltNAa8VFL+I=
|
||||
github.com/syncthing/syncthing v1.27.12/go.mod h1:kHq/6Vhq8mNL8ntNAoATEkuYsHO2hwy7UCoRGDHh2iA=
|
||||
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs=
|
||||
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48=
|
||||
github.com/tailscale/netlink v1.1.1-0.20240822203006-4d49adab4de7 h1:uFsXVBE9Qr4ZoF094vE6iYTLDl0qCiKzYXlL6UeWObU=
|
||||
@@ -707,7 +701,9 @@ github.com/theupdateframework/notary v0.7.0 h1:QyagRZ7wlSpjT5N2qQAh/pN+DVqgekv4D
|
||||
github.com/theupdateframework/notary v0.7.0/go.mod h1:c9DRxcmhHmVLDay4/2fUYdISnHqbFDGRSlXPO0AhYWw=
|
||||
github.com/tinylib/msgp v1.1.9 h1:SHf3yoO2sGA0veCJeCBYLHuttAVFHGm2RHgNodW7wQU=
|
||||
github.com/tinylib/msgp v1.1.9/go.mod h1:BCXGB54lDD8qUEPmiG0cQQUANC4IUQyB2ItS2UDlO/k=
|
||||
github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU=
|
||||
github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI=
|
||||
github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk=
|
||||
github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY=
|
||||
github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0=
|
||||
github.com/vishvananda/netns v0.0.4 h1:Oeaw1EM2JMxD51g9uhtC0D7erkIjgmj8+JZc26m1YX8=
|
||||
@@ -785,12 +781,13 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y
|
||||
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
|
||||
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
|
||||
golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30=
|
||||
golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M=
|
||||
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
||||
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
|
||||
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw=
|
||||
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 h1:985EYyeCOxTpcgOTJpflJUwOeEz0CQOdPt73OzpE9F8=
|
||||
golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI=
|
||||
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa h1:ELnwvuAXPNtPk1TJRuGkI9fDTwym6AYBu0qzT8AcHdI=
|
||||
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ=
|
||||
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-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
@@ -801,8 +798,8 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.19.0 h1:fEdghXQSo20giMthA7cd28ZC+jts4amQ3YMXiP5oMQ8=
|
||||
golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
|
||||
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
|
||||
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=
|
||||
@@ -828,11 +825,13 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug
|
||||
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.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||
golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
|
||||
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
|
||||
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
|
||||
golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
|
||||
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
|
||||
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI=
|
||||
golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8=
|
||||
golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs=
|
||||
golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
@@ -842,8 +841,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
|
||||
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
|
||||
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
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=
|
||||
@@ -886,32 +885,30 @@ 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.8.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.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
|
||||
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
|
||||
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||
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.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
||||
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
|
||||
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
|
||||
golang.org/x/term v0.22.0 h1:BbsgPEJULsl2fV/AT3v15Mjva5yXKQDyKf+TbDz7QJk=
|
||||
golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4=
|
||||
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
|
||||
golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24=
|
||||
golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
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.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.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
|
||||
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
|
||||
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
|
||||
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
|
||||
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
|
||||
golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U=
|
||||
golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||
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-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
@@ -926,8 +923,8 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f
|
||||
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||
golang.org/x/tools v0.23.0 h1:SGsXPZ+2l4JsgaCKkx+FQ9YZ5XEtA1GZYuoDjenLjvg=
|
||||
golang.org/x/tools v0.23.0/go.mod h1:pnu6ufv6vQkll6szChhK3C3L/ruaIv5eBeztNG8wtsI=
|
||||
golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ=
|
||||
golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
@@ -947,8 +944,6 @@ google.golang.org/api v0.172.0 h1:/1OcMZGPmW1rX2LCu2CmGUD1KXK1+pfzxotxyRUCCdk=
|
||||
google.golang.org/api v0.172.0/go.mod h1:+fJZq6QXWfa9pXhnIzsjx4yI22d4aI9ZpLb58gvXjis=
|
||||
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.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM=
|
||||
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-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
||||
@@ -976,8 +971,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba
|
||||
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.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
|
||||
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
|
||||
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
|
||||
gopkg.in/DataDog/dd-trace-go.v1 v1.62.0 h1:jeZxE4ZlfAc+R0zO5TEmJBwOLet3NThsOfYJeSQg1x0=
|
||||
gopkg.in/DataDog/dd-trace-go.v1 v1.62.0/go.mod h1:YTvYkk3PTsfw0OWrRFxV/IQ5Gy4nZ5TRvxTAP3JcIzs=
|
||||
gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U=
|
||||
|
18
vendor/cloud.google.com/go/compute/internal/version.go
generated
vendored
18
vendor/cloud.google.com/go/compute/internal/version.go
generated
vendored
@@ -1,18 +0,0 @@
|
||||
// Copyright 2022 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package internal
|
||||
|
||||
// Version is the current tagged release of the library.
|
||||
const Version = "1.25.1"
|
7
vendor/cloud.google.com/go/compute/metadata/CHANGES.md
generated
vendored
7
vendor/cloud.google.com/go/compute/metadata/CHANGES.md
generated
vendored
@@ -1,5 +1,12 @@
|
||||
# Changes
|
||||
|
||||
## [0.3.0](https://github.com/googleapis/google-cloud-go/compare/compute/metadata/v0.2.3...compute/metadata/v0.3.0) (2024-04-15)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **compute/metadata:** Add context aware functions ([#9733](https://github.com/googleapis/google-cloud-go/issues/9733)) ([e4eb5b4](https://github.com/googleapis/google-cloud-go/commit/e4eb5b46ee2aec9d2fc18300bfd66015e25a0510))
|
||||
|
||||
## [0.2.3](https://github.com/googleapis/google-cloud-go/compare/compute/metadata/v0.2.2...compute/metadata/v0.2.3) (2022-12-15)
|
||||
|
||||
|
||||
|
104
vendor/cloud.google.com/go/compute/metadata/metadata.go
generated
vendored
104
vendor/cloud.google.com/go/compute/metadata/metadata.go
generated
vendored
@@ -23,7 +23,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@@ -95,9 +95,9 @@ func (c *cachedValue) get(cl *Client) (v string, err error) {
|
||||
return c.v, nil
|
||||
}
|
||||
if c.trim {
|
||||
v, err = cl.getTrimmed(c.k)
|
||||
v, err = cl.getTrimmed(context.Background(), c.k)
|
||||
} else {
|
||||
v, err = cl.Get(c.k)
|
||||
v, err = cl.GetWithContext(context.Background(), c.k)
|
||||
}
|
||||
if err == nil {
|
||||
c.v = v
|
||||
@@ -197,18 +197,32 @@ func systemInfoSuggestsGCE() bool {
|
||||
// We don't have any non-Linux clues available, at least yet.
|
||||
return false
|
||||
}
|
||||
slurp, _ := ioutil.ReadFile("/sys/class/dmi/id/product_name")
|
||||
slurp, _ := os.ReadFile("/sys/class/dmi/id/product_name")
|
||||
name := strings.TrimSpace(string(slurp))
|
||||
return name == "Google" || name == "Google Compute Engine"
|
||||
}
|
||||
|
||||
// Subscribe calls Client.Subscribe on the default client.
|
||||
// Subscribe calls Client.SubscribeWithContext on the default client.
|
||||
func Subscribe(suffix string, fn func(v string, ok bool) error) error {
|
||||
return defaultClient.Subscribe(suffix, fn)
|
||||
return defaultClient.SubscribeWithContext(context.Background(), suffix, func(ctx context.Context, v string, ok bool) error { return fn(v, ok) })
|
||||
}
|
||||
|
||||
// Get calls Client.Get on the default client.
|
||||
func Get(suffix string) (string, error) { return defaultClient.Get(suffix) }
|
||||
// SubscribeWithContext calls Client.SubscribeWithContext on the default client.
|
||||
func SubscribeWithContext(ctx context.Context, suffix string, fn func(ctx context.Context, v string, ok bool) error) error {
|
||||
return defaultClient.SubscribeWithContext(ctx, suffix, fn)
|
||||
}
|
||||
|
||||
// Get calls Client.GetWithContext on the default client.
|
||||
//
|
||||
// Deprecated: Please use the context aware variant [GetWithContext].
|
||||
func Get(suffix string) (string, error) {
|
||||
return defaultClient.GetWithContext(context.Background(), suffix)
|
||||
}
|
||||
|
||||
// GetWithContext calls Client.GetWithContext on the default client.
|
||||
func GetWithContext(ctx context.Context, suffix string) (string, error) {
|
||||
return defaultClient.GetWithContext(ctx, suffix)
|
||||
}
|
||||
|
||||
// ProjectID returns the current instance's project ID string.
|
||||
func ProjectID() (string, error) { return defaultClient.ProjectID() }
|
||||
@@ -288,8 +302,7 @@ func NewClient(c *http.Client) *Client {
|
||||
|
||||
// getETag returns a value from the metadata service as well as the associated ETag.
|
||||
// This func is otherwise equivalent to Get.
|
||||
func (c *Client) getETag(suffix string) (value, etag string, err error) {
|
||||
ctx := context.TODO()
|
||||
func (c *Client) getETag(ctx context.Context, suffix string) (value, etag string, err error) {
|
||||
// Using a fixed IP makes it very difficult to spoof the metadata service in
|
||||
// a container, which is an important use-case for local testing of cloud
|
||||
// deployments. To enable spoofing of the metadata service, the environment
|
||||
@@ -306,7 +319,7 @@ func (c *Client) getETag(suffix string) (value, etag string, err error) {
|
||||
}
|
||||
suffix = strings.TrimLeft(suffix, "/")
|
||||
u := "http://" + host + "/computeMetadata/v1/" + suffix
|
||||
req, err := http.NewRequest("GET", u, nil)
|
||||
req, err := http.NewRequestWithContext(ctx, "GET", u, nil)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
@@ -336,7 +349,7 @@ func (c *Client) getETag(suffix string) (value, etag string, err error) {
|
||||
if res.StatusCode == http.StatusNotFound {
|
||||
return "", "", NotDefinedError(suffix)
|
||||
}
|
||||
all, err := ioutil.ReadAll(res.Body)
|
||||
all, err := io.ReadAll(res.Body)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
@@ -354,19 +367,33 @@ func (c *Client) getETag(suffix string) (value, etag string, err error) {
|
||||
//
|
||||
// If the requested metadata is not defined, the returned error will
|
||||
// be of type NotDefinedError.
|
||||
//
|
||||
// Deprecated: Please use the context aware variant [Client.GetWithContext].
|
||||
func (c *Client) Get(suffix string) (string, error) {
|
||||
val, _, err := c.getETag(suffix)
|
||||
return c.GetWithContext(context.Background(), suffix)
|
||||
}
|
||||
|
||||
// GetWithContext returns a value from the metadata service.
|
||||
// The suffix is appended to "http://${GCE_METADATA_HOST}/computeMetadata/v1/".
|
||||
//
|
||||
// If the GCE_METADATA_HOST environment variable is not defined, a default of
|
||||
// 169.254.169.254 will be used instead.
|
||||
//
|
||||
// If the requested metadata is not defined, the returned error will
|
||||
// be of type NotDefinedError.
|
||||
func (c *Client) GetWithContext(ctx context.Context, suffix string) (string, error) {
|
||||
val, _, err := c.getETag(ctx, suffix)
|
||||
return val, err
|
||||
}
|
||||
|
||||
func (c *Client) getTrimmed(suffix string) (s string, err error) {
|
||||
s, err = c.Get(suffix)
|
||||
func (c *Client) getTrimmed(ctx context.Context, suffix string) (s string, err error) {
|
||||
s, err = c.GetWithContext(ctx, suffix)
|
||||
s = strings.TrimSpace(s)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Client) lines(suffix string) ([]string, error) {
|
||||
j, err := c.Get(suffix)
|
||||
j, err := c.GetWithContext(context.Background(), suffix)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -388,7 +415,7 @@ func (c *Client) InstanceID() (string, error) { return instID.get(c) }
|
||||
|
||||
// InternalIP returns the instance's primary internal IP address.
|
||||
func (c *Client) InternalIP() (string, error) {
|
||||
return c.getTrimmed("instance/network-interfaces/0/ip")
|
||||
return c.getTrimmed(context.Background(), "instance/network-interfaces/0/ip")
|
||||
}
|
||||
|
||||
// Email returns the email address associated with the service account.
|
||||
@@ -398,25 +425,25 @@ func (c *Client) Email(serviceAccount string) (string, error) {
|
||||
if serviceAccount == "" {
|
||||
serviceAccount = "default"
|
||||
}
|
||||
return c.getTrimmed("instance/service-accounts/" + serviceAccount + "/email")
|
||||
return c.getTrimmed(context.Background(), "instance/service-accounts/"+serviceAccount+"/email")
|
||||
}
|
||||
|
||||
// ExternalIP returns the instance's primary external (public) IP address.
|
||||
func (c *Client) ExternalIP() (string, error) {
|
||||
return c.getTrimmed("instance/network-interfaces/0/access-configs/0/external-ip")
|
||||
return c.getTrimmed(context.Background(), "instance/network-interfaces/0/access-configs/0/external-ip")
|
||||
}
|
||||
|
||||
// Hostname returns the instance's hostname. This will be of the form
|
||||
// "<instanceID>.c.<projID>.internal".
|
||||
func (c *Client) Hostname() (string, error) {
|
||||
return c.getTrimmed("instance/hostname")
|
||||
return c.getTrimmed(context.Background(), "instance/hostname")
|
||||
}
|
||||
|
||||
// InstanceTags returns the list of user-defined instance tags,
|
||||
// assigned when initially creating a GCE instance.
|
||||
func (c *Client) InstanceTags() ([]string, error) {
|
||||
var s []string
|
||||
j, err := c.Get("instance/tags")
|
||||
j, err := c.GetWithContext(context.Background(), "instance/tags")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -428,12 +455,12 @@ func (c *Client) InstanceTags() ([]string, error) {
|
||||
|
||||
// InstanceName returns the current VM's instance ID string.
|
||||
func (c *Client) InstanceName() (string, error) {
|
||||
return c.getTrimmed("instance/name")
|
||||
return c.getTrimmed(context.Background(), "instance/name")
|
||||
}
|
||||
|
||||
// Zone returns the current VM's zone, such as "us-central1-b".
|
||||
func (c *Client) Zone() (string, error) {
|
||||
zone, err := c.getTrimmed("instance/zone")
|
||||
zone, err := c.getTrimmed(context.Background(), "instance/zone")
|
||||
// zone is of the form "projects/<projNum>/zones/<zoneName>".
|
||||
if err != nil {
|
||||
return "", err
|
||||
@@ -460,7 +487,7 @@ func (c *Client) ProjectAttributes() ([]string, error) { return c.lines("project
|
||||
// InstanceAttributeValue may return ("", nil) if the attribute was
|
||||
// defined to be the empty string.
|
||||
func (c *Client) InstanceAttributeValue(attr string) (string, error) {
|
||||
return c.Get("instance/attributes/" + attr)
|
||||
return c.GetWithContext(context.Background(), "instance/attributes/"+attr)
|
||||
}
|
||||
|
||||
// ProjectAttributeValue returns the value of the provided
|
||||
@@ -472,7 +499,7 @@ func (c *Client) InstanceAttributeValue(attr string) (string, error) {
|
||||
// ProjectAttributeValue may return ("", nil) if the attribute was
|
||||
// defined to be the empty string.
|
||||
func (c *Client) ProjectAttributeValue(attr string) (string, error) {
|
||||
return c.Get("project/attributes/" + attr)
|
||||
return c.GetWithContext(context.Background(), "project/attributes/"+attr)
|
||||
}
|
||||
|
||||
// Scopes returns the service account scopes for the given account.
|
||||
@@ -489,21 +516,30 @@ func (c *Client) Scopes(serviceAccount string) ([]string, error) {
|
||||
// The suffix is appended to "http://${GCE_METADATA_HOST}/computeMetadata/v1/".
|
||||
// The suffix may contain query parameters.
|
||||
//
|
||||
// Subscribe calls fn with the latest metadata value indicated by the provided
|
||||
// suffix. If the metadata value is deleted, fn is called with the empty string
|
||||
// and ok false. Subscribe blocks until fn returns a non-nil error or the value
|
||||
// is deleted. Subscribe returns the error value returned from the last call to
|
||||
// fn, which may be nil when ok == false.
|
||||
// Deprecated: Please use the context aware variant [Client.SubscribeWithContext].
|
||||
func (c *Client) Subscribe(suffix string, fn func(v string, ok bool) error) error {
|
||||
return c.SubscribeWithContext(context.Background(), suffix, func(ctx context.Context, v string, ok bool) error { return fn(v, ok) })
|
||||
}
|
||||
|
||||
// SubscribeWithContext subscribes to a value from the metadata service.
|
||||
// The suffix is appended to "http://${GCE_METADATA_HOST}/computeMetadata/v1/".
|
||||
// The suffix may contain query parameters.
|
||||
//
|
||||
// SubscribeWithContext calls fn with the latest metadata value indicated by the
|
||||
// provided suffix. If the metadata value is deleted, fn is called with the
|
||||
// empty string and ok false. Subscribe blocks until fn returns a non-nil error
|
||||
// or the value is deleted. Subscribe returns the error value returned from the
|
||||
// last call to fn, which may be nil when ok == false.
|
||||
func (c *Client) SubscribeWithContext(ctx context.Context, suffix string, fn func(ctx context.Context, v string, ok bool) error) error {
|
||||
const failedSubscribeSleep = time.Second * 5
|
||||
|
||||
// First check to see if the metadata value exists at all.
|
||||
val, lastETag, err := c.getETag(suffix)
|
||||
val, lastETag, err := c.getETag(ctx, suffix)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := fn(val, true); err != nil {
|
||||
if err := fn(ctx, val, true); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -514,7 +550,7 @@ func (c *Client) Subscribe(suffix string, fn func(v string, ok bool) error) erro
|
||||
suffix += "?wait_for_change=true&last_etag="
|
||||
}
|
||||
for {
|
||||
val, etag, err := c.getETag(suffix + url.QueryEscape(lastETag))
|
||||
val, etag, err := c.getETag(ctx, suffix+url.QueryEscape(lastETag))
|
||||
if err != nil {
|
||||
if _, deleted := err.(NotDefinedError); !deleted {
|
||||
time.Sleep(failedSubscribeSleep)
|
||||
@@ -524,7 +560,7 @@ func (c *Client) Subscribe(suffix string, fn func(v string, ok bool) error) erro
|
||||
}
|
||||
lastETag = etag
|
||||
|
||||
if err := fn(val, ok); err != nil || !ok {
|
||||
if err := fn(ctx, val, ok); err != nil || !ok {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
2
vendor/cloud.google.com/go/compute/metadata/retry.go
generated
vendored
2
vendor/cloud.google.com/go/compute/metadata/retry.go
generated
vendored
@@ -27,7 +27,7 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
syscallRetryable = func(err error) bool { return false }
|
||||
syscallRetryable = func(error) bool { return false }
|
||||
)
|
||||
|
||||
// defaultBackoff is basically equivalent to gax.Backoff without the need for
|
||||
|
23
vendor/cloud.google.com/go/compute/metadata/tidyfix.go
generated
vendored
23
vendor/cloud.google.com/go/compute/metadata/tidyfix.go
generated
vendored
@@ -1,23 +0,0 @@
|
||||
// Copyright 2022 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// This file, and the {{.RootMod}} import, won't actually become part of
|
||||
// the resultant binary.
|
||||
//go:build modhack
|
||||
// +build modhack
|
||||
|
||||
package metadata
|
||||
|
||||
// Necessary for safely adding multi-module repo. See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository
|
||||
import _ "cloud.google.com/go/compute/internal"
|
2
vendor/github.com/calmh/xdr/unmarshal.go
generated
vendored
2
vendor/github.com/calmh/xdr/unmarshal.go
generated
vendored
@@ -62,7 +62,7 @@ func (u *Unmarshaller) UnmarshalBytesMax(max int) []byte {
|
||||
u.Error = ElementSizeExceeded("bytes field", l, max)
|
||||
return nil
|
||||
}
|
||||
if len(u.Data) < l+4 {
|
||||
if len(u.Data) < 4+l+Padding(l) {
|
||||
u.Error = io.ErrUnexpectedEOF
|
||||
return nil
|
||||
}
|
||||
|
42
vendor/github.com/ccding/go-stun/stun/client.go
generated
vendored
42
vendor/github.com/ccding/go-stun/stun/client.go
generated
vendored
@@ -16,6 +16,7 @@ package stun
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"strconv"
|
||||
)
|
||||
@@ -24,6 +25,8 @@ import (
|
||||
// to discover NAT type.
|
||||
type Client struct {
|
||||
serverAddr string
|
||||
localIP string
|
||||
localPort int
|
||||
softwareName string
|
||||
conn net.PacketConn
|
||||
logger *Logger
|
||||
@@ -70,6 +73,16 @@ func (c *Client) SetServerAddr(address string) {
|
||||
c.serverAddr = address
|
||||
}
|
||||
|
||||
// SetLocalPort allows user to set the local port to send request.
|
||||
func (c *Client) SetLocalPort(port int) {
|
||||
c.localPort = port
|
||||
}
|
||||
|
||||
// SetLocalIP allows user to set the local ip address to send request.
|
||||
func (c *Client) SetLocalIP(ip string) {
|
||||
c.localIP = ip
|
||||
}
|
||||
|
||||
// SetSoftwareName allows user to set the name of the software, which is used
|
||||
// for logging purpose (NOT used in the current implementation).
|
||||
func (c *Client) SetSoftwareName(name string) {
|
||||
@@ -90,7 +103,20 @@ func (c *Client) Discover() (NATType, *Host, error) {
|
||||
// create a connection and close it at the end.
|
||||
conn := c.conn
|
||||
if conn == nil {
|
||||
conn, err = net.ListenUDP("udp", nil)
|
||||
var laddr *net.UDPAddr
|
||||
|
||||
if c.localPort != 0 || c.localIP != "" {
|
||||
var address = fmt.Sprintf("%s:%d", c.localIP, c.localPort)
|
||||
|
||||
laddr, err = net.ResolveUDPAddr("udp", address)
|
||||
if err != nil {
|
||||
return NATError, nil, err
|
||||
}
|
||||
|
||||
c.logger.Debugln("Local listen address: " + address)
|
||||
}
|
||||
|
||||
conn, err = net.ListenUDP("udp", laddr)
|
||||
if err != nil {
|
||||
return NATError, nil, err
|
||||
}
|
||||
@@ -99,6 +125,7 @@ func (c *Client) Discover() (NATType, *Host, error) {
|
||||
return c.discover(conn, serverUDPAddr)
|
||||
}
|
||||
|
||||
// BehaviorTest performs STUN behavior tests.
|
||||
func (c *Client) BehaviorTest() (*NATBehavior, error) {
|
||||
if c.serverAddr == "" {
|
||||
c.SetServerAddr(DefaultServerAddr)
|
||||
@@ -111,7 +138,18 @@ func (c *Client) BehaviorTest() (*NATBehavior, error) {
|
||||
// create a connection and close it at the end.
|
||||
conn := c.conn
|
||||
if conn == nil {
|
||||
conn, err = net.ListenUDP("udp", nil)
|
||||
var laddr *net.UDPAddr
|
||||
if c.localPort != 0 || c.localIP != "" {
|
||||
var address = fmt.Sprintf("%s:%d", c.localIP, c.localPort)
|
||||
|
||||
laddr, err = net.ResolveUDPAddr("udp", address)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
c.logger.Debugln("Local listen address: " + address)
|
||||
}
|
||||
conn, err = net.ListenUDP("udp", laddr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
13
vendor/github.com/ccding/go-stun/stun/const.go
generated
vendored
13
vendor/github.com/ccding/go-stun/stun/const.go
generated
vendored
@@ -28,9 +28,10 @@ const (
|
||||
// NATType is the type of NAT described by int.
|
||||
type NATType int
|
||||
|
||||
// NAT behavior type
|
||||
// BehaviorType is NAT behavior type.
|
||||
type BehaviorType int
|
||||
|
||||
// NATBehavior is NAT behavior type of MappingType and FilteringType.
|
||||
type NATBehavior struct {
|
||||
MappingType BehaviorType
|
||||
FilteringType BehaviorType
|
||||
@@ -54,6 +55,7 @@ const (
|
||||
NATSymmetricUDPFirewall = SymmetricUDPFirewall
|
||||
)
|
||||
|
||||
// Behavior types.
|
||||
const (
|
||||
BehaviorTypeUnknown BehaviorType = iota
|
||||
BehaviorTypeEndpoint
|
||||
@@ -86,10 +88,10 @@ func init() {
|
||||
|
||||
// Defined in RFC 3489
|
||||
natNormalTypeStr = map[NATBehavior]string{
|
||||
NATBehavior{BehaviorTypeEndpoint, BehaviorTypeEndpoint}: "Full cone NAT",
|
||||
NATBehavior{BehaviorTypeEndpoint, BehaviorTypeAddr}: "Restricted cone NAT",
|
||||
NATBehavior{BehaviorTypeEndpoint, BehaviorTypeAddrAndPort}: "Port Restricted cone NAT",
|
||||
NATBehavior{BehaviorTypeAddrAndPort, BehaviorTypeAddrAndPort}: "Symmetric NAT",
|
||||
{BehaviorTypeEndpoint, BehaviorTypeEndpoint}: "Full cone NAT",
|
||||
{BehaviorTypeEndpoint, BehaviorTypeAddr}: "Restricted cone NAT",
|
||||
{BehaviorTypeEndpoint, BehaviorTypeAddrAndPort}: "Port Restricted cone NAT",
|
||||
{BehaviorTypeAddrAndPort, BehaviorTypeAddrAndPort}: "Symmetric NAT",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,6 +109,7 @@ func (natBhType BehaviorType) String() string {
|
||||
return "Unknown"
|
||||
}
|
||||
|
||||
// NormalType returns the normal NAT type of the NatBehavior.
|
||||
func (natBehavior NATBehavior) NormalType() string {
|
||||
if s, ok := natNormalTypeStr[natBehavior]; ok {
|
||||
return s
|
||||
|
6
vendor/github.com/ccding/go-stun/stun/discover.go
generated
vendored
6
vendor/github.com/ccding/go-stun/stun/discover.go
generated
vendored
@@ -93,7 +93,7 @@ func (c *Client) discover(conn net.PacketConn, addr *net.UDPAddr) (NATType, *Hos
|
||||
}
|
||||
// changedAddr shall not be nil
|
||||
if changedAddr == nil {
|
||||
return NATError, mappedAddr, errors.New("Server error: no changed address.")
|
||||
return NATError, mappedAddr, errors.New("Server error: no changed address")
|
||||
}
|
||||
// Perform test2 to see if the client can receive packet sent from
|
||||
// another IP and port.
|
||||
@@ -177,7 +177,7 @@ func (c *Client) behaviorTest(conn net.PacketConn, addr *net.UDPAddr) (*NATBehav
|
||||
}
|
||||
// identical used to check if it is open Internet or not.
|
||||
if resp1.identical {
|
||||
return nil, errors.New("Not behind a NAT.")
|
||||
return nil, errors.New("Not behind a NAT")
|
||||
}
|
||||
// use otherAddr or changedAddr
|
||||
otherAddr := resp1.otherAddr
|
||||
@@ -185,7 +185,7 @@ func (c *Client) behaviorTest(conn net.PacketConn, addr *net.UDPAddr) (*NATBehav
|
||||
if resp1.changedAddr != nil {
|
||||
otherAddr = resp1.changedAddr
|
||||
} else {
|
||||
return nil, errors.New("Server error: no other address and changed address.")
|
||||
return nil, errors.New("Server error: no other address and changed address")
|
||||
}
|
||||
}
|
||||
|
||||
|
2
vendor/github.com/ccding/go-stun/stun/net.go
generated
vendored
2
vendor/github.com/ccding/go-stun/stun/net.go
generated
vendored
@@ -67,7 +67,7 @@ func (c *Client) send(pkt *packet, conn net.PacketConn, addr net.Addr) (*respons
|
||||
return nil, err
|
||||
}
|
||||
if length != len(pkt.bytes()) {
|
||||
return nil, errors.New("Error in sending data.")
|
||||
return nil, errors.New("Error in sending data")
|
||||
}
|
||||
err = conn.SetReadDeadline(time.Now().Add(time.Duration(timeout) * time.Millisecond))
|
||||
if err != nil {
|
||||
|
6
vendor/github.com/ccding/go-stun/stun/packet.go
generated
vendored
6
vendor/github.com/ccding/go-stun/stun/packet.go
generated
vendored
@@ -43,10 +43,10 @@ func newPacket() (*packet, error) {
|
||||
|
||||
func newPacketFromBytes(packetBytes []byte) (*packet, error) {
|
||||
if len(packetBytes) < 20 {
|
||||
return nil, errors.New("Received data length too short.")
|
||||
return nil, errors.New("Received data length too short")
|
||||
}
|
||||
if len(packetBytes) > math.MaxUint16+20 {
|
||||
return nil, errors.New("Received data length too long.")
|
||||
return nil, errors.New("Received data length too long")
|
||||
}
|
||||
pkt := new(packet)
|
||||
pkt.types = binary.BigEndian.Uint16(packetBytes[0:2])
|
||||
@@ -59,7 +59,7 @@ func newPacketFromBytes(packetBytes []byte) (*packet, error) {
|
||||
length := binary.BigEndian.Uint16(packetBytes[pos+2 : pos+4])
|
||||
end := pos + 4 + length
|
||||
if end < pos+4 || end > uint16(len(packetBytes)) {
|
||||
return nil, errors.New("Received data format mismatch.")
|
||||
return nil, errors.New("Received data format mismatch")
|
||||
}
|
||||
value := packetBytes[pos+4 : end]
|
||||
attribute := newAttribute(types, value)
|
||||
|
4
vendor/github.com/ccding/go-stun/stun/tests.go
generated
vendored
4
vendor/github.com/ccding/go-stun/stun/tests.go
generated
vendored
@@ -26,8 +26,8 @@ func (c *Client) sendWithLog(conn net.PacketConn, addr *net.UDPAddr, changeIP bo
|
||||
return nil, err
|
||||
}
|
||||
c.logger.Debugln("Received:", resp)
|
||||
if resp == nil && changeIP == false && changePort == false {
|
||||
return nil, errors.New("NAT blocked.")
|
||||
if resp == nil && !changeIP && !changePort {
|
||||
return nil, errors.New("NAT blocked")
|
||||
}
|
||||
if resp != nil && !addrCompare(resp.serverAddr, addr, changeIP, changePort) {
|
||||
return nil, errors.New("Server error: response IP/port")
|
||||
|
189
vendor/github.com/go-asn1-ber/asn1-ber/ber.go
generated
vendored
189
vendor/github.com/go-asn1-ber/asn1-ber/ber.go
generated
vendored
@@ -5,9 +5,12 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"math"
|
||||
"os"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
)
|
||||
@@ -352,13 +355,22 @@ func readPacket(reader io.Reader) (*Packet, int, error) {
|
||||
if MaxPacketLengthBytes > 0 && int64(length) > MaxPacketLengthBytes {
|
||||
return nil, read, fmt.Errorf("length %d greater than maximum %d", length, MaxPacketLengthBytes)
|
||||
}
|
||||
content := make([]byte, length)
|
||||
|
||||
var content []byte
|
||||
if length > 0 {
|
||||
_, err := io.ReadFull(reader, content)
|
||||
// Read the content and limit it to the parsed length.
|
||||
// If the content is less than the length, we return an EOF error.
|
||||
content, err = ioutil.ReadAll(io.LimitReader(reader, int64(length)))
|
||||
if err == nil && len(content) < int(length) {
|
||||
err = io.EOF
|
||||
}
|
||||
if err != nil {
|
||||
return nil, read, unexpectedEOF(err)
|
||||
}
|
||||
read += length
|
||||
read += len(content)
|
||||
} else {
|
||||
// If length == 0, we set the ByteValue to an empty slice
|
||||
content = make([]byte, 0)
|
||||
}
|
||||
|
||||
if p.ClassType == ClassUniversal {
|
||||
@@ -381,6 +393,10 @@ func readPacket(reader io.Reader) (*Packet, int, error) {
|
||||
p.Value = DecodeString(content)
|
||||
case TagNULL:
|
||||
case TagObjectIdentifier:
|
||||
oid, err := parseObjectIdentifier(content)
|
||||
if err == nil {
|
||||
p.Value = OIDToString(oid)
|
||||
}
|
||||
case TagObjectDescriptor:
|
||||
case TagExternal:
|
||||
case TagRealFloat:
|
||||
@@ -396,6 +412,10 @@ func readPacket(reader io.Reader) (*Packet, int, error) {
|
||||
p.Value = val
|
||||
}
|
||||
case TagRelativeOID:
|
||||
oid, err := parseObjectIdentifier(content)
|
||||
if err == nil {
|
||||
p.Value = OIDToString(oid)
|
||||
}
|
||||
case TagSequence:
|
||||
case TagSet:
|
||||
case TagNumericString:
|
||||
@@ -623,3 +643,166 @@ func NewReal(classType Class, tagType Type, tag Tag, value interface{}, descript
|
||||
}
|
||||
return p
|
||||
}
|
||||
|
||||
func NewOID(classType Class, tagType Type, tag Tag, value interface{}, description string) *Packet {
|
||||
p := Encode(classType, tagType, tag, nil, description)
|
||||
|
||||
switch v := value.(type) {
|
||||
case string:
|
||||
encoded, err := encodeOID(v)
|
||||
if err != nil {
|
||||
fmt.Printf("failed writing %v", err)
|
||||
return nil
|
||||
}
|
||||
p.Value = v
|
||||
p.Data.Write(encoded)
|
||||
// TODO: support []int already ?
|
||||
default:
|
||||
panic(fmt.Sprintf("Invalid type %T, expected float{64|32}", v))
|
||||
}
|
||||
return p
|
||||
}
|
||||
|
||||
// encodeOID takes a string representation of an OID and returns its DER-encoded byte slice along with any error.
|
||||
func encodeOID(oidString string) ([]byte, error) {
|
||||
// Convert the string representation to an asn1.ObjectIdentifier
|
||||
parts := strings.Split(oidString, ".")
|
||||
oid := make([]int, len(parts))
|
||||
for i, part := range parts {
|
||||
var val int
|
||||
if _, err := fmt.Sscanf(part, "%d", &val); err != nil {
|
||||
return nil, fmt.Errorf("invalid OID part '%s': %w", part, err)
|
||||
}
|
||||
oid[i] = val
|
||||
}
|
||||
if len(oid) < 2 || oid[0] > 2 || (oid[0] < 2 && oid[1] >= 40) {
|
||||
panic(fmt.Sprintf("invalid object identifier % d", oid)) // TODO: not elegant
|
||||
}
|
||||
encoded := make([]byte, 0)
|
||||
|
||||
encoded = appendBase128Int(encoded[:0], int64(oid[0]*40+oid[1]))
|
||||
for i := 2; i < len(oid); i++ {
|
||||
encoded = appendBase128Int(encoded, int64(oid[i]))
|
||||
}
|
||||
|
||||
return encoded, nil
|
||||
}
|
||||
|
||||
func appendBase128Int(dst []byte, n int64) []byte {
|
||||
l := base128IntLength(n)
|
||||
|
||||
for i := l - 1; i >= 0; i-- {
|
||||
o := byte(n >> uint(i*7))
|
||||
o &= 0x7f
|
||||
if i != 0 {
|
||||
o |= 0x80
|
||||
}
|
||||
|
||||
dst = append(dst, o)
|
||||
}
|
||||
|
||||
return dst
|
||||
}
|
||||
func base128IntLength(n int64) int {
|
||||
if n == 0 {
|
||||
return 1
|
||||
}
|
||||
|
||||
l := 0
|
||||
for i := n; i > 0; i >>= 7 {
|
||||
l++
|
||||
}
|
||||
|
||||
return l
|
||||
}
|
||||
|
||||
func OIDToString(oi []int) string {
|
||||
var s strings.Builder
|
||||
s.Grow(32)
|
||||
|
||||
buf := make([]byte, 0, 19)
|
||||
for i, v := range oi {
|
||||
if i > 0 {
|
||||
s.WriteByte('.')
|
||||
}
|
||||
s.Write(strconv.AppendInt(buf, int64(v), 10))
|
||||
}
|
||||
|
||||
return s.String()
|
||||
}
|
||||
|
||||
// parseObjectIdentifier parses an OBJECT IDENTIFIER from the given bytes and
|
||||
// returns it. An object identifier is a sequence of variable length integers
|
||||
// that are assigned in a hierarchy.
|
||||
func parseObjectIdentifier(bytes []byte) (s []int, err error) {
|
||||
if len(bytes) == 0 {
|
||||
err = fmt.Errorf("zero length OBJECT IDENTIFIER")
|
||||
return
|
||||
}
|
||||
|
||||
// In the worst case, we get two elements from the first byte (which is
|
||||
// encoded differently) and then every varint is a single byte long.
|
||||
s = make([]int, len(bytes)+1)
|
||||
|
||||
// The first varint is 40*value1 + value2:
|
||||
// According to this packing, value1 can take the values 0, 1 and 2 only.
|
||||
// When value1 = 0 or value1 = 1, then value2 is <= 39. When value1 = 2,
|
||||
// then there are no restrictions on value2.
|
||||
v, offset, err := parseBase128Int(bytes, 0)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if v < 80 {
|
||||
s[0] = v / 40
|
||||
s[1] = v % 40
|
||||
} else {
|
||||
s[0] = 2
|
||||
s[1] = v - 80
|
||||
}
|
||||
|
||||
i := 2
|
||||
for ; offset < len(bytes); i++ {
|
||||
v, offset, err = parseBase128Int(bytes, offset)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
s[i] = v
|
||||
}
|
||||
s = s[0:i]
|
||||
return
|
||||
}
|
||||
|
||||
// parseBase128Int parses a base-128 encoded int from the given offset in the
|
||||
// given byte slice. It returns the value and the new offset.
|
||||
func parseBase128Int(bytes []byte, initOffset int) (ret, offset int, err error) {
|
||||
offset = initOffset
|
||||
var ret64 int64
|
||||
for shifted := 0; offset < len(bytes); shifted++ {
|
||||
// 5 * 7 bits per byte == 35 bits of data
|
||||
// Thus the representation is either non-minimal or too large for an int32
|
||||
if shifted == 5 {
|
||||
err = fmt.Errorf("base 128 integer too large")
|
||||
return
|
||||
}
|
||||
ret64 <<= 7
|
||||
b := bytes[offset]
|
||||
// integers should be minimally encoded, so the leading octet should
|
||||
// never be 0x80
|
||||
if shifted == 0 && b == 0x80 {
|
||||
err = fmt.Errorf("integer is not minimally encoded")
|
||||
return
|
||||
}
|
||||
ret64 |= int64(b & 0x7f)
|
||||
offset++
|
||||
if b&0x80 == 0 {
|
||||
ret = int(ret64)
|
||||
// Ensure that the returned value fits in an int on all platforms
|
||||
if ret64 > math.MaxInt32 {
|
||||
err = fmt.Errorf("base 128 integer too large")
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
err = fmt.Errorf("truncated base 128 integer")
|
||||
return
|
||||
}
|
||||
|
15
vendor/github.com/go-ldap/ldap/v3/conn.go
generated
vendored
15
vendor/github.com/go-ldap/ldap/v3/conn.go
generated
vendored
@@ -143,7 +143,8 @@ func DialWithTLSConfig(tc *tls.Config) DialOpt {
|
||||
|
||||
// DialWithTLSDialer is a wrapper for DialWithTLSConfig with the option to
|
||||
// specify a net.Dialer to for example define a timeout or a custom resolver.
|
||||
// @deprecated Use DialWithDialer and DialWithTLSConfig instead
|
||||
//
|
||||
// Deprecated: Use DialWithDialer and DialWithTLSConfig instead
|
||||
func DialWithTLSDialer(tlsConfig *tls.Config, dialer *net.Dialer) DialOpt {
|
||||
return func(dc *DialContext) {
|
||||
dc.tlsConfig = tlsConfig
|
||||
@@ -195,7 +196,8 @@ func (dc *DialContext) dial(u *url.URL) (net.Conn, error) {
|
||||
|
||||
// Dial connects to the given address on the given network using net.Dial
|
||||
// and then returns a new Conn for the connection.
|
||||
// @deprecated Use DialURL instead.
|
||||
//
|
||||
// Deprecated: Use DialURL instead.
|
||||
func Dial(network, addr string) (*Conn, error) {
|
||||
c, err := net.DialTimeout(network, addr, DefaultTimeout)
|
||||
if err != nil {
|
||||
@@ -208,7 +210,8 @@ func Dial(network, addr string) (*Conn, error) {
|
||||
|
||||
// DialTLS connects to the given address on the given network using tls.Dial
|
||||
// and then returns a new Conn for the connection.
|
||||
// @deprecated Use DialURL instead.
|
||||
//
|
||||
// Deprecated: Use DialURL instead.
|
||||
func DialTLS(network, addr string, config *tls.Config) (*Conn, error) {
|
||||
c, err := tls.DialWithDialer(&net.Dialer{Timeout: DefaultTimeout}, network, addr, config)
|
||||
if err != nil {
|
||||
@@ -262,7 +265,11 @@ func NewConn(conn net.Conn, isTLS bool) *Conn {
|
||||
return l
|
||||
}
|
||||
|
||||
// Start initializes goroutines to read responses and process messages
|
||||
// Start initialises goroutines to read replies and process messages.
|
||||
// Warning: Calling this function in addition to Dial or DialURL
|
||||
// may cause race conditions.
|
||||
//
|
||||
// See: https://github.com/go-ldap/ldap/issues/356
|
||||
func (l *Conn) Start() {
|
||||
go l.reader()
|
||||
go l.processMessages()
|
||||
|
2
vendor/github.com/go-ldap/ldap/v3/control.go
generated
vendored
2
vendor/github.com/go-ldap/ldap/v3/control.go
generated
vendored
@@ -635,7 +635,7 @@ type ControlDirSync struct {
|
||||
Cookie []byte
|
||||
}
|
||||
|
||||
// @deprecated Use NewRequestControlDirSync instead
|
||||
// Deprecated: Use NewRequestControlDirSync instead
|
||||
func NewControlDirSync(flags int64, maxAttrCount int64, cookie []byte) *ControlDirSync {
|
||||
return NewRequestControlDirSync(flags, maxAttrCount, cookie)
|
||||
}
|
||||
|
404
vendor/github.com/go-ldap/ldap/v3/dn.go
generated
vendored
404
vendor/github.com/go-ldap/ldap/v3/dn.go
generated
vendored
@@ -1,14 +1,14 @@
|
||||
package ldap
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
enchex "encoding/hex"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
ber "github.com/go-asn1-ber/asn1-ber"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
ber "github.com/go-asn1-ber/asn1-ber"
|
||||
"unicode"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
// AttributeTypeAndValue represents an attributeTypeAndValue from https://tools.ietf.org/html/rfc4514
|
||||
@@ -19,62 +19,45 @@ type AttributeTypeAndValue struct {
|
||||
Value string
|
||||
}
|
||||
|
||||
// String returns a normalized string representation of this attribute type and
|
||||
// value pair which is the a lowercased join of the Type and Value with a "=".
|
||||
func (a *AttributeTypeAndValue) String() string {
|
||||
return strings.ToLower(a.Type) + "=" + a.encodeValue()
|
||||
func (a *AttributeTypeAndValue) setType(str string) error {
|
||||
result, err := decodeString(str)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
a.Type = result
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *AttributeTypeAndValue) encodeValue() string {
|
||||
// Normalize the value first.
|
||||
// value := strings.ToLower(a.Value)
|
||||
value := a.Value
|
||||
|
||||
encodedBuf := bytes.Buffer{}
|
||||
|
||||
escapeChar := func(c byte) {
|
||||
encodedBuf.WriteByte('\\')
|
||||
encodedBuf.WriteByte(c)
|
||||
func (a *AttributeTypeAndValue) setValue(s string) error {
|
||||
// https://www.ietf.org/rfc/rfc4514.html#section-2.4
|
||||
// If the AttributeType is of the dotted-decimal form, the
|
||||
// AttributeValue is represented by an number sign ('#' U+0023)
|
||||
// character followed by the hexadecimal encoding of each of the octets
|
||||
// of the BER encoding of the X.500 AttributeValue.
|
||||
if len(s) > 0 && s[0] == '#' {
|
||||
decodedString, err := decodeEncodedString(s[1:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
escapeHex := func(c byte) {
|
||||
encodedBuf.WriteByte('\\')
|
||||
encodedBuf.WriteString(enchex.EncodeToString([]byte{c}))
|
||||
a.Value = decodedString
|
||||
return nil
|
||||
} else {
|
||||
decodedString, err := decodeString(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for i := 0; i < len(value); i++ {
|
||||
char := value[i]
|
||||
if i == 0 && char == ' ' || char == '#' {
|
||||
// Special case leading space or number sign.
|
||||
escapeChar(char)
|
||||
continue
|
||||
}
|
||||
if i == len(value)-1 && char == ' ' {
|
||||
// Special case trailing space.
|
||||
escapeChar(char)
|
||||
continue
|
||||
a.Value = decodedString
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
switch char {
|
||||
case '"', '+', ',', ';', '<', '>', '\\':
|
||||
// Each of these special characters must be escaped.
|
||||
escapeChar(char)
|
||||
continue
|
||||
}
|
||||
|
||||
if char < ' ' || char > '~' {
|
||||
// All special character escapes are handled first
|
||||
// above. All bytes less than ASCII SPACE and all bytes
|
||||
// greater than ASCII TILDE must be hex-escaped.
|
||||
escapeHex(char)
|
||||
continue
|
||||
}
|
||||
|
||||
// Any other character does not require escaping.
|
||||
encodedBuf.WriteByte(char)
|
||||
}
|
||||
|
||||
return encodedBuf.String()
|
||||
// String returns a normalized string representation of this attribute type and
|
||||
// value pair which is the lowercase join of the Type and Value with a "=".
|
||||
func (a *AttributeTypeAndValue) String() string {
|
||||
return encodeString(foldString(a.Type), false) + "=" + encodeString(a.Value, true)
|
||||
}
|
||||
|
||||
// RelativeDN represents a relativeDistinguishedName from https://tools.ietf.org/html/rfc4514
|
||||
@@ -108,114 +91,218 @@ func (d *DN) String() string {
|
||||
return strings.Join(rdns, ",")
|
||||
}
|
||||
|
||||
func stripLeadingAndTrailingSpaces(inVal string) string {
|
||||
noSpaces := strings.Trim(inVal, " ")
|
||||
|
||||
// Re-add the trailing space if it was an escaped space
|
||||
if len(noSpaces) > 0 && noSpaces[len(noSpaces)-1] == '\\' && inVal[len(inVal)-1] == ' ' {
|
||||
noSpaces = noSpaces + " "
|
||||
}
|
||||
|
||||
return noSpaces
|
||||
}
|
||||
|
||||
// Remove leading and trailing spaces from the attribute type and value
|
||||
// and unescape any escaped characters in these fields
|
||||
//
|
||||
// decodeString is based on https://github.com/inteon/cert-manager/blob/ed280d28cd02b262c5db46054d88e70ab518299c/pkg/util/pki/internal/dn.go#L170
|
||||
func decodeString(str string) (string, error) {
|
||||
s := []rune(stripLeadingAndTrailingSpaces(str))
|
||||
|
||||
builder := strings.Builder{}
|
||||
for i := 0; i < len(s); i++ {
|
||||
char := s[i]
|
||||
|
||||
// If the character is not an escape character, just add it to the
|
||||
// builder and continue
|
||||
if char != '\\' {
|
||||
builder.WriteRune(char)
|
||||
continue
|
||||
}
|
||||
|
||||
// If the escape character is the last character, it's a corrupted
|
||||
// escaped character
|
||||
if i+1 >= len(s) {
|
||||
return "", fmt.Errorf("got corrupted escaped character: '%s'", string(s))
|
||||
}
|
||||
|
||||
// If the escaped character is a special character, just add it to
|
||||
// the builder and continue
|
||||
switch s[i+1] {
|
||||
case ' ', '"', '#', '+', ',', ';', '<', '=', '>', '\\':
|
||||
builder.WriteRune(s[i+1])
|
||||
i++
|
||||
continue
|
||||
}
|
||||
|
||||
// If the escaped character is not a special character, it should
|
||||
// be a hex-encoded character of the form \XX if it's not at least
|
||||
// two characters long, it's a corrupted escaped character
|
||||
if i+2 >= len(s) {
|
||||
return "", errors.New("failed to decode escaped character: encoding/hex: invalid byte: " + string(s[i+1]))
|
||||
}
|
||||
|
||||
// Get the runes for the two characters after the escape character
|
||||
// and convert them to a byte slice
|
||||
xx := []byte(string(s[i+1 : i+3]))
|
||||
|
||||
// If the two runes are not hex characters and result in more than
|
||||
// two bytes when converted to a byte slice, it's a corrupted
|
||||
// escaped character
|
||||
if len(xx) != 2 {
|
||||
return "", errors.New("failed to decode escaped character: invalid byte: " + string(xx))
|
||||
}
|
||||
|
||||
// Decode the hex-encoded character and add it to the builder
|
||||
dst := []byte{0}
|
||||
if n, err := hex.Decode(dst, xx); err != nil {
|
||||
return "", errors.New("failed to decode escaped character: " + err.Error())
|
||||
} else if n != 1 {
|
||||
return "", fmt.Errorf("failed to decode escaped character: encoding/hex: expected 1 byte when un-escaping, got %d", n)
|
||||
}
|
||||
|
||||
builder.WriteByte(dst[0])
|
||||
i += 2
|
||||
}
|
||||
|
||||
return builder.String(), nil
|
||||
}
|
||||
|
||||
// Escape a string according to RFC 4514
|
||||
func encodeString(value string, isValue bool) string {
|
||||
builder := strings.Builder{}
|
||||
|
||||
escapeChar := func(c byte) {
|
||||
builder.WriteByte('\\')
|
||||
builder.WriteByte(c)
|
||||
}
|
||||
|
||||
escapeHex := func(c byte) {
|
||||
builder.WriteByte('\\')
|
||||
builder.WriteString(hex.EncodeToString([]byte{c}))
|
||||
}
|
||||
|
||||
// Loop through each byte and escape as necessary.
|
||||
// Runes that take up more than one byte are escaped
|
||||
// byte by byte (since both bytes are non-ASCII).
|
||||
for i := 0; i < len(value); i++ {
|
||||
char := value[i]
|
||||
if i == 0 && (char == ' ' || char == '#') {
|
||||
// Special case leading space or number sign.
|
||||
escapeChar(char)
|
||||
continue
|
||||
}
|
||||
if i == len(value)-1 && char == ' ' {
|
||||
// Special case trailing space.
|
||||
escapeChar(char)
|
||||
continue
|
||||
}
|
||||
|
||||
switch char {
|
||||
case '"', '+', ',', ';', '<', '>', '\\':
|
||||
// Each of these special characters must be escaped.
|
||||
escapeChar(char)
|
||||
continue
|
||||
}
|
||||
|
||||
if !isValue && char == '=' {
|
||||
// Equal signs have to be escaped only in the type part of
|
||||
// the attribute type and value pair.
|
||||
escapeChar(char)
|
||||
continue
|
||||
}
|
||||
|
||||
if char < ' ' || char > '~' {
|
||||
// All special character escapes are handled first
|
||||
// above. All bytes less than ASCII SPACE and all bytes
|
||||
// greater than ASCII TILDE must be hex-escaped.
|
||||
escapeHex(char)
|
||||
continue
|
||||
}
|
||||
|
||||
// Any other character does not require escaping.
|
||||
builder.WriteByte(char)
|
||||
}
|
||||
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
func decodeEncodedString(str string) (string, error) {
|
||||
decoded, err := hex.DecodeString(str)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to decode BER encoding: %w", err)
|
||||
}
|
||||
|
||||
packet, err := ber.DecodePacketErr(decoded)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to decode BER encoding: %w", err)
|
||||
}
|
||||
|
||||
return packet.Data.String(), nil
|
||||
}
|
||||
|
||||
// ParseDN returns a distinguishedName or an error.
|
||||
// The function respects https://tools.ietf.org/html/rfc4514
|
||||
func ParseDN(str string) (*DN, error) {
|
||||
dn := new(DN)
|
||||
dn.RDNs = make([]*RelativeDN, 0)
|
||||
rdn := new(RelativeDN)
|
||||
rdn.Attributes = make([]*AttributeTypeAndValue, 0)
|
||||
buffer := bytes.Buffer{}
|
||||
attribute := new(AttributeTypeAndValue)
|
||||
escaping := false
|
||||
|
||||
unescapedTrailingSpaces := 0
|
||||
stringFromBuffer := func() string {
|
||||
s := buffer.String()
|
||||
s = s[0 : len(s)-unescapedTrailingSpaces]
|
||||
buffer.Reset()
|
||||
unescapedTrailingSpaces = 0
|
||||
return s
|
||||
var dn = &DN{RDNs: make([]*RelativeDN, 0)}
|
||||
if strings.TrimSpace(str) == "" {
|
||||
return dn, nil
|
||||
}
|
||||
|
||||
var (
|
||||
rdn = &RelativeDN{}
|
||||
attr = &AttributeTypeAndValue{}
|
||||
escaping bool
|
||||
startPos int
|
||||
appendAttributesToRDN = func(end bool) {
|
||||
rdn.Attributes = append(rdn.Attributes, attr)
|
||||
attr = &AttributeTypeAndValue{}
|
||||
if end {
|
||||
dn.RDNs = append(dn.RDNs, rdn)
|
||||
rdn = &RelativeDN{}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
// Loop through each character in the string and
|
||||
// build up the attribute type and value pairs.
|
||||
// We only check for ascii characters here, which
|
||||
// allows us to iterate over the string byte by byte.
|
||||
for i := 0; i < len(str); i++ {
|
||||
char := str[i]
|
||||
switch {
|
||||
case escaping:
|
||||
unescapedTrailingSpaces = 0
|
||||
escaping = false
|
||||
switch char {
|
||||
case ' ', '"', '#', '+', ',', ';', '<', '=', '>', '\\':
|
||||
buffer.WriteByte(char)
|
||||
continue
|
||||
case char == '\\':
|
||||
escaping = true
|
||||
case char == '=' && len(attr.Type) == 0:
|
||||
if err := attr.setType(str[startPos:i]); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// Not a special character, assume hex encoded octet
|
||||
if len(str) == i+1 {
|
||||
return nil, errors.New("got corrupted escaped character")
|
||||
startPos = i + 1
|
||||
case char == ',' || char == '+' || char == ';':
|
||||
if len(attr.Type) == 0 {
|
||||
return dn, errors.New("incomplete type, value pair")
|
||||
}
|
||||
if err := attr.setValue(str[startPos:i]); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
dst := []byte{0}
|
||||
n, err := enchex.Decode([]byte(dst), []byte(str[i:i+2]))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to decode escaped character: %s", err)
|
||||
} else if n != 1 {
|
||||
return nil, fmt.Errorf("expected 1 byte when un-escaping, got %d", n)
|
||||
}
|
||||
buffer.WriteByte(dst[0])
|
||||
i++
|
||||
case char == '\\':
|
||||
unescapedTrailingSpaces = 0
|
||||
escaping = true
|
||||
case char == '=' && attribute.Type == "":
|
||||
attribute.Type = stringFromBuffer()
|
||||
// Special case: If the first character in the value is # the
|
||||
// following data is BER encoded so we can just fast forward
|
||||
// and decode.
|
||||
if len(str) > i+1 && str[i+1] == '#' {
|
||||
i += 2
|
||||
index := strings.IndexAny(str[i:], ",+")
|
||||
var data string
|
||||
if index > 0 {
|
||||
data = str[i : i+index]
|
||||
} else {
|
||||
data = str[i:]
|
||||
}
|
||||
rawBER, err := enchex.DecodeString(data)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to decode BER encoding: %s", err)
|
||||
}
|
||||
packet, err := ber.DecodePacketErr(rawBER)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to decode BER packet: %s", err)
|
||||
}
|
||||
buffer.WriteString(packet.Data.String())
|
||||
i += len(data) - 1
|
||||
}
|
||||
case char == ',' || char == '+' || char == ';':
|
||||
// We're done with this RDN or value, push it
|
||||
if len(attribute.Type) == 0 {
|
||||
return nil, errors.New("incomplete type, value pair")
|
||||
}
|
||||
attribute.Value = stringFromBuffer()
|
||||
rdn.Attributes = append(rdn.Attributes, attribute)
|
||||
attribute = new(AttributeTypeAndValue)
|
||||
if char == ',' || char == ';' {
|
||||
dn.RDNs = append(dn.RDNs, rdn)
|
||||
rdn = new(RelativeDN)
|
||||
rdn.Attributes = make([]*AttributeTypeAndValue, 0)
|
||||
}
|
||||
case char == ' ' && buffer.Len() == 0:
|
||||
// ignore unescaped leading spaces
|
||||
continue
|
||||
default:
|
||||
if char == ' ' {
|
||||
// Track unescaped spaces in case they are trailing and we need to remove them
|
||||
unescapedTrailingSpaces++
|
||||
} else {
|
||||
// Reset if we see a non-space char
|
||||
unescapedTrailingSpaces = 0
|
||||
}
|
||||
buffer.WriteByte(char)
|
||||
startPos = i + 1
|
||||
last := char == ',' || char == ';'
|
||||
appendAttributesToRDN(last)
|
||||
}
|
||||
}
|
||||
if buffer.Len() > 0 {
|
||||
if len(attribute.Type) == 0 {
|
||||
return nil, errors.New("DN ended with incomplete type, value pair")
|
||||
|
||||
if len(attr.Type) == 0 {
|
||||
return dn, errors.New("DN ended with incomplete type, value pair")
|
||||
}
|
||||
attribute.Value = stringFromBuffer()
|
||||
rdn.Attributes = append(rdn.Attributes, attribute)
|
||||
dn.RDNs = append(dn.RDNs, rdn)
|
||||
|
||||
if err := attr.setValue(str[startPos:]); err != nil {
|
||||
return dn, err
|
||||
}
|
||||
appendAttributesToRDN(true)
|
||||
|
||||
return dn, nil
|
||||
}
|
||||
|
||||
@@ -348,3 +435,34 @@ func (r *RelativeDN) hasAllAttributesFold(attrs []*AttributeTypeAndValue) bool {
|
||||
func (a *AttributeTypeAndValue) EqualFold(other *AttributeTypeAndValue) bool {
|
||||
return strings.EqualFold(a.Type, other.Type) && strings.EqualFold(a.Value, other.Value)
|
||||
}
|
||||
|
||||
// foldString returns a folded string such that foldString(x) == foldString(y)
|
||||
// is identical to bytes.EqualFold(x, y).
|
||||
// based on https://go.dev/src/encoding/json/fold.go
|
||||
func foldString(s string) string {
|
||||
builder := strings.Builder{}
|
||||
for _, char := range s {
|
||||
// Handle single-byte ASCII.
|
||||
if char < utf8.RuneSelf {
|
||||
if 'A' <= char && char <= 'Z' {
|
||||
char += 'a' - 'A'
|
||||
}
|
||||
builder.WriteRune(char)
|
||||
continue
|
||||
}
|
||||
|
||||
builder.WriteRune(foldRune(char))
|
||||
}
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
// foldRune is returns the smallest rune for all runes in the same fold set.
|
||||
func foldRune(r rune) rune {
|
||||
for {
|
||||
r2 := unicode.SimpleFold(r)
|
||||
if r2 <= r {
|
||||
return r
|
||||
}
|
||||
r = r2
|
||||
}
|
||||
}
|
||||
|
5
vendor/github.com/go-ldap/ldap/v3/error.go
generated
vendored
5
vendor/github.com/go-ldap/ldap/v3/error.go
generated
vendored
@@ -1,6 +1,7 @@
|
||||
package ldap
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
ber "github.com/go-asn1-ber/asn1-ber"
|
||||
@@ -241,8 +242,8 @@ func IsErrorAnyOf(err error, codes ...uint16) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
serverError, ok := err.(*Error)
|
||||
if !ok {
|
||||
var serverError *Error
|
||||
if !errors.As(err, &serverError) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
7
vendor/github.com/go-ldap/ldap/v3/ldap.go
generated
vendored
7
vendor/github.com/go-ldap/ldap/v3/ldap.go
generated
vendored
@@ -314,8 +314,6 @@ func DebugBinaryFile(fileName string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
var hex = "0123456789abcdef"
|
||||
|
||||
func mustEscape(c byte) bool {
|
||||
return c > 0x7f || c == '(' || c == ')' || c == '\\' || c == '*' || c == 0
|
||||
}
|
||||
@@ -324,6 +322,7 @@ func mustEscape(c byte) bool {
|
||||
// characters in the set `()*\` and those out of the range 0 < c < 0x80,
|
||||
// as defined in RFC4515.
|
||||
func EscapeFilter(filter string) string {
|
||||
const hexValues = "0123456789abcdef"
|
||||
escape := 0
|
||||
for i := 0; i < len(filter); i++ {
|
||||
if mustEscape(filter[i]) {
|
||||
@@ -338,8 +337,8 @@ func EscapeFilter(filter string) string {
|
||||
c := filter[i]
|
||||
if mustEscape(c) {
|
||||
buf[j+0] = '\\'
|
||||
buf[j+1] = hex[c>>4]
|
||||
buf[j+2] = hex[c&0xf]
|
||||
buf[j+1] = hexValues[c>>4]
|
||||
buf[j+2] = hexValues[c&0xf]
|
||||
j += 3
|
||||
} else {
|
||||
buf[j] = c
|
||||
|
5
vendor/github.com/go-ldap/ldap/v3/response.go
generated
vendored
5
vendor/github.com/go-ldap/ldap/v3/response.go
generated
vendored
@@ -98,13 +98,12 @@ func (r *searchResponse) start(ctx context.Context, searchRequest *SearchRequest
|
||||
|
||||
foundSearchSingleResultDone := false
|
||||
for !foundSearchSingleResultDone {
|
||||
r.conn.Debug.Printf("%d: waiting for response", msgCtx.id)
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
r.conn.Debug.Printf("%d: %s", msgCtx.id, ctx.Err().Error())
|
||||
return
|
||||
default:
|
||||
r.conn.Debug.Printf("%d: waiting for response", msgCtx.id)
|
||||
packetResponse, ok := <-msgCtx.responses
|
||||
case packetResponse, ok := <-msgCtx.responses:
|
||||
if !ok {
|
||||
err := NewError(ErrorNetwork, errors.New("ldap: response channel closed"))
|
||||
r.ch <- &SearchSingleResult{Error: err}
|
||||
|
27
vendor/github.com/go-ldap/ldap/v3/search.go
generated
vendored
27
vendor/github.com/go-ldap/ldap/v3/search.go
generated
vendored
@@ -18,6 +18,9 @@ const (
|
||||
ScopeBaseObject = 0
|
||||
ScopeSingleLevel = 1
|
||||
ScopeWholeSubtree = 2
|
||||
// ScopeChildren is an OpenLDAP extension that may not be supported by another directory server.
|
||||
// See: https://github.com/openldap/openldap/blob/7c55484ee153047efd0e562fc1638c1a2525f320/include/ldap.h#L598
|
||||
ScopeChildren = 3
|
||||
)
|
||||
|
||||
// ScopeMap contains human readable descriptions of scope choices
|
||||
@@ -25,6 +28,7 @@ var ScopeMap = map[int]string{
|
||||
ScopeBaseObject: "Base Object",
|
||||
ScopeSingleLevel: "Single Level",
|
||||
ScopeWholeSubtree: "Whole Subtree",
|
||||
ScopeChildren: "Children",
|
||||
}
|
||||
|
||||
// derefAliases
|
||||
@@ -43,6 +47,10 @@ var DerefMap = map[int]string{
|
||||
DerefAlways: "DerefAlways",
|
||||
}
|
||||
|
||||
// ErrSizeLimitExceeded will be returned if the search result is exceeding the defined SizeLimit
|
||||
// and enforcing the requested limit is enabled in the search request (EnforceSizeLimit)
|
||||
var ErrSizeLimitExceeded = NewError(ErrorNetwork, errors.New("ldap: size limit exceeded"))
|
||||
|
||||
// NewEntry returns an Entry object with the specified distinguished name and attribute key-value pairs.
|
||||
// The map of attributes is accessed in alphabetical order of the keys in order to ensure that, for the
|
||||
// same input map of attributes, the output entry will contain the same order of attributes
|
||||
@@ -187,8 +195,8 @@ func readTag(f reflect.StructField) (string, bool) {
|
||||
// Unmarshal parses the Entry in the value pointed to by i
|
||||
//
|
||||
// Currently, this methods only supports struct fields of type
|
||||
// string, []string, int, int64, []byte, *DN, []*DN or time.Time. Other field types
|
||||
// will not be regarded. If the field type is a string or int but multiple
|
||||
// string, *string, []string, int, int64, []byte, *DN, []*DN or time.Time.
|
||||
// Other field types will not be regarded. If the field type is a string or int but multiple
|
||||
// attribute values are returned, the first value will be used to fill the field.
|
||||
//
|
||||
// Example:
|
||||
@@ -279,6 +287,8 @@ func (e *Entry) Unmarshal(i interface{}) (err error) {
|
||||
}
|
||||
case string:
|
||||
fv.SetString(values[0])
|
||||
case *string:
|
||||
fv.Set(reflect.ValueOf(&values[0]))
|
||||
case []byte:
|
||||
fv.SetBytes([]byte(values[0]))
|
||||
case int, int64:
|
||||
@@ -308,7 +318,7 @@ func (e *Entry) Unmarshal(i interface{}) (err error) {
|
||||
fv.Set(reflect.Append(fv, reflect.ValueOf(dn)))
|
||||
}
|
||||
default:
|
||||
return fmt.Errorf("ldap: expected field to be of type string, []string, int, int64, []byte, *DN, []*DN or time.Time, got %v", ft.Type)
|
||||
return fmt.Errorf("ldap: expected field to be of type string, *string, []string, int, int64, []byte, *DN, []*DN or time.Time, got %v", ft.Type)
|
||||
}
|
||||
}
|
||||
return
|
||||
@@ -411,6 +421,11 @@ type SearchRequest struct {
|
||||
Filter string
|
||||
Attributes []string
|
||||
Controls []Control
|
||||
|
||||
// EnforceSizeLimit will hard limit the maximum number of entries parsed, in case the directory
|
||||
// server returns more results than requested. This setting is disabled by default and does not
|
||||
// work in async search requests.
|
||||
EnforceSizeLimit bool
|
||||
}
|
||||
|
||||
func (req *SearchRequest) appendTo(envelope *ber.Packet) error {
|
||||
@@ -558,6 +573,12 @@ func (l *Conn) Search(searchRequest *SearchRequest) (*SearchResult, error) {
|
||||
|
||||
switch packet.Children[1].Tag {
|
||||
case 4:
|
||||
if searchRequest.EnforceSizeLimit &&
|
||||
searchRequest.SizeLimit > 0 &&
|
||||
len(result.Entries) >= searchRequest.SizeLimit {
|
||||
return result, ErrSizeLimitExceeded
|
||||
}
|
||||
|
||||
entry := &Entry{
|
||||
DN: packet.Children[1].Children[0].Value.(string),
|
||||
Attributes: unpackAttributes(packet.Children[1].Children[1].Children),
|
||||
|
@@ -1,5 +1,24 @@
|
||||
# Changelog
|
||||
|
||||
## Release 3.2.3 (2022-11-29)
|
||||
|
||||
### Changed
|
||||
|
||||
- Updated docs (thanks @book987 @aJetHorn @neelayu @pellizzetti @apricote @SaigyoujiYuyuko233 @AlekSi)
|
||||
- #348: Updated huandu/xstrings which fixed a snake case bug (thanks @yxxhero)
|
||||
- #353: Updated masterminds/semver which included bug fixes
|
||||
- #354: Updated golang.org/x/crypto which included bug fixes
|
||||
|
||||
## Release 3.2.2 (2021-02-04)
|
||||
|
||||
This is a re-release of 3.2.1 to satisfy something with the Go module system.
|
||||
|
||||
## Release 3.2.1 (2021-02-04)
|
||||
|
||||
### Changed
|
||||
|
||||
- Upgraded `Masterminds/goutils` to `v1.1.1`. see the [Security Advisory](https://github.com/Masterminds/goutils/security/advisories/GHSA-xg2h-wx96-xgxr)
|
||||
|
||||
## Release 3.2.0 (2020-12-14)
|
||||
|
||||
### Added
|
@@ -1,4 +1,4 @@
|
||||
# Slim-Sprig: Template functions for Go templates [](https://godoc.org/github.com/go-task/slim-sprig) [](https://goreportcard.com/report/github.com/go-task/slim-sprig)
|
||||
# Slim-Sprig: Template functions for Go templates [](https://pkg.go.dev/github.com/go-task/slim-sprig/v3)
|
||||
|
||||
Slim-Sprig is a fork of [Sprig](https://github.com/Masterminds/sprig), but with
|
||||
all functions that depend on external (non standard library) or crypto packages
|
@@ -1,6 +1,6 @@
|
||||
# https://taskfile.dev
|
||||
|
||||
version: '2'
|
||||
version: '3'
|
||||
|
||||
tasks:
|
||||
default:
|
2
vendor/github.com/google/pprof/profile/profile.go
generated
vendored
2
vendor/github.com/google/pprof/profile/profile.go
generated
vendored
@@ -847,7 +847,7 @@ func (p *Profile) HasFileLines() bool {
|
||||
// "[vdso]", [vsyscall]" and some others, see the code.
|
||||
func (m *Mapping) Unsymbolizable() bool {
|
||||
name := filepath.Base(m.File)
|
||||
return strings.HasPrefix(name, "[") || strings.HasPrefix(name, "linux-vdso") || strings.HasPrefix(m.File, "/dev/dri/")
|
||||
return strings.HasPrefix(name, "[") || strings.HasPrefix(name, "linux-vdso") || strings.HasPrefix(m.File, "/dev/dri/") || m.File == "//anon"
|
||||
}
|
||||
|
||||
// Copy makes a fully independent copy of a profile.
|
||||
|
2
vendor/github.com/greatroar/blobloom/.gitattributes
generated
vendored
Normal file
2
vendor/github.com/greatroar/blobloom/.gitattributes
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# Work around https://github.com/golang/go/issues/52268.
|
||||
**/testdata/fuzz/*/* eol=lf
|
2
vendor/github.com/greatroar/blobloom/README.md
generated
vendored
2
vendor/github.com/greatroar/blobloom/README.md
generated
vendored
@@ -71,7 +71,7 @@ So does passing integer keys in without running them through a mixing function.
|
||||
License
|
||||
-------
|
||||
|
||||
Copyright © 2020-2022 the Blobloom authors
|
||||
Copyright © 2020-2023 the Blobloom authors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
14
vendor/github.com/greatroar/blobloom/bloomfilter.go
generated
vendored
14
vendor/github.com/greatroar/blobloom/bloomfilter.go
generated
vendored
@@ -158,6 +158,20 @@ func (f *Filter) Empty() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// Equals returns true if f and g contain the same keys (in terms of Has)
|
||||
// when used with the same hash function.
|
||||
func (f *Filter) Equals(g *Filter) bool {
|
||||
if g.k != f.k || len(g.b) != len(f.b) {
|
||||
return false
|
||||
}
|
||||
for i := range g.b {
|
||||
if f.b[i] != g.b[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Fill set f to a completely full filter.
|
||||
// After Fill, Has returns true for any key.
|
||||
func (f *Filter) Fill() {
|
||||
|
246
vendor/github.com/greatroar/blobloom/io.go
generated
vendored
Normal file
246
vendor/github.com/greatroar/blobloom/io.go
generated
vendored
Normal file
@@ -0,0 +1,246 @@
|
||||
// Copyright 2023 the Blobloom 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 blobloom
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
)
|
||||
|
||||
const maxCommentLen = 44
|
||||
|
||||
// Dump writes f to w, with an optional comment string, in the binary format
|
||||
// that a Loader accepts. It returns the number of bytes written to w.
|
||||
//
|
||||
// The comment may contain arbitrary data, within the limits layed out by the
|
||||
// format description. It can be used to record the hash function to be used
|
||||
// with a Filter.
|
||||
func Dump(w io.Writer, f *Filter, comment string) (int64, error) {
|
||||
return dump(w, f.b, f.k, comment)
|
||||
}
|
||||
|
||||
// DumpSync is like Dump, but for SyncFilters.
|
||||
//
|
||||
// If other goroutines are simultaneously modifying f,
|
||||
// their modifications may not be reflected in the dump.
|
||||
// Separate synchronization is required to prevent this.
|
||||
//
|
||||
// The format produced is the same as Dump's. The fact that
|
||||
// the argument is a SyncFilter is not encoded in the dump.
|
||||
func DumpSync(w io.Writer, f *SyncFilter, comment string) (n int64, err error) {
|
||||
return dump(w, f.b, f.k, comment)
|
||||
}
|
||||
|
||||
func dump(w io.Writer, b []block, nhashes int, comment string) (n int64, err error) {
|
||||
switch {
|
||||
case len(b) == 0 || nhashes == 0:
|
||||
err = errors.New("blobloom: won't dump uninitialized Filter")
|
||||
case len(comment) > maxCommentLen:
|
||||
err = fmt.Errorf("blobloom: comment of length %d too long", len(comment))
|
||||
case strings.IndexByte(comment, 0) != -1:
|
||||
err = fmt.Errorf("blobloom: comment %q contains zero byte", len(comment))
|
||||
}
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
var buf [64]byte
|
||||
copy(buf[:8], "blobloom")
|
||||
// As documented in the comment for Loader, we store one less than the
|
||||
// number of blocks. This way, we can use the otherwise invalid value 0
|
||||
// and store 2³² blocks instead of at most 2³²-1.
|
||||
binary.LittleEndian.PutUint32(buf[12:], uint32(len(b)-1))
|
||||
binary.LittleEndian.PutUint32(buf[16:], uint32(nhashes))
|
||||
copy(buf[20:], comment)
|
||||
|
||||
k, err := w.Write(buf[:])
|
||||
n = int64(k)
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
|
||||
for i := range b {
|
||||
for j := range b[i] {
|
||||
x := atomic.LoadUint32(&b[i][j])
|
||||
binary.LittleEndian.PutUint32(buf[4*j:], x)
|
||||
}
|
||||
k, err = w.Write(buf[:])
|
||||
n += int64(k)
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return n, err
|
||||
}
|
||||
|
||||
// A Loader reads a Filter or SyncFilter from an io.Reader.
|
||||
//
|
||||
// A Loader accepts the binary format produced by Dump. The format starts
|
||||
// with a 64-byte header:
|
||||
// - the string "blobloom", in ASCII;
|
||||
// - a four-byte version number, which must be zero;
|
||||
// - the number of Bloom filter blocks, minus one, as a 32-bit integer;
|
||||
// - the number of hashes, as a 32-bit integer;
|
||||
// - a comment of at most 44 non-zero bytes, padded to 44 bytes with zeros.
|
||||
//
|
||||
// After the header come the 512-bit blocks, divided into sixteen 32-bit limbs.
|
||||
// All integers are little-endian.
|
||||
type Loader struct {
|
||||
buf [64]byte
|
||||
r io.Reader
|
||||
err error
|
||||
|
||||
Comment string // Comment field. Filled in by NewLoader.
|
||||
nblocks uint64
|
||||
nhashes int
|
||||
}
|
||||
|
||||
// NewLoader parses the format header from r and returns a Loader
|
||||
// that can be used to load a Filter from it.
|
||||
func NewLoader(r io.Reader) (*Loader, error) {
|
||||
l := &Loader{r: r}
|
||||
|
||||
err := l.fillbuf()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
version := binary.LittleEndian.Uint32(l.buf[8:])
|
||||
// See comment in dump for the +1.
|
||||
l.nblocks = 1 + uint64(binary.LittleEndian.Uint32(l.buf[12:]))
|
||||
l.nhashes = int(binary.LittleEndian.Uint32(l.buf[16:]))
|
||||
comment := l.buf[20:]
|
||||
|
||||
switch {
|
||||
case string(l.buf[:8]) != "blobloom":
|
||||
err = errors.New("blobloom: not a Bloom filter dump")
|
||||
case version != 0:
|
||||
err = errors.New("blobloom: unsupported dump version")
|
||||
case l.nhashes == 0:
|
||||
err = errors.New("blobloom: zero hashes in Bloom filter dump")
|
||||
}
|
||||
if err == nil {
|
||||
comment, err = checkComment(comment)
|
||||
l.Comment = string(comment)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
l = nil
|
||||
}
|
||||
return l, err
|
||||
}
|
||||
|
||||
// Load sets f to the union of f and the Loader's filter, then returns f.
|
||||
// If f is nil, a new Filter of the appropriate size is constructed.
|
||||
//
|
||||
// If f is not nil and an error occurs while reading from the Loader,
|
||||
// f may end up in an inconsistent state.
|
||||
func (l *Loader) Load(f *Filter) (*Filter, error) {
|
||||
if f == nil {
|
||||
nbits := BlockBits * l.nblocks
|
||||
if nbits > MaxBits {
|
||||
return nil, fmt.Errorf("blobloom: %d blocks is too large", l.nblocks)
|
||||
}
|
||||
f = New(nbits, int(l.nhashes))
|
||||
} else if err := l.checkBitsAndHashes(len(f.b), f.k); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for i := range f.b {
|
||||
if err := l.fillbuf(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for j := range f.b[i] {
|
||||
f.b[i][j] |= binary.LittleEndian.Uint32(l.buf[4*j:])
|
||||
}
|
||||
}
|
||||
|
||||
return f, nil
|
||||
}
|
||||
|
||||
// Load sets f to the union of f and the Loader's filter, then returns f.
|
||||
// If f is nil, a new SyncFilter of the appropriate size is constructed.
|
||||
// Else, LoadSync may run concurrently with other modifications to f.
|
||||
//
|
||||
// If f is not nil and an error occurs while reading from the Loader,
|
||||
// f may end up in an inconsistent state.
|
||||
func (l *Loader) LoadSync(f *SyncFilter) (*SyncFilter, error) {
|
||||
if f == nil {
|
||||
nbits := BlockBits * l.nblocks
|
||||
if nbits > MaxBits {
|
||||
return nil, fmt.Errorf("blobloom: %d blocks is too large", l.nblocks)
|
||||
}
|
||||
f = NewSync(nbits, int(l.nhashes))
|
||||
} else if err := l.checkBitsAndHashes(len(f.b), f.k); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for i := range f.b {
|
||||
if err := l.fillbuf(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for j := range f.b[i] {
|
||||
p := &f.b[i][j]
|
||||
x := binary.LittleEndian.Uint32(l.buf[4*j:])
|
||||
|
||||
for {
|
||||
old := atomic.LoadUint32(p)
|
||||
if atomic.CompareAndSwapUint32(p, old, old|x) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return f, nil
|
||||
}
|
||||
|
||||
func (l *Loader) checkBitsAndHashes(nblocks, nhashes int) error {
|
||||
switch {
|
||||
case nblocks != int(l.nblocks):
|
||||
return fmt.Errorf("blobloom: Filter has %d blocks, but dump has %d", nblocks, l.nblocks)
|
||||
case nhashes != l.nhashes:
|
||||
return fmt.Errorf("blobloom: Filter has %d hashes, but dump has %d", nhashes, l.nhashes)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (l *Loader) fillbuf() error {
|
||||
_, err := io.ReadFull(l.r, l.buf[:])
|
||||
if err == io.EOF {
|
||||
err = io.ErrUnexpectedEOF
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func checkComment(p []byte) ([]byte, error) {
|
||||
eos := bytes.IndexByte(p, 0)
|
||||
if eos != -1 {
|
||||
tail := p[eos+1:]
|
||||
if !bytes.Equal(tail, make([]byte, len(tail))) {
|
||||
return nil, fmt.Errorf("blobloom: comment block %q contains zero byte", p)
|
||||
}
|
||||
p = p[:eos]
|
||||
}
|
||||
return p, nil
|
||||
}
|
8
vendor/github.com/greatroar/blobloom/optimize.go
generated
vendored
8
vendor/github.com/greatroar/blobloom/optimize.go
generated
vendored
@@ -18,6 +18,10 @@ import "math"
|
||||
|
||||
// A Config holds parameters for Optimize or NewOptimized.
|
||||
type Config struct {
|
||||
// Trigger the "contains filtered or unexported fields" message for
|
||||
// forward compatibility and force the caller to use named fields.
|
||||
_ struct{}
|
||||
|
||||
// Capacity is the expected number of distinct keys to be added.
|
||||
// More keys can always be added, but the false positive rate can be
|
||||
// expected to drop below FPRate if their number exceeds the Capacity.
|
||||
@@ -31,10 +35,6 @@ type Config struct {
|
||||
// Maximum size of the Bloom filter in bits. Zero means the global
|
||||
// MaxBits constant. A value less than BlockBits means BlockBits.
|
||||
MaxBits uint64
|
||||
|
||||
// Trigger the "contains filtered or unexported fields" message for
|
||||
// forward compatibility and force the caller to use named fields.
|
||||
_ struct{}
|
||||
}
|
||||
|
||||
// NewOptimized is shorthand for New(Optimize(config)).
|
||||
|
6
vendor/github.com/jackpal/gateway/README.md
generated
vendored
6
vendor/github.com/jackpal/gateway/README.md
generated
vendored
@@ -40,6 +40,12 @@ Pull requests for other OSs happily considered!
|
||||
|
||||
## Versions
|
||||
|
||||
### v1.0.15
|
||||
|
||||
Update dependencies to latest versions. This was done to squelch a github security
|
||||
alert caused by depending upon an old version of x/net. This is the first time I've
|
||||
updated module versions, the tests pass, so hopefully everything's good.
|
||||
|
||||
### v1.0.14
|
||||
|
||||
+ [Fix panic when interface not set in Solaris `netstat -rn` output.](https://github.com/jackpal/gateway/pull/42)
|
||||
|
24
vendor/github.com/klauspost/cpuid/v2/.gitignore
generated
vendored
24
vendor/github.com/klauspost/cpuid/v2/.gitignore
generated
vendored
@@ -1,24 +0,0 @@
|
||||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
|
||||
# Folders
|
||||
_obj
|
||||
_test
|
||||
|
||||
# Architecture specific extensions/prefixes
|
||||
*.[568vq]
|
||||
[568vq].out
|
||||
|
||||
*.cgo1.go
|
||||
*.cgo2.c
|
||||
_cgo_defun.c
|
||||
_cgo_gotypes.go
|
||||
_cgo_export.*
|
||||
|
||||
_testmain.go
|
||||
|
||||
*.exe
|
||||
*.test
|
||||
*.prof
|
74
vendor/github.com/klauspost/cpuid/v2/.goreleaser.yml
generated
vendored
74
vendor/github.com/klauspost/cpuid/v2/.goreleaser.yml
generated
vendored
@@ -1,74 +0,0 @@
|
||||
# This is an example goreleaser.yaml file with some sane defaults.
|
||||
# Make sure to check the documentation at http://goreleaser.com
|
||||
|
||||
builds:
|
||||
-
|
||||
id: "cpuid"
|
||||
binary: cpuid
|
||||
main: ./cmd/cpuid/main.go
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
flags:
|
||||
- -ldflags=-s -w
|
||||
goos:
|
||||
- aix
|
||||
- linux
|
||||
- freebsd
|
||||
- netbsd
|
||||
- windows
|
||||
- darwin
|
||||
goarch:
|
||||
- 386
|
||||
- amd64
|
||||
- arm64
|
||||
goarm:
|
||||
- 7
|
||||
|
||||
archives:
|
||||
-
|
||||
id: cpuid
|
||||
name_template: "cpuid-{{ .Os }}_{{ .Arch }}_{{ .Version }}"
|
||||
replacements:
|
||||
aix: AIX
|
||||
darwin: OSX
|
||||
linux: Linux
|
||||
windows: Windows
|
||||
386: i386
|
||||
amd64: x86_64
|
||||
freebsd: FreeBSD
|
||||
netbsd: NetBSD
|
||||
format_overrides:
|
||||
- goos: windows
|
||||
format: zip
|
||||
files:
|
||||
- LICENSE
|
||||
checksum:
|
||||
name_template: 'checksums.txt'
|
||||
snapshot:
|
||||
name_template: "{{ .Tag }}-next"
|
||||
changelog:
|
||||
sort: asc
|
||||
filters:
|
||||
exclude:
|
||||
- '^doc:'
|
||||
- '^docs:'
|
||||
- '^test:'
|
||||
- '^tests:'
|
||||
- '^Update\sREADME.md'
|
||||
|
||||
nfpms:
|
||||
-
|
||||
file_name_template: "cpuid_package_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
|
||||
vendor: Klaus Post
|
||||
homepage: https://github.com/klauspost/cpuid
|
||||
maintainer: Klaus Post <klauspost@gmail.com>
|
||||
description: CPUID Tool
|
||||
license: BSD 3-Clause
|
||||
formats:
|
||||
- deb
|
||||
- rpm
|
||||
replacements:
|
||||
darwin: Darwin
|
||||
linux: Linux
|
||||
freebsd: FreeBSD
|
||||
amd64: x86_64
|
35
vendor/github.com/klauspost/cpuid/v2/CONTRIBUTING.txt
generated
vendored
35
vendor/github.com/klauspost/cpuid/v2/CONTRIBUTING.txt
generated
vendored
@@ -1,35 +0,0 @@
|
||||
Developer Certificate of Origin
|
||||
Version 1.1
|
||||
|
||||
Copyright (C) 2015- Klaus Post & Contributors.
|
||||
Email: klauspost@gmail.com
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this
|
||||
license document, but changing it is not allowed.
|
||||
|
||||
|
||||
Developer's Certificate of Origin 1.1
|
||||
|
||||
By making a contribution to this project, I certify that:
|
||||
|
||||
(a) The contribution was created in whole or in part by me and I
|
||||
have the right to submit it under the open source license
|
||||
indicated in the file; or
|
||||
|
||||
(b) The contribution is based upon previous work that, to the best
|
||||
of my knowledge, is covered under an appropriate open source
|
||||
license and I have the right under that license to submit that
|
||||
work with modifications, whether created in whole or in part
|
||||
by me, under the same open source license (unless I am
|
||||
permitted to submit under a different license), as indicated
|
||||
in the file; or
|
||||
|
||||
(c) The contribution was provided directly to me by some other
|
||||
person who certified (a), (b) or (c) and I have not modified
|
||||
it.
|
||||
|
||||
(d) I understand and agree that this project and the contribution
|
||||
are public and that a record of the contribution (including all
|
||||
personal information I submit with it, including my sign-off) is
|
||||
maintained indefinitely and may be redistributed consistent with
|
||||
this project or the open source license(s) involved.
|
22
vendor/github.com/klauspost/cpuid/v2/LICENSE
generated
vendored
22
vendor/github.com/klauspost/cpuid/v2/LICENSE
generated
vendored
@@ -1,22 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Klaus Post
|
||||
|
||||
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.
|
||||
|
497
vendor/github.com/klauspost/cpuid/v2/README.md
generated
vendored
497
vendor/github.com/klauspost/cpuid/v2/README.md
generated
vendored
@@ -1,497 +0,0 @@
|
||||
# cpuid
|
||||
Package cpuid provides information about the CPU running the current program.
|
||||
|
||||
CPU features are detected on startup, and kept for fast access through the life of the application.
|
||||
Currently x86 / x64 (AMD64/i386) and ARM (ARM64) is supported, and no external C (cgo) code is used, which should make the library very easy to use.
|
||||
|
||||
You can access the CPU information by accessing the shared CPU variable of the cpuid library.
|
||||
|
||||
Package home: https://github.com/klauspost/cpuid
|
||||
|
||||
[](https://pkg.go.dev/github.com/klauspost/cpuid/v2)
|
||||
[](https://github.com/klauspost/cpuid/actions/workflows/go.yml)
|
||||
|
||||
## installing
|
||||
|
||||
`go get -u github.com/klauspost/cpuid/v2` using modules.
|
||||
Drop `v2` for others.
|
||||
|
||||
Installing binary:
|
||||
|
||||
`go install github.com/klauspost/cpuid/v2/cmd/cpuid@latest`
|
||||
|
||||
Or download binaries from release page: https://github.com/klauspost/cpuid/releases
|
||||
|
||||
### Homebrew
|
||||
|
||||
For macOS/Linux users, you can install via [brew](https://brew.sh/)
|
||||
|
||||
```sh
|
||||
$ brew install cpuid
|
||||
```
|
||||
|
||||
## example
|
||||
|
||||
```Go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
. "github.com/klauspost/cpuid/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Print basic CPU information:
|
||||
fmt.Println("Name:", CPU.BrandName)
|
||||
fmt.Println("PhysicalCores:", CPU.PhysicalCores)
|
||||
fmt.Println("ThreadsPerCore:", CPU.ThreadsPerCore)
|
||||
fmt.Println("LogicalCores:", CPU.LogicalCores)
|
||||
fmt.Println("Family", CPU.Family, "Model:", CPU.Model, "Vendor ID:", CPU.VendorID)
|
||||
fmt.Println("Features:", strings.Join(CPU.FeatureSet(), ","))
|
||||
fmt.Println("Cacheline bytes:", CPU.CacheLine)
|
||||
fmt.Println("L1 Data Cache:", CPU.Cache.L1D, "bytes")
|
||||
fmt.Println("L1 Instruction Cache:", CPU.Cache.L1I, "bytes")
|
||||
fmt.Println("L2 Cache:", CPU.Cache.L2, "bytes")
|
||||
fmt.Println("L3 Cache:", CPU.Cache.L3, "bytes")
|
||||
fmt.Println("Frequency", CPU.Hz, "hz")
|
||||
|
||||
// Test if we have these specific features:
|
||||
if CPU.Supports(SSE, SSE2) {
|
||||
fmt.Println("We have Streaming SIMD 2 Extensions")
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Sample output:
|
||||
```
|
||||
>go run main.go
|
||||
Name: AMD Ryzen 9 3950X 16-Core Processor
|
||||
PhysicalCores: 16
|
||||
ThreadsPerCore: 2
|
||||
LogicalCores: 32
|
||||
Family 23 Model: 113 Vendor ID: AMD
|
||||
Features: ADX,AESNI,AVX,AVX2,BMI1,BMI2,CLMUL,CMOV,CX16,F16C,FMA3,HTT,HYPERVISOR,LZCNT,MMX,MMXEXT,NX,POPCNT,RDRAND,RDSEED,RDTSCP,SHA,SSE,SSE2,SSE3,SSE4,SSE42,SSE4A,SSSE3
|
||||
Cacheline bytes: 64
|
||||
L1 Data Cache: 32768 bytes
|
||||
L1 Instruction Cache: 32768 bytes
|
||||
L2 Cache: 524288 bytes
|
||||
L3 Cache: 16777216 bytes
|
||||
Frequency 0 hz
|
||||
We have Streaming SIMD 2 Extensions
|
||||
```
|
||||
|
||||
# usage
|
||||
|
||||
The `cpuid.CPU` provides access to CPU features. Use `cpuid.CPU.Supports()` to check for CPU features.
|
||||
A faster `cpuid.CPU.Has()` is provided which will usually be inlined by the gc compiler.
|
||||
|
||||
To test a larger number of features, they can be combined using `f := CombineFeatures(CMOV, CMPXCHG8, X87, FXSR, MMX, SYSCALL, SSE, SSE2)`, etc.
|
||||
This can be using with `cpuid.CPU.HasAll(f)` to quickly test if all features are supported.
|
||||
|
||||
Note that for some cpu/os combinations some features will not be detected.
|
||||
`amd64` has rather good support and should work reliably on all platforms.
|
||||
|
||||
Note that hypervisors may not pass through all CPU features through to the guest OS,
|
||||
so even if your host supports a feature it may not be visible on guests.
|
||||
|
||||
## arm64 feature detection
|
||||
|
||||
Not all operating systems provide ARM features directly
|
||||
and there is no safe way to do so for the rest.
|
||||
|
||||
Currently `arm64/linux` and `arm64/freebsd` should be quite reliable.
|
||||
`arm64/darwin` adds features expected from the M1 processor, but a lot remains undetected.
|
||||
|
||||
A `DetectARM()` can be used if you are able to control your deployment,
|
||||
it will detect CPU features, but may crash if the OS doesn't intercept the calls.
|
||||
A `-cpu.arm` flag for detecting unsafe ARM features can be added. See below.
|
||||
|
||||
Note that currently only features are detected on ARM,
|
||||
no additional information is currently available.
|
||||
|
||||
## flags
|
||||
|
||||
It is possible to add flags that affects cpu detection.
|
||||
|
||||
For this the `Flags()` command is provided.
|
||||
|
||||
This must be called *before* `flag.Parse()` AND after the flags have been parsed `Detect()` must be called.
|
||||
|
||||
This means that any detection used in `init()` functions will not contain these flags.
|
||||
|
||||
Example:
|
||||
|
||||
```Go
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/klauspost/cpuid/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
cpuid.Flags()
|
||||
flag.Parse()
|
||||
cpuid.Detect()
|
||||
|
||||
// Test if we have these specific features:
|
||||
if cpuid.CPU.Supports(cpuid.SSE, cpuid.SSE2) {
|
||||
fmt.Println("We have Streaming SIMD 2 Extensions")
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## commandline
|
||||
|
||||
Download as binary from: https://github.com/klauspost/cpuid/releases
|
||||
|
||||
Install from source:
|
||||
|
||||
`go install github.com/klauspost/cpuid/v2/cmd/cpuid@latest`
|
||||
|
||||
### Example
|
||||
|
||||
```
|
||||
λ cpuid
|
||||
Name: AMD Ryzen 9 3950X 16-Core Processor
|
||||
Vendor String: AuthenticAMD
|
||||
Vendor ID: AMD
|
||||
PhysicalCores: 16
|
||||
Threads Per Core: 2
|
||||
Logical Cores: 32
|
||||
CPU Family 23 Model: 113
|
||||
Features: ADX,AESNI,AVX,AVX2,BMI1,BMI2,CLMUL,CLZERO,CMOV,CMPXCHG8,CPBOOST,CX16,F16C,FMA3,FXSR,FXSROPT,HTT,HYPERVISOR,LAHF,LZCNT,MCAOVERFLOW,MMX,MMXEXT,MOVBE,NX,OSXSAVE,POPCNT,RDRAND,RDSEED,RDTSCP,SCE,SHA,SSE,SSE2,SSE3,SSE4,SSE42,SSE4A,SSSE3,SUCCOR,X87,XSAVE
|
||||
Microarchitecture level: 3
|
||||
Cacheline bytes: 64
|
||||
L1 Instruction Cache: 32768 bytes
|
||||
L1 Data Cache: 32768 bytes
|
||||
L2 Cache: 524288 bytes
|
||||
L3 Cache: 16777216 bytes
|
||||
|
||||
```
|
||||
### JSON Output:
|
||||
|
||||
```
|
||||
λ cpuid --json
|
||||
{
|
||||
"BrandName": "AMD Ryzen 9 3950X 16-Core Processor",
|
||||
"VendorID": 2,
|
||||
"VendorString": "AuthenticAMD",
|
||||
"PhysicalCores": 16,
|
||||
"ThreadsPerCore": 2,
|
||||
"LogicalCores": 32,
|
||||
"Family": 23,
|
||||
"Model": 113,
|
||||
"CacheLine": 64,
|
||||
"Hz": 0,
|
||||
"BoostFreq": 0,
|
||||
"Cache": {
|
||||
"L1I": 32768,
|
||||
"L1D": 32768,
|
||||
"L2": 524288,
|
||||
"L3": 16777216
|
||||
},
|
||||
"SGX": {
|
||||
"Available": false,
|
||||
"LaunchControl": false,
|
||||
"SGX1Supported": false,
|
||||
"SGX2Supported": false,
|
||||
"MaxEnclaveSizeNot64": 0,
|
||||
"MaxEnclaveSize64": 0,
|
||||
"EPCSections": null
|
||||
},
|
||||
"Features": [
|
||||
"ADX",
|
||||
"AESNI",
|
||||
"AVX",
|
||||
"AVX2",
|
||||
"BMI1",
|
||||
"BMI2",
|
||||
"CLMUL",
|
||||
"CLZERO",
|
||||
"CMOV",
|
||||
"CMPXCHG8",
|
||||
"CPBOOST",
|
||||
"CX16",
|
||||
"F16C",
|
||||
"FMA3",
|
||||
"FXSR",
|
||||
"FXSROPT",
|
||||
"HTT",
|
||||
"HYPERVISOR",
|
||||
"LAHF",
|
||||
"LZCNT",
|
||||
"MCAOVERFLOW",
|
||||
"MMX",
|
||||
"MMXEXT",
|
||||
"MOVBE",
|
||||
"NX",
|
||||
"OSXSAVE",
|
||||
"POPCNT",
|
||||
"RDRAND",
|
||||
"RDSEED",
|
||||
"RDTSCP",
|
||||
"SCE",
|
||||
"SHA",
|
||||
"SSE",
|
||||
"SSE2",
|
||||
"SSE3",
|
||||
"SSE4",
|
||||
"SSE42",
|
||||
"SSE4A",
|
||||
"SSSE3",
|
||||
"SUCCOR",
|
||||
"X87",
|
||||
"XSAVE"
|
||||
],
|
||||
"X64Level": 3
|
||||
}
|
||||
```
|
||||
|
||||
### Check CPU microarch level
|
||||
|
||||
```
|
||||
λ cpuid --check-level=3
|
||||
2022/03/18 17:04:40 AMD Ryzen 9 3950X 16-Core Processor
|
||||
2022/03/18 17:04:40 Microarchitecture level 3 is supported. Max level is 3.
|
||||
Exit Code 0
|
||||
|
||||
λ cpuid --check-level=4
|
||||
2022/03/18 17:06:18 AMD Ryzen 9 3950X 16-Core Processor
|
||||
2022/03/18 17:06:18 Microarchitecture level 4 not supported. Max level is 3.
|
||||
Exit Code 1
|
||||
```
|
||||
|
||||
|
||||
## Available flags
|
||||
|
||||
### x86 & amd64
|
||||
|
||||
| Feature Flag | Description |
|
||||
|--------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| ADX | Intel ADX (Multi-Precision Add-Carry Instruction Extensions) |
|
||||
| AESNI | Advanced Encryption Standard New Instructions |
|
||||
| AMD3DNOW | AMD 3DNOW |
|
||||
| AMD3DNOWEXT | AMD 3DNowExt |
|
||||
| AMXBF16 | Tile computational operations on BFLOAT16 numbers |
|
||||
| AMXINT8 | Tile computational operations on 8-bit integers |
|
||||
| AMXFP16 | Tile computational operations on FP16 numbers |
|
||||
| AMXTILE | Tile architecture |
|
||||
| APX_F | Intel APX |
|
||||
| AVX | AVX functions |
|
||||
| AVX10 | If set the Intel AVX10 Converged Vector ISA is supported |
|
||||
| AVX10_128 | If set indicates that AVX10 128-bit vector support is present |
|
||||
| AVX10_256 | If set indicates that AVX10 256-bit vector support is present |
|
||||
| AVX10_512 | If set indicates that AVX10 512-bit vector support is present |
|
||||
| AVX2 | AVX2 functions |
|
||||
| AVX512BF16 | AVX-512 BFLOAT16 Instructions |
|
||||
| AVX512BITALG | AVX-512 Bit Algorithms |
|
||||
| AVX512BW | AVX-512 Byte and Word Instructions |
|
||||
| AVX512CD | AVX-512 Conflict Detection Instructions |
|
||||
| AVX512DQ | AVX-512 Doubleword and Quadword Instructions |
|
||||
| AVX512ER | AVX-512 Exponential and Reciprocal Instructions |
|
||||
| AVX512F | AVX-512 Foundation |
|
||||
| AVX512FP16 | AVX-512 FP16 Instructions |
|
||||
| AVX512IFMA | AVX-512 Integer Fused Multiply-Add Instructions |
|
||||
| AVX512PF | AVX-512 Prefetch Instructions |
|
||||
| AVX512VBMI | AVX-512 Vector Bit Manipulation Instructions |
|
||||
| AVX512VBMI2 | AVX-512 Vector Bit Manipulation Instructions, Version 2 |
|
||||
| AVX512VL | AVX-512 Vector Length Extensions |
|
||||
| AVX512VNNI | AVX-512 Vector Neural Network Instructions |
|
||||
| AVX512VP2INTERSECT | AVX-512 Intersect for D/Q |
|
||||
| AVX512VPOPCNTDQ | AVX-512 Vector Population Count Doubleword and Quadword |
|
||||
| AVXIFMA | AVX-IFMA instructions |
|
||||
| AVXNECONVERT | AVX-NE-CONVERT instructions |
|
||||
| AVXSLOW | Indicates the CPU performs 2 128 bit operations instead of one |
|
||||
| AVXVNNI | AVX (VEX encoded) VNNI neural network instructions |
|
||||
| AVXVNNIINT8 | AVX-VNNI-INT8 instructions |
|
||||
| BHI_CTRL | Branch History Injection and Intra-mode Branch Target Injection / CVE-2022-0001, CVE-2022-0002 / INTEL-SA-00598 |
|
||||
| BMI1 | Bit Manipulation Instruction Set 1 |
|
||||
| BMI2 | Bit Manipulation Instruction Set 2 |
|
||||
| CETIBT | Intel CET Indirect Branch Tracking |
|
||||
| CETSS | Intel CET Shadow Stack |
|
||||
| CLDEMOTE | Cache Line Demote |
|
||||
| CLMUL | Carry-less Multiplication |
|
||||
| CLZERO | CLZERO instruction supported |
|
||||
| CMOV | i686 CMOV |
|
||||
| CMPCCXADD | CMPCCXADD instructions |
|
||||
| CMPSB_SCADBS_SHORT | Fast short CMPSB and SCASB |
|
||||
| CMPXCHG8 | CMPXCHG8 instruction |
|
||||
| CPBOOST | Core Performance Boost |
|
||||
| CPPC | AMD: Collaborative Processor Performance Control |
|
||||
| CX16 | CMPXCHG16B Instruction |
|
||||
| EFER_LMSLE_UNS | AMD: =Core::X86::Msr::EFER[LMSLE] is not supported, and MBZ |
|
||||
| ENQCMD | Enqueue Command |
|
||||
| ERMS | Enhanced REP MOVSB/STOSB |
|
||||
| F16C | Half-precision floating-point conversion |
|
||||
| FLUSH_L1D | Flush L1D cache |
|
||||
| FMA3 | Intel FMA 3. Does not imply AVX. |
|
||||
| FMA4 | Bulldozer FMA4 functions |
|
||||
| FP128 | AMD: When set, the internal FP/SIMD execution datapath is 128-bits wide |
|
||||
| FP256 | AMD: When set, the internal FP/SIMD execution datapath is 256-bits wide |
|
||||
| FSRM | Fast Short Rep Mov |
|
||||
| FXSR | FXSAVE, FXRESTOR instructions, CR4 bit 9 |
|
||||
| FXSROPT | FXSAVE/FXRSTOR optimizations |
|
||||
| GFNI | Galois Field New Instructions. May require other features (AVX, AVX512VL,AVX512F) based on usage. |
|
||||
| HLE | Hardware Lock Elision |
|
||||
| HRESET | If set CPU supports history reset and the IA32_HRESET_ENABLE MSR |
|
||||
| HTT | Hyperthreading (enabled) |
|
||||
| HWA | Hardware assert supported. Indicates support for MSRC001_10 |
|
||||
| HYBRID_CPU | This part has CPUs of more than one type. |
|
||||
| HYPERVISOR | This bit has been reserved by Intel & AMD for use by hypervisors |
|
||||
| IA32_ARCH_CAP | IA32_ARCH_CAPABILITIES MSR (Intel) |
|
||||
| IA32_CORE_CAP | IA32_CORE_CAPABILITIES MSR |
|
||||
| IBPB | Indirect Branch Restricted Speculation (IBRS) and Indirect Branch Predictor Barrier (IBPB) |
|
||||
| IBRS | AMD: Indirect Branch Restricted Speculation |
|
||||
| IBRS_PREFERRED | AMD: IBRS is preferred over software solution |
|
||||
| IBRS_PROVIDES_SMP | AMD: IBRS provides Same Mode Protection |
|
||||
| IBS | Instruction Based Sampling (AMD) |
|
||||
| IBSBRNTRGT | Instruction Based Sampling Feature (AMD) |
|
||||
| IBSFETCHSAM | Instruction Based Sampling Feature (AMD) |
|
||||
| IBSFFV | Instruction Based Sampling Feature (AMD) |
|
||||
| IBSOPCNT | Instruction Based Sampling Feature (AMD) |
|
||||
| IBSOPCNTEXT | Instruction Based Sampling Feature (AMD) |
|
||||
| IBSOPSAM | Instruction Based Sampling Feature (AMD) |
|
||||
| IBSRDWROPCNT | Instruction Based Sampling Feature (AMD) |
|
||||
| IBSRIPINVALIDCHK | Instruction Based Sampling Feature (AMD) |
|
||||
| IBS_FETCH_CTLX | AMD: IBS fetch control extended MSR supported |
|
||||
| IBS_OPDATA4 | AMD: IBS op data 4 MSR supported |
|
||||
| IBS_OPFUSE | AMD: Indicates support for IbsOpFuse |
|
||||
| IBS_PREVENTHOST | Disallowing IBS use by the host supported |
|
||||
| IBS_ZEN4 | Fetch and Op IBS support IBS extensions added with Zen4 |
|
||||
| IDPRED_CTRL | IPRED_DIS |
|
||||
| INT_WBINVD | WBINVD/WBNOINVD are interruptible. |
|
||||
| INVLPGB | NVLPGB and TLBSYNC instruction supported |
|
||||
| KEYLOCKER | Key locker |
|
||||
| KEYLOCKERW | Key locker wide |
|
||||
| LAHF | LAHF/SAHF in long mode |
|
||||
| LAM | If set, CPU supports Linear Address Masking |
|
||||
| LBRVIRT | LBR virtualization |
|
||||
| LZCNT | LZCNT instruction |
|
||||
| MCAOVERFLOW | MCA overflow recovery support. |
|
||||
| MCDT_NO | Processor do not exhibit MXCSR Configuration Dependent Timing behavior and do not need to mitigate it. |
|
||||
| MCOMMIT | MCOMMIT instruction supported |
|
||||
| MD_CLEAR | VERW clears CPU buffers |
|
||||
| MMX | standard MMX |
|
||||
| MMXEXT | SSE integer functions or AMD MMX ext |
|
||||
| MOVBE | MOVBE instruction (big-endian) |
|
||||
| MOVDIR64B | Move 64 Bytes as Direct Store |
|
||||
| MOVDIRI | Move Doubleword as Direct Store |
|
||||
| MOVSB_ZL | Fast Zero-Length MOVSB |
|
||||
| MPX | Intel MPX (Memory Protection Extensions) |
|
||||
| MOVU | MOVU SSE instructions are more efficient and should be preferred to SSE MOVL/MOVH. MOVUPS is more efficient than MOVLPS/MOVHPS. MOVUPD is more efficient than MOVLPD/MOVHPD |
|
||||
| MSRIRC | Instruction Retired Counter MSR available |
|
||||
| MSRLIST | Read/Write List of Model Specific Registers |
|
||||
| MSR_PAGEFLUSH | Page Flush MSR available |
|
||||
| NRIPS | Indicates support for NRIP save on VMEXIT |
|
||||
| NX | NX (No-Execute) bit |
|
||||
| OSXSAVE | XSAVE enabled by OS |
|
||||
| PCONFIG | PCONFIG for Intel Multi-Key Total Memory Encryption |
|
||||
| POPCNT | POPCNT instruction |
|
||||
| PPIN | AMD: Protected Processor Inventory Number support. Indicates that Protected Processor Inventory Number (PPIN) capability can be enabled |
|
||||
| PREFETCHI | PREFETCHIT0/1 instructions |
|
||||
| PSFD | Predictive Store Forward Disable |
|
||||
| RDPRU | RDPRU instruction supported |
|
||||
| RDRAND | RDRAND instruction is available |
|
||||
| RDSEED | RDSEED instruction is available |
|
||||
| RDTSCP | RDTSCP Instruction |
|
||||
| RRSBA_CTRL | Restricted RSB Alternate |
|
||||
| RTM | Restricted Transactional Memory |
|
||||
| RTM_ALWAYS_ABORT | Indicates that the loaded microcode is forcing RTM abort. |
|
||||
| SERIALIZE | Serialize Instruction Execution |
|
||||
| SEV | AMD Secure Encrypted Virtualization supported |
|
||||
| SEV_64BIT | AMD SEV guest execution only allowed from a 64-bit host |
|
||||
| SEV_ALTERNATIVE | AMD SEV Alternate Injection supported |
|
||||
| SEV_DEBUGSWAP | Full debug state swap supported for SEV-ES guests |
|
||||
| SEV_ES | AMD SEV Encrypted State supported |
|
||||
| SEV_RESTRICTED | AMD SEV Restricted Injection supported |
|
||||
| SEV_SNP | AMD SEV Secure Nested Paging supported |
|
||||
| SGX | Software Guard Extensions |
|
||||
| SGXLC | Software Guard Extensions Launch Control |
|
||||
| SHA | Intel SHA Extensions |
|
||||
| SME | AMD Secure Memory Encryption supported |
|
||||
| SME_COHERENT | AMD Hardware cache coherency across encryption domains enforced |
|
||||
| SPEC_CTRL_SSBD | Speculative Store Bypass Disable |
|
||||
| SRBDS_CTRL | SRBDS mitigation MSR available |
|
||||
| SSE | SSE functions |
|
||||
| SSE2 | P4 SSE functions |
|
||||
| SSE3 | Prescott SSE3 functions |
|
||||
| SSE4 | Penryn SSE4.1 functions |
|
||||
| SSE42 | Nehalem SSE4.2 functions |
|
||||
| SSE4A | AMD Barcelona microarchitecture SSE4a instructions |
|
||||
| SSSE3 | Conroe SSSE3 functions |
|
||||
| STIBP | Single Thread Indirect Branch Predictors |
|
||||
| STIBP_ALWAYSON | AMD: Single Thread Indirect Branch Prediction Mode has Enhanced Performance and may be left Always On |
|
||||
| STOSB_SHORT | Fast short STOSB |
|
||||
| SUCCOR | Software uncorrectable error containment and recovery capability. |
|
||||
| SVM | AMD Secure Virtual Machine |
|
||||
| SVMDA | Indicates support for the SVM decode assists. |
|
||||
| SVMFBASID | SVM, Indicates that TLB flush events, including CR3 writes and CR4.PGE toggles, flush only the current ASID's TLB entries. Also indicates support for the extended VMCBTLB_Control |
|
||||
| SVML | AMD SVM lock. Indicates support for SVM-Lock. |
|
||||
| SVMNP | AMD SVM nested paging |
|
||||
| SVMPF | SVM pause intercept filter. Indicates support for the pause intercept filter |
|
||||
| SVMPFT | SVM PAUSE filter threshold. Indicates support for the PAUSE filter cycle count threshold |
|
||||
| SYSCALL | System-Call Extension (SCE): SYSCALL and SYSRET instructions. |
|
||||
| SYSEE | SYSENTER and SYSEXIT instructions |
|
||||
| TBM | AMD Trailing Bit Manipulation |
|
||||
| TDX_GUEST | Intel Trust Domain Extensions Guest |
|
||||
| TLB_FLUSH_NESTED | AMD: Flushing includes all the nested translations for guest translations |
|
||||
| TME | Intel Total Memory Encryption. The following MSRs are supported: IA32_TME_CAPABILITY, IA32_TME_ACTIVATE, IA32_TME_EXCLUDE_MASK, and IA32_TME_EXCLUDE_BASE. |
|
||||
| TOPEXT | TopologyExtensions: topology extensions support. Indicates support for CPUID Fn8000_001D_EAX_x[N:0]-CPUID Fn8000_001E_EDX. |
|
||||
| TSCRATEMSR | MSR based TSC rate control. Indicates support for MSR TSC ratio MSRC000_0104 |
|
||||
| TSXLDTRK | Intel TSX Suspend Load Address Tracking |
|
||||
| VAES | Vector AES. AVX(512) versions requires additional checks. |
|
||||
| VMCBCLEAN | VMCB clean bits. Indicates support for VMCB clean bits. |
|
||||
| VMPL | AMD VM Permission Levels supported |
|
||||
| VMSA_REGPROT | AMD VMSA Register Protection supported |
|
||||
| VMX | Virtual Machine Extensions |
|
||||
| VPCLMULQDQ | Carry-Less Multiplication Quadword. Requires AVX for 3 register versions. |
|
||||
| VTE | AMD Virtual Transparent Encryption supported |
|
||||
| WAITPKG | TPAUSE, UMONITOR, UMWAIT |
|
||||
| WBNOINVD | Write Back and Do Not Invalidate Cache |
|
||||
| WRMSRNS | Non-Serializing Write to Model Specific Register |
|
||||
| X87 | FPU |
|
||||
| XGETBV1 | Supports XGETBV with ECX = 1 |
|
||||
| XOP | Bulldozer XOP functions |
|
||||
| XSAVE | XSAVE, XRESTOR, XSETBV, XGETBV |
|
||||
| XSAVEC | Supports XSAVEC and the compacted form of XRSTOR. |
|
||||
| XSAVEOPT | XSAVEOPT available |
|
||||
| XSAVES | Supports XSAVES/XRSTORS and IA32_XSS |
|
||||
|
||||
# ARM features:
|
||||
|
||||
| Feature Flag | Description |
|
||||
|--------------|------------------------------------------------------------------|
|
||||
| AESARM | AES instructions |
|
||||
| ARMCPUID | Some CPU ID registers readable at user-level |
|
||||
| ASIMD | Advanced SIMD |
|
||||
| ASIMDDP | SIMD Dot Product |
|
||||
| ASIMDHP | Advanced SIMD half-precision floating point |
|
||||
| ASIMDRDM | Rounding Double Multiply Accumulate/Subtract (SQRDMLAH/SQRDMLSH) |
|
||||
| ATOMICS | Large System Extensions (LSE) |
|
||||
| CRC32 | CRC32/CRC32C instructions |
|
||||
| DCPOP | Data cache clean to Point of Persistence (DC CVAP) |
|
||||
| EVTSTRM | Generic timer |
|
||||
| FCMA | Floatin point complex number addition and multiplication |
|
||||
| FP | Single-precision and double-precision floating point |
|
||||
| FPHP | Half-precision floating point |
|
||||
| GPA | Generic Pointer Authentication |
|
||||
| JSCVT | Javascript-style double->int convert (FJCVTZS) |
|
||||
| LRCPC | Weaker release consistency (LDAPR, etc) |
|
||||
| PMULL | Polynomial Multiply instructions (PMULL/PMULL2) |
|
||||
| SHA1 | SHA-1 instructions (SHA1C, etc) |
|
||||
| SHA2 | SHA-2 instructions (SHA256H, etc) |
|
||||
| SHA3 | SHA-3 instructions (EOR3, RAXI, XAR, BCAX) |
|
||||
| SHA512 | SHA512 instructions |
|
||||
| SM3 | SM3 instructions |
|
||||
| SM4 | SM4 instructions |
|
||||
| SVE | Scalable Vector Extension |
|
||||
|
||||
# license
|
||||
|
||||
This code is published under an MIT license. See LICENSE file for more information.
|
1514
vendor/github.com/klauspost/cpuid/v2/cpuid.go
generated
vendored
1514
vendor/github.com/klauspost/cpuid/v2/cpuid.go
generated
vendored
File diff suppressed because it is too large
Load Diff
47
vendor/github.com/klauspost/cpuid/v2/cpuid_386.s
generated
vendored
47
vendor/github.com/klauspost/cpuid/v2/cpuid_386.s
generated
vendored
@@ -1,47 +0,0 @@
|
||||
// Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file.
|
||||
|
||||
//+build 386,!gccgo,!noasm,!appengine
|
||||
|
||||
// func asmCpuid(op uint32) (eax, ebx, ecx, edx uint32)
|
||||
TEXT ·asmCpuid(SB), 7, $0
|
||||
XORL CX, CX
|
||||
MOVL op+0(FP), AX
|
||||
CPUID
|
||||
MOVL AX, eax+4(FP)
|
||||
MOVL BX, ebx+8(FP)
|
||||
MOVL CX, ecx+12(FP)
|
||||
MOVL DX, edx+16(FP)
|
||||
RET
|
||||
|
||||
// func asmCpuidex(op, op2 uint32) (eax, ebx, ecx, edx uint32)
|
||||
TEXT ·asmCpuidex(SB), 7, $0
|
||||
MOVL op+0(FP), AX
|
||||
MOVL op2+4(FP), CX
|
||||
CPUID
|
||||
MOVL AX, eax+8(FP)
|
||||
MOVL BX, ebx+12(FP)
|
||||
MOVL CX, ecx+16(FP)
|
||||
MOVL DX, edx+20(FP)
|
||||
RET
|
||||
|
||||
// func xgetbv(index uint32) (eax, edx uint32)
|
||||
TEXT ·asmXgetbv(SB), 7, $0
|
||||
MOVL index+0(FP), CX
|
||||
BYTE $0x0f; BYTE $0x01; BYTE $0xd0 // XGETBV
|
||||
MOVL AX, eax+4(FP)
|
||||
MOVL DX, edx+8(FP)
|
||||
RET
|
||||
|
||||
// func asmRdtscpAsm() (eax, ebx, ecx, edx uint32)
|
||||
TEXT ·asmRdtscpAsm(SB), 7, $0
|
||||
BYTE $0x0F; BYTE $0x01; BYTE $0xF9 // RDTSCP
|
||||
MOVL AX, eax+0(FP)
|
||||
MOVL BX, ebx+4(FP)
|
||||
MOVL CX, ecx+8(FP)
|
||||
MOVL DX, edx+12(FP)
|
||||
RET
|
||||
|
||||
// func asmDarwinHasAVX512() bool
|
||||
TEXT ·asmDarwinHasAVX512(SB), 7, $0
|
||||
MOVL $0, eax+0(FP)
|
||||
RET
|
72
vendor/github.com/klauspost/cpuid/v2/cpuid_amd64.s
generated
vendored
72
vendor/github.com/klauspost/cpuid/v2/cpuid_amd64.s
generated
vendored
@@ -1,72 +0,0 @@
|
||||
// Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file.
|
||||
|
||||
//+build amd64,!gccgo,!noasm,!appengine
|
||||
|
||||
// func asmCpuid(op uint32) (eax, ebx, ecx, edx uint32)
|
||||
TEXT ·asmCpuid(SB), 7, $0
|
||||
XORQ CX, CX
|
||||
MOVL op+0(FP), AX
|
||||
CPUID
|
||||
MOVL AX, eax+8(FP)
|
||||
MOVL BX, ebx+12(FP)
|
||||
MOVL CX, ecx+16(FP)
|
||||
MOVL DX, edx+20(FP)
|
||||
RET
|
||||
|
||||
// func asmCpuidex(op, op2 uint32) (eax, ebx, ecx, edx uint32)
|
||||
TEXT ·asmCpuidex(SB), 7, $0
|
||||
MOVL op+0(FP), AX
|
||||
MOVL op2+4(FP), CX
|
||||
CPUID
|
||||
MOVL AX, eax+8(FP)
|
||||
MOVL BX, ebx+12(FP)
|
||||
MOVL CX, ecx+16(FP)
|
||||
MOVL DX, edx+20(FP)
|
||||
RET
|
||||
|
||||
// func asmXgetbv(index uint32) (eax, edx uint32)
|
||||
TEXT ·asmXgetbv(SB), 7, $0
|
||||
MOVL index+0(FP), CX
|
||||
BYTE $0x0f; BYTE $0x01; BYTE $0xd0 // XGETBV
|
||||
MOVL AX, eax+8(FP)
|
||||
MOVL DX, edx+12(FP)
|
||||
RET
|
||||
|
||||
// func asmRdtscpAsm() (eax, ebx, ecx, edx uint32)
|
||||
TEXT ·asmRdtscpAsm(SB), 7, $0
|
||||
BYTE $0x0F; BYTE $0x01; BYTE $0xF9 // RDTSCP
|
||||
MOVL AX, eax+0(FP)
|
||||
MOVL BX, ebx+4(FP)
|
||||
MOVL CX, ecx+8(FP)
|
||||
MOVL DX, edx+12(FP)
|
||||
RET
|
||||
|
||||
// From https://go-review.googlesource.com/c/sys/+/285572/
|
||||
// func asmDarwinHasAVX512() bool
|
||||
TEXT ·asmDarwinHasAVX512(SB), 7, $0-1
|
||||
MOVB $0, ret+0(FP) // default to false
|
||||
|
||||
#ifdef GOOS_darwin // return if not darwin
|
||||
#ifdef GOARCH_amd64 // return if not amd64
|
||||
// These values from:
|
||||
// https://github.com/apple/darwin-xnu/blob/xnu-4570.1.46/osfmk/i386/cpu_capabilities.h
|
||||
#define commpage64_base_address 0x00007fffffe00000
|
||||
#define commpage64_cpu_capabilities64 (commpage64_base_address+0x010)
|
||||
#define commpage64_version (commpage64_base_address+0x01E)
|
||||
#define hasAVX512F 0x0000004000000000
|
||||
MOVQ $commpage64_version, BX
|
||||
MOVW (BX), AX
|
||||
CMPW AX, $13 // versions < 13 do not support AVX512
|
||||
JL no_avx512
|
||||
MOVQ $commpage64_cpu_capabilities64, BX
|
||||
MOVQ (BX), AX
|
||||
MOVQ $hasAVX512F, CX
|
||||
ANDQ CX, AX
|
||||
JZ no_avx512
|
||||
MOVB $1, ret+0(FP)
|
||||
|
||||
no_avx512:
|
||||
#endif
|
||||
#endif
|
||||
RET
|
||||
|
26
vendor/github.com/klauspost/cpuid/v2/cpuid_arm64.s
generated
vendored
26
vendor/github.com/klauspost/cpuid/v2/cpuid_arm64.s
generated
vendored
@@ -1,26 +0,0 @@
|
||||
// Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file.
|
||||
|
||||
//+build arm64,!gccgo,!noasm,!appengine
|
||||
|
||||
// See https://www.kernel.org/doc/Documentation/arm64/cpu-feature-registers.txt
|
||||
|
||||
// func getMidr
|
||||
TEXT ·getMidr(SB), 7, $0
|
||||
WORD $0xd5380000 // mrs x0, midr_el1 /* Main ID Register */
|
||||
MOVD R0, midr+0(FP)
|
||||
RET
|
||||
|
||||
// func getProcFeatures
|
||||
TEXT ·getProcFeatures(SB), 7, $0
|
||||
WORD $0xd5380400 // mrs x0, id_aa64pfr0_el1 /* Processor Feature Register 0 */
|
||||
MOVD R0, procFeatures+0(FP)
|
||||
RET
|
||||
|
||||
// func getInstAttributes
|
||||
TEXT ·getInstAttributes(SB), 7, $0
|
||||
WORD $0xd5380600 // mrs x0, id_aa64isar0_el1 /* Instruction Set Attribute Register 0 */
|
||||
WORD $0xd5380621 // mrs x1, id_aa64isar1_el1 /* Instruction Set Attribute Register 1 */
|
||||
MOVD R0, instAttrReg0+0(FP)
|
||||
MOVD R1, instAttrReg1+8(FP)
|
||||
RET
|
||||
|
247
vendor/github.com/klauspost/cpuid/v2/detect_arm64.go
generated
vendored
247
vendor/github.com/klauspost/cpuid/v2/detect_arm64.go
generated
vendored
@@ -1,247 +0,0 @@
|
||||
// Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file.
|
||||
|
||||
//go:build arm64 && !gccgo && !noasm && !appengine
|
||||
// +build arm64,!gccgo,!noasm,!appengine
|
||||
|
||||
package cpuid
|
||||
|
||||
import "runtime"
|
||||
|
||||
func getMidr() (midr uint64)
|
||||
func getProcFeatures() (procFeatures uint64)
|
||||
func getInstAttributes() (instAttrReg0, instAttrReg1 uint64)
|
||||
|
||||
func initCPU() {
|
||||
cpuid = func(uint32) (a, b, c, d uint32) { return 0, 0, 0, 0 }
|
||||
cpuidex = func(x, y uint32) (a, b, c, d uint32) { return 0, 0, 0, 0 }
|
||||
xgetbv = func(uint32) (a, b uint32) { return 0, 0 }
|
||||
rdtscpAsm = func() (a, b, c, d uint32) { return 0, 0, 0, 0 }
|
||||
}
|
||||
|
||||
func addInfo(c *CPUInfo, safe bool) {
|
||||
// Seems to be safe to assume on ARM64
|
||||
c.CacheLine = 64
|
||||
detectOS(c)
|
||||
|
||||
// ARM64 disabled since it may crash if interrupt is not intercepted by OS.
|
||||
if safe && !c.Supports(ARMCPUID) && runtime.GOOS != "freebsd" {
|
||||
return
|
||||
}
|
||||
midr := getMidr()
|
||||
|
||||
// MIDR_EL1 - Main ID Register
|
||||
// https://developer.arm.com/docs/ddi0595/h/aarch64-system-registers/midr_el1
|
||||
// x--------------------------------------------------x
|
||||
// | Name | bits | visible |
|
||||
// |--------------------------------------------------|
|
||||
// | Implementer | [31-24] | y |
|
||||
// |--------------------------------------------------|
|
||||
// | Variant | [23-20] | y |
|
||||
// |--------------------------------------------------|
|
||||
// | Architecture | [19-16] | y |
|
||||
// |--------------------------------------------------|
|
||||
// | PartNum | [15-4] | y |
|
||||
// |--------------------------------------------------|
|
||||
// | Revision | [3-0] | y |
|
||||
// x--------------------------------------------------x
|
||||
|
||||
switch (midr >> 24) & 0xff {
|
||||
case 0xC0:
|
||||
c.VendorString = "Ampere Computing"
|
||||
c.VendorID = Ampere
|
||||
case 0x41:
|
||||
c.VendorString = "Arm Limited"
|
||||
c.VendorID = ARM
|
||||
case 0x42:
|
||||
c.VendorString = "Broadcom Corporation"
|
||||
c.VendorID = Broadcom
|
||||
case 0x43:
|
||||
c.VendorString = "Cavium Inc"
|
||||
c.VendorID = Cavium
|
||||
case 0x44:
|
||||
c.VendorString = "Digital Equipment Corporation"
|
||||
c.VendorID = DEC
|
||||
case 0x46:
|
||||
c.VendorString = "Fujitsu Ltd"
|
||||
c.VendorID = Fujitsu
|
||||
case 0x49:
|
||||
c.VendorString = "Infineon Technologies AG"
|
||||
c.VendorID = Infineon
|
||||
case 0x4D:
|
||||
c.VendorString = "Motorola or Freescale Semiconductor Inc"
|
||||
c.VendorID = Motorola
|
||||
case 0x4E:
|
||||
c.VendorString = "NVIDIA Corporation"
|
||||
c.VendorID = NVIDIA
|
||||
case 0x50:
|
||||
c.VendorString = "Applied Micro Circuits Corporation"
|
||||
c.VendorID = AMCC
|
||||
case 0x51:
|
||||
c.VendorString = "Qualcomm Inc"
|
||||
c.VendorID = Qualcomm
|
||||
case 0x56:
|
||||
c.VendorString = "Marvell International Ltd"
|
||||
c.VendorID = Marvell
|
||||
case 0x69:
|
||||
c.VendorString = "Intel Corporation"
|
||||
c.VendorID = Intel
|
||||
}
|
||||
|
||||
// Lower 4 bits: Architecture
|
||||
// Architecture Meaning
|
||||
// 0b0001 Armv4.
|
||||
// 0b0010 Armv4T.
|
||||
// 0b0011 Armv5 (obsolete).
|
||||
// 0b0100 Armv5T.
|
||||
// 0b0101 Armv5TE.
|
||||
// 0b0110 Armv5TEJ.
|
||||
// 0b0111 Armv6.
|
||||
// 0b1111 Architectural features are individually identified in the ID_* registers, see 'ID registers'.
|
||||
// Upper 4 bit: Variant
|
||||
// An IMPLEMENTATION DEFINED variant number.
|
||||
// Typically, this field is used to distinguish between different product variants, or major revisions of a product.
|
||||
c.Family = int(midr>>16) & 0xff
|
||||
|
||||
// PartNum, bits [15:4]
|
||||
// An IMPLEMENTATION DEFINED primary part number for the device.
|
||||
// On processors implemented by Arm, if the top four bits of the primary
|
||||
// part number are 0x0 or 0x7, the variant and architecture are encoded differently.
|
||||
// Revision, bits [3:0]
|
||||
// An IMPLEMENTATION DEFINED revision number for the device.
|
||||
c.Model = int(midr) & 0xffff
|
||||
|
||||
procFeatures := getProcFeatures()
|
||||
|
||||
// ID_AA64PFR0_EL1 - Processor Feature Register 0
|
||||
// x--------------------------------------------------x
|
||||
// | Name | bits | visible |
|
||||
// |--------------------------------------------------|
|
||||
// | DIT | [51-48] | y |
|
||||
// |--------------------------------------------------|
|
||||
// | SVE | [35-32] | y |
|
||||
// |--------------------------------------------------|
|
||||
// | GIC | [27-24] | n |
|
||||
// |--------------------------------------------------|
|
||||
// | AdvSIMD | [23-20] | y |
|
||||
// |--------------------------------------------------|
|
||||
// | FP | [19-16] | y |
|
||||
// |--------------------------------------------------|
|
||||
// | EL3 | [15-12] | n |
|
||||
// |--------------------------------------------------|
|
||||
// | EL2 | [11-8] | n |
|
||||
// |--------------------------------------------------|
|
||||
// | EL1 | [7-4] | n |
|
||||
// |--------------------------------------------------|
|
||||
// | EL0 | [3-0] | n |
|
||||
// x--------------------------------------------------x
|
||||
|
||||
var f flagSet
|
||||
// if procFeatures&(0xf<<48) != 0 {
|
||||
// fmt.Println("DIT")
|
||||
// }
|
||||
f.setIf(procFeatures&(0xf<<32) != 0, SVE)
|
||||
if procFeatures&(0xf<<20) != 15<<20 {
|
||||
f.set(ASIMD)
|
||||
// https://developer.arm.com/docs/ddi0595/b/aarch64-system-registers/id_aa64pfr0_el1
|
||||
// 0b0001 --> As for 0b0000, and also includes support for half-precision floating-point arithmetic.
|
||||
f.setIf(procFeatures&(0xf<<20) == 1<<20, FPHP, ASIMDHP)
|
||||
}
|
||||
f.setIf(procFeatures&(0xf<<16) != 0, FP)
|
||||
|
||||
instAttrReg0, instAttrReg1 := getInstAttributes()
|
||||
|
||||
// https://developer.arm.com/docs/ddi0595/b/aarch64-system-registers/id_aa64isar0_el1
|
||||
//
|
||||
// ID_AA64ISAR0_EL1 - Instruction Set Attribute Register 0
|
||||
// x--------------------------------------------------x
|
||||
// | Name | bits | visible |
|
||||
// |--------------------------------------------------|
|
||||
// | TS | [55-52] | y |
|
||||
// |--------------------------------------------------|
|
||||
// | FHM | [51-48] | y |
|
||||
// |--------------------------------------------------|
|
||||
// | DP | [47-44] | y |
|
||||
// |--------------------------------------------------|
|
||||
// | SM4 | [43-40] | y |
|
||||
// |--------------------------------------------------|
|
||||
// | SM3 | [39-36] | y |
|
||||
// |--------------------------------------------------|
|
||||
// | SHA3 | [35-32] | y |
|
||||
// |--------------------------------------------------|
|
||||
// | RDM | [31-28] | y |
|
||||
// |--------------------------------------------------|
|
||||
// | ATOMICS | [23-20] | y |
|
||||
// |--------------------------------------------------|
|
||||
// | CRC32 | [19-16] | y |
|
||||
// |--------------------------------------------------|
|
||||
// | SHA2 | [15-12] | y |
|
||||
// |--------------------------------------------------|
|
||||
// | SHA1 | [11-8] | y |
|
||||
// |--------------------------------------------------|
|
||||
// | AES | [7-4] | y |
|
||||
// x--------------------------------------------------x
|
||||
|
||||
// if instAttrReg0&(0xf<<52) != 0 {
|
||||
// fmt.Println("TS")
|
||||
// }
|
||||
// if instAttrReg0&(0xf<<48) != 0 {
|
||||
// fmt.Println("FHM")
|
||||
// }
|
||||
f.setIf(instAttrReg0&(0xf<<44) != 0, ASIMDDP)
|
||||
f.setIf(instAttrReg0&(0xf<<40) != 0, SM4)
|
||||
f.setIf(instAttrReg0&(0xf<<36) != 0, SM3)
|
||||
f.setIf(instAttrReg0&(0xf<<32) != 0, SHA3)
|
||||
f.setIf(instAttrReg0&(0xf<<28) != 0, ASIMDRDM)
|
||||
f.setIf(instAttrReg0&(0xf<<20) != 0, ATOMICS)
|
||||
f.setIf(instAttrReg0&(0xf<<16) != 0, CRC32)
|
||||
f.setIf(instAttrReg0&(0xf<<12) != 0, SHA2)
|
||||
// https://developer.arm.com/docs/ddi0595/b/aarch64-system-registers/id_aa64isar0_el1
|
||||
// 0b0010 --> As 0b0001, plus SHA512H, SHA512H2, SHA512SU0, and SHA512SU1 instructions implemented.
|
||||
f.setIf(instAttrReg0&(0xf<<12) == 2<<12, SHA512)
|
||||
f.setIf(instAttrReg0&(0xf<<8) != 0, SHA1)
|
||||
f.setIf(instAttrReg0&(0xf<<4) != 0, AESARM)
|
||||
// https://developer.arm.com/docs/ddi0595/b/aarch64-system-registers/id_aa64isar0_el1
|
||||
// 0b0010 --> As for 0b0001, plus PMULL/PMULL2 instructions operating on 64-bit data quantities.
|
||||
f.setIf(instAttrReg0&(0xf<<4) == 2<<4, PMULL)
|
||||
|
||||
// https://developer.arm.com/docs/ddi0595/b/aarch64-system-registers/id_aa64isar1_el1
|
||||
//
|
||||
// ID_AA64ISAR1_EL1 - Instruction set attribute register 1
|
||||
// x--------------------------------------------------x
|
||||
// | Name | bits | visible |
|
||||
// |--------------------------------------------------|
|
||||
// | GPI | [31-28] | y |
|
||||
// |--------------------------------------------------|
|
||||
// | GPA | [27-24] | y |
|
||||
// |--------------------------------------------------|
|
||||
// | LRCPC | [23-20] | y |
|
||||
// |--------------------------------------------------|
|
||||
// | FCMA | [19-16] | y |
|
||||
// |--------------------------------------------------|
|
||||
// | JSCVT | [15-12] | y |
|
||||
// |--------------------------------------------------|
|
||||
// | API | [11-8] | y |
|
||||
// |--------------------------------------------------|
|
||||
// | APA | [7-4] | y |
|
||||
// |--------------------------------------------------|
|
||||
// | DPB | [3-0] | y |
|
||||
// x--------------------------------------------------x
|
||||
|
||||
// if instAttrReg1&(0xf<<28) != 0 {
|
||||
// fmt.Println("GPI")
|
||||
// }
|
||||
f.setIf(instAttrReg1&(0xf<<28) != 24, GPA)
|
||||
f.setIf(instAttrReg1&(0xf<<20) != 0, LRCPC)
|
||||
f.setIf(instAttrReg1&(0xf<<16) != 0, FCMA)
|
||||
f.setIf(instAttrReg1&(0xf<<12) != 0, JSCVT)
|
||||
// if instAttrReg1&(0xf<<8) != 0 {
|
||||
// fmt.Println("API")
|
||||
// }
|
||||
// if instAttrReg1&(0xf<<4) != 0 {
|
||||
// fmt.Println("APA")
|
||||
// }
|
||||
f.setIf(instAttrReg1&(0xf<<0) != 0, DCPOP)
|
||||
|
||||
// Store
|
||||
c.featureSet.or(f)
|
||||
}
|
15
vendor/github.com/klauspost/cpuid/v2/detect_ref.go
generated
vendored
15
vendor/github.com/klauspost/cpuid/v2/detect_ref.go
generated
vendored
@@ -1,15 +0,0 @@
|
||||
// Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file.
|
||||
|
||||
//go:build (!amd64 && !386 && !arm64) || gccgo || noasm || appengine
|
||||
// +build !amd64,!386,!arm64 gccgo noasm appengine
|
||||
|
||||
package cpuid
|
||||
|
||||
func initCPU() {
|
||||
cpuid = func(uint32) (a, b, c, d uint32) { return 0, 0, 0, 0 }
|
||||
cpuidex = func(x, y uint32) (a, b, c, d uint32) { return 0, 0, 0, 0 }
|
||||
xgetbv = func(uint32) (a, b uint32) { return 0, 0 }
|
||||
rdtscpAsm = func() (a, b, c, d uint32) { return 0, 0, 0, 0 }
|
||||
}
|
||||
|
||||
func addInfo(info *CPUInfo, safe bool) {}
|
38
vendor/github.com/klauspost/cpuid/v2/detect_x86.go
generated
vendored
38
vendor/github.com/klauspost/cpuid/v2/detect_x86.go
generated
vendored
@@ -1,38 +0,0 @@
|
||||
// Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file.
|
||||
|
||||
//go:build (386 && !gccgo && !noasm && !appengine) || (amd64 && !gccgo && !noasm && !appengine)
|
||||
// +build 386,!gccgo,!noasm,!appengine amd64,!gccgo,!noasm,!appengine
|
||||
|
||||
package cpuid
|
||||
|
||||
func asmCpuid(op uint32) (eax, ebx, ecx, edx uint32)
|
||||
func asmCpuidex(op, op2 uint32) (eax, ebx, ecx, edx uint32)
|
||||
func asmXgetbv(index uint32) (eax, edx uint32)
|
||||
func asmRdtscpAsm() (eax, ebx, ecx, edx uint32)
|
||||
func asmDarwinHasAVX512() bool
|
||||
|
||||
func initCPU() {
|
||||
cpuid = asmCpuid
|
||||
cpuidex = asmCpuidex
|
||||
xgetbv = asmXgetbv
|
||||
rdtscpAsm = asmRdtscpAsm
|
||||
darwinHasAVX512 = asmDarwinHasAVX512
|
||||
}
|
||||
|
||||
func addInfo(c *CPUInfo, safe bool) {
|
||||
c.maxFunc = maxFunctionID()
|
||||
c.maxExFunc = maxExtendedFunction()
|
||||
c.BrandName = brandName()
|
||||
c.CacheLine = cacheLine()
|
||||
c.Family, c.Model, c.Stepping = familyModel()
|
||||
c.featureSet = support()
|
||||
c.SGX = hasSGX(c.featureSet.inSet(SGX), c.featureSet.inSet(SGXLC))
|
||||
c.AMDMemEncryption = hasAMDMemEncryption(c.featureSet.inSet(SME) || c.featureSet.inSet(SEV))
|
||||
c.ThreadsPerCore = threadsPerCore()
|
||||
c.LogicalCores = logicalCores()
|
||||
c.PhysicalCores = physicalCores()
|
||||
c.VendorID, c.VendorString = vendorID()
|
||||
c.AVX10Level = c.supportAVX10()
|
||||
c.cacheSize()
|
||||
c.frequencies()
|
||||
}
|
284
vendor/github.com/klauspost/cpuid/v2/featureid_string.go
generated
vendored
284
vendor/github.com/klauspost/cpuid/v2/featureid_string.go
generated
vendored
@@ -1,284 +0,0 @@
|
||||
// Code generated by "stringer -type=FeatureID,Vendor"; DO NOT EDIT.
|
||||
|
||||
package cpuid
|
||||
|
||||
import "strconv"
|
||||
|
||||
func _() {
|
||||
// An "invalid array index" compiler error signifies that the constant values have changed.
|
||||
// Re-run the stringer command to generate them again.
|
||||
var x [1]struct{}
|
||||
_ = x[ADX-1]
|
||||
_ = x[AESNI-2]
|
||||
_ = x[AMD3DNOW-3]
|
||||
_ = x[AMD3DNOWEXT-4]
|
||||
_ = x[AMXBF16-5]
|
||||
_ = x[AMXFP16-6]
|
||||
_ = x[AMXINT8-7]
|
||||
_ = x[AMXTILE-8]
|
||||
_ = x[APX_F-9]
|
||||
_ = x[AVX-10]
|
||||
_ = x[AVX10-11]
|
||||
_ = x[AVX10_128-12]
|
||||
_ = x[AVX10_256-13]
|
||||
_ = x[AVX10_512-14]
|
||||
_ = x[AVX2-15]
|
||||
_ = x[AVX512BF16-16]
|
||||
_ = x[AVX512BITALG-17]
|
||||
_ = x[AVX512BW-18]
|
||||
_ = x[AVX512CD-19]
|
||||
_ = x[AVX512DQ-20]
|
||||
_ = x[AVX512ER-21]
|
||||
_ = x[AVX512F-22]
|
||||
_ = x[AVX512FP16-23]
|
||||
_ = x[AVX512IFMA-24]
|
||||
_ = x[AVX512PF-25]
|
||||
_ = x[AVX512VBMI-26]
|
||||
_ = x[AVX512VBMI2-27]
|
||||
_ = x[AVX512VL-28]
|
||||
_ = x[AVX512VNNI-29]
|
||||
_ = x[AVX512VP2INTERSECT-30]
|
||||
_ = x[AVX512VPOPCNTDQ-31]
|
||||
_ = x[AVXIFMA-32]
|
||||
_ = x[AVXNECONVERT-33]
|
||||
_ = x[AVXSLOW-34]
|
||||
_ = x[AVXVNNI-35]
|
||||
_ = x[AVXVNNIINT8-36]
|
||||
_ = x[BHI_CTRL-37]
|
||||
_ = x[BMI1-38]
|
||||
_ = x[BMI2-39]
|
||||
_ = x[CETIBT-40]
|
||||
_ = x[CETSS-41]
|
||||
_ = x[CLDEMOTE-42]
|
||||
_ = x[CLMUL-43]
|
||||
_ = x[CLZERO-44]
|
||||
_ = x[CMOV-45]
|
||||
_ = x[CMPCCXADD-46]
|
||||
_ = x[CMPSB_SCADBS_SHORT-47]
|
||||
_ = x[CMPXCHG8-48]
|
||||
_ = x[CPBOOST-49]
|
||||
_ = x[CPPC-50]
|
||||
_ = x[CX16-51]
|
||||
_ = x[EFER_LMSLE_UNS-52]
|
||||
_ = x[ENQCMD-53]
|
||||
_ = x[ERMS-54]
|
||||
_ = x[F16C-55]
|
||||
_ = x[FLUSH_L1D-56]
|
||||
_ = x[FMA3-57]
|
||||
_ = x[FMA4-58]
|
||||
_ = x[FP128-59]
|
||||
_ = x[FP256-60]
|
||||
_ = x[FSRM-61]
|
||||
_ = x[FXSR-62]
|
||||
_ = x[FXSROPT-63]
|
||||
_ = x[GFNI-64]
|
||||
_ = x[HLE-65]
|
||||
_ = x[HRESET-66]
|
||||
_ = x[HTT-67]
|
||||
_ = x[HWA-68]
|
||||
_ = x[HYBRID_CPU-69]
|
||||
_ = x[HYPERVISOR-70]
|
||||
_ = x[IA32_ARCH_CAP-71]
|
||||
_ = x[IA32_CORE_CAP-72]
|
||||
_ = x[IBPB-73]
|
||||
_ = x[IBPB_BRTYPE-74]
|
||||
_ = x[IBRS-75]
|
||||
_ = x[IBRS_PREFERRED-76]
|
||||
_ = x[IBRS_PROVIDES_SMP-77]
|
||||
_ = x[IBS-78]
|
||||
_ = x[IBSBRNTRGT-79]
|
||||
_ = x[IBSFETCHSAM-80]
|
||||
_ = x[IBSFFV-81]
|
||||
_ = x[IBSOPCNT-82]
|
||||
_ = x[IBSOPCNTEXT-83]
|
||||
_ = x[IBSOPSAM-84]
|
||||
_ = x[IBSRDWROPCNT-85]
|
||||
_ = x[IBSRIPINVALIDCHK-86]
|
||||
_ = x[IBS_FETCH_CTLX-87]
|
||||
_ = x[IBS_OPDATA4-88]
|
||||
_ = x[IBS_OPFUSE-89]
|
||||
_ = x[IBS_PREVENTHOST-90]
|
||||
_ = x[IBS_ZEN4-91]
|
||||
_ = x[IDPRED_CTRL-92]
|
||||
_ = x[INT_WBINVD-93]
|
||||
_ = x[INVLPGB-94]
|
||||
_ = x[KEYLOCKER-95]
|
||||
_ = x[KEYLOCKERW-96]
|
||||
_ = x[LAHF-97]
|
||||
_ = x[LAM-98]
|
||||
_ = x[LBRVIRT-99]
|
||||
_ = x[LZCNT-100]
|
||||
_ = x[MCAOVERFLOW-101]
|
||||
_ = x[MCDT_NO-102]
|
||||
_ = x[MCOMMIT-103]
|
||||
_ = x[MD_CLEAR-104]
|
||||
_ = x[MMX-105]
|
||||
_ = x[MMXEXT-106]
|
||||
_ = x[MOVBE-107]
|
||||
_ = x[MOVDIR64B-108]
|
||||
_ = x[MOVDIRI-109]
|
||||
_ = x[MOVSB_ZL-110]
|
||||
_ = x[MOVU-111]
|
||||
_ = x[MPX-112]
|
||||
_ = x[MSRIRC-113]
|
||||
_ = x[MSRLIST-114]
|
||||
_ = x[MSR_PAGEFLUSH-115]
|
||||
_ = x[NRIPS-116]
|
||||
_ = x[NX-117]
|
||||
_ = x[OSXSAVE-118]
|
||||
_ = x[PCONFIG-119]
|
||||
_ = x[POPCNT-120]
|
||||
_ = x[PPIN-121]
|
||||
_ = x[PREFETCHI-122]
|
||||
_ = x[PSFD-123]
|
||||
_ = x[RDPRU-124]
|
||||
_ = x[RDRAND-125]
|
||||
_ = x[RDSEED-126]
|
||||
_ = x[RDTSCP-127]
|
||||
_ = x[RRSBA_CTRL-128]
|
||||
_ = x[RTM-129]
|
||||
_ = x[RTM_ALWAYS_ABORT-130]
|
||||
_ = x[SBPB-131]
|
||||
_ = x[SERIALIZE-132]
|
||||
_ = x[SEV-133]
|
||||
_ = x[SEV_64BIT-134]
|
||||
_ = x[SEV_ALTERNATIVE-135]
|
||||
_ = x[SEV_DEBUGSWAP-136]
|
||||
_ = x[SEV_ES-137]
|
||||
_ = x[SEV_RESTRICTED-138]
|
||||
_ = x[SEV_SNP-139]
|
||||
_ = x[SGX-140]
|
||||
_ = x[SGXLC-141]
|
||||
_ = x[SHA-142]
|
||||
_ = x[SME-143]
|
||||
_ = x[SME_COHERENT-144]
|
||||
_ = x[SPEC_CTRL_SSBD-145]
|
||||
_ = x[SRBDS_CTRL-146]
|
||||
_ = x[SRSO_MSR_FIX-147]
|
||||
_ = x[SRSO_NO-148]
|
||||
_ = x[SRSO_USER_KERNEL_NO-149]
|
||||
_ = x[SSE-150]
|
||||
_ = x[SSE2-151]
|
||||
_ = x[SSE3-152]
|
||||
_ = x[SSE4-153]
|
||||
_ = x[SSE42-154]
|
||||
_ = x[SSE4A-155]
|
||||
_ = x[SSSE3-156]
|
||||
_ = x[STIBP-157]
|
||||
_ = x[STIBP_ALWAYSON-158]
|
||||
_ = x[STOSB_SHORT-159]
|
||||
_ = x[SUCCOR-160]
|
||||
_ = x[SVM-161]
|
||||
_ = x[SVMDA-162]
|
||||
_ = x[SVMFBASID-163]
|
||||
_ = x[SVML-164]
|
||||
_ = x[SVMNP-165]
|
||||
_ = x[SVMPF-166]
|
||||
_ = x[SVMPFT-167]
|
||||
_ = x[SYSCALL-168]
|
||||
_ = x[SYSEE-169]
|
||||
_ = x[TBM-170]
|
||||
_ = x[TDX_GUEST-171]
|
||||
_ = x[TLB_FLUSH_NESTED-172]
|
||||
_ = x[TME-173]
|
||||
_ = x[TOPEXT-174]
|
||||
_ = x[TSCRATEMSR-175]
|
||||
_ = x[TSXLDTRK-176]
|
||||
_ = x[VAES-177]
|
||||
_ = x[VMCBCLEAN-178]
|
||||
_ = x[VMPL-179]
|
||||
_ = x[VMSA_REGPROT-180]
|
||||
_ = x[VMX-181]
|
||||
_ = x[VPCLMULQDQ-182]
|
||||
_ = x[VTE-183]
|
||||
_ = x[WAITPKG-184]
|
||||
_ = x[WBNOINVD-185]
|
||||
_ = x[WRMSRNS-186]
|
||||
_ = x[X87-187]
|
||||
_ = x[XGETBV1-188]
|
||||
_ = x[XOP-189]
|
||||
_ = x[XSAVE-190]
|
||||
_ = x[XSAVEC-191]
|
||||
_ = x[XSAVEOPT-192]
|
||||
_ = x[XSAVES-193]
|
||||
_ = x[AESARM-194]
|
||||
_ = x[ARMCPUID-195]
|
||||
_ = x[ASIMD-196]
|
||||
_ = x[ASIMDDP-197]
|
||||
_ = x[ASIMDHP-198]
|
||||
_ = x[ASIMDRDM-199]
|
||||
_ = x[ATOMICS-200]
|
||||
_ = x[CRC32-201]
|
||||
_ = x[DCPOP-202]
|
||||
_ = x[EVTSTRM-203]
|
||||
_ = x[FCMA-204]
|
||||
_ = x[FP-205]
|
||||
_ = x[FPHP-206]
|
||||
_ = x[GPA-207]
|
||||
_ = x[JSCVT-208]
|
||||
_ = x[LRCPC-209]
|
||||
_ = x[PMULL-210]
|
||||
_ = x[SHA1-211]
|
||||
_ = x[SHA2-212]
|
||||
_ = x[SHA3-213]
|
||||
_ = x[SHA512-214]
|
||||
_ = x[SM3-215]
|
||||
_ = x[SM4-216]
|
||||
_ = x[SVE-217]
|
||||
_ = x[lastID-218]
|
||||
_ = x[firstID-0]
|
||||
}
|
||||
|
||||
const _FeatureID_name = "firstIDADXAESNIAMD3DNOWAMD3DNOWEXTAMXBF16AMXFP16AMXINT8AMXTILEAPX_FAVXAVX10AVX10_128AVX10_256AVX10_512AVX2AVX512BF16AVX512BITALGAVX512BWAVX512CDAVX512DQAVX512ERAVX512FAVX512FP16AVX512IFMAAVX512PFAVX512VBMIAVX512VBMI2AVX512VLAVX512VNNIAVX512VP2INTERSECTAVX512VPOPCNTDQAVXIFMAAVXNECONVERTAVXSLOWAVXVNNIAVXVNNIINT8BHI_CTRLBMI1BMI2CETIBTCETSSCLDEMOTECLMULCLZEROCMOVCMPCCXADDCMPSB_SCADBS_SHORTCMPXCHG8CPBOOSTCPPCCX16EFER_LMSLE_UNSENQCMDERMSF16CFLUSH_L1DFMA3FMA4FP128FP256FSRMFXSRFXSROPTGFNIHLEHRESETHTTHWAHYBRID_CPUHYPERVISORIA32_ARCH_CAPIA32_CORE_CAPIBPBIBPB_BRTYPEIBRSIBRS_PREFERREDIBRS_PROVIDES_SMPIBSIBSBRNTRGTIBSFETCHSAMIBSFFVIBSOPCNTIBSOPCNTEXTIBSOPSAMIBSRDWROPCNTIBSRIPINVALIDCHKIBS_FETCH_CTLXIBS_OPDATA4IBS_OPFUSEIBS_PREVENTHOSTIBS_ZEN4IDPRED_CTRLINT_WBINVDINVLPGBKEYLOCKERKEYLOCKERWLAHFLAMLBRVIRTLZCNTMCAOVERFLOWMCDT_NOMCOMMITMD_CLEARMMXMMXEXTMOVBEMOVDIR64BMOVDIRIMOVSB_ZLMOVUMPXMSRIRCMSRLISTMSR_PAGEFLUSHNRIPSNXOSXSAVEPCONFIGPOPCNTPPINPREFETCHIPSFDRDPRURDRANDRDSEEDRDTSCPRRSBA_CTRLRTMRTM_ALWAYS_ABORTSBPBSERIALIZESEVSEV_64BITSEV_ALTERNATIVESEV_DEBUGSWAPSEV_ESSEV_RESTRICTEDSEV_SNPSGXSGXLCSHASMESME_COHERENTSPEC_CTRL_SSBDSRBDS_CTRLSRSO_MSR_FIXSRSO_NOSRSO_USER_KERNEL_NOSSESSE2SSE3SSE4SSE42SSE4ASSSE3STIBPSTIBP_ALWAYSONSTOSB_SHORTSUCCORSVMSVMDASVMFBASIDSVMLSVMNPSVMPFSVMPFTSYSCALLSYSEETBMTDX_GUESTTLB_FLUSH_NESTEDTMETOPEXTTSCRATEMSRTSXLDTRKVAESVMCBCLEANVMPLVMSA_REGPROTVMXVPCLMULQDQVTEWAITPKGWBNOINVDWRMSRNSX87XGETBV1XOPXSAVEXSAVECXSAVEOPTXSAVESAESARMARMCPUIDASIMDASIMDDPASIMDHPASIMDRDMATOMICSCRC32DCPOPEVTSTRMFCMAFPFPHPGPAJSCVTLRCPCPMULLSHA1SHA2SHA3SHA512SM3SM4SVElastID"
|
||||
|
||||
var _FeatureID_index = [...]uint16{0, 7, 10, 15, 23, 34, 41, 48, 55, 62, 67, 70, 75, 84, 93, 102, 106, 116, 128, 136, 144, 152, 160, 167, 177, 187, 195, 205, 216, 224, 234, 252, 267, 274, 286, 293, 300, 311, 319, 323, 327, 333, 338, 346, 351, 357, 361, 370, 388, 396, 403, 407, 411, 425, 431, 435, 439, 448, 452, 456, 461, 466, 470, 474, 481, 485, 488, 494, 497, 500, 510, 520, 533, 546, 550, 561, 565, 579, 596, 599, 609, 620, 626, 634, 645, 653, 665, 681, 695, 706, 716, 731, 739, 750, 760, 767, 776, 786, 790, 793, 800, 805, 816, 823, 830, 838, 841, 847, 852, 861, 868, 876, 880, 883, 889, 896, 909, 914, 916, 923, 930, 936, 940, 949, 953, 958, 964, 970, 976, 986, 989, 1005, 1009, 1018, 1021, 1030, 1045, 1058, 1064, 1078, 1085, 1088, 1093, 1096, 1099, 1111, 1125, 1135, 1147, 1154, 1173, 1176, 1180, 1184, 1188, 1193, 1198, 1203, 1208, 1222, 1233, 1239, 1242, 1247, 1256, 1260, 1265, 1270, 1276, 1283, 1288, 1291, 1300, 1316, 1319, 1325, 1335, 1343, 1347, 1356, 1360, 1372, 1375, 1385, 1388, 1395, 1403, 1410, 1413, 1420, 1423, 1428, 1434, 1442, 1448, 1454, 1462, 1467, 1474, 1481, 1489, 1496, 1501, 1506, 1513, 1517, 1519, 1523, 1526, 1531, 1536, 1541, 1545, 1549, 1553, 1559, 1562, 1565, 1568, 1574}
|
||||
|
||||
func (i FeatureID) String() string {
|
||||
if i < 0 || i >= FeatureID(len(_FeatureID_index)-1) {
|
||||
return "FeatureID(" + strconv.FormatInt(int64(i), 10) + ")"
|
||||
}
|
||||
return _FeatureID_name[_FeatureID_index[i]:_FeatureID_index[i+1]]
|
||||
}
|
||||
func _() {
|
||||
// An "invalid array index" compiler error signifies that the constant values have changed.
|
||||
// Re-run the stringer command to generate them again.
|
||||
var x [1]struct{}
|
||||
_ = x[VendorUnknown-0]
|
||||
_ = x[Intel-1]
|
||||
_ = x[AMD-2]
|
||||
_ = x[VIA-3]
|
||||
_ = x[Transmeta-4]
|
||||
_ = x[NSC-5]
|
||||
_ = x[KVM-6]
|
||||
_ = x[MSVM-7]
|
||||
_ = x[VMware-8]
|
||||
_ = x[XenHVM-9]
|
||||
_ = x[Bhyve-10]
|
||||
_ = x[Hygon-11]
|
||||
_ = x[SiS-12]
|
||||
_ = x[RDC-13]
|
||||
_ = x[Ampere-14]
|
||||
_ = x[ARM-15]
|
||||
_ = x[Broadcom-16]
|
||||
_ = x[Cavium-17]
|
||||
_ = x[DEC-18]
|
||||
_ = x[Fujitsu-19]
|
||||
_ = x[Infineon-20]
|
||||
_ = x[Motorola-21]
|
||||
_ = x[NVIDIA-22]
|
||||
_ = x[AMCC-23]
|
||||
_ = x[Qualcomm-24]
|
||||
_ = x[Marvell-25]
|
||||
_ = x[lastVendor-26]
|
||||
}
|
||||
|
||||
const _Vendor_name = "VendorUnknownIntelAMDVIATransmetaNSCKVMMSVMVMwareXenHVMBhyveHygonSiSRDCAmpereARMBroadcomCaviumDECFujitsuInfineonMotorolaNVIDIAAMCCQualcommMarvelllastVendor"
|
||||
|
||||
var _Vendor_index = [...]uint8{0, 13, 18, 21, 24, 33, 36, 39, 43, 49, 55, 60, 65, 68, 71, 77, 80, 88, 94, 97, 104, 112, 120, 126, 130, 138, 145, 155}
|
||||
|
||||
func (i Vendor) String() string {
|
||||
if i < 0 || i >= Vendor(len(_Vendor_index)-1) {
|
||||
return "Vendor(" + strconv.FormatInt(int64(i), 10) + ")"
|
||||
}
|
||||
return _Vendor_name[_Vendor_index[i]:_Vendor_index[i+1]]
|
||||
}
|
121
vendor/github.com/klauspost/cpuid/v2/os_darwin_arm64.go
generated
vendored
121
vendor/github.com/klauspost/cpuid/v2/os_darwin_arm64.go
generated
vendored
@@ -1,121 +0,0 @@
|
||||
// Copyright (c) 2020 Klaus Post, released under MIT License. See LICENSE file.
|
||||
|
||||
package cpuid
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
func detectOS(c *CPUInfo) bool {
|
||||
if runtime.GOOS != "ios" {
|
||||
tryToFillCPUInfoFomSysctl(c)
|
||||
}
|
||||
// There are no hw.optional sysctl values for the below features on Mac OS 11.0
|
||||
// to detect their supported state dynamically. Assume the CPU features that
|
||||
// Apple Silicon M1 supports to be available as a minimal set of features
|
||||
// to all Go programs running on darwin/arm64.
|
||||
// TODO: Add more if we know them.
|
||||
c.featureSet.setIf(runtime.GOOS != "ios", AESARM, PMULL, SHA1, SHA2)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func sysctlGetBool(name string) bool {
|
||||
value, err := unix.SysctlUint32(name)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return value != 0
|
||||
}
|
||||
|
||||
func sysctlGetString(name string) string {
|
||||
value, err := unix.Sysctl(name)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
func sysctlGetInt(unknown int, names ...string) int {
|
||||
for _, name := range names {
|
||||
value, err := unix.SysctlUint32(name)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
if value != 0 {
|
||||
return int(value)
|
||||
}
|
||||
}
|
||||
return unknown
|
||||
}
|
||||
|
||||
func sysctlGetInt64(unknown int, names ...string) int {
|
||||
for _, name := range names {
|
||||
value64, err := unix.SysctlUint64(name)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
if int(value64) != unknown {
|
||||
return int(value64)
|
||||
}
|
||||
}
|
||||
return unknown
|
||||
}
|
||||
|
||||
func setFeature(c *CPUInfo, name string, feature FeatureID) {
|
||||
c.featureSet.setIf(sysctlGetBool(name), feature)
|
||||
}
|
||||
func tryToFillCPUInfoFomSysctl(c *CPUInfo) {
|
||||
c.BrandName = sysctlGetString("machdep.cpu.brand_string")
|
||||
|
||||
if len(c.BrandName) != 0 {
|
||||
c.VendorString = strings.Fields(c.BrandName)[0]
|
||||
}
|
||||
|
||||
c.PhysicalCores = sysctlGetInt(runtime.NumCPU(), "hw.physicalcpu")
|
||||
c.ThreadsPerCore = sysctlGetInt(1, "machdep.cpu.thread_count", "kern.num_threads") /
|
||||
sysctlGetInt(1, "hw.physicalcpu")
|
||||
c.LogicalCores = sysctlGetInt(runtime.NumCPU(), "machdep.cpu.core_count")
|
||||
c.Family = sysctlGetInt(0, "machdep.cpu.family", "hw.cpufamily")
|
||||
c.Model = sysctlGetInt(0, "machdep.cpu.model")
|
||||
c.CacheLine = sysctlGetInt64(0, "hw.cachelinesize")
|
||||
c.Cache.L1I = sysctlGetInt64(-1, "hw.l1icachesize")
|
||||
c.Cache.L1D = sysctlGetInt64(-1, "hw.l1dcachesize")
|
||||
c.Cache.L2 = sysctlGetInt64(-1, "hw.l2cachesize")
|
||||
c.Cache.L3 = sysctlGetInt64(-1, "hw.l3cachesize")
|
||||
|
||||
// from https://developer.arm.com/downloads/-/exploration-tools/feature-names-for-a-profile
|
||||
setFeature(c, "hw.optional.arm.FEAT_AES", AESARM)
|
||||
setFeature(c, "hw.optional.AdvSIMD", ASIMD)
|
||||
setFeature(c, "hw.optional.arm.FEAT_DotProd", ASIMDDP)
|
||||
setFeature(c, "hw.optional.arm.FEAT_RDM", ASIMDRDM)
|
||||
setFeature(c, "hw.optional.FEAT_CRC32", CRC32)
|
||||
setFeature(c, "hw.optional.arm.FEAT_DPB", DCPOP)
|
||||
// setFeature(c, "", EVTSTRM)
|
||||
setFeature(c, "hw.optional.arm.FEAT_FCMA", FCMA)
|
||||
setFeature(c, "hw.optional.arm.FEAT_FP", FP)
|
||||
setFeature(c, "hw.optional.arm.FEAT_FP16", FPHP)
|
||||
setFeature(c, "hw.optional.arm.FEAT_PAuth", GPA)
|
||||
setFeature(c, "hw.optional.arm.FEAT_JSCVT", JSCVT)
|
||||
setFeature(c, "hw.optional.arm.FEAT_LRCPC", LRCPC)
|
||||
setFeature(c, "hw.optional.arm.FEAT_PMULL", PMULL)
|
||||
setFeature(c, "hw.optional.arm.FEAT_SHA1", SHA1)
|
||||
setFeature(c, "hw.optional.arm.FEAT_SHA256", SHA2)
|
||||
setFeature(c, "hw.optional.arm.FEAT_SHA3", SHA3)
|
||||
setFeature(c, "hw.optional.arm.FEAT_SHA512", SHA512)
|
||||
// setFeature(c, "", SM3)
|
||||
// setFeature(c, "", SM4)
|
||||
setFeature(c, "hw.optional.arm.FEAT_SVE", SVE)
|
||||
|
||||
// from empirical observation
|
||||
setFeature(c, "hw.optional.AdvSIMD_HPFPCvt", ASIMDHP)
|
||||
setFeature(c, "hw.optional.armv8_1_atomics", ATOMICS)
|
||||
setFeature(c, "hw.optional.floatingpoint", FP)
|
||||
setFeature(c, "hw.optional.armv8_2_sha3", SHA3)
|
||||
setFeature(c, "hw.optional.armv8_2_sha512", SHA512)
|
||||
setFeature(c, "hw.optional.armv8_3_compnum", FCMA)
|
||||
setFeature(c, "hw.optional.armv8_crc32", CRC32)
|
||||
}
|
130
vendor/github.com/klauspost/cpuid/v2/os_linux_arm64.go
generated
vendored
130
vendor/github.com/klauspost/cpuid/v2/os_linux_arm64.go
generated
vendored
@@ -1,130 +0,0 @@
|
||||
// Copyright (c) 2020 Klaus Post, released under MIT License. See LICENSE file.
|
||||
|
||||
// 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 located
|
||||
// here https://github.com/golang/sys/blob/master/LICENSE
|
||||
|
||||
package cpuid
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"io/ioutil"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
// HWCAP bits.
|
||||
const (
|
||||
hwcap_FP = 1 << 0
|
||||
hwcap_ASIMD = 1 << 1
|
||||
hwcap_EVTSTRM = 1 << 2
|
||||
hwcap_AES = 1 << 3
|
||||
hwcap_PMULL = 1 << 4
|
||||
hwcap_SHA1 = 1 << 5
|
||||
hwcap_SHA2 = 1 << 6
|
||||
hwcap_CRC32 = 1 << 7
|
||||
hwcap_ATOMICS = 1 << 8
|
||||
hwcap_FPHP = 1 << 9
|
||||
hwcap_ASIMDHP = 1 << 10
|
||||
hwcap_CPUID = 1 << 11
|
||||
hwcap_ASIMDRDM = 1 << 12
|
||||
hwcap_JSCVT = 1 << 13
|
||||
hwcap_FCMA = 1 << 14
|
||||
hwcap_LRCPC = 1 << 15
|
||||
hwcap_DCPOP = 1 << 16
|
||||
hwcap_SHA3 = 1 << 17
|
||||
hwcap_SM3 = 1 << 18
|
||||
hwcap_SM4 = 1 << 19
|
||||
hwcap_ASIMDDP = 1 << 20
|
||||
hwcap_SHA512 = 1 << 21
|
||||
hwcap_SVE = 1 << 22
|
||||
hwcap_ASIMDFHM = 1 << 23
|
||||
)
|
||||
|
||||
func detectOS(c *CPUInfo) bool {
|
||||
// For now assuming no hyperthreading is reasonable.
|
||||
c.LogicalCores = runtime.NumCPU()
|
||||
c.PhysicalCores = c.LogicalCores
|
||||
c.ThreadsPerCore = 1
|
||||
if hwcap == 0 {
|
||||
// We did not get values from the runtime.
|
||||
// Try reading /proc/self/auxv
|
||||
|
||||
// From https://github.com/golang/sys
|
||||
const (
|
||||
_AT_HWCAP = 16
|
||||
_AT_HWCAP2 = 26
|
||||
|
||||
uintSize = int(32 << (^uint(0) >> 63))
|
||||
)
|
||||
|
||||
buf, err := ioutil.ReadFile("/proc/self/auxv")
|
||||
if err != nil {
|
||||
// e.g. on android /proc/self/auxv is not accessible, so silently
|
||||
// ignore the error and leave Initialized = false. On some
|
||||
// architectures (e.g. arm64) doinit() implements a fallback
|
||||
// readout and will set Initialized = true again.
|
||||
return false
|
||||
}
|
||||
bo := binary.LittleEndian
|
||||
for len(buf) >= 2*(uintSize/8) {
|
||||
var tag, val uint
|
||||
switch uintSize {
|
||||
case 32:
|
||||
tag = uint(bo.Uint32(buf[0:]))
|
||||
val = uint(bo.Uint32(buf[4:]))
|
||||
buf = buf[8:]
|
||||
case 64:
|
||||
tag = uint(bo.Uint64(buf[0:]))
|
||||
val = uint(bo.Uint64(buf[8:]))
|
||||
buf = buf[16:]
|
||||
}
|
||||
switch tag {
|
||||
case _AT_HWCAP:
|
||||
hwcap = val
|
||||
case _AT_HWCAP2:
|
||||
// Not used
|
||||
}
|
||||
}
|
||||
if hwcap == 0 {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// HWCap was populated by the runtime from the auxiliary vector.
|
||||
// Use HWCap information since reading aarch64 system registers
|
||||
// is not supported in user space on older linux kernels.
|
||||
c.featureSet.setIf(isSet(hwcap, hwcap_AES), AESARM)
|
||||
c.featureSet.setIf(isSet(hwcap, hwcap_ASIMD), ASIMD)
|
||||
c.featureSet.setIf(isSet(hwcap, hwcap_ASIMDDP), ASIMDDP)
|
||||
c.featureSet.setIf(isSet(hwcap, hwcap_ASIMDHP), ASIMDHP)
|
||||
c.featureSet.setIf(isSet(hwcap, hwcap_ASIMDRDM), ASIMDRDM)
|
||||
c.featureSet.setIf(isSet(hwcap, hwcap_CPUID), ARMCPUID)
|
||||
c.featureSet.setIf(isSet(hwcap, hwcap_CRC32), CRC32)
|
||||
c.featureSet.setIf(isSet(hwcap, hwcap_DCPOP), DCPOP)
|
||||
c.featureSet.setIf(isSet(hwcap, hwcap_EVTSTRM), EVTSTRM)
|
||||
c.featureSet.setIf(isSet(hwcap, hwcap_FCMA), FCMA)
|
||||
c.featureSet.setIf(isSet(hwcap, hwcap_FP), FP)
|
||||
c.featureSet.setIf(isSet(hwcap, hwcap_FPHP), FPHP)
|
||||
c.featureSet.setIf(isSet(hwcap, hwcap_JSCVT), JSCVT)
|
||||
c.featureSet.setIf(isSet(hwcap, hwcap_LRCPC), LRCPC)
|
||||
c.featureSet.setIf(isSet(hwcap, hwcap_PMULL), PMULL)
|
||||
c.featureSet.setIf(isSet(hwcap, hwcap_SHA1), SHA1)
|
||||
c.featureSet.setIf(isSet(hwcap, hwcap_SHA2), SHA2)
|
||||
c.featureSet.setIf(isSet(hwcap, hwcap_SHA3), SHA3)
|
||||
c.featureSet.setIf(isSet(hwcap, hwcap_SHA512), SHA512)
|
||||
c.featureSet.setIf(isSet(hwcap, hwcap_SM3), SM3)
|
||||
c.featureSet.setIf(isSet(hwcap, hwcap_SM4), SM4)
|
||||
c.featureSet.setIf(isSet(hwcap, hwcap_SVE), SVE)
|
||||
|
||||
// The Samsung S9+ kernel reports support for atomics, but not all cores
|
||||
// actually support them, resulting in SIGILL. See issue #28431.
|
||||
// TODO(elias.naur): Only disable the optimization on bad chipsets on android.
|
||||
c.featureSet.setIf(isSet(hwcap, hwcap_ATOMICS) && runtime.GOOS != "android", ATOMICS)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func isSet(hwc uint, value uint) bool {
|
||||
return hwc&value != 0
|
||||
}
|
16
vendor/github.com/klauspost/cpuid/v2/os_other_arm64.go
generated
vendored
16
vendor/github.com/klauspost/cpuid/v2/os_other_arm64.go
generated
vendored
@@ -1,16 +0,0 @@
|
||||
// Copyright (c) 2020 Klaus Post, released under MIT License. See LICENSE file.
|
||||
|
||||
//go:build arm64 && !linux && !darwin
|
||||
// +build arm64,!linux,!darwin
|
||||
|
||||
package cpuid
|
||||
|
||||
import "runtime"
|
||||
|
||||
func detectOS(c *CPUInfo) bool {
|
||||
c.PhysicalCores = runtime.NumCPU()
|
||||
// For now assuming 1 thread per core...
|
||||
c.ThreadsPerCore = 1
|
||||
c.LogicalCores = c.PhysicalCores
|
||||
return false
|
||||
}
|
8
vendor/github.com/klauspost/cpuid/v2/os_safe_linux_arm64.go
generated
vendored
8
vendor/github.com/klauspost/cpuid/v2/os_safe_linux_arm64.go
generated
vendored
@@ -1,8 +0,0 @@
|
||||
// Copyright (c) 2021 Klaus Post, released under MIT License. See LICENSE file.
|
||||
|
||||
//go:build nounsafe
|
||||
// +build nounsafe
|
||||
|
||||
package cpuid
|
||||
|
||||
var hwcap uint
|
11
vendor/github.com/klauspost/cpuid/v2/os_unsafe_linux_arm64.go
generated
vendored
11
vendor/github.com/klauspost/cpuid/v2/os_unsafe_linux_arm64.go
generated
vendored
@@ -1,11 +0,0 @@
|
||||
// Copyright (c) 2021 Klaus Post, released under MIT License. See LICENSE file.
|
||||
|
||||
//go:build !nounsafe
|
||||
// +build !nounsafe
|
||||
|
||||
package cpuid
|
||||
|
||||
import _ "unsafe" // needed for go:linkname
|
||||
|
||||
//go:linkname hwcap internal/cpu.HWCap
|
||||
var hwcap uint
|
15
vendor/github.com/klauspost/cpuid/v2/test-architectures.sh
generated
vendored
15
vendor/github.com/klauspost/cpuid/v2/test-architectures.sh
generated
vendored
@@ -1,15 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
go tool dist list | while IFS=/ read os arch; do
|
||||
echo "Checking $os/$arch..."
|
||||
echo " normal"
|
||||
GOARCH=$arch GOOS=$os go build -o /dev/null .
|
||||
echo " noasm"
|
||||
GOARCH=$arch GOOS=$os go build -tags noasm -o /dev/null .
|
||||
echo " appengine"
|
||||
GOARCH=$arch GOOS=$os go build -tags appengine -o /dev/null .
|
||||
echo " noasm,appengine"
|
||||
GOARCH=$arch GOOS=$os go build -tags 'appengine noasm' -o /dev/null .
|
||||
done
|
12
vendor/github.com/lufia/plan9stats/.gitignore
generated
vendored
Normal file
12
vendor/github.com/lufia/plan9stats/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# Binaries for programs and plugins
|
||||
*.exe
|
||||
*.exe~
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
|
||||
# Test binary, build with `go test -c`
|
||||
*.test
|
||||
|
||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||
*.out
|
29
vendor/github.com/lufia/plan9stats/LICENSE
generated
vendored
Normal file
29
vendor/github.com/lufia/plan9stats/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2019, KADOTA, Kyohei
|
||||
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.
|
2
vendor/github.com/lufia/plan9stats/README.md
generated
vendored
Normal file
2
vendor/github.com/lufia/plan9stats/README.md
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# plan9stats
|
||||
A module for retrieving statistics of Plan 9
|
288
vendor/github.com/lufia/plan9stats/cpu.go
generated
vendored
Normal file
288
vendor/github.com/lufia/plan9stats/cpu.go
generated
vendored
Normal file
@@ -0,0 +1,288 @@
|
||||
package stats
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// CPUType represents /dev/cputype.
|
||||
type CPUType struct {
|
||||
Name string
|
||||
Clock int // clock rate in MHz
|
||||
}
|
||||
|
||||
func ReadCPUType(ctx context.Context, opts ...Option) (*CPUType, error) {
|
||||
cfg := newConfig(opts...)
|
||||
var c CPUType
|
||||
if err := readCPUType(cfg.rootdir, &c); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &c, nil
|
||||
}
|
||||
|
||||
type SysStats struct {
|
||||
ID int
|
||||
NumCtxSwitch int64
|
||||
NumInterrupt int64
|
||||
NumSyscall int64
|
||||
NumFault int64
|
||||
NumTLBFault int64
|
||||
NumTLBPurge int64
|
||||
LoadAvg int64 // in units of milli-CPUs and is decayed over time
|
||||
Idle int // percentage
|
||||
Interrupt int // percentage
|
||||
}
|
||||
|
||||
// ReadSysStats reads system statistics from /dev/sysstat.
|
||||
func ReadSysStats(ctx context.Context, opts ...Option) ([]*SysStats, error) {
|
||||
cfg := newConfig(opts...)
|
||||
file := filepath.Join(cfg.rootdir, "/dev/sysstat")
|
||||
f, err := os.Open(file)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
scanner := bufio.NewScanner(f)
|
||||
var stats []*SysStats
|
||||
for scanner.Scan() {
|
||||
a := strings.Fields(scanner.Text())
|
||||
if len(a) != 10 {
|
||||
continue
|
||||
}
|
||||
var (
|
||||
p intParser
|
||||
stat SysStats
|
||||
)
|
||||
stat.ID = p.ParseInt(a[0], 10)
|
||||
stat.NumCtxSwitch = p.ParseInt64(a[1], 10)
|
||||
stat.NumInterrupt = p.ParseInt64(a[2], 10)
|
||||
stat.NumSyscall = p.ParseInt64(a[3], 10)
|
||||
stat.NumFault = p.ParseInt64(a[4], 10)
|
||||
stat.NumTLBFault = p.ParseInt64(a[5], 10)
|
||||
stat.NumTLBPurge = p.ParseInt64(a[6], 10)
|
||||
stat.LoadAvg = p.ParseInt64(a[7], 10)
|
||||
stat.Idle = p.ParseInt(a[8], 10)
|
||||
stat.Interrupt = p.ParseInt(a[9], 10)
|
||||
if err := p.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
stats = append(stats, &stat)
|
||||
}
|
||||
if err := scanner.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return stats, nil
|
||||
}
|
||||
|
||||
func readCPUType(rootdir string, c *CPUType) error {
|
||||
file := filepath.Join(rootdir, "/dev/cputype")
|
||||
b, err := ioutil.ReadFile(file)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
b = bytes.TrimSpace(b)
|
||||
i := bytes.LastIndexByte(b, ' ')
|
||||
if i < 0 {
|
||||
return fmt.Errorf("%s: invalid format", file)
|
||||
}
|
||||
clock, err := strconv.Atoi(string(b[i+1:]))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
c.Name = string(b[:i])
|
||||
c.Clock = clock
|
||||
return nil
|
||||
}
|
||||
|
||||
// Time represents /dev/time.
|
||||
type Time struct {
|
||||
Unix time.Duration
|
||||
UnixNano time.Duration
|
||||
Ticks int64 // clock ticks
|
||||
Freq int64 //cloc frequency
|
||||
}
|
||||
|
||||
// Uptime returns uptime.
|
||||
func (t *Time) Uptime() time.Duration {
|
||||
v := float64(t.Ticks) / float64(t.Freq)
|
||||
return time.Duration(v*1000_000_000) * time.Nanosecond
|
||||
}
|
||||
|
||||
func ReadTime(ctx context.Context, opts ...Option) (*Time, error) {
|
||||
cfg := newConfig(opts...)
|
||||
file := filepath.Join(cfg.rootdir, "/dev/time")
|
||||
var t Time
|
||||
if err := readTime(file, &t); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &t, nil
|
||||
}
|
||||
|
||||
// ProcStatus represents a /proc/n/status.
|
||||
type ProcStatus struct {
|
||||
Name string
|
||||
User string
|
||||
State string
|
||||
Times CPUTime
|
||||
MemUsed int64 // in units of 1024 bytes
|
||||
BasePriority uint32 // 0(low) to 19(high)
|
||||
Priority uint32 // 0(low) to 19(high)
|
||||
}
|
||||
|
||||
// CPUTime represents /dev/cputime or a part of /proc/n/status.
|
||||
type CPUTime struct {
|
||||
User time.Duration // the time in user mode (millisecconds)
|
||||
Sys time.Duration
|
||||
Real time.Duration
|
||||
ChildUser time.Duration // exited children and descendants time in user mode
|
||||
ChildSys time.Duration
|
||||
ChildReal time.Duration
|
||||
}
|
||||
|
||||
// CPUStats emulates Linux's /proc/stat.
|
||||
type CPUStats struct {
|
||||
User time.Duration
|
||||
Sys time.Duration
|
||||
Idle time.Duration
|
||||
}
|
||||
|
||||
func ReadCPUStats(ctx context.Context, opts ...Option) (*CPUStats, error) {
|
||||
cfg := newConfig(opts...)
|
||||
a, err := ReadSysStats(ctx, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
dir := filepath.Join(cfg.rootdir, "/proc")
|
||||
d, err := os.Open(dir)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer d.Close()
|
||||
|
||||
names, err := d.Readdirnames(0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var up uint32parser
|
||||
pids := make([]uint32, len(names))
|
||||
for i, s := range names {
|
||||
pids[i] = up.Parse(s)
|
||||
}
|
||||
if up.err != nil {
|
||||
return nil, err
|
||||
}
|
||||
sort.Slice(pids, func(i, j int) bool {
|
||||
return pids[i] < pids[j]
|
||||
})
|
||||
|
||||
var stat CPUStats
|
||||
for _, pid := range pids {
|
||||
s := strconv.FormatUint(uint64(pid), 10)
|
||||
file := filepath.Join(dir, s, "status")
|
||||
var p ProcStatus
|
||||
if err := readProcStatus(file, &p); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
stat.User += p.Times.User
|
||||
stat.Sys += p.Times.Sys
|
||||
}
|
||||
|
||||
var t Time
|
||||
file := filepath.Join(cfg.rootdir, "/dev/time")
|
||||
if err := readTime(file, &t); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// In multi-processor host, Idle should multiple by number of cores.
|
||||
u := t.Uptime() * time.Duration(len(a))
|
||||
stat.Idle = u - stat.User - stat.Sys
|
||||
return &stat, nil
|
||||
}
|
||||
|
||||
func readProcStatus(file string, p *ProcStatus) error {
|
||||
b, err := ioutil.ReadFile(file)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
fields := strings.Fields(string(b))
|
||||
if len(fields) != 12 {
|
||||
return errors.New("invalid format")
|
||||
}
|
||||
p.Name = string(fields[0])
|
||||
p.User = string(fields[1])
|
||||
p.State = string(fields[2])
|
||||
var up uint32parser
|
||||
p.Times.User = time.Duration(up.Parse(fields[3])) * time.Millisecond
|
||||
p.Times.Sys = time.Duration(up.Parse(fields[4])) * time.Millisecond
|
||||
p.Times.Real = time.Duration(up.Parse(fields[5])) * time.Millisecond
|
||||
p.Times.ChildUser = time.Duration(up.Parse(fields[6])) * time.Millisecond
|
||||
p.Times.ChildSys = time.Duration(up.Parse(fields[7])) * time.Millisecond
|
||||
p.Times.ChildReal = time.Duration(up.Parse(fields[8])) * time.Millisecond
|
||||
p.MemUsed, err = strconv.ParseInt(fields[9], 10, 64)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
p.BasePriority = up.Parse(fields[10])
|
||||
p.Priority = up.Parse(fields[11])
|
||||
return up.err
|
||||
}
|
||||
|
||||
func readTime(file string, t *Time) error {
|
||||
b, err := ioutil.ReadFile(file)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fields := strings.Fields(string(b))
|
||||
if len(fields) != 4 {
|
||||
return errors.New("invalid format")
|
||||
}
|
||||
n, err := strconv.ParseInt(fields[0], 10, 32)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.Unix = time.Duration(n) * time.Second
|
||||
v, err := strconv.ParseInt(fields[1], 10, 64)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.UnixNano = time.Duration(v) * time.Nanosecond
|
||||
t.Ticks, err = strconv.ParseInt(fields[2], 10, 64)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.Freq, err = strconv.ParseInt(fields[3], 10, 64)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type uint32parser struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func (p *uint32parser) Parse(s string) uint32 {
|
||||
if p.err != nil {
|
||||
return 0
|
||||
}
|
||||
n, err := strconv.ParseUint(s, 10, 32)
|
||||
if err != nil {
|
||||
p.err = err
|
||||
return 0
|
||||
}
|
||||
return uint32(n)
|
||||
}
|
2
vendor/github.com/lufia/plan9stats/doc.go
generated
vendored
Normal file
2
vendor/github.com/lufia/plan9stats/doc.go
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
// Package stats provides statistic utilities for Plan 9.
|
||||
package stats
|
303
vendor/github.com/lufia/plan9stats/host.go
generated
vendored
Normal file
303
vendor/github.com/lufia/plan9stats/host.go
generated
vendored
Normal file
@@ -0,0 +1,303 @@
|
||||
package stats
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var (
|
||||
delim = []byte{' '}
|
||||
)
|
||||
|
||||
// Host represents host status.
|
||||
type Host struct {
|
||||
Sysname string
|
||||
Storages []*Storage
|
||||
Interfaces []*Interface
|
||||
}
|
||||
|
||||
// MemStats represents the memory statistics.
|
||||
type MemStats struct {
|
||||
Total int64 // total memory in byte
|
||||
PageSize int64 // a page size in byte
|
||||
KernelPages int64
|
||||
UserPages Gauge
|
||||
SwapPages Gauge
|
||||
|
||||
Malloced Gauge // kernel malloced data in byte
|
||||
Graphics Gauge // kernel graphics data in byte
|
||||
}
|
||||
|
||||
// Gauge is used/available gauge.
|
||||
type Gauge struct {
|
||||
Used int64
|
||||
Avail int64
|
||||
}
|
||||
|
||||
func (g Gauge) Free() int64 {
|
||||
return g.Avail - g.Used
|
||||
}
|
||||
|
||||
// ReadMemStats reads memory statistics from /dev/swap.
|
||||
func ReadMemStats(ctx context.Context, opts ...Option) (*MemStats, error) {
|
||||
cfg := newConfig(opts...)
|
||||
swap := filepath.Join(cfg.rootdir, "/dev/swap")
|
||||
f, err := os.Open(swap)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
var stat MemStats
|
||||
m := map[string]interface{}{
|
||||
"memory": &stat.Total,
|
||||
"pagesize": &stat.PageSize,
|
||||
"kernel": &stat.KernelPages,
|
||||
"user": &stat.UserPages,
|
||||
"swap": &stat.SwapPages,
|
||||
"kernel malloc": &stat.Malloced,
|
||||
"kernel draw": &stat.Graphics,
|
||||
}
|
||||
scanner := bufio.NewScanner(f)
|
||||
for scanner.Scan() {
|
||||
fields := bytes.SplitN(scanner.Bytes(), delim, 2)
|
||||
if len(fields) < 2 {
|
||||
continue
|
||||
}
|
||||
switch key := string(fields[1]); key {
|
||||
case "memory", "pagesize", "kernel":
|
||||
v := m[key].(*int64)
|
||||
n, err := strconv.ParseInt(string(fields[0]), 10, 64)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
*v = n
|
||||
case "user", "swap", "kernel malloc", "kernel draw":
|
||||
v := m[key].(*Gauge)
|
||||
if err := parseGauge(string(fields[0]), v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
if err := scanner.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &stat, nil
|
||||
}
|
||||
|
||||
func parseGauge(s string, r *Gauge) error {
|
||||
a := strings.SplitN(s, "/", 2)
|
||||
if len(a) != 2 {
|
||||
return fmt.Errorf("can't parse ratio: %s", s)
|
||||
}
|
||||
var p intParser
|
||||
u := p.ParseInt64(a[0], 10)
|
||||
n := p.ParseInt64(a[1], 10)
|
||||
if err := p.Err(); err != nil {
|
||||
return err
|
||||
}
|
||||
r.Used = u
|
||||
r.Avail = n
|
||||
return nil
|
||||
}
|
||||
|
||||
type Storage struct {
|
||||
Name string
|
||||
Model string
|
||||
Capacity int64
|
||||
}
|
||||
|
||||
type Interface struct {
|
||||
Name string
|
||||
Addr string
|
||||
}
|
||||
|
||||
const (
|
||||
numEther = 8 // see ether(3)
|
||||
numIpifc = 16 // see ip(3)
|
||||
)
|
||||
|
||||
// ReadInterfaces reads network interfaces from etherN.
|
||||
func ReadInterfaces(ctx context.Context, opts ...Option) ([]*Interface, error) {
|
||||
cfg := newConfig(opts...)
|
||||
var a []*Interface
|
||||
for i := 0; i < numEther; i++ {
|
||||
p, err := readInterface(cfg.rootdir, i)
|
||||
if os.IsNotExist(err) {
|
||||
continue
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
a = append(a, p)
|
||||
}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
func readInterface(netroot string, i int) (*Interface, error) {
|
||||
ether := fmt.Sprintf("ether%d", i)
|
||||
dir := filepath.Join(netroot, ether)
|
||||
info, err := os.Stat(dir)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !info.IsDir() {
|
||||
return nil, fmt.Errorf("%s: is not directory", dir)
|
||||
}
|
||||
|
||||
addr, err := ioutil.ReadFile(filepath.Join(dir, "addr"))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Interface{
|
||||
Name: ether,
|
||||
Addr: string(addr),
|
||||
}, nil
|
||||
}
|
||||
|
||||
var (
|
||||
netdirs = []string{"/net", "/net.alt"}
|
||||
)
|
||||
|
||||
// ReadHost reads host status.
|
||||
func ReadHost(ctx context.Context, opts ...Option) (*Host, error) {
|
||||
cfg := newConfig(opts...)
|
||||
var h Host
|
||||
name, err := readSysname(cfg.rootdir)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
h.Sysname = name
|
||||
|
||||
a, err := readStorages(cfg.rootdir)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
h.Storages = a
|
||||
|
||||
for _, s := range netdirs {
|
||||
netroot := filepath.Join(cfg.rootdir, s)
|
||||
ifaces, err := ReadInterfaces(ctx, WithRootDir(netroot))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
h.Interfaces = append(h.Interfaces, ifaces...)
|
||||
}
|
||||
return &h, nil
|
||||
}
|
||||
|
||||
func readSysname(rootdir string) (string, error) {
|
||||
file := filepath.Join(rootdir, "/dev/sysname")
|
||||
b, err := ioutil.ReadFile(file)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(bytes.TrimSpace(b)), nil
|
||||
}
|
||||
|
||||
func readStorages(rootdir string) ([]*Storage, error) {
|
||||
sdctl := filepath.Join(rootdir, "/dev/sdctl")
|
||||
f, err := os.Open(sdctl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
var a []*Storage
|
||||
scanner := bufio.NewScanner(f)
|
||||
for scanner.Scan() {
|
||||
fields := bytes.Split(scanner.Bytes(), delim)
|
||||
if len(fields) == 0 {
|
||||
continue
|
||||
}
|
||||
exp := string(fields[0]) + "*"
|
||||
if !strings.HasPrefix(exp, "sd") {
|
||||
continue
|
||||
}
|
||||
dir := filepath.Join(rootdir, "/dev", exp)
|
||||
m, err := filepath.Glob(dir)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, dir := range m {
|
||||
s, err := readStorage(dir)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
a = append(a, s)
|
||||
}
|
||||
}
|
||||
if err := scanner.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
func readStorage(dir string) (*Storage, error) {
|
||||
ctl := filepath.Join(dir, "ctl")
|
||||
f, err := os.Open(ctl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
var s Storage
|
||||
s.Name = filepath.Base(dir)
|
||||
scanner := bufio.NewScanner(f)
|
||||
for scanner.Scan() {
|
||||
line := scanner.Bytes()
|
||||
switch {
|
||||
case bytes.HasPrefix(line, []byte("inquiry")):
|
||||
s.Model = string(bytes.TrimSpace(line[7:]))
|
||||
case bytes.HasPrefix(line, []byte("geometry")):
|
||||
fields := bytes.Split(line, delim)
|
||||
if len(fields) < 3 {
|
||||
continue
|
||||
}
|
||||
var p intParser
|
||||
sec := p.ParseInt64(string(fields[1]), 10)
|
||||
size := p.ParseInt64(string(fields[2]), 10)
|
||||
if err := p.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
s.Capacity = sec * size
|
||||
}
|
||||
}
|
||||
if err := scanner.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &s, nil
|
||||
}
|
||||
|
||||
type IPStats struct {
|
||||
ID int // number of interface in ipifc dir
|
||||
Device string // associated physical device
|
||||
MTU int // max transfer unit
|
||||
Sendra6 uint8 // on == send router adv
|
||||
Recvra6 uint8 // on == recv router adv
|
||||
|
||||
Pktin int64 // packets read
|
||||
Pktout int64 // packets written
|
||||
Errin int64 // read errors
|
||||
Errout int64 // write errors
|
||||
}
|
||||
|
||||
type Iplifc struct {
|
||||
IP net.IP
|
||||
Mask net.IPMask
|
||||
Net net.IP // ip & mask
|
||||
PerfLifetime int64 // preferred lifetime
|
||||
ValidLifetime int64 // valid lifetime
|
||||
}
|
||||
|
||||
type Ipv6rp struct {
|
||||
// TODO(lufia): see ip(2)
|
||||
}
|
31
vendor/github.com/lufia/plan9stats/int.go
generated
vendored
Normal file
31
vendor/github.com/lufia/plan9stats/int.go
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
package stats
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type intParser struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func (p *intParser) ParseInt(s string, base int) int {
|
||||
if p.err != nil {
|
||||
return 0
|
||||
}
|
||||
var n int64
|
||||
n, p.err = strconv.ParseInt(s, base, 0)
|
||||
return int(n)
|
||||
}
|
||||
|
||||
func (p *intParser) ParseInt64(s string, base int) int64 {
|
||||
if p.err != nil {
|
||||
return 0
|
||||
}
|
||||
var n int64
|
||||
n, p.err = strconv.ParseInt(s, base, 64)
|
||||
return n
|
||||
}
|
||||
|
||||
func (p *intParser) Err() error {
|
||||
return p.err
|
||||
}
|
21
vendor/github.com/lufia/plan9stats/opts.go
generated
vendored
Normal file
21
vendor/github.com/lufia/plan9stats/opts.go
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
package stats
|
||||
|
||||
type Config struct {
|
||||
rootdir string
|
||||
}
|
||||
|
||||
type Option func(*Config)
|
||||
|
||||
func newConfig(opts ...Option) *Config {
|
||||
var cfg Config
|
||||
for _, opt := range opts {
|
||||
opt(&cfg)
|
||||
}
|
||||
return &cfg
|
||||
}
|
||||
|
||||
func WithRootDir(dir string) Option {
|
||||
return func(cfg *Config) {
|
||||
cfg.rootdir = dir
|
||||
}
|
||||
}
|
88
vendor/github.com/lufia/plan9stats/stats.go
generated
vendored
Normal file
88
vendor/github.com/lufia/plan9stats/stats.go
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
package stats
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"context"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type InterfaceStats struct {
|
||||
PacketsReceived int64 // in packets
|
||||
Link int // link status
|
||||
PacketsSent int64 // out packets
|
||||
NumCRCErr int // input CRC errors
|
||||
NumOverflows int // packet overflows
|
||||
NumSoftOverflows int // software overflow
|
||||
NumFramingErr int // framing errors
|
||||
NumBufferingErr int // buffering errors
|
||||
NumOutputErr int // output errors
|
||||
Promiscuous int // number of promiscuous opens
|
||||
Mbps int // megabits per sec
|
||||
Addr string
|
||||
}
|
||||
|
||||
func ReadInterfaceStats(ctx context.Context, opts ...Option) (*InterfaceStats, error) {
|
||||
cfg := newConfig(opts...)
|
||||
file := filepath.Join(cfg.rootdir, "stats")
|
||||
f, err := os.Open(file)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
var stats InterfaceStats
|
||||
scanner := bufio.NewScanner(f)
|
||||
for scanner.Scan() {
|
||||
s := strings.TrimSpace(scanner.Text())
|
||||
a := strings.SplitN(s, ":", 2)
|
||||
if len(a) != 2 {
|
||||
continue
|
||||
}
|
||||
var p intParser
|
||||
v := strings.TrimSpace(a[1])
|
||||
switch a[0] {
|
||||
case "in":
|
||||
stats.PacketsReceived = p.ParseInt64(v, 10)
|
||||
case "link":
|
||||
stats.Link = p.ParseInt(v, 10)
|
||||
case "out":
|
||||
stats.PacketsSent = p.ParseInt64(v, 10)
|
||||
case "crc":
|
||||
stats.NumCRCErr = p.ParseInt(v, 10)
|
||||
case "overflows":
|
||||
stats.NumOverflows = p.ParseInt(v, 10)
|
||||
case "soft overflows":
|
||||
stats.NumSoftOverflows = p.ParseInt(v, 10)
|
||||
case "framing errs":
|
||||
stats.NumFramingErr = p.ParseInt(v, 10)
|
||||
case "buffer errs":
|
||||
stats.NumBufferingErr = p.ParseInt(v, 10)
|
||||
case "output errs":
|
||||
stats.NumOutputErr = p.ParseInt(v, 10)
|
||||
case "prom":
|
||||
stats.Promiscuous = p.ParseInt(v, 10)
|
||||
case "mbps":
|
||||
stats.Mbps = p.ParseInt(v, 10)
|
||||
case "addr":
|
||||
stats.Addr = v
|
||||
}
|
||||
if err := p.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if err := scanner.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &stats, nil
|
||||
}
|
||||
|
||||
type TCPStats struct {
|
||||
MaxConn int
|
||||
MaxSegment int
|
||||
ActiveOpens int
|
||||
PassiveOpens int
|
||||
EstablishedResets int
|
||||
CurrentEstablished int
|
||||
}
|
1
vendor/github.com/minio/sha256-simd/.gitignore
generated
vendored
1
vendor/github.com/minio/sha256-simd/.gitignore
generated
vendored
@@ -1 +0,0 @@
|
||||
*.test
|
202
vendor/github.com/minio/sha256-simd/LICENSE
generated
vendored
202
vendor/github.com/minio/sha256-simd/LICENSE
generated
vendored
@@ -1,202 +0,0 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
137
vendor/github.com/minio/sha256-simd/README.md
generated
vendored
137
vendor/github.com/minio/sha256-simd/README.md
generated
vendored
@@ -1,137 +0,0 @@
|
||||
# sha256-simd
|
||||
|
||||
Accelerate SHA256 computations in pure Go using AVX512, SHA Extensions for x86 and ARM64 for ARM.
|
||||
On AVX512 it provides an up to 8x improvement (over 3 GB/s per core).
|
||||
SHA Extensions give a performance boost of close to 4x over native.
|
||||
|
||||
## Introduction
|
||||
|
||||
This package is designed as a replacement for `crypto/sha256`.
|
||||
For ARM CPUs with the Cryptography Extensions, advantage is taken of the SHA2 instructions resulting in a massive performance improvement.
|
||||
|
||||
This package uses Golang assembly.
|
||||
The AVX512 version is based on the Intel's "multi-buffer crypto library for IPSec" whereas the other Intel implementations are described in "Fast SHA-256 Implementations on Intel Architecture Processors" by J. Guilford et al.
|
||||
|
||||
## Support for Intel SHA Extensions
|
||||
|
||||
Support for the Intel SHA Extensions has been added by Kristofer Peterson (@svenski123), originally developed for spacemeshos [here](https://github.com/spacemeshos/POET/issues/23). On CPUs that support it (known thus far Intel Celeron J3455 and AMD Ryzen) it gives a significant boost in performance (with thanks to @AudriusButkevicius for reporting the results; full results [here](https://github.com/minio/sha256-simd/pull/37#issuecomment-451607827)).
|
||||
|
||||
```
|
||||
$ benchcmp avx2.txt sha-ext.txt
|
||||
benchmark AVX2 MB/s SHA Ext MB/s speedup
|
||||
BenchmarkHash5M 514.40 1975.17 3.84x
|
||||
```
|
||||
|
||||
Thanks to Kristofer Peterson, we also added additional performance changes such as optimized padding,
|
||||
endian conversions which sped up all implementations i.e. Intel SHA alone while doubled performance for small sizes,
|
||||
the other changes increased everything roughly 50%.
|
||||
|
||||
## Support for AVX512
|
||||
|
||||
We have added support for AVX512 which results in an up to 8x performance improvement over AVX2 (3.0 GHz Xeon Platinum 8124M CPU):
|
||||
|
||||
```
|
||||
$ benchcmp avx2.txt avx512.txt
|
||||
benchmark AVX2 MB/s AVX512 MB/s speedup
|
||||
BenchmarkHash5M 448.62 3498.20 7.80x
|
||||
```
|
||||
|
||||
The original code was developed by Intel as part of the [multi-buffer crypto library](https://github.com/intel/intel-ipsec-mb) for IPSec or more specifically this [AVX512](https://github.com/intel/intel-ipsec-mb/blob/master/avx512/sha256_x16_avx512.asm) implementation. The key idea behind it is to process a total of 16 checksums in parallel by “transposing” 16 (independent) messages of 64 bytes between a total of 16 ZMM registers (each 64 bytes wide).
|
||||
|
||||
Transposing the input messages means that in order to take full advantage of the speedup you need to have a (server) workload where multiple threads are doing SHA256 calculations in parallel. Unfortunately for this algorithm it is not possible for two message blocks processed in parallel to be dependent on one another — because then the (interim) result of the first part of the message has to be an input into the processing of the second part of the message.
|
||||
|
||||
Whereas the original Intel C implementation requires some sort of explicit scheduling of messages to be processed in parallel, for Golang it makes sense to take advantage of channels in order to group messages together and use channels as well for sending back the results (thereby effectively decoupling the calculations). We have implemented a fairly simple scheduling mechanism that seems to work well in practice.
|
||||
|
||||
Due to this different way of scheduling, we decided to use an explicit method to instantiate the AVX512 version. Essentially one or more AVX512 processing servers ([`Avx512Server`](https://github.com/minio/sha256-simd/blob/master/sha256blockAvx512_amd64.go#L294)) have to be created whereby each server can hash over 3 GB/s on a single core. An `hash.Hash` object ([`Avx512Digest`](https://github.com/minio/sha256-simd/blob/master/sha256blockAvx512_amd64.go#L45)) is then instantiated using one of these servers and used in the regular fashion:
|
||||
|
||||
```go
|
||||
import "github.com/minio/sha256-simd"
|
||||
|
||||
func main() {
|
||||
server := sha256.NewAvx512Server()
|
||||
h512 := sha256.NewAvx512(server)
|
||||
h512.Write(fileBlock)
|
||||
digest := h512.Sum([]byte{})
|
||||
}
|
||||
```
|
||||
|
||||
Note that, because of the scheduling overhead, for small messages (< 1 MB) you will be better off using the regular SHA256 hashing (but those are typically not performance critical anyway). Some other tips to get the best performance:
|
||||
* Have many go routines doing SHA256 calculations in parallel.
|
||||
* Try to Write() messages in multiples of 64 bytes.
|
||||
* Try to keep the overall length of messages to a roughly similar size ie. 5 MB (this way all 16 ‘lanes’ in the AVX512 computations are contributing as much as possible).
|
||||
|
||||
More detailed information can be found in this [blog](https://blog.minio.io/accelerate-sha256-up-to-8x-over-3-gb-s-per-core-with-avx512-a0b1d64f78f) post including scaling across cores.
|
||||
|
||||
## Drop-In Replacement
|
||||
|
||||
The following code snippet shows how you can use `github.com/minio/sha256-simd`.
|
||||
This will automatically select the fastest method for the architecture on which it will be executed.
|
||||
|
||||
```go
|
||||
import "github.com/minio/sha256-simd"
|
||||
|
||||
func main() {
|
||||
...
|
||||
shaWriter := sha256.New()
|
||||
io.Copy(shaWriter, file)
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
## Performance
|
||||
|
||||
Below is the speed in MB/s for a single core (ranked fast to slow) for blocks larger than 1 MB.
|
||||
|
||||
| Processor | SIMD | Speed (MB/s) |
|
||||
| --------------------------------- | ------- | ------------:|
|
||||
| 3.0 GHz Intel Xeon Platinum 8124M | AVX512 | 3498 |
|
||||
| 3.7 GHz AMD Ryzen 7 2700X | SHA Ext | 1979 |
|
||||
| 1.2 GHz ARM Cortex-A53 | ARM64 | 638 |
|
||||
|
||||
## asm2plan9s
|
||||
|
||||
In order to be able to work more easily with AVX512/AVX2 instructions, a separate tool was developed to convert SIMD instructions into the corresponding BYTE sequence as accepted by Go assembly. See [asm2plan9s](https://github.com/minio/asm2plan9s) for more information.
|
||||
|
||||
## Why and benefits
|
||||
|
||||
One of the most performance sensitive parts of the [Minio](https://github.com/minio/minio) object storage server is related to SHA256 hash sums calculations. For instance during multi part uploads each part that is uploaded needs to be verified for data integrity by the server.
|
||||
|
||||
Other applications that can benefit from enhanced SHA256 performance are deduplication in storage systems, intrusion detection, version control systems, integrity checking, etc.
|
||||
|
||||
## ARM SHA Extensions
|
||||
|
||||
The 64-bit ARMv8 core has introduced new instructions for SHA1 and SHA2 acceleration as part of the [Cryptography Extensions](http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0501f/CHDFJBCJ.html). Below you can see a small excerpt highlighting one of the rounds as is done for the SHA256 calculation process (for full code see [sha256block_arm64.s](https://github.com/minio/sha256-simd/blob/master/sha256block_arm64.s)).
|
||||
|
||||
```
|
||||
sha256h q2, q3, v9.4s
|
||||
sha256h2 q3, q4, v9.4s
|
||||
sha256su0 v5.4s, v6.4s
|
||||
rev32 v8.16b, v8.16b
|
||||
add v9.4s, v7.4s, v18.4s
|
||||
mov v4.16b, v2.16b
|
||||
sha256h q2, q3, v10.4s
|
||||
sha256h2 q3, q4, v10.4s
|
||||
sha256su0 v6.4s, v7.4s
|
||||
sha256su1 v5.4s, v7.4s, v8.4s
|
||||
```
|
||||
|
||||
### Detailed benchmarks
|
||||
|
||||
Benchmarks generated on a 1.2 Ghz Quad-Core ARM Cortex A53 equipped [Pine64](https://www.pine64.com/).
|
||||
|
||||
```
|
||||
minio@minio-arm:$ benchcmp golang.txt arm64.txt
|
||||
benchmark golang arm64 speedup
|
||||
BenchmarkHash8Bytes-4 0.68 MB/s 5.70 MB/s 8.38x
|
||||
BenchmarkHash1K-4 5.65 MB/s 326.30 MB/s 57.75x
|
||||
BenchmarkHash8K-4 6.00 MB/s 570.63 MB/s 95.11x
|
||||
BenchmarkHash1M-4 6.05 MB/s 638.23 MB/s 105.49x
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Released under the Apache License v2.0. You can find the complete text in the file LICENSE.
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions are welcome, please send PRs for any enhancements.
|
50
vendor/github.com/minio/sha256-simd/cpuid_other.go
generated
vendored
50
vendor/github.com/minio/sha256-simd/cpuid_other.go
generated
vendored
@@ -1,50 +0,0 @@
|
||||
// Minio Cloud Storage, (C) 2021 Minio, 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 sha256
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"runtime"
|
||||
|
||||
"github.com/klauspost/cpuid/v2"
|
||||
)
|
||||
|
||||
var (
|
||||
hasIntelSha = runtime.GOARCH == "amd64" && cpuid.CPU.Supports(cpuid.SHA, cpuid.SSSE3, cpuid.SSE4)
|
||||
hasAvx512 = cpuid.CPU.Supports(cpuid.AVX512F, cpuid.AVX512DQ, cpuid.AVX512BW, cpuid.AVX512VL)
|
||||
)
|
||||
|
||||
func hasArmSha2() bool {
|
||||
if cpuid.CPU.Has(cpuid.SHA2) {
|
||||
return true
|
||||
}
|
||||
if runtime.GOARCH != "arm64" || runtime.GOOS != "linux" {
|
||||
return false
|
||||
}
|
||||
|
||||
// Fall back to hacky cpuinfo parsing...
|
||||
const procCPUInfo = "/proc/cpuinfo"
|
||||
|
||||
// Feature to check for.
|
||||
const sha256Feature = "sha2"
|
||||
|
||||
cpuInfo, err := ioutil.ReadFile(procCPUInfo)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return bytes.Contains(cpuInfo, []byte(sha256Feature))
|
||||
}
|
468
vendor/github.com/minio/sha256-simd/sha256.go
generated
vendored
468
vendor/github.com/minio/sha256-simd/sha256.go
generated
vendored
@@ -1,468 +0,0 @@
|
||||
/*
|
||||
* Minio Cloud Storage, (C) 2016 Minio, 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 sha256
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"hash"
|
||||
)
|
||||
|
||||
// Size - The size of a SHA256 checksum in bytes.
|
||||
const Size = 32
|
||||
|
||||
// BlockSize - The blocksize of SHA256 in bytes.
|
||||
const BlockSize = 64
|
||||
|
||||
const (
|
||||
chunk = BlockSize
|
||||
init0 = 0x6A09E667
|
||||
init1 = 0xBB67AE85
|
||||
init2 = 0x3C6EF372
|
||||
init3 = 0xA54FF53A
|
||||
init4 = 0x510E527F
|
||||
init5 = 0x9B05688C
|
||||
init6 = 0x1F83D9AB
|
||||
init7 = 0x5BE0CD19
|
||||
)
|
||||
|
||||
// digest represents the partial evaluation of a checksum.
|
||||
type digest struct {
|
||||
h [8]uint32
|
||||
x [chunk]byte
|
||||
nx int
|
||||
len uint64
|
||||
}
|
||||
|
||||
// Reset digest back to default
|
||||
func (d *digest) Reset() {
|
||||
d.h[0] = init0
|
||||
d.h[1] = init1
|
||||
d.h[2] = init2
|
||||
d.h[3] = init3
|
||||
d.h[4] = init4
|
||||
d.h[5] = init5
|
||||
d.h[6] = init6
|
||||
d.h[7] = init7
|
||||
d.nx = 0
|
||||
d.len = 0
|
||||
}
|
||||
|
||||
type blockfuncType int
|
||||
|
||||
const (
|
||||
blockfuncStdlib blockfuncType = iota
|
||||
blockfuncIntelSha
|
||||
blockfuncArmSha2
|
||||
blockfuncForceGeneric = -1
|
||||
)
|
||||
|
||||
var blockfunc blockfuncType
|
||||
|
||||
func init() {
|
||||
switch {
|
||||
case hasIntelSha:
|
||||
blockfunc = blockfuncIntelSha
|
||||
case hasArmSha2():
|
||||
blockfunc = blockfuncArmSha2
|
||||
}
|
||||
}
|
||||
|
||||
// New returns a new hash.Hash computing the SHA256 checksum.
|
||||
func New() hash.Hash {
|
||||
if blockfunc == blockfuncStdlib {
|
||||
// Fallback to the standard golang implementation
|
||||
// if no features were found.
|
||||
return sha256.New()
|
||||
}
|
||||
|
||||
d := new(digest)
|
||||
d.Reset()
|
||||
return d
|
||||
}
|
||||
|
||||
// Sum256 - single caller sha256 helper
|
||||
func Sum256(data []byte) (result [Size]byte) {
|
||||
var d digest
|
||||
d.Reset()
|
||||
d.Write(data)
|
||||
result = d.checkSum()
|
||||
return
|
||||
}
|
||||
|
||||
// Return size of checksum
|
||||
func (d *digest) Size() int { return Size }
|
||||
|
||||
// Return blocksize of checksum
|
||||
func (d *digest) BlockSize() int { return BlockSize }
|
||||
|
||||
// Write to digest
|
||||
func (d *digest) Write(p []byte) (nn int, err error) {
|
||||
nn = len(p)
|
||||
d.len += uint64(nn)
|
||||
if d.nx > 0 {
|
||||
n := copy(d.x[d.nx:], p)
|
||||
d.nx += n
|
||||
if d.nx == chunk {
|
||||
block(d, d.x[:])
|
||||
d.nx = 0
|
||||
}
|
||||
p = p[n:]
|
||||
}
|
||||
if len(p) >= chunk {
|
||||
n := len(p) &^ (chunk - 1)
|
||||
block(d, p[:n])
|
||||
p = p[n:]
|
||||
}
|
||||
if len(p) > 0 {
|
||||
d.nx = copy(d.x[:], p)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Return sha256 sum in bytes
|
||||
func (d *digest) Sum(in []byte) []byte {
|
||||
// Make a copy of d0 so that caller can keep writing and summing.
|
||||
d0 := *d
|
||||
hash := d0.checkSum()
|
||||
return append(in, hash[:]...)
|
||||
}
|
||||
|
||||
// Intermediate checksum function
|
||||
func (d *digest) checkSum() (digest [Size]byte) {
|
||||
n := d.nx
|
||||
|
||||
var k [64]byte
|
||||
copy(k[:], d.x[:n])
|
||||
|
||||
k[n] = 0x80
|
||||
|
||||
if n >= 56 {
|
||||
block(d, k[:])
|
||||
|
||||
// clear block buffer - go compiles this to optimal 1x xorps + 4x movups
|
||||
// unfortunately expressing this more succinctly results in much worse code
|
||||
k[0] = 0
|
||||
k[1] = 0
|
||||
k[2] = 0
|
||||
k[3] = 0
|
||||
k[4] = 0
|
||||
k[5] = 0
|
||||
k[6] = 0
|
||||
k[7] = 0
|
||||
k[8] = 0
|
||||
k[9] = 0
|
||||
k[10] = 0
|
||||
k[11] = 0
|
||||
k[12] = 0
|
||||
k[13] = 0
|
||||
k[14] = 0
|
||||
k[15] = 0
|
||||
k[16] = 0
|
||||
k[17] = 0
|
||||
k[18] = 0
|
||||
k[19] = 0
|
||||
k[20] = 0
|
||||
k[21] = 0
|
||||
k[22] = 0
|
||||
k[23] = 0
|
||||
k[24] = 0
|
||||
k[25] = 0
|
||||
k[26] = 0
|
||||
k[27] = 0
|
||||
k[28] = 0
|
||||
k[29] = 0
|
||||
k[30] = 0
|
||||
k[31] = 0
|
||||
k[32] = 0
|
||||
k[33] = 0
|
||||
k[34] = 0
|
||||
k[35] = 0
|
||||
k[36] = 0
|
||||
k[37] = 0
|
||||
k[38] = 0
|
||||
k[39] = 0
|
||||
k[40] = 0
|
||||
k[41] = 0
|
||||
k[42] = 0
|
||||
k[43] = 0
|
||||
k[44] = 0
|
||||
k[45] = 0
|
||||
k[46] = 0
|
||||
k[47] = 0
|
||||
k[48] = 0
|
||||
k[49] = 0
|
||||
k[50] = 0
|
||||
k[51] = 0
|
||||
k[52] = 0
|
||||
k[53] = 0
|
||||
k[54] = 0
|
||||
k[55] = 0
|
||||
k[56] = 0
|
||||
k[57] = 0
|
||||
k[58] = 0
|
||||
k[59] = 0
|
||||
k[60] = 0
|
||||
k[61] = 0
|
||||
k[62] = 0
|
||||
k[63] = 0
|
||||
}
|
||||
binary.BigEndian.PutUint64(k[56:64], uint64(d.len)<<3)
|
||||
block(d, k[:])
|
||||
|
||||
{
|
||||
const i = 0
|
||||
binary.BigEndian.PutUint32(digest[i*4:i*4+4], d.h[i])
|
||||
}
|
||||
{
|
||||
const i = 1
|
||||
binary.BigEndian.PutUint32(digest[i*4:i*4+4], d.h[i])
|
||||
}
|
||||
{
|
||||
const i = 2
|
||||
binary.BigEndian.PutUint32(digest[i*4:i*4+4], d.h[i])
|
||||
}
|
||||
{
|
||||
const i = 3
|
||||
binary.BigEndian.PutUint32(digest[i*4:i*4+4], d.h[i])
|
||||
}
|
||||
{
|
||||
const i = 4
|
||||
binary.BigEndian.PutUint32(digest[i*4:i*4+4], d.h[i])
|
||||
}
|
||||
{
|
||||
const i = 5
|
||||
binary.BigEndian.PutUint32(digest[i*4:i*4+4], d.h[i])
|
||||
}
|
||||
{
|
||||
const i = 6
|
||||
binary.BigEndian.PutUint32(digest[i*4:i*4+4], d.h[i])
|
||||
}
|
||||
{
|
||||
const i = 7
|
||||
binary.BigEndian.PutUint32(digest[i*4:i*4+4], d.h[i])
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func block(dig *digest, p []byte) {
|
||||
if blockfunc == blockfuncIntelSha {
|
||||
blockIntelShaGo(dig, p)
|
||||
} else if blockfunc == blockfuncArmSha2 {
|
||||
blockArmSha2Go(dig, p)
|
||||
} else {
|
||||
blockGeneric(dig, p)
|
||||
}
|
||||
}
|
||||
|
||||
func blockGeneric(dig *digest, p []byte) {
|
||||
var w [64]uint32
|
||||
h0, h1, h2, h3, h4, h5, h6, h7 := dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7]
|
||||
for len(p) >= chunk {
|
||||
// Can interlace the computation of w with the
|
||||
// rounds below if needed for speed.
|
||||
for i := 0; i < 16; i++ {
|
||||
j := i * 4
|
||||
w[i] = uint32(p[j])<<24 | uint32(p[j+1])<<16 | uint32(p[j+2])<<8 | uint32(p[j+3])
|
||||
}
|
||||
for i := 16; i < 64; i++ {
|
||||
v1 := w[i-2]
|
||||
t1 := (v1>>17 | v1<<(32-17)) ^ (v1>>19 | v1<<(32-19)) ^ (v1 >> 10)
|
||||
v2 := w[i-15]
|
||||
t2 := (v2>>7 | v2<<(32-7)) ^ (v2>>18 | v2<<(32-18)) ^ (v2 >> 3)
|
||||
w[i] = t1 + w[i-7] + t2 + w[i-16]
|
||||
}
|
||||
|
||||
a, b, c, d, e, f, g, h := h0, h1, h2, h3, h4, h5, h6, h7
|
||||
|
||||
for i := 0; i < 64; i++ {
|
||||
t1 := h + ((e>>6 | e<<(32-6)) ^ (e>>11 | e<<(32-11)) ^ (e>>25 | e<<(32-25))) + ((e & f) ^ (^e & g)) + _K[i] + w[i]
|
||||
|
||||
t2 := ((a>>2 | a<<(32-2)) ^ (a>>13 | a<<(32-13)) ^ (a>>22 | a<<(32-22))) + ((a & b) ^ (a & c) ^ (b & c))
|
||||
|
||||
h = g
|
||||
g = f
|
||||
f = e
|
||||
e = d + t1
|
||||
d = c
|
||||
c = b
|
||||
b = a
|
||||
a = t1 + t2
|
||||
}
|
||||
|
||||
h0 += a
|
||||
h1 += b
|
||||
h2 += c
|
||||
h3 += d
|
||||
h4 += e
|
||||
h5 += f
|
||||
h6 += g
|
||||
h7 += h
|
||||
|
||||
p = p[chunk:]
|
||||
}
|
||||
|
||||
dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7] = h0, h1, h2, h3, h4, h5, h6, h7
|
||||
}
|
||||
|
||||
var _K = []uint32{
|
||||
0x428a2f98,
|
||||
0x71374491,
|
||||
0xb5c0fbcf,
|
||||
0xe9b5dba5,
|
||||
0x3956c25b,
|
||||
0x59f111f1,
|
||||
0x923f82a4,
|
||||
0xab1c5ed5,
|
||||
0xd807aa98,
|
||||
0x12835b01,
|
||||
0x243185be,
|
||||
0x550c7dc3,
|
||||
0x72be5d74,
|
||||
0x80deb1fe,
|
||||
0x9bdc06a7,
|
||||
0xc19bf174,
|
||||
0xe49b69c1,
|
||||
0xefbe4786,
|
||||
0x0fc19dc6,
|
||||
0x240ca1cc,
|
||||
0x2de92c6f,
|
||||
0x4a7484aa,
|
||||
0x5cb0a9dc,
|
||||
0x76f988da,
|
||||
0x983e5152,
|
||||
0xa831c66d,
|
||||
0xb00327c8,
|
||||
0xbf597fc7,
|
||||
0xc6e00bf3,
|
||||
0xd5a79147,
|
||||
0x06ca6351,
|
||||
0x14292967,
|
||||
0x27b70a85,
|
||||
0x2e1b2138,
|
||||
0x4d2c6dfc,
|
||||
0x53380d13,
|
||||
0x650a7354,
|
||||
0x766a0abb,
|
||||
0x81c2c92e,
|
||||
0x92722c85,
|
||||
0xa2bfe8a1,
|
||||
0xa81a664b,
|
||||
0xc24b8b70,
|
||||
0xc76c51a3,
|
||||
0xd192e819,
|
||||
0xd6990624,
|
||||
0xf40e3585,
|
||||
0x106aa070,
|
||||
0x19a4c116,
|
||||
0x1e376c08,
|
||||
0x2748774c,
|
||||
0x34b0bcb5,
|
||||
0x391c0cb3,
|
||||
0x4ed8aa4a,
|
||||
0x5b9cca4f,
|
||||
0x682e6ff3,
|
||||
0x748f82ee,
|
||||
0x78a5636f,
|
||||
0x84c87814,
|
||||
0x8cc70208,
|
||||
0x90befffa,
|
||||
0xa4506ceb,
|
||||
0xbef9a3f7,
|
||||
0xc67178f2,
|
||||
}
|
||||
|
||||
const (
|
||||
magic256 = "sha\x03"
|
||||
marshaledSize = len(magic256) + 8*4 + chunk + 8
|
||||
)
|
||||
|
||||
func (d *digest) MarshalBinary() ([]byte, error) {
|
||||
b := make([]byte, 0, marshaledSize)
|
||||
b = append(b, magic256...)
|
||||
b = appendUint32(b, d.h[0])
|
||||
b = appendUint32(b, d.h[1])
|
||||
b = appendUint32(b, d.h[2])
|
||||
b = appendUint32(b, d.h[3])
|
||||
b = appendUint32(b, d.h[4])
|
||||
b = appendUint32(b, d.h[5])
|
||||
b = appendUint32(b, d.h[6])
|
||||
b = appendUint32(b, d.h[7])
|
||||
b = append(b, d.x[:d.nx]...)
|
||||
b = b[:len(b)+len(d.x)-d.nx] // already zero
|
||||
b = appendUint64(b, d.len)
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func (d *digest) UnmarshalBinary(b []byte) error {
|
||||
if len(b) < len(magic256) || string(b[:len(magic256)]) != magic256 {
|
||||
return errors.New("crypto/sha256: invalid hash state identifier")
|
||||
}
|
||||
if len(b) != marshaledSize {
|
||||
return errors.New("crypto/sha256: invalid hash state size")
|
||||
}
|
||||
b = b[len(magic256):]
|
||||
b, d.h[0] = consumeUint32(b)
|
||||
b, d.h[1] = consumeUint32(b)
|
||||
b, d.h[2] = consumeUint32(b)
|
||||
b, d.h[3] = consumeUint32(b)
|
||||
b, d.h[4] = consumeUint32(b)
|
||||
b, d.h[5] = consumeUint32(b)
|
||||
b, d.h[6] = consumeUint32(b)
|
||||
b, d.h[7] = consumeUint32(b)
|
||||
b = b[copy(d.x[:], b):]
|
||||
b, d.len = consumeUint64(b)
|
||||
d.nx = int(d.len % chunk)
|
||||
return nil
|
||||
}
|
||||
|
||||
func appendUint32(b []byte, v uint32) []byte {
|
||||
return append(b,
|
||||
byte(v>>24),
|
||||
byte(v>>16),
|
||||
byte(v>>8),
|
||||
byte(v),
|
||||
)
|
||||
}
|
||||
|
||||
func appendUint64(b []byte, v uint64) []byte {
|
||||
return append(b,
|
||||
byte(v>>56),
|
||||
byte(v>>48),
|
||||
byte(v>>40),
|
||||
byte(v>>32),
|
||||
byte(v>>24),
|
||||
byte(v>>16),
|
||||
byte(v>>8),
|
||||
byte(v),
|
||||
)
|
||||
}
|
||||
|
||||
func consumeUint64(b []byte) ([]byte, uint64) {
|
||||
_ = b[7]
|
||||
x := uint64(b[7]) | uint64(b[6])<<8 | uint64(b[5])<<16 | uint64(b[4])<<24 |
|
||||
uint64(b[3])<<32 | uint64(b[2])<<40 | uint64(b[1])<<48 | uint64(b[0])<<56
|
||||
return b[8:], x
|
||||
}
|
||||
|
||||
func consumeUint32(b []byte) ([]byte, uint32) {
|
||||
_ = b[3]
|
||||
x := uint32(b[3]) | uint32(b[2])<<8 | uint32(b[1])<<16 | uint32(b[0])<<24
|
||||
return b[4:], x
|
||||
}
|
686
vendor/github.com/minio/sha256-simd/sha256blockAvx512_amd64.asm
generated
vendored
686
vendor/github.com/minio/sha256-simd/sha256blockAvx512_amd64.asm
generated
vendored
@@ -1,686 +0,0 @@
|
||||
|
||||
// 16x Parallel implementation of SHA256 for AVX512
|
||||
|
||||
//
|
||||
// Minio Cloud Storage, (C) 2017 Minio, 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.
|
||||
|
||||
//
|
||||
// This code is based on the Intel Multi-Buffer Crypto for IPSec library
|
||||
// and more specifically the following implementation:
|
||||
// https://github.com/intel/intel-ipsec-mb/blob/master/avx512/sha256_x16_avx512.asm
|
||||
//
|
||||
// For Golang it has been converted into Plan 9 assembly with the help of
|
||||
// github.com/minio/asm2plan9s to assemble the AVX512 instructions
|
||||
//
|
||||
|
||||
// Copyright (c) 2017, Intel Corporation
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must 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 Intel Corporation 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.
|
||||
|
||||
#define SHA256_DIGEST_ROW_SIZE 64
|
||||
|
||||
// arg1
|
||||
#define STATE rdi
|
||||
#define STATE_P9 DI
|
||||
// arg2
|
||||
#define INP_SIZE rsi
|
||||
#define INP_SIZE_P9 SI
|
||||
|
||||
#define IDX rcx
|
||||
#define TBL rdx
|
||||
#define TBL_P9 DX
|
||||
|
||||
#define INPUT rax
|
||||
#define INPUT_P9 AX
|
||||
|
||||
#define inp0 r9
|
||||
#define SCRATCH_P9 R12
|
||||
#define SCRATCH r12
|
||||
#define maskp r13
|
||||
#define MASKP_P9 R13
|
||||
#define mask r14
|
||||
#define MASK_P9 R14
|
||||
|
||||
#define A zmm0
|
||||
#define B zmm1
|
||||
#define C zmm2
|
||||
#define D zmm3
|
||||
#define E zmm4
|
||||
#define F zmm5
|
||||
#define G zmm6
|
||||
#define H zmm7
|
||||
#define T1 zmm8
|
||||
#define TMP0 zmm9
|
||||
#define TMP1 zmm10
|
||||
#define TMP2 zmm11
|
||||
#define TMP3 zmm12
|
||||
#define TMP4 zmm13
|
||||
#define TMP5 zmm14
|
||||
#define TMP6 zmm15
|
||||
|
||||
#define W0 zmm16
|
||||
#define W1 zmm17
|
||||
#define W2 zmm18
|
||||
#define W3 zmm19
|
||||
#define W4 zmm20
|
||||
#define W5 zmm21
|
||||
#define W6 zmm22
|
||||
#define W7 zmm23
|
||||
#define W8 zmm24
|
||||
#define W9 zmm25
|
||||
#define W10 zmm26
|
||||
#define W11 zmm27
|
||||
#define W12 zmm28
|
||||
#define W13 zmm29
|
||||
#define W14 zmm30
|
||||
#define W15 zmm31
|
||||
|
||||
|
||||
#define TRANSPOSE16(_r0, _r1, _r2, _r3, _r4, _r5, _r6, _r7, _r8, _r9, _r10, _r11, _r12, _r13, _r14, _r15, _t0, _t1) \
|
||||
\
|
||||
\ // input r0 = {a15 a14 a13 a12 a11 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 a0}
|
||||
\ // r1 = {b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0}
|
||||
\ // r2 = {c15 c14 c13 c12 c11 c10 c9 c8 c7 c6 c5 c4 c3 c2 c1 c0}
|
||||
\ // r3 = {d15 d14 d13 d12 d11 d10 d9 d8 d7 d6 d5 d4 d3 d2 d1 d0}
|
||||
\ // r4 = {e15 e14 e13 e12 e11 e10 e9 e8 e7 e6 e5 e4 e3 e2 e1 e0}
|
||||
\ // r5 = {f15 f14 f13 f12 f11 f10 f9 f8 f7 f6 f5 f4 f3 f2 f1 f0}
|
||||
\ // r6 = {g15 g14 g13 g12 g11 g10 g9 g8 g7 g6 g5 g4 g3 g2 g1 g0}
|
||||
\ // r7 = {h15 h14 h13 h12 h11 h10 h9 h8 h7 h6 h5 h4 h3 h2 h1 h0}
|
||||
\ // r8 = {i15 i14 i13 i12 i11 i10 i9 i8 i7 i6 i5 i4 i3 i2 i1 i0}
|
||||
\ // r9 = {j15 j14 j13 j12 j11 j10 j9 j8 j7 j6 j5 j4 j3 j2 j1 j0}
|
||||
\ // r10 = {k15 k14 k13 k12 k11 k10 k9 k8 k7 k6 k5 k4 k3 k2 k1 k0}
|
||||
\ // r11 = {l15 l14 l13 l12 l11 l10 l9 l8 l7 l6 l5 l4 l3 l2 l1 l0}
|
||||
\ // r12 = {m15 m14 m13 m12 m11 m10 m9 m8 m7 m6 m5 m4 m3 m2 m1 m0}
|
||||
\ // r13 = {n15 n14 n13 n12 n11 n10 n9 n8 n7 n6 n5 n4 n3 n2 n1 n0}
|
||||
\ // r14 = {o15 o14 o13 o12 o11 o10 o9 o8 o7 o6 o5 o4 o3 o2 o1 o0}
|
||||
\ // r15 = {p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0}
|
||||
\
|
||||
\ // output r0 = { p0 o0 n0 m0 l0 k0 j0 i0 h0 g0 f0 e0 d0 c0 b0 a0}
|
||||
\ // r1 = { p1 o1 n1 m1 l1 k1 j1 i1 h1 g1 f1 e1 d1 c1 b1 a1}
|
||||
\ // r2 = { p2 o2 n2 m2 l2 k2 j2 i2 h2 g2 f2 e2 d2 c2 b2 a2}
|
||||
\ // r3 = { p3 o3 n3 m3 l3 k3 j3 i3 h3 g3 f3 e3 d3 c3 b3 a3}
|
||||
\ // r4 = { p4 o4 n4 m4 l4 k4 j4 i4 h4 g4 f4 e4 d4 c4 b4 a4}
|
||||
\ // r5 = { p5 o5 n5 m5 l5 k5 j5 i5 h5 g5 f5 e5 d5 c5 b5 a5}
|
||||
\ // r6 = { p6 o6 n6 m6 l6 k6 j6 i6 h6 g6 f6 e6 d6 c6 b6 a6}
|
||||
\ // r7 = { p7 o7 n7 m7 l7 k7 j7 i7 h7 g7 f7 e7 d7 c7 b7 a7}
|
||||
\ // r8 = { p8 o8 n8 m8 l8 k8 j8 i8 h8 g8 f8 e8 d8 c8 b8 a8}
|
||||
\ // r9 = { p9 o9 n9 m9 l9 k9 j9 i9 h9 g9 f9 e9 d9 c9 b9 a9}
|
||||
\ // r10 = {p10 o10 n10 m10 l10 k10 j10 i10 h10 g10 f10 e10 d10 c10 b10 a10}
|
||||
\ // r11 = {p11 o11 n11 m11 l11 k11 j11 i11 h11 g11 f11 e11 d11 c11 b11 a11}
|
||||
\ // r12 = {p12 o12 n12 m12 l12 k12 j12 i12 h12 g12 f12 e12 d12 c12 b12 a12}
|
||||
\ // r13 = {p13 o13 n13 m13 l13 k13 j13 i13 h13 g13 f13 e13 d13 c13 b13 a13}
|
||||
\ // r14 = {p14 o14 n14 m14 l14 k14 j14 i14 h14 g14 f14 e14 d14 c14 b14 a14}
|
||||
\ // r15 = {p15 o15 n15 m15 l15 k15 j15 i15 h15 g15 f15 e15 d15 c15 b15 a15}
|
||||
\
|
||||
\ // process top half
|
||||
vshufps _t0, _r0, _r1, 0x44 \ // t0 = {b13 b12 a13 a12 b9 b8 a9 a8 b5 b4 a5 a4 b1 b0 a1 a0}
|
||||
vshufps _r0, _r0, _r1, 0xEE \ // r0 = {b15 b14 a15 a14 b11 b10 a11 a10 b7 b6 a7 a6 b3 b2 a3 a2}
|
||||
vshufps _t1, _r2, _r3, 0x44 \ // t1 = {d13 d12 c13 c12 d9 d8 c9 c8 d5 d4 c5 c4 d1 d0 c1 c0}
|
||||
vshufps _r2, _r2, _r3, 0xEE \ // r2 = {d15 d14 c15 c14 d11 d10 c11 c10 d7 d6 c7 c6 d3 d2 c3 c2}
|
||||
\
|
||||
vshufps _r3, _t0, _t1, 0xDD \ // r3 = {d13 c13 b13 a13 d9 c9 b9 a9 d5 c5 b5 a5 d1 c1 b1 a1}
|
||||
vshufps _r1, _r0, _r2, 0x88 \ // r1 = {d14 c14 b14 a14 d10 c10 b10 a10 d6 c6 b6 a6 d2 c2 b2 a2}
|
||||
vshufps _r0, _r0, _r2, 0xDD \ // r0 = {d15 c15 b15 a15 d11 c11 b11 a11 d7 c7 b7 a7 d3 c3 b3 a3}
|
||||
vshufps _t0, _t0, _t1, 0x88 \ // t0 = {d12 c12 b12 a12 d8 c8 b8 a8 d4 c4 b4 a4 d0 c0 b0 a0}
|
||||
\
|
||||
\ // use r2 in place of t0
|
||||
vshufps _r2, _r4, _r5, 0x44 \ // r2 = {f13 f12 e13 e12 f9 f8 e9 e8 f5 f4 e5 e4 f1 f0 e1 e0}
|
||||
vshufps _r4, _r4, _r5, 0xEE \ // r4 = {f15 f14 e15 e14 f11 f10 e11 e10 f7 f6 e7 e6 f3 f2 e3 e2}
|
||||
vshufps _t1, _r6, _r7, 0x44 \ // t1 = {h13 h12 g13 g12 h9 h8 g9 g8 h5 h4 g5 g4 h1 h0 g1 g0}
|
||||
vshufps _r6, _r6, _r7, 0xEE \ // r6 = {h15 h14 g15 g14 h11 h10 g11 g10 h7 h6 g7 g6 h3 h2 g3 g2}
|
||||
\
|
||||
vshufps _r7, _r2, _t1, 0xDD \ // r7 = {h13 g13 f13 e13 h9 g9 f9 e9 h5 g5 f5 e5 h1 g1 f1 e1}
|
||||
vshufps _r5, _r4, _r6, 0x88 \ // r5 = {h14 g14 f14 e14 h10 g10 f10 e10 h6 g6 f6 e6 h2 g2 f2 e2}
|
||||
vshufps _r4, _r4, _r6, 0xDD \ // r4 = {h15 g15 f15 e15 h11 g11 f11 e11 h7 g7 f7 e7 h3 g3 f3 e3}
|
||||
vshufps _r2, _r2, _t1, 0x88 \ // r2 = {h12 g12 f12 e12 h8 g8 f8 e8 h4 g4 f4 e4 h0 g0 f0 e0}
|
||||
\
|
||||
\ // use r6 in place of t0
|
||||
vshufps _r6, _r8, _r9, 0x44 \ // r6 = {j13 j12 i13 i12 j9 j8 i9 i8 j5 j4 i5 i4 j1 j0 i1 i0}
|
||||
vshufps _r8, _r8, _r9, 0xEE \ // r8 = {j15 j14 i15 i14 j11 j10 i11 i10 j7 j6 i7 i6 j3 j2 i3 i2}
|
||||
vshufps _t1, _r10, _r11, 0x44 \ // t1 = {l13 l12 k13 k12 l9 l8 k9 k8 l5 l4 k5 k4 l1 l0 k1 k0}
|
||||
vshufps _r10, _r10, _r11, 0xEE \ // r10 = {l15 l14 k15 k14 l11 l10 k11 k10 l7 l6 k7 k6 l3 l2 k3 k2}
|
||||
\
|
||||
vshufps _r11, _r6, _t1, 0xDD \ // r11 = {l13 k13 j13 113 l9 k9 j9 i9 l5 k5 j5 i5 l1 k1 j1 i1}
|
||||
vshufps _r9, _r8, _r10, 0x88 \ // r9 = {l14 k14 j14 114 l10 k10 j10 i10 l6 k6 j6 i6 l2 k2 j2 i2}
|
||||
vshufps _r8, _r8, _r10, 0xDD \ // r8 = {l15 k15 j15 115 l11 k11 j11 i11 l7 k7 j7 i7 l3 k3 j3 i3}
|
||||
vshufps _r6, _r6, _t1, 0x88 \ // r6 = {l12 k12 j12 112 l8 k8 j8 i8 l4 k4 j4 i4 l0 k0 j0 i0}
|
||||
\
|
||||
\ // use r10 in place of t0
|
||||
vshufps _r10, _r12, _r13, 0x44 \ // r10 = {n13 n12 m13 m12 n9 n8 m9 m8 n5 n4 m5 m4 n1 n0 a1 m0}
|
||||
vshufps _r12, _r12, _r13, 0xEE \ // r12 = {n15 n14 m15 m14 n11 n10 m11 m10 n7 n6 m7 m6 n3 n2 a3 m2}
|
||||
vshufps _t1, _r14, _r15, 0x44 \ // t1 = {p13 p12 013 012 p9 p8 09 08 p5 p4 05 04 p1 p0 01 00}
|
||||
vshufps _r14, _r14, _r15, 0xEE \ // r14 = {p15 p14 015 014 p11 p10 011 010 p7 p6 07 06 p3 p2 03 02}
|
||||
\
|
||||
vshufps _r15, _r10, _t1, 0xDD \ // r15 = {p13 013 n13 m13 p9 09 n9 m9 p5 05 n5 m5 p1 01 n1 m1}
|
||||
vshufps _r13, _r12, _r14, 0x88 \ // r13 = {p14 014 n14 m14 p10 010 n10 m10 p6 06 n6 m6 p2 02 n2 m2}
|
||||
vshufps _r12, _r12, _r14, 0xDD \ // r12 = {p15 015 n15 m15 p11 011 n11 m11 p7 07 n7 m7 p3 03 n3 m3}
|
||||
vshufps _r10, _r10, _t1, 0x88 \ // r10 = {p12 012 n12 m12 p8 08 n8 m8 p4 04 n4 m4 p0 00 n0 m0}
|
||||
\
|
||||
\ // At this point, the registers that contain interesting data are:
|
||||
\ // t0, r3, r1, r0, r2, r7, r5, r4, r6, r11, r9, r8, r10, r15, r13, r12
|
||||
\ // Can use t1 and r14 as scratch registers
|
||||
LEAQ PSHUFFLE_TRANSPOSE16_MASK1<>(SB), BX \
|
||||
LEAQ PSHUFFLE_TRANSPOSE16_MASK2<>(SB), R8 \
|
||||
\
|
||||
vmovdqu32 _r14, [rbx] \
|
||||
vpermi2q _r14, _t0, _r2 \ // r14 = {h8 g8 f8 e8 d8 c8 b8 a8 h0 g0 f0 e0 d0 c0 b0 a0}
|
||||
vmovdqu32 _t1, [r8] \
|
||||
vpermi2q _t1, _t0, _r2 \ // t1 = {h12 g12 f12 e12 d12 c12 b12 a12 h4 g4 f4 e4 d4 c4 b4 a4}
|
||||
\
|
||||
vmovdqu32 _r2, [rbx] \
|
||||
vpermi2q _r2, _r3, _r7 \ // r2 = {h9 g9 f9 e9 d9 c9 b9 a9 h1 g1 f1 e1 d1 c1 b1 a1}
|
||||
vmovdqu32 _t0, [r8] \
|
||||
vpermi2q _t0, _r3, _r7 \ // t0 = {h13 g13 f13 e13 d13 c13 b13 a13 h5 g5 f5 e5 d5 c5 b5 a5}
|
||||
\
|
||||
vmovdqu32 _r3, [rbx] \
|
||||
vpermi2q _r3, _r1, _r5 \ // r3 = {h10 g10 f10 e10 d10 c10 b10 a10 h2 g2 f2 e2 d2 c2 b2 a2}
|
||||
vmovdqu32 _r7, [r8] \
|
||||
vpermi2q _r7, _r1, _r5 \ // r7 = {h14 g14 f14 e14 d14 c14 b14 a14 h6 g6 f6 e6 d6 c6 b6 a6}
|
||||
\
|
||||
vmovdqu32 _r1, [rbx] \
|
||||
vpermi2q _r1, _r0, _r4 \ // r1 = {h11 g11 f11 e11 d11 c11 b11 a11 h3 g3 f3 e3 d3 c3 b3 a3}
|
||||
vmovdqu32 _r5, [r8] \
|
||||
vpermi2q _r5, _r0, _r4 \ // r5 = {h15 g15 f15 e15 d15 c15 b15 a15 h7 g7 f7 e7 d7 c7 b7 a7}
|
||||
\
|
||||
vmovdqu32 _r0, [rbx] \
|
||||
vpermi2q _r0, _r6, _r10 \ // r0 = {p8 o8 n8 m8 l8 k8 j8 i8 p0 o0 n0 m0 l0 k0 j0 i0}
|
||||
vmovdqu32 _r4, [r8] \
|
||||
vpermi2q _r4, _r6, _r10 \ // r4 = {p12 o12 n12 m12 l12 k12 j12 i12 p4 o4 n4 m4 l4 k4 j4 i4}
|
||||
\
|
||||
vmovdqu32 _r6, [rbx] \
|
||||
vpermi2q _r6, _r11, _r15 \ // r6 = {p9 o9 n9 m9 l9 k9 j9 i9 p1 o1 n1 m1 l1 k1 j1 i1}
|
||||
vmovdqu32 _r10, [r8] \
|
||||
vpermi2q _r10, _r11, _r15 \ // r10 = {p13 o13 n13 m13 l13 k13 j13 i13 p5 o5 n5 m5 l5 k5 j5 i5}
|
||||
\
|
||||
vmovdqu32 _r11, [rbx] \
|
||||
vpermi2q _r11, _r9, _r13 \ // r11 = {p10 o10 n10 m10 l10 k10 j10 i10 p2 o2 n2 m2 l2 k2 j2 i2}
|
||||
vmovdqu32 _r15, [r8] \
|
||||
vpermi2q _r15, _r9, _r13 \ // r15 = {p14 o14 n14 m14 l14 k14 j14 i14 p6 o6 n6 m6 l6 k6 j6 i6}
|
||||
\
|
||||
vmovdqu32 _r9, [rbx] \
|
||||
vpermi2q _r9, _r8, _r12 \ // r9 = {p11 o11 n11 m11 l11 k11 j11 i11 p3 o3 n3 m3 l3 k3 j3 i3}
|
||||
vmovdqu32 _r13, [r8] \
|
||||
vpermi2q _r13, _r8, _r12 \ // r13 = {p15 o15 n15 m15 l15 k15 j15 i15 p7 o7 n7 m7 l7 k7 j7 i7}
|
||||
\
|
||||
\ // At this point r8 and r12 can be used as scratch registers
|
||||
vshuff64x2 _r8, _r14, _r0, 0xEE \ // r8 = {p8 o8 n8 m8 l8 k8 j8 i8 h8 g8 f8 e8 d8 c8 b8 a8}
|
||||
vshuff64x2 _r0, _r14, _r0, 0x44 \ // r0 = {p0 o0 n0 m0 l0 k0 j0 i0 h0 g0 f0 e0 d0 c0 b0 a0}
|
||||
\
|
||||
vshuff64x2 _r12, _t1, _r4, 0xEE \ // r12 = {p12 o12 n12 m12 l12 k12 j12 i12 h12 g12 f12 e12 d12 c12 b12 a12}
|
||||
vshuff64x2 _r4, _t1, _r4, 0x44 \ // r4 = {p4 o4 n4 m4 l4 k4 j4 i4 h4 g4 f4 e4 d4 c4 b4 a4}
|
||||
\
|
||||
vshuff64x2 _r14, _r7, _r15, 0xEE \ // r14 = {p14 o14 n14 m14 l14 k14 j14 i14 h14 g14 f14 e14 d14 c14 b14 a14}
|
||||
vshuff64x2 _t1, _r7, _r15, 0x44 \ // t1 = {p6 o6 n6 m6 l6 k6 j6 i6 h6 g6 f6 e6 d6 c6 b6 a6}
|
||||
\
|
||||
vshuff64x2 _r15, _r5, _r13, 0xEE \ // r15 = {p15 o15 n15 m15 l15 k15 j15 i15 h15 g15 f15 e15 d15 c15 b15 a15}
|
||||
vshuff64x2 _r7, _r5, _r13, 0x44 \ // r7 = {p7 o7 n7 m7 l7 k7 j7 i7 h7 g7 f7 e7 d7 c7 b7 a7}
|
||||
\
|
||||
vshuff64x2 _r13, _t0, _r10, 0xEE \ // r13 = {p13 o13 n13 m13 l13 k13 j13 i13 h13 g13 f13 e13 d13 c13 b13 a13}
|
||||
vshuff64x2 _r5, _t0, _r10, 0x44 \ // r5 = {p5 o5 n5 m5 l5 k5 j5 i5 h5 g5 f5 e5 d5 c5 b5 a5}
|
||||
\
|
||||
vshuff64x2 _r10, _r3, _r11, 0xEE \ // r10 = {p10 o10 n10 m10 l10 k10 j10 i10 h10 g10 f10 e10 d10 c10 b10 a10}
|
||||
vshuff64x2 _t0, _r3, _r11, 0x44 \ // t0 = {p2 o2 n2 m2 l2 k2 j2 i2 h2 g2 f2 e2 d2 c2 b2 a2}
|
||||
\
|
||||
vshuff64x2 _r11, _r1, _r9, 0xEE \ // r11 = {p11 o11 n11 m11 l11 k11 j11 i11 h11 g11 f11 e11 d11 c11 b11 a11}
|
||||
vshuff64x2 _r3, _r1, _r9, 0x44 \ // r3 = {p3 o3 n3 m3 l3 k3 j3 i3 h3 g3 f3 e3 d3 c3 b3 a3}
|
||||
\
|
||||
vshuff64x2 _r9, _r2, _r6, 0xEE \ // r9 = {p9 o9 n9 m9 l9 k9 j9 i9 h9 g9 f9 e9 d9 c9 b9 a9}
|
||||
vshuff64x2 _r1, _r2, _r6, 0x44 \ // r1 = {p1 o1 n1 m1 l1 k1 j1 i1 h1 g1 f1 e1 d1 c1 b1 a1}
|
||||
\
|
||||
vmovdqu32 _r2, _t0 \ // r2 = {p2 o2 n2 m2 l2 k2 j2 i2 h2 g2 f2 e2 d2 c2 b2 a2}
|
||||
vmovdqu32 _r6, _t1 \ // r6 = {p6 o6 n6 m6 l6 k6 j6 i6 h6 g6 f6 e6 d6 c6 b6 a6}
|
||||
|
||||
|
||||
// CH(A, B, C) = (A&B) ^ (~A&C)
|
||||
// MAJ(E, F, G) = (E&F) ^ (E&G) ^ (F&G)
|
||||
// SIGMA0 = ROR_2 ^ ROR_13 ^ ROR_22
|
||||
// SIGMA1 = ROR_6 ^ ROR_11 ^ ROR_25
|
||||
// sigma0 = ROR_7 ^ ROR_18 ^ SHR_3
|
||||
// sigma1 = ROR_17 ^ ROR_19 ^ SHR_10
|
||||
|
||||
// Main processing loop per round
|
||||
#define PROCESS_LOOP(_WT, _ROUND, _A, _B, _C, _D, _E, _F, _G, _H) \
|
||||
\ // T1 = H + SIGMA1(E) + CH(E, F, G) + Kt + Wt
|
||||
\ // T2 = SIGMA0(A) + MAJ(A, B, C)
|
||||
\ // H=G, G=F, F=E, E=D+T1, D=C, C=B, B=A, A=T1+T2
|
||||
\
|
||||
\ // H becomes T2, then add T1 for A
|
||||
\ // D becomes D + T1 for E
|
||||
\
|
||||
vpaddd T1, _H, TMP3 \ // T1 = H + Kt
|
||||
vmovdqu32 TMP0, _E \
|
||||
vprord TMP1, _E, 6 \ // ROR_6(E)
|
||||
vprord TMP2, _E, 11 \ // ROR_11(E)
|
||||
vprord TMP3, _E, 25 \ // ROR_25(E)
|
||||
vpternlogd TMP0, _F, _G, 0xCA \ // TMP0 = CH(E,F,G)
|
||||
vpaddd T1, T1, _WT \ // T1 = T1 + Wt
|
||||
vpternlogd TMP1, TMP2, TMP3, 0x96 \ // TMP1 = SIGMA1(E)
|
||||
vpaddd T1, T1, TMP0 \ // T1 = T1 + CH(E,F,G)
|
||||
vpaddd T1, T1, TMP1 \ // T1 = T1 + SIGMA1(E)
|
||||
vpaddd _D, _D, T1 \ // D = D + T1
|
||||
\
|
||||
vprord _H, _A, 2 \ // ROR_2(A)
|
||||
vprord TMP2, _A, 13 \ // ROR_13(A)
|
||||
vprord TMP3, _A, 22 \ // ROR_22(A)
|
||||
vmovdqu32 TMP0, _A \
|
||||
vpternlogd TMP0, _B, _C, 0xE8 \ // TMP0 = MAJ(A,B,C)
|
||||
vpternlogd _H, TMP2, TMP3, 0x96 \ // H(T2) = SIGMA0(A)
|
||||
vpaddd _H, _H, TMP0 \ // H(T2) = SIGMA0(A) + MAJ(A,B,C)
|
||||
vpaddd _H, _H, T1 \ // H(A) = H(T2) + T1
|
||||
\
|
||||
vmovdqu32 TMP3, [TBL + ((_ROUND+1)*64)] \ // Next Kt
|
||||
|
||||
|
||||
#define MSG_SCHED_ROUND_16_63(_WT, _WTp1, _WTp9, _WTp14) \
|
||||
vprord TMP4, _WTp14, 17 \ // ROR_17(Wt-2)
|
||||
vprord TMP5, _WTp14, 19 \ // ROR_19(Wt-2)
|
||||
vpsrld TMP6, _WTp14, 10 \ // SHR_10(Wt-2)
|
||||
vpternlogd TMP4, TMP5, TMP6, 0x96 \ // TMP4 = sigma1(Wt-2)
|
||||
\
|
||||
vpaddd _WT, _WT, TMP4 \ // Wt = Wt-16 + sigma1(Wt-2)
|
||||
vpaddd _WT, _WT, _WTp9 \ // Wt = Wt-16 + sigma1(Wt-2) + Wt-7
|
||||
\
|
||||
vprord TMP4, _WTp1, 7 \ // ROR_7(Wt-15)
|
||||
vprord TMP5, _WTp1, 18 \ // ROR_18(Wt-15)
|
||||
vpsrld TMP6, _WTp1, 3 \ // SHR_3(Wt-15)
|
||||
vpternlogd TMP4, TMP5, TMP6, 0x96 \ // TMP4 = sigma0(Wt-15)
|
||||
\
|
||||
vpaddd _WT, _WT, TMP4 \ // Wt = Wt-16 + sigma1(Wt-2) +
|
||||
\ // Wt-7 + sigma0(Wt-15) +
|
||||
|
||||
|
||||
// Note this is reading in a block of data for one lane
|
||||
// When all 16 are read, the data must be transposed to build msg schedule
|
||||
#define MSG_SCHED_ROUND_00_15(_WT, OFFSET, LABEL) \
|
||||
TESTQ $(1<<OFFSET), MASK_P9 \
|
||||
JE LABEL \
|
||||
MOVQ OFFSET*24(INPUT_P9), R9 \
|
||||
vmovups _WT, [inp0+IDX] \
|
||||
LABEL: \
|
||||
|
||||
#define MASKED_LOAD(_WT, OFFSET, LABEL) \
|
||||
TESTQ $(1<<OFFSET), MASK_P9 \
|
||||
JE LABEL \
|
||||
MOVQ OFFSET*24(INPUT_P9), R9 \
|
||||
vmovups _WT,[inp0+IDX] \
|
||||
LABEL: \
|
||||
|
||||
TEXT ·sha256_x16_avx512(SB), 7, $0
|
||||
MOVQ digests+0(FP), STATE_P9 //
|
||||
MOVQ scratch+8(FP), SCRATCH_P9
|
||||
MOVQ mask_len+32(FP), INP_SIZE_P9 // number of blocks to process
|
||||
MOVQ mask+24(FP), MASKP_P9
|
||||
MOVQ (MASKP_P9), MASK_P9
|
||||
kmovq k1, mask
|
||||
LEAQ inputs+48(FP), INPUT_P9
|
||||
|
||||
// Initialize digests
|
||||
vmovdqu32 A, [STATE + 0*SHA256_DIGEST_ROW_SIZE]
|
||||
vmovdqu32 B, [STATE + 1*SHA256_DIGEST_ROW_SIZE]
|
||||
vmovdqu32 C, [STATE + 2*SHA256_DIGEST_ROW_SIZE]
|
||||
vmovdqu32 D, [STATE + 3*SHA256_DIGEST_ROW_SIZE]
|
||||
vmovdqu32 E, [STATE + 4*SHA256_DIGEST_ROW_SIZE]
|
||||
vmovdqu32 F, [STATE + 5*SHA256_DIGEST_ROW_SIZE]
|
||||
vmovdqu32 G, [STATE + 6*SHA256_DIGEST_ROW_SIZE]
|
||||
vmovdqu32 H, [STATE + 7*SHA256_DIGEST_ROW_SIZE]
|
||||
|
||||
MOVQ table+16(FP), TBL_P9
|
||||
|
||||
xor IDX, IDX
|
||||
|
||||
// Read in first block of input data
|
||||
MASKED_LOAD( W0, 0, skipInput0)
|
||||
MASKED_LOAD( W1, 1, skipInput1)
|
||||
MASKED_LOAD( W2, 2, skipInput2)
|
||||
MASKED_LOAD( W3, 3, skipInput3)
|
||||
MASKED_LOAD( W4, 4, skipInput4)
|
||||
MASKED_LOAD( W5, 5, skipInput5)
|
||||
MASKED_LOAD( W6, 6, skipInput6)
|
||||
MASKED_LOAD( W7, 7, skipInput7)
|
||||
MASKED_LOAD( W8, 8, skipInput8)
|
||||
MASKED_LOAD( W9, 9, skipInput9)
|
||||
MASKED_LOAD(W10, 10, skipInput10)
|
||||
MASKED_LOAD(W11, 11, skipInput11)
|
||||
MASKED_LOAD(W12, 12, skipInput12)
|
||||
MASKED_LOAD(W13, 13, skipInput13)
|
||||
MASKED_LOAD(W14, 14, skipInput14)
|
||||
MASKED_LOAD(W15, 15, skipInput15)
|
||||
|
||||
lloop:
|
||||
LEAQ PSHUFFLE_BYTE_FLIP_MASK<>(SB), TBL_P9
|
||||
vmovdqu32 TMP2, [TBL]
|
||||
|
||||
// Get first K from table
|
||||
MOVQ table+16(FP), TBL_P9
|
||||
vmovdqu32 TMP3, [TBL]
|
||||
|
||||
// Save digests for later addition
|
||||
vmovdqu32 [SCRATCH + 64*0], A
|
||||
vmovdqu32 [SCRATCH + 64*1], B
|
||||
vmovdqu32 [SCRATCH + 64*2], C
|
||||
vmovdqu32 [SCRATCH + 64*3], D
|
||||
vmovdqu32 [SCRATCH + 64*4], E
|
||||
vmovdqu32 [SCRATCH + 64*5], F
|
||||
vmovdqu32 [SCRATCH + 64*6], G
|
||||
vmovdqu32 [SCRATCH + 64*7], H
|
||||
|
||||
add IDX, 64
|
||||
|
||||
// Transpose input data
|
||||
TRANSPOSE16(W0, W1, W2, W3, W4, W5, W6, W7, W8, W9, W10, W11, W12, W13, W14, W15, TMP0, TMP1)
|
||||
|
||||
vpshufb W0, W0, TMP2
|
||||
vpshufb W1, W1, TMP2
|
||||
vpshufb W2, W2, TMP2
|
||||
vpshufb W3, W3, TMP2
|
||||
vpshufb W4, W4, TMP2
|
||||
vpshufb W5, W5, TMP2
|
||||
vpshufb W6, W6, TMP2
|
||||
vpshufb W7, W7, TMP2
|
||||
vpshufb W8, W8, TMP2
|
||||
vpshufb W9, W9, TMP2
|
||||
vpshufb W10, W10, TMP2
|
||||
vpshufb W11, W11, TMP2
|
||||
vpshufb W12, W12, TMP2
|
||||
vpshufb W13, W13, TMP2
|
||||
vpshufb W14, W14, TMP2
|
||||
vpshufb W15, W15, TMP2
|
||||
|
||||
// MSG Schedule for W0-W15 is now complete in registers
|
||||
// Process first 48 rounds
|
||||
// Calculate next Wt+16 after processing is complete and Wt is unneeded
|
||||
|
||||
PROCESS_LOOP( W0, 0, A, B, C, D, E, F, G, H)
|
||||
MSG_SCHED_ROUND_16_63( W0, W1, W9, W14)
|
||||
PROCESS_LOOP( W1, 1, H, A, B, C, D, E, F, G)
|
||||
MSG_SCHED_ROUND_16_63( W1, W2, W10, W15)
|
||||
PROCESS_LOOP( W2, 2, G, H, A, B, C, D, E, F)
|
||||
MSG_SCHED_ROUND_16_63( W2, W3, W11, W0)
|
||||
PROCESS_LOOP( W3, 3, F, G, H, A, B, C, D, E)
|
||||
MSG_SCHED_ROUND_16_63( W3, W4, W12, W1)
|
||||
PROCESS_LOOP( W4, 4, E, F, G, H, A, B, C, D)
|
||||
MSG_SCHED_ROUND_16_63( W4, W5, W13, W2)
|
||||
PROCESS_LOOP( W5, 5, D, E, F, G, H, A, B, C)
|
||||
MSG_SCHED_ROUND_16_63( W5, W6, W14, W3)
|
||||
PROCESS_LOOP( W6, 6, C, D, E, F, G, H, A, B)
|
||||
MSG_SCHED_ROUND_16_63( W6, W7, W15, W4)
|
||||
PROCESS_LOOP( W7, 7, B, C, D, E, F, G, H, A)
|
||||
MSG_SCHED_ROUND_16_63( W7, W8, W0, W5)
|
||||
PROCESS_LOOP( W8, 8, A, B, C, D, E, F, G, H)
|
||||
MSG_SCHED_ROUND_16_63( W8, W9, W1, W6)
|
||||
PROCESS_LOOP( W9, 9, H, A, B, C, D, E, F, G)
|
||||
MSG_SCHED_ROUND_16_63( W9, W10, W2, W7)
|
||||
PROCESS_LOOP(W10, 10, G, H, A, B, C, D, E, F)
|
||||
MSG_SCHED_ROUND_16_63(W10, W11, W3, W8)
|
||||
PROCESS_LOOP(W11, 11, F, G, H, A, B, C, D, E)
|
||||
MSG_SCHED_ROUND_16_63(W11, W12, W4, W9)
|
||||
PROCESS_LOOP(W12, 12, E, F, G, H, A, B, C, D)
|
||||
MSG_SCHED_ROUND_16_63(W12, W13, W5, W10)
|
||||
PROCESS_LOOP(W13, 13, D, E, F, G, H, A, B, C)
|
||||
MSG_SCHED_ROUND_16_63(W13, W14, W6, W11)
|
||||
PROCESS_LOOP(W14, 14, C, D, E, F, G, H, A, B)
|
||||
MSG_SCHED_ROUND_16_63(W14, W15, W7, W12)
|
||||
PROCESS_LOOP(W15, 15, B, C, D, E, F, G, H, A)
|
||||
MSG_SCHED_ROUND_16_63(W15, W0, W8, W13)
|
||||
PROCESS_LOOP( W0, 16, A, B, C, D, E, F, G, H)
|
||||
MSG_SCHED_ROUND_16_63( W0, W1, W9, W14)
|
||||
PROCESS_LOOP( W1, 17, H, A, B, C, D, E, F, G)
|
||||
MSG_SCHED_ROUND_16_63( W1, W2, W10, W15)
|
||||
PROCESS_LOOP( W2, 18, G, H, A, B, C, D, E, F)
|
||||
MSG_SCHED_ROUND_16_63( W2, W3, W11, W0)
|
||||
PROCESS_LOOP( W3, 19, F, G, H, A, B, C, D, E)
|
||||
MSG_SCHED_ROUND_16_63( W3, W4, W12, W1)
|
||||
PROCESS_LOOP( W4, 20, E, F, G, H, A, B, C, D)
|
||||
MSG_SCHED_ROUND_16_63( W4, W5, W13, W2)
|
||||
PROCESS_LOOP( W5, 21, D, E, F, G, H, A, B, C)
|
||||
MSG_SCHED_ROUND_16_63( W5, W6, W14, W3)
|
||||
PROCESS_LOOP( W6, 22, C, D, E, F, G, H, A, B)
|
||||
MSG_SCHED_ROUND_16_63( W6, W7, W15, W4)
|
||||
PROCESS_LOOP( W7, 23, B, C, D, E, F, G, H, A)
|
||||
MSG_SCHED_ROUND_16_63( W7, W8, W0, W5)
|
||||
PROCESS_LOOP( W8, 24, A, B, C, D, E, F, G, H)
|
||||
MSG_SCHED_ROUND_16_63( W8, W9, W1, W6)
|
||||
PROCESS_LOOP( W9, 25, H, A, B, C, D, E, F, G)
|
||||
MSG_SCHED_ROUND_16_63( W9, W10, W2, W7)
|
||||
PROCESS_LOOP(W10, 26, G, H, A, B, C, D, E, F)
|
||||
MSG_SCHED_ROUND_16_63(W10, W11, W3, W8)
|
||||
PROCESS_LOOP(W11, 27, F, G, H, A, B, C, D, E)
|
||||
MSG_SCHED_ROUND_16_63(W11, W12, W4, W9)
|
||||
PROCESS_LOOP(W12, 28, E, F, G, H, A, B, C, D)
|
||||
MSG_SCHED_ROUND_16_63(W12, W13, W5, W10)
|
||||
PROCESS_LOOP(W13, 29, D, E, F, G, H, A, B, C)
|
||||
MSG_SCHED_ROUND_16_63(W13, W14, W6, W11)
|
||||
PROCESS_LOOP(W14, 30, C, D, E, F, G, H, A, B)
|
||||
MSG_SCHED_ROUND_16_63(W14, W15, W7, W12)
|
||||
PROCESS_LOOP(W15, 31, B, C, D, E, F, G, H, A)
|
||||
MSG_SCHED_ROUND_16_63(W15, W0, W8, W13)
|
||||
PROCESS_LOOP( W0, 32, A, B, C, D, E, F, G, H)
|
||||
MSG_SCHED_ROUND_16_63( W0, W1, W9, W14)
|
||||
PROCESS_LOOP( W1, 33, H, A, B, C, D, E, F, G)
|
||||
MSG_SCHED_ROUND_16_63( W1, W2, W10, W15)
|
||||
PROCESS_LOOP( W2, 34, G, H, A, B, C, D, E, F)
|
||||
MSG_SCHED_ROUND_16_63( W2, W3, W11, W0)
|
||||
PROCESS_LOOP( W3, 35, F, G, H, A, B, C, D, E)
|
||||
MSG_SCHED_ROUND_16_63( W3, W4, W12, W1)
|
||||
PROCESS_LOOP( W4, 36, E, F, G, H, A, B, C, D)
|
||||
MSG_SCHED_ROUND_16_63( W4, W5, W13, W2)
|
||||
PROCESS_LOOP( W5, 37, D, E, F, G, H, A, B, C)
|
||||
MSG_SCHED_ROUND_16_63( W5, W6, W14, W3)
|
||||
PROCESS_LOOP( W6, 38, C, D, E, F, G, H, A, B)
|
||||
MSG_SCHED_ROUND_16_63( W6, W7, W15, W4)
|
||||
PROCESS_LOOP( W7, 39, B, C, D, E, F, G, H, A)
|
||||
MSG_SCHED_ROUND_16_63( W7, W8, W0, W5)
|
||||
PROCESS_LOOP( W8, 40, A, B, C, D, E, F, G, H)
|
||||
MSG_SCHED_ROUND_16_63( W8, W9, W1, W6)
|
||||
PROCESS_LOOP( W9, 41, H, A, B, C, D, E, F, G)
|
||||
MSG_SCHED_ROUND_16_63( W9, W10, W2, W7)
|
||||
PROCESS_LOOP(W10, 42, G, H, A, B, C, D, E, F)
|
||||
MSG_SCHED_ROUND_16_63(W10, W11, W3, W8)
|
||||
PROCESS_LOOP(W11, 43, F, G, H, A, B, C, D, E)
|
||||
MSG_SCHED_ROUND_16_63(W11, W12, W4, W9)
|
||||
PROCESS_LOOP(W12, 44, E, F, G, H, A, B, C, D)
|
||||
MSG_SCHED_ROUND_16_63(W12, W13, W5, W10)
|
||||
PROCESS_LOOP(W13, 45, D, E, F, G, H, A, B, C)
|
||||
MSG_SCHED_ROUND_16_63(W13, W14, W6, W11)
|
||||
PROCESS_LOOP(W14, 46, C, D, E, F, G, H, A, B)
|
||||
MSG_SCHED_ROUND_16_63(W14, W15, W7, W12)
|
||||
PROCESS_LOOP(W15, 47, B, C, D, E, F, G, H, A)
|
||||
MSG_SCHED_ROUND_16_63(W15, W0, W8, W13)
|
||||
|
||||
// Check if this is the last block
|
||||
sub INP_SIZE, 1
|
||||
JE lastLoop
|
||||
|
||||
// Load next mask for inputs
|
||||
ADDQ $8, MASKP_P9
|
||||
MOVQ (MASKP_P9), MASK_P9
|
||||
|
||||
// Process last 16 rounds
|
||||
// Read in next block msg data for use in first 16 words of msg sched
|
||||
|
||||
PROCESS_LOOP( W0, 48, A, B, C, D, E, F, G, H)
|
||||
MSG_SCHED_ROUND_00_15( W0, 0, skipNext0)
|
||||
PROCESS_LOOP( W1, 49, H, A, B, C, D, E, F, G)
|
||||
MSG_SCHED_ROUND_00_15( W1, 1, skipNext1)
|
||||
PROCESS_LOOP( W2, 50, G, H, A, B, C, D, E, F)
|
||||
MSG_SCHED_ROUND_00_15( W2, 2, skipNext2)
|
||||
PROCESS_LOOP( W3, 51, F, G, H, A, B, C, D, E)
|
||||
MSG_SCHED_ROUND_00_15( W3, 3, skipNext3)
|
||||
PROCESS_LOOP( W4, 52, E, F, G, H, A, B, C, D)
|
||||
MSG_SCHED_ROUND_00_15( W4, 4, skipNext4)
|
||||
PROCESS_LOOP( W5, 53, D, E, F, G, H, A, B, C)
|
||||
MSG_SCHED_ROUND_00_15( W5, 5, skipNext5)
|
||||
PROCESS_LOOP( W6, 54, C, D, E, F, G, H, A, B)
|
||||
MSG_SCHED_ROUND_00_15( W6, 6, skipNext6)
|
||||
PROCESS_LOOP( W7, 55, B, C, D, E, F, G, H, A)
|
||||
MSG_SCHED_ROUND_00_15( W7, 7, skipNext7)
|
||||
PROCESS_LOOP( W8, 56, A, B, C, D, E, F, G, H)
|
||||
MSG_SCHED_ROUND_00_15( W8, 8, skipNext8)
|
||||
PROCESS_LOOP( W9, 57, H, A, B, C, D, E, F, G)
|
||||
MSG_SCHED_ROUND_00_15( W9, 9, skipNext9)
|
||||
PROCESS_LOOP(W10, 58, G, H, A, B, C, D, E, F)
|
||||
MSG_SCHED_ROUND_00_15(W10, 10, skipNext10)
|
||||
PROCESS_LOOP(W11, 59, F, G, H, A, B, C, D, E)
|
||||
MSG_SCHED_ROUND_00_15(W11, 11, skipNext11)
|
||||
PROCESS_LOOP(W12, 60, E, F, G, H, A, B, C, D)
|
||||
MSG_SCHED_ROUND_00_15(W12, 12, skipNext12)
|
||||
PROCESS_LOOP(W13, 61, D, E, F, G, H, A, B, C)
|
||||
MSG_SCHED_ROUND_00_15(W13, 13, skipNext13)
|
||||
PROCESS_LOOP(W14, 62, C, D, E, F, G, H, A, B)
|
||||
MSG_SCHED_ROUND_00_15(W14, 14, skipNext14)
|
||||
PROCESS_LOOP(W15, 63, B, C, D, E, F, G, H, A)
|
||||
MSG_SCHED_ROUND_00_15(W15, 15, skipNext15)
|
||||
|
||||
// Add old digest
|
||||
vmovdqu32 TMP2, A
|
||||
vmovdqu32 A, [SCRATCH + 64*0]
|
||||
vpaddd A{k1}, A, TMP2
|
||||
vmovdqu32 TMP2, B
|
||||
vmovdqu32 B, [SCRATCH + 64*1]
|
||||
vpaddd B{k1}, B, TMP2
|
||||
vmovdqu32 TMP2, C
|
||||
vmovdqu32 C, [SCRATCH + 64*2]
|
||||
vpaddd C{k1}, C, TMP2
|
||||
vmovdqu32 TMP2, D
|
||||
vmovdqu32 D, [SCRATCH + 64*3]
|
||||
vpaddd D{k1}, D, TMP2
|
||||
vmovdqu32 TMP2, E
|
||||
vmovdqu32 E, [SCRATCH + 64*4]
|
||||
vpaddd E{k1}, E, TMP2
|
||||
vmovdqu32 TMP2, F
|
||||
vmovdqu32 F, [SCRATCH + 64*5]
|
||||
vpaddd F{k1}, F, TMP2
|
||||
vmovdqu32 TMP2, G
|
||||
vmovdqu32 G, [SCRATCH + 64*6]
|
||||
vpaddd G{k1}, G, TMP2
|
||||
vmovdqu32 TMP2, H
|
||||
vmovdqu32 H, [SCRATCH + 64*7]
|
||||
vpaddd H{k1}, H, TMP2
|
||||
|
||||
kmovq k1, mask
|
||||
JMP lloop
|
||||
|
||||
lastLoop:
|
||||
// Process last 16 rounds
|
||||
PROCESS_LOOP( W0, 48, A, B, C, D, E, F, G, H)
|
||||
PROCESS_LOOP( W1, 49, H, A, B, C, D, E, F, G)
|
||||
PROCESS_LOOP( W2, 50, G, H, A, B, C, D, E, F)
|
||||
PROCESS_LOOP( W3, 51, F, G, H, A, B, C, D, E)
|
||||
PROCESS_LOOP( W4, 52, E, F, G, H, A, B, C, D)
|
||||
PROCESS_LOOP( W5, 53, D, E, F, G, H, A, B, C)
|
||||
PROCESS_LOOP( W6, 54, C, D, E, F, G, H, A, B)
|
||||
PROCESS_LOOP( W7, 55, B, C, D, E, F, G, H, A)
|
||||
PROCESS_LOOP( W8, 56, A, B, C, D, E, F, G, H)
|
||||
PROCESS_LOOP( W9, 57, H, A, B, C, D, E, F, G)
|
||||
PROCESS_LOOP(W10, 58, G, H, A, B, C, D, E, F)
|
||||
PROCESS_LOOP(W11, 59, F, G, H, A, B, C, D, E)
|
||||
PROCESS_LOOP(W12, 60, E, F, G, H, A, B, C, D)
|
||||
PROCESS_LOOP(W13, 61, D, E, F, G, H, A, B, C)
|
||||
PROCESS_LOOP(W14, 62, C, D, E, F, G, H, A, B)
|
||||
PROCESS_LOOP(W15, 63, B, C, D, E, F, G, H, A)
|
||||
|
||||
// Add old digest
|
||||
vmovdqu32 TMP2, A
|
||||
vmovdqu32 A, [SCRATCH + 64*0]
|
||||
vpaddd A{k1}, A, TMP2
|
||||
vmovdqu32 TMP2, B
|
||||
vmovdqu32 B, [SCRATCH + 64*1]
|
||||
vpaddd B{k1}, B, TMP2
|
||||
vmovdqu32 TMP2, C
|
||||
vmovdqu32 C, [SCRATCH + 64*2]
|
||||
vpaddd C{k1}, C, TMP2
|
||||
vmovdqu32 TMP2, D
|
||||
vmovdqu32 D, [SCRATCH + 64*3]
|
||||
vpaddd D{k1}, D, TMP2
|
||||
vmovdqu32 TMP2, E
|
||||
vmovdqu32 E, [SCRATCH + 64*4]
|
||||
vpaddd E{k1}, E, TMP2
|
||||
vmovdqu32 TMP2, F
|
||||
vmovdqu32 F, [SCRATCH + 64*5]
|
||||
vpaddd F{k1}, F, TMP2
|
||||
vmovdqu32 TMP2, G
|
||||
vmovdqu32 G, [SCRATCH + 64*6]
|
||||
vpaddd G{k1}, G, TMP2
|
||||
vmovdqu32 TMP2, H
|
||||
vmovdqu32 H, [SCRATCH + 64*7]
|
||||
vpaddd H{k1}, H, TMP2
|
||||
|
||||
// Write out digest
|
||||
vmovdqu32 [STATE + 0*SHA256_DIGEST_ROW_SIZE], A
|
||||
vmovdqu32 [STATE + 1*SHA256_DIGEST_ROW_SIZE], B
|
||||
vmovdqu32 [STATE + 2*SHA256_DIGEST_ROW_SIZE], C
|
||||
vmovdqu32 [STATE + 3*SHA256_DIGEST_ROW_SIZE], D
|
||||
vmovdqu32 [STATE + 4*SHA256_DIGEST_ROW_SIZE], E
|
||||
vmovdqu32 [STATE + 5*SHA256_DIGEST_ROW_SIZE], F
|
||||
vmovdqu32 [STATE + 6*SHA256_DIGEST_ROW_SIZE], G
|
||||
vmovdqu32 [STATE + 7*SHA256_DIGEST_ROW_SIZE], H
|
||||
|
||||
VZEROUPPER
|
||||
RET
|
||||
|
||||
//
|
||||
// Tables
|
||||
//
|
||||
|
||||
DATA PSHUFFLE_BYTE_FLIP_MASK<>+0x000(SB)/8, $0x0405060700010203
|
||||
DATA PSHUFFLE_BYTE_FLIP_MASK<>+0x008(SB)/8, $0x0c0d0e0f08090a0b
|
||||
DATA PSHUFFLE_BYTE_FLIP_MASK<>+0x010(SB)/8, $0x0405060700010203
|
||||
DATA PSHUFFLE_BYTE_FLIP_MASK<>+0x018(SB)/8, $0x0c0d0e0f08090a0b
|
||||
DATA PSHUFFLE_BYTE_FLIP_MASK<>+0x020(SB)/8, $0x0405060700010203
|
||||
DATA PSHUFFLE_BYTE_FLIP_MASK<>+0x028(SB)/8, $0x0c0d0e0f08090a0b
|
||||
DATA PSHUFFLE_BYTE_FLIP_MASK<>+0x030(SB)/8, $0x0405060700010203
|
||||
DATA PSHUFFLE_BYTE_FLIP_MASK<>+0x038(SB)/8, $0x0c0d0e0f08090a0b
|
||||
GLOBL PSHUFFLE_BYTE_FLIP_MASK<>(SB), 8, $64
|
||||
|
||||
DATA PSHUFFLE_TRANSPOSE16_MASK1<>+0x000(SB)/8, $0x0000000000000000
|
||||
DATA PSHUFFLE_TRANSPOSE16_MASK1<>+0x008(SB)/8, $0x0000000000000001
|
||||
DATA PSHUFFLE_TRANSPOSE16_MASK1<>+0x010(SB)/8, $0x0000000000000008
|
||||
DATA PSHUFFLE_TRANSPOSE16_MASK1<>+0x018(SB)/8, $0x0000000000000009
|
||||
DATA PSHUFFLE_TRANSPOSE16_MASK1<>+0x020(SB)/8, $0x0000000000000004
|
||||
DATA PSHUFFLE_TRANSPOSE16_MASK1<>+0x028(SB)/8, $0x0000000000000005
|
||||
DATA PSHUFFLE_TRANSPOSE16_MASK1<>+0x030(SB)/8, $0x000000000000000C
|
||||
DATA PSHUFFLE_TRANSPOSE16_MASK1<>+0x038(SB)/8, $0x000000000000000D
|
||||
GLOBL PSHUFFLE_TRANSPOSE16_MASK1<>(SB), 8, $64
|
||||
|
||||
DATA PSHUFFLE_TRANSPOSE16_MASK2<>+0x000(SB)/8, $0x0000000000000002
|
||||
DATA PSHUFFLE_TRANSPOSE16_MASK2<>+0x008(SB)/8, $0x0000000000000003
|
||||
DATA PSHUFFLE_TRANSPOSE16_MASK2<>+0x010(SB)/8, $0x000000000000000A
|
||||
DATA PSHUFFLE_TRANSPOSE16_MASK2<>+0x018(SB)/8, $0x000000000000000B
|
||||
DATA PSHUFFLE_TRANSPOSE16_MASK2<>+0x020(SB)/8, $0x0000000000000006
|
||||
DATA PSHUFFLE_TRANSPOSE16_MASK2<>+0x028(SB)/8, $0x0000000000000007
|
||||
DATA PSHUFFLE_TRANSPOSE16_MASK2<>+0x030(SB)/8, $0x000000000000000E
|
||||
DATA PSHUFFLE_TRANSPOSE16_MASK2<>+0x038(SB)/8, $0x000000000000000F
|
||||
GLOBL PSHUFFLE_TRANSPOSE16_MASK2<>(SB), 8, $64
|
501
vendor/github.com/minio/sha256-simd/sha256blockAvx512_amd64.go
generated
vendored
501
vendor/github.com/minio/sha256-simd/sha256blockAvx512_amd64.go
generated
vendored
@@ -1,501 +0,0 @@
|
||||
//go:build !noasm && !appengine && gc
|
||||
// +build !noasm,!appengine,gc
|
||||
|
||||
/*
|
||||
* Minio Cloud Storage, (C) 2017 Minio, 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 sha256
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"hash"
|
||||
"sort"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
)
|
||||
|
||||
//go:noescape
|
||||
func sha256X16Avx512(digests *[512]byte, scratch *[512]byte, table *[512]uint64, mask []uint64, inputs [16][]byte)
|
||||
|
||||
// Avx512ServerUID - Do not start at 0 but next multiple of 16 so as to be able to
|
||||
// differentiate with default initialiation value of 0
|
||||
const Avx512ServerUID = 16
|
||||
|
||||
var uidCounter uint64
|
||||
|
||||
// NewAvx512 - initialize sha256 Avx512 implementation.
|
||||
func NewAvx512(a512srv *Avx512Server) hash.Hash {
|
||||
uid := atomic.AddUint64(&uidCounter, 1)
|
||||
return &Avx512Digest{uid: uid, a512srv: a512srv}
|
||||
}
|
||||
|
||||
// Avx512Digest - Type for computing SHA256 using Avx512
|
||||
type Avx512Digest struct {
|
||||
uid uint64
|
||||
a512srv *Avx512Server
|
||||
x [chunk]byte
|
||||
nx int
|
||||
len uint64
|
||||
final bool
|
||||
result [Size]byte
|
||||
}
|
||||
|
||||
// Size - Return size of checksum
|
||||
func (d *Avx512Digest) Size() int { return Size }
|
||||
|
||||
// BlockSize - Return blocksize of checksum
|
||||
func (d Avx512Digest) BlockSize() int { return BlockSize }
|
||||
|
||||
// Reset - reset sha digest to its initial values
|
||||
func (d *Avx512Digest) Reset() {
|
||||
d.a512srv.blocksCh <- blockInput{uid: d.uid, reset: true}
|
||||
d.nx = 0
|
||||
d.len = 0
|
||||
d.final = false
|
||||
}
|
||||
|
||||
// Write to digest
|
||||
func (d *Avx512Digest) Write(p []byte) (nn int, err error) {
|
||||
|
||||
if d.final {
|
||||
return 0, errors.New("Avx512Digest already finalized. Reset first before writing again")
|
||||
}
|
||||
|
||||
nn = len(p)
|
||||
d.len += uint64(nn)
|
||||
if d.nx > 0 {
|
||||
n := copy(d.x[d.nx:], p)
|
||||
d.nx += n
|
||||
if d.nx == chunk {
|
||||
d.a512srv.blocksCh <- blockInput{uid: d.uid, msg: d.x[:]}
|
||||
d.nx = 0
|
||||
}
|
||||
p = p[n:]
|
||||
}
|
||||
if len(p) >= chunk {
|
||||
n := len(p) &^ (chunk - 1)
|
||||
d.a512srv.blocksCh <- blockInput{uid: d.uid, msg: p[:n]}
|
||||
p = p[n:]
|
||||
}
|
||||
if len(p) > 0 {
|
||||
d.nx = copy(d.x[:], p)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Sum - Return sha256 sum in bytes
|
||||
func (d *Avx512Digest) Sum(in []byte) (result []byte) {
|
||||
|
||||
if d.final {
|
||||
return append(in, d.result[:]...)
|
||||
}
|
||||
|
||||
trail := make([]byte, 0, 128)
|
||||
trail = append(trail, d.x[:d.nx]...)
|
||||
|
||||
len := d.len
|
||||
// Padding. Add a 1 bit and 0 bits until 56 bytes mod 64.
|
||||
var tmp [64]byte
|
||||
tmp[0] = 0x80
|
||||
if len%64 < 56 {
|
||||
trail = append(trail, tmp[0:56-len%64]...)
|
||||
} else {
|
||||
trail = append(trail, tmp[0:64+56-len%64]...)
|
||||
}
|
||||
d.nx = 0
|
||||
|
||||
// Length in bits.
|
||||
len <<= 3
|
||||
for i := uint(0); i < 8; i++ {
|
||||
tmp[i] = byte(len >> (56 - 8*i))
|
||||
}
|
||||
trail = append(trail, tmp[0:8]...)
|
||||
|
||||
sumCh := make(chan [Size]byte)
|
||||
d.a512srv.blocksCh <- blockInput{uid: d.uid, msg: trail, final: true, sumCh: sumCh}
|
||||
d.result = <-sumCh
|
||||
d.final = true
|
||||
return append(in, d.result[:]...)
|
||||
}
|
||||
|
||||
var table = [512]uint64{
|
||||
0x428a2f98428a2f98, 0x428a2f98428a2f98, 0x428a2f98428a2f98, 0x428a2f98428a2f98,
|
||||
0x428a2f98428a2f98, 0x428a2f98428a2f98, 0x428a2f98428a2f98, 0x428a2f98428a2f98,
|
||||
0x7137449171374491, 0x7137449171374491, 0x7137449171374491, 0x7137449171374491,
|
||||
0x7137449171374491, 0x7137449171374491, 0x7137449171374491, 0x7137449171374491,
|
||||
0xb5c0fbcfb5c0fbcf, 0xb5c0fbcfb5c0fbcf, 0xb5c0fbcfb5c0fbcf, 0xb5c0fbcfb5c0fbcf,
|
||||
0xb5c0fbcfb5c0fbcf, 0xb5c0fbcfb5c0fbcf, 0xb5c0fbcfb5c0fbcf, 0xb5c0fbcfb5c0fbcf,
|
||||
0xe9b5dba5e9b5dba5, 0xe9b5dba5e9b5dba5, 0xe9b5dba5e9b5dba5, 0xe9b5dba5e9b5dba5,
|
||||
0xe9b5dba5e9b5dba5, 0xe9b5dba5e9b5dba5, 0xe9b5dba5e9b5dba5, 0xe9b5dba5e9b5dba5,
|
||||
0x3956c25b3956c25b, 0x3956c25b3956c25b, 0x3956c25b3956c25b, 0x3956c25b3956c25b,
|
||||
0x3956c25b3956c25b, 0x3956c25b3956c25b, 0x3956c25b3956c25b, 0x3956c25b3956c25b,
|
||||
0x59f111f159f111f1, 0x59f111f159f111f1, 0x59f111f159f111f1, 0x59f111f159f111f1,
|
||||
0x59f111f159f111f1, 0x59f111f159f111f1, 0x59f111f159f111f1, 0x59f111f159f111f1,
|
||||
0x923f82a4923f82a4, 0x923f82a4923f82a4, 0x923f82a4923f82a4, 0x923f82a4923f82a4,
|
||||
0x923f82a4923f82a4, 0x923f82a4923f82a4, 0x923f82a4923f82a4, 0x923f82a4923f82a4,
|
||||
0xab1c5ed5ab1c5ed5, 0xab1c5ed5ab1c5ed5, 0xab1c5ed5ab1c5ed5, 0xab1c5ed5ab1c5ed5,
|
||||
0xab1c5ed5ab1c5ed5, 0xab1c5ed5ab1c5ed5, 0xab1c5ed5ab1c5ed5, 0xab1c5ed5ab1c5ed5,
|
||||
0xd807aa98d807aa98, 0xd807aa98d807aa98, 0xd807aa98d807aa98, 0xd807aa98d807aa98,
|
||||
0xd807aa98d807aa98, 0xd807aa98d807aa98, 0xd807aa98d807aa98, 0xd807aa98d807aa98,
|
||||
0x12835b0112835b01, 0x12835b0112835b01, 0x12835b0112835b01, 0x12835b0112835b01,
|
||||
0x12835b0112835b01, 0x12835b0112835b01, 0x12835b0112835b01, 0x12835b0112835b01,
|
||||
0x243185be243185be, 0x243185be243185be, 0x243185be243185be, 0x243185be243185be,
|
||||
0x243185be243185be, 0x243185be243185be, 0x243185be243185be, 0x243185be243185be,
|
||||
0x550c7dc3550c7dc3, 0x550c7dc3550c7dc3, 0x550c7dc3550c7dc3, 0x550c7dc3550c7dc3,
|
||||
0x550c7dc3550c7dc3, 0x550c7dc3550c7dc3, 0x550c7dc3550c7dc3, 0x550c7dc3550c7dc3,
|
||||
0x72be5d7472be5d74, 0x72be5d7472be5d74, 0x72be5d7472be5d74, 0x72be5d7472be5d74,
|
||||
0x72be5d7472be5d74, 0x72be5d7472be5d74, 0x72be5d7472be5d74, 0x72be5d7472be5d74,
|
||||
0x80deb1fe80deb1fe, 0x80deb1fe80deb1fe, 0x80deb1fe80deb1fe, 0x80deb1fe80deb1fe,
|
||||
0x80deb1fe80deb1fe, 0x80deb1fe80deb1fe, 0x80deb1fe80deb1fe, 0x80deb1fe80deb1fe,
|
||||
0x9bdc06a79bdc06a7, 0x9bdc06a79bdc06a7, 0x9bdc06a79bdc06a7, 0x9bdc06a79bdc06a7,
|
||||
0x9bdc06a79bdc06a7, 0x9bdc06a79bdc06a7, 0x9bdc06a79bdc06a7, 0x9bdc06a79bdc06a7,
|
||||
0xc19bf174c19bf174, 0xc19bf174c19bf174, 0xc19bf174c19bf174, 0xc19bf174c19bf174,
|
||||
0xc19bf174c19bf174, 0xc19bf174c19bf174, 0xc19bf174c19bf174, 0xc19bf174c19bf174,
|
||||
0xe49b69c1e49b69c1, 0xe49b69c1e49b69c1, 0xe49b69c1e49b69c1, 0xe49b69c1e49b69c1,
|
||||
0xe49b69c1e49b69c1, 0xe49b69c1e49b69c1, 0xe49b69c1e49b69c1, 0xe49b69c1e49b69c1,
|
||||
0xefbe4786efbe4786, 0xefbe4786efbe4786, 0xefbe4786efbe4786, 0xefbe4786efbe4786,
|
||||
0xefbe4786efbe4786, 0xefbe4786efbe4786, 0xefbe4786efbe4786, 0xefbe4786efbe4786,
|
||||
0x0fc19dc60fc19dc6, 0x0fc19dc60fc19dc6, 0x0fc19dc60fc19dc6, 0x0fc19dc60fc19dc6,
|
||||
0x0fc19dc60fc19dc6, 0x0fc19dc60fc19dc6, 0x0fc19dc60fc19dc6, 0x0fc19dc60fc19dc6,
|
||||
0x240ca1cc240ca1cc, 0x240ca1cc240ca1cc, 0x240ca1cc240ca1cc, 0x240ca1cc240ca1cc,
|
||||
0x240ca1cc240ca1cc, 0x240ca1cc240ca1cc, 0x240ca1cc240ca1cc, 0x240ca1cc240ca1cc,
|
||||
0x2de92c6f2de92c6f, 0x2de92c6f2de92c6f, 0x2de92c6f2de92c6f, 0x2de92c6f2de92c6f,
|
||||
0x2de92c6f2de92c6f, 0x2de92c6f2de92c6f, 0x2de92c6f2de92c6f, 0x2de92c6f2de92c6f,
|
||||
0x4a7484aa4a7484aa, 0x4a7484aa4a7484aa, 0x4a7484aa4a7484aa, 0x4a7484aa4a7484aa,
|
||||
0x4a7484aa4a7484aa, 0x4a7484aa4a7484aa, 0x4a7484aa4a7484aa, 0x4a7484aa4a7484aa,
|
||||
0x5cb0a9dc5cb0a9dc, 0x5cb0a9dc5cb0a9dc, 0x5cb0a9dc5cb0a9dc, 0x5cb0a9dc5cb0a9dc,
|
||||
0x5cb0a9dc5cb0a9dc, 0x5cb0a9dc5cb0a9dc, 0x5cb0a9dc5cb0a9dc, 0x5cb0a9dc5cb0a9dc,
|
||||
0x76f988da76f988da, 0x76f988da76f988da, 0x76f988da76f988da, 0x76f988da76f988da,
|
||||
0x76f988da76f988da, 0x76f988da76f988da, 0x76f988da76f988da, 0x76f988da76f988da,
|
||||
0x983e5152983e5152, 0x983e5152983e5152, 0x983e5152983e5152, 0x983e5152983e5152,
|
||||
0x983e5152983e5152, 0x983e5152983e5152, 0x983e5152983e5152, 0x983e5152983e5152,
|
||||
0xa831c66da831c66d, 0xa831c66da831c66d, 0xa831c66da831c66d, 0xa831c66da831c66d,
|
||||
0xa831c66da831c66d, 0xa831c66da831c66d, 0xa831c66da831c66d, 0xa831c66da831c66d,
|
||||
0xb00327c8b00327c8, 0xb00327c8b00327c8, 0xb00327c8b00327c8, 0xb00327c8b00327c8,
|
||||
0xb00327c8b00327c8, 0xb00327c8b00327c8, 0xb00327c8b00327c8, 0xb00327c8b00327c8,
|
||||
0xbf597fc7bf597fc7, 0xbf597fc7bf597fc7, 0xbf597fc7bf597fc7, 0xbf597fc7bf597fc7,
|
||||
0xbf597fc7bf597fc7, 0xbf597fc7bf597fc7, 0xbf597fc7bf597fc7, 0xbf597fc7bf597fc7,
|
||||
0xc6e00bf3c6e00bf3, 0xc6e00bf3c6e00bf3, 0xc6e00bf3c6e00bf3, 0xc6e00bf3c6e00bf3,
|
||||
0xc6e00bf3c6e00bf3, 0xc6e00bf3c6e00bf3, 0xc6e00bf3c6e00bf3, 0xc6e00bf3c6e00bf3,
|
||||
0xd5a79147d5a79147, 0xd5a79147d5a79147, 0xd5a79147d5a79147, 0xd5a79147d5a79147,
|
||||
0xd5a79147d5a79147, 0xd5a79147d5a79147, 0xd5a79147d5a79147, 0xd5a79147d5a79147,
|
||||
0x06ca635106ca6351, 0x06ca635106ca6351, 0x06ca635106ca6351, 0x06ca635106ca6351,
|
||||
0x06ca635106ca6351, 0x06ca635106ca6351, 0x06ca635106ca6351, 0x06ca635106ca6351,
|
||||
0x1429296714292967, 0x1429296714292967, 0x1429296714292967, 0x1429296714292967,
|
||||
0x1429296714292967, 0x1429296714292967, 0x1429296714292967, 0x1429296714292967,
|
||||
0x27b70a8527b70a85, 0x27b70a8527b70a85, 0x27b70a8527b70a85, 0x27b70a8527b70a85,
|
||||
0x27b70a8527b70a85, 0x27b70a8527b70a85, 0x27b70a8527b70a85, 0x27b70a8527b70a85,
|
||||
0x2e1b21382e1b2138, 0x2e1b21382e1b2138, 0x2e1b21382e1b2138, 0x2e1b21382e1b2138,
|
||||
0x2e1b21382e1b2138, 0x2e1b21382e1b2138, 0x2e1b21382e1b2138, 0x2e1b21382e1b2138,
|
||||
0x4d2c6dfc4d2c6dfc, 0x4d2c6dfc4d2c6dfc, 0x4d2c6dfc4d2c6dfc, 0x4d2c6dfc4d2c6dfc,
|
||||
0x4d2c6dfc4d2c6dfc, 0x4d2c6dfc4d2c6dfc, 0x4d2c6dfc4d2c6dfc, 0x4d2c6dfc4d2c6dfc,
|
||||
0x53380d1353380d13, 0x53380d1353380d13, 0x53380d1353380d13, 0x53380d1353380d13,
|
||||
0x53380d1353380d13, 0x53380d1353380d13, 0x53380d1353380d13, 0x53380d1353380d13,
|
||||
0x650a7354650a7354, 0x650a7354650a7354, 0x650a7354650a7354, 0x650a7354650a7354,
|
||||
0x650a7354650a7354, 0x650a7354650a7354, 0x650a7354650a7354, 0x650a7354650a7354,
|
||||
0x766a0abb766a0abb, 0x766a0abb766a0abb, 0x766a0abb766a0abb, 0x766a0abb766a0abb,
|
||||
0x766a0abb766a0abb, 0x766a0abb766a0abb, 0x766a0abb766a0abb, 0x766a0abb766a0abb,
|
||||
0x81c2c92e81c2c92e, 0x81c2c92e81c2c92e, 0x81c2c92e81c2c92e, 0x81c2c92e81c2c92e,
|
||||
0x81c2c92e81c2c92e, 0x81c2c92e81c2c92e, 0x81c2c92e81c2c92e, 0x81c2c92e81c2c92e,
|
||||
0x92722c8592722c85, 0x92722c8592722c85, 0x92722c8592722c85, 0x92722c8592722c85,
|
||||
0x92722c8592722c85, 0x92722c8592722c85, 0x92722c8592722c85, 0x92722c8592722c85,
|
||||
0xa2bfe8a1a2bfe8a1, 0xa2bfe8a1a2bfe8a1, 0xa2bfe8a1a2bfe8a1, 0xa2bfe8a1a2bfe8a1,
|
||||
0xa2bfe8a1a2bfe8a1, 0xa2bfe8a1a2bfe8a1, 0xa2bfe8a1a2bfe8a1, 0xa2bfe8a1a2bfe8a1,
|
||||
0xa81a664ba81a664b, 0xa81a664ba81a664b, 0xa81a664ba81a664b, 0xa81a664ba81a664b,
|
||||
0xa81a664ba81a664b, 0xa81a664ba81a664b, 0xa81a664ba81a664b, 0xa81a664ba81a664b,
|
||||
0xc24b8b70c24b8b70, 0xc24b8b70c24b8b70, 0xc24b8b70c24b8b70, 0xc24b8b70c24b8b70,
|
||||
0xc24b8b70c24b8b70, 0xc24b8b70c24b8b70, 0xc24b8b70c24b8b70, 0xc24b8b70c24b8b70,
|
||||
0xc76c51a3c76c51a3, 0xc76c51a3c76c51a3, 0xc76c51a3c76c51a3, 0xc76c51a3c76c51a3,
|
||||
0xc76c51a3c76c51a3, 0xc76c51a3c76c51a3, 0xc76c51a3c76c51a3, 0xc76c51a3c76c51a3,
|
||||
0xd192e819d192e819, 0xd192e819d192e819, 0xd192e819d192e819, 0xd192e819d192e819,
|
||||
0xd192e819d192e819, 0xd192e819d192e819, 0xd192e819d192e819, 0xd192e819d192e819,
|
||||
0xd6990624d6990624, 0xd6990624d6990624, 0xd6990624d6990624, 0xd6990624d6990624,
|
||||
0xd6990624d6990624, 0xd6990624d6990624, 0xd6990624d6990624, 0xd6990624d6990624,
|
||||
0xf40e3585f40e3585, 0xf40e3585f40e3585, 0xf40e3585f40e3585, 0xf40e3585f40e3585,
|
||||
0xf40e3585f40e3585, 0xf40e3585f40e3585, 0xf40e3585f40e3585, 0xf40e3585f40e3585,
|
||||
0x106aa070106aa070, 0x106aa070106aa070, 0x106aa070106aa070, 0x106aa070106aa070,
|
||||
0x106aa070106aa070, 0x106aa070106aa070, 0x106aa070106aa070, 0x106aa070106aa070,
|
||||
0x19a4c11619a4c116, 0x19a4c11619a4c116, 0x19a4c11619a4c116, 0x19a4c11619a4c116,
|
||||
0x19a4c11619a4c116, 0x19a4c11619a4c116, 0x19a4c11619a4c116, 0x19a4c11619a4c116,
|
||||
0x1e376c081e376c08, 0x1e376c081e376c08, 0x1e376c081e376c08, 0x1e376c081e376c08,
|
||||
0x1e376c081e376c08, 0x1e376c081e376c08, 0x1e376c081e376c08, 0x1e376c081e376c08,
|
||||
0x2748774c2748774c, 0x2748774c2748774c, 0x2748774c2748774c, 0x2748774c2748774c,
|
||||
0x2748774c2748774c, 0x2748774c2748774c, 0x2748774c2748774c, 0x2748774c2748774c,
|
||||
0x34b0bcb534b0bcb5, 0x34b0bcb534b0bcb5, 0x34b0bcb534b0bcb5, 0x34b0bcb534b0bcb5,
|
||||
0x34b0bcb534b0bcb5, 0x34b0bcb534b0bcb5, 0x34b0bcb534b0bcb5, 0x34b0bcb534b0bcb5,
|
||||
0x391c0cb3391c0cb3, 0x391c0cb3391c0cb3, 0x391c0cb3391c0cb3, 0x391c0cb3391c0cb3,
|
||||
0x391c0cb3391c0cb3, 0x391c0cb3391c0cb3, 0x391c0cb3391c0cb3, 0x391c0cb3391c0cb3,
|
||||
0x4ed8aa4a4ed8aa4a, 0x4ed8aa4a4ed8aa4a, 0x4ed8aa4a4ed8aa4a, 0x4ed8aa4a4ed8aa4a,
|
||||
0x4ed8aa4a4ed8aa4a, 0x4ed8aa4a4ed8aa4a, 0x4ed8aa4a4ed8aa4a, 0x4ed8aa4a4ed8aa4a,
|
||||
0x5b9cca4f5b9cca4f, 0x5b9cca4f5b9cca4f, 0x5b9cca4f5b9cca4f, 0x5b9cca4f5b9cca4f,
|
||||
0x5b9cca4f5b9cca4f, 0x5b9cca4f5b9cca4f, 0x5b9cca4f5b9cca4f, 0x5b9cca4f5b9cca4f,
|
||||
0x682e6ff3682e6ff3, 0x682e6ff3682e6ff3, 0x682e6ff3682e6ff3, 0x682e6ff3682e6ff3,
|
||||
0x682e6ff3682e6ff3, 0x682e6ff3682e6ff3, 0x682e6ff3682e6ff3, 0x682e6ff3682e6ff3,
|
||||
0x748f82ee748f82ee, 0x748f82ee748f82ee, 0x748f82ee748f82ee, 0x748f82ee748f82ee,
|
||||
0x748f82ee748f82ee, 0x748f82ee748f82ee, 0x748f82ee748f82ee, 0x748f82ee748f82ee,
|
||||
0x78a5636f78a5636f, 0x78a5636f78a5636f, 0x78a5636f78a5636f, 0x78a5636f78a5636f,
|
||||
0x78a5636f78a5636f, 0x78a5636f78a5636f, 0x78a5636f78a5636f, 0x78a5636f78a5636f,
|
||||
0x84c8781484c87814, 0x84c8781484c87814, 0x84c8781484c87814, 0x84c8781484c87814,
|
||||
0x84c8781484c87814, 0x84c8781484c87814, 0x84c8781484c87814, 0x84c8781484c87814,
|
||||
0x8cc702088cc70208, 0x8cc702088cc70208, 0x8cc702088cc70208, 0x8cc702088cc70208,
|
||||
0x8cc702088cc70208, 0x8cc702088cc70208, 0x8cc702088cc70208, 0x8cc702088cc70208,
|
||||
0x90befffa90befffa, 0x90befffa90befffa, 0x90befffa90befffa, 0x90befffa90befffa,
|
||||
0x90befffa90befffa, 0x90befffa90befffa, 0x90befffa90befffa, 0x90befffa90befffa,
|
||||
0xa4506ceba4506ceb, 0xa4506ceba4506ceb, 0xa4506ceba4506ceb, 0xa4506ceba4506ceb,
|
||||
0xa4506ceba4506ceb, 0xa4506ceba4506ceb, 0xa4506ceba4506ceb, 0xa4506ceba4506ceb,
|
||||
0xbef9a3f7bef9a3f7, 0xbef9a3f7bef9a3f7, 0xbef9a3f7bef9a3f7, 0xbef9a3f7bef9a3f7,
|
||||
0xbef9a3f7bef9a3f7, 0xbef9a3f7bef9a3f7, 0xbef9a3f7bef9a3f7, 0xbef9a3f7bef9a3f7,
|
||||
0xc67178f2c67178f2, 0xc67178f2c67178f2, 0xc67178f2c67178f2, 0xc67178f2c67178f2,
|
||||
0xc67178f2c67178f2, 0xc67178f2c67178f2, 0xc67178f2c67178f2, 0xc67178f2c67178f2}
|
||||
|
||||
// Interface function to assembly ode
|
||||
func blockAvx512(digests *[512]byte, input [16][]byte, mask []uint64) [16][Size]byte {
|
||||
|
||||
scratch := [512]byte{}
|
||||
sha256X16Avx512(digests, &scratch, &table, mask, input)
|
||||
|
||||
output := [16][Size]byte{}
|
||||
for i := 0; i < 16; i++ {
|
||||
output[i] = getDigest(i, digests[:])
|
||||
}
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
func getDigest(index int, state []byte) (sum [Size]byte) {
|
||||
for j := 0; j < 16; j += 2 {
|
||||
for i := index*4 + j*Size; i < index*4+(j+1)*Size; i += Size {
|
||||
binary.BigEndian.PutUint32(sum[j*2:], binary.LittleEndian.Uint32(state[i:i+4]))
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Message to send across input channel
|
||||
type blockInput struct {
|
||||
uid uint64
|
||||
msg []byte
|
||||
reset bool
|
||||
final bool
|
||||
sumCh chan [Size]byte
|
||||
}
|
||||
|
||||
// Avx512Server - Type to implement 16x parallel handling of SHA256 invocations
|
||||
type Avx512Server struct {
|
||||
blocksCh chan blockInput // Input channel
|
||||
totalIn int // Total number of inputs waiting to be processed
|
||||
lanes [16]Avx512LaneInfo // Array with info per lane (out of 16)
|
||||
digests map[uint64][Size]byte // Map of uids to (interim) digest results
|
||||
}
|
||||
|
||||
// Avx512LaneInfo - Info for each lane
|
||||
type Avx512LaneInfo struct {
|
||||
uid uint64 // unique identification for this SHA processing
|
||||
block []byte // input block to be processed
|
||||
outputCh chan [Size]byte // channel for output result
|
||||
}
|
||||
|
||||
// NewAvx512Server - Create new object for parallel processing handling
|
||||
func NewAvx512Server() *Avx512Server {
|
||||
a512srv := &Avx512Server{}
|
||||
a512srv.digests = make(map[uint64][Size]byte)
|
||||
a512srv.blocksCh = make(chan blockInput)
|
||||
|
||||
// Start a single thread for reading from the input channel
|
||||
go a512srv.Process()
|
||||
return a512srv
|
||||
}
|
||||
|
||||
// Process - Sole handler for reading from the input channel
|
||||
func (a512srv *Avx512Server) Process() {
|
||||
for {
|
||||
select {
|
||||
case block := <-a512srv.blocksCh:
|
||||
if block.reset {
|
||||
a512srv.reset(block.uid)
|
||||
continue
|
||||
}
|
||||
index := block.uid & 0xf
|
||||
// fmt.Println("Adding message:", block.uid, index)
|
||||
|
||||
if a512srv.lanes[index].block != nil { // If slot is already filled, process all inputs
|
||||
//fmt.Println("Invoking Blocks()")
|
||||
a512srv.blocks()
|
||||
}
|
||||
a512srv.totalIn++
|
||||
a512srv.lanes[index] = Avx512LaneInfo{uid: block.uid, block: block.msg}
|
||||
if block.final {
|
||||
a512srv.lanes[index].outputCh = block.sumCh
|
||||
}
|
||||
if a512srv.totalIn == len(a512srv.lanes) {
|
||||
// fmt.Println("Invoking Blocks() while FULL: ")
|
||||
a512srv.blocks()
|
||||
}
|
||||
|
||||
// TODO: test with larger timeout
|
||||
case <-time.After(1 * time.Microsecond):
|
||||
for _, lane := range a512srv.lanes {
|
||||
if lane.block != nil { // check if there is any input to process
|
||||
// fmt.Println("Invoking Blocks() on TIMEOUT: ")
|
||||
a512srv.blocks()
|
||||
break // we are done
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Do a reset for this calculation
|
||||
func (a512srv *Avx512Server) reset(uid uint64) {
|
||||
|
||||
// Check if there is a message still waiting to be processed (and remove if so)
|
||||
for i, lane := range a512srv.lanes {
|
||||
if lane.uid == uid {
|
||||
if lane.block != nil {
|
||||
a512srv.lanes[i] = Avx512LaneInfo{} // clear message
|
||||
a512srv.totalIn--
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Delete entry from hash map
|
||||
delete(a512srv.digests, uid)
|
||||
}
|
||||
|
||||
// Invoke assembly and send results back
|
||||
func (a512srv *Avx512Server) blocks() {
|
||||
|
||||
inputs := [16][]byte{}
|
||||
for i := range inputs {
|
||||
inputs[i] = a512srv.lanes[i].block
|
||||
}
|
||||
|
||||
mask := expandMask(genMask(inputs))
|
||||
outputs := blockAvx512(a512srv.getDigests(), inputs, mask)
|
||||
|
||||
a512srv.totalIn = 0
|
||||
for i := 0; i < len(outputs); i++ {
|
||||
uid, outputCh := a512srv.lanes[i].uid, a512srv.lanes[i].outputCh
|
||||
a512srv.digests[uid] = outputs[i]
|
||||
a512srv.lanes[i] = Avx512LaneInfo{}
|
||||
|
||||
if outputCh != nil {
|
||||
// Send back result
|
||||
outputCh <- outputs[i]
|
||||
delete(a512srv.digests, uid) // Delete entry from hashmap
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (a512srv *Avx512Server) Write(uid uint64, p []byte) (nn int, err error) {
|
||||
a512srv.blocksCh <- blockInput{uid: uid, msg: p}
|
||||
return len(p), nil
|
||||
}
|
||||
|
||||
// Sum - return sha256 sum in bytes for a given sum id.
|
||||
func (a512srv *Avx512Server) Sum(uid uint64, p []byte) [32]byte {
|
||||
sumCh := make(chan [32]byte)
|
||||
a512srv.blocksCh <- blockInput{uid: uid, msg: p, final: true, sumCh: sumCh}
|
||||
return <-sumCh
|
||||
}
|
||||
|
||||
func (a512srv *Avx512Server) getDigests() *[512]byte {
|
||||
digests := [512]byte{}
|
||||
for i, lane := range a512srv.lanes {
|
||||
a, ok := a512srv.digests[lane.uid]
|
||||
if ok {
|
||||
binary.BigEndian.PutUint32(digests[(i+0*16)*4:], binary.LittleEndian.Uint32(a[0:4]))
|
||||
binary.BigEndian.PutUint32(digests[(i+1*16)*4:], binary.LittleEndian.Uint32(a[4:8]))
|
||||
binary.BigEndian.PutUint32(digests[(i+2*16)*4:], binary.LittleEndian.Uint32(a[8:12]))
|
||||
binary.BigEndian.PutUint32(digests[(i+3*16)*4:], binary.LittleEndian.Uint32(a[12:16]))
|
||||
binary.BigEndian.PutUint32(digests[(i+4*16)*4:], binary.LittleEndian.Uint32(a[16:20]))
|
||||
binary.BigEndian.PutUint32(digests[(i+5*16)*4:], binary.LittleEndian.Uint32(a[20:24]))
|
||||
binary.BigEndian.PutUint32(digests[(i+6*16)*4:], binary.LittleEndian.Uint32(a[24:28]))
|
||||
binary.BigEndian.PutUint32(digests[(i+7*16)*4:], binary.LittleEndian.Uint32(a[28:32]))
|
||||
} else {
|
||||
binary.LittleEndian.PutUint32(digests[(i+0*16)*4:], init0)
|
||||
binary.LittleEndian.PutUint32(digests[(i+1*16)*4:], init1)
|
||||
binary.LittleEndian.PutUint32(digests[(i+2*16)*4:], init2)
|
||||
binary.LittleEndian.PutUint32(digests[(i+3*16)*4:], init3)
|
||||
binary.LittleEndian.PutUint32(digests[(i+4*16)*4:], init4)
|
||||
binary.LittleEndian.PutUint32(digests[(i+5*16)*4:], init5)
|
||||
binary.LittleEndian.PutUint32(digests[(i+6*16)*4:], init6)
|
||||
binary.LittleEndian.PutUint32(digests[(i+7*16)*4:], init7)
|
||||
}
|
||||
}
|
||||
return &digests
|
||||
}
|
||||
|
||||
// Helper struct for sorting blocks based on length
|
||||
type lane struct {
|
||||
len uint
|
||||
pos uint
|
||||
}
|
||||
|
||||
type lanes []lane
|
||||
|
||||
func (lns lanes) Len() int { return len(lns) }
|
||||
func (lns lanes) Swap(i, j int) { lns[i], lns[j] = lns[j], lns[i] }
|
||||
func (lns lanes) Less(i, j int) bool { return lns[i].len < lns[j].len }
|
||||
|
||||
// Helper struct for
|
||||
type maskRounds struct {
|
||||
mask uint64
|
||||
rounds uint64
|
||||
}
|
||||
|
||||
func genMask(input [16][]byte) [16]maskRounds {
|
||||
|
||||
// Sort on blocks length small to large
|
||||
var sorted [16]lane
|
||||
for c, inpt := range input {
|
||||
sorted[c] = lane{uint(len(inpt)), uint(c)}
|
||||
}
|
||||
sort.Sort(lanes(sorted[:]))
|
||||
|
||||
// Create mask array including 'rounds' between masks
|
||||
m, round, index := uint64(0xffff), uint64(0), 0
|
||||
var mr [16]maskRounds
|
||||
for _, s := range sorted {
|
||||
if s.len > 0 {
|
||||
if uint64(s.len)>>6 > round {
|
||||
mr[index] = maskRounds{m, (uint64(s.len) >> 6) - round}
|
||||
index++
|
||||
}
|
||||
round = uint64(s.len) >> 6
|
||||
}
|
||||
m = m & ^(1 << uint(s.pos))
|
||||
}
|
||||
|
||||
return mr
|
||||
}
|
||||
|
||||
// TODO: remove function
|
||||
func expandMask(mr [16]maskRounds) []uint64 {
|
||||
size := uint64(0)
|
||||
for _, r := range mr {
|
||||
size += r.rounds
|
||||
}
|
||||
result, index := make([]uint64, size), 0
|
||||
for _, r := range mr {
|
||||
for j := uint64(0); j < r.rounds; j++ {
|
||||
result[index] = r.mask
|
||||
index++
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
267
vendor/github.com/minio/sha256-simd/sha256blockAvx512_amd64.s
generated
vendored
267
vendor/github.com/minio/sha256-simd/sha256blockAvx512_amd64.s
generated
vendored
File diff suppressed because one or more lines are too long
31
vendor/github.com/minio/sha256-simd/sha256block_amd64.go
generated
vendored
31
vendor/github.com/minio/sha256-simd/sha256block_amd64.go
generated
vendored
@@ -1,31 +0,0 @@
|
||||
//go:build !noasm && !appengine && gc
|
||||
// +build !noasm,!appengine,gc
|
||||
|
||||
/*
|
||||
* Minio Cloud Storage, (C) 2016 Minio, 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 sha256
|
||||
|
||||
func blockArmSha2Go(dig *digest, p []byte) {
|
||||
panic("blockArmSha2Go called unexpectedly")
|
||||
}
|
||||
|
||||
//go:noescape
|
||||
func blockIntelSha(h *[8]uint32, message []uint8)
|
||||
|
||||
func blockIntelShaGo(dig *digest, p []byte) {
|
||||
blockIntelSha(&dig.h, p)
|
||||
}
|
266
vendor/github.com/minio/sha256-simd/sha256block_amd64.s
generated
vendored
266
vendor/github.com/minio/sha256-simd/sha256block_amd64.s
generated
vendored
@@ -1,266 +0,0 @@
|
||||
//+build !noasm,!appengine,gc
|
||||
|
||||
// SHA intrinsic version of SHA256
|
||||
|
||||
// Kristofer Peterson, (C) 2018.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT 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"
|
||||
|
||||
DATA K<>+0x00(SB)/4, $0x428a2f98
|
||||
DATA K<>+0x04(SB)/4, $0x71374491
|
||||
DATA K<>+0x08(SB)/4, $0xb5c0fbcf
|
||||
DATA K<>+0x0c(SB)/4, $0xe9b5dba5
|
||||
DATA K<>+0x10(SB)/4, $0x3956c25b
|
||||
DATA K<>+0x14(SB)/4, $0x59f111f1
|
||||
DATA K<>+0x18(SB)/4, $0x923f82a4
|
||||
DATA K<>+0x1c(SB)/4, $0xab1c5ed5
|
||||
DATA K<>+0x20(SB)/4, $0xd807aa98
|
||||
DATA K<>+0x24(SB)/4, $0x12835b01
|
||||
DATA K<>+0x28(SB)/4, $0x243185be
|
||||
DATA K<>+0x2c(SB)/4, $0x550c7dc3
|
||||
DATA K<>+0x30(SB)/4, $0x72be5d74
|
||||
DATA K<>+0x34(SB)/4, $0x80deb1fe
|
||||
DATA K<>+0x38(SB)/4, $0x9bdc06a7
|
||||
DATA K<>+0x3c(SB)/4, $0xc19bf174
|
||||
DATA K<>+0x40(SB)/4, $0xe49b69c1
|
||||
DATA K<>+0x44(SB)/4, $0xefbe4786
|
||||
DATA K<>+0x48(SB)/4, $0x0fc19dc6
|
||||
DATA K<>+0x4c(SB)/4, $0x240ca1cc
|
||||
DATA K<>+0x50(SB)/4, $0x2de92c6f
|
||||
DATA K<>+0x54(SB)/4, $0x4a7484aa
|
||||
DATA K<>+0x58(SB)/4, $0x5cb0a9dc
|
||||
DATA K<>+0x5c(SB)/4, $0x76f988da
|
||||
DATA K<>+0x60(SB)/4, $0x983e5152
|
||||
DATA K<>+0x64(SB)/4, $0xa831c66d
|
||||
DATA K<>+0x68(SB)/4, $0xb00327c8
|
||||
DATA K<>+0x6c(SB)/4, $0xbf597fc7
|
||||
DATA K<>+0x70(SB)/4, $0xc6e00bf3
|
||||
DATA K<>+0x74(SB)/4, $0xd5a79147
|
||||
DATA K<>+0x78(SB)/4, $0x06ca6351
|
||||
DATA K<>+0x7c(SB)/4, $0x14292967
|
||||
DATA K<>+0x80(SB)/4, $0x27b70a85
|
||||
DATA K<>+0x84(SB)/4, $0x2e1b2138
|
||||
DATA K<>+0x88(SB)/4, $0x4d2c6dfc
|
||||
DATA K<>+0x8c(SB)/4, $0x53380d13
|
||||
DATA K<>+0x90(SB)/4, $0x650a7354
|
||||
DATA K<>+0x94(SB)/4, $0x766a0abb
|
||||
DATA K<>+0x98(SB)/4, $0x81c2c92e
|
||||
DATA K<>+0x9c(SB)/4, $0x92722c85
|
||||
DATA K<>+0xa0(SB)/4, $0xa2bfe8a1
|
||||
DATA K<>+0xa4(SB)/4, $0xa81a664b
|
||||
DATA K<>+0xa8(SB)/4, $0xc24b8b70
|
||||
DATA K<>+0xac(SB)/4, $0xc76c51a3
|
||||
DATA K<>+0xb0(SB)/4, $0xd192e819
|
||||
DATA K<>+0xb4(SB)/4, $0xd6990624
|
||||
DATA K<>+0xb8(SB)/4, $0xf40e3585
|
||||
DATA K<>+0xbc(SB)/4, $0x106aa070
|
||||
DATA K<>+0xc0(SB)/4, $0x19a4c116
|
||||
DATA K<>+0xc4(SB)/4, $0x1e376c08
|
||||
DATA K<>+0xc8(SB)/4, $0x2748774c
|
||||
DATA K<>+0xcc(SB)/4, $0x34b0bcb5
|
||||
DATA K<>+0xd0(SB)/4, $0x391c0cb3
|
||||
DATA K<>+0xd4(SB)/4, $0x4ed8aa4a
|
||||
DATA K<>+0xd8(SB)/4, $0x5b9cca4f
|
||||
DATA K<>+0xdc(SB)/4, $0x682e6ff3
|
||||
DATA K<>+0xe0(SB)/4, $0x748f82ee
|
||||
DATA K<>+0xe4(SB)/4, $0x78a5636f
|
||||
DATA K<>+0xe8(SB)/4, $0x84c87814
|
||||
DATA K<>+0xec(SB)/4, $0x8cc70208
|
||||
DATA K<>+0xf0(SB)/4, $0x90befffa
|
||||
DATA K<>+0xf4(SB)/4, $0xa4506ceb
|
||||
DATA K<>+0xf8(SB)/4, $0xbef9a3f7
|
||||
DATA K<>+0xfc(SB)/4, $0xc67178f2
|
||||
GLOBL K<>(SB), RODATA|NOPTR, $256
|
||||
|
||||
DATA SHUF_MASK<>+0x00(SB)/8, $0x0405060700010203
|
||||
DATA SHUF_MASK<>+0x08(SB)/8, $0x0c0d0e0f08090a0b
|
||||
GLOBL SHUF_MASK<>(SB), RODATA|NOPTR, $16
|
||||
|
||||
// Register Usage
|
||||
// BX base address of constant table (constant)
|
||||
// DX hash_state (constant)
|
||||
// SI hash_data.data
|
||||
// DI hash_data.data + hash_data.length - 64 (constant)
|
||||
// X0 scratch
|
||||
// X1 scratch
|
||||
// X2 working hash state // ABEF
|
||||
// X3 working hash state // CDGH
|
||||
// X4 first 16 bytes of block
|
||||
// X5 second 16 bytes of block
|
||||
// X6 third 16 bytes of block
|
||||
// X7 fourth 16 bytes of block
|
||||
// X12 saved hash state // ABEF
|
||||
// X13 saved hash state // CDGH
|
||||
// X15 data shuffle mask (constant)
|
||||
|
||||
TEXT ·blockIntelSha(SB), NOSPLIT, $0-32
|
||||
MOVQ h+0(FP), DX
|
||||
MOVQ message_base+8(FP), SI
|
||||
MOVQ message_len+16(FP), DI
|
||||
LEAQ -64(SI)(DI*1), DI
|
||||
MOVOU (DX), X2
|
||||
MOVOU 16(DX), X1
|
||||
MOVO X2, X3
|
||||
PUNPCKLLQ X1, X2
|
||||
PUNPCKHLQ X1, X3
|
||||
PSHUFD $0x27, X2, X2
|
||||
PSHUFD $0x27, X3, X3
|
||||
MOVO SHUF_MASK<>(SB), X15
|
||||
LEAQ K<>(SB), BX
|
||||
|
||||
JMP TEST
|
||||
|
||||
LOOP:
|
||||
MOVO X2, X12
|
||||
MOVO X3, X13
|
||||
|
||||
// load block and shuffle
|
||||
MOVOU (SI), X4
|
||||
MOVOU 16(SI), X5
|
||||
MOVOU 32(SI), X6
|
||||
MOVOU 48(SI), X7
|
||||
PSHUFB X15, X4
|
||||
PSHUFB X15, X5
|
||||
PSHUFB X15, X6
|
||||
PSHUFB X15, X7
|
||||
|
||||
#define ROUND456 \
|
||||
PADDL X5, X0 \
|
||||
LONG $0xdacb380f \ // SHA256RNDS2 XMM3, XMM2
|
||||
MOVO X5, X1 \
|
||||
LONG $0x0f3a0f66; WORD $0x04cc \ // PALIGNR XMM1, XMM4, 4
|
||||
PADDL X1, X6 \
|
||||
LONG $0xf5cd380f \ // SHA256MSG2 XMM6, XMM5
|
||||
PSHUFD $0x4e, X0, X0 \
|
||||
LONG $0xd3cb380f \ // SHA256RNDS2 XMM2, XMM3
|
||||
LONG $0xe5cc380f // SHA256MSG1 XMM4, XMM5
|
||||
|
||||
#define ROUND567 \
|
||||
PADDL X6, X0 \
|
||||
LONG $0xdacb380f \ // SHA256RNDS2 XMM3, XMM2
|
||||
MOVO X6, X1 \
|
||||
LONG $0x0f3a0f66; WORD $0x04cd \ // PALIGNR XMM1, XMM5, 4
|
||||
PADDL X1, X7 \
|
||||
LONG $0xfecd380f \ // SHA256MSG2 XMM7, XMM6
|
||||
PSHUFD $0x4e, X0, X0 \
|
||||
LONG $0xd3cb380f \ // SHA256RNDS2 XMM2, XMM3
|
||||
LONG $0xeecc380f // SHA256MSG1 XMM5, XMM6
|
||||
|
||||
#define ROUND674 \
|
||||
PADDL X7, X0 \
|
||||
LONG $0xdacb380f \ // SHA256RNDS2 XMM3, XMM2
|
||||
MOVO X7, X1 \
|
||||
LONG $0x0f3a0f66; WORD $0x04ce \ // PALIGNR XMM1, XMM6, 4
|
||||
PADDL X1, X4 \
|
||||
LONG $0xe7cd380f \ // SHA256MSG2 XMM4, XMM7
|
||||
PSHUFD $0x4e, X0, X0 \
|
||||
LONG $0xd3cb380f \ // SHA256RNDS2 XMM2, XMM3
|
||||
LONG $0xf7cc380f // SHA256MSG1 XMM6, XMM7
|
||||
|
||||
#define ROUND745 \
|
||||
PADDL X4, X0 \
|
||||
LONG $0xdacb380f \ // SHA256RNDS2 XMM3, XMM2
|
||||
MOVO X4, X1 \
|
||||
LONG $0x0f3a0f66; WORD $0x04cf \ // PALIGNR XMM1, XMM7, 4
|
||||
PADDL X1, X5 \
|
||||
LONG $0xeccd380f \ // SHA256MSG2 XMM5, XMM4
|
||||
PSHUFD $0x4e, X0, X0 \
|
||||
LONG $0xd3cb380f \ // SHA256RNDS2 XMM2, XMM3
|
||||
LONG $0xfccc380f // SHA256MSG1 XMM7, XMM4
|
||||
|
||||
// rounds 0-3
|
||||
MOVO (BX), X0
|
||||
PADDL X4, X0
|
||||
LONG $0xdacb380f // SHA256RNDS2 XMM3, XMM2
|
||||
PSHUFD $0x4e, X0, X0
|
||||
LONG $0xd3cb380f // SHA256RNDS2 XMM2, XMM3
|
||||
|
||||
// rounds 4-7
|
||||
MOVO 1*16(BX), X0
|
||||
PADDL X5, X0
|
||||
LONG $0xdacb380f // SHA256RNDS2 XMM3, XMM2
|
||||
PSHUFD $0x4e, X0, X0
|
||||
LONG $0xd3cb380f // SHA256RNDS2 XMM2, XMM3
|
||||
LONG $0xe5cc380f // SHA256MSG1 XMM4, XMM5
|
||||
|
||||
// rounds 8-11
|
||||
MOVO 2*16(BX), X0
|
||||
PADDL X6, X0
|
||||
LONG $0xdacb380f // SHA256RNDS2 XMM3, XMM2
|
||||
PSHUFD $0x4e, X0, X0
|
||||
LONG $0xd3cb380f // SHA256RNDS2 XMM2, XMM3
|
||||
LONG $0xeecc380f // SHA256MSG1 XMM5, XMM6
|
||||
|
||||
MOVO 3*16(BX), X0; ROUND674 // rounds 12-15
|
||||
MOVO 4*16(BX), X0; ROUND745 // rounds 16-19
|
||||
MOVO 5*16(BX), X0; ROUND456 // rounds 20-23
|
||||
MOVO 6*16(BX), X0; ROUND567 // rounds 24-27
|
||||
MOVO 7*16(BX), X0; ROUND674 // rounds 28-31
|
||||
MOVO 8*16(BX), X0; ROUND745 // rounds 32-35
|
||||
MOVO 9*16(BX), X0; ROUND456 // rounds 36-39
|
||||
MOVO 10*16(BX), X0; ROUND567 // rounds 40-43
|
||||
MOVO 11*16(BX), X0; ROUND674 // rounds 44-47
|
||||
MOVO 12*16(BX), X0; ROUND745 // rounds 48-51
|
||||
|
||||
// rounds 52-55
|
||||
MOVO 13*16(BX), X0
|
||||
PADDL X5, X0
|
||||
LONG $0xdacb380f // SHA256RNDS2 XMM3, XMM2
|
||||
MOVO X5, X1
|
||||
LONG $0x0f3a0f66; WORD $0x04cc // PALIGNR XMM1, XMM4, 4
|
||||
PADDL X1, X6
|
||||
LONG $0xf5cd380f // SHA256MSG2 XMM6, XMM5
|
||||
PSHUFD $0x4e, X0, X0
|
||||
LONG $0xd3cb380f // SHA256RNDS2 XMM2, XMM3
|
||||
|
||||
// rounds 56-59
|
||||
MOVO 14*16(BX), X0
|
||||
PADDL X6, X0
|
||||
LONG $0xdacb380f // SHA256RNDS2 XMM3, XMM2
|
||||
MOVO X6, X1
|
||||
LONG $0x0f3a0f66; WORD $0x04cd // PALIGNR XMM1, XMM5, 4
|
||||
PADDL X1, X7
|
||||
LONG $0xfecd380f // SHA256MSG2 XMM7, XMM6
|
||||
PSHUFD $0x4e, X0, X0
|
||||
LONG $0xd3cb380f // SHA256RNDS2 XMM2, XMM3
|
||||
|
||||
// rounds 60-63
|
||||
MOVO 15*16(BX), X0
|
||||
PADDL X7, X0
|
||||
LONG $0xdacb380f // SHA256RNDS2 XMM3, XMM2
|
||||
PSHUFD $0x4e, X0, X0
|
||||
LONG $0xd3cb380f // SHA256RNDS2 XMM2, XMM3
|
||||
|
||||
PADDL X12, X2
|
||||
PADDL X13, X3
|
||||
|
||||
ADDQ $64, SI
|
||||
|
||||
TEST:
|
||||
CMPQ SI, DI
|
||||
JBE LOOP
|
||||
|
||||
PSHUFD $0x4e, X3, X0
|
||||
LONG $0x0e3a0f66; WORD $0xf0c2 // PBLENDW XMM0, XMM2, 0xf0
|
||||
PSHUFD $0x4e, X2, X1
|
||||
LONG $0x0e3a0f66; WORD $0x0fcb // PBLENDW XMM1, XMM3, 0x0f
|
||||
PSHUFD $0x1b, X0, X0
|
||||
PSHUFD $0x1b, X1, X1
|
||||
|
||||
MOVOU X0, (DX)
|
||||
MOVOU X1, 16(DX)
|
||||
|
||||
RET
|
37
vendor/github.com/minio/sha256-simd/sha256block_arm64.go
generated
vendored
37
vendor/github.com/minio/sha256-simd/sha256block_arm64.go
generated
vendored
@@ -1,37 +0,0 @@
|
||||
//go:build !noasm && !appengine && gc
|
||||
// +build !noasm,!appengine,gc
|
||||
|
||||
/*
|
||||
* Minio Cloud Storage, (C) 2016 Minio, 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 sha256
|
||||
|
||||
func blockIntelShaGo(dig *digest, p []byte) {
|
||||
panic("blockIntelShaGo called unexpectedly")
|
||||
}
|
||||
|
||||
//go:noescape
|
||||
func blockArmSha2(h []uint32, message []uint8)
|
||||
|
||||
func blockArmSha2Go(dig *digest, p []byte) {
|
||||
|
||||
h := []uint32{dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7]}
|
||||
|
||||
blockArmSha2(h[:], p[:])
|
||||
|
||||
dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7] = h[0], h[1], h[2], h[3], h[4],
|
||||
h[5], h[6], h[7]
|
||||
}
|
192
vendor/github.com/minio/sha256-simd/sha256block_arm64.s
generated
vendored
192
vendor/github.com/minio/sha256-simd/sha256block_arm64.s
generated
vendored
@@ -1,192 +0,0 @@
|
||||
//+build !noasm,!appengine,gc
|
||||
|
||||
// ARM64 version of SHA256
|
||||
|
||||
//
|
||||
// Minio Cloud Storage, (C) 2016 Minio, 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.
|
||||
//
|
||||
|
||||
//
|
||||
// Based on implementation as found in https://github.com/jocover/sha256-armv8
|
||||
//
|
||||
// Use github.com/minio/asm2plan9s on this file to assemble ARM instructions to
|
||||
// their Plan9 equivalents
|
||||
//
|
||||
|
||||
TEXT ·blockArmSha2(SB), 7, $0
|
||||
MOVD h+0(FP), R0
|
||||
MOVD message+24(FP), R1
|
||||
MOVD message_len+32(FP), R2 // length of message
|
||||
SUBS $64, R2
|
||||
BMI complete
|
||||
|
||||
// Load constants table pointer
|
||||
MOVD $·constants(SB), R3
|
||||
|
||||
// Cache constants table in registers v16 - v31
|
||||
WORD $0x4cdf2870 // ld1 {v16.4s-v19.4s}, [x3], #64
|
||||
WORD $0x4cdf7800 // ld1 {v0.4s}, [x0], #16
|
||||
WORD $0x4cdf2874 // ld1 {v20.4s-v23.4s}, [x3], #64
|
||||
|
||||
WORD $0x4c407801 // ld1 {v1.4s}, [x0]
|
||||
WORD $0x4cdf2878 // ld1 {v24.4s-v27.4s}, [x3], #64
|
||||
WORD $0xd1004000 // sub x0, x0, #0x10
|
||||
WORD $0x4cdf287c // ld1 {v28.4s-v31.4s}, [x3], #64
|
||||
|
||||
loop:
|
||||
// Main loop
|
||||
WORD $0x4cdf2025 // ld1 {v5.16b-v8.16b}, [x1], #64
|
||||
WORD $0x4ea01c02 // mov v2.16b, v0.16b
|
||||
WORD $0x4ea11c23 // mov v3.16b, v1.16b
|
||||
WORD $0x6e2008a5 // rev32 v5.16b, v5.16b
|
||||
WORD $0x6e2008c6 // rev32 v6.16b, v6.16b
|
||||
WORD $0x4eb084a9 // add v9.4s, v5.4s, v16.4s
|
||||
WORD $0x6e2008e7 // rev32 v7.16b, v7.16b
|
||||
WORD $0x4eb184ca // add v10.4s, v6.4s, v17.4s
|
||||
WORD $0x4ea21c44 // mov v4.16b, v2.16b
|
||||
WORD $0x5e094062 // sha256h q2, q3, v9.4s
|
||||
WORD $0x5e095083 // sha256h2 q3, q4, v9.4s
|
||||
WORD $0x5e2828c5 // sha256su0 v5.4s, v6.4s
|
||||
WORD $0x6e200908 // rev32 v8.16b, v8.16b
|
||||
WORD $0x4eb284e9 // add v9.4s, v7.4s, v18.4s
|
||||
WORD $0x4ea21c44 // mov v4.16b, v2.16b
|
||||
WORD $0x5e0a4062 // sha256h q2, q3, v10.4s
|
||||
WORD $0x5e0a5083 // sha256h2 q3, q4, v10.4s
|
||||
WORD $0x5e2828e6 // sha256su0 v6.4s, v7.4s
|
||||
WORD $0x5e0860e5 // sha256su1 v5.4s, v7.4s, v8.4s
|
||||
WORD $0x4eb3850a // add v10.4s, v8.4s, v19.4s
|
||||
WORD $0x4ea21c44 // mov v4.16b, v2.16b
|
||||
WORD $0x5e094062 // sha256h q2, q3, v9.4s
|
||||
WORD $0x5e095083 // sha256h2 q3, q4, v9.4s
|
||||
WORD $0x5e282907 // sha256su0 v7.4s, v8.4s
|
||||
WORD $0x5e056106 // sha256su1 v6.4s, v8.4s, v5.4s
|
||||
WORD $0x4eb484a9 // add v9.4s, v5.4s, v20.4s
|
||||
WORD $0x4ea21c44 // mov v4.16b, v2.16b
|
||||
WORD $0x5e0a4062 // sha256h q2, q3, v10.4s
|
||||
WORD $0x5e0a5083 // sha256h2 q3, q4, v10.4s
|
||||
WORD $0x5e2828a8 // sha256su0 v8.4s, v5.4s
|
||||
WORD $0x5e0660a7 // sha256su1 v7.4s, v5.4s, v6.4s
|
||||
WORD $0x4eb584ca // add v10.4s, v6.4s, v21.4s
|
||||
WORD $0x4ea21c44 // mov v4.16b, v2.16b
|
||||
WORD $0x5e094062 // sha256h q2, q3, v9.4s
|
||||
WORD $0x5e095083 // sha256h2 q3, q4, v9.4s
|
||||
WORD $0x5e2828c5 // sha256su0 v5.4s, v6.4s
|
||||
WORD $0x5e0760c8 // sha256su1 v8.4s, v6.4s, v7.4s
|
||||
WORD $0x4eb684e9 // add v9.4s, v7.4s, v22.4s
|
||||
WORD $0x4ea21c44 // mov v4.16b, v2.16b
|
||||
WORD $0x5e0a4062 // sha256h q2, q3, v10.4s
|
||||
WORD $0x5e0a5083 // sha256h2 q3, q4, v10.4s
|
||||
WORD $0x5e2828e6 // sha256su0 v6.4s, v7.4s
|
||||
WORD $0x5e0860e5 // sha256su1 v5.4s, v7.4s, v8.4s
|
||||
WORD $0x4eb7850a // add v10.4s, v8.4s, v23.4s
|
||||
WORD $0x4ea21c44 // mov v4.16b, v2.16b
|
||||
WORD $0x5e094062 // sha256h q2, q3, v9.4s
|
||||
WORD $0x5e095083 // sha256h2 q3, q4, v9.4s
|
||||
WORD $0x5e282907 // sha256su0 v7.4s, v8.4s
|
||||
WORD $0x5e056106 // sha256su1 v6.4s, v8.4s, v5.4s
|
||||
WORD $0x4eb884a9 // add v9.4s, v5.4s, v24.4s
|
||||
WORD $0x4ea21c44 // mov v4.16b, v2.16b
|
||||
WORD $0x5e0a4062 // sha256h q2, q3, v10.4s
|
||||
WORD $0x5e0a5083 // sha256h2 q3, q4, v10.4s
|
||||
WORD $0x5e2828a8 // sha256su0 v8.4s, v5.4s
|
||||
WORD $0x5e0660a7 // sha256su1 v7.4s, v5.4s, v6.4s
|
||||
WORD $0x4eb984ca // add v10.4s, v6.4s, v25.4s
|
||||
WORD $0x4ea21c44 // mov v4.16b, v2.16b
|
||||
WORD $0x5e094062 // sha256h q2, q3, v9.4s
|
||||
WORD $0x5e095083 // sha256h2 q3, q4, v9.4s
|
||||
WORD $0x5e2828c5 // sha256su0 v5.4s, v6.4s
|
||||
WORD $0x5e0760c8 // sha256su1 v8.4s, v6.4s, v7.4s
|
||||
WORD $0x4eba84e9 // add v9.4s, v7.4s, v26.4s
|
||||
WORD $0x4ea21c44 // mov v4.16b, v2.16b
|
||||
WORD $0x5e0a4062 // sha256h q2, q3, v10.4s
|
||||
WORD $0x5e0a5083 // sha256h2 q3, q4, v10.4s
|
||||
WORD $0x5e2828e6 // sha256su0 v6.4s, v7.4s
|
||||
WORD $0x5e0860e5 // sha256su1 v5.4s, v7.4s, v8.4s
|
||||
WORD $0x4ebb850a // add v10.4s, v8.4s, v27.4s
|
||||
WORD $0x4ea21c44 // mov v4.16b, v2.16b
|
||||
WORD $0x5e094062 // sha256h q2, q3, v9.4s
|
||||
WORD $0x5e095083 // sha256h2 q3, q4, v9.4s
|
||||
WORD $0x5e282907 // sha256su0 v7.4s, v8.4s
|
||||
WORD $0x5e056106 // sha256su1 v6.4s, v8.4s, v5.4s
|
||||
WORD $0x4ebc84a9 // add v9.4s, v5.4s, v28.4s
|
||||
WORD $0x4ea21c44 // mov v4.16b, v2.16b
|
||||
WORD $0x5e0a4062 // sha256h q2, q3, v10.4s
|
||||
WORD $0x5e0a5083 // sha256h2 q3, q4, v10.4s
|
||||
WORD $0x5e2828a8 // sha256su0 v8.4s, v5.4s
|
||||
WORD $0x5e0660a7 // sha256su1 v7.4s, v5.4s, v6.4s
|
||||
WORD $0x4ebd84ca // add v10.4s, v6.4s, v29.4s
|
||||
WORD $0x4ea21c44 // mov v4.16b, v2.16b
|
||||
WORD $0x5e094062 // sha256h q2, q3, v9.4s
|
||||
WORD $0x5e095083 // sha256h2 q3, q4, v9.4s
|
||||
WORD $0x5e0760c8 // sha256su1 v8.4s, v6.4s, v7.4s
|
||||
WORD $0x4ebe84e9 // add v9.4s, v7.4s, v30.4s
|
||||
WORD $0x4ea21c44 // mov v4.16b, v2.16b
|
||||
WORD $0x5e0a4062 // sha256h q2, q3, v10.4s
|
||||
WORD $0x5e0a5083 // sha256h2 q3, q4, v10.4s
|
||||
WORD $0x4ebf850a // add v10.4s, v8.4s, v31.4s
|
||||
WORD $0x4ea21c44 // mov v4.16b, v2.16b
|
||||
WORD $0x5e094062 // sha256h q2, q3, v9.4s
|
||||
WORD $0x5e095083 // sha256h2 q3, q4, v9.4s
|
||||
WORD $0x4ea21c44 // mov v4.16b, v2.16b
|
||||
WORD $0x5e0a4062 // sha256h q2, q3, v10.4s
|
||||
WORD $0x5e0a5083 // sha256h2 q3, q4, v10.4s
|
||||
WORD $0x4ea38421 // add v1.4s, v1.4s, v3.4s
|
||||
WORD $0x4ea28400 // add v0.4s, v0.4s, v2.4s
|
||||
|
||||
SUBS $64, R2
|
||||
BPL loop
|
||||
|
||||
// Store result
|
||||
WORD $0x4c00a800 // st1 {v0.4s, v1.4s}, [x0]
|
||||
|
||||
complete:
|
||||
RET
|
||||
|
||||
// Constants table
|
||||
DATA ·constants+0x0(SB)/8, $0x71374491428a2f98
|
||||
DATA ·constants+0x8(SB)/8, $0xe9b5dba5b5c0fbcf
|
||||
DATA ·constants+0x10(SB)/8, $0x59f111f13956c25b
|
||||
DATA ·constants+0x18(SB)/8, $0xab1c5ed5923f82a4
|
||||
DATA ·constants+0x20(SB)/8, $0x12835b01d807aa98
|
||||
DATA ·constants+0x28(SB)/8, $0x550c7dc3243185be
|
||||
DATA ·constants+0x30(SB)/8, $0x80deb1fe72be5d74
|
||||
DATA ·constants+0x38(SB)/8, $0xc19bf1749bdc06a7
|
||||
DATA ·constants+0x40(SB)/8, $0xefbe4786e49b69c1
|
||||
DATA ·constants+0x48(SB)/8, $0x240ca1cc0fc19dc6
|
||||
DATA ·constants+0x50(SB)/8, $0x4a7484aa2de92c6f
|
||||
DATA ·constants+0x58(SB)/8, $0x76f988da5cb0a9dc
|
||||
DATA ·constants+0x60(SB)/8, $0xa831c66d983e5152
|
||||
DATA ·constants+0x68(SB)/8, $0xbf597fc7b00327c8
|
||||
DATA ·constants+0x70(SB)/8, $0xd5a79147c6e00bf3
|
||||
DATA ·constants+0x78(SB)/8, $0x1429296706ca6351
|
||||
DATA ·constants+0x80(SB)/8, $0x2e1b213827b70a85
|
||||
DATA ·constants+0x88(SB)/8, $0x53380d134d2c6dfc
|
||||
DATA ·constants+0x90(SB)/8, $0x766a0abb650a7354
|
||||
DATA ·constants+0x98(SB)/8, $0x92722c8581c2c92e
|
||||
DATA ·constants+0xa0(SB)/8, $0xa81a664ba2bfe8a1
|
||||
DATA ·constants+0xa8(SB)/8, $0xc76c51a3c24b8b70
|
||||
DATA ·constants+0xb0(SB)/8, $0xd6990624d192e819
|
||||
DATA ·constants+0xb8(SB)/8, $0x106aa070f40e3585
|
||||
DATA ·constants+0xc0(SB)/8, $0x1e376c0819a4c116
|
||||
DATA ·constants+0xc8(SB)/8, $0x34b0bcb52748774c
|
||||
DATA ·constants+0xd0(SB)/8, $0x4ed8aa4a391c0cb3
|
||||
DATA ·constants+0xd8(SB)/8, $0x682e6ff35b9cca4f
|
||||
DATA ·constants+0xe0(SB)/8, $0x78a5636f748f82ee
|
||||
DATA ·constants+0xe8(SB)/8, $0x8cc7020884c87814
|
||||
DATA ·constants+0xf0(SB)/8, $0xa4506ceb90befffa
|
||||
DATA ·constants+0xf8(SB)/8, $0xc67178f2bef9a3f7
|
||||
|
||||
GLOBL ·constants(SB), 8, $256
|
||||
|
29
vendor/github.com/minio/sha256-simd/sha256block_other.go
generated
vendored
29
vendor/github.com/minio/sha256-simd/sha256block_other.go
generated
vendored
@@ -1,29 +0,0 @@
|
||||
//go:build appengine || noasm || (!amd64 && !arm64) || !gc
|
||||
// +build appengine noasm !amd64,!arm64 !gc
|
||||
|
||||
/*
|
||||
* Minio Cloud Storage, (C) 2019 Minio, 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 sha256
|
||||
|
||||
func blockIntelShaGo(dig *digest, p []byte) {
|
||||
panic("blockIntelShaGo called unexpectedly")
|
||||
|
||||
}
|
||||
|
||||
func blockArmSha2Go(dig *digest, p []byte) {
|
||||
panic("blockArmSha2Go called unexpectedly")
|
||||
}
|
15
vendor/github.com/minio/sha256-simd/test-architectures.sh
generated
vendored
15
vendor/github.com/minio/sha256-simd/test-architectures.sh
generated
vendored
@@ -1,15 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
go tool dist list | while IFS=/ read os arch; do
|
||||
echo "Checking $os/$arch..."
|
||||
echo " normal"
|
||||
GOARCH=$arch GOOS=$os go build -o /dev/null ./...
|
||||
echo " noasm"
|
||||
GOARCH=$arch GOOS=$os go build -tags noasm -o /dev/null ./...
|
||||
echo " appengine"
|
||||
GOARCH=$arch GOOS=$os go build -tags appengine -o /dev/null ./...
|
||||
echo " noasm,appengine"
|
||||
GOARCH=$arch GOOS=$os go build -tags 'appengine noasm' -o /dev/null ./...
|
||||
done
|
15
vendor/github.com/onsi/ginkgo/v2/ginkgo/build/build_command.go
generated
vendored
15
vendor/github.com/onsi/ginkgo/v2/ginkgo/build/build_command.go
generated
vendored
@@ -2,6 +2,8 @@ package build
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"github.com/onsi/ginkgo/v2/ginkgo/command"
|
||||
"github.com/onsi/ginkgo/v2/ginkgo/internal"
|
||||
@@ -53,7 +55,18 @@ func buildSpecs(args []string, cliConfig types.CLIConfig, goFlagsConfig types.Go
|
||||
if suite.State.Is(internal.TestSuiteStateFailedToCompile) {
|
||||
fmt.Println(suite.CompilationError.Error())
|
||||
} else {
|
||||
fmt.Printf("Compiled %s.test\n", suite.PackageName)
|
||||
if len(goFlagsConfig.O) == 0 {
|
||||
goFlagsConfig.O = path.Join(suite.Path, suite.PackageName+".test")
|
||||
} else {
|
||||
stat, err := os.Stat(goFlagsConfig.O)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if stat.IsDir() {
|
||||
goFlagsConfig.O += "/" + suite.PackageName + ".test"
|
||||
}
|
||||
}
|
||||
fmt.Printf("Compiled %s\n", goFlagsConfig.O)
|
||||
}
|
||||
}
|
||||
|
||||
|
2
vendor/github.com/onsi/ginkgo/v2/ginkgo/generators/bootstrap_command.go
generated
vendored
2
vendor/github.com/onsi/ginkgo/v2/ginkgo/generators/bootstrap_command.go
generated
vendored
@@ -7,7 +7,7 @@ import (
|
||||
"os"
|
||||
"text/template"
|
||||
|
||||
sprig "github.com/go-task/slim-sprig"
|
||||
sprig "github.com/go-task/slim-sprig/v3"
|
||||
"github.com/onsi/ginkgo/v2/ginkgo/command"
|
||||
"github.com/onsi/ginkgo/v2/ginkgo/internal"
|
||||
"github.com/onsi/ginkgo/v2/types"
|
||||
|
3
vendor/github.com/onsi/ginkgo/v2/ginkgo/generators/generate_command.go
generated
vendored
3
vendor/github.com/onsi/ginkgo/v2/ginkgo/generators/generate_command.go
generated
vendored
@@ -10,7 +10,7 @@ import (
|
||||
"strings"
|
||||
"text/template"
|
||||
|
||||
sprig "github.com/go-task/slim-sprig"
|
||||
sprig "github.com/go-task/slim-sprig/v3"
|
||||
"github.com/onsi/ginkgo/v2/ginkgo/command"
|
||||
"github.com/onsi/ginkgo/v2/ginkgo/internal"
|
||||
"github.com/onsi/ginkgo/v2/types"
|
||||
@@ -174,6 +174,7 @@ func moduleName(modRoot string) string {
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
defer modFile.Close()
|
||||
|
||||
mod := make([]byte, 128)
|
||||
_, err = modFile.Read(mod)
|
||||
|
14
vendor/github.com/onsi/ginkgo/v2/ginkgo/internal/compile.go
generated
vendored
14
vendor/github.com/onsi/ginkgo/v2/ginkgo/internal/compile.go
generated
vendored
@@ -25,6 +25,18 @@ func CompileSuite(suite TestSuite, goFlagsConfig types.GoFlagsConfig) TestSuite
|
||||
return suite
|
||||
}
|
||||
|
||||
if len(goFlagsConfig.O) > 0 {
|
||||
userDefinedPath, err := filepath.Abs(goFlagsConfig.O)
|
||||
if err != nil {
|
||||
suite.State = TestSuiteStateFailedToCompile
|
||||
suite.CompilationError = fmt.Errorf("Failed to compute compilation target path %s:\n%s", goFlagsConfig.O, err.Error())
|
||||
return suite
|
||||
}
|
||||
path = userDefinedPath
|
||||
}
|
||||
|
||||
goFlagsConfig.O = path
|
||||
|
||||
ginkgoInvocationPath, _ := os.Getwd()
|
||||
ginkgoInvocationPath, _ = filepath.Abs(ginkgoInvocationPath)
|
||||
packagePath := suite.AbsPath()
|
||||
@@ -34,7 +46,7 @@ func CompileSuite(suite TestSuite, goFlagsConfig types.GoFlagsConfig) TestSuite
|
||||
suite.CompilationError = fmt.Errorf("Failed to get relative path from package to the current working directory:\n%s", err.Error())
|
||||
return suite
|
||||
}
|
||||
args, err := types.GenerateGoTestCompileArgs(goFlagsConfig, path, "./", pathToInvocationPath)
|
||||
args, err := types.GenerateGoTestCompileArgs(goFlagsConfig, "./", pathToInvocationPath)
|
||||
if err != nil {
|
||||
suite.State = TestSuiteStateFailedToCompile
|
||||
suite.CompilationError = fmt.Errorf("Failed to generate go test compile flags:\n%s", err.Error())
|
||||
|
2
vendor/github.com/onsi/ginkgo/v2/ginkgo/internal/profiles_and_reports.go
generated
vendored
2
vendor/github.com/onsi/ginkgo/v2/ginkgo/internal/profiles_and_reports.go
generated
vendored
@@ -161,6 +161,7 @@ func MergeAndCleanupCoverProfiles(profiles []string, destination string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer dst.Close()
|
||||
err = DumpCoverProfiles(merged, dst)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -196,6 +197,7 @@ func MergeProfiles(profilePaths []string, destination string) error {
|
||||
return fmt.Errorf("Could not open profile: %s\n%s", profilePath, err.Error())
|
||||
}
|
||||
prof, err := profile.Parse(proFile)
|
||||
_ = proFile.Close()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Could not parse profile: %s\n%s", profilePath, err.Error())
|
||||
}
|
||||
|
9
vendor/github.com/onsi/ginkgo/v2/ginkgo/watch/package_hash.go
generated
vendored
9
vendor/github.com/onsi/ginkgo/v2/ginkgo/watch/package_hash.go
generated
vendored
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -79,6 +80,10 @@ func (p *PackageHash) computeHashes() (codeHash string, codeModifiedTime time.Ti
|
||||
continue
|
||||
}
|
||||
|
||||
if isHiddenFile(info) {
|
||||
continue
|
||||
}
|
||||
|
||||
if goTestRegExp.MatchString(info.Name()) {
|
||||
testHash += p.hashForFileInfo(info)
|
||||
if info.ModTime().After(testModifiedTime) {
|
||||
@@ -103,6 +108,10 @@ func (p *PackageHash) computeHashes() (codeHash string, codeModifiedTime time.Ti
|
||||
return
|
||||
}
|
||||
|
||||
func isHiddenFile(info os.FileInfo) bool {
|
||||
return strings.HasPrefix(info.Name(), ".") || strings.HasPrefix(info.Name(), "_")
|
||||
}
|
||||
|
||||
func (p *PackageHash) hashForFileInfo(info os.FileInfo) string {
|
||||
return fmt.Sprintf("%s_%d_%d", info.Name(), info.Size(), info.ModTime().UnixNano())
|
||||
}
|
||||
|
16
vendor/github.com/onsi/ginkgo/v2/reporters/default_reporter.go
generated
vendored
16
vendor/github.com/onsi/ginkgo/v2/reporters/default_reporter.go
generated
vendored
@@ -202,6 +202,11 @@ func (r *DefaultReporter) DidRun(report types.SpecReport) {
|
||||
v := r.conf.Verbosity()
|
||||
inParallel := report.RunningInParallel
|
||||
|
||||
//should we completely omit this spec?
|
||||
if report.State.Is(types.SpecStateSkipped) && r.conf.SilenceSkips {
|
||||
return
|
||||
}
|
||||
|
||||
header := r.specDenoter
|
||||
if report.LeafNodeType.Is(types.NodeTypesForSuiteLevelNodes) {
|
||||
header = fmt.Sprintf("[%s]", report.LeafNodeType)
|
||||
@@ -278,9 +283,12 @@ func (r *DefaultReporter) DidRun(report types.SpecReport) {
|
||||
}
|
||||
}
|
||||
|
||||
// If we have no content to show, jsut emit the header and return
|
||||
// If we have no content to show, just emit the header and return
|
||||
if !reportHasContent {
|
||||
r.emit(r.f(highlightColor + header + "{{/}}"))
|
||||
if r.conf.ForceNewlines {
|
||||
r.emit("\n")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -419,7 +427,11 @@ func (r *DefaultReporter) emitFailure(indent uint, state types.SpecState, failur
|
||||
highlightColor := r.highlightColorForState(state)
|
||||
r.emitBlock(r.fi(indent, highlightColor+"[%s] %s{{/}}", r.humanReadableState(state), failure.Message))
|
||||
if r.conf.GithubOutput {
|
||||
r.emitBlock(r.fi(indent, "::error file=%s,line=%d::%s %s", failure.Location.FileName, failure.Location.LineNumber, failure.FailureNodeType, failure.TimelineLocation.Time.Format(types.GINKGO_TIME_FORMAT)))
|
||||
level := "error"
|
||||
if state.Is(types.SpecStateSkipped) {
|
||||
level = "notice"
|
||||
}
|
||||
r.emitBlock(r.fi(indent, "::%s file=%s,line=%d::%s %s", level, failure.Location.FileName, failure.Location.LineNumber, failure.FailureNodeType, failure.TimelineLocation.Time.Format(types.GINKGO_TIME_FORMAT)))
|
||||
} else {
|
||||
r.emitBlock(r.fi(indent, highlightColor+"In {{bold}}[%s]{{/}}"+highlightColor+" at: {{bold}}%s{{/}} {{gray}}@ %s{{/}}\n", failure.FailureNodeType, failure.Location, failure.TimelineLocation.Time.Format(types.GINKGO_TIME_FORMAT)))
|
||||
}
|
||||
|
2
vendor/github.com/onsi/ginkgo/v2/reporters/junit_report.go
generated
vendored
2
vendor/github.com/onsi/ginkgo/v2/reporters/junit_report.go
generated
vendored
@@ -177,6 +177,7 @@ func GenerateJUnitReportWithConfig(report types.Report, dst string, config Junit
|
||||
{"FocusFiles", strings.Join(report.SuiteConfig.FocusFiles, ";")},
|
||||
{"SkipFiles", strings.Join(report.SuiteConfig.SkipFiles, ";")},
|
||||
{"FailOnPending", fmt.Sprintf("%t", report.SuiteConfig.FailOnPending)},
|
||||
{"FailOnEmpty", fmt.Sprintf("%t", report.SuiteConfig.FailOnEmpty)},
|
||||
{"FailFast", fmt.Sprintf("%t", report.SuiteConfig.FailFast)},
|
||||
{"FlakeAttempts", fmt.Sprintf("%d", report.SuiteConfig.FlakeAttempts)},
|
||||
{"DryRun", fmt.Sprintf("%t", report.SuiteConfig.DryRun)},
|
||||
@@ -324,6 +325,7 @@ func MergeAndCleanupJUnitReports(sources []string, dst string) ([]string, error)
|
||||
continue
|
||||
}
|
||||
err = xml.NewDecoder(f).Decode(&report)
|
||||
_ = f.Close()
|
||||
if err != nil {
|
||||
messages = append(messages, fmt.Sprintf("Could not decode %s:\n%s", source, err.Error()))
|
||||
continue
|
||||
|
21
vendor/github.com/onsi/ginkgo/v2/types/config.go
generated
vendored
21
vendor/github.com/onsi/ginkgo/v2/types/config.go
generated
vendored
@@ -25,6 +25,7 @@ type SuiteConfig struct {
|
||||
SkipFiles []string
|
||||
LabelFilter string
|
||||
FailOnPending bool
|
||||
FailOnEmpty bool
|
||||
FailFast bool
|
||||
FlakeAttempts int
|
||||
MustPassRepeatedly int
|
||||
@@ -90,6 +91,8 @@ type ReporterConfig struct {
|
||||
FullTrace bool
|
||||
ShowNodeEvents bool
|
||||
GithubOutput bool
|
||||
SilenceSkips bool
|
||||
ForceNewlines bool
|
||||
|
||||
JSONReport string
|
||||
JUnitReport string
|
||||
@@ -199,6 +202,7 @@ type GoFlagsConfig struct {
|
||||
A bool
|
||||
ASMFlags string
|
||||
BuildMode string
|
||||
BuildVCS bool
|
||||
Compiler string
|
||||
GCCGoFlags string
|
||||
GCFlags string
|
||||
@@ -216,6 +220,7 @@ type GoFlagsConfig struct {
|
||||
ToolExec string
|
||||
Work bool
|
||||
X bool
|
||||
O string
|
||||
}
|
||||
|
||||
func NewDefaultGoFlagsConfig() GoFlagsConfig {
|
||||
@@ -275,6 +280,8 @@ var SuiteConfigFlags = GinkgoFlags{
|
||||
Usage: "If set, ginkgo will stop running a test suite after a failure occurs."},
|
||||
{KeyPath: "S.FlakeAttempts", Name: "flake-attempts", SectionKey: "failure", UsageDefaultValue: "0 - failed tests are not retried", DeprecatedName: "flakeAttempts", DeprecatedDocLink: "changed-command-line-flags",
|
||||
Usage: "Make up to this many attempts to run each spec. If any of the attempts succeed, the suite will not be failed."},
|
||||
{KeyPath: "S.FailOnEmpty", Name: "fail-on-empty", SectionKey: "failure",
|
||||
Usage: "If set, ginkgo will mark the test suite as failed if no specs are run."},
|
||||
|
||||
{KeyPath: "S.DryRun", Name: "dry-run", SectionKey: "debug", DeprecatedName: "dryRun", DeprecatedDocLink: "changed-command-line-flags",
|
||||
Usage: "If set, ginkgo will walk the test hierarchy without actually running anything. Best paired with -v."},
|
||||
@@ -334,6 +341,10 @@ var ReporterConfigFlags = GinkgoFlags{
|
||||
Usage: "If set, default reporter prints node > Enter and < Exit events when specs fail"},
|
||||
{KeyPath: "R.GithubOutput", Name: "github-output", SectionKey: "output",
|
||||
Usage: "If set, default reporter prints easier to manage output in Github Actions."},
|
||||
{KeyPath: "R.SilenceSkips", Name: "silence-skips", SectionKey: "output",
|
||||
Usage: "If set, default reporter will not print out skipped tests."},
|
||||
{KeyPath: "R.ForceNewlines", Name: "force-newlines", SectionKey: "output",
|
||||
Usage: "If set, default reporter will ensure a newline appears after each test."},
|
||||
|
||||
{KeyPath: "R.JSONReport", Name: "json-report", UsageArgument: "filename.json", SectionKey: "output",
|
||||
Usage: "If set, Ginkgo will generate a JSON-formatted test report at the specified location."},
|
||||
@@ -502,7 +513,7 @@ var GinkgoCLIWatchFlags = GinkgoFlags{
|
||||
// GoBuildFlags provides flags for the Ginkgo CLI build, run, and watch commands that capture go's build-time flags. These are passed to go test -c by the ginkgo CLI
|
||||
var GoBuildFlags = GinkgoFlags{
|
||||
{KeyPath: "Go.Race", Name: "race", SectionKey: "code-and-coverage-analysis",
|
||||
Usage: "enable data race detection. Supported only on linux/amd64, freebsd/amd64, darwin/amd64, windows/amd64, linux/ppc64le and linux/arm64 (only for 48-bit VMA)."},
|
||||
Usage: "enable data race detection. Supported on linux/amd64, linux/ppc64le, linux/arm64, linux/s390x, freebsd/amd64, netbsd/amd64, darwin/amd64, darwin/arm64, and windows/amd64."},
|
||||
{KeyPath: "Go.Vet", Name: "vet", UsageArgument: "list", SectionKey: "code-and-coverage-analysis",
|
||||
Usage: `Configure the invocation of "go vet" during "go test" to use the comma-separated list of vet checks. If list is empty, "go test" runs "go vet" with a curated list of checks believed to be always worth addressing. If list is "off", "go test" does not run "go vet" at all. Available checks can be found by running 'go doc cmd/vet'`},
|
||||
{KeyPath: "Go.Cover", Name: "cover", SectionKey: "code-and-coverage-analysis",
|
||||
@@ -518,6 +529,8 @@ var GoBuildFlags = GinkgoFlags{
|
||||
Usage: "arguments to pass on each go tool asm invocation."},
|
||||
{KeyPath: "Go.BuildMode", Name: "buildmode", UsageArgument: "mode", SectionKey: "go-build",
|
||||
Usage: "build mode to use. See 'go help buildmode' for more."},
|
||||
{KeyPath: "Go.BuildVCS", Name: "buildvcs", SectionKey: "go-build",
|
||||
Usage: "adds version control information."},
|
||||
{KeyPath: "Go.Compiler", Name: "compiler", UsageArgument: "name", SectionKey: "go-build",
|
||||
Usage: "name of compiler to use, as in runtime.Compiler (gccgo or gc)."},
|
||||
{KeyPath: "Go.GCCGoFlags", Name: "gccgoflags", UsageArgument: "'[pattern=]arg list'", SectionKey: "go-build",
|
||||
@@ -552,6 +565,8 @@ var GoBuildFlags = GinkgoFlags{
|
||||
Usage: "print the name of the temporary work directory and do not delete it when exiting."},
|
||||
{KeyPath: "Go.X", Name: "x", SectionKey: "go-build",
|
||||
Usage: "print the commands."},
|
||||
{KeyPath: "Go.O", Name: "o", SectionKey: "go-build",
|
||||
Usage: "output binary path (including name)."},
|
||||
}
|
||||
|
||||
// GoRunFlags provides flags for the Ginkgo CLI run, and watch commands that capture go's run-time flags. These are passed to the compiled test binary by the ginkgo CLI
|
||||
@@ -605,7 +620,7 @@ func VetAndInitializeCLIAndGoConfig(cliConfig CLIConfig, goFlagsConfig GoFlagsCo
|
||||
}
|
||||
|
||||
// GenerateGoTestCompileArgs is used by the Ginkgo CLI to generate command line arguments to pass to the go test -c command when compiling the test
|
||||
func GenerateGoTestCompileArgs(goFlagsConfig GoFlagsConfig, destination string, packageToBuild string, pathToInvocationPath string) ([]string, error) {
|
||||
func GenerateGoTestCompileArgs(goFlagsConfig GoFlagsConfig, packageToBuild string, pathToInvocationPath string) ([]string, error) {
|
||||
// if the user has set the CoverProfile run-time flag make sure to set the build-time cover flag to make sure
|
||||
// the built test binary can generate a coverprofile
|
||||
if goFlagsConfig.CoverProfile != "" {
|
||||
@@ -628,7 +643,7 @@ func GenerateGoTestCompileArgs(goFlagsConfig GoFlagsConfig, destination string,
|
||||
goFlagsConfig.CoverPkg = strings.Join(adjustedCoverPkgs, ",")
|
||||
}
|
||||
|
||||
args := []string{"test", "-c", "-o", destination, packageToBuild}
|
||||
args := []string{"test", "-c", packageToBuild}
|
||||
goArgs, err := GenerateFlagArgs(
|
||||
GoBuildFlags,
|
||||
map[string]interface{}{
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user