...
Source file src/pkg/vendor/golang.org/x/crypto/internal/chacha20/chacha_arm64.go
1
2
3
4
5
6
7
8 package chacha20
9
10 const (
11 haveAsm = true
12 bufSize = 256
13 )
14
15
16 func xorKeyStreamVX(dst, src []byte, key *[8]uint32, nonce *[3]uint32, counter *uint32)
17
18 func (c *Cipher) xorKeyStreamAsm(dst, src []byte) {
19
20 if len(src) >= bufSize {
21 xorKeyStreamVX(dst, src, &c.key, &c.nonce, &c.counter)
22 }
23
24 if len(src)%bufSize != 0 {
25 i := len(src) - len(src)%bufSize
26 c.buf = [bufSize]byte{}
27 copy(c.buf[:], src[i:])
28 xorKeyStreamVX(c.buf[:], c.buf[:], &c.key, &c.nonce, &c.counter)
29 c.len = bufSize - copy(dst[i:], c.buf[:len(src)%bufSize])
30 }
31 }
32
View as plain text