Source file src/crypto/internal/fips/sha256/sha256block_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 sha256 8 9 import ( 10 "crypto/internal/impl" 11 "internal/cpu" 12 ) 13 14 var useSHA256 = cpu.S390X.HasSHA256 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/sha256", "CPACF", &useSHA256) 20 } 21 22 //go:noescape 23 func blockS390X(dig *Digest, p []byte) 24 25 func block(dig *Digest, p []byte) { 26 if useSHA256 { 27 blockS390X(dig, p) 28 } else { 29 blockGeneric(dig, p) 30 } 31 } 32