summaryrefslogtreecommitdiffstats
path: root/vendor/golang.org/x/crypto/salsa20
diff options
context:
space:
mode:
authorWim <wim@42.be>2023-01-28 22:57:53 +0100
committerGitHub <noreply@github.com>2023-01-28 22:57:53 +0100
commit880586bac42817ffcfea5d9f746f503fa29915b8 (patch)
treea89374cba6f88975f12316ec8d1b8aa1d4c6ba79 /vendor/golang.org/x/crypto/salsa20
parenteac2a8c8dc831f946970d327e2a80b26b0684255 (diff)
downloadmatterbridge-msglm-880586bac42817ffcfea5d9f746f503fa29915b8.tar.gz
matterbridge-msglm-880586bac42817ffcfea5d9f746f503fa29915b8.tar.bz2
matterbridge-msglm-880586bac42817ffcfea5d9f746f503fa29915b8.zip
Update dependencies (#1951)
Diffstat (limited to 'vendor/golang.org/x/crypto/salsa20')
-rw-r--r--vendor/golang.org/x/crypto/salsa20/salsa/hsalsa20.go66
-rw-r--r--vendor/golang.org/x/crypto/salsa20/salsa/salsa208.go66
-rw-r--r--vendor/golang.org/x/crypto/salsa20/salsa/salsa20_ref.go66
3 files changed, 102 insertions, 96 deletions
diff --git a/vendor/golang.org/x/crypto/salsa20/salsa/hsalsa20.go b/vendor/golang.org/x/crypto/salsa20/salsa/hsalsa20.go
index 4c96147c..3fd05b27 100644
--- a/vendor/golang.org/x/crypto/salsa20/salsa/hsalsa20.go
+++ b/vendor/golang.org/x/crypto/salsa20/salsa/hsalsa20.go
@@ -5,6 +5,8 @@
// Package salsa provides low-level access to functions in the Salsa family.
package salsa // import "golang.org/x/crypto/salsa20/salsa"
+import "math/bits"
+
// Sigma is the Salsa20 constant for 256-bit keys.
var Sigma = [16]byte{'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'}
@@ -31,76 +33,76 @@ func HSalsa20(out *[32]byte, in *[16]byte, k *[32]byte, c *[16]byte) {
for i := 0; i < 20; i += 2 {
u := x0 + x12
- x4 ^= u<<7 | u>>(32-7)
+ x4 ^= bits.RotateLeft32(u, 7)
u = x4 + x0
- x8 ^= u<<9 | u>>(32-9)
+ x8 ^= bits.RotateLeft32(u, 9)
u = x8 + x4
- x12 ^= u<<13 | u>>(32-13)
+ x12 ^= bits.RotateLeft32(u, 13)
u = x12 + x8
- x0 ^= u<<18 | u>>(32-18)
+ x0 ^= bits.RotateLeft32(u, 18)
u = x5 + x1
- x9 ^= u<<7 | u>>(32-7)
+ x9 ^= bits.RotateLeft32(u, 7)
u = x9 + x5
- x13 ^= u<<9 | u>>(32-9)
+ x13 ^= bits.RotateLeft32(u, 9)
u = x13 + x9
- x1 ^= u<<13 | u>>(32-13)
+ x1 ^= bits.RotateLeft32(u, 13)
u = x1 + x13
- x5 ^= u<<18 | u>>(32-18)
+ x5 ^= bits.RotateLeft32(u, 18)
u = x10 + x6
- x14 ^= u<<7 | u>>(32-7)
+ x14 ^= bits.RotateLeft32(u, 7)
u = x14 + x10
- x2 ^= u<<9 | u>>(32-9)
+ x2 ^= bits.RotateLeft32(u, 9)
u = x2 + x14
- x6 ^= u<<13 | u>>(32-13)
+ x6 ^= bits.RotateLeft32(u, 13)
u = x6 + x2
- x10 ^= u<<18 | u>>(32-18)
+ x10 ^= bits.RotateLeft32(u, 18)
u = x15 + x11
- x3 ^= u<<7 | u>>(32-7)
+ x3 ^= bits.RotateLeft32(u, 7)
u = x3 + x15
- x7 ^= u<<9 | u>>(32-9)
+ x7 ^= bits.RotateLeft32(u, 9)
u = x7 + x3
- x11 ^= u<<13 | u>>(32-13)
+ x11 ^= bits.RotateLeft32(u, 13)
u = x11 + x7
- x15 ^= u<<18 | u>>(32-18)
+ x15 ^= bits.RotateLeft32(u, 18)
u = x0 + x3
- x1 ^= u<<7 | u>>(32-7)
+ x1 ^= bits.RotateLeft32(u, 7)
u = x1 + x0
- x2 ^= u<<9 | u>>(32-9)
+ x2 ^= bits.RotateLeft32(u, 9)
u = x2 + x1
- x3 ^= u<<13 | u>>(32-13)
+ x3 ^= bits.RotateLeft32(u, 13)
u = x3 + x2
- x0 ^= u<<18 | u>>(32-18)
+ x0 ^= bits.RotateLeft32(u, 18)
u = x5 + x4
- x6 ^= u<<7 | u>>(32-7)
+ x6 ^= bits.RotateLeft32(u, 7)
u = x6 + x5
- x7 ^= u<<9 | u>>(32-9)
+ x7 ^= bits.RotateLeft32(u, 9)
u = x7 + x6
- x4 ^= u<<13 | u>>(32-13)
+ x4 ^= bits.RotateLeft32(u, 13)
u = x4 + x7
- x5 ^= u<<18 | u>>(32-18)
+ x5 ^= bits.RotateLeft32(u, 18)
u = x10 + x9
- x11 ^= u<<7 | u>>(32-7)
+ x11 ^= bits.RotateLeft32(u, 7)
u = x11 + x10
- x8 ^= u<<9 | u>>(32-9)
+ x8 ^= bits.RotateLeft32(u, 9)
u = x8 + x11
- x9 ^= u<<13 | u>>(32-13)
+ x9 ^= bits.RotateLeft32(u, 13)
u = x9 + x8
- x10 ^= u<<18 | u>>(32-18)
+ x10 ^= bits.RotateLeft32(u, 18)
u = x15 + x14
- x12 ^= u<<7 | u>>(32-7)
+ x12 ^= bits.RotateLeft32(u, 7)
u = x12 + x15
- x13 ^= u<<9 | u>>(32-9)
+ x13 ^= bits.RotateLeft32(u, 9)
u = x13 + x12
- x14 ^= u<<13 | u>>(32-13)
+ x14 ^= bits.RotateLeft32(u, 13)
u = x14 + x13
- x15 ^= u<<18 | u>>(32-18)
+ x15 ^= bits.RotateLeft32(u, 18)
}
out[0] = byte(x0)
out[1] = byte(x0 >> 8)
diff --git a/vendor/golang.org/x/crypto/salsa20/salsa/salsa208.go b/vendor/golang.org/x/crypto/salsa20/salsa/salsa208.go
index 9bfc0927..7ec7bb39 100644
--- a/vendor/golang.org/x/crypto/salsa20/salsa/salsa208.go
+++ b/vendor/golang.org/x/crypto/salsa20/salsa/salsa208.go
@@ -4,6 +4,8 @@
package salsa
+import "math/bits"
+
// Core208 applies the Salsa20/8 core function to the 64-byte array in and puts
// the result into the 64-byte array out. The input and output may be the same array.
func Core208(out *[64]byte, in *[64]byte) {
@@ -29,76 +31,76 @@ func Core208(out *[64]byte, in *[64]byte) {
for i := 0; i < 8; i += 2 {
u := x0 + x12
- x4 ^= u<<7 | u>>(32-7)
+ x4 ^= bits.RotateLeft32(u, 7)
u = x4 + x0
- x8 ^= u<<9 | u>>(32-9)
+ x8 ^= bits.RotateLeft32(u, 9)
u = x8 + x4
- x12 ^= u<<13 | u>>(32-13)
+ x12 ^= bits.RotateLeft32(u, 13)
u = x12 + x8
- x0 ^= u<<18 | u>>(32-18)
+ x0 ^= bits.RotateLeft32(u, 18)
u = x5 + x1
- x9 ^= u<<7 | u>>(32-7)
+ x9 ^= bits.RotateLeft32(u, 7)
u = x9 + x5
- x13 ^= u<<9 | u>>(32-9)
+ x13 ^= bits.RotateLeft32(u, 9)
u = x13 + x9
- x1 ^= u<<13 | u>>(32-13)
+ x1 ^= bits.RotateLeft32(u, 13)
u = x1 + x13
- x5 ^= u<<18 | u>>(32-18)
+ x5 ^= bits.RotateLeft32(u, 18)
u = x10 + x6
- x14 ^= u<<7 | u>>(32-7)
+ x14 ^= bits.RotateLeft32(u, 7)
u = x14 + x10
- x2 ^= u<<9 | u>>(32-9)
+ x2 ^= bits.RotateLeft32(u, 9)
u = x2 + x14
- x6 ^= u<<13 | u>>(32-13)
+ x6 ^= bits.RotateLeft32(u, 13)
u = x6 + x2
- x10 ^= u<<18 | u>>(32-18)
+ x10 ^= bits.RotateLeft32(u, 18)
u = x15 + x11
- x3 ^= u<<7 | u>>(32-7)
+ x3 ^= bits.RotateLeft32(u, 7)
u = x3 + x15
- x7 ^= u<<9 | u>>(32-9)
+ x7 ^= bits.RotateLeft32(u, 9)
u = x7 + x3
- x11 ^= u<<13 | u>>(32-13)
+ x11 ^= bits.RotateLeft32(u, 13)
u = x11 + x7
- x15 ^= u<<18 | u>>(32-18)
+ x15 ^= bits.RotateLeft32(u, 18)
u = x0 + x3
- x1 ^= u<<7 | u>>(32-7)
+ x1 ^= bits.RotateLeft32(u, 7)
u = x1 + x0
- x2 ^= u<<9 | u>>(32-9)
+ x2 ^= bits.RotateLeft32(u, 9)
u = x2 + x1
- x3 ^= u<<13 | u>>(32-13)
+ x3 ^= bits.RotateLeft32(u, 13)
u = x3 + x2
- x0 ^= u<<18 | u>>(32-18)
+ x0 ^= bits.RotateLeft32(u, 18)
u = x5 + x4
- x6 ^= u<<7 | u>>(32-7)
+ x6 ^= bits.RotateLeft32(u, 7)
u = x6 + x5
- x7 ^= u<<9 | u>>(32-9)
+ x7 ^= bits.RotateLeft32(u, 9)
u = x7 + x6
- x4 ^= u<<13 | u>>(32-13)
+ x4 ^= bits.RotateLeft32(u, 13)
u = x4 + x7
- x5 ^= u<<18 | u>>(32-18)
+ x5 ^= bits.RotateLeft32(u, 18)
u = x10 + x9
- x11 ^= u<<7 | u>>(32-7)
+ x11 ^= bits.RotateLeft32(u, 7)
u = x11 + x10
- x8 ^= u<<9 | u>>(32-9)
+ x8 ^= bits.RotateLeft32(u, 9)
u = x8 + x11
- x9 ^= u<<13 | u>>(32-13)
+ x9 ^= bits.RotateLeft32(u, 13)
u = x9 + x8
- x10 ^= u<<18 | u>>(32-18)
+ x10 ^= bits.RotateLeft32(u, 18)
u = x15 + x14
- x12 ^= u<<7 | u>>(32-7)
+ x12 ^= bits.RotateLeft32(u, 7)
u = x12 + x15
- x13 ^= u<<9 | u>>(32-9)
+ x13 ^= bits.RotateLeft32(u, 9)
u = x13 + x12
- x14 ^= u<<13 | u>>(32-13)
+ x14 ^= bits.RotateLeft32(u, 13)
u = x14 + x13
- x15 ^= u<<18 | u>>(32-18)
+ x15 ^= bits.RotateLeft32(u, 18)
}
x0 += j0
x1 += j1
diff --git a/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_ref.go b/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_ref.go
index 68169c6d..e5cdb9a2 100644
--- a/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_ref.go
+++ b/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_ref.go
@@ -4,6 +4,8 @@
package salsa
+import "math/bits"
+
const rounds = 20
// core applies the Salsa20 core function to 16-byte input in, 32-byte key k,
@@ -31,76 +33,76 @@ func core(out *[64]byte, in *[16]byte, k *[32]byte, c *[16]byte) {
for i := 0; i < rounds; i += 2 {
u := x0 + x12
- x4 ^= u<<7 | u>>(32-7)
+ x4 ^= bits.RotateLeft32(u, 7)
u = x4 + x0
- x8 ^= u<<9 | u>>(32-9)
+ x8 ^= bits.RotateLeft32(u, 9)
u = x8 + x4
- x12 ^= u<<13 | u>>(32-13)
+ x12 ^= bits.RotateLeft32(u, 13)
u = x12 + x8
- x0 ^= u<<18 | u>>(32-18)
+ x0 ^= bits.RotateLeft32(u, 18)
u = x5 + x1
- x9 ^= u<<7 | u>>(32-7)
+ x9 ^= bits.RotateLeft32(u, 7)
u = x9 + x5
- x13 ^= u<<9 | u>>(32-9)
+ x13 ^= bits.RotateLeft32(u, 9)
u = x13 + x9
- x1 ^= u<<13 | u>>(32-13)
+ x1 ^= bits.RotateLeft32(u, 13)
u = x1 + x13
- x5 ^= u<<18 | u>>(32-18)
+ x5 ^= bits.RotateLeft32(u, 18)
u = x10 + x6
- x14 ^= u<<7 | u>>(32-7)
+ x14 ^= bits.RotateLeft32(u, 7)
u = x14 + x10
- x2 ^= u<<9 | u>>(32-9)
+ x2 ^= bits.RotateLeft32(u, 9)
u = x2 + x14
- x6 ^= u<<13 | u>>(32-13)
+ x6 ^= bits.RotateLeft32(u, 13)
u = x6 + x2
- x10 ^= u<<18 | u>>(32-18)
+ x10 ^= bits.RotateLeft32(u, 18)
u = x15 + x11
- x3 ^= u<<7 | u>>(32-7)
+ x3 ^= bits.RotateLeft32(u, 7)
u = x3 + x15
- x7 ^= u<<9 | u>>(32-9)
+ x7 ^= bits.RotateLeft32(u, 9)
u = x7 + x3
- x11 ^= u<<13 | u>>(32-13)
+ x11 ^= bits.RotateLeft32(u, 13)
u = x11 + x7
- x15 ^= u<<18 | u>>(32-18)
+ x15 ^= bits.RotateLeft32(u, 18)
u = x0 + x3
- x1 ^= u<<7 | u>>(32-7)
+ x1 ^= bits.RotateLeft32(u, 7)
u = x1 + x0
- x2 ^= u<<9 | u>>(32-9)
+ x2 ^= bits.RotateLeft32(u, 9)
u = x2 + x1
- x3 ^= u<<13 | u>>(32-13)
+ x3 ^= bits.RotateLeft32(u, 13)
u = x3 + x2
- x0 ^= u<<18 | u>>(32-18)
+ x0 ^= bits.RotateLeft32(u, 18)
u = x5 + x4
- x6 ^= u<<7 | u>>(32-7)
+ x6 ^= bits.RotateLeft32(u, 7)
u = x6 + x5
- x7 ^= u<<9 | u>>(32-9)
+ x7 ^= bits.RotateLeft32(u, 9)
u = x7 + x6
- x4 ^= u<<13 | u>>(32-13)
+ x4 ^= bits.RotateLeft32(u, 13)
u = x4 + x7
- x5 ^= u<<18 | u>>(32-18)
+ x5 ^= bits.RotateLeft32(u, 18)
u = x10 + x9
- x11 ^= u<<7 | u>>(32-7)
+ x11 ^= bits.RotateLeft32(u, 7)
u = x11 + x10
- x8 ^= u<<9 | u>>(32-9)
+ x8 ^= bits.RotateLeft32(u, 9)
u = x8 + x11
- x9 ^= u<<13 | u>>(32-13)
+ x9 ^= bits.RotateLeft32(u, 13)
u = x9 + x8
- x10 ^= u<<18 | u>>(32-18)
+ x10 ^= bits.RotateLeft32(u, 18)
u = x15 + x14
- x12 ^= u<<7 | u>>(32-7)
+ x12 ^= bits.RotateLeft32(u, 7)
u = x12 + x15
- x13 ^= u<<9 | u>>(32-9)
+ x13 ^= bits.RotateLeft32(u, 9)
u = x13 + x12
- x14 ^= u<<13 | u>>(32-13)
+ x14 ^= bits.RotateLeft32(u, 13)
u = x14 + x13
- x15 ^= u<<18 | u>>(32-18)
+ x15 ^= bits.RotateLeft32(u, 18)
}
x0 += j0
x1 += j1