github.com/qv2ray/smaead@v0.0.0-20211021072225-a01f7e01d185/util.go (about) 1 package smaead 2 3 import _ "unsafe" 4 5 type PartialAEAD interface { 6 OpenWithoutCheck(dst, nonce, ciphertext []byte) []byte 7 } 8 9 //go:linkname inexactOverlap crypto/internal/subtle.InexactOverlap 10 //goland:noinspection GoUnusedParameter 11 func inexactOverlap(x, y []byte) bool 12 13 //go:linkname xorBytes crypto/cipher.xorBytes 14 //goland:noinspection GoUnusedParameter 15 func xorBytes(dst, a, b []byte) int 16 17 //go:linkname xorWords crypto/cipher.xorWords 18 //goland:noinspection GoUnusedParameter 19 func xorWords(dst, a, b []byte) 20 21 //go:linkname sliceForAppend crypto/cipher.sliceForAppend 22 //goland:noinspection GoUnusedParameter 23 func sliceForAppend(in []byte, n int) (head, tail []byte) 24 25 //go:linkname reverseBits crypto/cipher.reverseBits 26 //goland:noinspection GoUnusedParameter 27 func reverseBits(i int) int 28 29 type gcmFieldElement struct { 30 low, high uint64 31 } 32 33 //go:linkname gcmAdd crypto/cipher.gcmAdd 34 //goland:noinspection GoUnusedParameter 35 func gcmAdd(x, y *gcmFieldElement) gcmFieldElement 36 37 //go:linkname gcmDouble crypto/cipher.gcmDouble 38 //goland:noinspection GoUnusedParameter 39 func gcmDouble(x *gcmFieldElement) (double gcmFieldElement) 40 41 //go:linkname gcmInc32 crypto/cipher.gcmInc32 42 //goland:noinspection GoUnusedParameter 43 func gcmInc32(counterBlock *[16]byte)