Merge pull request #5825 from containers/renovate/golang.org-x-crypto-0.x
fix(deps): update module golang.org/x/crypto to v0.29.0
This commit is contained in:
commit
b51c12c6e7
10
go.mod
10
go.mod
|
@ -36,11 +36,11 @@ require (
|
||||||
github.com/spf13/pflag v1.0.5
|
github.com/spf13/pflag v1.0.5
|
||||||
github.com/stretchr/testify v1.9.0
|
github.com/stretchr/testify v1.9.0
|
||||||
go.etcd.io/bbolt v1.3.11
|
go.etcd.io/bbolt v1.3.11
|
||||||
golang.org/x/crypto v0.28.0
|
golang.org/x/crypto v0.29.0
|
||||||
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c
|
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c
|
||||||
golang.org/x/sync v0.8.0
|
golang.org/x/sync v0.9.0
|
||||||
golang.org/x/sys v0.26.0
|
golang.org/x/sys v0.27.0
|
||||||
golang.org/x/term v0.25.0
|
golang.org/x/term v0.26.0
|
||||||
sigs.k8s.io/yaml v1.4.0
|
sigs.k8s.io/yaml v1.4.0
|
||||||
tags.cncf.io/container-device-interface v0.8.0
|
tags.cncf.io/container-device-interface v0.8.0
|
||||||
)
|
)
|
||||||
|
@ -147,7 +147,7 @@ require (
|
||||||
go.opentelemetry.io/otel/trace v1.28.0 // indirect
|
go.opentelemetry.io/otel/trace v1.28.0 // indirect
|
||||||
golang.org/x/mod v0.21.0 // indirect
|
golang.org/x/mod v0.21.0 // indirect
|
||||||
golang.org/x/net v0.29.0 // indirect
|
golang.org/x/net v0.29.0 // indirect
|
||||||
golang.org/x/text v0.19.0 // indirect
|
golang.org/x/text v0.20.0 // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
|
||||||
google.golang.org/grpc v1.67.0 // indirect
|
google.golang.org/grpc v1.67.0 // indirect
|
||||||
google.golang.org/protobuf v1.35.1 // indirect
|
google.golang.org/protobuf v1.35.1 // indirect
|
||||||
|
|
20
go.sum
20
go.sum
|
@ -394,8 +394,8 @@ go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v8
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw=
|
golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ=
|
||||||
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
|
golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg=
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c h1:7dEasQXItcW1xKJ2+gg5VOiBnqWrJc+rq0DPKyvvdbY=
|
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c h1:7dEasQXItcW1xKJ2+gg5VOiBnqWrJc+rq0DPKyvvdbY=
|
||||||
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8=
|
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8=
|
||||||
|
@ -423,8 +423,8 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
|
golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ=
|
||||||
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
golang.org/x/sync v0.9.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-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
@ -435,14 +435,14 @@ golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
|
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
|
||||||
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24=
|
golang.org/x/term v0.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU=
|
||||||
golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M=
|
golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
|
golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug=
|
||||||
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
|
golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4=
|
||||||
golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U=
|
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/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-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build (!arm64 && !s390x && !ppc64le) || !gc || purego
|
//go:build (!arm64 && !s390x && !ppc64 && !ppc64le) || !gc || purego
|
||||||
|
|
||||||
package chacha20
|
package chacha20
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build gc && !purego
|
//go:build gc && !purego && (ppc64 || ppc64le)
|
||||||
|
|
||||||
package chacha20
|
package chacha20
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
// The differences in this and the original implementation are
|
// The differences in this and the original implementation are
|
||||||
// due to the calling conventions and initialization of constants.
|
// due to the calling conventions and initialization of constants.
|
||||||
|
|
||||||
//go:build gc && !purego
|
//go:build gc && !purego && (ppc64 || ppc64le)
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
@ -36,32 +36,68 @@
|
||||||
// for VPERMXOR
|
// for VPERMXOR
|
||||||
#define MASK R18
|
#define MASK R18
|
||||||
|
|
||||||
DATA consts<>+0x00(SB)/8, $0x3320646e61707865
|
DATA consts<>+0x00(SB)/4, $0x61707865
|
||||||
DATA consts<>+0x08(SB)/8, $0x6b20657479622d32
|
DATA consts<>+0x04(SB)/4, $0x3320646e
|
||||||
DATA consts<>+0x10(SB)/8, $0x0000000000000001
|
DATA consts<>+0x08(SB)/4, $0x79622d32
|
||||||
DATA consts<>+0x18(SB)/8, $0x0000000000000000
|
DATA consts<>+0x0c(SB)/4, $0x6b206574
|
||||||
DATA consts<>+0x20(SB)/8, $0x0000000000000004
|
DATA consts<>+0x10(SB)/4, $0x00000001
|
||||||
DATA consts<>+0x28(SB)/8, $0x0000000000000000
|
DATA consts<>+0x14(SB)/4, $0x00000000
|
||||||
DATA consts<>+0x30(SB)/8, $0x0a0b08090e0f0c0d
|
DATA consts<>+0x18(SB)/4, $0x00000000
|
||||||
DATA consts<>+0x38(SB)/8, $0x0203000106070405
|
DATA consts<>+0x1c(SB)/4, $0x00000000
|
||||||
DATA consts<>+0x40(SB)/8, $0x090a0b080d0e0f0c
|
DATA consts<>+0x20(SB)/4, $0x00000004
|
||||||
DATA consts<>+0x48(SB)/8, $0x0102030005060704
|
DATA consts<>+0x24(SB)/4, $0x00000000
|
||||||
DATA consts<>+0x50(SB)/8, $0x6170786561707865
|
DATA consts<>+0x28(SB)/4, $0x00000000
|
||||||
DATA consts<>+0x58(SB)/8, $0x6170786561707865
|
DATA consts<>+0x2c(SB)/4, $0x00000000
|
||||||
DATA consts<>+0x60(SB)/8, $0x3320646e3320646e
|
DATA consts<>+0x30(SB)/4, $0x0e0f0c0d
|
||||||
DATA consts<>+0x68(SB)/8, $0x3320646e3320646e
|
DATA consts<>+0x34(SB)/4, $0x0a0b0809
|
||||||
DATA consts<>+0x70(SB)/8, $0x79622d3279622d32
|
DATA consts<>+0x38(SB)/4, $0x06070405
|
||||||
DATA consts<>+0x78(SB)/8, $0x79622d3279622d32
|
DATA consts<>+0x3c(SB)/4, $0x02030001
|
||||||
DATA consts<>+0x80(SB)/8, $0x6b2065746b206574
|
DATA consts<>+0x40(SB)/4, $0x0d0e0f0c
|
||||||
DATA consts<>+0x88(SB)/8, $0x6b2065746b206574
|
DATA consts<>+0x44(SB)/4, $0x090a0b08
|
||||||
DATA consts<>+0x90(SB)/8, $0x0000000100000000
|
DATA consts<>+0x48(SB)/4, $0x05060704
|
||||||
DATA consts<>+0x98(SB)/8, $0x0000000300000002
|
DATA consts<>+0x4c(SB)/4, $0x01020300
|
||||||
DATA consts<>+0xa0(SB)/8, $0x5566774411223300
|
DATA consts<>+0x50(SB)/4, $0x61707865
|
||||||
DATA consts<>+0xa8(SB)/8, $0xddeeffcc99aabb88
|
DATA consts<>+0x54(SB)/4, $0x61707865
|
||||||
DATA consts<>+0xb0(SB)/8, $0x6677445522330011
|
DATA consts<>+0x58(SB)/4, $0x61707865
|
||||||
DATA consts<>+0xb8(SB)/8, $0xeeffccddaabb8899
|
DATA consts<>+0x5c(SB)/4, $0x61707865
|
||||||
|
DATA consts<>+0x60(SB)/4, $0x3320646e
|
||||||
|
DATA consts<>+0x64(SB)/4, $0x3320646e
|
||||||
|
DATA consts<>+0x68(SB)/4, $0x3320646e
|
||||||
|
DATA consts<>+0x6c(SB)/4, $0x3320646e
|
||||||
|
DATA consts<>+0x70(SB)/4, $0x79622d32
|
||||||
|
DATA consts<>+0x74(SB)/4, $0x79622d32
|
||||||
|
DATA consts<>+0x78(SB)/4, $0x79622d32
|
||||||
|
DATA consts<>+0x7c(SB)/4, $0x79622d32
|
||||||
|
DATA consts<>+0x80(SB)/4, $0x6b206574
|
||||||
|
DATA consts<>+0x84(SB)/4, $0x6b206574
|
||||||
|
DATA consts<>+0x88(SB)/4, $0x6b206574
|
||||||
|
DATA consts<>+0x8c(SB)/4, $0x6b206574
|
||||||
|
DATA consts<>+0x90(SB)/4, $0x00000000
|
||||||
|
DATA consts<>+0x94(SB)/4, $0x00000001
|
||||||
|
DATA consts<>+0x98(SB)/4, $0x00000002
|
||||||
|
DATA consts<>+0x9c(SB)/4, $0x00000003
|
||||||
|
DATA consts<>+0xa0(SB)/4, $0x11223300
|
||||||
|
DATA consts<>+0xa4(SB)/4, $0x55667744
|
||||||
|
DATA consts<>+0xa8(SB)/4, $0x99aabb88
|
||||||
|
DATA consts<>+0xac(SB)/4, $0xddeeffcc
|
||||||
|
DATA consts<>+0xb0(SB)/4, $0x22330011
|
||||||
|
DATA consts<>+0xb4(SB)/4, $0x66774455
|
||||||
|
DATA consts<>+0xb8(SB)/4, $0xaabb8899
|
||||||
|
DATA consts<>+0xbc(SB)/4, $0xeeffccdd
|
||||||
GLOBL consts<>(SB), RODATA, $0xc0
|
GLOBL consts<>(SB), RODATA, $0xc0
|
||||||
|
|
||||||
|
#ifdef GOARCH_ppc64
|
||||||
|
#define BE_XXBRW_INIT() \
|
||||||
|
LVSL (R0)(R0), V24 \
|
||||||
|
VSPLTISB $3, V25 \
|
||||||
|
VXOR V24, V25, V24 \
|
||||||
|
|
||||||
|
#define BE_XXBRW(vr) VPERM vr, vr, V24, vr
|
||||||
|
#else
|
||||||
|
#define BE_XXBRW_INIT()
|
||||||
|
#define BE_XXBRW(vr)
|
||||||
|
#endif
|
||||||
|
|
||||||
//func chaCha20_ctr32_vsx(out, inp *byte, len int, key *[8]uint32, counter *uint32)
|
//func chaCha20_ctr32_vsx(out, inp *byte, len int, key *[8]uint32, counter *uint32)
|
||||||
TEXT ·chaCha20_ctr32_vsx(SB),NOSPLIT,$64-40
|
TEXT ·chaCha20_ctr32_vsx(SB),NOSPLIT,$64-40
|
||||||
MOVD out+0(FP), OUT
|
MOVD out+0(FP), OUT
|
||||||
|
@ -94,6 +130,8 @@ TEXT ·chaCha20_ctr32_vsx(SB),NOSPLIT,$64-40
|
||||||
// Clear V27
|
// Clear V27
|
||||||
VXOR V27, V27, V27
|
VXOR V27, V27, V27
|
||||||
|
|
||||||
|
BE_XXBRW_INIT()
|
||||||
|
|
||||||
// V28
|
// V28
|
||||||
LXVW4X (CONSTBASE)(R11), VS60
|
LXVW4X (CONSTBASE)(R11), VS60
|
||||||
|
|
||||||
|
@ -299,6 +337,11 @@ loop_vsx:
|
||||||
VADDUWM V8, V18, V8
|
VADDUWM V8, V18, V8
|
||||||
VADDUWM V12, V19, V12
|
VADDUWM V12, V19, V12
|
||||||
|
|
||||||
|
BE_XXBRW(V0)
|
||||||
|
BE_XXBRW(V4)
|
||||||
|
BE_XXBRW(V8)
|
||||||
|
BE_XXBRW(V12)
|
||||||
|
|
||||||
CMPU LEN, $64
|
CMPU LEN, $64
|
||||||
BLT tail_vsx
|
BLT tail_vsx
|
||||||
|
|
||||||
|
@ -327,6 +370,11 @@ loop_vsx:
|
||||||
VADDUWM V9, V18, V8
|
VADDUWM V9, V18, V8
|
||||||
VADDUWM V13, V19, V12
|
VADDUWM V13, V19, V12
|
||||||
|
|
||||||
|
BE_XXBRW(V0)
|
||||||
|
BE_XXBRW(V4)
|
||||||
|
BE_XXBRW(V8)
|
||||||
|
BE_XXBRW(V12)
|
||||||
|
|
||||||
CMPU LEN, $64
|
CMPU LEN, $64
|
||||||
BLT tail_vsx
|
BLT tail_vsx
|
||||||
|
|
||||||
|
@ -334,8 +382,8 @@ loop_vsx:
|
||||||
LXVW4X (INP)(R8), VS60
|
LXVW4X (INP)(R8), VS60
|
||||||
LXVW4X (INP)(R9), VS61
|
LXVW4X (INP)(R9), VS61
|
||||||
LXVW4X (INP)(R10), VS62
|
LXVW4X (INP)(R10), VS62
|
||||||
VXOR V27, V0, V27
|
|
||||||
|
|
||||||
|
VXOR V27, V0, V27
|
||||||
VXOR V28, V4, V28
|
VXOR V28, V4, V28
|
||||||
VXOR V29, V8, V29
|
VXOR V29, V8, V29
|
||||||
VXOR V30, V12, V30
|
VXOR V30, V12, V30
|
||||||
|
@ -354,6 +402,11 @@ loop_vsx:
|
||||||
VADDUWM V10, V18, V8
|
VADDUWM V10, V18, V8
|
||||||
VADDUWM V14, V19, V12
|
VADDUWM V14, V19, V12
|
||||||
|
|
||||||
|
BE_XXBRW(V0)
|
||||||
|
BE_XXBRW(V4)
|
||||||
|
BE_XXBRW(V8)
|
||||||
|
BE_XXBRW(V12)
|
||||||
|
|
||||||
CMPU LEN, $64
|
CMPU LEN, $64
|
||||||
BLT tail_vsx
|
BLT tail_vsx
|
||||||
|
|
||||||
|
@ -381,6 +434,11 @@ loop_vsx:
|
||||||
VADDUWM V11, V18, V8
|
VADDUWM V11, V18, V8
|
||||||
VADDUWM V15, V19, V12
|
VADDUWM V15, V19, V12
|
||||||
|
|
||||||
|
BE_XXBRW(V0)
|
||||||
|
BE_XXBRW(V4)
|
||||||
|
BE_XXBRW(V8)
|
||||||
|
BE_XXBRW(V12)
|
||||||
|
|
||||||
CMPU LEN, $64
|
CMPU LEN, $64
|
||||||
BLT tail_vsx
|
BLT tail_vsx
|
||||||
|
|
||||||
|
@ -408,9 +466,9 @@ loop_vsx:
|
||||||
|
|
||||||
done_vsx:
|
done_vsx:
|
||||||
// Increment counter by number of 64 byte blocks
|
// Increment counter by number of 64 byte blocks
|
||||||
MOVD (CNT), R14
|
MOVWZ (CNT), R14
|
||||||
ADD BLOCKS, R14
|
ADD BLOCKS, R14
|
||||||
MOVD R14, (CNT)
|
MOVWZ R14, (CNT)
|
||||||
RET
|
RET
|
||||||
|
|
||||||
tail_vsx:
|
tail_vsx:
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build (!amd64 && !ppc64le && !s390x) || !gc || purego
|
//go:build (!amd64 && !ppc64le && !ppc64 && !s390x) || !gc || purego
|
||||||
|
|
||||||
package poly1305
|
package poly1305
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build gc && !purego
|
//go:build gc && !purego && (ppc64 || ppc64le)
|
||||||
|
|
||||||
package poly1305
|
package poly1305
|
||||||
|
|
|
@ -2,15 +2,25 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build gc && !purego
|
//go:build gc && !purego && (ppc64 || ppc64le)
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
// This was ported from the amd64 implementation.
|
// This was ported from the amd64 implementation.
|
||||||
|
|
||||||
|
#ifdef GOARCH_ppc64le
|
||||||
|
#define LE_MOVD MOVD
|
||||||
|
#define LE_MOVWZ MOVWZ
|
||||||
|
#define LE_MOVHZ MOVHZ
|
||||||
|
#else
|
||||||
|
#define LE_MOVD MOVDBR
|
||||||
|
#define LE_MOVWZ MOVWBR
|
||||||
|
#define LE_MOVHZ MOVHBR
|
||||||
|
#endif
|
||||||
|
|
||||||
#define POLY1305_ADD(msg, h0, h1, h2, t0, t1, t2) \
|
#define POLY1305_ADD(msg, h0, h1, h2, t0, t1, t2) \
|
||||||
MOVD (msg), t0; \
|
LE_MOVD (msg)( R0), t0; \
|
||||||
MOVD 8(msg), t1; \
|
LE_MOVD (msg)(R24), t1; \
|
||||||
MOVD $1, t2; \
|
MOVD $1, t2; \
|
||||||
ADDC t0, h0, h0; \
|
ADDC t0, h0, h0; \
|
||||||
ADDE t1, h1, h1; \
|
ADDE t1, h1, h1; \
|
||||||
|
@ -50,10 +60,6 @@
|
||||||
ADDE t3, h1, h1; \
|
ADDE t3, h1, h1; \
|
||||||
ADDZE h2
|
ADDZE h2
|
||||||
|
|
||||||
DATA ·poly1305Mask<>+0x00(SB)/8, $0x0FFFFFFC0FFFFFFF
|
|
||||||
DATA ·poly1305Mask<>+0x08(SB)/8, $0x0FFFFFFC0FFFFFFC
|
|
||||||
GLOBL ·poly1305Mask<>(SB), RODATA, $16
|
|
||||||
|
|
||||||
// func update(state *[7]uint64, msg []byte)
|
// func update(state *[7]uint64, msg []byte)
|
||||||
TEXT ·update(SB), $0-32
|
TEXT ·update(SB), $0-32
|
||||||
MOVD state+0(FP), R3
|
MOVD state+0(FP), R3
|
||||||
|
@ -66,6 +72,8 @@ TEXT ·update(SB), $0-32
|
||||||
MOVD 24(R3), R11 // r0
|
MOVD 24(R3), R11 // r0
|
||||||
MOVD 32(R3), R12 // r1
|
MOVD 32(R3), R12 // r1
|
||||||
|
|
||||||
|
MOVD $8, R24
|
||||||
|
|
||||||
CMP R5, $16
|
CMP R5, $16
|
||||||
BLT bytes_between_0_and_15
|
BLT bytes_between_0_and_15
|
||||||
|
|
||||||
|
@ -94,7 +102,7 @@ flush_buffer:
|
||||||
|
|
||||||
// Greater than 8 -- load the rightmost remaining bytes in msg
|
// Greater than 8 -- load the rightmost remaining bytes in msg
|
||||||
// and put into R17 (h1)
|
// and put into R17 (h1)
|
||||||
MOVD (R4)(R21), R17
|
LE_MOVD (R4)(R21), R17
|
||||||
MOVD $16, R22
|
MOVD $16, R22
|
||||||
|
|
||||||
// Find the offset to those bytes
|
// Find the offset to those bytes
|
||||||
|
@ -118,7 +126,7 @@ just1:
|
||||||
BLT less8
|
BLT less8
|
||||||
|
|
||||||
// Exactly 8
|
// Exactly 8
|
||||||
MOVD (R4), R16
|
LE_MOVD (R4), R16
|
||||||
|
|
||||||
CMP R17, $0
|
CMP R17, $0
|
||||||
|
|
||||||
|
@ -133,7 +141,7 @@ less8:
|
||||||
MOVD $0, R22 // shift count
|
MOVD $0, R22 // shift count
|
||||||
CMP R5, $4
|
CMP R5, $4
|
||||||
BLT less4
|
BLT less4
|
||||||
MOVWZ (R4), R16
|
LE_MOVWZ (R4), R16
|
||||||
ADD $4, R4
|
ADD $4, R4
|
||||||
ADD $-4, R5
|
ADD $-4, R5
|
||||||
MOVD $32, R22
|
MOVD $32, R22
|
||||||
|
@ -141,7 +149,7 @@ less8:
|
||||||
less4:
|
less4:
|
||||||
CMP R5, $2
|
CMP R5, $2
|
||||||
BLT less2
|
BLT less2
|
||||||
MOVHZ (R4), R21
|
LE_MOVHZ (R4), R21
|
||||||
SLD R22, R21, R21
|
SLD R22, R21, R21
|
||||||
OR R16, R21, R16
|
OR R16, R21, R16
|
||||||
ADD $16, R22
|
ADD $16, R22
|
|
@ -5,6 +5,10 @@
|
||||||
// Package sha3 implements the SHA-3 fixed-output-length hash functions and
|
// Package sha3 implements the SHA-3 fixed-output-length hash functions and
|
||||||
// the SHAKE variable-output-length hash functions defined by FIPS-202.
|
// the SHAKE variable-output-length hash functions defined by FIPS-202.
|
||||||
//
|
//
|
||||||
|
// All types in this package also implement [encoding.BinaryMarshaler],
|
||||||
|
// [encoding.BinaryAppender] and [encoding.BinaryUnmarshaler] to marshal and
|
||||||
|
// unmarshal the internal state of the hash.
|
||||||
|
//
|
||||||
// Both types of hash function use the "sponge" construction and the Keccak
|
// Both types of hash function use the "sponge" construction and the Keccak
|
||||||
// permutation. For a detailed specification see http://keccak.noekeon.org/
|
// permutation. For a detailed specification see http://keccak.noekeon.org/
|
||||||
//
|
//
|
||||||
|
|
|
@ -48,33 +48,52 @@ func init() {
|
||||||
crypto.RegisterHash(crypto.SHA3_512, New512)
|
crypto.RegisterHash(crypto.SHA3_512, New512)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
dsbyteSHA3 = 0b00000110
|
||||||
|
dsbyteKeccak = 0b00000001
|
||||||
|
dsbyteShake = 0b00011111
|
||||||
|
dsbyteCShake = 0b00000100
|
||||||
|
|
||||||
|
// rateK[c] is the rate in bytes for Keccak[c] where c is the capacity in
|
||||||
|
// bits. Given the sponge size is 1600 bits, the rate is 1600 - c bits.
|
||||||
|
rateK256 = (1600 - 256) / 8
|
||||||
|
rateK448 = (1600 - 448) / 8
|
||||||
|
rateK512 = (1600 - 512) / 8
|
||||||
|
rateK768 = (1600 - 768) / 8
|
||||||
|
rateK1024 = (1600 - 1024) / 8
|
||||||
|
)
|
||||||
|
|
||||||
func new224Generic() *state {
|
func new224Generic() *state {
|
||||||
return &state{rate: 144, outputLen: 28, dsbyte: 0x06}
|
return &state{rate: rateK448, outputLen: 28, dsbyte: dsbyteSHA3}
|
||||||
}
|
}
|
||||||
|
|
||||||
func new256Generic() *state {
|
func new256Generic() *state {
|
||||||
return &state{rate: 136, outputLen: 32, dsbyte: 0x06}
|
return &state{rate: rateK512, outputLen: 32, dsbyte: dsbyteSHA3}
|
||||||
}
|
}
|
||||||
|
|
||||||
func new384Generic() *state {
|
func new384Generic() *state {
|
||||||
return &state{rate: 104, outputLen: 48, dsbyte: 0x06}
|
return &state{rate: rateK768, outputLen: 48, dsbyte: dsbyteSHA3}
|
||||||
}
|
}
|
||||||
|
|
||||||
func new512Generic() *state {
|
func new512Generic() *state {
|
||||||
return &state{rate: 72, outputLen: 64, dsbyte: 0x06}
|
return &state{rate: rateK1024, outputLen: 64, dsbyte: dsbyteSHA3}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewLegacyKeccak256 creates a new Keccak-256 hash.
|
// NewLegacyKeccak256 creates a new Keccak-256 hash.
|
||||||
//
|
//
|
||||||
// Only use this function if you require compatibility with an existing cryptosystem
|
// Only use this function if you require compatibility with an existing cryptosystem
|
||||||
// that uses non-standard padding. All other users should use New256 instead.
|
// that uses non-standard padding. All other users should use New256 instead.
|
||||||
func NewLegacyKeccak256() hash.Hash { return &state{rate: 136, outputLen: 32, dsbyte: 0x01} }
|
func NewLegacyKeccak256() hash.Hash {
|
||||||
|
return &state{rate: rateK512, outputLen: 32, dsbyte: dsbyteKeccak}
|
||||||
|
}
|
||||||
|
|
||||||
// NewLegacyKeccak512 creates a new Keccak-512 hash.
|
// NewLegacyKeccak512 creates a new Keccak-512 hash.
|
||||||
//
|
//
|
||||||
// Only use this function if you require compatibility with an existing cryptosystem
|
// Only use this function if you require compatibility with an existing cryptosystem
|
||||||
// that uses non-standard padding. All other users should use New512 instead.
|
// that uses non-standard padding. All other users should use New512 instead.
|
||||||
func NewLegacyKeccak512() hash.Hash { return &state{rate: 72, outputLen: 64, dsbyte: 0x01} }
|
func NewLegacyKeccak512() hash.Hash {
|
||||||
|
return &state{rate: rateK1024, outputLen: 64, dsbyte: dsbyteKeccak}
|
||||||
|
}
|
||||||
|
|
||||||
// Sum224 returns the SHA3-224 digest of the data.
|
// Sum224 returns the SHA3-224 digest of the data.
|
||||||
func Sum224(data []byte) (digest [28]byte) {
|
func Sum224(data []byte) (digest [28]byte) {
|
||||||
|
|
|
@ -4,6 +4,15 @@
|
||||||
|
|
||||||
package sha3
|
package sha3
|
||||||
|
|
||||||
|
import (
|
||||||
|
"crypto/subtle"
|
||||||
|
"encoding/binary"
|
||||||
|
"errors"
|
||||||
|
"unsafe"
|
||||||
|
|
||||||
|
"golang.org/x/sys/cpu"
|
||||||
|
)
|
||||||
|
|
||||||
// spongeDirection indicates the direction bytes are flowing through the sponge.
|
// spongeDirection indicates the direction bytes are flowing through the sponge.
|
||||||
type spongeDirection int
|
type spongeDirection int
|
||||||
|
|
||||||
|
@ -14,16 +23,13 @@ const (
|
||||||
spongeSqueezing
|
spongeSqueezing
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
// maxRate is the maximum size of the internal buffer. SHAKE-256
|
|
||||||
// currently needs the largest buffer.
|
|
||||||
maxRate = 168
|
|
||||||
)
|
|
||||||
|
|
||||||
type state struct {
|
type state struct {
|
||||||
// Generic sponge components.
|
a [1600 / 8]byte // main state of the hash
|
||||||
a [25]uint64 // main state of the hash
|
|
||||||
rate int // the number of bytes of state to use
|
// a[n:rate] is the buffer. If absorbing, it's the remaining space to XOR
|
||||||
|
// into before running the permutation. If squeezing, it's the remaining
|
||||||
|
// output to produce before running the permutation.
|
||||||
|
n, rate int
|
||||||
|
|
||||||
// dsbyte contains the "domain separation" bits and the first bit of
|
// dsbyte contains the "domain separation" bits and the first bit of
|
||||||
// the padding. Sections 6.1 and 6.2 of [1] separate the outputs of the
|
// the padding. Sections 6.1 and 6.2 of [1] separate the outputs of the
|
||||||
|
@ -39,10 +45,6 @@ type state struct {
|
||||||
// Extendable-Output Functions (May 2014)"
|
// Extendable-Output Functions (May 2014)"
|
||||||
dsbyte byte
|
dsbyte byte
|
||||||
|
|
||||||
i, n int // storage[i:n] is the buffer, i is only used while squeezing
|
|
||||||
storage [maxRate]byte
|
|
||||||
|
|
||||||
// Specific to SHA-3 and SHAKE.
|
|
||||||
outputLen int // the default output size in bytes
|
outputLen int // the default output size in bytes
|
||||||
state spongeDirection // whether the sponge is absorbing or squeezing
|
state spongeDirection // whether the sponge is absorbing or squeezing
|
||||||
}
|
}
|
||||||
|
@ -61,7 +63,7 @@ func (d *state) Reset() {
|
||||||
d.a[i] = 0
|
d.a[i] = 0
|
||||||
}
|
}
|
||||||
d.state = spongeAbsorbing
|
d.state = spongeAbsorbing
|
||||||
d.i, d.n = 0, 0
|
d.n = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *state) clone() *state {
|
func (d *state) clone() *state {
|
||||||
|
@ -69,22 +71,25 @@ func (d *state) clone() *state {
|
||||||
return &ret
|
return &ret
|
||||||
}
|
}
|
||||||
|
|
||||||
// permute applies the KeccakF-1600 permutation. It handles
|
// permute applies the KeccakF-1600 permutation.
|
||||||
// any input-output buffering.
|
|
||||||
func (d *state) permute() {
|
func (d *state) permute() {
|
||||||
switch d.state {
|
var a *[25]uint64
|
||||||
case spongeAbsorbing:
|
if cpu.IsBigEndian {
|
||||||
// If we're absorbing, we need to xor the input into the state
|
a = new([25]uint64)
|
||||||
// before applying the permutation.
|
for i := range a {
|
||||||
xorIn(d, d.storage[:d.rate])
|
a[i] = binary.LittleEndian.Uint64(d.a[i*8:])
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
a = (*[25]uint64)(unsafe.Pointer(&d.a))
|
||||||
|
}
|
||||||
|
|
||||||
|
keccakF1600(a)
|
||||||
d.n = 0
|
d.n = 0
|
||||||
keccakF1600(&d.a)
|
|
||||||
case spongeSqueezing:
|
if cpu.IsBigEndian {
|
||||||
// If we're squeezing, we need to apply the permutation before
|
for i := range a {
|
||||||
// copying more output.
|
binary.LittleEndian.PutUint64(d.a[i*8:], a[i])
|
||||||
keccakF1600(&d.a)
|
}
|
||||||
d.i = 0
|
|
||||||
copyOut(d, d.storage[:d.rate])
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,55 +97,38 @@ func (d *state) permute() {
|
||||||
// the multi-bitrate 10..1 padding rule, and permutes the state.
|
// the multi-bitrate 10..1 padding rule, and permutes the state.
|
||||||
func (d *state) padAndPermute() {
|
func (d *state) padAndPermute() {
|
||||||
// Pad with this instance's domain-separator bits. We know that there's
|
// Pad with this instance's domain-separator bits. We know that there's
|
||||||
// at least one byte of space in d.buf because, if it were full,
|
// at least one byte of space in the sponge because, if it were full,
|
||||||
// permute would have been called to empty it. dsbyte also contains the
|
// permute would have been called to empty it. dsbyte also contains the
|
||||||
// first one bit for the padding. See the comment in the state struct.
|
// first one bit for the padding. See the comment in the state struct.
|
||||||
d.storage[d.n] = d.dsbyte
|
d.a[d.n] ^= d.dsbyte
|
||||||
d.n++
|
|
||||||
for d.n < d.rate {
|
|
||||||
d.storage[d.n] = 0
|
|
||||||
d.n++
|
|
||||||
}
|
|
||||||
// This adds the final one bit for the padding. Because of the way that
|
// This adds the final one bit for the padding. Because of the way that
|
||||||
// bits are numbered from the LSB upwards, the final bit is the MSB of
|
// bits are numbered from the LSB upwards, the final bit is the MSB of
|
||||||
// the last byte.
|
// the last byte.
|
||||||
d.storage[d.rate-1] ^= 0x80
|
d.a[d.rate-1] ^= 0x80
|
||||||
// Apply the permutation
|
// Apply the permutation
|
||||||
d.permute()
|
d.permute()
|
||||||
d.state = spongeSqueezing
|
d.state = spongeSqueezing
|
||||||
d.n = d.rate
|
|
||||||
copyOut(d, d.storage[:d.rate])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write absorbs more data into the hash's state. It panics if any
|
// Write absorbs more data into the hash's state. It panics if any
|
||||||
// output has already been read.
|
// output has already been read.
|
||||||
func (d *state) Write(p []byte) (written int, err error) {
|
func (d *state) Write(p []byte) (n int, err error) {
|
||||||
if d.state != spongeAbsorbing {
|
if d.state != spongeAbsorbing {
|
||||||
panic("sha3: Write after Read")
|
panic("sha3: Write after Read")
|
||||||
}
|
}
|
||||||
written = len(p)
|
|
||||||
|
n = len(p)
|
||||||
|
|
||||||
for len(p) > 0 {
|
for len(p) > 0 {
|
||||||
if d.n == 0 && len(p) >= d.rate {
|
x := subtle.XORBytes(d.a[d.n:d.rate], d.a[d.n:d.rate], p)
|
||||||
// The fast path; absorb a full "rate" bytes of input and apply the permutation.
|
d.n += x
|
||||||
xorIn(d, p[:d.rate])
|
p = p[x:]
|
||||||
p = p[d.rate:]
|
|
||||||
keccakF1600(&d.a)
|
|
||||||
} else {
|
|
||||||
// The slow path; buffer the input until we can fill the sponge, and then xor it in.
|
|
||||||
todo := d.rate - d.n
|
|
||||||
if todo > len(p) {
|
|
||||||
todo = len(p)
|
|
||||||
}
|
|
||||||
d.n += copy(d.storage[d.n:], p[:todo])
|
|
||||||
p = p[todo:]
|
|
||||||
|
|
||||||
// If the sponge is full, apply the permutation.
|
// If the sponge is full, apply the permutation.
|
||||||
if d.n == d.rate {
|
if d.n == d.rate {
|
||||||
d.permute()
|
d.permute()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -156,14 +144,14 @@ func (d *state) Read(out []byte) (n int, err error) {
|
||||||
|
|
||||||
// Now, do the squeezing.
|
// Now, do the squeezing.
|
||||||
for len(out) > 0 {
|
for len(out) > 0 {
|
||||||
n := copy(out, d.storage[d.i:d.n])
|
|
||||||
d.i += n
|
|
||||||
out = out[n:]
|
|
||||||
|
|
||||||
// Apply the permutation if we've squeezed the sponge dry.
|
// Apply the permutation if we've squeezed the sponge dry.
|
||||||
if d.i == d.rate {
|
if d.n == d.rate {
|
||||||
d.permute()
|
d.permute()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
x := copy(out, d.a[d.n:d.rate])
|
||||||
|
d.n += x
|
||||||
|
out = out[x:]
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -183,3 +171,74 @@ func (d *state) Sum(in []byte) []byte {
|
||||||
dup.Read(hash)
|
dup.Read(hash)
|
||||||
return append(in, hash...)
|
return append(in, hash...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
magicSHA3 = "sha\x08"
|
||||||
|
magicShake = "sha\x09"
|
||||||
|
magicCShake = "sha\x0a"
|
||||||
|
magicKeccak = "sha\x0b"
|
||||||
|
// magic || rate || main state || n || sponge direction
|
||||||
|
marshaledSize = len(magicSHA3) + 1 + 200 + 1 + 1
|
||||||
|
)
|
||||||
|
|
||||||
|
func (d *state) MarshalBinary() ([]byte, error) {
|
||||||
|
return d.AppendBinary(make([]byte, 0, marshaledSize))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *state) AppendBinary(b []byte) ([]byte, error) {
|
||||||
|
switch d.dsbyte {
|
||||||
|
case dsbyteSHA3:
|
||||||
|
b = append(b, magicSHA3...)
|
||||||
|
case dsbyteShake:
|
||||||
|
b = append(b, magicShake...)
|
||||||
|
case dsbyteCShake:
|
||||||
|
b = append(b, magicCShake...)
|
||||||
|
case dsbyteKeccak:
|
||||||
|
b = append(b, magicKeccak...)
|
||||||
|
default:
|
||||||
|
panic("unknown dsbyte")
|
||||||
|
}
|
||||||
|
// rate is at most 168, and n is at most rate.
|
||||||
|
b = append(b, byte(d.rate))
|
||||||
|
b = append(b, d.a[:]...)
|
||||||
|
b = append(b, byte(d.n), byte(d.state))
|
||||||
|
return b, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *state) UnmarshalBinary(b []byte) error {
|
||||||
|
if len(b) != marshaledSize {
|
||||||
|
return errors.New("sha3: invalid hash state")
|
||||||
|
}
|
||||||
|
|
||||||
|
magic := string(b[:len(magicSHA3)])
|
||||||
|
b = b[len(magicSHA3):]
|
||||||
|
switch {
|
||||||
|
case magic == magicSHA3 && d.dsbyte == dsbyteSHA3:
|
||||||
|
case magic == magicShake && d.dsbyte == dsbyteShake:
|
||||||
|
case magic == magicCShake && d.dsbyte == dsbyteCShake:
|
||||||
|
case magic == magicKeccak && d.dsbyte == dsbyteKeccak:
|
||||||
|
default:
|
||||||
|
return errors.New("sha3: invalid hash state identifier")
|
||||||
|
}
|
||||||
|
|
||||||
|
rate := int(b[0])
|
||||||
|
b = b[1:]
|
||||||
|
if rate != d.rate {
|
||||||
|
return errors.New("sha3: invalid hash state function")
|
||||||
|
}
|
||||||
|
|
||||||
|
copy(d.a[:], b)
|
||||||
|
b = b[len(d.a):]
|
||||||
|
|
||||||
|
n, state := int(b[0]), spongeDirection(b[1])
|
||||||
|
if n > d.rate {
|
||||||
|
return errors.New("sha3: invalid hash state")
|
||||||
|
}
|
||||||
|
d.n = n
|
||||||
|
if state != spongeAbsorbing && state != spongeSqueezing {
|
||||||
|
return errors.New("sha3: invalid hash state")
|
||||||
|
}
|
||||||
|
d.state = state
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
|
@ -16,9 +16,12 @@ package sha3
|
||||||
// [2] https://doi.org/10.6028/NIST.SP.800-185
|
// [2] https://doi.org/10.6028/NIST.SP.800-185
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
"errors"
|
||||||
"hash"
|
"hash"
|
||||||
"io"
|
"io"
|
||||||
|
"math/bits"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ShakeHash defines the interface to hash functions that support
|
// ShakeHash defines the interface to hash functions that support
|
||||||
|
@ -50,41 +53,33 @@ type cshakeState struct {
|
||||||
initBlock []byte
|
initBlock []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
// Consts for configuring initial SHA-3 state
|
func bytepad(data []byte, rate int) []byte {
|
||||||
const (
|
out := make([]byte, 0, 9+len(data)+rate-1)
|
||||||
dsbyteShake = 0x1f
|
out = append(out, leftEncode(uint64(rate))...)
|
||||||
dsbyteCShake = 0x04
|
out = append(out, data...)
|
||||||
rate128 = 168
|
if padlen := rate - len(out)%rate; padlen < rate {
|
||||||
rate256 = 136
|
out = append(out, make([]byte, padlen)...)
|
||||||
)
|
}
|
||||||
|
return out
|
||||||
func bytepad(input []byte, w int) []byte {
|
|
||||||
// leftEncode always returns max 9 bytes
|
|
||||||
buf := make([]byte, 0, 9+len(input)+w)
|
|
||||||
buf = append(buf, leftEncode(uint64(w))...)
|
|
||||||
buf = append(buf, input...)
|
|
||||||
padlen := w - (len(buf) % w)
|
|
||||||
return append(buf, make([]byte, padlen)...)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func leftEncode(value uint64) []byte {
|
func leftEncode(x uint64) []byte {
|
||||||
var b [9]byte
|
// Let n be the smallest positive integer for which 2^(8n) > x.
|
||||||
binary.BigEndian.PutUint64(b[1:], value)
|
n := (bits.Len64(x) + 7) / 8
|
||||||
// Trim all but last leading zero bytes
|
if n == 0 {
|
||||||
i := byte(1)
|
n = 1
|
||||||
for i < 8 && b[i] == 0 {
|
|
||||||
i++
|
|
||||||
}
|
}
|
||||||
// Prepend number of encoded bytes
|
// Return n || x with n as a byte and x an n bytes in big-endian order.
|
||||||
b[i-1] = 9 - i
|
b := make([]byte, 9)
|
||||||
return b[i-1:]
|
binary.BigEndian.PutUint64(b[1:], x)
|
||||||
|
b = b[9-n-1:]
|
||||||
|
b[0] = byte(n)
|
||||||
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
func newCShake(N, S []byte, rate, outputLen int, dsbyte byte) ShakeHash {
|
func newCShake(N, S []byte, rate, outputLen int, dsbyte byte) ShakeHash {
|
||||||
c := cshakeState{state: &state{rate: rate, outputLen: outputLen, dsbyte: dsbyte}}
|
c := cshakeState{state: &state{rate: rate, outputLen: outputLen, dsbyte: dsbyte}}
|
||||||
|
c.initBlock = make([]byte, 0, 9+len(N)+9+len(S)) // leftEncode returns max 9 bytes
|
||||||
// leftEncode returns max 9 bytes
|
|
||||||
c.initBlock = make([]byte, 0, 9*2+len(N)+len(S))
|
|
||||||
c.initBlock = append(c.initBlock, leftEncode(uint64(len(N))*8)...)
|
c.initBlock = append(c.initBlock, leftEncode(uint64(len(N))*8)...)
|
||||||
c.initBlock = append(c.initBlock, N...)
|
c.initBlock = append(c.initBlock, N...)
|
||||||
c.initBlock = append(c.initBlock, leftEncode(uint64(len(S))*8)...)
|
c.initBlock = append(c.initBlock, leftEncode(uint64(len(S))*8)...)
|
||||||
|
@ -111,6 +106,30 @@ func (c *state) Clone() ShakeHash {
|
||||||
return c.clone()
|
return c.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *cshakeState) MarshalBinary() ([]byte, error) {
|
||||||
|
return c.AppendBinary(make([]byte, 0, marshaledSize+len(c.initBlock)))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *cshakeState) AppendBinary(b []byte) ([]byte, error) {
|
||||||
|
b, err := c.state.AppendBinary(b)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
b = append(b, c.initBlock...)
|
||||||
|
return b, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *cshakeState) UnmarshalBinary(b []byte) error {
|
||||||
|
if len(b) <= marshaledSize {
|
||||||
|
return errors.New("sha3: invalid hash state")
|
||||||
|
}
|
||||||
|
if err := c.state.UnmarshalBinary(b[:marshaledSize]); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
c.initBlock = bytes.Clone(b[marshaledSize:])
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// NewShake128 creates a new SHAKE128 variable-output-length ShakeHash.
|
// NewShake128 creates a new SHAKE128 variable-output-length ShakeHash.
|
||||||
// Its generic security strength is 128 bits against all attacks if at
|
// Its generic security strength is 128 bits against all attacks if at
|
||||||
// least 32 bytes of its output are used.
|
// least 32 bytes of its output are used.
|
||||||
|
@ -126,11 +145,11 @@ func NewShake256() ShakeHash {
|
||||||
}
|
}
|
||||||
|
|
||||||
func newShake128Generic() *state {
|
func newShake128Generic() *state {
|
||||||
return &state{rate: rate128, outputLen: 32, dsbyte: dsbyteShake}
|
return &state{rate: rateK256, outputLen: 32, dsbyte: dsbyteShake}
|
||||||
}
|
}
|
||||||
|
|
||||||
func newShake256Generic() *state {
|
func newShake256Generic() *state {
|
||||||
return &state{rate: rate256, outputLen: 64, dsbyte: dsbyteShake}
|
return &state{rate: rateK512, outputLen: 64, dsbyte: dsbyteShake}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewCShake128 creates a new instance of cSHAKE128 variable-output-length ShakeHash,
|
// NewCShake128 creates a new instance of cSHAKE128 variable-output-length ShakeHash,
|
||||||
|
@ -143,7 +162,7 @@ func NewCShake128(N, S []byte) ShakeHash {
|
||||||
if len(N) == 0 && len(S) == 0 {
|
if len(N) == 0 && len(S) == 0 {
|
||||||
return NewShake128()
|
return NewShake128()
|
||||||
}
|
}
|
||||||
return newCShake(N, S, rate128, 32, dsbyteCShake)
|
return newCShake(N, S, rateK256, 32, dsbyteCShake)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewCShake256 creates a new instance of cSHAKE256 variable-output-length ShakeHash,
|
// NewCShake256 creates a new instance of cSHAKE256 variable-output-length ShakeHash,
|
||||||
|
@ -156,7 +175,7 @@ func NewCShake256(N, S []byte) ShakeHash {
|
||||||
if len(N) == 0 && len(S) == 0 {
|
if len(N) == 0 && len(S) == 0 {
|
||||||
return NewShake256()
|
return NewShake256()
|
||||||
}
|
}
|
||||||
return newCShake(N, S, rate256, 64, dsbyteCShake)
|
return newCShake(N, S, rateK512, 64, dsbyteCShake)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ShakeSum128 writes an arbitrary-length digest of data into hash.
|
// ShakeSum128 writes an arbitrary-length digest of data into hash.
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
// Copyright 2015 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package sha3
|
|
||||||
|
|
||||||
import (
|
|
||||||
"crypto/subtle"
|
|
||||||
"encoding/binary"
|
|
||||||
"unsafe"
|
|
||||||
|
|
||||||
"golang.org/x/sys/cpu"
|
|
||||||
)
|
|
||||||
|
|
||||||
// xorIn xors the bytes in buf into the state.
|
|
||||||
func xorIn(d *state, buf []byte) {
|
|
||||||
if cpu.IsBigEndian {
|
|
||||||
for i := 0; len(buf) >= 8; i++ {
|
|
||||||
a := binary.LittleEndian.Uint64(buf)
|
|
||||||
d.a[i] ^= a
|
|
||||||
buf = buf[8:]
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ab := (*[25 * 64 / 8]byte)(unsafe.Pointer(&d.a))
|
|
||||||
subtle.XORBytes(ab[:], ab[:], buf)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// copyOut copies uint64s to a byte buffer.
|
|
||||||
func copyOut(d *state, b []byte) {
|
|
||||||
if cpu.IsBigEndian {
|
|
||||||
for i := 0; len(b) >= 8; i++ {
|
|
||||||
binary.LittleEndian.PutUint64(b, d.a[i])
|
|
||||||
b = b[8:]
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ab := (*[25 * 64 / 8]byte)(unsafe.Pointer(&d.a))
|
|
||||||
copy(b, ab[:])
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -555,6 +555,7 @@ func (cb KeyboardInteractiveChallenge) auth(session []byte, user string, c packe
|
||||||
}
|
}
|
||||||
|
|
||||||
gotMsgExtInfo := false
|
gotMsgExtInfo := false
|
||||||
|
gotUserAuthInfoRequest := false
|
||||||
for {
|
for {
|
||||||
packet, err := c.readPacket()
|
packet, err := c.readPacket()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -585,6 +586,9 @@ func (cb KeyboardInteractiveChallenge) auth(session []byte, user string, c packe
|
||||||
if msg.PartialSuccess {
|
if msg.PartialSuccess {
|
||||||
return authPartialSuccess, msg.Methods, nil
|
return authPartialSuccess, msg.Methods, nil
|
||||||
}
|
}
|
||||||
|
if !gotUserAuthInfoRequest {
|
||||||
|
return authFailure, msg.Methods, unexpectedMessageError(msgUserAuthInfoRequest, packet[0])
|
||||||
|
}
|
||||||
return authFailure, msg.Methods, nil
|
return authFailure, msg.Methods, nil
|
||||||
case msgUserAuthSuccess:
|
case msgUserAuthSuccess:
|
||||||
return authSuccess, nil, nil
|
return authSuccess, nil, nil
|
||||||
|
@ -596,6 +600,7 @@ func (cb KeyboardInteractiveChallenge) auth(session []byte, user string, c packe
|
||||||
if err := Unmarshal(packet, &msg); err != nil {
|
if err := Unmarshal(packet, &msg); err != nil {
|
||||||
return authFailure, nil, err
|
return authFailure, nil, err
|
||||||
}
|
}
|
||||||
|
gotUserAuthInfoRequest = true
|
||||||
|
|
||||||
// Manually unpack the prompt/echo pairs.
|
// Manually unpack the prompt/echo pairs.
|
||||||
rest := msg.Prompts
|
rest := msg.Prompts
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright 2024 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build darwin && amd64 && gc
|
||||||
|
|
||||||
|
#include "textflag.h"
|
||||||
|
|
||||||
|
TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
|
JMP libc_sysctl(SB)
|
||||||
|
GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8
|
||||||
|
DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB)
|
||||||
|
|
||||||
|
TEXT libc_sysctlbyname_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
|
JMP libc_sysctlbyname(SB)
|
||||||
|
GLOBL ·libc_sysctlbyname_trampoline_addr(SB), RODATA, $8
|
||||||
|
DATA ·libc_sysctlbyname_trampoline_addr(SB)/8, $libc_sysctlbyname_trampoline<>(SB)
|
|
@ -0,0 +1,61 @@
|
||||||
|
// Copyright 2024 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build darwin && amd64 && gc
|
||||||
|
|
||||||
|
package cpu
|
||||||
|
|
||||||
|
// darwinSupportsAVX512 checks Darwin kernel for AVX512 support via sysctl
|
||||||
|
// call (see issue 43089). It also restricts AVX512 support for Darwin to
|
||||||
|
// kernel version 21.3.0 (MacOS 12.2.0) or later (see issue 49233).
|
||||||
|
//
|
||||||
|
// Background:
|
||||||
|
// Darwin implements a special mechanism to economize on thread state when
|
||||||
|
// AVX512 specific registers are not in use. This scheme minimizes state when
|
||||||
|
// preempting threads that haven't yet used any AVX512 instructions, but adds
|
||||||
|
// special requirements to check for AVX512 hardware support at runtime (e.g.
|
||||||
|
// via sysctl call or commpage inspection). See issue 43089 and link below for
|
||||||
|
// full background:
|
||||||
|
// https://github.com/apple-oss-distributions/xnu/blob/xnu-11215.1.10/osfmk/i386/fpu.c#L214-L240
|
||||||
|
//
|
||||||
|
// Additionally, all versions of the Darwin kernel from 19.6.0 through 21.2.0
|
||||||
|
// (corresponding to MacOS 10.15.6 - 12.1) have a bug that can cause corruption
|
||||||
|
// of the AVX512 mask registers (K0-K7) upon signal return. For this reason
|
||||||
|
// AVX512 is considered unsafe to use on Darwin for kernel versions prior to
|
||||||
|
// 21.3.0, where a fix has been confirmed. See issue 49233 for full background.
|
||||||
|
func darwinSupportsAVX512() bool {
|
||||||
|
return darwinSysctlEnabled([]byte("hw.optional.avx512f\x00")) && darwinKernelVersionCheck(21, 3, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure Darwin kernel version is at least major.minor.patch, avoiding dependencies
|
||||||
|
func darwinKernelVersionCheck(major, minor, patch int) bool {
|
||||||
|
var release [256]byte
|
||||||
|
err := darwinOSRelease(&release)
|
||||||
|
if err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
var mmp [3]int
|
||||||
|
c := 0
|
||||||
|
Loop:
|
||||||
|
for _, b := range release[:] {
|
||||||
|
switch {
|
||||||
|
case b >= '0' && b <= '9':
|
||||||
|
mmp[c] = 10*mmp[c] + int(b-'0')
|
||||||
|
case b == '.':
|
||||||
|
c++
|
||||||
|
if c > 2 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
case b == 0:
|
||||||
|
break Loop
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if c != 2 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return mmp[0] > major || mmp[0] == major && (mmp[1] > minor || mmp[1] == minor && mmp[2] >= patch)
|
||||||
|
}
|
|
@ -6,10 +6,10 @@
|
||||||
|
|
||||||
package cpu
|
package cpu
|
||||||
|
|
||||||
// cpuid is implemented in cpu_x86.s for gc compiler
|
// cpuid is implemented in cpu_gc_x86.s for gc compiler
|
||||||
// and in cpu_gccgo.c for gccgo.
|
// and in cpu_gccgo.c for gccgo.
|
||||||
func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32)
|
func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32)
|
||||||
|
|
||||||
// xgetbv with ecx = 0 is implemented in cpu_x86.s for gc compiler
|
// xgetbv with ecx = 0 is implemented in cpu_gc_x86.s for gc compiler
|
||||||
// and in cpu_gccgo.c for gccgo.
|
// and in cpu_gccgo.c for gccgo.
|
||||||
func xgetbv() (eax, edx uint32)
|
func xgetbv() (eax, edx uint32)
|
||||||
|
|
2
vendor/golang.org/x/sys/cpu/cpu_x86.s → vendor/golang.org/x/sys/cpu/cpu_gc_x86.s
generated
vendored
2
vendor/golang.org/x/sys/cpu/cpu_x86.s → vendor/golang.org/x/sys/cpu/cpu_gc_x86.s
generated
vendored
|
@ -18,7 +18,7 @@ TEXT ·cpuid(SB), NOSPLIT, $0-24
|
||||||
RET
|
RET
|
||||||
|
|
||||||
// func xgetbv() (eax, edx uint32)
|
// func xgetbv() (eax, edx uint32)
|
||||||
TEXT ·xgetbv(SB),NOSPLIT,$0-8
|
TEXT ·xgetbv(SB), NOSPLIT, $0-8
|
||||||
MOVL $0, CX
|
MOVL $0, CX
|
||||||
XGETBV
|
XGETBV
|
||||||
MOVL AX, eax+0(FP)
|
MOVL AX, eax+0(FP)
|
|
@ -23,9 +23,3 @@ func xgetbv() (eax, edx uint32) {
|
||||||
gccgoXgetbv(&a, &d)
|
gccgoXgetbv(&a, &d)
|
||||||
return a, d
|
return a, d
|
||||||
}
|
}
|
||||||
|
|
||||||
// gccgo doesn't build on Darwin, per:
|
|
||||||
// https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/gcc.rb#L76
|
|
||||||
func darwinSupportsAVX512() bool {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
|
@ -110,7 +110,6 @@ func doinit() {
|
||||||
ARM64.HasASIMDFHM = isSet(hwCap, hwcap_ASIMDFHM)
|
ARM64.HasASIMDFHM = isSet(hwCap, hwcap_ASIMDFHM)
|
||||||
ARM64.HasDIT = isSet(hwCap, hwcap_DIT)
|
ARM64.HasDIT = isSet(hwCap, hwcap_DIT)
|
||||||
|
|
||||||
|
|
||||||
// HWCAP2 feature bits
|
// HWCAP2 feature bits
|
||||||
ARM64.HasSVE2 = isSet(hwCap2, hwcap2_SVE2)
|
ARM64.HasSVE2 = isSet(hwCap2, hwcap2_SVE2)
|
||||||
ARM64.HasI8MM = isSet(hwCap2, hwcap2_I8MM)
|
ARM64.HasI8MM = isSet(hwCap2, hwcap2_I8MM)
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
// Copyright 2024 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build 386 || amd64p32 || (amd64 && (!darwin || !gc))
|
||||||
|
|
||||||
|
package cpu
|
||||||
|
|
||||||
|
func darwinSupportsAVX512() bool {
|
||||||
|
panic("only implemented for gc && amd64 && darwin")
|
||||||
|
}
|
|
@ -92,10 +92,8 @@ func archInit() {
|
||||||
osSupportsAVX = isSet(1, eax) && isSet(2, eax)
|
osSupportsAVX = isSet(1, eax) && isSet(2, eax)
|
||||||
|
|
||||||
if runtime.GOOS == "darwin" {
|
if runtime.GOOS == "darwin" {
|
||||||
// Darwin doesn't save/restore AVX-512 mask registers correctly across signal handlers.
|
// Darwin requires special AVX512 checks, see cpu_darwin_x86.go
|
||||||
// Since users can't rely on mask register contents, let's not advertise AVX-512 support.
|
osSupportsAVX512 = osSupportsAVX && darwinSupportsAVX512()
|
||||||
// See issue 49233.
|
|
||||||
osSupportsAVX512 = false
|
|
||||||
} else {
|
} else {
|
||||||
// Check if OPMASK and ZMM registers have OS support.
|
// Check if OPMASK and ZMM registers have OS support.
|
||||||
osSupportsAVX512 = osSupportsAVX && isSet(5, eax) && isSet(6, eax) && isSet(7, eax)
|
osSupportsAVX512 = osSupportsAVX && isSet(5, eax) && isSet(6, eax) && isSet(7, eax)
|
||||||
|
|
|
@ -0,0 +1,98 @@
|
||||||
|
// Copyright 2024 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Minimal copy of x/sys/unix so the cpu package can make a
|
||||||
|
// system call on Darwin without depending on x/sys/unix.
|
||||||
|
|
||||||
|
//go:build darwin && amd64 && gc
|
||||||
|
|
||||||
|
package cpu
|
||||||
|
|
||||||
|
import (
|
||||||
|
"syscall"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
type _C_int int32
|
||||||
|
|
||||||
|
// adapted from unix.Uname() at x/sys/unix/syscall_darwin.go L419
|
||||||
|
func darwinOSRelease(release *[256]byte) error {
|
||||||
|
// from x/sys/unix/zerrors_openbsd_amd64.go
|
||||||
|
const (
|
||||||
|
CTL_KERN = 0x1
|
||||||
|
KERN_OSRELEASE = 0x2
|
||||||
|
)
|
||||||
|
|
||||||
|
mib := []_C_int{CTL_KERN, KERN_OSRELEASE}
|
||||||
|
n := unsafe.Sizeof(*release)
|
||||||
|
|
||||||
|
return sysctl(mib, &release[0], &n, nil, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
type Errno = syscall.Errno
|
||||||
|
|
||||||
|
var _zero uintptr // Single-word zero for use when we need a valid pointer to 0 bytes.
|
||||||
|
|
||||||
|
// from x/sys/unix/zsyscall_darwin_amd64.go L791-807
|
||||||
|
func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) error {
|
||||||
|
var _p0 unsafe.Pointer
|
||||||
|
if len(mib) > 0 {
|
||||||
|
_p0 = unsafe.Pointer(&mib[0])
|
||||||
|
} else {
|
||||||
|
_p0 = unsafe.Pointer(&_zero)
|
||||||
|
}
|
||||||
|
if _, _, err := syscall_syscall6(
|
||||||
|
libc_sysctl_trampoline_addr,
|
||||||
|
uintptr(_p0),
|
||||||
|
uintptr(len(mib)),
|
||||||
|
uintptr(unsafe.Pointer(old)),
|
||||||
|
uintptr(unsafe.Pointer(oldlen)),
|
||||||
|
uintptr(unsafe.Pointer(new)),
|
||||||
|
uintptr(newlen),
|
||||||
|
); err != 0 {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var libc_sysctl_trampoline_addr uintptr
|
||||||
|
|
||||||
|
// adapted from internal/cpu/cpu_arm64_darwin.go
|
||||||
|
func darwinSysctlEnabled(name []byte) bool {
|
||||||
|
out := int32(0)
|
||||||
|
nout := unsafe.Sizeof(out)
|
||||||
|
if ret := sysctlbyname(&name[0], (*byte)(unsafe.Pointer(&out)), &nout, nil, 0); ret != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return out > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
//go:cgo_import_dynamic libc_sysctl sysctl "/usr/lib/libSystem.B.dylib"
|
||||||
|
|
||||||
|
var libc_sysctlbyname_trampoline_addr uintptr
|
||||||
|
|
||||||
|
// adapted from runtime/sys_darwin.go in the pattern of sysctl() above, as defined in x/sys/unix
|
||||||
|
func sysctlbyname(name *byte, old *byte, oldlen *uintptr, new *byte, newlen uintptr) error {
|
||||||
|
if _, _, err := syscall_syscall6(
|
||||||
|
libc_sysctlbyname_trampoline_addr,
|
||||||
|
uintptr(unsafe.Pointer(name)),
|
||||||
|
uintptr(unsafe.Pointer(old)),
|
||||||
|
uintptr(unsafe.Pointer(oldlen)),
|
||||||
|
uintptr(unsafe.Pointer(new)),
|
||||||
|
uintptr(newlen),
|
||||||
|
0,
|
||||||
|
); err != 0 {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
//go:cgo_import_dynamic libc_sysctlbyname sysctlbyname "/usr/lib/libSystem.B.dylib"
|
||||||
|
|
||||||
|
// Implemented in the runtime package (runtime/sys_darwin.go)
|
||||||
|
func syscall_syscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
|
||||||
|
|
||||||
|
//go:linkname syscall_syscall6 syscall.syscall6
|
|
@ -58,6 +58,102 @@ func IoctlGetEthtoolDrvinfo(fd int, ifname string) (*EthtoolDrvinfo, error) {
|
||||||
return &value, err
|
return &value, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IoctlGetEthtoolTsInfo fetches ethtool timestamping and PHC
|
||||||
|
// association for the network device specified by ifname.
|
||||||
|
func IoctlGetEthtoolTsInfo(fd int, ifname string) (*EthtoolTsInfo, error) {
|
||||||
|
ifr, err := NewIfreq(ifname)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
value := EthtoolTsInfo{Cmd: ETHTOOL_GET_TS_INFO}
|
||||||
|
ifrd := ifr.withData(unsafe.Pointer(&value))
|
||||||
|
|
||||||
|
err = ioctlIfreqData(fd, SIOCETHTOOL, &ifrd)
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlGetHwTstamp retrieves the hardware timestamping configuration
|
||||||
|
// for the network device specified by ifname.
|
||||||
|
func IoctlGetHwTstamp(fd int, ifname string) (*HwTstampConfig, error) {
|
||||||
|
ifr, err := NewIfreq(ifname)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
value := HwTstampConfig{}
|
||||||
|
ifrd := ifr.withData(unsafe.Pointer(&value))
|
||||||
|
|
||||||
|
err = ioctlIfreqData(fd, SIOCGHWTSTAMP, &ifrd)
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlSetHwTstamp updates the hardware timestamping configuration for
|
||||||
|
// the network device specified by ifname.
|
||||||
|
func IoctlSetHwTstamp(fd int, ifname string, cfg *HwTstampConfig) error {
|
||||||
|
ifr, err := NewIfreq(ifname)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
ifrd := ifr.withData(unsafe.Pointer(cfg))
|
||||||
|
return ioctlIfreqData(fd, SIOCSHWTSTAMP, &ifrd)
|
||||||
|
}
|
||||||
|
|
||||||
|
// FdToClockID derives the clock ID from the file descriptor number
|
||||||
|
// - see clock_gettime(3), FD_TO_CLOCKID macros. The resulting ID is
|
||||||
|
// suitable for system calls like ClockGettime.
|
||||||
|
func FdToClockID(fd int) int32 { return int32((int(^fd) << 3) | 3) }
|
||||||
|
|
||||||
|
// IoctlPtpClockGetcaps returns the description of a given PTP device.
|
||||||
|
func IoctlPtpClockGetcaps(fd int) (*PtpClockCaps, error) {
|
||||||
|
var value PtpClockCaps
|
||||||
|
err := ioctlPtr(fd, PTP_CLOCK_GETCAPS2, unsafe.Pointer(&value))
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlPtpSysOffsetPrecise returns a description of the clock
|
||||||
|
// offset compared to the system clock.
|
||||||
|
func IoctlPtpSysOffsetPrecise(fd int) (*PtpSysOffsetPrecise, error) {
|
||||||
|
var value PtpSysOffsetPrecise
|
||||||
|
err := ioctlPtr(fd, PTP_SYS_OFFSET_PRECISE2, unsafe.Pointer(&value))
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlPtpSysOffsetExtended returns an extended description of the
|
||||||
|
// clock offset compared to the system clock. The samples parameter
|
||||||
|
// specifies the desired number of measurements.
|
||||||
|
func IoctlPtpSysOffsetExtended(fd int, samples uint) (*PtpSysOffsetExtended, error) {
|
||||||
|
value := PtpSysOffsetExtended{Samples: uint32(samples)}
|
||||||
|
err := ioctlPtr(fd, PTP_SYS_OFFSET_EXTENDED2, unsafe.Pointer(&value))
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlPtpPinGetfunc returns the configuration of the specified
|
||||||
|
// I/O pin on given PTP device.
|
||||||
|
func IoctlPtpPinGetfunc(fd int, index uint) (*PtpPinDesc, error) {
|
||||||
|
value := PtpPinDesc{Index: uint32(index)}
|
||||||
|
err := ioctlPtr(fd, PTP_PIN_GETFUNC2, unsafe.Pointer(&value))
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlPtpPinSetfunc updates configuration of the specified PTP
|
||||||
|
// I/O pin.
|
||||||
|
func IoctlPtpPinSetfunc(fd int, pd *PtpPinDesc) error {
|
||||||
|
return ioctlPtr(fd, PTP_PIN_SETFUNC2, unsafe.Pointer(pd))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlPtpPeroutRequest configures the periodic output mode of the
|
||||||
|
// PTP I/O pins.
|
||||||
|
func IoctlPtpPeroutRequest(fd int, r *PtpPeroutRequest) error {
|
||||||
|
return ioctlPtr(fd, PTP_PEROUT_REQUEST2, unsafe.Pointer(r))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlPtpExttsRequest configures the external timestamping mode
|
||||||
|
// of the PTP I/O pins.
|
||||||
|
func IoctlPtpExttsRequest(fd int, r *PtpExttsRequest) error {
|
||||||
|
return ioctlPtr(fd, PTP_EXTTS_REQUEST2, unsafe.Pointer(r))
|
||||||
|
}
|
||||||
|
|
||||||
// IoctlGetWatchdogInfo fetches information about a watchdog device from the
|
// IoctlGetWatchdogInfo fetches information about a watchdog device from the
|
||||||
// Linux watchdog API. For more information, see:
|
// Linux watchdog API. For more information, see:
|
||||||
// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html.
|
// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html.
|
||||||
|
|
|
@ -158,6 +158,16 @@ includes_Linux='
|
||||||
#endif
|
#endif
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
|
|
||||||
|
// See the description in unix/linux/types.go
|
||||||
|
#if defined(__ARM_EABI__) || \
|
||||||
|
(defined(__mips__) && (_MIPS_SIM == _ABIO32)) || \
|
||||||
|
(defined(__powerpc__) && (!defined(__powerpc64__)))
|
||||||
|
# ifdef _TIME_BITS
|
||||||
|
# undef _TIME_BITS
|
||||||
|
# endif
|
||||||
|
# define _TIME_BITS 32
|
||||||
|
#endif
|
||||||
|
|
||||||
// <sys/ioctl.h> is broken on powerpc64, as it fails to include definitions of
|
// <sys/ioctl.h> is broken on powerpc64, as it fails to include definitions of
|
||||||
// these structures. We just include them copied from <bits/termios.h>.
|
// these structures. We just include them copied from <bits/termios.h>.
|
||||||
#if defined(__powerpc__)
|
#if defined(__powerpc__)
|
||||||
|
@ -256,6 +266,7 @@ struct ltchars {
|
||||||
#include <linux/nsfs.h>
|
#include <linux/nsfs.h>
|
||||||
#include <linux/perf_event.h>
|
#include <linux/perf_event.h>
|
||||||
#include <linux/pps.h>
|
#include <linux/pps.h>
|
||||||
|
#include <linux/ptp_clock.h>
|
||||||
#include <linux/ptrace.h>
|
#include <linux/ptrace.h>
|
||||||
#include <linux/random.h>
|
#include <linux/random.h>
|
||||||
#include <linux/reboot.h>
|
#include <linux/reboot.h>
|
||||||
|
@ -527,6 +538,7 @@ ccflags="$@"
|
||||||
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MREMAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL|TCPOPT|UDP)_/ ||
|
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MREMAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL|TCPOPT|UDP)_/ ||
|
||||||
$2 ~ /^NFC_(GENL|PROTO|COMM|RF|SE|DIRECTION|LLCP|SOCKPROTO)_/ ||
|
$2 ~ /^NFC_(GENL|PROTO|COMM|RF|SE|DIRECTION|LLCP|SOCKPROTO)_/ ||
|
||||||
$2 ~ /^NFC_.*_(MAX)?SIZE$/ ||
|
$2 ~ /^NFC_.*_(MAX)?SIZE$/ ||
|
||||||
|
$2 ~ /^PTP_/ ||
|
||||||
$2 ~ /^RAW_PAYLOAD_/ ||
|
$2 ~ /^RAW_PAYLOAD_/ ||
|
||||||
$2 ~ /^[US]F_/ ||
|
$2 ~ /^[US]F_/ ||
|
||||||
$2 ~ /^TP_STATUS_/ ||
|
$2 ~ /^TP_STATUS_/ ||
|
||||||
|
|
|
@ -1860,6 +1860,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
||||||
//sys ClockAdjtime(clockid int32, buf *Timex) (state int, err error)
|
//sys ClockAdjtime(clockid int32, buf *Timex) (state int, err error)
|
||||||
//sys ClockGetres(clockid int32, res *Timespec) (err error)
|
//sys ClockGetres(clockid int32, res *Timespec) (err error)
|
||||||
//sys ClockGettime(clockid int32, time *Timespec) (err error)
|
//sys ClockGettime(clockid int32, time *Timespec) (err error)
|
||||||
|
//sys ClockSettime(clockid int32, time *Timespec) (err error)
|
||||||
//sys ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error)
|
//sys ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error)
|
||||||
//sys Close(fd int) (err error)
|
//sys Close(fd int) (err error)
|
||||||
//sys CloseRange(first uint, last uint, flags uint) (err error)
|
//sys CloseRange(first uint, last uint, flags uint) (err error)
|
||||||
|
|
|
@ -768,6 +768,15 @@ func Munmap(b []byte) (err error) {
|
||||||
return mapper.Munmap(b)
|
return mapper.Munmap(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func MmapPtr(fd int, offset int64, addr unsafe.Pointer, length uintptr, prot int, flags int) (ret unsafe.Pointer, err error) {
|
||||||
|
xaddr, err := mapper.mmap(uintptr(addr), length, prot, flags, fd, offset)
|
||||||
|
return unsafe.Pointer(xaddr), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func MunmapPtr(addr unsafe.Pointer, length uintptr) (err error) {
|
||||||
|
return mapper.munmap(uintptr(addr), length)
|
||||||
|
}
|
||||||
|
|
||||||
//sys Gethostname(buf []byte) (err error) = SYS___GETHOSTNAME_A
|
//sys Gethostname(buf []byte) (err error) = SYS___GETHOSTNAME_A
|
||||||
//sysnb Getgid() (gid int)
|
//sysnb Getgid() (gid int)
|
||||||
//sysnb Getpid() (pid int)
|
//sysnb Getpid() (pid int)
|
||||||
|
@ -816,10 +825,10 @@ func Lstat(path string, stat *Stat_t) (err error) {
|
||||||
// for checking symlinks begins with $VERSION/ $SYSNAME/ $SYSSYMR/ $SYSSYMA/
|
// for checking symlinks begins with $VERSION/ $SYSNAME/ $SYSSYMR/ $SYSSYMA/
|
||||||
func isSpecialPath(path []byte) (v bool) {
|
func isSpecialPath(path []byte) (v bool) {
|
||||||
var special = [4][8]byte{
|
var special = [4][8]byte{
|
||||||
[8]byte{'V', 'E', 'R', 'S', 'I', 'O', 'N', '/'},
|
{'V', 'E', 'R', 'S', 'I', 'O', 'N', '/'},
|
||||||
[8]byte{'S', 'Y', 'S', 'N', 'A', 'M', 'E', '/'},
|
{'S', 'Y', 'S', 'N', 'A', 'M', 'E', '/'},
|
||||||
[8]byte{'S', 'Y', 'S', 'S', 'Y', 'M', 'R', '/'},
|
{'S', 'Y', 'S', 'S', 'Y', 'M', 'R', '/'},
|
||||||
[8]byte{'S', 'Y', 'S', 'S', 'Y', 'M', 'A', '/'}}
|
{'S', 'Y', 'S', 'S', 'Y', 'M', 'A', '/'}}
|
||||||
|
|
||||||
var i, j int
|
var i, j int
|
||||||
for i = 0; i < len(special); i++ {
|
for i = 0; i < len(special); i++ {
|
||||||
|
@ -3115,3 +3124,90 @@ func legacy_Mkfifoat(dirfd int, path string, mode uint32) (err error) {
|
||||||
//sys Posix_openpt(oflag int) (fd int, err error) = SYS_POSIX_OPENPT
|
//sys Posix_openpt(oflag int) (fd int, err error) = SYS_POSIX_OPENPT
|
||||||
//sys Grantpt(fildes int) (rc int, err error) = SYS_GRANTPT
|
//sys Grantpt(fildes int) (rc int, err error) = SYS_GRANTPT
|
||||||
//sys Unlockpt(fildes int) (rc int, err error) = SYS_UNLOCKPT
|
//sys Unlockpt(fildes int) (rc int, err error) = SYS_UNLOCKPT
|
||||||
|
|
||||||
|
func fcntlAsIs(fd uintptr, cmd int, arg uintptr) (val int, err error) {
|
||||||
|
runtime.EnterSyscall()
|
||||||
|
r0, e2, e1 := CallLeFuncWithErr(GetZosLibVec()+SYS_FCNTL<<4, uintptr(fd), uintptr(cmd), arg)
|
||||||
|
runtime.ExitSyscall()
|
||||||
|
val = int(r0)
|
||||||
|
if int64(r0) == -1 {
|
||||||
|
err = errnoErr2(e1, e2)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func Fcntl(fd uintptr, cmd int, op interface{}) (ret int, err error) {
|
||||||
|
switch op.(type) {
|
||||||
|
case *Flock_t:
|
||||||
|
err = FcntlFlock(fd, cmd, op.(*Flock_t))
|
||||||
|
if err != nil {
|
||||||
|
ret = -1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
case int:
|
||||||
|
return FcntlInt(fd, cmd, op.(int))
|
||||||
|
case *F_cnvrt:
|
||||||
|
return fcntlAsIs(fd, cmd, uintptr(unsafe.Pointer(op.(*F_cnvrt))))
|
||||||
|
case unsafe.Pointer:
|
||||||
|
return fcntlAsIs(fd, cmd, uintptr(op.(unsafe.Pointer)))
|
||||||
|
default:
|
||||||
|
return -1, EINVAL
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||||
|
if raceenabled {
|
||||||
|
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||||
|
}
|
||||||
|
return sendfile(outfd, infd, offset, count)
|
||||||
|
}
|
||||||
|
|
||||||
|
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||||
|
// TODO: use LE call instead if the call is implemented
|
||||||
|
originalOffset, err := Seek(infd, 0, SEEK_CUR)
|
||||||
|
if err != nil {
|
||||||
|
return -1, err
|
||||||
|
}
|
||||||
|
//start reading data from in_fd
|
||||||
|
if offset != nil {
|
||||||
|
_, err := Seek(infd, *offset, SEEK_SET)
|
||||||
|
if err != nil {
|
||||||
|
return -1, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buf := make([]byte, count)
|
||||||
|
readBuf := make([]byte, 0)
|
||||||
|
var n int = 0
|
||||||
|
for i := 0; i < count; i += n {
|
||||||
|
n, err := Read(infd, buf)
|
||||||
|
if n == 0 {
|
||||||
|
if err != nil {
|
||||||
|
return -1, err
|
||||||
|
} else { // EOF
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
readBuf = append(readBuf, buf...)
|
||||||
|
buf = buf[0:0]
|
||||||
|
}
|
||||||
|
|
||||||
|
n2, err := Write(outfd, readBuf)
|
||||||
|
if err != nil {
|
||||||
|
return -1, err
|
||||||
|
}
|
||||||
|
|
||||||
|
//When sendfile() returns, this variable will be set to the
|
||||||
|
// offset of the byte following the last byte that was read.
|
||||||
|
if offset != nil {
|
||||||
|
*offset = *offset + int64(n)
|
||||||
|
// If offset is not NULL, then sendfile() does not modify the file
|
||||||
|
// offset of in_fd
|
||||||
|
_, err := Seek(infd, originalOffset, SEEK_SET)
|
||||||
|
if err != nil {
|
||||||
|
return -1, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return n2, nil
|
||||||
|
}
|
||||||
|
|
|
@ -2625,6 +2625,28 @@ const (
|
||||||
PR_UNALIGN_NOPRINT = 0x1
|
PR_UNALIGN_NOPRINT = 0x1
|
||||||
PR_UNALIGN_SIGBUS = 0x2
|
PR_UNALIGN_SIGBUS = 0x2
|
||||||
PSTOREFS_MAGIC = 0x6165676c
|
PSTOREFS_MAGIC = 0x6165676c
|
||||||
|
PTP_CLK_MAGIC = '='
|
||||||
|
PTP_ENABLE_FEATURE = 0x1
|
||||||
|
PTP_EXTTS_EDGES = 0x6
|
||||||
|
PTP_EXTTS_EVENT_VALID = 0x1
|
||||||
|
PTP_EXTTS_V1_VALID_FLAGS = 0x7
|
||||||
|
PTP_EXTTS_VALID_FLAGS = 0x1f
|
||||||
|
PTP_EXT_OFFSET = 0x10
|
||||||
|
PTP_FALLING_EDGE = 0x4
|
||||||
|
PTP_MAX_SAMPLES = 0x19
|
||||||
|
PTP_PEROUT_DUTY_CYCLE = 0x2
|
||||||
|
PTP_PEROUT_ONE_SHOT = 0x1
|
||||||
|
PTP_PEROUT_PHASE = 0x4
|
||||||
|
PTP_PEROUT_V1_VALID_FLAGS = 0x0
|
||||||
|
PTP_PEROUT_VALID_FLAGS = 0x7
|
||||||
|
PTP_PIN_GETFUNC = 0xc0603d06
|
||||||
|
PTP_PIN_GETFUNC2 = 0xc0603d0f
|
||||||
|
PTP_RISING_EDGE = 0x2
|
||||||
|
PTP_STRICT_FLAGS = 0x8
|
||||||
|
PTP_SYS_OFFSET_EXTENDED = 0xc4c03d09
|
||||||
|
PTP_SYS_OFFSET_EXTENDED2 = 0xc4c03d12
|
||||||
|
PTP_SYS_OFFSET_PRECISE = 0xc0403d08
|
||||||
|
PTP_SYS_OFFSET_PRECISE2 = 0xc0403d11
|
||||||
PTRACE_ATTACH = 0x10
|
PTRACE_ATTACH = 0x10
|
||||||
PTRACE_CONT = 0x7
|
PTRACE_CONT = 0x7
|
||||||
PTRACE_DETACH = 0x11
|
PTRACE_DETACH = 0x11
|
||||||
|
|
|
@ -237,6 +237,20 @@ const (
|
||||||
PPPIOCUNBRIDGECHAN = 0x7434
|
PPPIOCUNBRIDGECHAN = 0x7434
|
||||||
PPPIOCXFERUNIT = 0x744e
|
PPPIOCXFERUNIT = 0x744e
|
||||||
PR_SET_PTRACER_ANY = 0xffffffff
|
PR_SET_PTRACER_ANY = 0xffffffff
|
||||||
|
PTP_CLOCK_GETCAPS = 0x80503d01
|
||||||
|
PTP_CLOCK_GETCAPS2 = 0x80503d0a
|
||||||
|
PTP_ENABLE_PPS = 0x40043d04
|
||||||
|
PTP_ENABLE_PPS2 = 0x40043d0d
|
||||||
|
PTP_EXTTS_REQUEST = 0x40103d02
|
||||||
|
PTP_EXTTS_REQUEST2 = 0x40103d0b
|
||||||
|
PTP_MASK_CLEAR_ALL = 0x3d13
|
||||||
|
PTP_MASK_EN_SINGLE = 0x40043d14
|
||||||
|
PTP_PEROUT_REQUEST = 0x40383d03
|
||||||
|
PTP_PEROUT_REQUEST2 = 0x40383d0c
|
||||||
|
PTP_PIN_SETFUNC = 0x40603d07
|
||||||
|
PTP_PIN_SETFUNC2 = 0x40603d10
|
||||||
|
PTP_SYS_OFFSET = 0x43403d05
|
||||||
|
PTP_SYS_OFFSET2 = 0x43403d0e
|
||||||
PTRACE_GETFPREGS = 0xe
|
PTRACE_GETFPREGS = 0xe
|
||||||
PTRACE_GETFPXREGS = 0x12
|
PTRACE_GETFPXREGS = 0x12
|
||||||
PTRACE_GET_THREAD_AREA = 0x19
|
PTRACE_GET_THREAD_AREA = 0x19
|
||||||
|
|
|
@ -237,6 +237,20 @@ const (
|
||||||
PPPIOCUNBRIDGECHAN = 0x7434
|
PPPIOCUNBRIDGECHAN = 0x7434
|
||||||
PPPIOCXFERUNIT = 0x744e
|
PPPIOCXFERUNIT = 0x744e
|
||||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||||
|
PTP_CLOCK_GETCAPS = 0x80503d01
|
||||||
|
PTP_CLOCK_GETCAPS2 = 0x80503d0a
|
||||||
|
PTP_ENABLE_PPS = 0x40043d04
|
||||||
|
PTP_ENABLE_PPS2 = 0x40043d0d
|
||||||
|
PTP_EXTTS_REQUEST = 0x40103d02
|
||||||
|
PTP_EXTTS_REQUEST2 = 0x40103d0b
|
||||||
|
PTP_MASK_CLEAR_ALL = 0x3d13
|
||||||
|
PTP_MASK_EN_SINGLE = 0x40043d14
|
||||||
|
PTP_PEROUT_REQUEST = 0x40383d03
|
||||||
|
PTP_PEROUT_REQUEST2 = 0x40383d0c
|
||||||
|
PTP_PIN_SETFUNC = 0x40603d07
|
||||||
|
PTP_PIN_SETFUNC2 = 0x40603d10
|
||||||
|
PTP_SYS_OFFSET = 0x43403d05
|
||||||
|
PTP_SYS_OFFSET2 = 0x43403d0e
|
||||||
PTRACE_ARCH_PRCTL = 0x1e
|
PTRACE_ARCH_PRCTL = 0x1e
|
||||||
PTRACE_GETFPREGS = 0xe
|
PTRACE_GETFPREGS = 0xe
|
||||||
PTRACE_GETFPXREGS = 0x12
|
PTRACE_GETFPXREGS = 0x12
|
||||||
|
|
|
@ -234,6 +234,20 @@ const (
|
||||||
PPPIOCUNBRIDGECHAN = 0x7434
|
PPPIOCUNBRIDGECHAN = 0x7434
|
||||||
PPPIOCXFERUNIT = 0x744e
|
PPPIOCXFERUNIT = 0x744e
|
||||||
PR_SET_PTRACER_ANY = 0xffffffff
|
PR_SET_PTRACER_ANY = 0xffffffff
|
||||||
|
PTP_CLOCK_GETCAPS = 0x80503d01
|
||||||
|
PTP_CLOCK_GETCAPS2 = 0x80503d0a
|
||||||
|
PTP_ENABLE_PPS = 0x40043d04
|
||||||
|
PTP_ENABLE_PPS2 = 0x40043d0d
|
||||||
|
PTP_EXTTS_REQUEST = 0x40103d02
|
||||||
|
PTP_EXTTS_REQUEST2 = 0x40103d0b
|
||||||
|
PTP_MASK_CLEAR_ALL = 0x3d13
|
||||||
|
PTP_MASK_EN_SINGLE = 0x40043d14
|
||||||
|
PTP_PEROUT_REQUEST = 0x40383d03
|
||||||
|
PTP_PEROUT_REQUEST2 = 0x40383d0c
|
||||||
|
PTP_PIN_SETFUNC = 0x40603d07
|
||||||
|
PTP_PIN_SETFUNC2 = 0x40603d10
|
||||||
|
PTP_SYS_OFFSET = 0x43403d05
|
||||||
|
PTP_SYS_OFFSET2 = 0x43403d0e
|
||||||
PTRACE_GETCRUNCHREGS = 0x19
|
PTRACE_GETCRUNCHREGS = 0x19
|
||||||
PTRACE_GETFDPIC = 0x1f
|
PTRACE_GETFDPIC = 0x1f
|
||||||
PTRACE_GETFDPIC_EXEC = 0x0
|
PTRACE_GETFDPIC_EXEC = 0x0
|
||||||
|
|
|
@ -240,6 +240,20 @@ const (
|
||||||
PROT_BTI = 0x10
|
PROT_BTI = 0x10
|
||||||
PROT_MTE = 0x20
|
PROT_MTE = 0x20
|
||||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||||
|
PTP_CLOCK_GETCAPS = 0x80503d01
|
||||||
|
PTP_CLOCK_GETCAPS2 = 0x80503d0a
|
||||||
|
PTP_ENABLE_PPS = 0x40043d04
|
||||||
|
PTP_ENABLE_PPS2 = 0x40043d0d
|
||||||
|
PTP_EXTTS_REQUEST = 0x40103d02
|
||||||
|
PTP_EXTTS_REQUEST2 = 0x40103d0b
|
||||||
|
PTP_MASK_CLEAR_ALL = 0x3d13
|
||||||
|
PTP_MASK_EN_SINGLE = 0x40043d14
|
||||||
|
PTP_PEROUT_REQUEST = 0x40383d03
|
||||||
|
PTP_PEROUT_REQUEST2 = 0x40383d0c
|
||||||
|
PTP_PIN_SETFUNC = 0x40603d07
|
||||||
|
PTP_PIN_SETFUNC2 = 0x40603d10
|
||||||
|
PTP_SYS_OFFSET = 0x43403d05
|
||||||
|
PTP_SYS_OFFSET2 = 0x43403d0e
|
||||||
PTRACE_PEEKMTETAGS = 0x21
|
PTRACE_PEEKMTETAGS = 0x21
|
||||||
PTRACE_POKEMTETAGS = 0x22
|
PTRACE_POKEMTETAGS = 0x22
|
||||||
PTRACE_SYSEMU = 0x1f
|
PTRACE_SYSEMU = 0x1f
|
||||||
|
|
|
@ -238,6 +238,20 @@ const (
|
||||||
PPPIOCUNBRIDGECHAN = 0x7434
|
PPPIOCUNBRIDGECHAN = 0x7434
|
||||||
PPPIOCXFERUNIT = 0x744e
|
PPPIOCXFERUNIT = 0x744e
|
||||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||||
|
PTP_CLOCK_GETCAPS = 0x80503d01
|
||||||
|
PTP_CLOCK_GETCAPS2 = 0x80503d0a
|
||||||
|
PTP_ENABLE_PPS = 0x40043d04
|
||||||
|
PTP_ENABLE_PPS2 = 0x40043d0d
|
||||||
|
PTP_EXTTS_REQUEST = 0x40103d02
|
||||||
|
PTP_EXTTS_REQUEST2 = 0x40103d0b
|
||||||
|
PTP_MASK_CLEAR_ALL = 0x3d13
|
||||||
|
PTP_MASK_EN_SINGLE = 0x40043d14
|
||||||
|
PTP_PEROUT_REQUEST = 0x40383d03
|
||||||
|
PTP_PEROUT_REQUEST2 = 0x40383d0c
|
||||||
|
PTP_PIN_SETFUNC = 0x40603d07
|
||||||
|
PTP_PIN_SETFUNC2 = 0x40603d10
|
||||||
|
PTP_SYS_OFFSET = 0x43403d05
|
||||||
|
PTP_SYS_OFFSET2 = 0x43403d0e
|
||||||
PTRACE_SYSEMU = 0x1f
|
PTRACE_SYSEMU = 0x1f
|
||||||
PTRACE_SYSEMU_SINGLESTEP = 0x20
|
PTRACE_SYSEMU_SINGLESTEP = 0x20
|
||||||
RLIMIT_AS = 0x9
|
RLIMIT_AS = 0x9
|
||||||
|
|
|
@ -234,6 +234,20 @@ const (
|
||||||
PPPIOCUNBRIDGECHAN = 0x20007434
|
PPPIOCUNBRIDGECHAN = 0x20007434
|
||||||
PPPIOCXFERUNIT = 0x2000744e
|
PPPIOCXFERUNIT = 0x2000744e
|
||||||
PR_SET_PTRACER_ANY = 0xffffffff
|
PR_SET_PTRACER_ANY = 0xffffffff
|
||||||
|
PTP_CLOCK_GETCAPS = 0x40503d01
|
||||||
|
PTP_CLOCK_GETCAPS2 = 0x40503d0a
|
||||||
|
PTP_ENABLE_PPS = 0x80043d04
|
||||||
|
PTP_ENABLE_PPS2 = 0x80043d0d
|
||||||
|
PTP_EXTTS_REQUEST = 0x80103d02
|
||||||
|
PTP_EXTTS_REQUEST2 = 0x80103d0b
|
||||||
|
PTP_MASK_CLEAR_ALL = 0x20003d13
|
||||||
|
PTP_MASK_EN_SINGLE = 0x80043d14
|
||||||
|
PTP_PEROUT_REQUEST = 0x80383d03
|
||||||
|
PTP_PEROUT_REQUEST2 = 0x80383d0c
|
||||||
|
PTP_PIN_SETFUNC = 0x80603d07
|
||||||
|
PTP_PIN_SETFUNC2 = 0x80603d10
|
||||||
|
PTP_SYS_OFFSET = 0x83403d05
|
||||||
|
PTP_SYS_OFFSET2 = 0x83403d0e
|
||||||
PTRACE_GETFPREGS = 0xe
|
PTRACE_GETFPREGS = 0xe
|
||||||
PTRACE_GET_THREAD_AREA = 0x19
|
PTRACE_GET_THREAD_AREA = 0x19
|
||||||
PTRACE_GET_THREAD_AREA_3264 = 0xc4
|
PTRACE_GET_THREAD_AREA_3264 = 0xc4
|
||||||
|
|
|
@ -234,6 +234,20 @@ const (
|
||||||
PPPIOCUNBRIDGECHAN = 0x20007434
|
PPPIOCUNBRIDGECHAN = 0x20007434
|
||||||
PPPIOCXFERUNIT = 0x2000744e
|
PPPIOCXFERUNIT = 0x2000744e
|
||||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||||
|
PTP_CLOCK_GETCAPS = 0x40503d01
|
||||||
|
PTP_CLOCK_GETCAPS2 = 0x40503d0a
|
||||||
|
PTP_ENABLE_PPS = 0x80043d04
|
||||||
|
PTP_ENABLE_PPS2 = 0x80043d0d
|
||||||
|
PTP_EXTTS_REQUEST = 0x80103d02
|
||||||
|
PTP_EXTTS_REQUEST2 = 0x80103d0b
|
||||||
|
PTP_MASK_CLEAR_ALL = 0x20003d13
|
||||||
|
PTP_MASK_EN_SINGLE = 0x80043d14
|
||||||
|
PTP_PEROUT_REQUEST = 0x80383d03
|
||||||
|
PTP_PEROUT_REQUEST2 = 0x80383d0c
|
||||||
|
PTP_PIN_SETFUNC = 0x80603d07
|
||||||
|
PTP_PIN_SETFUNC2 = 0x80603d10
|
||||||
|
PTP_SYS_OFFSET = 0x83403d05
|
||||||
|
PTP_SYS_OFFSET2 = 0x83403d0e
|
||||||
PTRACE_GETFPREGS = 0xe
|
PTRACE_GETFPREGS = 0xe
|
||||||
PTRACE_GET_THREAD_AREA = 0x19
|
PTRACE_GET_THREAD_AREA = 0x19
|
||||||
PTRACE_GET_THREAD_AREA_3264 = 0xc4
|
PTRACE_GET_THREAD_AREA_3264 = 0xc4
|
||||||
|
|
|
@ -234,6 +234,20 @@ const (
|
||||||
PPPIOCUNBRIDGECHAN = 0x20007434
|
PPPIOCUNBRIDGECHAN = 0x20007434
|
||||||
PPPIOCXFERUNIT = 0x2000744e
|
PPPIOCXFERUNIT = 0x2000744e
|
||||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||||
|
PTP_CLOCK_GETCAPS = 0x40503d01
|
||||||
|
PTP_CLOCK_GETCAPS2 = 0x40503d0a
|
||||||
|
PTP_ENABLE_PPS = 0x80043d04
|
||||||
|
PTP_ENABLE_PPS2 = 0x80043d0d
|
||||||
|
PTP_EXTTS_REQUEST = 0x80103d02
|
||||||
|
PTP_EXTTS_REQUEST2 = 0x80103d0b
|
||||||
|
PTP_MASK_CLEAR_ALL = 0x20003d13
|
||||||
|
PTP_MASK_EN_SINGLE = 0x80043d14
|
||||||
|
PTP_PEROUT_REQUEST = 0x80383d03
|
||||||
|
PTP_PEROUT_REQUEST2 = 0x80383d0c
|
||||||
|
PTP_PIN_SETFUNC = 0x80603d07
|
||||||
|
PTP_PIN_SETFUNC2 = 0x80603d10
|
||||||
|
PTP_SYS_OFFSET = 0x83403d05
|
||||||
|
PTP_SYS_OFFSET2 = 0x83403d0e
|
||||||
PTRACE_GETFPREGS = 0xe
|
PTRACE_GETFPREGS = 0xe
|
||||||
PTRACE_GET_THREAD_AREA = 0x19
|
PTRACE_GET_THREAD_AREA = 0x19
|
||||||
PTRACE_GET_THREAD_AREA_3264 = 0xc4
|
PTRACE_GET_THREAD_AREA_3264 = 0xc4
|
||||||
|
|
|
@ -234,6 +234,20 @@ const (
|
||||||
PPPIOCUNBRIDGECHAN = 0x20007434
|
PPPIOCUNBRIDGECHAN = 0x20007434
|
||||||
PPPIOCXFERUNIT = 0x2000744e
|
PPPIOCXFERUNIT = 0x2000744e
|
||||||
PR_SET_PTRACER_ANY = 0xffffffff
|
PR_SET_PTRACER_ANY = 0xffffffff
|
||||||
|
PTP_CLOCK_GETCAPS = 0x40503d01
|
||||||
|
PTP_CLOCK_GETCAPS2 = 0x40503d0a
|
||||||
|
PTP_ENABLE_PPS = 0x80043d04
|
||||||
|
PTP_ENABLE_PPS2 = 0x80043d0d
|
||||||
|
PTP_EXTTS_REQUEST = 0x80103d02
|
||||||
|
PTP_EXTTS_REQUEST2 = 0x80103d0b
|
||||||
|
PTP_MASK_CLEAR_ALL = 0x20003d13
|
||||||
|
PTP_MASK_EN_SINGLE = 0x80043d14
|
||||||
|
PTP_PEROUT_REQUEST = 0x80383d03
|
||||||
|
PTP_PEROUT_REQUEST2 = 0x80383d0c
|
||||||
|
PTP_PIN_SETFUNC = 0x80603d07
|
||||||
|
PTP_PIN_SETFUNC2 = 0x80603d10
|
||||||
|
PTP_SYS_OFFSET = 0x83403d05
|
||||||
|
PTP_SYS_OFFSET2 = 0x83403d0e
|
||||||
PTRACE_GETFPREGS = 0xe
|
PTRACE_GETFPREGS = 0xe
|
||||||
PTRACE_GET_THREAD_AREA = 0x19
|
PTRACE_GET_THREAD_AREA = 0x19
|
||||||
PTRACE_GET_THREAD_AREA_3264 = 0xc4
|
PTRACE_GET_THREAD_AREA_3264 = 0xc4
|
||||||
|
|
|
@ -237,6 +237,20 @@ const (
|
||||||
PPPIOCXFERUNIT = 0x2000744e
|
PPPIOCXFERUNIT = 0x2000744e
|
||||||
PROT_SAO = 0x10
|
PROT_SAO = 0x10
|
||||||
PR_SET_PTRACER_ANY = 0xffffffff
|
PR_SET_PTRACER_ANY = 0xffffffff
|
||||||
|
PTP_CLOCK_GETCAPS = 0x40503d01
|
||||||
|
PTP_CLOCK_GETCAPS2 = 0x40503d0a
|
||||||
|
PTP_ENABLE_PPS = 0x80043d04
|
||||||
|
PTP_ENABLE_PPS2 = 0x80043d0d
|
||||||
|
PTP_EXTTS_REQUEST = 0x80103d02
|
||||||
|
PTP_EXTTS_REQUEST2 = 0x80103d0b
|
||||||
|
PTP_MASK_CLEAR_ALL = 0x20003d13
|
||||||
|
PTP_MASK_EN_SINGLE = 0x80043d14
|
||||||
|
PTP_PEROUT_REQUEST = 0x80383d03
|
||||||
|
PTP_PEROUT_REQUEST2 = 0x80383d0c
|
||||||
|
PTP_PIN_SETFUNC = 0x80603d07
|
||||||
|
PTP_PIN_SETFUNC2 = 0x80603d10
|
||||||
|
PTP_SYS_OFFSET = 0x83403d05
|
||||||
|
PTP_SYS_OFFSET2 = 0x83403d0e
|
||||||
PTRACE_GETEVRREGS = 0x14
|
PTRACE_GETEVRREGS = 0x14
|
||||||
PTRACE_GETFPREGS = 0xe
|
PTRACE_GETFPREGS = 0xe
|
||||||
PTRACE_GETREGS64 = 0x16
|
PTRACE_GETREGS64 = 0x16
|
||||||
|
|
|
@ -237,6 +237,20 @@ const (
|
||||||
PPPIOCXFERUNIT = 0x2000744e
|
PPPIOCXFERUNIT = 0x2000744e
|
||||||
PROT_SAO = 0x10
|
PROT_SAO = 0x10
|
||||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||||
|
PTP_CLOCK_GETCAPS = 0x40503d01
|
||||||
|
PTP_CLOCK_GETCAPS2 = 0x40503d0a
|
||||||
|
PTP_ENABLE_PPS = 0x80043d04
|
||||||
|
PTP_ENABLE_PPS2 = 0x80043d0d
|
||||||
|
PTP_EXTTS_REQUEST = 0x80103d02
|
||||||
|
PTP_EXTTS_REQUEST2 = 0x80103d0b
|
||||||
|
PTP_MASK_CLEAR_ALL = 0x20003d13
|
||||||
|
PTP_MASK_EN_SINGLE = 0x80043d14
|
||||||
|
PTP_PEROUT_REQUEST = 0x80383d03
|
||||||
|
PTP_PEROUT_REQUEST2 = 0x80383d0c
|
||||||
|
PTP_PIN_SETFUNC = 0x80603d07
|
||||||
|
PTP_PIN_SETFUNC2 = 0x80603d10
|
||||||
|
PTP_SYS_OFFSET = 0x83403d05
|
||||||
|
PTP_SYS_OFFSET2 = 0x83403d0e
|
||||||
PTRACE_GETEVRREGS = 0x14
|
PTRACE_GETEVRREGS = 0x14
|
||||||
PTRACE_GETFPREGS = 0xe
|
PTRACE_GETFPREGS = 0xe
|
||||||
PTRACE_GETREGS64 = 0x16
|
PTRACE_GETREGS64 = 0x16
|
||||||
|
|
|
@ -237,6 +237,20 @@ const (
|
||||||
PPPIOCXFERUNIT = 0x2000744e
|
PPPIOCXFERUNIT = 0x2000744e
|
||||||
PROT_SAO = 0x10
|
PROT_SAO = 0x10
|
||||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||||
|
PTP_CLOCK_GETCAPS = 0x40503d01
|
||||||
|
PTP_CLOCK_GETCAPS2 = 0x40503d0a
|
||||||
|
PTP_ENABLE_PPS = 0x80043d04
|
||||||
|
PTP_ENABLE_PPS2 = 0x80043d0d
|
||||||
|
PTP_EXTTS_REQUEST = 0x80103d02
|
||||||
|
PTP_EXTTS_REQUEST2 = 0x80103d0b
|
||||||
|
PTP_MASK_CLEAR_ALL = 0x20003d13
|
||||||
|
PTP_MASK_EN_SINGLE = 0x80043d14
|
||||||
|
PTP_PEROUT_REQUEST = 0x80383d03
|
||||||
|
PTP_PEROUT_REQUEST2 = 0x80383d0c
|
||||||
|
PTP_PIN_SETFUNC = 0x80603d07
|
||||||
|
PTP_PIN_SETFUNC2 = 0x80603d10
|
||||||
|
PTP_SYS_OFFSET = 0x83403d05
|
||||||
|
PTP_SYS_OFFSET2 = 0x83403d0e
|
||||||
PTRACE_GETEVRREGS = 0x14
|
PTRACE_GETEVRREGS = 0x14
|
||||||
PTRACE_GETFPREGS = 0xe
|
PTRACE_GETFPREGS = 0xe
|
||||||
PTRACE_GETREGS64 = 0x16
|
PTRACE_GETREGS64 = 0x16
|
||||||
|
|
|
@ -234,6 +234,20 @@ const (
|
||||||
PPPIOCUNBRIDGECHAN = 0x7434
|
PPPIOCUNBRIDGECHAN = 0x7434
|
||||||
PPPIOCXFERUNIT = 0x744e
|
PPPIOCXFERUNIT = 0x744e
|
||||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||||
|
PTP_CLOCK_GETCAPS = 0x80503d01
|
||||||
|
PTP_CLOCK_GETCAPS2 = 0x80503d0a
|
||||||
|
PTP_ENABLE_PPS = 0x40043d04
|
||||||
|
PTP_ENABLE_PPS2 = 0x40043d0d
|
||||||
|
PTP_EXTTS_REQUEST = 0x40103d02
|
||||||
|
PTP_EXTTS_REQUEST2 = 0x40103d0b
|
||||||
|
PTP_MASK_CLEAR_ALL = 0x3d13
|
||||||
|
PTP_MASK_EN_SINGLE = 0x40043d14
|
||||||
|
PTP_PEROUT_REQUEST = 0x40383d03
|
||||||
|
PTP_PEROUT_REQUEST2 = 0x40383d0c
|
||||||
|
PTP_PIN_SETFUNC = 0x40603d07
|
||||||
|
PTP_PIN_SETFUNC2 = 0x40603d10
|
||||||
|
PTP_SYS_OFFSET = 0x43403d05
|
||||||
|
PTP_SYS_OFFSET2 = 0x43403d0e
|
||||||
PTRACE_GETFDPIC = 0x21
|
PTRACE_GETFDPIC = 0x21
|
||||||
PTRACE_GETFDPIC_EXEC = 0x0
|
PTRACE_GETFDPIC_EXEC = 0x0
|
||||||
PTRACE_GETFDPIC_INTERP = 0x1
|
PTRACE_GETFDPIC_INTERP = 0x1
|
||||||
|
|
|
@ -234,6 +234,20 @@ const (
|
||||||
PPPIOCUNBRIDGECHAN = 0x7434
|
PPPIOCUNBRIDGECHAN = 0x7434
|
||||||
PPPIOCXFERUNIT = 0x744e
|
PPPIOCXFERUNIT = 0x744e
|
||||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||||
|
PTP_CLOCK_GETCAPS = 0x80503d01
|
||||||
|
PTP_CLOCK_GETCAPS2 = 0x80503d0a
|
||||||
|
PTP_ENABLE_PPS = 0x40043d04
|
||||||
|
PTP_ENABLE_PPS2 = 0x40043d0d
|
||||||
|
PTP_EXTTS_REQUEST = 0x40103d02
|
||||||
|
PTP_EXTTS_REQUEST2 = 0x40103d0b
|
||||||
|
PTP_MASK_CLEAR_ALL = 0x3d13
|
||||||
|
PTP_MASK_EN_SINGLE = 0x40043d14
|
||||||
|
PTP_PEROUT_REQUEST = 0x40383d03
|
||||||
|
PTP_PEROUT_REQUEST2 = 0x40383d0c
|
||||||
|
PTP_PIN_SETFUNC = 0x40603d07
|
||||||
|
PTP_PIN_SETFUNC2 = 0x40603d10
|
||||||
|
PTP_SYS_OFFSET = 0x43403d05
|
||||||
|
PTP_SYS_OFFSET2 = 0x43403d0e
|
||||||
PTRACE_DISABLE_TE = 0x5010
|
PTRACE_DISABLE_TE = 0x5010
|
||||||
PTRACE_ENABLE_TE = 0x5009
|
PTRACE_ENABLE_TE = 0x5009
|
||||||
PTRACE_GET_LAST_BREAK = 0x5006
|
PTRACE_GET_LAST_BREAK = 0x5006
|
||||||
|
|
|
@ -239,6 +239,20 @@ const (
|
||||||
PPPIOCUNBRIDGECHAN = 0x20007434
|
PPPIOCUNBRIDGECHAN = 0x20007434
|
||||||
PPPIOCXFERUNIT = 0x2000744e
|
PPPIOCXFERUNIT = 0x2000744e
|
||||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||||
|
PTP_CLOCK_GETCAPS = 0x40503d01
|
||||||
|
PTP_CLOCK_GETCAPS2 = 0x40503d0a
|
||||||
|
PTP_ENABLE_PPS = 0x80043d04
|
||||||
|
PTP_ENABLE_PPS2 = 0x80043d0d
|
||||||
|
PTP_EXTTS_REQUEST = 0x80103d02
|
||||||
|
PTP_EXTTS_REQUEST2 = 0x80103d0b
|
||||||
|
PTP_MASK_CLEAR_ALL = 0x20003d13
|
||||||
|
PTP_MASK_EN_SINGLE = 0x80043d14
|
||||||
|
PTP_PEROUT_REQUEST = 0x80383d03
|
||||||
|
PTP_PEROUT_REQUEST2 = 0x80383d0c
|
||||||
|
PTP_PIN_SETFUNC = 0x80603d07
|
||||||
|
PTP_PIN_SETFUNC2 = 0x80603d10
|
||||||
|
PTP_SYS_OFFSET = 0x83403d05
|
||||||
|
PTP_SYS_OFFSET2 = 0x83403d0e
|
||||||
PTRACE_GETFPAREGS = 0x14
|
PTRACE_GETFPAREGS = 0x14
|
||||||
PTRACE_GETFPREGS = 0xe
|
PTRACE_GETFPREGS = 0xe
|
||||||
PTRACE_GETFPREGS64 = 0x19
|
PTRACE_GETFPREGS64 = 0x19
|
||||||
|
|
|
@ -592,6 +592,16 @@ func ClockGettime(clockid int32, time *Timespec) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func ClockSettime(clockid int32, time *Timespec) (err error) {
|
||||||
|
_, _, e1 := Syscall(SYS_CLOCK_SETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) {
|
func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) {
|
||||||
_, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0)
|
_, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0)
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
|
|
|
@ -1752,12 +1752,6 @@ const (
|
||||||
IFLA_IPVLAN_UNSPEC = 0x0
|
IFLA_IPVLAN_UNSPEC = 0x0
|
||||||
IFLA_IPVLAN_MODE = 0x1
|
IFLA_IPVLAN_MODE = 0x1
|
||||||
IFLA_IPVLAN_FLAGS = 0x2
|
IFLA_IPVLAN_FLAGS = 0x2
|
||||||
NETKIT_NEXT = -0x1
|
|
||||||
NETKIT_PASS = 0x0
|
|
||||||
NETKIT_DROP = 0x2
|
|
||||||
NETKIT_REDIRECT = 0x7
|
|
||||||
NETKIT_L2 = 0x0
|
|
||||||
NETKIT_L3 = 0x1
|
|
||||||
IFLA_NETKIT_UNSPEC = 0x0
|
IFLA_NETKIT_UNSPEC = 0x0
|
||||||
IFLA_NETKIT_PEER_INFO = 0x1
|
IFLA_NETKIT_PEER_INFO = 0x1
|
||||||
IFLA_NETKIT_PRIMARY = 0x2
|
IFLA_NETKIT_PRIMARY = 0x2
|
||||||
|
@ -1796,6 +1790,7 @@ const (
|
||||||
IFLA_VXLAN_DF = 0x1d
|
IFLA_VXLAN_DF = 0x1d
|
||||||
IFLA_VXLAN_VNIFILTER = 0x1e
|
IFLA_VXLAN_VNIFILTER = 0x1e
|
||||||
IFLA_VXLAN_LOCALBYPASS = 0x1f
|
IFLA_VXLAN_LOCALBYPASS = 0x1f
|
||||||
|
IFLA_VXLAN_LABEL_POLICY = 0x20
|
||||||
IFLA_GENEVE_UNSPEC = 0x0
|
IFLA_GENEVE_UNSPEC = 0x0
|
||||||
IFLA_GENEVE_ID = 0x1
|
IFLA_GENEVE_ID = 0x1
|
||||||
IFLA_GENEVE_REMOTE = 0x2
|
IFLA_GENEVE_REMOTE = 0x2
|
||||||
|
@ -1825,6 +1820,8 @@ const (
|
||||||
IFLA_GTP_ROLE = 0x4
|
IFLA_GTP_ROLE = 0x4
|
||||||
IFLA_GTP_CREATE_SOCKETS = 0x5
|
IFLA_GTP_CREATE_SOCKETS = 0x5
|
||||||
IFLA_GTP_RESTART_COUNT = 0x6
|
IFLA_GTP_RESTART_COUNT = 0x6
|
||||||
|
IFLA_GTP_LOCAL = 0x7
|
||||||
|
IFLA_GTP_LOCAL6 = 0x8
|
||||||
IFLA_BOND_UNSPEC = 0x0
|
IFLA_BOND_UNSPEC = 0x0
|
||||||
IFLA_BOND_MODE = 0x1
|
IFLA_BOND_MODE = 0x1
|
||||||
IFLA_BOND_ACTIVE_SLAVE = 0x2
|
IFLA_BOND_ACTIVE_SLAVE = 0x2
|
||||||
|
@ -1857,6 +1854,7 @@ const (
|
||||||
IFLA_BOND_AD_LACP_ACTIVE = 0x1d
|
IFLA_BOND_AD_LACP_ACTIVE = 0x1d
|
||||||
IFLA_BOND_MISSED_MAX = 0x1e
|
IFLA_BOND_MISSED_MAX = 0x1e
|
||||||
IFLA_BOND_NS_IP6_TARGET = 0x1f
|
IFLA_BOND_NS_IP6_TARGET = 0x1f
|
||||||
|
IFLA_BOND_COUPLED_CONTROL = 0x20
|
||||||
IFLA_BOND_AD_INFO_UNSPEC = 0x0
|
IFLA_BOND_AD_INFO_UNSPEC = 0x0
|
||||||
IFLA_BOND_AD_INFO_AGGREGATOR = 0x1
|
IFLA_BOND_AD_INFO_AGGREGATOR = 0x1
|
||||||
IFLA_BOND_AD_INFO_NUM_PORTS = 0x2
|
IFLA_BOND_AD_INFO_NUM_PORTS = 0x2
|
||||||
|
@ -1925,6 +1923,7 @@ const (
|
||||||
IFLA_HSR_SEQ_NR = 0x5
|
IFLA_HSR_SEQ_NR = 0x5
|
||||||
IFLA_HSR_VERSION = 0x6
|
IFLA_HSR_VERSION = 0x6
|
||||||
IFLA_HSR_PROTOCOL = 0x7
|
IFLA_HSR_PROTOCOL = 0x7
|
||||||
|
IFLA_HSR_INTERLINK = 0x8
|
||||||
IFLA_STATS_UNSPEC = 0x0
|
IFLA_STATS_UNSPEC = 0x0
|
||||||
IFLA_STATS_LINK_64 = 0x1
|
IFLA_STATS_LINK_64 = 0x1
|
||||||
IFLA_STATS_LINK_XSTATS = 0x2
|
IFLA_STATS_LINK_XSTATS = 0x2
|
||||||
|
@ -1977,6 +1976,15 @@ const (
|
||||||
IFLA_DSA_MASTER = 0x1
|
IFLA_DSA_MASTER = 0x1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
NETKIT_NEXT = -0x1
|
||||||
|
NETKIT_PASS = 0x0
|
||||||
|
NETKIT_DROP = 0x2
|
||||||
|
NETKIT_REDIRECT = 0x7
|
||||||
|
NETKIT_L2 = 0x0
|
||||||
|
NETKIT_L3 = 0x1
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
NF_INET_PRE_ROUTING = 0x0
|
NF_INET_PRE_ROUTING = 0x0
|
||||||
NF_INET_LOCAL_IN = 0x1
|
NF_INET_LOCAL_IN = 0x1
|
||||||
|
@ -4110,6 +4118,106 @@ type EthtoolDrvinfo struct {
|
||||||
Regdump_len uint32
|
Regdump_len uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type EthtoolTsInfo struct {
|
||||||
|
Cmd uint32
|
||||||
|
So_timestamping uint32
|
||||||
|
Phc_index int32
|
||||||
|
Tx_types uint32
|
||||||
|
Tx_reserved [3]uint32
|
||||||
|
Rx_filters uint32
|
||||||
|
Rx_reserved [3]uint32
|
||||||
|
}
|
||||||
|
|
||||||
|
type HwTstampConfig struct {
|
||||||
|
Flags int32
|
||||||
|
Tx_type int32
|
||||||
|
Rx_filter int32
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
HWTSTAMP_FILTER_NONE = 0x0
|
||||||
|
HWTSTAMP_FILTER_ALL = 0x1
|
||||||
|
HWTSTAMP_FILTER_SOME = 0x2
|
||||||
|
HWTSTAMP_FILTER_PTP_V1_L4_EVENT = 0x3
|
||||||
|
HWTSTAMP_FILTER_PTP_V2_L4_EVENT = 0x6
|
||||||
|
HWTSTAMP_FILTER_PTP_V2_L2_EVENT = 0x9
|
||||||
|
HWTSTAMP_FILTER_PTP_V2_EVENT = 0xc
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
HWTSTAMP_TX_OFF = 0x0
|
||||||
|
HWTSTAMP_TX_ON = 0x1
|
||||||
|
HWTSTAMP_TX_ONESTEP_SYNC = 0x2
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
PtpClockCaps struct {
|
||||||
|
Max_adj int32
|
||||||
|
N_alarm int32
|
||||||
|
N_ext_ts int32
|
||||||
|
N_per_out int32
|
||||||
|
Pps int32
|
||||||
|
N_pins int32
|
||||||
|
Cross_timestamping int32
|
||||||
|
Adjust_phase int32
|
||||||
|
Max_phase_adj int32
|
||||||
|
Rsv [11]int32
|
||||||
|
}
|
||||||
|
PtpClockTime struct {
|
||||||
|
Sec int64
|
||||||
|
Nsec uint32
|
||||||
|
Reserved uint32
|
||||||
|
}
|
||||||
|
PtpExttsEvent struct {
|
||||||
|
T PtpClockTime
|
||||||
|
Index uint32
|
||||||
|
Flags uint32
|
||||||
|
Rsv [2]uint32
|
||||||
|
}
|
||||||
|
PtpExttsRequest struct {
|
||||||
|
Index uint32
|
||||||
|
Flags uint32
|
||||||
|
Rsv [2]uint32
|
||||||
|
}
|
||||||
|
PtpPeroutRequest struct {
|
||||||
|
StartOrPhase PtpClockTime
|
||||||
|
Period PtpClockTime
|
||||||
|
Index uint32
|
||||||
|
Flags uint32
|
||||||
|
On PtpClockTime
|
||||||
|
}
|
||||||
|
PtpPinDesc struct {
|
||||||
|
Name [64]byte
|
||||||
|
Index uint32
|
||||||
|
Func uint32
|
||||||
|
Chan uint32
|
||||||
|
Rsv [5]uint32
|
||||||
|
}
|
||||||
|
PtpSysOffset struct {
|
||||||
|
Samples uint32
|
||||||
|
Rsv [3]uint32
|
||||||
|
Ts [51]PtpClockTime
|
||||||
|
}
|
||||||
|
PtpSysOffsetExtended struct {
|
||||||
|
Samples uint32
|
||||||
|
Rsv [3]uint32
|
||||||
|
Ts [25][3]PtpClockTime
|
||||||
|
}
|
||||||
|
PtpSysOffsetPrecise struct {
|
||||||
|
Device PtpClockTime
|
||||||
|
Realtime PtpClockTime
|
||||||
|
Monoraw PtpClockTime
|
||||||
|
Rsv [4]uint32
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
PTP_PF_NONE = 0x0
|
||||||
|
PTP_PF_EXTTS = 0x1
|
||||||
|
PTP_PF_PEROUT = 0x2
|
||||||
|
PTP_PF_PHYSYNC = 0x3
|
||||||
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
HIDRawReportDescriptor struct {
|
HIDRawReportDescriptor struct {
|
||||||
Size uint32
|
Size uint32
|
||||||
|
|
|
@ -377,6 +377,12 @@ type Flock_t struct {
|
||||||
Pid int32
|
Pid int32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type F_cnvrt struct {
|
||||||
|
Cvtcmd int32
|
||||||
|
Pccsid int16
|
||||||
|
Fccsid int16
|
||||||
|
}
|
||||||
|
|
||||||
type Termios struct {
|
type Termios struct {
|
||||||
Cflag uint32
|
Cflag uint32
|
||||||
Iflag uint32
|
Iflag uint32
|
||||||
|
|
|
@ -725,20 +725,12 @@ func DurationSinceBoot() time.Duration {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Ftruncate(fd Handle, length int64) (err error) {
|
func Ftruncate(fd Handle, length int64) (err error) {
|
||||||
curoffset, e := Seek(fd, 0, 1)
|
type _FILE_END_OF_FILE_INFO struct {
|
||||||
if e != nil {
|
EndOfFile int64
|
||||||
return e
|
|
||||||
}
|
}
|
||||||
defer Seek(fd, curoffset, 0)
|
var info _FILE_END_OF_FILE_INFO
|
||||||
_, e = Seek(fd, length, 0)
|
info.EndOfFile = length
|
||||||
if e != nil {
|
return SetFileInformationByHandle(fd, FileEndOfFileInfo, (*byte)(unsafe.Pointer(&info)), uint32(unsafe.Sizeof(info)))
|
||||||
return e
|
|
||||||
}
|
|
||||||
e = SetEndOfFile(fd)
|
|
||||||
if e != nil {
|
|
||||||
return e
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func Gettimeofday(tv *Timeval) (err error) {
|
func Gettimeofday(tv *Timeval) (err error) {
|
||||||
|
@ -894,6 +886,11 @@ const socket_error = uintptr(^uint32(0))
|
||||||
//sys GetACP() (acp uint32) = kernel32.GetACP
|
//sys GetACP() (acp uint32) = kernel32.GetACP
|
||||||
//sys MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) = kernel32.MultiByteToWideChar
|
//sys MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) = kernel32.MultiByteToWideChar
|
||||||
//sys getBestInterfaceEx(sockaddr unsafe.Pointer, pdwBestIfIndex *uint32) (errcode error) = iphlpapi.GetBestInterfaceEx
|
//sys getBestInterfaceEx(sockaddr unsafe.Pointer, pdwBestIfIndex *uint32) (errcode error) = iphlpapi.GetBestInterfaceEx
|
||||||
|
//sys GetIfEntry2Ex(level uint32, row *MibIfRow2) (errcode error) = iphlpapi.GetIfEntry2Ex
|
||||||
|
//sys GetUnicastIpAddressEntry(row *MibUnicastIpAddressRow) (errcode error) = iphlpapi.GetUnicastIpAddressEntry
|
||||||
|
//sys NotifyIpInterfaceChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) = iphlpapi.NotifyIpInterfaceChange
|
||||||
|
//sys NotifyUnicastIpAddressChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) = iphlpapi.NotifyUnicastIpAddressChange
|
||||||
|
//sys CancelMibChangeNotify2(notificationHandle Handle) (errcode error) = iphlpapi.CancelMibChangeNotify2
|
||||||
|
|
||||||
// For testing: clients can set this flag to force
|
// For testing: clients can set this flag to force
|
||||||
// creation of IPv6 sockets to return EAFNOSUPPORT.
|
// creation of IPv6 sockets to return EAFNOSUPPORT.
|
||||||
|
@ -1685,13 +1682,16 @@ func (s NTStatus) Error() string {
|
||||||
// do not use NTUnicodeString, and instead UTF16PtrFromString should be used for
|
// do not use NTUnicodeString, and instead UTF16PtrFromString should be used for
|
||||||
// the more common *uint16 string type.
|
// the more common *uint16 string type.
|
||||||
func NewNTUnicodeString(s string) (*NTUnicodeString, error) {
|
func NewNTUnicodeString(s string) (*NTUnicodeString, error) {
|
||||||
var u NTUnicodeString
|
s16, err := UTF16FromString(s)
|
||||||
s16, err := UTF16PtrFromString(s)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
RtlInitUnicodeString(&u, s16)
|
n := uint16(len(s16) * 2)
|
||||||
return &u, nil
|
return &NTUnicodeString{
|
||||||
|
Length: n - 2, // subtract 2 bytes for the NULL terminator
|
||||||
|
MaximumLength: n,
|
||||||
|
Buffer: &s16[0],
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Slice returns a uint16 slice that aliases the data in the NTUnicodeString.
|
// Slice returns a uint16 slice that aliases the data in the NTUnicodeString.
|
||||||
|
|
|
@ -2203,6 +2203,132 @@ const (
|
||||||
IfOperStatusLowerLayerDown = 7
|
IfOperStatusLowerLayerDown = 7
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
IF_MAX_PHYS_ADDRESS_LENGTH = 32
|
||||||
|
IF_MAX_STRING_SIZE = 256
|
||||||
|
)
|
||||||
|
|
||||||
|
// MIB_IF_ENTRY_LEVEL enumeration from netioapi.h or
|
||||||
|
// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/nf-netioapi-getifentry2ex.
|
||||||
|
const (
|
||||||
|
MibIfEntryNormal = 0
|
||||||
|
MibIfEntryNormalWithoutStatistics = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
// MIB_NOTIFICATION_TYPE enumeration from netioapi.h or
|
||||||
|
// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ne-netioapi-mib_notification_type.
|
||||||
|
const (
|
||||||
|
MibParameterNotification = 0
|
||||||
|
MibAddInstance = 1
|
||||||
|
MibDeleteInstance = 2
|
||||||
|
MibInitialNotification = 3
|
||||||
|
)
|
||||||
|
|
||||||
|
// MibIfRow2 stores information about a particular interface. See
|
||||||
|
// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_if_row2.
|
||||||
|
type MibIfRow2 struct {
|
||||||
|
InterfaceLuid uint64
|
||||||
|
InterfaceIndex uint32
|
||||||
|
InterfaceGuid GUID
|
||||||
|
Alias [IF_MAX_STRING_SIZE + 1]uint16
|
||||||
|
Description [IF_MAX_STRING_SIZE + 1]uint16
|
||||||
|
PhysicalAddressLength uint32
|
||||||
|
PhysicalAddress [IF_MAX_PHYS_ADDRESS_LENGTH]uint8
|
||||||
|
PermanentPhysicalAddress [IF_MAX_PHYS_ADDRESS_LENGTH]uint8
|
||||||
|
Mtu uint32
|
||||||
|
Type uint32
|
||||||
|
TunnelType uint32
|
||||||
|
MediaType uint32
|
||||||
|
PhysicalMediumType uint32
|
||||||
|
AccessType uint32
|
||||||
|
DirectionType uint32
|
||||||
|
InterfaceAndOperStatusFlags uint8
|
||||||
|
OperStatus uint32
|
||||||
|
AdminStatus uint32
|
||||||
|
MediaConnectState uint32
|
||||||
|
NetworkGuid GUID
|
||||||
|
ConnectionType uint32
|
||||||
|
TransmitLinkSpeed uint64
|
||||||
|
ReceiveLinkSpeed uint64
|
||||||
|
InOctets uint64
|
||||||
|
InUcastPkts uint64
|
||||||
|
InNUcastPkts uint64
|
||||||
|
InDiscards uint64
|
||||||
|
InErrors uint64
|
||||||
|
InUnknownProtos uint64
|
||||||
|
InUcastOctets uint64
|
||||||
|
InMulticastOctets uint64
|
||||||
|
InBroadcastOctets uint64
|
||||||
|
OutOctets uint64
|
||||||
|
OutUcastPkts uint64
|
||||||
|
OutNUcastPkts uint64
|
||||||
|
OutDiscards uint64
|
||||||
|
OutErrors uint64
|
||||||
|
OutUcastOctets uint64
|
||||||
|
OutMulticastOctets uint64
|
||||||
|
OutBroadcastOctets uint64
|
||||||
|
OutQLen uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
// MIB_UNICASTIPADDRESS_ROW stores information about a unicast IP address. See
|
||||||
|
// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_unicastipaddress_row.
|
||||||
|
type MibUnicastIpAddressRow struct {
|
||||||
|
Address RawSockaddrInet6 // SOCKADDR_INET union
|
||||||
|
InterfaceLuid uint64
|
||||||
|
InterfaceIndex uint32
|
||||||
|
PrefixOrigin uint32
|
||||||
|
SuffixOrigin uint32
|
||||||
|
ValidLifetime uint32
|
||||||
|
PreferredLifetime uint32
|
||||||
|
OnLinkPrefixLength uint8
|
||||||
|
SkipAsSource uint8
|
||||||
|
DadState uint32
|
||||||
|
ScopeId uint32
|
||||||
|
CreationTimeStamp Filetime
|
||||||
|
}
|
||||||
|
|
||||||
|
const ScopeLevelCount = 16
|
||||||
|
|
||||||
|
// MIB_IPINTERFACE_ROW stores interface management information for a particular IP address family on a network interface.
|
||||||
|
// See https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_ipinterface_row.
|
||||||
|
type MibIpInterfaceRow struct {
|
||||||
|
Family uint16
|
||||||
|
InterfaceLuid uint64
|
||||||
|
InterfaceIndex uint32
|
||||||
|
MaxReassemblySize uint32
|
||||||
|
InterfaceIdentifier uint64
|
||||||
|
MinRouterAdvertisementInterval uint32
|
||||||
|
MaxRouterAdvertisementInterval uint32
|
||||||
|
AdvertisingEnabled uint8
|
||||||
|
ForwardingEnabled uint8
|
||||||
|
WeakHostSend uint8
|
||||||
|
WeakHostReceive uint8
|
||||||
|
UseAutomaticMetric uint8
|
||||||
|
UseNeighborUnreachabilityDetection uint8
|
||||||
|
ManagedAddressConfigurationSupported uint8
|
||||||
|
OtherStatefulConfigurationSupported uint8
|
||||||
|
AdvertiseDefaultRoute uint8
|
||||||
|
RouterDiscoveryBehavior uint32
|
||||||
|
DadTransmits uint32
|
||||||
|
BaseReachableTime uint32
|
||||||
|
RetransmitTime uint32
|
||||||
|
PathMtuDiscoveryTimeout uint32
|
||||||
|
LinkLocalAddressBehavior uint32
|
||||||
|
LinkLocalAddressTimeout uint32
|
||||||
|
ZoneIndices [ScopeLevelCount]uint32
|
||||||
|
SitePrefixLength uint32
|
||||||
|
Metric uint32
|
||||||
|
NlMtu uint32
|
||||||
|
Connected uint8
|
||||||
|
SupportsWakeUpPatterns uint8
|
||||||
|
SupportsNeighborDiscovery uint8
|
||||||
|
SupportsRouterDiscovery uint8
|
||||||
|
ReachableTime uint32
|
||||||
|
TransmitOffload uint32
|
||||||
|
ReceiveOffload uint32
|
||||||
|
DisableDefaultRoutes uint8
|
||||||
|
}
|
||||||
|
|
||||||
// Console related constants used for the mode parameter to SetConsoleMode. See
|
// Console related constants used for the mode parameter to SetConsoleMode. See
|
||||||
// https://docs.microsoft.com/en-us/windows/console/setconsolemode for details.
|
// https://docs.microsoft.com/en-us/windows/console/setconsolemode for details.
|
||||||
|
|
||||||
|
|
|
@ -181,10 +181,15 @@ var (
|
||||||
procDnsRecordListFree = moddnsapi.NewProc("DnsRecordListFree")
|
procDnsRecordListFree = moddnsapi.NewProc("DnsRecordListFree")
|
||||||
procDwmGetWindowAttribute = moddwmapi.NewProc("DwmGetWindowAttribute")
|
procDwmGetWindowAttribute = moddwmapi.NewProc("DwmGetWindowAttribute")
|
||||||
procDwmSetWindowAttribute = moddwmapi.NewProc("DwmSetWindowAttribute")
|
procDwmSetWindowAttribute = moddwmapi.NewProc("DwmSetWindowAttribute")
|
||||||
|
procCancelMibChangeNotify2 = modiphlpapi.NewProc("CancelMibChangeNotify2")
|
||||||
procGetAdaptersAddresses = modiphlpapi.NewProc("GetAdaptersAddresses")
|
procGetAdaptersAddresses = modiphlpapi.NewProc("GetAdaptersAddresses")
|
||||||
procGetAdaptersInfo = modiphlpapi.NewProc("GetAdaptersInfo")
|
procGetAdaptersInfo = modiphlpapi.NewProc("GetAdaptersInfo")
|
||||||
procGetBestInterfaceEx = modiphlpapi.NewProc("GetBestInterfaceEx")
|
procGetBestInterfaceEx = modiphlpapi.NewProc("GetBestInterfaceEx")
|
||||||
procGetIfEntry = modiphlpapi.NewProc("GetIfEntry")
|
procGetIfEntry = modiphlpapi.NewProc("GetIfEntry")
|
||||||
|
procGetIfEntry2Ex = modiphlpapi.NewProc("GetIfEntry2Ex")
|
||||||
|
procGetUnicastIpAddressEntry = modiphlpapi.NewProc("GetUnicastIpAddressEntry")
|
||||||
|
procNotifyIpInterfaceChange = modiphlpapi.NewProc("NotifyIpInterfaceChange")
|
||||||
|
procNotifyUnicastIpAddressChange = modiphlpapi.NewProc("NotifyUnicastIpAddressChange")
|
||||||
procAddDllDirectory = modkernel32.NewProc("AddDllDirectory")
|
procAddDllDirectory = modkernel32.NewProc("AddDllDirectory")
|
||||||
procAssignProcessToJobObject = modkernel32.NewProc("AssignProcessToJobObject")
|
procAssignProcessToJobObject = modkernel32.NewProc("AssignProcessToJobObject")
|
||||||
procCancelIo = modkernel32.NewProc("CancelIo")
|
procCancelIo = modkernel32.NewProc("CancelIo")
|
||||||
|
@ -1606,6 +1611,14 @@ func DwmSetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, si
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CancelMibChangeNotify2(notificationHandle Handle) (errcode error) {
|
||||||
|
r0, _, _ := syscall.SyscallN(procCancelMibChangeNotify2.Addr(), uintptr(notificationHandle))
|
||||||
|
if r0 != 0 {
|
||||||
|
errcode = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) {
|
func GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) {
|
||||||
r0, _, _ := syscall.Syscall6(procGetAdaptersAddresses.Addr(), 5, uintptr(family), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(adapterAddresses)), uintptr(unsafe.Pointer(sizePointer)), 0)
|
r0, _, _ := syscall.Syscall6(procGetAdaptersAddresses.Addr(), 5, uintptr(family), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(adapterAddresses)), uintptr(unsafe.Pointer(sizePointer)), 0)
|
||||||
if r0 != 0 {
|
if r0 != 0 {
|
||||||
|
@ -1638,6 +1651,46 @@ func GetIfEntry(pIfRow *MibIfRow) (errcode error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetIfEntry2Ex(level uint32, row *MibIfRow2) (errcode error) {
|
||||||
|
r0, _, _ := syscall.SyscallN(procGetIfEntry2Ex.Addr(), uintptr(level), uintptr(unsafe.Pointer(row)))
|
||||||
|
if r0 != 0 {
|
||||||
|
errcode = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetUnicastIpAddressEntry(row *MibUnicastIpAddressRow) (errcode error) {
|
||||||
|
r0, _, _ := syscall.SyscallN(procGetUnicastIpAddressEntry.Addr(), uintptr(unsafe.Pointer(row)))
|
||||||
|
if r0 != 0 {
|
||||||
|
errcode = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func NotifyIpInterfaceChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) {
|
||||||
|
var _p0 uint32
|
||||||
|
if initialNotification {
|
||||||
|
_p0 = 1
|
||||||
|
}
|
||||||
|
r0, _, _ := syscall.SyscallN(procNotifyIpInterfaceChange.Addr(), uintptr(family), uintptr(callback), uintptr(callerContext), uintptr(_p0), uintptr(unsafe.Pointer(notificationHandle)))
|
||||||
|
if r0 != 0 {
|
||||||
|
errcode = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func NotifyUnicastIpAddressChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) {
|
||||||
|
var _p0 uint32
|
||||||
|
if initialNotification {
|
||||||
|
_p0 = 1
|
||||||
|
}
|
||||||
|
r0, _, _ := syscall.SyscallN(procNotifyUnicastIpAddressChange.Addr(), uintptr(family), uintptr(callback), uintptr(callerContext), uintptr(_p0), uintptr(unsafe.Pointer(notificationHandle)))
|
||||||
|
if r0 != 0 {
|
||||||
|
errcode = syscall.Errno(r0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func AddDllDirectory(path *uint16) (cookie uintptr, err error) {
|
func AddDllDirectory(path *uint16) (cookie uintptr, err error) {
|
||||||
r0, _, e1 := syscall.Syscall(procAddDllDirectory.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
|
r0, _, e1 := syscall.Syscall(procAddDllDirectory.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
|
||||||
cookie = uintptr(r0)
|
cookie = uintptr(r0)
|
||||||
|
|
|
@ -4,16 +4,13 @@
|
||||||
|
|
||||||
This repository provides Go terminal and console support packages.
|
This repository provides Go terminal and console support packages.
|
||||||
|
|
||||||
## Download/Install
|
|
||||||
|
|
||||||
The easiest way to install is to run `go get -u golang.org/x/term`. You can
|
|
||||||
also manually git clone the repository to `$GOPATH/src/golang.org/x/term`.
|
|
||||||
|
|
||||||
## Report Issues / Send Patches
|
## Report Issues / Send Patches
|
||||||
|
|
||||||
This repository uses Gerrit for code changes. To learn how to submit changes to
|
This repository uses Gerrit for code changes. To learn how to submit changes to
|
||||||
this repository, see https://golang.org/doc/contribute.html.
|
this repository, see https://go.dev/doc/contribute.
|
||||||
|
|
||||||
|
The git repository is https://go.googlesource.com/term.
|
||||||
|
|
||||||
The main issue tracker for the term repository is located at
|
The main issue tracker for the term repository is located at
|
||||||
https://github.com/golang/go/issues. Prefix your issue with "x/term:" in the
|
https://go.dev/issues. Prefix your issue with "x/term:" in the
|
||||||
subject line, so it is easy to find.
|
subject line, so it is easy to find.
|
||||||
|
|
|
@ -728,7 +728,7 @@ go.opentelemetry.io/otel/metric/embedded
|
||||||
## explicit; go 1.21
|
## explicit; go 1.21
|
||||||
go.opentelemetry.io/otel/trace
|
go.opentelemetry.io/otel/trace
|
||||||
go.opentelemetry.io/otel/trace/embedded
|
go.opentelemetry.io/otel/trace/embedded
|
||||||
# golang.org/x/crypto v0.28.0
|
# golang.org/x/crypto v0.29.0
|
||||||
## explicit; go 1.20
|
## explicit; go 1.20
|
||||||
golang.org/x/crypto/argon2
|
golang.org/x/crypto/argon2
|
||||||
golang.org/x/crypto/bcrypt
|
golang.org/x/crypto/bcrypt
|
||||||
|
@ -773,21 +773,21 @@ golang.org/x/net/http2/hpack
|
||||||
golang.org/x/net/idna
|
golang.org/x/net/idna
|
||||||
golang.org/x/net/internal/timeseries
|
golang.org/x/net/internal/timeseries
|
||||||
golang.org/x/net/trace
|
golang.org/x/net/trace
|
||||||
# golang.org/x/sync v0.8.0
|
# golang.org/x/sync v0.9.0
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
golang.org/x/sync/errgroup
|
golang.org/x/sync/errgroup
|
||||||
golang.org/x/sync/semaphore
|
golang.org/x/sync/semaphore
|
||||||
# golang.org/x/sys v0.26.0
|
# golang.org/x/sys v0.27.0
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
golang.org/x/sys/cpu
|
golang.org/x/sys/cpu
|
||||||
golang.org/x/sys/plan9
|
golang.org/x/sys/plan9
|
||||||
golang.org/x/sys/unix
|
golang.org/x/sys/unix
|
||||||
golang.org/x/sys/windows
|
golang.org/x/sys/windows
|
||||||
golang.org/x/sys/windows/registry
|
golang.org/x/sys/windows/registry
|
||||||
# golang.org/x/term v0.25.0
|
# golang.org/x/term v0.26.0
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
golang.org/x/term
|
golang.org/x/term
|
||||||
# golang.org/x/text v0.19.0
|
# golang.org/x/text v0.20.0
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
golang.org/x/text/secure/bidirule
|
golang.org/x/text/secure/bidirule
|
||||||
golang.org/x/text/transform
|
golang.org/x/text/transform
|
||||||
|
|
Loading…
Reference in New Issue