-
Notifications
You must be signed in to change notification settings - Fork 4
/
chacha20_poly1305.go
52 lines (37 loc) · 2.03 KB
/
chacha20_poly1305.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// This source code refers to The Go Authors for copyright purposes.
// The master list of authors is in the main Go distribution,
// visible at https://tip.golang.org/AUTHORS.
package unclassified
import (
_ "unsafe"
)
// Cipher is a stateful instance of ChaCha20 or XChaCha20 using a particular key
// and nonce. A *Cipher implements the cipher.Stream interface.
//go:linkname Cipher vendor/golang.org/x/crypto/chacha20.Cipher
type Cipher struct {}
//go:linkname (*Cipher).SetCounter vendor/golang.org/x/crypto/chacha20.(*Cipher).SetCounter
func (s *Cipher) SetCounter(counter uint32)
//go:linkname (*Cipher).XORKeyStream vendor/golang.org/x/crypto/chacha20.(*Cipher).XORKeyStream
func (s *Cipher) XORKeyStream(dst, src []byte)
//go:linkname chacha20_NewUnauthenticatedCipher vendor/golang.org/x/crypto/chacha20.NewUnauthenticatedCipher
func chacha20_NewUnauthenticatedCipher(key, nonce []byte) (*Cipher, error)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Splitter
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//go:linkname poly1305_TagSize vendor/golang.org/x/crypto/poly1305.TagSize
const poly1305_TagSize = 16
//go:linkname MAC vendor/golang.org/x/crypto/poly1305.MAC
type MAC struct {}
//go:linkname (*MAC).Write vendor/golang.org/x/crypto/poly1305.(*MAC).Write
func (h *MAC) Write(p []byte) (n int, err error)
//go:linkname (*MAC).Sum vendor/golang.org/x/crypto/poly1305.(*MAC).Sum
func (h *MAC) Sum(b []byte) []byte
//go:linkname (*MAC).Verify vendor/golang.org/x/crypto/poly1305.(*MAC).Verify
func (h *MAC) Verify(expected []byte) bool
//go:linkname poly1305_New vendor/golang.org/x/crypto/poly1305.New
func poly1305_New(key *[32]byte) *MAC
////go:linkname poly1305_Sum vendor/golang.org/x/crypto/poly1305.Sum
//func poly1305_Sum(out *[16]byte, m []byte, key *[32]byte)
//
////go:linkname poly1305_Verify vendor/golang.org/x/crypto/poly1305.Verify
//func poly1305_Verify(mac *[16]byte, m []byte, key *[32]byte) bool