Source file src/crypto/internal/fips140/sha512/sha512block_riscv64.go

     1  // Copyright 2026 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/fips140deps/cpu"
    11  	"crypto/internal/impl"
    12  )
    13  
    14  var supportsZvknhb = cpu.RISCV64HasZvknhb && cpu.RISCV64HasZvbb && cpu.RISCV64VLENB >= 32
    15  
    16  func init() {
    17  	impl.Register("sha512", "Zvknhb", &supportsZvknhb)
    18  }
    19  
    20  //go:noescape
    21  func blockZvknhb(dig *Digest, p []byte)
    22  
    23  //go:noescape
    24  func blockScalar(dig *Digest, p []byte)
    25  
    26  func block(dig *Digest, p []byte) {
    27  	if supportsZvknhb {
    28  		blockZvknhb(dig, p)
    29  	} else {
    30  		blockScalar(dig, p)
    31  	}
    32  }
    33  

View as plain text