From 8a57cc8e3749f05134c82d7750b4ed1831f4d846 Mon Sep 17 00:00:00 2001 From: Filippo Valsorda Date: Tue, 6 Feb 2024 13:32:39 +0100 Subject: [PATCH] crypto: use and test purego tag consistently Fixes #58636 Updates #23172 Change-Id: I578a5597f467be45a7d6fb7582b24855b2e6512b Reviewed-on: https://go-review.googlesource.com/c/go/+/561935 Reviewed-by: Roland Shoemaker Reviewed-by: Michael Knyszek Auto-Submit: Filippo Valsorda LUCI-TryBot-Result: Go LUCI --- src/cmd/dist/test.go | 8 +++ src/crypto/aes/aes_gcm.go | 2 +- src/crypto/aes/asm_amd64.s | 2 + src/crypto/aes/asm_arm64.s | 2 + src/crypto/aes/asm_ppc64x.s | 2 +- src/crypto/aes/asm_s390x.s | 2 + src/crypto/aes/cbc_ppc64x.go | 2 +- src/crypto/aes/cbc_s390x.go | 2 + src/crypto/aes/cipher_asm.go | 2 +- src/crypto/aes/cipher_generic.go | 2 +- src/crypto/aes/cipher_s390x.go | 2 + src/crypto/aes/ctr_s390x.go | 2 + src/crypto/aes/gcm_amd64.s | 2 + src/crypto/aes/gcm_arm64.s | 2 + src/crypto/aes/gcm_ppc64x.go | 2 +- src/crypto/aes/gcm_ppc64x.s | 2 +- src/crypto/aes/gcm_s390x.go | 2 + src/crypto/ecdsa/ecdsa_noasm.go | 2 +- src/crypto/ecdsa/ecdsa_s390x.go | 2 + src/crypto/ecdsa/ecdsa_s390x.s | 2 + src/crypto/ecdsa/ecdsa_s390x_test.go | 2 +- .../edwards25519/field/_asm/fe_amd64_asm.go | 2 +- .../internal/edwards25519/field/fe_amd64.go | 2 +- .../internal/edwards25519/field/fe_amd64.s | 2 +- .../edwards25519/field/fe_amd64_noasm.go | 2 +- .../internal/edwards25519/field/fe_arm64.go | 2 +- .../internal/edwards25519/field/fe_arm64.s | 2 +- .../edwards25519/field/fe_arm64_noasm.go | 2 +- src/crypto/internal/nistec/generate.go | 2 +- src/crypto/internal/nistec/p256.go | 2 +- src/crypto/internal/nistec/p256_asm.go | 2 +- src/crypto/internal/nistec/p256_asm_amd64.s | 2 + src/crypto/internal/nistec/p256_asm_arm64.s | 2 + src/crypto/internal/nistec/p256_asm_ppc64le.s | 2 + src/crypto/internal/nistec/p256_asm_s390x.s | 2 + .../internal/nistec/p256_asm_table_test.go | 2 +- src/crypto/internal/nistec/p256_ordinv.go | 2 +- .../internal/nistec/p256_ordinv_noasm.go | 2 +- .../internal/nistec/p256_ordinv_test.go | 2 +- src/crypto/md5/md5block_386.s | 2 + src/crypto/md5/md5block_amd64.s | 2 + src/crypto/md5/md5block_arm.s | 2 + src/crypto/md5/md5block_arm64.s | 2 + src/crypto/md5/md5block_decl.go | 2 +- src/crypto/md5/md5block_generic.go | 2 +- src/crypto/md5/md5block_ppc64x.s | 2 +- src/crypto/md5/md5block_s390x.s | 2 + src/crypto/purego_test.go | 67 +++++++++++++++++++ src/crypto/sha1/fallback_test.go | 2 +- src/crypto/sha1/sha1block_386.s | 2 + src/crypto/sha1/sha1block_amd64.go | 2 + src/crypto/sha1/sha1block_amd64.s | 1 + src/crypto/sha1/sha1block_arm.s | 2 + src/crypto/sha1/sha1block_arm64.go | 2 + src/crypto/sha1/sha1block_arm64.s | 2 + src/crypto/sha1/sha1block_decl.go | 2 +- src/crypto/sha1/sha1block_generic.go | 2 +- src/crypto/sha1/sha1block_s390x.go | 2 + src/crypto/sha1/sha1block_s390x.s | 2 + src/crypto/sha256/fallback_test.go | 2 +- src/crypto/sha256/sha256block_386.s | 2 + src/crypto/sha256/sha256block_amd64.go | 2 + src/crypto/sha256/sha256block_amd64.s | 2 + src/crypto/sha256/sha256block_arm64.go | 2 + src/crypto/sha256/sha256block_arm64.s | 2 + src/crypto/sha256/sha256block_decl.go | 2 +- src/crypto/sha256/sha256block_generic.go | 2 +- src/crypto/sha256/sha256block_ppc64x.s | 2 +- src/crypto/sha256/sha256block_s390x.go | 2 + src/crypto/sha256/sha256block_s390x.s | 2 + src/crypto/sha512/fallback_test.go | 2 +- src/crypto/sha512/sha512block_amd64.go | 2 +- src/crypto/sha512/sha512block_amd64.s | 2 + src/crypto/sha512/sha512block_arm64.go | 2 + src/crypto/sha512/sha512block_arm64.s | 2 + src/crypto/sha512/sha512block_decl.go | 2 +- src/crypto/sha512/sha512block_generic.go | 2 +- src/crypto/sha512/sha512block_ppc64x.s | 2 +- src/crypto/sha512/sha512block_riscv64.s | 2 + src/crypto/sha512/sha512block_s390x.go | 2 + src/crypto/sha512/sha512block_s390x.s | 2 + 81 files changed, 194 insertions(+), 38 deletions(-) create mode 100644 src/crypto/purego_test.go diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go index 80a134becdf879..aed59db9d56080 100644 --- a/src/cmd/dist/test.go +++ b/src/cmd/dist/test.go @@ -691,6 +691,14 @@ func (t *tester) registerTests() { }) } + // Check that all crypto packages compile with the purego build tag. + t.registerTest("crypto with tag purego", &goTest{ + variant: "purego", + tags: []string{"purego"}, + pkg: "crypto/...", + runTests: "^$", // only ensure they compile + }) + // Test ios/amd64 for the iOS simulator. if goos == "darwin" && goarch == "amd64" && t.cgoEnabled { t.registerTest("GOOS=ios on darwin/amd64", diff --git a/src/crypto/aes/aes_gcm.go b/src/crypto/aes/aes_gcm.go index 036705fecaac6e..b95796970c86ad 100644 --- a/src/crypto/aes/aes_gcm.go +++ b/src/crypto/aes/aes_gcm.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build amd64 || arm64 +//go:build (amd64 || arm64) && !purego package aes diff --git a/src/crypto/aes/asm_amd64.s b/src/crypto/aes/asm_amd64.s index ed831bf47ff2a9..d5e17401ea0ef6 100644 --- a/src/crypto/aes/asm_amd64.s +++ b/src/crypto/aes/asm_amd64.s @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + #include "textflag.h" // func encryptBlockAsm(nr int, xk *uint32, dst, src *byte) diff --git a/src/crypto/aes/asm_arm64.s b/src/crypto/aes/asm_arm64.s index 4a02e943ce3168..2bf5bee2b59fb2 100644 --- a/src/crypto/aes/asm_arm64.s +++ b/src/crypto/aes/asm_arm64.s @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + #include "textflag.h" DATA rotInvSRows<>+0x00(SB)/8, $0x080f0205040b0e01 DATA rotInvSRows<>+0x08(SB)/8, $0x00070a0d0c030609 diff --git a/src/crypto/aes/asm_ppc64x.s b/src/crypto/aes/asm_ppc64x.s index 288f7256c7c5bf..859cffa3eef233 100644 --- a/src/crypto/aes/asm_ppc64x.s +++ b/src/crypto/aes/asm_ppc64x.s @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build ppc64 || ppc64le +//go:build (ppc64 || ppc64le) && !purego // Based on CRYPTOGAMS code with the following comment: // # ==================================================================== diff --git a/src/crypto/aes/asm_s390x.s b/src/crypto/aes/asm_s390x.s index a233714fb8e3b5..5da0d8bf9cb3f1 100644 --- a/src/crypto/aes/asm_s390x.s +++ b/src/crypto/aes/asm_s390x.s @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + #include "textflag.h" // func cryptBlocks(c code, key, dst, src *byte, length int) diff --git a/src/crypto/aes/cbc_ppc64x.go b/src/crypto/aes/cbc_ppc64x.go index c23c37156e5179..2cb9606e5864b4 100644 --- a/src/crypto/aes/cbc_ppc64x.go +++ b/src/crypto/aes/cbc_ppc64x.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build ppc64 || ppc64le +//go:build (ppc64 || ppc64le) && !purego package aes diff --git a/src/crypto/aes/cbc_s390x.go b/src/crypto/aes/cbc_s390x.go index eaa21f8a65f2cc..09c19ff394793a 100644 --- a/src/crypto/aes/cbc_s390x.go +++ b/src/crypto/aes/cbc_s390x.go @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + package aes import ( diff --git a/src/crypto/aes/cipher_asm.go b/src/crypto/aes/cipher_asm.go index 90031c5e2c58e6..5451fa60d38677 100644 --- a/src/crypto/aes/cipher_asm.go +++ b/src/crypto/aes/cipher_asm.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build amd64 || arm64 || ppc64 || ppc64le +//go:build (amd64 || arm64 || ppc64 || ppc64le) && !purego package aes diff --git a/src/crypto/aes/cipher_generic.go b/src/crypto/aes/cipher_generic.go index 8a8a3fff384400..7c7d89aa873d0d 100644 --- a/src/crypto/aes/cipher_generic.go +++ b/src/crypto/aes/cipher_generic.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !amd64 && !s390x && !ppc64 && !ppc64le && !arm64 +//go:build (!amd64 && !s390x && !ppc64 && !ppc64le && !arm64) || purego package aes diff --git a/src/crypto/aes/cipher_s390x.go b/src/crypto/aes/cipher_s390x.go index 8dd3d8f0537fd3..1541890deab7fa 100644 --- a/src/crypto/aes/cipher_s390x.go +++ b/src/crypto/aes/cipher_s390x.go @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + package aes import ( diff --git a/src/crypto/aes/ctr_s390x.go b/src/crypto/aes/ctr_s390x.go index 921421533a4490..e5249d1842216b 100644 --- a/src/crypto/aes/ctr_s390x.go +++ b/src/crypto/aes/ctr_s390x.go @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + package aes import ( diff --git a/src/crypto/aes/gcm_amd64.s b/src/crypto/aes/gcm_amd64.s index e6eedf326400a5..f787e6fd6bbe94 100644 --- a/src/crypto/aes/gcm_amd64.s +++ b/src/crypto/aes/gcm_amd64.s @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + // This is an optimized implementation of AES-GCM using AES-NI and CLMUL-NI // The implementation uses some optimization as described in: // [1] Gueron, S., Kounavis, M.E.: Intel® Carry-Less Multiplication diff --git a/src/crypto/aes/gcm_arm64.s b/src/crypto/aes/gcm_arm64.s index c3501024c9f932..23ce1890e4e5d0 100644 --- a/src/crypto/aes/gcm_arm64.s +++ b/src/crypto/aes/gcm_arm64.s @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + #include "textflag.h" #define B0 V0 diff --git a/src/crypto/aes/gcm_ppc64x.go b/src/crypto/aes/gcm_ppc64x.go index 2a7f898dc4be42..04fac72459cbe2 100644 --- a/src/crypto/aes/gcm_ppc64x.go +++ b/src/crypto/aes/gcm_ppc64x.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build ppc64le || ppc64 +//go:build (ppc64le || ppc64) && !purego package aes diff --git a/src/crypto/aes/gcm_ppc64x.s b/src/crypto/aes/gcm_ppc64x.s index f661b2764279c9..987f4e718e124c 100644 --- a/src/crypto/aes/gcm_ppc64x.s +++ b/src/crypto/aes/gcm_ppc64x.s @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build ppc64 || ppc64le +//go:build (ppc64 || ppc64le) && !purego // Portions based on CRYPTOGAMS code with the following comment: // # ==================================================================== diff --git a/src/crypto/aes/gcm_s390x.go b/src/crypto/aes/gcm_s390x.go index cf0e28af695bda..01504e1815a031 100644 --- a/src/crypto/aes/gcm_s390x.go +++ b/src/crypto/aes/gcm_s390x.go @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + package aes import ( diff --git a/src/crypto/ecdsa/ecdsa_noasm.go b/src/crypto/ecdsa/ecdsa_noasm.go index a72aa4b04ef52f..e2fa8082f68d4c 100644 --- a/src/crypto/ecdsa/ecdsa_noasm.go +++ b/src/crypto/ecdsa/ecdsa_noasm.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !s390x +//go:build !s390x || purego package ecdsa diff --git a/src/crypto/ecdsa/ecdsa_s390x.go b/src/crypto/ecdsa/ecdsa_s390x.go index 49f645a4892761..8ebf15a525fbfd 100644 --- a/src/crypto/ecdsa/ecdsa_s390x.go +++ b/src/crypto/ecdsa/ecdsa_s390x.go @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + package ecdsa import ( diff --git a/src/crypto/ecdsa/ecdsa_s390x.s b/src/crypto/ecdsa/ecdsa_s390x.s index ea1f4469e9918c..2aae59c291d15c 100644 --- a/src/crypto/ecdsa/ecdsa_s390x.s +++ b/src/crypto/ecdsa/ecdsa_s390x.s @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + #include "textflag.h" // func kdsa(fc uint64, params *[4096]byte) (errn uint64) diff --git a/src/crypto/ecdsa/ecdsa_s390x_test.go b/src/crypto/ecdsa/ecdsa_s390x_test.go index fd1dc7c0605a5d..ba8f810fab0e86 100644 --- a/src/crypto/ecdsa/ecdsa_s390x_test.go +++ b/src/crypto/ecdsa/ecdsa_s390x_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build s390x +//go:build s390x && !purego package ecdsa diff --git a/src/crypto/internal/edwards25519/field/_asm/fe_amd64_asm.go b/src/crypto/internal/edwards25519/field/_asm/fe_amd64_asm.go index 411399cb1e83d3..6765a688f455ec 100644 --- a/src/crypto/internal/edwards25519/field/_asm/fe_amd64_asm.go +++ b/src/crypto/internal/edwards25519/field/_asm/fe_amd64_asm.go @@ -17,7 +17,7 @@ import ( func main() { Package("crypto/internal/edwards25519/field") - ConstraintExpr("amd64,gc,!purego") + ConstraintExpr("!purego") feMul() feSquare() Generate() diff --git a/src/crypto/internal/edwards25519/field/fe_amd64.go b/src/crypto/internal/edwards25519/field/fe_amd64.go index 70c541692c3a3a..00bf8f4479225b 100644 --- a/src/crypto/internal/edwards25519/field/fe_amd64.go +++ b/src/crypto/internal/edwards25519/field/fe_amd64.go @@ -1,6 +1,6 @@ // Code generated by command: go run fe_amd64_asm.go -out ../fe_amd64.s -stubs ../fe_amd64.go -pkg field. DO NOT EDIT. -//go:build amd64 && gc && !purego +//go:build !purego package field diff --git a/src/crypto/internal/edwards25519/field/fe_amd64.s b/src/crypto/internal/edwards25519/field/fe_amd64.s index 60817acc4131a0..657851c85ed199 100644 --- a/src/crypto/internal/edwards25519/field/fe_amd64.s +++ b/src/crypto/internal/edwards25519/field/fe_amd64.s @@ -1,6 +1,6 @@ // Code generated by command: go run fe_amd64_asm.go -out ../fe_amd64.s -stubs ../fe_amd64.go -pkg field. DO NOT EDIT. -//go:build amd64 && gc && !purego +//go:build !purego #include "textflag.h" diff --git a/src/crypto/internal/edwards25519/field/fe_amd64_noasm.go b/src/crypto/internal/edwards25519/field/fe_amd64_noasm.go index 9da280d1d887d0..4b81f25d1d0f53 100644 --- a/src/crypto/internal/edwards25519/field/fe_amd64_noasm.go +++ b/src/crypto/internal/edwards25519/field/fe_amd64_noasm.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !amd64 || !gc || purego +//go:build !amd64 || purego package field diff --git a/src/crypto/internal/edwards25519/field/fe_arm64.go b/src/crypto/internal/edwards25519/field/fe_arm64.go index 075fe9b925742e..05c7cedd4e9c74 100644 --- a/src/crypto/internal/edwards25519/field/fe_arm64.go +++ b/src/crypto/internal/edwards25519/field/fe_arm64.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build arm64 && gc && !purego +//go:build !purego package field diff --git a/src/crypto/internal/edwards25519/field/fe_arm64.s b/src/crypto/internal/edwards25519/field/fe_arm64.s index 3126a434191c0c..ae207dae43e8fc 100644 --- a/src/crypto/internal/edwards25519/field/fe_arm64.s +++ b/src/crypto/internal/edwards25519/field/fe_arm64.s @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build arm64 && gc && !purego +//go:build !purego #include "textflag.h" diff --git a/src/crypto/internal/edwards25519/field/fe_arm64_noasm.go b/src/crypto/internal/edwards25519/field/fe_arm64_noasm.go index fc029ac12dae05..6b9e06a6e8266c 100644 --- a/src/crypto/internal/edwards25519/field/fe_arm64_noasm.go +++ b/src/crypto/internal/edwards25519/field/fe_arm64_noasm.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !arm64 || !gc || purego +//go:build !arm64 || purego package field diff --git a/src/crypto/internal/nistec/generate.go b/src/crypto/internal/nistec/generate.go index 0e84cefb3657dc..27e8d13943b243 100644 --- a/src/crypto/internal/nistec/generate.go +++ b/src/crypto/internal/nistec/generate.go @@ -40,7 +40,7 @@ var curves = []struct { P: "P256", Element: "fiat.P256Element", Params: elliptic.P256().Params(), - BuildTags: "!amd64 && !arm64 && !ppc64le && !s390x", + BuildTags: "(!amd64 && !arm64 && !ppc64le && !s390x) || purego", }, { P: "P384", diff --git a/src/crypto/internal/nistec/p256.go b/src/crypto/internal/nistec/p256.go index 3cfa5fb37179c6..f2dfbbb1ee9b43 100644 --- a/src/crypto/internal/nistec/p256.go +++ b/src/crypto/internal/nistec/p256.go @@ -4,7 +4,7 @@ // Code generated by generate.go. DO NOT EDIT. -//go:build !amd64 && !arm64 && !ppc64le && !s390x +//go:build (!amd64 && !arm64 && !ppc64le && !s390x) || purego package nistec diff --git a/src/crypto/internal/nistec/p256_asm.go b/src/crypto/internal/nistec/p256_asm.go index 99a22b833f028c..1a523cc13c1449 100644 --- a/src/crypto/internal/nistec/p256_asm.go +++ b/src/crypto/internal/nistec/p256_asm.go @@ -10,7 +10,7 @@ // https://link.springer.com/article/10.1007%2Fs13389-014-0090-x // https://eprint.iacr.org/2013/816.pdf -//go:build amd64 || arm64 || ppc64le || s390x +//go:build (amd64 || arm64 || ppc64le || s390x) && !purego package nistec diff --git a/src/crypto/internal/nistec/p256_asm_amd64.s b/src/crypto/internal/nistec/p256_asm_amd64.s index 84e4cee9039ccc..f5c008319bd7f0 100644 --- a/src/crypto/internal/nistec/p256_asm_amd64.s +++ b/src/crypto/internal/nistec/p256_asm_amd64.s @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + // This file contains constant-time, 64-bit assembly implementation of // P256. The optimizations performed here are described in detail in: // S.Gueron and V.Krasnov, "Fast prime field elliptic-curve cryptography with diff --git a/src/crypto/internal/nistec/p256_asm_arm64.s b/src/crypto/internal/nistec/p256_asm_arm64.s index 1ba5df381b3a96..d00a54db1adc41 100644 --- a/src/crypto/internal/nistec/p256_asm_arm64.s +++ b/src/crypto/internal/nistec/p256_asm_arm64.s @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + // This file contains constant-time, 64-bit assembly implementation of // P256. The optimizations performed here are described in detail in: // S.Gueron and V.Krasnov, "Fast prime field elliptic-curve cryptography with diff --git a/src/crypto/internal/nistec/p256_asm_ppc64le.s b/src/crypto/internal/nistec/p256_asm_ppc64le.s index 6b787609b9994e..1475dfb1d90e4b 100644 --- a/src/crypto/internal/nistec/p256_asm_ppc64le.s +++ b/src/crypto/internal/nistec/p256_asm_ppc64le.s @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + #include "textflag.h" // This is a port of the s390x asm implementation. diff --git a/src/crypto/internal/nistec/p256_asm_s390x.s b/src/crypto/internal/nistec/p256_asm_s390x.s index 8da4f3f5b89d08..77c9f63349a047 100644 --- a/src/crypto/internal/nistec/p256_asm_s390x.s +++ b/src/crypto/internal/nistec/p256_asm_s390x.s @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + #include "textflag.h" #include "go_asm.h" diff --git a/src/crypto/internal/nistec/p256_asm_table_test.go b/src/crypto/internal/nistec/p256_asm_table_test.go index 5b7246ba1274be..cba455d32db965 100644 --- a/src/crypto/internal/nistec/p256_asm_table_test.go +++ b/src/crypto/internal/nistec/p256_asm_table_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build amd64 || arm64 || ppc64le || s390x +//go:build !purego && (amd64 || arm64 || ppc64le || s390x) package nistec diff --git a/src/crypto/internal/nistec/p256_ordinv.go b/src/crypto/internal/nistec/p256_ordinv.go index 1274fb7fd3f5cc..156a873188c3ae 100644 --- a/src/crypto/internal/nistec/p256_ordinv.go +++ b/src/crypto/internal/nistec/p256_ordinv.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build amd64 || arm64 +//go:build (amd64 || arm64) && !purego package nistec diff --git a/src/crypto/internal/nistec/p256_ordinv_noasm.go b/src/crypto/internal/nistec/p256_ordinv_noasm.go index 213875ce76165c..9cbb1a89dbaf18 100644 --- a/src/crypto/internal/nistec/p256_ordinv_noasm.go +++ b/src/crypto/internal/nistec/p256_ordinv_noasm.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !amd64 && !arm64 +//go:build (!amd64 && !arm64) || purego package nistec diff --git a/src/crypto/internal/nistec/p256_ordinv_test.go b/src/crypto/internal/nistec/p256_ordinv_test.go index 72de6bd487d06e..ca323a3ae294f9 100644 --- a/src/crypto/internal/nistec/p256_ordinv_test.go +++ b/src/crypto/internal/nistec/p256_ordinv_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build amd64 || arm64 +//go:build (amd64 || arm64) && !purego package nistec_test diff --git a/src/crypto/md5/md5block_386.s b/src/crypto/md5/md5block_386.s index 30d4209a62407f..b6c6509d3b529c 100644 --- a/src/crypto/md5/md5block_386.s +++ b/src/crypto/md5/md5block_386.s @@ -6,6 +6,8 @@ // #defines generating 8a assembly, and adjusted for 386, // by the Go Authors. +//go:build !purego + #include "textflag.h" // MD5 optimized for AMD64. diff --git a/src/crypto/md5/md5block_amd64.s b/src/crypto/md5/md5block_amd64.s index 75c8074b37ebb4..652506ae27fbc1 100644 --- a/src/crypto/md5/md5block_amd64.s +++ b/src/crypto/md5/md5block_amd64.s @@ -5,6 +5,8 @@ // Translated from Perl generating GNU assembly into // #defines generating 6a assembly by the Go Authors. +//go:build !purego + #include "textflag.h" // MD5 optimized for AMD64. diff --git a/src/crypto/md5/md5block_arm.s b/src/crypto/md5/md5block_arm.s index 54d02b743a6a2b..13fdc5c3beb515 100644 --- a/src/crypto/md5/md5block_arm.s +++ b/src/crypto/md5/md5block_arm.s @@ -4,6 +4,8 @@ // // ARM version of md5block.go +//go:build !purego + #include "textflag.h" // Register definitions diff --git a/src/crypto/md5/md5block_arm64.s b/src/crypto/md5/md5block_arm64.s index 39b9851d1fe1c2..5942218f76fb92 100644 --- a/src/crypto/md5/md5block_arm64.s +++ b/src/crypto/md5/md5block_arm64.s @@ -5,6 +5,8 @@ // ARM64 version of md5block.go // derived from crypto/md5/md5block_amd64.s +//go:build !purego + #include "textflag.h" TEXT ·block(SB),NOSPLIT,$0-32 diff --git a/src/crypto/md5/md5block_decl.go b/src/crypto/md5/md5block_decl.go index f1fb34c3d7fb85..3664542fb92048 100644 --- a/src/crypto/md5/md5block_decl.go +++ b/src/crypto/md5/md5block_decl.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build amd64 || 386 || arm || ppc64le || ppc64 || s390x || arm64 +//go:build (amd64 || 386 || arm || ppc64le || ppc64 || s390x || arm64) && !purego package md5 diff --git a/src/crypto/md5/md5block_generic.go b/src/crypto/md5/md5block_generic.go index c929c2b84aca51..43cfebd38a9094 100644 --- a/src/crypto/md5/md5block_generic.go +++ b/src/crypto/md5/md5block_generic.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !amd64 && !386 && !arm && !ppc64le && !ppc64 && !s390x && !arm64 +//go:build (!amd64 && !386 && !arm && !ppc64le && !ppc64 && !s390x && !arm64) || purego package md5 diff --git a/src/crypto/md5/md5block_ppc64x.s b/src/crypto/md5/md5block_ppc64x.s index 69a20e7cad3399..f607040d02e664 100644 --- a/src/crypto/md5/md5block_ppc64x.s +++ b/src/crypto/md5/md5block_ppc64x.s @@ -10,7 +10,7 @@ // Licence: I hereby disclaim the copyright on this code and place it // in the public domain. -//go:build ppc64 || ppc64le +//go:build (ppc64 || ppc64le) && !purego #include "textflag.h" diff --git a/src/crypto/md5/md5block_s390x.s b/src/crypto/md5/md5block_s390x.s index 68f501cfea83d3..2d18d28f2514d5 100644 --- a/src/crypto/md5/md5block_s390x.s +++ b/src/crypto/md5/md5block_s390x.s @@ -10,6 +10,8 @@ // Licence: I hereby disclaim the copyright on this code and place it // in the public domain. +//go:build !purego + #include "textflag.h" // func block(dig *digest, p []byte) diff --git a/src/crypto/purego_test.go b/src/crypto/purego_test.go new file mode 100644 index 00000000000000..62be347e0c6822 --- /dev/null +++ b/src/crypto/purego_test.go @@ -0,0 +1,67 @@ +// 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. + +package crypto_test + +import ( + "go/build" + "internal/testenv" + "log" + "os" + "os/exec" + "strings" + "testing" +) + +// TestPureGoTag checks that when built with the purego build tag, crypto +// packages don't require any assembly. This is used by alternative compilers +// such as TinyGo. See also the "crypto/...:purego" test in cmd/dist, which +// ensures the packages build correctly. +func TestPureGoTag(t *testing.T) { + cmd := exec.Command(testenv.GoToolPath(t), "list", "-e", "crypto/...", "math/big") + cmd.Env = append(cmd.Env, "GOOS=linux") + cmd.Stderr = os.Stderr + out, err := cmd.Output() + if err != nil { + log.Fatalf("loading package list: %v\n%s", err, out) + } + pkgs := strings.Split(strings.TrimSpace(string(out)), "\n") + + cmd = exec.Command(testenv.GoToolPath(t), "tool", "dist", "list") + cmd.Stderr = os.Stderr + out, err = cmd.Output() + if err != nil { + log.Fatalf("loading architecture list: %v\n%s", err, out) + } + allGOARCH := make(map[string]bool) + for _, pair := range strings.Split(strings.TrimSpace(string(out)), "\n") { + GOARCH := strings.Split(pair, "/")[1] + allGOARCH[GOARCH] = true + } + + for _, pkgName := range pkgs { + if strings.Contains(pkgName, "/boring") { + continue + } + + for GOARCH := range allGOARCH { + context := build.Context{ + GOOS: "linux", // darwin has custom assembly + GOARCH: GOARCH, + GOROOT: testenv.GOROOT(t), + Compiler: build.Default.Compiler, + BuildTags: []string{"purego", "math_big_pure_go"}, + } + + pkg, err := context.Import(pkgName, "", 0) + if err != nil { + t.Fatal(err) + } + if len(pkg.SFiles) == 0 { + continue + } + t.Errorf("package %s has purego assembly files on %s: %v", pkgName, GOARCH, pkg.SFiles) + } + } +} diff --git a/src/crypto/sha1/fallback_test.go b/src/crypto/sha1/fallback_test.go index aa1d413f2f063f..b869a939f601fb 100644 --- a/src/crypto/sha1/fallback_test.go +++ b/src/crypto/sha1/fallback_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build s390x +//go:build s390x && !purego package sha1 diff --git a/src/crypto/sha1/sha1block_386.s b/src/crypto/sha1/sha1block_386.s index 34d023d424c0ff..33d3f1e9973fd3 100644 --- a/src/crypto/sha1/sha1block_386.s +++ b/src/crypto/sha1/sha1block_386.s @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + #include "textflag.h" // SHA-1 block routine. See sha1block.go for Go equivalent. diff --git a/src/crypto/sha1/sha1block_amd64.go b/src/crypto/sha1/sha1block_amd64.go index 039813d7dc3fea..92fa7a6fbc0d14 100644 --- a/src/crypto/sha1/sha1block_amd64.go +++ b/src/crypto/sha1/sha1block_amd64.go @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + package sha1 import "internal/cpu" diff --git a/src/crypto/sha1/sha1block_amd64.s b/src/crypto/sha1/sha1block_amd64.s index 9bdf24cf49f24e..6508612d890099 100644 --- a/src/crypto/sha1/sha1block_amd64.s +++ b/src/crypto/sha1/sha1block_amd64.s @@ -10,6 +10,7 @@ // Ronen Zohar // Chandramouli Narayanan +//go:build !purego #include "textflag.h" diff --git a/src/crypto/sha1/sha1block_arm.s b/src/crypto/sha1/sha1block_arm.s index 2236533ab4d9ef..209b1d89ae349a 100644 --- a/src/crypto/sha1/sha1block_arm.s +++ b/src/crypto/sha1/sha1block_arm.s @@ -4,6 +4,8 @@ // // ARM version of md5block.go +//go:build !purego + #include "textflag.h" // SHA-1 block routine. See sha1block.go for Go equivalent. diff --git a/src/crypto/sha1/sha1block_arm64.go b/src/crypto/sha1/sha1block_arm64.go index 08d3df0000e686..e6d96a9080a8c5 100644 --- a/src/crypto/sha1/sha1block_arm64.go +++ b/src/crypto/sha1/sha1block_arm64.go @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + package sha1 import "internal/cpu" diff --git a/src/crypto/sha1/sha1block_arm64.s b/src/crypto/sha1/sha1block_arm64.s index d56838464ddba3..d0ff0986b8b5ab 100644 --- a/src/crypto/sha1/sha1block_arm64.s +++ b/src/crypto/sha1/sha1block_arm64.s @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + #include "textflag.h" #define HASHUPDATECHOOSE \ diff --git a/src/crypto/sha1/sha1block_decl.go b/src/crypto/sha1/sha1block_decl.go index 8e20401c14c406..3edf5a43606d41 100644 --- a/src/crypto/sha1/sha1block_decl.go +++ b/src/crypto/sha1/sha1block_decl.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build arm || 386 || s390x +//go:build (arm || 386 || s390x) && !purego package sha1 diff --git a/src/crypto/sha1/sha1block_generic.go b/src/crypto/sha1/sha1block_generic.go index ba35155d0b92ef..4c6f74d99d8f23 100644 --- a/src/crypto/sha1/sha1block_generic.go +++ b/src/crypto/sha1/sha1block_generic.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !amd64 && !386 && !arm && !s390x && !arm64 +//go:build (!amd64 && !386 && !arm && !s390x && !arm64) || purego package sha1 diff --git a/src/crypto/sha1/sha1block_s390x.go b/src/crypto/sha1/sha1block_s390x.go index 446bf5d36e5943..f8b0d8ba31007b 100644 --- a/src/crypto/sha1/sha1block_s390x.go +++ b/src/crypto/sha1/sha1block_s390x.go @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + package sha1 import "internal/cpu" diff --git a/src/crypto/sha1/sha1block_s390x.s b/src/crypto/sha1/sha1block_s390x.s index 0fb7aef28371fc..7a2f4e39c4013f 100644 --- a/src/crypto/sha1/sha1block_s390x.s +++ b/src/crypto/sha1/sha1block_s390x.s @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + #include "textflag.h" // func block(dig *digest, p []byte) diff --git a/src/crypto/sha256/fallback_test.go b/src/crypto/sha256/fallback_test.go index 3f561aadd65ee6..ceef3cc9222fcd 100644 --- a/src/crypto/sha256/fallback_test.go +++ b/src/crypto/sha256/fallback_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build s390x +//go:build s390x && !purego package sha256 diff --git a/src/crypto/sha256/sha256block_386.s b/src/crypto/sha256/sha256block_386.s index 086a0ab25c88c6..0e27fa02d7e708 100644 --- a/src/crypto/sha256/sha256block_386.s +++ b/src/crypto/sha256/sha256block_386.s @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + // SHA256 block routine. See sha256block.go for Go equivalent. // // The algorithm is detailed in FIPS 180-4: diff --git a/src/crypto/sha256/sha256block_amd64.go b/src/crypto/sha256/sha256block_amd64.go index b5d2c9b574a2a4..fdd75a3f3e7e04 100644 --- a/src/crypto/sha256/sha256block_amd64.go +++ b/src/crypto/sha256/sha256block_amd64.go @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + package sha256 import "internal/cpu" diff --git a/src/crypto/sha256/sha256block_amd64.s b/src/crypto/sha256/sha256block_amd64.s index bbde6285d1789e..2559f659a20077 100644 --- a/src/crypto/sha256/sha256block_amd64.s +++ b/src/crypto/sha256/sha256block_amd64.s @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + #include "textflag.h" // SHA256 block routine. See sha256block.go for Go equivalent. diff --git a/src/crypto/sha256/sha256block_arm64.go b/src/crypto/sha256/sha256block_arm64.go index e5da5663631556..434b6f253d41c9 100644 --- a/src/crypto/sha256/sha256block_arm64.go +++ b/src/crypto/sha256/sha256block_arm64.go @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + package sha256 import "internal/cpu" diff --git a/src/crypto/sha256/sha256block_arm64.s b/src/crypto/sha256/sha256block_arm64.s index d5c1eb0b2e15ac..6757310c34e34c 100644 --- a/src/crypto/sha256/sha256block_arm64.s +++ b/src/crypto/sha256/sha256block_arm64.s @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + #include "textflag.h" #define HASHUPDATE \ diff --git a/src/crypto/sha256/sha256block_decl.go b/src/crypto/sha256/sha256block_decl.go index 7d68cd95fe440f..85374cbdbb59bb 100644 --- a/src/crypto/sha256/sha256block_decl.go +++ b/src/crypto/sha256/sha256block_decl.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build 386 || amd64 || s390x || ppc64le || ppc64 +//go:build (386 || amd64 || s390x || ppc64le || ppc64) && !purego package sha256 diff --git a/src/crypto/sha256/sha256block_generic.go b/src/crypto/sha256/sha256block_generic.go index fd098bec894be5..2964255f99cc55 100644 --- a/src/crypto/sha256/sha256block_generic.go +++ b/src/crypto/sha256/sha256block_generic.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !amd64 && !386 && !s390x && !ppc64le && !ppc64 && !arm64 +//go:build (!amd64 && !386 && !s390x && !ppc64le && !ppc64 && !arm64) || purego package sha256 diff --git a/src/crypto/sha256/sha256block_ppc64x.s b/src/crypto/sha256/sha256block_ppc64x.s index b229ef619a35bc..ba8fa623c11f02 100644 --- a/src/crypto/sha256/sha256block_ppc64x.s +++ b/src/crypto/sha256/sha256block_ppc64x.s @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build ppc64 || ppc64le +//go:build (ppc64 || ppc64le) && !purego // Based on CRYPTOGAMS code with the following comment: // # ==================================================================== diff --git a/src/crypto/sha256/sha256block_s390x.go b/src/crypto/sha256/sha256block_s390x.go index 1a376c5f935318..0a1dc5785d2e44 100644 --- a/src/crypto/sha256/sha256block_s390x.go +++ b/src/crypto/sha256/sha256block_s390x.go @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + package sha256 import "internal/cpu" diff --git a/src/crypto/sha256/sha256block_s390x.s b/src/crypto/sha256/sha256block_s390x.s index 9c30136b31ef51..757d62f5125aa1 100644 --- a/src/crypto/sha256/sha256block_s390x.s +++ b/src/crypto/sha256/sha256block_s390x.s @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + #include "textflag.h" // func block(dig *digest, p []byte) diff --git a/src/crypto/sha512/fallback_test.go b/src/crypto/sha512/fallback_test.go index ac0c2c3c76f712..b55a4a56fa9d03 100644 --- a/src/crypto/sha512/fallback_test.go +++ b/src/crypto/sha512/fallback_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build s390x +//go:build s390x && !purego package sha512 diff --git a/src/crypto/sha512/sha512block_amd64.go b/src/crypto/sha512/sha512block_amd64.go index 8da3e1473f6c45..fd1baecb32d83a 100644 --- a/src/crypto/sha512/sha512block_amd64.go +++ b/src/crypto/sha512/sha512block_amd64.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build amd64 +//go:build !purego package sha512 diff --git a/src/crypto/sha512/sha512block_amd64.s b/src/crypto/sha512/sha512block_amd64.s index 0fa0df2f60e8b7..bd4e3e6669f886 100644 --- a/src/crypto/sha512/sha512block_amd64.s +++ b/src/crypto/sha512/sha512block_amd64.s @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + #include "textflag.h" // SHA512 block routine. See sha512block.go for Go equivalent. diff --git a/src/crypto/sha512/sha512block_arm64.go b/src/crypto/sha512/sha512block_arm64.go index 243eb5c1d63b6f..4e2793100a3199 100644 --- a/src/crypto/sha512/sha512block_arm64.go +++ b/src/crypto/sha512/sha512block_arm64.go @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + package sha512 import "internal/cpu" diff --git a/src/crypto/sha512/sha512block_arm64.s b/src/crypto/sha512/sha512block_arm64.s index dfc35d69c38802..25f3dbfe43d5e6 100644 --- a/src/crypto/sha512/sha512block_arm64.s +++ b/src/crypto/sha512/sha512block_arm64.s @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + // Based on the Linux Kernel with the following comment: // Algorithm based on https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fb87127bcefc17efab757606e1b1e333fd614dd0 // Originally written by Ard Biesheuvel diff --git a/src/crypto/sha512/sha512block_decl.go b/src/crypto/sha512/sha512block_decl.go index d5d03d0f3c0153..324659e62ca289 100644 --- a/src/crypto/sha512/sha512block_decl.go +++ b/src/crypto/sha512/sha512block_decl.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build ppc64le || ppc64 || riscv64 || s390x +//go:build (ppc64le || ppc64 || riscv64 || s390x) && !purego package sha512 diff --git a/src/crypto/sha512/sha512block_generic.go b/src/crypto/sha512/sha512block_generic.go index f11c0980bd60e9..9177722be12b00 100644 --- a/src/crypto/sha512/sha512block_generic.go +++ b/src/crypto/sha512/sha512block_generic.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !amd64 && !arm64 && !ppc64 && !ppc64le && !riscv64 && !s390x +//go:build (!amd64 && !arm64 && !ppc64 && !ppc64le && !riscv64 && !s390x) || purego package sha512 diff --git a/src/crypto/sha512/sha512block_ppc64x.s b/src/crypto/sha512/sha512block_ppc64x.s index 90dbf0f02b64bf..87aab80903c9b8 100644 --- a/src/crypto/sha512/sha512block_ppc64x.s +++ b/src/crypto/sha512/sha512block_ppc64x.s @@ -10,7 +10,7 @@ // # details see http://www.openssl.org/~appro/cryptogams/. // # ==================================================================== -//go:build ppc64 || ppc64le +//go:build (ppc64 || ppc64le) && !purego #include "textflag.h" diff --git a/src/crypto/sha512/sha512block_riscv64.s b/src/crypto/sha512/sha512block_riscv64.s index 361aafe49d75bb..6fbd524a31deec 100644 --- a/src/crypto/sha512/sha512block_riscv64.s +++ b/src/crypto/sha512/sha512block_riscv64.s @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + #include "textflag.h" // SHA512 block routine. See sha512block.go for Go equivalent. diff --git a/src/crypto/sha512/sha512block_s390x.go b/src/crypto/sha512/sha512block_s390x.go index 7df29fd29828c4..d0f09ea9edb072 100644 --- a/src/crypto/sha512/sha512block_s390x.go +++ b/src/crypto/sha512/sha512block_s390x.go @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + package sha512 import "internal/cpu" diff --git a/src/crypto/sha512/sha512block_s390x.s b/src/crypto/sha512/sha512block_s390x.s index 9fdf3439007ae0..230bd414d38bd0 100644 --- a/src/crypto/sha512/sha512block_s390x.s +++ b/src/crypto/sha512/sha512block_s390x.s @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !purego + #include "textflag.h" // func block(dig *digest, p []byte)