From a8fe3a59b013dddbb8d4ed46cf995bb7205a1fd9 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Wed, 8 Apr 2020 16:30:19 +0300 Subject: [PATCH] tests: fix sha1 test by fixing << | expressions with explicit parenthesis for now. --- cmd/tools/vtest-fixed.v | 1 - vlib/crypto/sha1/sha1block_generic.v | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/cmd/tools/vtest-fixed.v b/cmd/tools/vtest-fixed.v index 0cb35d3110..984d874165 100644 --- a/cmd/tools/vtest-fixed.v +++ b/cmd/tools/vtest-fixed.v @@ -14,7 +14,6 @@ const ( 'vlib/crypto/aes/aes_test.v', 'vlib/crypto/rand/rand_test.v', 'vlib/crypto/rc4/rc4_test.v', - 'vlib/crypto/sha1/sha1_test.v', 'vlib/crypto/sha256/sha256_test.v', 'vlib/crypto/sha512/sha512_test.v', 'vlib/encoding/base64/base64_memory_test.v', diff --git a/vlib/crypto/sha1/sha1block_generic.v b/vlib/crypto/sha1/sha1block_generic.v index 02b7e06fdb..8258f98a68 100644 --- a/vlib/crypto/sha1/sha1block_generic.v +++ b/vlib/crypto/sha1/sha1block_generic.v @@ -55,7 +55,7 @@ fn block_generic(dig mut Digest, p_ []byte) { } for i < 20 { tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf] - w[i&0xf] = tmp<<1 | (tmp>>(32-1)) + w[i&0xf] = (tmp<<1) | (tmp>>(32-1)) f := b&c | (~b)&d t := bits.rotate_left_32(a, 5) + f + e + w[i&0xf] + u32(_k0) e = d @@ -67,7 +67,7 @@ fn block_generic(dig mut Digest, p_ []byte) { } for i < 40 { tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf] - w[i&0xf] = tmp<<1 | (tmp>>(32-1)) + w[i&0xf] = (tmp<<1) | (tmp>>(32-1)) f := b ^ c ^ d t := bits.rotate_left_32(a, 5) + f + e + w[i&0xf] + u32(_k1) e = d @@ -79,7 +79,7 @@ fn block_generic(dig mut Digest, p_ []byte) { } for i < 60 { tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf] - w[i&0xf] = tmp<<1 | (tmp>>(32-1)) + w[i&0xf] = (tmp<<1) | (tmp>>(32-1)) f := ((b | c) & d) | (b & c) t := bits.rotate_left_32(a, 5) + f + e + w[i&0xf] + u32(_k2) e = d @@ -91,7 +91,7 @@ fn block_generic(dig mut Digest, p_ []byte) { } for i < 80 { tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf] - w[i&0xf] = tmp<<1 | (tmp>>(32-1)) + w[i&0xf] = (tmp<<1) | (tmp>>(32-1)) f := b ^ c ^ d t := bits.rotate_left_32(a, 5) + f + e + w[i&0xf] + u32(_k3) e = d