]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link/internal/loader: fix linknames from FIPS 140 frozen tree
authorFilippo Valsorda <filippo@golang.org>
Wed, 29 Jan 2025 02:18:01 +0000 (03:18 +0100)
committerGopher Robot <gobot@golang.org>
Wed, 29 Jan 2025 14:30:36 +0000 (06:30 -0800)
blockedLinknames was updated in CL 635676 after the lib/fips140 zip
mechanism was last tested. linknames from crypto/internal/fips140/v1.0.0
need to be allowed if they'd be allowed from crypto/internal/fips140.

Change-Id: I6a6a4656022118d4739ae14831f2ad721951c192
Reviewed-on: https://go-review.googlesource.com/c/go/+/645195
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
src/cmd/link/internal/loader/loader.go

index e7cc30ab0731c2a12774c513dbbe809acb41abfc..0c234e89758df32960660194784fcad0367fe4dd 100644 (file)
@@ -2394,6 +2394,16 @@ func (l *Loader) checkLinkname(pkg, name string, s Sym) {
                        if pkg == p {
                                return // pkg is allowed
                        }
+                       // crypto/internal/fips140/vX.Y.Z/... is the frozen version of
+                       // crypto/internal/fips140/... and is similarly allowed.
+                       if strings.HasPrefix(pkg, "crypto/internal/fips140/v") {
+                               parts := strings.Split(pkg, "/")
+                               parts = append(parts[:3], parts[4:]...)
+                               pkg := strings.Join(parts, "/")
+                               if pkg == p {
+                                       return
+                               }
+                       }
                }
                error()
        }