sha1block_arm64.mx raw

   1  // Copyright 2017 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 sha1
   8  
   9  import (
  10  	"crypto/internal/impl"
  11  	"internal/cpu"
  12  )
  13  
  14  var useSHA1 = cpu.ARM64.HasSHA1
  15  
  16  func init() {
  17  	impl.Register("sha1", "Armv8.0", &useSHA1)
  18  }
  19  
  20  var k = []uint32{
  21  	0x5A827999,
  22  	0x6ED9EBA1,
  23  	0x8F1BBCDC,
  24  	0xCA62C1D6,
  25  }
  26  
  27  //go:noescape
  28  func sha1block(h []uint32, p []byte, k []uint32)
  29  
  30  func block(dig *digest, p []byte) {
  31  	if useSHA1 {
  32  		h := dig.h[:]
  33  		sha1block(h, p, k)
  34  	} else {
  35  		blockGeneric(dig, p)
  36  	}
  37  }
  38