@ttsc/darwin-arm64 0.36.3 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/go/VERSION +2 -2
- package/bin/go/bin/go +0 -0
- package/bin/go/bin/gofmt +0 -0
- package/bin/go/pkg/tool/darwin_arm64/asm +0 -0
- package/bin/go/pkg/tool/darwin_arm64/cgo +0 -0
- package/bin/go/pkg/tool/darwin_arm64/compile +0 -0
- package/bin/go/pkg/tool/darwin_arm64/cover +0 -0
- package/bin/go/pkg/tool/darwin_arm64/fix +0 -0
- package/bin/go/pkg/tool/darwin_arm64/link +0 -0
- package/bin/go/pkg/tool/darwin_arm64/preprofile +0 -0
- package/bin/go/pkg/tool/darwin_arm64/vet +0 -0
- package/bin/go/src/crypto/internal/fips140/ecdh/ecdh.go +3 -0
- package/bin/go/src/crypto/internal/fips140/ecdsa/ecdsa.go +2 -0
- package/bin/go/src/crypto/internal/fips140/ed25519/ed25519.go +3 -0
- package/bin/go/src/crypto/internal/fips140/fips140.go +2 -1
- package/bin/go/src/crypto/internal/fips140/hkdf/hkdf.go +0 -1
- package/bin/go/src/crypto/internal/fips140/hmac/hmac.go +1 -1
- package/bin/go/src/crypto/internal/fips140/mlkem/mlkem1024.go +1 -0
- package/bin/go/src/crypto/internal/fips140/mlkem/mlkem768.go +1 -0
- package/bin/go/src/crypto/internal/fips140/rsa/keygen.go +1 -0
- package/bin/go/src/crypto/internal/fips140/rsa/largeexponent.go +2 -0
- package/bin/go/src/crypto/internal/fips140/rsa/pkcs1v22.go +2 -0
- package/bin/go/src/crypto/internal/fips140/rsa/rsa.go +3 -0
- package/bin/go/src/crypto/internal/fips140/sha3/sha3.go +5 -1
- package/bin/go/src/crypto/internal/fips140/tls12/tls12.go +1 -1
- package/bin/go/src/crypto/rsa/fips.go +8 -5
- package/bin/go/src/crypto/tls/common.go +8 -3
- package/bin/go/src/internal/buildcfg/zbootstrap.go +1 -1
- package/bin/go/src/internal/platform/supported.go +16 -0
- package/bin/go/src/net/dial.go +24 -3
- package/bin/go/src/net/http/server.go +12 -8
- package/bin/go/src/runtime/defs_linux_386.go +3 -4
- package/bin/go/src/runtime/defs_linux_arm.go +3 -4
- package/bin/go/src/runtime/defs_linux_mipsx.go +3 -4
- package/bin/go/src/runtime/os_linux32.go +1 -1
- package/bin/go/src/runtime/panic.go +3 -1
- package/bin/ttsc +0 -0
- package/bin/ttsc-cache +0 -0
- package/bin/ttscserver +0 -0
- package/package.json +1 -1
package/bin/go/VERSION
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
go1.27.
|
|
2
|
-
time 2026-
|
|
1
|
+
go1.27.4
|
|
2
|
+
time 2026-11-02T20:36:20Z
|
package/bin/go/bin/go
CHANGED
|
Binary file
|
package/bin/go/bin/gofmt
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -137,6 +137,7 @@ var p521Order = []byte{0x01, 0xff,
|
|
|
137
137
|
|
|
138
138
|
// GenerateKey generates a new ECDSA private key pair for the specified curve.
|
|
139
139
|
func GenerateKey[P Point[P]](c *Curve[P], rand io.Reader) (*PrivateKey, error) {
|
|
140
|
+
fipsSelfTest()
|
|
140
141
|
fips140.RecordApproved()
|
|
141
142
|
// This procedure is equivalent to Key Pair Generation by Testing
|
|
142
143
|
// Candidates, specified in NIST SP 800-56A Rev. 3, Section 5.6.1.2.2.
|
|
@@ -187,6 +188,8 @@ func GenerateKey[P Point[P]](c *Curve[P], rand io.Reader) (*PrivateKey, error) {
|
|
|
187
188
|
}
|
|
188
189
|
|
|
189
190
|
func NewPrivateKey[P Point[P]](c *Curve[P], key []byte) (*PrivateKey, error) {
|
|
191
|
+
fipsSelfTest()
|
|
192
|
+
|
|
190
193
|
// SP 800-56A Rev. 3, Section 5.6.1.2.2 checks that c <= n – 2 and then
|
|
191
194
|
// returns d = c + 1. Note that it follows that 0 < d < n. Equivalently,
|
|
192
195
|
// we check that 0 < d < n, and return d.
|
|
@@ -161,6 +161,7 @@ var p521Order = []byte{0x01, 0xff,
|
|
|
161
161
|
// slices. D must be the fixed-length big-endian encoding of the private scalar,
|
|
162
162
|
// and Q must be the compressed or uncompressed encoding of the public point.
|
|
163
163
|
func NewPrivateKey[P Point[P]](c *Curve[P], D, Q []byte) (*PrivateKey, error) {
|
|
164
|
+
fipsSelfTest()
|
|
164
165
|
fips140.RecordApproved()
|
|
165
166
|
pub, err := NewPublicKey(c, Q)
|
|
166
167
|
if err != nil {
|
|
@@ -198,6 +199,7 @@ func NewPublicKey[P Point[P]](c *Curve[P], Q []byte) (*PublicKey, error) {
|
|
|
198
199
|
|
|
199
200
|
// GenerateKey generates a new ECDSA private key pair for the specified curve.
|
|
200
201
|
func GenerateKey[P Point[P]](c *Curve[P], rand io.Reader) (*PrivateKey, error) {
|
|
202
|
+
fipsSelfTest()
|
|
201
203
|
fips140.RecordApproved()
|
|
202
204
|
|
|
203
205
|
k, Q, err := randomPoint(c, func(b []byte) error {
|
|
@@ -66,6 +66,7 @@ func GenerateKey() (*PrivateKey, error) {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
func generateKey(priv *PrivateKey) (*PrivateKey, error) {
|
|
69
|
+
fipsSelfTest()
|
|
69
70
|
fips140.RecordApproved()
|
|
70
71
|
drbg.Read(priv.seed[:])
|
|
71
72
|
precomputePrivateKey(priv)
|
|
@@ -79,6 +80,7 @@ func NewPrivateKeyFromSeed(seed []byte) (*PrivateKey, error) {
|
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
func newPrivateKeyFromSeed(priv *PrivateKey, seed []byte) (*PrivateKey, error) {
|
|
83
|
+
fipsSelfTest()
|
|
82
84
|
fips140.RecordApproved()
|
|
83
85
|
if l := len(seed); l != seedSize {
|
|
84
86
|
return nil, errors.New("ed25519: bad seed length: " + strconv.Itoa(l))
|
|
@@ -109,6 +111,7 @@ func NewPrivateKey(priv []byte) (*PrivateKey, error) {
|
|
|
109
111
|
}
|
|
110
112
|
|
|
111
113
|
func newPrivateKey(priv *PrivateKey, privBytes []byte) (*PrivateKey, error) {
|
|
114
|
+
fipsSelfTest()
|
|
112
115
|
fips140.RecordApproved()
|
|
113
116
|
if l := len(privBytes); l != privateKeySize {
|
|
114
117
|
return nil, errors.New("ed25519: bad private key length: " + strconv.Itoa(l))
|
|
@@ -30,7 +30,8 @@ func init() {
|
|
|
30
30
|
|
|
31
31
|
// Supported returns an error if FIPS 140-3 mode can't be enabled.
|
|
32
32
|
func Supported() error {
|
|
33
|
-
// Keep this in sync with
|
|
33
|
+
// Keep this in sync with internal/platform.FIPS140Supported and
|
|
34
|
+
// cmd/dist.tester.fips140Supported.
|
|
34
35
|
|
|
35
36
|
// The purego tag changes too much of the implementation to claim the
|
|
36
37
|
// validation still applies.
|
|
@@ -27,7 +27,6 @@ func Extract[H hash.Hash](h func() H, secret, salt []byte) []byte {
|
|
|
27
27
|
func Expand[H hash.Hash](h func() H, pseudorandomKey []byte, info string, keyLen int) []byte {
|
|
28
28
|
out := make([]byte, 0, keyLen)
|
|
29
29
|
expander := hmac.New(h, pseudorandomKey)
|
|
30
|
-
hmac.MarkAsUsedInKDF(expander)
|
|
31
30
|
var counter uint8
|
|
32
31
|
var buf []byte
|
|
33
32
|
|
|
@@ -47,7 +47,7 @@ type HMAC struct {
|
|
|
47
47
|
func (h *HMAC) Sum(in []byte) []byte {
|
|
48
48
|
// Per FIPS 140-3 IG C.M, key lengths below 112 bits are only allowed for
|
|
49
49
|
// legacy use (i.e. verification only) and we don't support that. However,
|
|
50
|
-
// HKDF uses the HMAC key for the salt, which is allowed to be shorter.
|
|
50
|
+
// HKDF-Extract uses the HMAC key for the salt, which is allowed to be shorter.
|
|
51
51
|
if h.keyLen < 112/8 && !h.forHKDF {
|
|
52
52
|
fips140.RecordNonApproved()
|
|
53
53
|
}
|
|
@@ -142,6 +142,7 @@ func NewDecapsulationKey1024(seed []byte) (*DecapsulationKey1024, error) {
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
func newKeyFromSeed1024(dk *DecapsulationKey1024, seed []byte) (*DecapsulationKey1024, error) {
|
|
145
|
+
fipsSelfTest()
|
|
145
146
|
if len(seed) != SeedSize {
|
|
146
147
|
return nil, errors.New("mlkem: invalid seed length")
|
|
147
148
|
}
|
|
@@ -201,6 +201,7 @@ func NewDecapsulationKey768(seed []byte) (*DecapsulationKey768, error) {
|
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
func newKeyFromSeed(dk *DecapsulationKey768, seed []byte) (*DecapsulationKey768, error) {
|
|
204
|
+
fipsSelfTest()
|
|
204
205
|
if len(seed) != SeedSize {
|
|
205
206
|
return nil, errors.New("mlkem: invalid seed length")
|
|
206
207
|
}
|
|
@@ -282,6 +282,7 @@ func TestingOnlyLargeExponentDecryptOAEP(hash, mgfHash hash.Hash, priv *TestingO
|
|
|
282
282
|
fipsSelfTest()
|
|
283
283
|
fips140.RecordApproved()
|
|
284
284
|
checkApprovedHash(hash)
|
|
285
|
+
checkApprovedHash(mgfHash)
|
|
285
286
|
|
|
286
287
|
k := priv.Size()
|
|
287
288
|
if len(ciphertext) > k || k < hash.Size()*2+2 {
|
|
@@ -334,6 +335,7 @@ func TestingOnlyLargeExponentEncryptOAEP(hash, mgfHash hash.Hash, random io.Read
|
|
|
334
335
|
fipsSelfTest()
|
|
335
336
|
fips140.RecordApproved()
|
|
336
337
|
checkApprovedHash(hash)
|
|
338
|
+
checkApprovedHash(mgfHash)
|
|
337
339
|
if err := checkLargeExponentPublicKey(pub); err != nil {
|
|
338
340
|
return nil, err
|
|
339
341
|
}
|
|
@@ -380,6 +380,7 @@ func EncryptOAEP(hash, mgfHash hash.Hash, random io.Reader, pub *PublicKey, msg
|
|
|
380
380
|
fipsSelfTest()
|
|
381
381
|
fips140.RecordApproved()
|
|
382
382
|
checkApprovedHash(hash)
|
|
383
|
+
checkApprovedHash(mgfHash)
|
|
383
384
|
if fipsApproved, err := checkPublicKey(pub); err != nil {
|
|
384
385
|
return nil, err
|
|
385
386
|
} else if !fipsApproved {
|
|
@@ -417,6 +418,7 @@ func DecryptOAEP(hash, mgfHash hash.Hash, priv *PrivateKey, ciphertext []byte, l
|
|
|
417
418
|
fipsSelfTest()
|
|
418
419
|
fips140.RecordApproved()
|
|
419
420
|
checkApprovedHash(hash)
|
|
421
|
+
checkApprovedHash(mgfHash)
|
|
420
422
|
|
|
421
423
|
k := priv.pub.Size()
|
|
422
424
|
if len(ciphertext) > k ||
|
|
@@ -50,6 +50,7 @@ func (priv *PrivateKey) PublicKey() *PublicKey {
|
|
|
50
50
|
// All values are in big-endian byte slice format, and may have leading zeros
|
|
51
51
|
// or be shorter if leading zeroes were trimmed.
|
|
52
52
|
func NewPrivateKey(N []byte, e int, d, P, Q []byte) (*PrivateKey, error) {
|
|
53
|
+
fipsSelfTest()
|
|
53
54
|
n, err := bigmod.NewModulus(N)
|
|
54
55
|
if err != nil {
|
|
55
56
|
return nil, err
|
|
@@ -110,6 +111,8 @@ func newPrivateKey(n *bigmod.Modulus, e int, d *bigmod.Nat, p, q *bigmod.Modulus
|
|
|
110
111
|
// NewPrivateKeyWithPrecomputation creates a new RSA private key from the given
|
|
111
112
|
// parameters, which include precomputed CRT values.
|
|
112
113
|
func NewPrivateKeyWithPrecomputation(N []byte, e int, d, P, Q, dP, dQ, qInv []byte) (*PrivateKey, error) {
|
|
114
|
+
fipsSelfTest()
|
|
115
|
+
|
|
113
116
|
n, err := bigmod.NewModulus(N)
|
|
114
117
|
if err != nil {
|
|
115
118
|
return nil, err
|
|
@@ -144,7 +144,11 @@ func (d *Digest) readGeneric(out []byte) (n int, err error) {
|
|
|
144
144
|
// Sum appends the current hash to b and returns the resulting slice.
|
|
145
145
|
// It does not change the underlying hash state.
|
|
146
146
|
func (d *Digest) Sum(b []byte) []byte {
|
|
147
|
-
|
|
147
|
+
if d.dsbyte == dsbyteKeccak {
|
|
148
|
+
fips140.RecordNonApproved()
|
|
149
|
+
} else {
|
|
150
|
+
fips140.RecordApproved()
|
|
151
|
+
}
|
|
148
152
|
return d.sum(b)
|
|
149
153
|
}
|
|
150
154
|
|
|
@@ -59,7 +59,7 @@ func MasterSecret[H hash.Hash](hash func() H, preMasterSecret, transcript []byte
|
|
|
59
59
|
fips140.RecordNonApproved()
|
|
60
60
|
}
|
|
61
61
|
case *sha512.Digest:
|
|
62
|
-
if h.Size() !=
|
|
62
|
+
if h.Size() != 48 && h.Size() != 64 {
|
|
63
63
|
fips140.RecordNonApproved()
|
|
64
64
|
}
|
|
65
65
|
default:
|
|
@@ -245,15 +245,18 @@ func encryptOAEP(hash hash.Hash, mgfHash hash.Hash, random io.Reader, pub *Publi
|
|
|
245
245
|
boring.UnreachableExceptTests()
|
|
246
246
|
|
|
247
247
|
hash = fips140hash.Unwrap(hash)
|
|
248
|
+
mgfHash = fips140hash.Unwrap(mgfHash)
|
|
248
249
|
|
|
249
250
|
if err := checkFIPS140OnlyPublicKey(pub); err != nil {
|
|
250
251
|
return nil, err
|
|
251
252
|
}
|
|
252
|
-
if fips140only.Enforced()
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
253
|
+
if fips140only.Enforced() {
|
|
254
|
+
if !fips140only.ApprovedHash(hash) || !fips140only.ApprovedHash(mgfHash) {
|
|
255
|
+
return nil, errors.New("crypto/rsa: use of hash functions other than SHA-2 or SHA-3 is not allowed in FIPS 140-only mode")
|
|
256
|
+
}
|
|
257
|
+
if !fips140only.ApprovedRandomReader(random) {
|
|
258
|
+
return nil, errors.New("crypto/rsa: only crypto/rand.Reader is allowed in FIPS 140-only mode")
|
|
259
|
+
}
|
|
257
260
|
}
|
|
258
261
|
|
|
259
262
|
k, err := fipsPublicKey(pub)
|
|
@@ -1798,6 +1798,11 @@ func isDisabledSignatureAlgorithm(version uint16, s SignatureScheme, isCert bool
|
|
|
1798
1798
|
|
|
1799
1799
|
switch s {
|
|
1800
1800
|
case MLDSA44, MLDSA65, MLDSA87:
|
|
1801
|
+
// Omit ML-DSA from signature_algorithms_cert in Go 1.27 to work
|
|
1802
|
+
// around non-compliant middleboxes. See https://go.dev/issue/82536.
|
|
1803
|
+
if isCert {
|
|
1804
|
+
return true
|
|
1805
|
+
}
|
|
1801
1806
|
// ML-DSA is not available in FIPS 140-3 module v1.0.0.
|
|
1802
1807
|
if fips140.Version() == "v1.0.0" {
|
|
1803
1808
|
return true
|
|
@@ -1808,8 +1813,8 @@ func isDisabledSignatureAlgorithm(version uint16, s SignatureScheme, isCert bool
|
|
|
1808
1813
|
}
|
|
1809
1814
|
}
|
|
1810
1815
|
|
|
1811
|
-
// For the _cert extension we include
|
|
1812
|
-
//
|
|
1816
|
+
// For the _cert extension we also include SHA-1 and PKCS#1 v1.5,
|
|
1817
|
+
// because it's more likely that something on our side will be
|
|
1813
1818
|
// willing to accept a *-with-SHA1 certificate (e.g. with a custom
|
|
1814
1819
|
// VerifyConnection or by a direct match with the CertPool), than that the
|
|
1815
1820
|
// peer would have a better certificate but is just choosing not to send it.
|
|
@@ -1835,7 +1840,7 @@ func isDisabledSignatureAlgorithm(version uint16, s SignatureScheme, isCert bool
|
|
|
1835
1840
|
return false
|
|
1836
1841
|
}
|
|
1837
1842
|
|
|
1838
|
-
// supportedSignatureAlgorithmsCert returns the
|
|
1843
|
+
// supportedSignatureAlgorithmsCert returns the algorithms to advertise for
|
|
1839
1844
|
// signatures in certificates.
|
|
1840
1845
|
func supportedSignatureAlgorithmsCert(minVers, maxVers uint16) []SignatureScheme {
|
|
1841
1846
|
sigAlgs := defaultSupportedSignatureAlgorithms()
|
|
@@ -15,7 +15,7 @@ const DefaultGORISCV64 = `rva20u64`
|
|
|
15
15
|
const defaultGOEXPERIMENT = ``
|
|
16
16
|
const defaultGO_EXTLINK_ENABLED = ``
|
|
17
17
|
const defaultGO_LDSO = ``
|
|
18
|
-
const version = `go1.27.
|
|
18
|
+
const version = `go1.27.4`
|
|
19
19
|
const defaultGOOS = runtime.GOOS
|
|
20
20
|
const defaultGOARCH = runtime.GOARCH
|
|
21
21
|
const DefaultGOFIPS140 = `off`
|
|
@@ -57,6 +57,22 @@ func ASanSupported(goos, goarch string) bool {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
// FIPS140Supported reports whether goos/goarch supports FIPS 140-3 mode.
|
|
61
|
+
// It does not consider non-platform constraints such as the purego build tag,
|
|
62
|
+
// -asan, or GOEXPERIMENT=boringcrypto.
|
|
63
|
+
// There is a copy of this function in cmd/dist/test.go.
|
|
64
|
+
func FIPS140Supported(goos, goarch string) bool {
|
|
65
|
+
// Keep this in sync with crypto/internal/fips140.Supported.
|
|
66
|
+
switch {
|
|
67
|
+
case goarch == "wasm",
|
|
68
|
+
goos == "windows" && goarch == "386",
|
|
69
|
+
goos == "openbsd",
|
|
70
|
+
goos == "aix":
|
|
71
|
+
return false
|
|
72
|
+
}
|
|
73
|
+
return true
|
|
74
|
+
}
|
|
75
|
+
|
|
60
76
|
// FuzzSupported reports whether goos/goarch supports fuzzing
|
|
61
77
|
// ('go test -fuzz=.').
|
|
62
78
|
func FuzzSupported(goos, goarch string) bool {
|
package/bin/go/src/net/dial.go
CHANGED
|
@@ -607,7 +607,14 @@ func (d *Dialer) dialCtx(ctx context.Context) (context.Context, context.CancelFu
|
|
|
607
607
|
func (d *Dialer) DialTCP(ctx context.Context, network string, laddr netip.AddrPort, raddr netip.AddrPort) (*TCPConn, error) {
|
|
608
608
|
ctx, cancel := d.dialCtx(ctx)
|
|
609
609
|
defer cancel()
|
|
610
|
-
|
|
610
|
+
var laddrTCP, raddrTCP *TCPAddr
|
|
611
|
+
if laddr.IsValid() {
|
|
612
|
+
laddrTCP = TCPAddrFromAddrPort(laddr)
|
|
613
|
+
}
|
|
614
|
+
if raddr.IsValid() {
|
|
615
|
+
raddrTCP = TCPAddrFromAddrPort(raddr)
|
|
616
|
+
}
|
|
617
|
+
return dialTCP(ctx, d, network, laddrTCP, raddrTCP)
|
|
611
618
|
}
|
|
612
619
|
|
|
613
620
|
// DialUDP acts like Dial for UDP networks using the provided context.
|
|
@@ -621,7 +628,14 @@ func (d *Dialer) DialTCP(ctx context.Context, network string, laddr netip.AddrPo
|
|
|
621
628
|
func (d *Dialer) DialUDP(ctx context.Context, network string, laddr netip.AddrPort, raddr netip.AddrPort) (*UDPConn, error) {
|
|
622
629
|
ctx, cancel := d.dialCtx(ctx)
|
|
623
630
|
defer cancel()
|
|
624
|
-
|
|
631
|
+
var laddrUDP, raddrUDP *UDPAddr
|
|
632
|
+
if laddr.IsValid() {
|
|
633
|
+
laddrUDP = UDPAddrFromAddrPort(laddr)
|
|
634
|
+
}
|
|
635
|
+
if raddr.IsValid() {
|
|
636
|
+
raddrUDP = UDPAddrFromAddrPort(raddr)
|
|
637
|
+
}
|
|
638
|
+
return dialUDP(ctx, d, network, laddrUDP, raddrUDP)
|
|
625
639
|
}
|
|
626
640
|
|
|
627
641
|
// DialIP acts like Dial for IP networks using the provided context.
|
|
@@ -635,7 +649,14 @@ func (d *Dialer) DialUDP(ctx context.Context, network string, laddr netip.AddrPo
|
|
|
635
649
|
func (d *Dialer) DialIP(ctx context.Context, network string, laddr netip.Addr, raddr netip.Addr) (*IPConn, error) {
|
|
636
650
|
ctx, cancel := d.dialCtx(ctx)
|
|
637
651
|
defer cancel()
|
|
638
|
-
|
|
652
|
+
var laddrIP, raddrIP *IPAddr
|
|
653
|
+
if laddr.IsValid() {
|
|
654
|
+
laddrIP = ipAddrFromAddr(laddr)
|
|
655
|
+
}
|
|
656
|
+
if raddr.IsValid() {
|
|
657
|
+
raddrIP = ipAddrFromAddr(raddr)
|
|
658
|
+
}
|
|
659
|
+
return dialIP(ctx, d, network, laddrIP, raddrIP)
|
|
639
660
|
}
|
|
640
661
|
|
|
641
662
|
// DialUnix acts like Dial for Unix networks using the provided context.
|
|
@@ -475,7 +475,7 @@ type response struct {
|
|
|
475
475
|
// request. Instead, when this is set, we stop reading
|
|
476
476
|
// subsequent requests on this connection and stop reading
|
|
477
477
|
// input from it.
|
|
478
|
-
requestBodyLimitHit
|
|
478
|
+
requestBodyLimitHit atomic.Bool
|
|
479
479
|
|
|
480
480
|
// trailers are the headers to be sent after the handler
|
|
481
481
|
// finishes writing the body. This field is initialized from
|
|
@@ -564,11 +564,7 @@ func (w *response) declareTrailer(k string) {
|
|
|
564
564
|
// requestTooLarge is called by maxBytesReader when too much input has
|
|
565
565
|
// been read from the client.
|
|
566
566
|
func (w *response) requestTooLarge() {
|
|
567
|
-
w.
|
|
568
|
-
w.requestBodyLimitHit = true
|
|
569
|
-
if !w.wroteHeader {
|
|
570
|
-
w.Header().Set("Connection", "close")
|
|
571
|
-
}
|
|
567
|
+
w.requestBodyLimitHit.Store(true)
|
|
572
568
|
}
|
|
573
569
|
|
|
574
570
|
// disableWriteContinue stops Request.Body.Read from sending an automatic
|
|
@@ -1439,6 +1435,10 @@ func (cw *chunkWriter) writeHeader(p []byte) {
|
|
|
1439
1435
|
w.closeAfterReply = true
|
|
1440
1436
|
}
|
|
1441
1437
|
|
|
1438
|
+
if w.requestBodyLimitHit.Load() {
|
|
1439
|
+
w.closeAfterReply = true
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
1442
|
// We do this by default because there are a number of clients that
|
|
1443
1443
|
// send a full request before starting to read the response, and they
|
|
1444
1444
|
// can deadlock if we start writing the response with unconsumed body
|
|
@@ -1561,6 +1561,10 @@ func (cw *chunkWriter) writeHeader(p []byte) {
|
|
|
1561
1561
|
return
|
|
1562
1562
|
}
|
|
1563
1563
|
|
|
1564
|
+
if w.requestBodyLimitHit.Load() {
|
|
1565
|
+
w.closeAfterReply = true
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1564
1568
|
// Only override the Connection header if it is not a successful
|
|
1565
1569
|
// protocol switch response and if KeepAlives are not enabled.
|
|
1566
1570
|
// See https://golang.org/issue/36381.
|
|
@@ -1744,7 +1748,7 @@ func (w *response) finishRequest() {
|
|
|
1744
1748
|
// shouldReuseConnection reports whether the underlying TCP connection can be reused.
|
|
1745
1749
|
// It must only be called after the handler is done executing.
|
|
1746
1750
|
func (w *response) shouldReuseConnection() bool {
|
|
1747
|
-
if w.closeAfterReply {
|
|
1751
|
+
if w.closeAfterReply || w.requestBodyLimitHit.Load() {
|
|
1748
1752
|
// The request or something set while executing the
|
|
1749
1753
|
// handler indicated we shouldn't reuse this
|
|
1750
1754
|
// connection.
|
|
@@ -2164,7 +2168,7 @@ func (c *conn) serve(ctx context.Context) {
|
|
|
2164
2168
|
w.finishRequest()
|
|
2165
2169
|
c.rwc.SetWriteDeadline(time.Time{})
|
|
2166
2170
|
if !w.shouldReuseConnection() {
|
|
2167
|
-
if w.requestBodyLimitHit || w.closedRequestBodyEarly() {
|
|
2171
|
+
if w.requestBodyLimitHit.Load() || w.closedRequestBodyEarly() {
|
|
2168
2172
|
c.closeWriteAndWait()
|
|
2169
2173
|
}
|
|
2170
2174
|
return
|
|
@@ -152,14 +152,13 @@ func (ts *timespec32) setNsec(ns int64) {
|
|
|
152
152
|
|
|
153
153
|
type timespec struct {
|
|
154
154
|
tv_sec int64
|
|
155
|
-
tv_nsec
|
|
156
|
-
_ [4]byte // the C ABI aligns int64 to 8 bytes
|
|
155
|
+
tv_nsec int64
|
|
157
156
|
}
|
|
158
157
|
|
|
159
158
|
//go:nosplit
|
|
160
159
|
func (ts *timespec) setNsec(ns int64) {
|
|
161
|
-
ts.tv_sec = ns / 1e9
|
|
162
|
-
ts.tv_nsec =
|
|
160
|
+
ts.tv_sec = int64(ns / 1e9)
|
|
161
|
+
ts.tv_nsec = int64(ns % 1e9)
|
|
163
162
|
}
|
|
164
163
|
|
|
165
164
|
type timeval struct {
|
|
@@ -111,14 +111,13 @@ func (ts *timespec32) setNsec(ns int64) {
|
|
|
111
111
|
|
|
112
112
|
type timespec struct {
|
|
113
113
|
tv_sec int64
|
|
114
|
-
tv_nsec
|
|
115
|
-
_ [4]byte // the C ABI aligns int64 to 8 bytes
|
|
114
|
+
tv_nsec int64
|
|
116
115
|
}
|
|
117
116
|
|
|
118
117
|
//go:nosplit
|
|
119
118
|
func (ts *timespec) setNsec(ns int64) {
|
|
120
|
-
ts.tv_sec = ns / 1e9
|
|
121
|
-
ts.tv_nsec =
|
|
119
|
+
ts.tv_sec = int64(ns / 1e9)
|
|
120
|
+
ts.tv_nsec = int64(ns % 1e9)
|
|
122
121
|
}
|
|
123
122
|
|
|
124
123
|
type stackt struct {
|
|
@@ -109,14 +109,13 @@ func (ts *timespec32) setNsec(ns int64) {
|
|
|
109
109
|
|
|
110
110
|
type timespec struct {
|
|
111
111
|
tv_sec int64
|
|
112
|
-
tv_nsec
|
|
113
|
-
_ [4]byte // the C ABI aligns int64 to 8 bytes
|
|
112
|
+
tv_nsec int64
|
|
114
113
|
}
|
|
115
114
|
|
|
116
115
|
//go:nosplit
|
|
117
116
|
func (ts *timespec) setNsec(ns int64) {
|
|
118
|
-
ts.tv_sec = ns / 1e9
|
|
119
|
-
ts.tv_nsec =
|
|
117
|
+
ts.tv_sec = int64(ns / 1e9)
|
|
118
|
+
ts.tv_nsec = int64(ns % 1e9)
|
|
120
119
|
}
|
|
121
120
|
|
|
122
121
|
type timeval struct {
|
|
@@ -1001,8 +1001,10 @@ func (p *_panic) nextFrame() (ok bool) {
|
|
|
1001
1001
|
gp := getg()
|
|
1002
1002
|
systemstack(func() {
|
|
1003
1003
|
var limit uintptr
|
|
1004
|
+
var limitFn funcInfo
|
|
1004
1005
|
if d := gp._defer; d != nil {
|
|
1005
1006
|
limit = d.sp
|
|
1007
|
+
limitFn = findfunc(d.pc)
|
|
1006
1008
|
}
|
|
1007
1009
|
|
|
1008
1010
|
var u unwinder
|
|
@@ -1018,7 +1020,7 @@ func (p *_panic) nextFrame() (ok bool) {
|
|
|
1018
1020
|
// then we can simply loop until we find the next frame where
|
|
1019
1021
|
// it's non-zero.
|
|
1020
1022
|
|
|
1021
|
-
if u.frame.sp == limit {
|
|
1023
|
+
if u.frame.sp == limit && u.frame.fn == limitFn {
|
|
1022
1024
|
break // found a frame with linked defers
|
|
1023
1025
|
}
|
|
1024
1026
|
|
package/bin/ttsc
CHANGED
|
Binary file
|
package/bin/ttsc-cache
CHANGED
|
Binary file
|
package/bin/ttscserver
CHANGED
|
Binary file
|