diff options
author | Jelle Raaijmakers <jelle@gmta.nl> | 2023-03-24 01:42:30 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-03-24 15:28:10 +0000 |
commit | 88b0b80aab65493b1b547879dd145c8f457576e0 (patch) | |
tree | b296332286be0d195ac1f31eb054133e4a9e9de5 | |
parent | c048cf2004c9cda9ed6533b81b586600b740c14b (diff) | |
download | serenity-88b0b80aab65493b1b547879dd145c8f457576e0.zip |
LibCrypto: Stop shadowing `i` variable
-rw-r--r-- | Userland/Libraries/LibCrypto/Hash/SHA1.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibCrypto/Hash/SHA2.cpp | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/Userland/Libraries/LibCrypto/Hash/SHA1.cpp b/Userland/Libraries/LibCrypto/Hash/SHA1.cpp index 56022efb7a..d99f23b783 100644 --- a/Userland/Libraries/LibCrypto/Hash/SHA1.cpp +++ b/Userland/Libraries/LibCrypto/Hash/SHA1.cpp @@ -132,7 +132,7 @@ SHA1::DigestType SHA1::peek() transform(m_data_buffer); - for (size_t i = 0; i < 4; ++i) { + for (i = 0; i < 4; ++i) { digest.data[i + 0] = (m_state[0] >> (24 - i * 8)) & 0x000000ff; digest.data[i + 4] = (m_state[1] >> (24 - i * 8)) & 0x000000ff; digest.data[i + 8] = (m_state[2] >> (24 - i * 8)) & 0x000000ff; diff --git a/Userland/Libraries/LibCrypto/Hash/SHA2.cpp b/Userland/Libraries/LibCrypto/Hash/SHA2.cpp index fda788fbf8..106eefdf37 100644 --- a/Userland/Libraries/LibCrypto/Hash/SHA2.cpp +++ b/Userland/Libraries/LibCrypto/Hash/SHA2.cpp @@ -42,7 +42,7 @@ inline void SHA256::transform(u8 const* data) e = m_state[4], f = m_state[5], g = m_state[6], h = m_state[7]; - for (size_t i = 0; i < Rounds; ++i) { + for (i = 0; i < Rounds; ++i) { auto temp0 = h + EP1(e) + CH(e, f, g) + SHA256Constants::RoundConstants[i] + m[i]; auto temp1 = EP0(a) + MAJ(a, b, c); h = g; @@ -128,7 +128,7 @@ SHA256::DigestType SHA256::peek() // SHA uses big-endian and we assume little-endian // FIXME: looks like a thing for AK::NetworkOrdered, // but that doesn't support shifting operations - for (size_t i = 0; i < 4; ++i) { + for (i = 0; i < 4; ++i) { digest.data[i + 0] = (m_state[0] >> (24 - i * 8)) & 0x000000ff; digest.data[i + 4] = (m_state[1] >> (24 - i * 8)) & 0x000000ff; digest.data[i + 8] = (m_state[2] >> (24 - i * 8)) & 0x000000ff; @@ -159,7 +159,7 @@ inline void SHA384::transform(u8 const* data) e = m_state[4], f = m_state[5], g = m_state[6], h = m_state[7]; - for (size_t i = 0; i < Rounds; ++i) { + for (i = 0; i < Rounds; ++i) { // Note : SHA384 uses the SHA512 constants. auto temp0 = h + EP1(e) + CH(e, f, g) + SHA512Constants::RoundConstants[i] + m[i]; auto temp1 = EP0(a) + MAJ(a, b, c); @@ -255,7 +255,7 @@ SHA384::DigestType SHA384::peek() // SHA uses big-endian and we assume little-endian // FIXME: looks like a thing for AK::NetworkOrdered, // but that doesn't support shifting operations - for (size_t i = 0; i < 8; ++i) { + for (i = 0; i < 8; ++i) { digest.data[i + 0] = (m_state[0] >> (56 - i * 8)) & 0x000000ff; digest.data[i + 8] = (m_state[1] >> (56 - i * 8)) & 0x000000ff; digest.data[i + 16] = (m_state[2] >> (56 - i * 8)) & 0x000000ff; @@ -284,7 +284,7 @@ inline void SHA512::transform(u8 const* data) e = m_state[4], f = m_state[5], g = m_state[6], h = m_state[7]; - for (size_t i = 0; i < Rounds; ++i) { + for (i = 0; i < Rounds; ++i) { auto temp0 = h + EP1(e) + CH(e, f, g) + SHA512Constants::RoundConstants[i] + m[i]; auto temp1 = EP0(a) + MAJ(a, b, c); h = g; @@ -379,7 +379,7 @@ SHA512::DigestType SHA512::peek() // SHA uses big-endian and we assume little-endian // FIXME: looks like a thing for AK::NetworkOrdered, // but that doesn't support shifting operations - for (size_t i = 0; i < 8; ++i) { + for (i = 0; i < 8; ++i) { digest.data[i + 0] = (m_state[0] >> (56 - i * 8)) & 0x000000ff; digest.data[i + 8] = (m_state[1] >> (56 - i * 8)) & 0x000000ff; digest.data[i + 16] = (m_state[2] >> (56 - i * 8)) & 0x000000ff; |