Source file src/crypto/internal/fips/sha512/sha512block_s390x.go
1 // Copyright 2016 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 !purego 6 7 package sha512 8 9 import ( 10 "crypto/internal/impl" 11 "internal/cpu" 12 ) 13 14 var useSHA512 = cpu.S390X.HasSHA512 15 16 func init() { 17 // CP Assist for Cryptographic Functions (CPACF) 18 // https://www.ibm.com/docs/en/zos/3.1.0?topic=icsf-cp-assist-cryptographic-functions-cpacf 19 impl.Register("crypto/sha512", "CPACF", &useSHA512) 20 } 21 22 //go:noescape 23 func blockS390X(dig *Digest, p []byte) 24 25 func block(dig *Digest, p []byte) { 26 if useSHA512 { 27 blockS390X(dig, p) 28 } else { 29 blockGeneric(dig, p) 30 } 31 } 32