@ttsc/win32-arm64 0.14.2 → 0.15.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 CHANGED
@@ -1,2 +1,2 @@
1
- go1.26.3
2
- time 2026-05-04T20:36:18Z
1
+ go1.26.4
2
+ time 2026-05-29T15:26:39Z
package/bin/go/bin/go.exe CHANGED
Binary file
Binary file
@@ -2,24 +2,18 @@
2
2
  // Use of this source code is governed by a BSD-style
3
3
  // license that can be found in the LICENSE file.
4
4
 
5
+ // Entropy generation in FIPS 140-3 mode uses a scratch buffer in the BSS
6
+ // section (see below), which usually doesn't cost much, except on Wasm, due to
7
+ // the way the linear memory works. FIPS 140-3 mode is not supported on Wasm, so
8
+ // we just use a build tag to exclude it. (Could also exclude other platforms
9
+ // that does not support FIPS 140-3 mode, but as the BSS variable doesn't cost
10
+ // much, don't bother.)
11
+ //
5
12
  //go:build !wasm
6
13
 
7
- // This file contains reading from from entropy sources in FIPS-140
8
- // mode. It uses a scratch buffer in the BSS section (see below),
9
- // which usually doesn't cost much, except on Wasm, due to the way
10
- // the linear memory works. FIPS-140 mode is not supported on Wasm,
11
- // so we just use a build tag to exclude it. (Could also exclude other
12
- // platforms that does not support FIPS-140 mode, but as the BSS
13
- // variable doesn't cost much, don't bother.)
14
-
15
14
  package drbg
16
15
 
17
- import (
18
- entropy "crypto/internal/entropy/v1.0.0"
19
- "crypto/internal/sysrand"
20
- "sync"
21
- "sync/atomic"
22
- )
16
+ import entropy "crypto/internal/entropy/v1.0.0"
23
17
 
24
18
  // memory is a scratch buffer that is accessed between samples by the entropy
25
19
  // source to expose it to memory access timings.
@@ -50,48 +44,3 @@ func getEntropy() *[SeedSize]byte {
50
44
  }
51
45
  return &seed
52
46
  }
53
-
54
- // getEntropy is very slow (~500µs), so we don't want it on the hot path.
55
- // We keep both a persistent DRBG instance and a pool of additional instances.
56
- // Occasional uses will use drbgInstance, even if the pool was emptied since the
57
- // last use. Frequent concurrent uses will fill the pool and use it.
58
- var drbgInstance atomic.Pointer[Counter]
59
- var drbgPool = sync.Pool{
60
- New: func() any {
61
- return NewCounter(getEntropy())
62
- },
63
- }
64
-
65
- func readFromEntropy(b []byte) {
66
- // At every read, 128 random bits from the operating system are mixed as
67
- // additional input, to make the output as strong as non-FIPS randomness.
68
- // This is not credited as entropy for FIPS purposes, as allowed by Section
69
- // 8.7.2: "Note that a DRBG does not rely on additional input to provide
70
- // entropy, even though entropy could be provided in the additional input".
71
- additionalInput := new([SeedSize]byte)
72
- sysrand.Read(additionalInput[:16])
73
-
74
- drbg := drbgInstance.Swap(nil)
75
- if drbg == nil {
76
- drbg = drbgPool.Get().(*Counter)
77
- }
78
- defer func() {
79
- if !drbgInstance.CompareAndSwap(nil, drbg) {
80
- drbgPool.Put(drbg)
81
- }
82
- }()
83
-
84
- for len(b) > 0 {
85
- size := min(len(b), maxRequestSize)
86
- if reseedRequired := drbg.Generate(b[:size], additionalInput); reseedRequired {
87
- // See SP 800-90A Rev. 1, Section 9.3.1, Steps 6-8, as explained in
88
- // Section 9.3.2: if Generate reports a reseed is required, the
89
- // additional input is passed to Reseed along with the entropy and
90
- // then nulled before the next Generate call.
91
- drbg.Reseed(getEntropy(), additionalInput)
92
- additionalInput = nil
93
- continue
94
- }
95
- b = b[size:]
96
- }
97
- }
@@ -6,6 +6,6 @@
6
6
 
7
7
  package drbg
8
8
 
9
- func readFromEntropy(b []byte) {
10
- panic("FIPS-140 entropy generation is not supported on Wasm")
9
+ func getEntropy() *[SeedSize]byte {
10
+ panic("FIPS 140-3 entropy generation is not supported on Wasm")
11
11
  }
@@ -12,8 +12,21 @@ import (
12
12
  "crypto/internal/fips140"
13
13
  "crypto/internal/sysrand"
14
14
  "io"
15
+ "sync"
16
+ "sync/atomic"
15
17
  )
16
18
 
19
+ // getEntropy is very slow (~500µs), so we don't want it on the hot path.
20
+ // We keep both a persistent DRBG instance and a pool of additional instances.
21
+ // Occasional uses will use drbgInstance, even if the pool was emptied since the
22
+ // last use. Frequent concurrent uses will fill the pool and use it.
23
+ var drbgInstance atomic.Pointer[Counter]
24
+ var drbgPool = sync.Pool{
25
+ New: func() any {
26
+ return NewCounter(getEntropy())
27
+ },
28
+ }
29
+
17
30
  // Read fills b with cryptographically secure random bytes. In FIPS mode, it
18
31
  // uses an SP 800-90A Rev. 1 Deterministic Random Bit Generator (DRBG).
19
32
  // Otherwise, it uses the operating system's random number generator.
@@ -32,7 +45,37 @@ func Read(b []byte) {
32
45
  return
33
46
  }
34
47
 
35
- readFromEntropy(b)
48
+ // At every read, 128 random bits from the operating system are mixed as
49
+ // additional input, to make the output as strong as non-FIPS randomness.
50
+ // This is not credited as entropy for FIPS purposes, as allowed by Section
51
+ // 8.7.2: "Note that a DRBG does not rely on additional input to provide
52
+ // entropy, even though entropy could be provided in the additional input".
53
+ additionalInput := new([SeedSize]byte)
54
+ sysrand.Read(additionalInput[:16])
55
+
56
+ drbg := drbgInstance.Swap(nil)
57
+ if drbg == nil {
58
+ drbg = drbgPool.Get().(*Counter)
59
+ }
60
+ defer func() {
61
+ if !drbgInstance.CompareAndSwap(nil, drbg) {
62
+ drbgPool.Put(drbg)
63
+ }
64
+ }()
65
+
66
+ for len(b) > 0 {
67
+ size := min(len(b), maxRequestSize)
68
+ if reseedRequired := drbg.Generate(b[:size], additionalInput); reseedRequired {
69
+ // See SP 800-90A Rev. 1, Section 9.3.1, Steps 6-8, as explained in
70
+ // Section 9.3.2: if Generate reports a reseed is required, the
71
+ // additional input is passed to Reseed along with the entropy and
72
+ // then nulled before the next Generate call.
73
+ drbg.Reseed(getEntropy(), additionalInput)
74
+ additionalInput = nil
75
+ continue
76
+ }
77
+ b = b[size:]
78
+ }
36
79
  }
37
80
 
38
81
  var testingReader io.Reader
@@ -110,7 +110,7 @@ func (h HostnameError) Error() string {
110
110
  c := h.Certificate
111
111
  maxNamesIncluded := 100
112
112
 
113
- if !c.hasSANExtension() && matchHostnames(c.Subject.CommonName, h.Host) {
113
+ if !c.hasSANExtension() && matchHostnames(c.Subject.CommonName, splitHostname(h.Host)) {
114
114
  return "x509: certificate relies on legacy Common Name field, use SANs instead"
115
115
  }
116
116
 
@@ -867,16 +867,14 @@ func matchExactly(hostA, hostB string) bool {
867
867
  return toLowerCaseASCII(hostA) == toLowerCaseASCII(hostB)
868
868
  }
869
869
 
870
- func matchHostnames(pattern, host string) bool {
870
+ func matchHostnames(pattern string, hostParts []string) bool {
871
871
  pattern = toLowerCaseASCII(pattern)
872
- host = toLowerCaseASCII(strings.TrimSuffix(host, "."))
873
872
 
874
- if len(pattern) == 0 || len(host) == 0 {
873
+ if len(pattern) == 0 || len(hostParts) == 0 {
875
874
  return false
876
875
  }
877
876
 
878
877
  patternParts := strings.Split(pattern, ".")
879
- hostParts := strings.Split(host, ".")
880
878
 
881
879
  if len(patternParts) != len(hostParts) {
882
880
  return false
@@ -954,6 +952,7 @@ func (c *Certificate) VerifyHostname(h string) error {
954
952
 
955
953
  candidateName := toLowerCaseASCII(h) // Save allocations inside the loop.
956
954
  validCandidateName := validHostnameInput(candidateName)
955
+ hostParts := splitHostname(candidateName)
957
956
 
958
957
  for _, match := range c.DNSNames {
959
958
  // Ideally, we'd only match valid hostnames according to RFC 6125 like
@@ -962,7 +961,7 @@ func (c *Certificate) VerifyHostname(h string) error {
962
961
  // always allow perfect matches, and only apply wildcard and trailing
963
962
  // dot processing to valid hostnames.
964
963
  if validCandidateName && validHostnamePattern(match) {
965
- if matchHostnames(match, candidateName) {
964
+ if matchHostnames(match, hostParts) {
966
965
  return nil
967
966
  }
968
967
  } else {
@@ -975,6 +974,10 @@ func (c *Certificate) VerifyHostname(h string) error {
975
974
  return HostnameError{c, h}
976
975
  }
977
976
 
977
+ func splitHostname(host string) []string {
978
+ return strings.Split(toLowerCaseASCII(strings.TrimSuffix(host, ".")), ".")
979
+ }
980
+
978
981
  func checkChainForKeyUsage(chain []*Certificate, keyUsages []ExtKeyUsage) bool {
979
982
  usages := make([]ExtKeyUsage, len(keyUsages))
980
983
  copy(usages, keyUsages)
@@ -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.26.3`
18
+ const version = `go1.26.4`
19
19
  const defaultGOOS = runtime.GOOS
20
20
  const defaultGOARCH = runtime.GOARCH
21
21
  const DefaultGOFIPS140 = `off`
@@ -275,8 +275,8 @@ func (d *WordDecoder) DecodeHeader(header string) (string, error) {
275
275
  content, err := decode(encoding, text)
276
276
  if err != nil {
277
277
  betweenWords = false
278
- buf.WriteString(header[:start+2])
279
- header = header[start+2:]
278
+ buf.WriteString(header[:end])
279
+ header = header[end:]
280
280
  continue
281
281
  }
282
282
 
@@ -215,13 +215,13 @@ func (r *Reader) readCodeLine(expectCode int) (code int, continued bool, message
215
215
 
216
216
  func parseCodeLine(line string, expectCode int) (code int, continued bool, message string, err error) {
217
217
  if len(line) < 4 || line[3] != ' ' && line[3] != '-' {
218
- err = ProtocolError("short response: " + line)
218
+ err = ProtocolError(fmt.Sprintf("short response: %q", line))
219
219
  return
220
220
  }
221
221
  continued = line[3] == '-'
222
222
  code, err = strconv.Atoi(line[0:3])
223
223
  if err != nil || code < 100 {
224
- err = ProtocolError("invalid response code: " + line)
224
+ err = ProtocolError(fmt.Sprintf("invalid response code: %q", line))
225
225
  return
226
226
  }
227
227
  message = line[4:]
@@ -253,7 +253,7 @@ func parseCodeLine(line string, expectCode int) (code int, continued bool, messa
253
253
  func (r *Reader) ReadCodeLine(expectCode int) (code int, message string, err error) {
254
254
  code, continued, message, err := r.readCodeLine(expectCode)
255
255
  if err == nil && continued {
256
- err = ProtocolError("unexpected multi-line response: " + message)
256
+ err = ProtocolError(fmt.Sprintf("unexpected multi-line response: %q", message))
257
257
  }
258
258
  return
259
259
  }
@@ -541,7 +541,7 @@ func readMIMEHeader(r *Reader, maxMemory, maxHeaders int64) (MIMEHeader, error)
541
541
  if err != nil {
542
542
  return m, err
543
543
  }
544
- return m, ProtocolError("malformed MIME header initial line: " + string(line))
544
+ return m, ProtocolError(fmt.Sprintf("malformed MIME header initial line: %q", line))
545
545
  }
546
546
 
547
547
  for {
@@ -553,15 +553,15 @@ func readMIMEHeader(r *Reader, maxMemory, maxHeaders int64) (MIMEHeader, error)
553
553
  // Key ends at first colon.
554
554
  k, v, ok := bytes.Cut(kv, colon)
555
555
  if !ok {
556
- return m, ProtocolError("malformed MIME header line: " + string(kv))
556
+ return m, ProtocolError(fmt.Sprintf("malformed MIME header line: %q", kv))
557
557
  }
558
558
  key, ok := canonicalMIMEHeaderKey(k)
559
559
  if !ok {
560
- return m, ProtocolError("malformed MIME header line: " + string(kv))
560
+ return m, ProtocolError(fmt.Sprintf("malformed MIME header line: %q", kv))
561
561
  }
562
562
  for _, c := range v {
563
563
  if !validHeaderValueByte(c) {
564
- return m, ProtocolError("malformed MIME header line: " + string(kv))
564
+ return m, ProtocolError(fmt.Sprintf("malformed MIME header line: %q", kv))
565
565
  }
566
566
  }
567
567
 
@@ -41,7 +41,7 @@ type Error struct {
41
41
  }
42
42
 
43
43
  func (e *Error) Error() string {
44
- return fmt.Sprintf("%03d %s", e.Code, e.Msg)
44
+ return fmt.Sprintf("%03d %q", e.Code, e.Msg)
45
45
  }
46
46
 
47
47
  // A ProtocolError describes a protocol violation such
package/bin/ttsc.exe CHANGED
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttsc/win32-arm64",
3
- "version": "0.14.2",
3
+ "version": "0.15.0",
4
4
  "description": "Windows arm64 native ttsc/ttscserver binaries and bundled Go compiler for ttsc.",
5
5
  "os": [
6
6
  "win32"