diff --git a/shadowaead_2022/xor.go b/shadowaead_2022/xor.go index 3e09591..007742f 100644 --- a/shadowaead_2022/xor.go +++ b/shadowaead_2022/xor.go @@ -1,7 +1,7 @@ +//go:build go1.20 + package shadowaead_2022 -import _ "unsafe" +import "crypto/subtle" -//go:linkname xorWords crypto/cipher.xorWords -//go:noescape -func xorWords(dst, a, b []byte) +var xorWords = subtle.XORBytes diff --git a/shadowaead_2022/xor_go119.go b/shadowaead_2022/xor_go119.go new file mode 100644 index 0000000..35fb48c --- /dev/null +++ b/shadowaead_2022/xor_go119.go @@ -0,0 +1,9 @@ +//go:build !go1.20 + +package shadowaead_2022 + +import _ "unsafe" + +//go:linkname xorWords crypto/cipher.xorWords +//go:noescape +func xorWords(dst, a, b []byte)