aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/block
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/block')
-rw-r--r--src/lib/block/aes/aes.cpp2
-rw-r--r--src/lib/block/kasumi/kasumi.cpp2
-rw-r--r--src/lib/block/misty1/misty1.cpp2
-rw-r--r--src/lib/block/seed/seed.cpp4
4 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/block/aes/aes.cpp b/src/lib/block/aes/aes.cpp
index a632c01ac..71a8c6a44 100644
--- a/src/lib/block/aes/aes.cpp
+++ b/src/lib/block/aes/aes.cpp
@@ -94,7 +94,7 @@ const uint8_t SD[256] = {
0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26, 0xE1, 0x69, 0x14, 0x63,
0x55, 0x21, 0x0C, 0x7D };
-inline uint8_t xtime(uint8_t s) { return (s << 1) ^ ((s >> 7) * 0x1B); }
+inline uint8_t xtime(uint8_t s) { return static_cast<uint8_t>(s << 1) ^ ((s >> 7) * 0x1B); }
inline uint8_t xtime4(uint8_t s) { return xtime(xtime(s)); }
inline uint8_t xtime8(uint8_t s) { return xtime(xtime(xtime(s))); }
diff --git a/src/lib/block/kasumi/kasumi.cpp b/src/lib/block/kasumi/kasumi.cpp
index 92ad5dd14..ed2524e0b 100644
--- a/src/lib/block/kasumi/kasumi.cpp
+++ b/src/lib/block/kasumi/kasumi.cpp
@@ -100,7 +100,7 @@ uint16_t FI(uint16_t I, uint16_t K)
D7 ^= (K >> 9);
D9 = KASUMI_SBOX_S9[D9 ^ (K & 0x1FF)] ^ D7;
D7 = KASUMI_SBOX_S7[D7] ^ (D9 & 0x7F);
- return (D7 << 9) | D9;
+ return static_cast<uint16_t>(D7 << 9) | D9;
}
}
diff --git a/src/lib/block/misty1/misty1.cpp b/src/lib/block/misty1/misty1.cpp
index d6ac5f9a9..eaef86c8c 100644
--- a/src/lib/block/misty1/misty1.cpp
+++ b/src/lib/block/misty1/misty1.cpp
@@ -93,7 +93,7 @@ uint16_t FI(uint16_t input, uint16_t key7, uint16_t key9)
D9 = MISTY1_SBOX_S9[D9] ^ D7;
D7 = (MISTY1_SBOX_S7[D7] ^ key7 ^ D9) & 0x7F;
D9 = MISTY1_SBOX_S9[D9 ^ key9] ^ D7;
- return static_cast<uint16_t>((D7 << 9) | D9);
+ return static_cast<uint16_t>(D7 << 9) | D9;
}
}
diff --git a/src/lib/block/seed/seed.cpp b/src/lib/block/seed/seed.cpp
index 0df35383f..700283042 100644
--- a/src/lib/block/seed/seed.cpp
+++ b/src/lib/block/seed/seed.cpp
@@ -303,9 +303,9 @@ void SEED::key_schedule(const uint8_t key[], size_t)
m_K[2*i ] = SEED_G(WK[0] + WK[2] - RC[i]);
m_K[2*i+1] = SEED_G(WK[1] - WK[3] + RC[i]) ^ m_K[2*i];
- uint8_t T = get_byte(3, WK[0]);
+ uint32_t T = (WK[0] & 0xFF) << 24;
WK[0] = (WK[0] >> 8) | (get_byte(3, WK[1]) << 24);
- WK[1] = (WK[1] >> 8) | (T << 24);
+ WK[1] = (WK[1] >> 8) | T;
m_K[2*i+2] = SEED_G(WK[0] + WK[2] - RC[i+1]);
m_K[2*i+3] = SEED_G(WK[1] - WK[3] + RC[i+1]) ^ m_K[2*i+2];