@ttsc/darwin-arm64 0.13.0 → 0.14.0-dev.20250530.1

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.
Files changed (120) hide show
  1. package/bin/go/VERSION +2 -2
  2. package/bin/go/bin/go +0 -0
  3. package/bin/go/bin/gofmt +0 -0
  4. package/bin/go/pkg/tool/darwin_arm64/asm +0 -0
  5. package/bin/go/pkg/tool/darwin_arm64/cgo +0 -0
  6. package/bin/go/pkg/tool/darwin_arm64/compile +0 -0
  7. package/bin/go/pkg/tool/darwin_arm64/cover +0 -0
  8. package/bin/go/pkg/tool/darwin_arm64/fix +0 -0
  9. package/bin/go/pkg/tool/darwin_arm64/link +0 -0
  10. package/bin/go/pkg/tool/darwin_arm64/preprofile +0 -0
  11. package/bin/go/pkg/tool/darwin_arm64/vet +0 -0
  12. package/bin/go/src/archive/tar/format.go +0 -6
  13. package/bin/go/src/archive/tar/reader.go +4 -24
  14. package/bin/go/src/builtin/builtin.go +4 -13
  15. package/bin/go/src/crypto/fips140/fips140.go +0 -6
  16. package/bin/go/src/crypto/internal/fips140/drbg/rand.go +75 -1
  17. package/bin/go/src/crypto/tls/conn.go +3 -7
  18. package/bin/go/src/crypto/tls/handshake_client_tls13.go +2 -2
  19. package/bin/go/src/crypto/tls/handshake_server_tls13.go +2 -2
  20. package/bin/go/src/crypto/tls/key_schedule.go +3 -24
  21. package/bin/go/src/crypto/x509/constraints.go +33 -33
  22. package/bin/go/src/crypto/x509/verify.go +13 -28
  23. package/bin/go/src/go/types/builtins.go +2 -2
  24. package/bin/go/src/go/types/signature.go +0 -3
  25. package/bin/go/src/go/types/under.go +3 -3
  26. package/bin/go/src/go.mod +1 -1
  27. package/bin/go/src/go.sum +2 -2
  28. package/bin/go/src/html/template/attr_string.go +2 -3
  29. package/bin/go/src/html/template/context.go +1 -21
  30. package/bin/go/src/html/template/element_string.go +2 -3
  31. package/bin/go/src/html/template/escape.go +2 -16
  32. package/bin/go/src/html/template/js.go +0 -1
  33. package/bin/go/src/html/template/state_string.go +3 -5
  34. package/bin/go/src/html/template/transition.go +6 -43
  35. package/bin/go/src/internal/buildcfg/zbootstrap.go +1 -1
  36. package/bin/go/src/internal/godebugs/table.go +0 -1
  37. package/bin/go/src/internal/poll/fd_windows.go +38 -64
  38. package/bin/go/src/internal/poll/sendfile_windows.go +1 -3
  39. package/bin/go/src/internal/runtime/syscall/linux/defs_linux_386.go +0 -1
  40. package/bin/go/src/internal/runtime/syscall/linux/defs_linux_amd64.go +0 -1
  41. package/bin/go/src/internal/runtime/syscall/linux/defs_linux_arm.go +0 -1
  42. package/bin/go/src/internal/runtime/syscall/linux/defs_linux_arm64.go +0 -1
  43. package/bin/go/src/internal/runtime/syscall/linux/defs_linux_loong64.go +0 -1
  44. package/bin/go/src/internal/runtime/syscall/linux/defs_linux_mips64x.go +0 -1
  45. package/bin/go/src/internal/runtime/syscall/linux/defs_linux_mipsx.go +0 -1
  46. package/bin/go/src/internal/runtime/syscall/linux/defs_linux_ppc64x.go +0 -1
  47. package/bin/go/src/internal/runtime/syscall/linux/defs_linux_riscv64.go +0 -1
  48. package/bin/go/src/internal/runtime/syscall/linux/defs_linux_s390x.go +0 -1
  49. package/bin/go/src/internal/runtime/syscall/linux/syscall_linux.go +0 -14
  50. package/bin/go/src/internal/syscall/unix/at.go +17 -0
  51. package/bin/go/src/internal/syscall/unix/at_sysnum_linux.go +1 -2
  52. package/bin/go/src/internal/syscall/windows/at_windows.go +3 -20
  53. package/bin/go/src/internal/syscall/windows/registry/key.go +2 -10
  54. package/bin/go/src/internal/syscall/windows/registry/value.go +1 -5
  55. package/bin/go/src/internal/syscall/windows/syscall_windows.go +0 -4
  56. package/bin/go/src/internal/syscall/windows/types_windows.go +0 -82
  57. package/bin/go/src/internal/syscall/windows/zsyscall_windows.go +0 -27
  58. package/bin/go/src/net/cgo_unix.go +1 -4
  59. package/bin/go/src/net/http/doc.go +1 -0
  60. package/bin/go/src/net/http/h2_bundle.go +3 -3
  61. package/bin/go/src/net/http/httputil/reverseproxy.go +0 -14
  62. package/bin/go/src/net/lookup_windows.go +3 -16
  63. package/bin/go/src/net/mail/message.go +9 -20
  64. package/bin/go/src/net/sendfile.go +0 -2
  65. package/bin/go/src/net/sendfile_stub.go +0 -2
  66. package/bin/go/src/net/sendfile_windows.go +0 -3
  67. package/bin/go/src/net/url/url.go +16 -22
  68. package/bin/go/src/os/dir_darwin.go +2 -2
  69. package/bin/go/src/os/dir_unix.go +2 -2
  70. package/bin/go/src/os/file.go +3 -0
  71. package/bin/go/src/os/file_unix.go +5 -9
  72. package/bin/go/src/os/removeall_at.go +2 -6
  73. package/bin/go/src/os/removeall_unix.go +8 -0
  74. package/bin/go/src/os/removeall_windows.go +4 -0
  75. package/bin/go/src/os/root_unix.go +0 -1
  76. package/bin/go/src/os/stat.go +0 -3
  77. package/bin/go/src/reflect/value.go +2 -3
  78. package/bin/go/src/runtime/defs_linux_386.go +3 -4
  79. package/bin/go/src/runtime/defs_linux_arm.go +3 -4
  80. package/bin/go/src/runtime/defs_linux_mips64x.go +1 -1
  81. package/bin/go/src/runtime/defs_linux_mipsx.go +4 -5
  82. package/bin/go/src/runtime/malloc.go +53 -1
  83. package/bin/go/src/runtime/mem.go +9 -104
  84. package/bin/go/src/runtime/metrics/doc.go +0 -5
  85. package/bin/go/src/runtime/os_linux.go +0 -62
  86. package/bin/go/src/runtime/os_linux32.go +24 -14
  87. package/bin/go/src/runtime/os_linux64.go +0 -2
  88. package/bin/go/src/runtime/print.go +4 -16
  89. package/bin/go/src/runtime/race/README +9 -9
  90. package/bin/go/src/runtime/race/internal/amd64v1/race_darwin.syso +0 -0
  91. package/bin/go/src/runtime/race/internal/amd64v1/race_freebsd.syso +0 -0
  92. package/bin/go/src/runtime/race/internal/amd64v1/race_linux.syso +0 -0
  93. package/bin/go/src/runtime/race/internal/amd64v1/race_windows.syso +0 -0
  94. package/bin/go/src/runtime/race/internal/amd64v3/race_linux.syso +0 -0
  95. package/bin/go/src/runtime/race/race_darwin_arm64.syso +0 -0
  96. package/bin/go/src/runtime/race/race_linux_arm64.syso +0 -0
  97. package/bin/go/src/runtime/race/race_linux_loong64.syso +0 -0
  98. package/bin/go/src/runtime/race/race_linux_s390x.syso +0 -0
  99. package/bin/go/src/syscall/syscall_windows.go +1 -5
  100. package/bin/go/src/vendor/modules.txt +1 -1
  101. package/bin/ttsc +0 -0
  102. package/bin/ttscserver +0 -0
  103. package/package.json +2 -2
  104. package/bin/go/src/crypto/internal/fips140/drbg/entropy_fips140.go +0 -97
  105. package/bin/go/src/crypto/internal/fips140/drbg/entropy_wasm.go +0 -11
  106. package/bin/go/src/internal/poll/fstatat_unix.go +0 -22
  107. package/bin/go/src/internal/syscall/unix/fchmodat_linux.go +0 -51
  108. package/bin/go/src/internal/syscall/unix/fchmodat_other.go +0 -29
  109. package/bin/go/src/os/statat.go +0 -24
  110. package/bin/go/src/os/statat_other.go +0 -12
  111. package/bin/go/src/os/statat_unix.go +0 -20
  112. package/bin/go/src/runtime/race/internal/amd64v1/race_darwin.patch +0 -63
  113. package/bin/go/src/runtime/race/internal/amd64v1/race_freebsd.patch +0 -63
  114. package/bin/go/src/runtime/race/internal/amd64v1/race_linux.patch +0 -63
  115. package/bin/go/src/runtime/race/internal/amd64v1/race_windows.patch +0 -63
  116. package/bin/go/src/runtime/race/internal/amd64v3/race_linux.patch +0 -63
  117. package/bin/go/src/runtime/race/race_darwin_arm64.patch +0 -63
  118. package/bin/go/src/runtime/race/race_linux_arm64.patch +0 -63
  119. package/bin/go/src/runtime/race/race_linux_loong64.patch +0 -63
  120. package/bin/go/src/runtime/race/race_linux_s390x.patch +0 -63
package/bin/go/VERSION CHANGED
@@ -1,2 +1,2 @@
1
- go1.26.3
2
- time 2026-05-04T20:36:18Z
1
+ go1.26.0
2
+ time 2026-02-10T01:22:00Z
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
@@ -147,12 +147,6 @@ const (
147
147
  // Max length of a special file (PAX header, GNU long name or link).
148
148
  // This matches the limit used by libarchive.
149
149
  maxSpecialFileSize = 1 << 20
150
-
151
- // Maximum number of sparse file entries.
152
- // We should never actually hit this limit
153
- // (every sparse encoding will first be limited by maxSpecialFileSize),
154
- // but this adds an additional layer of defense.
155
- maxSparseFileEntries = 1 << 20
156
150
  )
157
151
 
158
152
  // blockPadding computes the number of bytes needed to pad offset up to the
@@ -490,8 +490,7 @@ func (tr *Reader) readOldGNUSparseMap(hdr *Header, blk *block) (sparseDatas, err
490
490
  }
491
491
  s := blk.toGNU().sparse()
492
492
  spd := make(sparseDatas, 0, s.maxEntries())
493
- totalSize := len(s)
494
- for totalSize < maxSpecialFileSize {
493
+ for {
495
494
  for i := 0; i < s.maxEntries(); i++ {
496
495
  // This termination condition is identical to GNU and BSD tar.
497
496
  if s.entry(i).offset()[0] == 0x00 {
@@ -502,11 +501,7 @@ func (tr *Reader) readOldGNUSparseMap(hdr *Header, blk *block) (sparseDatas, err
502
501
  if p.err != nil {
503
502
  return nil, p.err
504
503
  }
505
- var err error
506
- spd, err = appendSparseEntry(spd, sparseEntry{Offset: offset, Length: length})
507
- if err != nil {
508
- return nil, err
509
- }
504
+ spd = append(spd, sparseEntry{Offset: offset, Length: length})
510
505
  }
511
506
 
512
507
  if s.isExtended()[0] > 0 {
@@ -515,12 +510,10 @@ func (tr *Reader) readOldGNUSparseMap(hdr *Header, blk *block) (sparseDatas, err
515
510
  return nil, err
516
511
  }
517
512
  s = blk.toSparse()
518
- totalSize += len(s)
519
513
  continue
520
514
  }
521
515
  return spd, nil // Done
522
516
  }
523
- return nil, errSparseTooLong
524
517
  }
525
518
 
526
519
  // readGNUSparseMap1x0 reads the sparse map as stored in GNU's PAX sparse format
@@ -593,10 +586,7 @@ func readGNUSparseMap1x0(r io.Reader) (sparseDatas, error) {
593
586
  if err1 != nil || err2 != nil {
594
587
  return nil, ErrHeader
595
588
  }
596
- spd, err = appendSparseEntry(spd, sparseEntry{Offset: offset, Length: length})
597
- if err != nil {
598
- return nil, err
599
- }
589
+ spd = append(spd, sparseEntry{Offset: offset, Length: length})
600
590
  }
601
591
  return spd, nil
602
592
  }
@@ -630,22 +620,12 @@ func readGNUSparseMap0x1(paxHdrs map[string]string) (sparseDatas, error) {
630
620
  if err1 != nil || err2 != nil {
631
621
  return nil, ErrHeader
632
622
  }
633
- spd, err = appendSparseEntry(spd, sparseEntry{Offset: offset, Length: length})
634
- if err != nil {
635
- return nil, err
636
- }
623
+ spd = append(spd, sparseEntry{Offset: offset, Length: length})
637
624
  sparseMap = sparseMap[2:]
638
625
  }
639
626
  return spd, nil
640
627
  }
641
628
 
642
- func appendSparseEntry(spd sparseDatas, ent sparseEntry) (sparseDatas, error) {
643
- if len(spd) >= maxSparseFileEntries {
644
- return nil, errSparseTooLong
645
- }
646
- return append(spd, ent), nil
647
- }
648
-
649
629
  // Read reads from the current file in the tar archive.
650
630
  // It returns (0, io.EOF) when it reaches the end of that file,
651
631
  // until [Next] is called to advance to the next file.
@@ -122,10 +122,6 @@ type Type int
122
122
  // invocation.
123
123
  type Type1 int
124
124
 
125
- // TypeOrExpr is here for the purposes of documentation only. It is a stand-in
126
- // for either a Go type or an expression.
127
- type TypeOrExpr int
128
-
129
125
  // IntegerType is here for the purposes of documentation only. It is a stand-in
130
126
  // for any integer type: int, uint, int8 etc.
131
127
  type IntegerType int
@@ -224,15 +220,10 @@ func max[T cmp.Ordered](x T, y ...T) T
224
220
  // min will return NaN.
225
221
  func min[T cmp.Ordered](x T, y ...T) T
226
222
 
227
- // The built-in function new allocates a new, initialized variable and returns
228
- // a pointer to it. It accepts a single argument, which may be either a type
229
- // or an expression.
230
- // If the argument is a type T, then new(T) allocates a variable of type T
231
- // initialized to its zero value.
232
- // Otherwise, the argument is an expression x and new(x) allocates a variable
233
- // of the type of x initialized to the value of x. If that value is an untyped
234
- // constant, it is first implicitly converted to its default type.
235
- func new(TypeOrExpr) *Type
223
+ // The new built-in function allocates memory. The first argument is a type,
224
+ // not a value, and the value returned is a pointer to a newly
225
+ // allocated zero value of that type.
226
+ func new(Type) *Type
236
227
 
237
228
  // The complex built-in function constructs a complex value from two
238
229
  // floating-point values. The real and imaginary parts must be of the same
@@ -2,12 +2,6 @@
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
- // Package fips140 provides information about the FIPS 140-3 Go Cryptographic
6
- // Module and FIPS 140-3 mode.
7
- //
8
- // For more details, see the [FIPS 140-3 documentation].
9
- //
10
- // [FIPS 140-3 documentation]: https://go.dev/doc/security/fips140
11
5
  package fips140
12
6
 
13
7
  import (
@@ -9,11 +9,55 @@
9
9
  package drbg
10
10
 
11
11
  import (
12
+ entropy "crypto/internal/entropy/v1.0.0"
12
13
  "crypto/internal/fips140"
13
14
  "crypto/internal/sysrand"
14
15
  "io"
16
+ "sync"
17
+ "sync/atomic"
15
18
  )
16
19
 
20
+ // memory is a scratch buffer that is accessed between samples by the entropy
21
+ // source to expose it to memory access timings.
22
+ //
23
+ // We reuse it and share it between Seed calls to avoid the significant (~500µs)
24
+ // cost of zeroing a new allocation every time. The entropy source accesses it
25
+ // using atomics (and doesn't care about its contents).
26
+ //
27
+ // It should end up in the .noptrbss section, and become backed by physical pages
28
+ // at first use. This ensures that programs that do not use the FIPS 140-3 module
29
+ // do not incur any memory use or initialization penalties.
30
+ var memory entropy.ScratchBuffer
31
+
32
+ func getEntropy() *[SeedSize]byte {
33
+ var retries int
34
+ seed, err := entropy.Seed(&memory)
35
+ for err != nil {
36
+ // The CPU jitter-based SP 800-90B entropy source has a non-negligible
37
+ // chance of failing the startup health tests.
38
+ //
39
+ // Each time it does, it enters a permanent failure state, and we
40
+ // restart it anew. This is not expected to happen more than a few times
41
+ // in a row.
42
+ if retries++; retries > 100 {
43
+ panic("fips140/drbg: failed to obtain initial entropy")
44
+ }
45
+ seed, err = entropy.Seed(&memory)
46
+ }
47
+ return &seed
48
+ }
49
+
50
+ // getEntropy is very slow (~500µs), so we don't want it on the hot path.
51
+ // We keep both a persistent DRBG instance and a pool of additional instances.
52
+ // Occasional uses will use drbgInstance, even if the pool was emptied since the
53
+ // last use. Frequent concurrent uses will fill the pool and use it.
54
+ var drbgInstance atomic.Pointer[Counter]
55
+ var drbgPool = sync.Pool{
56
+ New: func() any {
57
+ return NewCounter(getEntropy())
58
+ },
59
+ }
60
+
17
61
  // Read fills b with cryptographically secure random bytes. In FIPS mode, it
18
62
  // uses an SP 800-90A Rev. 1 Deterministic Random Bit Generator (DRBG).
19
63
  // Otherwise, it uses the operating system's random number generator.
@@ -32,7 +76,37 @@ func Read(b []byte) {
32
76
  return
33
77
  }
34
78
 
35
- readFromEntropy(b)
79
+ // At every read, 128 random bits from the operating system are mixed as
80
+ // additional input, to make the output as strong as non-FIPS randomness.
81
+ // This is not credited as entropy for FIPS purposes, as allowed by Section
82
+ // 8.7.2: "Note that a DRBG does not rely on additional input to provide
83
+ // entropy, even though entropy could be provided in the additional input".
84
+ additionalInput := new([SeedSize]byte)
85
+ sysrand.Read(additionalInput[:16])
86
+
87
+ drbg := drbgInstance.Swap(nil)
88
+ if drbg == nil {
89
+ drbg = drbgPool.Get().(*Counter)
90
+ }
91
+ defer func() {
92
+ if !drbgInstance.CompareAndSwap(nil, drbg) {
93
+ drbgPool.Put(drbg)
94
+ }
95
+ }()
96
+
97
+ for len(b) > 0 {
98
+ size := min(len(b), maxRequestSize)
99
+ if reseedRequired := drbg.Generate(b[:size], additionalInput); reseedRequired {
100
+ // See SP 800-90A Rev. 1, Section 9.3.1, Steps 6-8, as explained in
101
+ // Section 9.3.2: if Generate reports a reseed is required, the
102
+ // additional input is passed to Reseed along with the entropy and
103
+ // then nulled before the next Generate call.
104
+ drbg.Reseed(getEntropy(), additionalInput)
105
+ additionalInput = nil
106
+ continue
107
+ }
108
+ b = b[size:]
109
+ }
36
110
  }
37
111
 
38
112
  var testingReader io.Reader
@@ -1363,7 +1363,7 @@ func (c *Conn) handleKeyUpdate(keyUpdate *keyUpdateMsg) error {
1363
1363
  }
1364
1364
 
1365
1365
  newSecret := cipherSuite.nextTrafficSecret(c.in.trafficSecret)
1366
- if err := c.setReadTrafficSecret(cipherSuite, QUICEncryptionLevelInitial, newSecret, keyUpdate.updateRequested); err != nil {
1366
+ if err := c.setReadTrafficSecret(cipherSuite, QUICEncryptionLevelInitial, newSecret); err != nil {
1367
1367
  return err
1368
1368
  }
1369
1369
 
@@ -1683,16 +1683,12 @@ func (c *Conn) VerifyHostname(host string) error {
1683
1683
  // setReadTrafficSecret sets the read traffic secret for the given encryption level. If
1684
1684
  // being called at the same time as setWriteTrafficSecret, the caller must ensure the call
1685
1685
  // to setWriteTrafficSecret happens first so any alerts are sent at the write level.
1686
- func (c *Conn) setReadTrafficSecret(suite *cipherSuiteTLS13, level QUICEncryptionLevel, secret []byte, locked bool) error {
1686
+ func (c *Conn) setReadTrafficSecret(suite *cipherSuiteTLS13, level QUICEncryptionLevel, secret []byte) error {
1687
1687
  // Ensure that there are no buffered handshake messages before changing the
1688
1688
  // read keys, since that can cause messages to be parsed that were encrypted
1689
1689
  // using old keys which are no longer appropriate.
1690
1690
  if c.hand.Len() != 0 {
1691
- if locked {
1692
- c.sendAlertLocked(alertUnexpectedMessage)
1693
- } else {
1694
- c.sendAlert(alertUnexpectedMessage)
1695
- }
1691
+ c.sendAlert(alertUnexpectedMessage)
1696
1692
  return errors.New("tls: handshake buffer not empty before setting read traffic secret")
1697
1693
  }
1698
1694
  c.in.setTrafficSecret(suite, level, secret)
@@ -492,7 +492,7 @@ func (hs *clientHandshakeStateTLS13) establishHandshakeKeys() error {
492
492
  clientSecret := handshakeSecret.ClientHandshakeTrafficSecret(hs.transcript)
493
493
  c.setWriteTrafficSecret(hs.suite, QUICEncryptionLevelHandshake, clientSecret)
494
494
  serverSecret := handshakeSecret.ServerHandshakeTrafficSecret(hs.transcript)
495
- if err := c.setReadTrafficSecret(hs.suite, QUICEncryptionLevelHandshake, serverSecret, false); err != nil {
495
+ if err := c.setReadTrafficSecret(hs.suite, QUICEncryptionLevelHandshake, serverSecret); err != nil {
496
496
  return err
497
497
  }
498
498
 
@@ -711,7 +711,7 @@ func (hs *clientHandshakeStateTLS13) readServerFinished() error {
711
711
 
712
712
  hs.trafficSecret = hs.masterSecret.ClientApplicationTrafficSecret(hs.transcript)
713
713
  serverSecret := hs.masterSecret.ServerApplicationTrafficSecret(hs.transcript)
714
- if err := c.setReadTrafficSecret(hs.suite, QUICEncryptionLevelApplication, serverSecret, false); err != nil {
714
+ if err := c.setReadTrafficSecret(hs.suite, QUICEncryptionLevelApplication, serverSecret); err != nil {
715
715
  return err
716
716
  }
717
717
 
@@ -752,7 +752,7 @@ func (hs *serverHandshakeStateTLS13) sendServerParameters() error {
752
752
  serverSecret := hs.handshakeSecret.ServerHandshakeTrafficSecret(hs.transcript)
753
753
  c.setWriteTrafficSecret(hs.suite, QUICEncryptionLevelHandshake, serverSecret)
754
754
  clientSecret := hs.handshakeSecret.ClientHandshakeTrafficSecret(hs.transcript)
755
- if err := c.setReadTrafficSecret(hs.suite, QUICEncryptionLevelHandshake, clientSecret, false); err != nil {
755
+ if err := c.setReadTrafficSecret(hs.suite, QUICEncryptionLevelHandshake, clientSecret); err != nil {
756
756
  return err
757
757
  }
758
758
 
@@ -1136,7 +1136,7 @@ func (hs *serverHandshakeStateTLS13) readClientFinished() error {
1136
1136
  return errors.New("tls: invalid client finished hash")
1137
1137
  }
1138
1138
 
1139
- if err := c.setReadTrafficSecret(hs.suite, QUICEncryptionLevelApplication, hs.trafficSecret, false); err != nil {
1139
+ if err := c.setReadTrafficSecret(hs.suite, QUICEncryptionLevelApplication, hs.trafficSecret); err != nil {
1140
1140
  return err
1141
1141
  }
1142
1142
 
@@ -7,7 +7,6 @@ package tls
7
7
  import (
8
8
  "crypto"
9
9
  "crypto/ecdh"
10
- "crypto/fips140"
11
10
  "crypto/hmac"
12
11
  "crypto/internal/fips140/tls13"
13
12
  "crypto/mlkem"
@@ -166,14 +165,7 @@ type hybridKeyExchange struct {
166
165
  }
167
166
 
168
167
  func (ke *hybridKeyExchange) keyShares(rand io.Reader) (*keySharePrivateKeys, []keyShare, error) {
169
- var (
170
- priv *keySharePrivateKeys
171
- ecdhShares []keyShare
172
- err error
173
- )
174
- fips140.WithoutEnforcement(func() { // Hybrid of ML-KEM, which is Approved.
175
- priv, ecdhShares, err = ke.ecdh.keyShares(rand)
176
- })
168
+ priv, ecdhShares, err := ke.ecdh.keyShares(rand)
177
169
  if err != nil {
178
170
  return nil, nil, err
179
171
  }
@@ -209,14 +201,7 @@ func (ke *hybridKeyExchange) serverSharedSecret(rand io.Reader, clientKeyShare [
209
201
  ecdhShareData = clientKeyShare[:ke.ecdhElementSize]
210
202
  mlkemShareData = clientKeyShare[ke.ecdhElementSize:]
211
203
  }
212
- var (
213
- ecdhSharedSecret []byte
214
- ks keyShare
215
- err error
216
- )
217
- fips140.WithoutEnforcement(func() { // Hybrid of ML-KEM, which is Approved.
218
- ecdhSharedSecret, ks, err = ke.ecdh.serverSharedSecret(rand, ecdhShareData)
219
- })
204
+ ecdhSharedSecret, ks, err := ke.ecdh.serverSharedSecret(rand, ecdhShareData)
220
205
  if err != nil {
221
206
  return nil, keyShare{}, err
222
207
  }
@@ -249,13 +234,7 @@ func (ke *hybridKeyExchange) clientSharedSecret(priv *keySharePrivateKeys, serve
249
234
  ecdhShareData = serverKeyShare[:ke.ecdhElementSize]
250
235
  mlkemShareData = serverKeyShare[ke.ecdhElementSize:]
251
236
  }
252
- var (
253
- ecdhSharedSecret []byte
254
- err error
255
- )
256
- fips140.WithoutEnforcement(func() { // Hybrid of ML-KEM, which is Approved.
257
- ecdhSharedSecret, err = ke.ecdh.clientSharedSecret(priv, ecdhShareData)
258
- })
237
+ ecdhSharedSecret, err := ke.ecdh.clientSharedSecret(priv, ecdhShareData)
259
238
  if err != nil {
260
239
  return nil, err
261
240
  }
@@ -58,11 +58,11 @@ import (
58
58
  // of nameConstraintsSet, to handle constraints which define full email
59
59
  // addresses (i.e. 'test@example.com'). For bare domain constraints, we use the
60
60
  // dnsConstraints type described above, querying the domain portion of the email
61
- // address. For full email addresses, we also hold a map of email addresses with
62
- // the domain portion of the email lowercased, since it is case insensitive. When
63
- // looking up an email address in the constraint set, we first check the full
64
- // email address map, and if we don't find anything, we check the domain portion
65
- // of the email address against the dnsConstraints.
61
+ // address. For full email addresses, we also hold a map of email addresses that
62
+ // map the local portion of the email to the domain. When querying full email
63
+ // addresses we then check if the local portion of the email is present in the
64
+ // map, and if so case insensitively compare the domain portion of the
65
+ // email.
66
66
 
67
67
  type nameConstraintsSet[T *net.IPNet | string, V net.IP | string] struct {
68
68
  set []T
@@ -351,7 +351,6 @@ func newDNSConstraints(l []string, permitted bool) interface{ query(string) (str
351
351
  if !permitted {
352
352
  parentConstraints := map[string]string{}
353
353
  for _, name := range nc.constraints.set {
354
- name = strings.ToLower(name)
355
354
  trimmedName := trimFirstLabel(name)
356
355
  if trimmedName == "" {
357
356
  continue
@@ -376,8 +375,7 @@ func (dnc *dnsConstraints) query(s string) (string, bool) {
376
375
  return constraint, true
377
376
  }
378
377
 
379
- if !dnc.permitted && len(s) > 0 && s[0] == '*' {
380
- s = strings.ToLower(s)
378
+ if !dnc.permitted && s[0] == '*' {
381
379
  trimmed := trimFirstLabel(s)
382
380
  if constraint, found := dnc.parentConstraints[trimmed]; found {
383
381
  return constraint, true
@@ -389,22 +387,16 @@ func (dnc *dnsConstraints) query(s string) (string, bool) {
389
387
  type emailConstraints struct {
390
388
  dnsConstraints interface{ query(string) (string, bool) }
391
389
 
392
- // fullEmails is map of rfc2821Mailboxs that are fully specified in the
393
- // constraints, which we need to check for separately since they don't
394
- // follow the same matching rules as the domain-based constraints. The
395
- // domain portion of the rfc2821Mailbox has been lowercased, since the
396
- // domain portion is case insensitive. When checking the map for an email,
397
- // the domain portion of the query should also be lowercased.
398
- fullEmails map[rfc2821Mailbox]struct{}
390
+ fullEmails map[string]string
399
391
  }
400
392
 
401
393
  func newEmailConstraints(l []string, permitted bool) interface {
402
- query(rfc2821Mailbox) (string, bool)
394
+ query(parsedEmail) (string, bool)
403
395
  } {
404
396
  if len(l) == 0 {
405
397
  return nil
406
398
  }
407
- exactMap := map[rfc2821Mailbox]struct{}{}
399
+ exactMap := map[string]string{}
408
400
  var domains []string
409
401
  for _, c := range l {
410
402
  if !strings.ContainsRune(c, '@') {
@@ -419,8 +411,7 @@ func newEmailConstraints(l []string, permitted bool) interface {
419
411
  // certificate since parsing.
420
412
  continue
421
413
  }
422
- parsed.domain = strings.ToLower(parsed.domain)
423
- exactMap[parsed] = struct{}{}
414
+ exactMap[parsed.local] = parsed.domain
424
415
  }
425
416
  ec := &emailConstraints{
426
417
  fullEmails: exactMap,
@@ -431,16 +422,16 @@ func newEmailConstraints(l []string, permitted bool) interface {
431
422
  return ec
432
423
  }
433
424
 
434
- func (ec *emailConstraints) query(s rfc2821Mailbox) (string, bool) {
435
- if len(ec.fullEmails) > 0 {
436
- if _, ok := ec.fullEmails[s]; ok {
437
- return fmt.Sprintf("%s@%s", s.local, s.domain), true
425
+ func (ec *emailConstraints) query(s parsedEmail) (string, bool) {
426
+ if len(ec.fullEmails) > 0 && strings.ContainsRune(s.email, '@') {
427
+ if domain, ok := ec.fullEmails[s.mailbox.local]; ok && strings.EqualFold(domain, s.mailbox.domain) {
428
+ return ec.fullEmails[s.email] + "@" + s.mailbox.domain, true
438
429
  }
439
430
  }
440
431
  if ec.dnsConstraints == nil {
441
432
  return "", false
442
433
  }
443
- constraint, found := ec.dnsConstraints.query(s.domain)
434
+ constraint, found := ec.dnsConstraints.query(s.mailbox.domain)
444
435
  return constraint, found
445
436
  }
446
437
 
@@ -450,7 +441,7 @@ type constraints[T any, V any] struct {
450
441
  excluded interface{ query(V) (T, bool) }
451
442
  }
452
443
 
453
- func checkConstraints[T string | *net.IPNet, V any, P string | net.IP | parsedURI | rfc2821Mailbox](c constraints[T, V], s V, p P) error {
444
+ func checkConstraints[T string | *net.IPNet, V any, P string | net.IP | parsedURI | parsedEmail](c constraints[T, V], s V, p P) error {
454
445
  if c.permitted != nil {
455
446
  if _, found := c.permitted.query(s); !found {
456
447
  return fmt.Errorf("%s %q is not permitted by any constraint", c.constraintType, p)
@@ -468,13 +459,13 @@ type chainConstraints struct {
468
459
  ip constraints[*net.IPNet, net.IP]
469
460
  dns constraints[string, string]
470
461
  uri constraints[string, string]
471
- email constraints[string, rfc2821Mailbox]
462
+ email constraints[string, parsedEmail]
472
463
 
473
464
  index int
474
465
  next *chainConstraints
475
466
  }
476
467
 
477
- func (cc *chainConstraints) check(dns []string, uris []parsedURI, emails []rfc2821Mailbox, ips []net.IP) error {
468
+ func (cc *chainConstraints) check(dns []string, uris []parsedURI, emails []parsedEmail, ips []net.IP) error {
478
469
  for _, ip := range ips {
479
470
  if err := checkConstraints(cc.ip, ip, ip); err != nil {
480
471
  return err
@@ -497,8 +488,8 @@ func (cc *chainConstraints) check(dns []string, uris []parsedURI, emails []rfc28
497
488
  }
498
489
  }
499
490
  for _, e := range emails {
500
- if !domainNameValid(e.domain, false) {
501
- return fmt.Errorf("x509: cannot parse rfc822Name %q", e)
491
+ if !domainNameValid(e.mailbox.domain, false) {
492
+ return fmt.Errorf("x509: cannot parse rfc822Name %q", e.mailbox)
502
493
  }
503
494
  if err := checkConstraints(cc.email, e, e); err != nil {
504
495
  return err
@@ -518,7 +509,7 @@ func checkChainConstraints(chain []*Certificate) error {
518
509
  ip: constraints[*net.IPNet, net.IP]{"IP address", newIPNetConstraints(c.PermittedIPRanges), newIPNetConstraints(c.ExcludedIPRanges)},
519
510
  dns: constraints[string, string]{"DNS name", newDNSConstraints(c.PermittedDNSDomains, true), newDNSConstraints(c.ExcludedDNSDomains, false)},
520
511
  uri: constraints[string, string]{"URI", newDNSConstraints(c.PermittedURIDomains, true), newDNSConstraints(c.ExcludedURIDomains, false)},
521
- email: constraints[string, rfc2821Mailbox]{"email address", newEmailConstraints(c.PermittedEmailAddresses, true), newEmailConstraints(c.ExcludedEmailAddresses, false)},
512
+ email: constraints[string, parsedEmail]{"email address", newEmailConstraints(c.PermittedEmailAddresses, true), newEmailConstraints(c.ExcludedEmailAddresses, false)},
522
513
  index: i,
523
514
  }
524
515
  if currentConstraints == nil {
@@ -601,15 +592,24 @@ func parseURIs(uris []*url.URL) ([]parsedURI, error) {
601
592
  return parsed, nil
602
593
  }
603
594
 
604
- func parseMailboxes(emails []string) ([]rfc2821Mailbox, error) {
605
- parsed := make([]rfc2821Mailbox, 0, len(emails))
595
+ type parsedEmail struct {
596
+ email string
597
+ mailbox *rfc2821Mailbox
598
+ }
599
+
600
+ func (e parsedEmail) String() string {
601
+ return e.mailbox.local + "@" + e.mailbox.domain
602
+ }
603
+
604
+ func parseMailboxes(emails []string) ([]parsedEmail, error) {
605
+ parsed := make([]parsedEmail, 0, len(emails))
606
606
  for _, email := range emails {
607
607
  mailbox, ok := parseRFC2821Mailbox(email)
608
608
  if !ok {
609
609
  return nil, fmt.Errorf("cannot parse rfc822Name %q", email)
610
610
  }
611
611
  mailbox.domain = strings.ToLower(mailbox.domain)
612
- parsed = append(parsed, mailbox)
612
+ parsed = append(parsed, parsedEmail{strings.ToLower(email), &mailbox})
613
613
  }
614
614
  return parsed, nil
615
615
  }
@@ -253,10 +253,6 @@ type rfc2821Mailbox struct {
253
253
  local, domain string
254
254
  }
255
255
 
256
- func (s rfc2821Mailbox) String() string {
257
- return fmt.Sprintf("%s@%s", s.local, s.domain)
258
- }
259
-
260
256
  // parseRFC2821Mailbox parses an email address into local and domain parts,
261
257
  // based on the ABNF for a “Mailbox” from RFC 2821. According to RFC 5280,
262
258
  // Section 4.2.1.6 that's correct for an rfc822Name from a certificate: “The
@@ -720,8 +716,6 @@ func alreadyInChain(candidate *Certificate, chain []*Certificate) bool {
720
716
  // for failed checks due to different intermediates having the same Subject.
721
717
  const maxChainSignatureChecks = 100
722
718
 
723
- var errSignatureLimit = errors.New("x509: signature check attempts limit reached while verifying certificate chain")
724
-
725
719
  func (c *Certificate) buildChains(currentChain []*Certificate, sigChecks *int, opts *VerifyOptions) (chains [][]*Certificate, err error) {
726
720
  var (
727
721
  hintErr error
@@ -729,16 +723,16 @@ func (c *Certificate) buildChains(currentChain []*Certificate, sigChecks *int, o
729
723
  )
730
724
 
731
725
  considerCandidate := func(certType int, candidate potentialParent) {
726
+ if candidate.cert.PublicKey == nil || alreadyInChain(candidate.cert, currentChain) {
727
+ return
728
+ }
729
+
732
730
  if sigChecks == nil {
733
731
  sigChecks = new(int)
734
732
  }
735
733
  *sigChecks++
736
734
  if *sigChecks > maxChainSignatureChecks {
737
- err = errSignatureLimit
738
- return
739
- }
740
-
741
- if candidate.cert.PublicKey == nil || alreadyInChain(candidate.cert, currentChain) {
735
+ err = errors.New("x509: signature check attempts limit reached while verifying certificate chain")
742
736
  return
743
737
  }
744
738
 
@@ -779,20 +773,11 @@ func (c *Certificate) buildChains(currentChain []*Certificate, sigChecks *int, o
779
773
  }
780
774
  }
781
775
 
782
- candidateLoop:
783
- for _, parents := range []struct {
784
- certType int
785
- potentials []potentialParent
786
- }{
787
- {rootCertificate, opts.Roots.findPotentialParents(c)},
788
- {intermediateCertificate, opts.Intermediates.findPotentialParents(c)},
789
- } {
790
- for _, parent := range parents.potentials {
791
- considerCandidate(parents.certType, parent)
792
- if err == errSignatureLimit {
793
- break candidateLoop
794
- }
795
- }
776
+ for _, root := range opts.Roots.findPotentialParents(c) {
777
+ considerCandidate(rootCertificate, root)
778
+ }
779
+ for _, intermediate := range opts.Intermediates.findPotentialParents(c) {
780
+ considerCandidate(intermediateCertificate, intermediate)
796
781
  }
797
782
 
798
783
  if len(chains) > 0 {
@@ -1295,12 +1280,12 @@ func policiesValid(chain []*Certificate, opts VerifyOptions) bool {
1295
1280
  } else {
1296
1281
  // 6.1.4 (b) (3) (i) -- as updated by RFC 9618
1297
1282
  pg.deleteLeaf(mapping.IssuerDomainPolicy)
1283
+
1284
+ // 6.1.4 (b) (3) (ii) -- as updated by RFC 9618
1285
+ pg.prune()
1298
1286
  }
1299
1287
  }
1300
1288
 
1301
- // 6.1.4 (b) (3) (ii) -- as updated by RFC 9618
1302
- pg.prune()
1303
-
1304
1289
  for issuerStr, subjectPolicies := range mappings {
1305
1290
  // 6.1.4 (b) (1) -- as updated by RFC 9618
1306
1291
  if matching := pg.leafWithPolicy(OID{der: []byte(issuerStr)}); matching != nil {
@@ -115,7 +115,7 @@ func (check *Checker) builtin(x *operand, call *ast.CallExpr, id builtinId) (_ b
115
115
  for _, u := range typeset(y.typ) {
116
116
  if s, _ := u.(*Slice); s != nil && Identical(s.elem, universeByte) {
117
117
  // typeset ⊇ {[]byte}
118
- } else if u != nil && isString(u) {
118
+ } else if isString(u) {
119
119
  // typeset ⊇ {string}
120
120
  hasString = true
121
121
  } else {
@@ -378,7 +378,7 @@ func (check *Checker) builtin(x *operand, call *ast.CallExpr, id builtinId) (_ b
378
378
  for _, u := range typeset(y.typ) {
379
379
  if s, _ := u.(*Slice); s != nil && Identical(s.elem, universeByte) {
380
380
  // typeset ⊇ {[]byte}
381
- } else if u != nil && isString(u) {
381
+ } else if isString(u) {
382
382
  // typeset ⊇ {string}
383
383
  } else {
384
384
  special = false
@@ -74,9 +74,6 @@ func NewSignatureType(recv *Var, recvTypeParams, typeParams []*TypeParam, params
74
74
  last := params.At(n - 1).typ
75
75
  var S *Slice
76
76
  for t := range typeset(last) {
77
- if t == nil {
78
- break
79
- }
80
77
  var s *Slice
81
78
  if isString(t) {
82
79
  s = NewSlice(universeByte)