]> Cypherpunks.ru repositories - govpn.git/blob - internal/chacha20/chacha_s390x.go
Preparing move to modules
[govpn.git] / internal / chacha20 / chacha_s390x.go
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 s390x,!gccgo,!appengine
6
7 package chacha20
8
9 import (
10         "golang.org/x/sys/cpu"
11 )
12
13 var haveAsm = cpu.S390X.HasVX
14
15 const bufSize = 256
16
17 // xorKeyStreamVX is an assembly implementation of XORKeyStream. It must only
18 // be called when the vector facility is available.
19 // Implementation in asm_s390x.s.
20 //go:noescape
21 func xorKeyStreamVX(dst, src []byte, key *[8]uint32, nonce *[3]uint32, counter *uint32, buf *[256]byte, len *int)
22
23 func (c *Cipher) xorKeyStreamAsm(dst, src []byte) {
24         xorKeyStreamVX(dst, src, &c.key, &c.nonce, &c.counter, &c.buf, &c.len)
25 }
26
27 // EXRL targets, DO NOT CALL!
28 func mvcSrcToBuf()
29 func mvcBufToDst()