VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Crypto/Twofish.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2024-06-12 12:30:04 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2024-06-12 12:30:04 +0200
commit455a4f2176a5cfbe325e1e40cea20dd3e466b64c (patch)
tree7a84d0f768ee375ea9f648bbbdeac7a4906f13fb /src/Crypto/Twofish.c
parentbf9f3ec4f0a987ae1591ab5466f6eee599203c85 (diff)
downloadVeraCrypt-455a4f2176a5cfbe325e1e40cea20dd3e466b64c.tar.gz
VeraCrypt-455a4f2176a5cfbe325e1e40cea20dd3e466b64c.zip
Avoid conflict with C++17 features std::byte by using uint8 type instead of byte
Diffstat (limited to 'src/Crypto/Twofish.c')
-rw-r--r--src/Crypto/Twofish.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/Crypto/Twofish.c b/src/Crypto/Twofish.c
index ad93b66f..ff46bc99 100644
--- a/src/Crypto/Twofish.c
+++ b/src/Crypto/Twofish.c
@@ -57,25 +57,25 @@
#if CRYPTOPP_BOOL_X64 && !defined(CRYPTOPP_DISABLE_ASM)
/* these are 64-bit assembly implementation taken from https://github.com/jkivilin/supercop-blockciphers
- Copyright © 2011-2013 Jussi Kivilinna <jussi.kivilinna@iki.fi>
+ Copyright © 2011-2013 Jussi Kivilinna <jussi.kivilinna@iki.fi>
*/
#if defined(__cplusplus)
extern "C"
{
#endif
-void twofish_enc_blk(TwofishInstance *ks, byte *dst, const byte *src);
-void twofish_dec_blk(TwofishInstance *ks, byte *dst, const byte *src);
-void twofish_enc_blk2(TwofishInstance *ks, byte *dst, const byte *src);
-void twofish_dec_blk2(TwofishInstance *ks, byte *dst, const byte *src);
-void twofish_enc_blk3(TwofishInstance *ks, byte *dst, const byte *src);
-void twofish_dec_blk3(TwofishInstance *ks, byte *dst, const byte *src);
+void twofish_enc_blk(TwofishInstance *ks, uint8 *dst, const uint8 *src);
+void twofish_dec_blk(TwofishInstance *ks, uint8 *dst, const uint8 *src);
+void twofish_enc_blk2(TwofishInstance *ks, uint8 *dst, const uint8 *src);
+void twofish_dec_blk2(TwofishInstance *ks, uint8 *dst, const uint8 *src);
+void twofish_enc_blk3(TwofishInstance *ks, uint8 *dst, const uint8 *src);
+void twofish_dec_blk3(TwofishInstance *ks, uint8 *dst, const uint8 *src);
#if defined(__cplusplus)
}
#endif
-void twofish_encrypt_blocks(TwofishInstance *instance, const byte* in_blk, byte* out_blk, uint32 blockCount)
+void twofish_encrypt_blocks(TwofishInstance *instance, const uint8* in_blk, uint8* out_blk, uint32 blockCount)
{
while (blockCount >= 3)
{
@@ -96,7 +96,7 @@ void twofish_encrypt_blocks(TwofishInstance *instance, const byte* in_blk, byte*
}
-void twofish_decrypt_blocks(TwofishInstance *instance, const byte* in_blk, byte* out_blk, uint32 blockCount)
+void twofish_decrypt_blocks(TwofishInstance *instance, const uint8* in_blk, uint8* out_blk, uint32 blockCount)
{
while (blockCount >= 3)
{
@@ -120,7 +120,7 @@ void twofish_decrypt_blocks(TwofishInstance *instance, const byte* in_blk, byte*
#endif
-static const byte Q[2][256] = {
+static const uint8 Q[2][256] = {
{
0xa9, 0x67, 0xb3, 0xe8, 0x04, 0xfd, 0xa3, 0x76, 0x9a, 0x92, 0x80, 0x78, 0xe4, 0xdd, 0xd1, 0x38,
0x0d, 0xc6, 0x35, 0x98, 0x18, 0xf7, 0xec, 0x6c, 0x43, 0x75, 0x37, 0x26, 0xfa, 0x13, 0x94, 0x48,
@@ -604,11 +604,11 @@ static const uint32 RS[8][256] = {
void twofish_set_key(TwofishInstance *instance, const u4byte in_key[])
{
union {
- byte S8[16];
+ uint8 S8[16];
uint32 S32[4];
} us;
unsigned int i;
- const byte* key = (const byte*) in_key;
+ const uint8* key = (const uint8*) in_key;
us.S32[0] = RS[0][key[0]] ^ RS[1][key[1]] ^ RS[2][key[2]] ^ RS[3][key[3]] ^ RS[4][key[4]] ^ RS[5][key[5]] ^ RS[6][key[6]] ^ RS[7][key[7]];
us.S32[1] = RS[0][key[8]] ^ RS[1][key[9]] ^ RS[2][key[10]] ^ RS[3][key[11]] ^ RS[4][key[12]] ^ RS[5][key[13]] ^ RS[6][key[14]] ^ RS[7][key[15]];