1
2
3
4
5
6
7 package subtle
8
9 import (
10 "crypto/internal/fips140deps/cpu"
11 "crypto/internal/impl"
12 )
13
14 var useLSX = cpu.LOONG64HasLSX
15 var useLASX = cpu.LOONG64HasLASX
16
17 func init() {
18 impl.Register("subtle", "LSX", &useLSX)
19 impl.Register("subtle", "LASX", &useLASX)
20 }
21
22
23 func xorBytesBasic(dst, a, b *byte, n int)
24
25
26 func xorBytesLSX(dst, a, b *byte, n int)
27
28
29 func xorBytesLASX(dst, a, b *byte, n int)
30
31 func xorBytes(dst, a, b *byte, n int) {
32 if useLASX {
33 xorBytesLASX(dst, a, b, n)
34 } else if useLSX {
35 xorBytesLSX(dst, a, b, n)
36 } else {
37 xorBytesBasic(dst, a, b, n)
38 }
39 }
40
View as plain text