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