Source file src/crypto/internal/fips140/sha512/sha512block_ppc64x.go
1 // Copyright 2024 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 //go:build (ppc64 || ppc64le) && !purego 6 7 package sha512 8 9 import ( 10 "crypto/internal/fips140deps/godebug" 11 "crypto/internal/impl" 12 ) 13 14 // The POWER architecture doesn't have a way to turn off SHA-512 support at 15 // runtime with GODEBUG=cpu.something=off, so introduce a new GODEBUG knob for 16 // that. It's intentionally only checked at init() time, to avoid the 17 // performance overhead of checking it on every block. 18 var ppc64sha512 = godebug.Value("#ppc64sha512") != "off" 19 20 func init() { 21 impl.Register("sha512", "POWER8", &ppc64sha512) 22 } 23 24 //go:noescape 25 func blockPOWER(dig *Digest, p []byte) 26 27 func block(dig *Digest, p []byte) { 28 if ppc64sha512 { 29 blockPOWER(dig, p) 30 } else { 31 blockGeneric(dig, p) 32 } 33 } 34