You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

chacha_s390x.go 740B

1234567891011121314151617181920212223242526
  1. // Copyright 2018 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. // +build !gccgo,!purego
  5. package chacha20
  6. import "golang.org/x/sys/cpu"
  7. var haveAsm = cpu.S390X.HasVX
  8. const bufSize = 256
  9. // xorKeyStreamVX is an assembly implementation of XORKeyStream. It must only
  10. // be called when the vector facility is available. Implementation in asm_s390x.s.
  11. //go:noescape
  12. func xorKeyStreamVX(dst, src []byte, key *[8]uint32, nonce *[3]uint32, counter *uint32)
  13. func (c *Cipher) xorKeyStreamBlocks(dst, src []byte) {
  14. if cpu.S390X.HasVX {
  15. xorKeyStreamVX(dst, src, &c.key, &c.nonce, &c.counter)
  16. } else {
  17. c.xorKeyStreamBlocksGeneric(dst, src)
  18. }
  19. }