diff options
Diffstat (limited to 'src/block')
62 files changed, 861 insertions, 737 deletions
diff --git a/src/block/aes/aes.cpp b/src/block/aes/aes.cpp index 1c3f12aa0..9072b507b 100644 --- a/src/block/aes/aes.cpp +++ b/src/block/aes/aes.cpp @@ -1,6 +1,8 @@ /** -* AES Source File +* AES * (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/aes.h> diff --git a/src/block/aes/aes.h b/src/block/aes/aes.h index c7361f6e8..05e2e3123 100644 --- a/src/block/aes/aes.h +++ b/src/block/aes/aes.h @@ -1,6 +1,8 @@ /** -* AES Header File +* AES * (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_AES_H__ diff --git a/src/block/aes/aes_tab.cpp b/src/block/aes/aes_tab.cpp index 3665bb746..d42a2cd60 100644 --- a/src/block/aes/aes_tab.cpp +++ b/src/block/aes/aes_tab.cpp @@ -1,7 +1,9 @@ -/************************************************* -* S-Box and Diffusion Tables for AES * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* S-Box and Diffusion Tables for AES +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/aes.h> diff --git a/src/block/block_cipher.h b/src/block/block_cipher.h index 61d3c87d9..01c45af04 100644 --- a/src/block/block_cipher.h +++ b/src/block/block_cipher.h @@ -1,6 +1,8 @@ /** * Block Cipher Base Class * (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_BLOCK_CIPHER_H__ diff --git a/src/block/blowfish/blfs_tab.cpp b/src/block/blowfish/blfs_tab.cpp index f8fa07ee5..070fa6c69 100644 --- a/src/block/blowfish/blfs_tab.cpp +++ b/src/block/blowfish/blfs_tab.cpp @@ -1,7 +1,9 @@ -/************************************************* -* S-Box and P-Box Tables for Blowfish * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* S-Box and P-Box Tables for Blowfish +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/blowfish.h> diff --git a/src/block/blowfish/blowfish.cpp b/src/block/blowfish/blowfish.cpp index f55cffb62..b0599d6c5 100644 --- a/src/block/blowfish/blowfish.cpp +++ b/src/block/blowfish/blowfish.cpp @@ -1,16 +1,18 @@ -/************************************************* -* Blowfish Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Blowfish +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/blowfish.h> #include <botan/loadstor.h> namespace Botan { -/************************************************* -* Blowfish Encryption * -*************************************************/ +/* +* Blowfish Encryption +*/ void Blowfish::enc(const byte in[], byte out[]) const { const u32bit* S1 = S + 0; @@ -37,9 +39,9 @@ void Blowfish::enc(const byte in[], byte out[]) const store_be(out, R, L); } -/************************************************* -* Blowfish Decryption * -*************************************************/ +/* +* Blowfish Decryption +*/ void Blowfish::dec(const byte in[], byte out[]) const { const u32bit* S1 = S + 0; @@ -66,9 +68,9 @@ void Blowfish::dec(const byte in[], byte out[]) const store_be(out, R, L); } -/************************************************* -* Blowfish Key Schedule * -*************************************************/ +/* +* Blowfish Key Schedule +*/ void Blowfish::key_schedule(const byte key[], u32bit length) { clear(); @@ -82,9 +84,9 @@ void Blowfish::key_schedule(const byte key[], u32bit length) generate_sbox(S, 1024, L, R); } -/************************************************* -* Generate one of the Sboxes * -*************************************************/ +/* +* Generate one of the Sboxes +*/ void Blowfish::generate_sbox(u32bit Box[], u32bit size, u32bit& L, u32bit& R) const { @@ -111,9 +113,9 @@ void Blowfish::generate_sbox(u32bit Box[], u32bit size, } } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void Blowfish::clear() throw() { P.copy(P_INIT, 18); diff --git a/src/block/blowfish/blowfish.h b/src/block/blowfish/blowfish.h index c4ef16683..f0f26418d 100644 --- a/src/block/blowfish/blowfish.h +++ b/src/block/blowfish/blowfish.h @@ -1,7 +1,9 @@ -/************************************************* -* Blowfish Header File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Blowfish +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_BLOWFISH_H__ #define BOTAN_BLOWFISH_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Blowfish * -*************************************************/ +/* +* Blowfish +*/ class BOTAN_DLL Blowfish : public BlockCipher { public: diff --git a/src/block/cast/cast128.cpp b/src/block/cast/cast128.cpp index 6a6b46efd..fdb9428a6 100644 --- a/src/block/cast/cast128.cpp +++ b/src/block/cast/cast128.cpp @@ -1,7 +1,9 @@ -/************************************************* -* CAST-128 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CAST-128 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/cast128.h> #include <botan/loadstor.h> @@ -11,9 +13,9 @@ namespace Botan { namespace { -/************************************************* -* CAST-128 Round Type 1 * -*************************************************/ +/* +* CAST-128 Round Type 1 +*/ inline void R1(u32bit& L, u32bit R, u32bit MK, u32bit RK) { u32bit T = rotate_left(MK + R, RK); @@ -21,9 +23,9 @@ inline void R1(u32bit& L, u32bit R, u32bit MK, u32bit RK) CAST_SBOX3[get_byte(2, T)] + CAST_SBOX4[get_byte(3, T)]; } -/************************************************* -* CAST-128 Round Type 2 * -*************************************************/ +/* +* CAST-128 Round Type 2 +*/ inline void R2(u32bit& L, u32bit R, u32bit MK, u32bit RK) { u32bit T = rotate_left(MK ^ R, RK); @@ -31,9 +33,9 @@ inline void R2(u32bit& L, u32bit R, u32bit MK, u32bit RK) CAST_SBOX3[get_byte(2, T)]) ^ CAST_SBOX4[get_byte(3, T)]; } -/************************************************* -* CAST-128 Round Type 3 * -*************************************************/ +/* +* CAST-128 Round Type 3 +*/ inline void R3(u32bit& L, u32bit R, u32bit MK, u32bit RK) { u32bit T = rotate_left(MK - R, RK); @@ -43,9 +45,9 @@ inline void R3(u32bit& L, u32bit R, u32bit MK, u32bit RK) } -/************************************************* -* CAST-128 Encryption * -*************************************************/ +/* +* CAST-128 Encryption +*/ void CAST_128::enc(const byte in[], byte out[]) const { u32bit L = load_be<u32bit>(in, 0); @@ -71,9 +73,9 @@ void CAST_128::enc(const byte in[], byte out[]) const store_be(out, R, L); } -/************************************************* -* CAST-128 Decryption * -*************************************************/ +/* +* CAST-128 Decryption +*/ void CAST_128::dec(const byte in[], byte out[]) const { u32bit L = load_be<u32bit>(in, 0); @@ -99,9 +101,9 @@ void CAST_128::dec(const byte in[], byte out[]) const store_be(out, R, L); } -/************************************************* -* CAST-128 Key Schedule * -*************************************************/ +/* +* CAST-128 Key Schedule +*/ void CAST_128::key_schedule(const byte key[], u32bit length) { clear(); @@ -116,9 +118,9 @@ void CAST_128::key_schedule(const byte key[], u32bit length) RK[j] %= 32; } -/************************************************* -* S-Box Based Key Expansion * -*************************************************/ +/* +* S-Box Based Key Expansion +*/ void CAST_128::key_schedule(u32bit K[16], u32bit X[4]) { class ByteReader diff --git a/src/block/cast/cast128.h b/src/block/cast/cast128.h index 2004de51a..680481482 100644 --- a/src/block/cast/cast128.h +++ b/src/block/cast/cast128.h @@ -1,7 +1,9 @@ -/************************************************* -* CAST-128 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CAST-128 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_CAST128_H__ #define BOTAN_CAST128_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* CAST-128 * -*************************************************/ +/* +* CAST-128 +*/ class BOTAN_DLL CAST_128 : public BlockCipher { public: diff --git a/src/block/cast/cast256.cpp b/src/block/cast/cast256.cpp index b8004851b..993bab46c 100644 --- a/src/block/cast/cast256.cpp +++ b/src/block/cast/cast256.cpp @@ -1,7 +1,9 @@ -/************************************************* -* CAST-256 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CAST-256 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/cast256.h> #include <botan/loadstor.h> @@ -11,9 +13,9 @@ namespace Botan { namespace { -/************************************************* -* CAST-256 Round Type 1 * -*************************************************/ +/* +* CAST-256 Round Type 1 +*/ void round1(u32bit& out, u32bit in, u32bit mask, u32bit rot) { u32bit temp = rotate_left(mask + in, rot); @@ -21,9 +23,9 @@ void round1(u32bit& out, u32bit in, u32bit mask, u32bit rot) CAST_SBOX3[get_byte(2, temp)] + CAST_SBOX4[get_byte(3, temp)]; } -/************************************************* -* CAST-256 Round Type 2 * -*************************************************/ +/* +* CAST-256 Round Type 2 +*/ void round2(u32bit& out, u32bit in, u32bit mask, u32bit rot) { u32bit temp = rotate_left(mask ^ in, rot); @@ -31,9 +33,9 @@ void round2(u32bit& out, u32bit in, u32bit mask, u32bit rot) CAST_SBOX3[get_byte(2, temp)]) ^ CAST_SBOX4[get_byte(3, temp)]; } -/************************************************* -* CAST-256 Round Type 3 * -*************************************************/ +/* +* CAST-256 Round Type 3 +*/ void round3(u32bit& out, u32bit in, u32bit mask, u32bit rot) { u32bit temp = rotate_left(mask - in, rot); @@ -43,9 +45,9 @@ void round3(u32bit& out, u32bit in, u32bit mask, u32bit rot) } -/************************************************* -* CAST-256 Encryption * -*************************************************/ +/* +* CAST-256 Encryption +*/ void CAST_256::enc(const byte in[], byte out[]) const { u32bit A = load_be<u32bit>(in, 0); @@ -81,9 +83,9 @@ void CAST_256::enc(const byte in[], byte out[]) const store_be(out, A, B, C, D); } -/************************************************* -* CAST-256 Decryption * -*************************************************/ +/* +* CAST-256 Decryption +*/ void CAST_256::dec(const byte in[], byte out[]) const { u32bit A = load_be<u32bit>(in, 0); @@ -119,9 +121,9 @@ void CAST_256::dec(const byte in[], byte out[]) const store_be(out, A, B, C, D); } -/************************************************* -* CAST-256 Key Schedule * -*************************************************/ +/* +* CAST-256 Key Schedule +*/ void CAST_256::key_schedule(const byte key[], u32bit length) { SecureBuffer<u32bit, 8> TMP; diff --git a/src/block/cast/cast256.h b/src/block/cast/cast256.h index e80208ad4..cd48edd5e 100644 --- a/src/block/cast/cast256.h +++ b/src/block/cast/cast256.h @@ -1,7 +1,9 @@ -/************************************************* -* CAST-256 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CAST-256 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_CAST256_H__ #define BOTAN_CAST256_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* CAST-256 * -*************************************************/ +/* +* CAST-256 +*/ class BOTAN_DLL CAST_256 : public BlockCipher { public: diff --git a/src/block/cast/cast_tab.cpp b/src/block/cast/cast_tab.cpp index 3edab713f..61c843713 100644 --- a/src/block/cast/cast_tab.cpp +++ b/src/block/cast/cast_tab.cpp @@ -1,7 +1,9 @@ -/************************************************* -* S-Box Tables for CAST-128 and CAST-256 * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* S-Box Tables for CAST-128 and CAST-256 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/cast128.h> #include <botan/cast256.h> diff --git a/src/block/des/des.cpp b/src/block/des/des.cpp index f6453cff0..37520e0fc 100644 --- a/src/block/des/des.cpp +++ b/src/block/des/des.cpp @@ -1,7 +1,9 @@ -/************************************************* -* DES Source File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* DES +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/des.h> #include <botan/loadstor.h> @@ -10,9 +12,9 @@ namespace Botan { namespace { -/************************************************* -* DES Key Schedule * -*************************************************/ +/* +* DES Key Schedule +*/ void des_key_schedule(u32bit round_key[32], const byte key[8]) { static const byte ROT[16] = { 1, 1, 2, 2, 2, 2, 2, 2, @@ -76,9 +78,9 @@ void des_key_schedule(u32bit round_key[32], const byte key[8]) } } -/************************************************* -* DES Encryption * -*************************************************/ +/* +* DES Encryption +*/ void des_encrypt(u32bit& L, u32bit& R, const u32bit round_key[32]) { @@ -104,9 +106,9 @@ void des_encrypt(u32bit& L, u32bit& R, } } -/************************************************* -* DES Decryption * -*************************************************/ +/* +* DES Decryption +*/ void des_decrypt(u32bit& L, u32bit& R, const u32bit round_key[32]) { @@ -134,9 +136,9 @@ void des_decrypt(u32bit& L, u32bit& R, } -/************************************************* -* DES Encryption * -*************************************************/ +/* +* DES Encryption +*/ void DES::enc(const byte in[], byte out[]) const { u64bit T = (DES_IPTAB1[in[0]] ) | (DES_IPTAB1[in[1]] << 1) | @@ -159,9 +161,9 @@ void DES::enc(const byte in[], byte out[]) const store_be(T, out); } -/************************************************* -* DES Decryption * -*************************************************/ +/* +* DES Decryption +*/ void DES::dec(const byte in[], byte out[]) const { u64bit T = (DES_IPTAB1[in[0]] ) | (DES_IPTAB1[in[1]] << 1) | @@ -184,17 +186,17 @@ void DES::dec(const byte in[], byte out[]) const store_be(T, out); } -/************************************************* -* DES Key Schedule * -*************************************************/ +/* +* DES Key Schedule +*/ void DES::key_schedule(const byte key[], u32bit) { des_key_schedule(round_key.begin(), key); } -/************************************************* -* TripleDES Encryption * -*************************************************/ +/* +* TripleDES Encryption +*/ void TripleDES::enc(const byte in[], byte out[]) const { u64bit T = (DES_IPTAB1[in[0]] ) | (DES_IPTAB1[in[1]] << 1) | @@ -219,9 +221,9 @@ void TripleDES::enc(const byte in[], byte out[]) const store_be(T, out); } -/************************************************* -* TripleDES Decryption * -*************************************************/ +/* +* TripleDES Decryption +*/ void TripleDES::dec(const byte in[], byte out[]) const { u64bit T = (DES_IPTAB1[in[0]] ) | (DES_IPTAB1[in[1]] << 1) | @@ -246,9 +248,9 @@ void TripleDES::dec(const byte in[], byte out[]) const store_be(T, out); } -/************************************************* -* TripleDES Key Schedule * -*************************************************/ +/* +* TripleDES Key Schedule +*/ void TripleDES::key_schedule(const byte key[], u32bit length) { des_key_schedule(&round_key[0], key); diff --git a/src/block/des/des.h b/src/block/des/des.h index f3a0d56eb..6fa59de5e 100644 --- a/src/block/des/des.h +++ b/src/block/des/des.h @@ -1,7 +1,9 @@ -/************************************************* -* DES Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* DES +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_DES_H__ #define BOTAN_DES_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* DES * -*************************************************/ +/* +* DES +*/ class BOTAN_DLL DES : public BlockCipher { public: @@ -28,9 +30,9 @@ class BOTAN_DLL DES : public BlockCipher SecureBuffer<u32bit, 32> round_key; }; -/************************************************* -* Triple DES * -*************************************************/ +/* +* Triple DES +*/ class BOTAN_DLL TripleDES : public BlockCipher { public: @@ -46,9 +48,9 @@ class BOTAN_DLL TripleDES : public BlockCipher SecureBuffer<u32bit, 96> round_key; }; -/************************************************* -* DES Tables * -*************************************************/ +/* +* DES Tables +*/ extern const u32bit DES_SPBOX1[256]; extern const u32bit DES_SPBOX2[256]; extern const u32bit DES_SPBOX3[256]; diff --git a/src/block/des/des_tab.cpp b/src/block/des/des_tab.cpp index aa3b7cd45..b46ca3063 100644 --- a/src/block/des/des_tab.cpp +++ b/src/block/des/des_tab.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Substitution/Permutation Tables for DES * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Substitution/Permutation Tables for DES +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/des.h> diff --git a/src/block/des/desx.cpp b/src/block/des/desx.cpp index 41c3bcd8d..e557901d3 100644 --- a/src/block/des/desx.cpp +++ b/src/block/des/desx.cpp @@ -1,16 +1,18 @@ -/************************************************* -* DES Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* DES +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/desx.h> #include <botan/xor_buf.h> namespace Botan { -/************************************************* -* DESX Encryption * -*************************************************/ +/* +* DESX Encryption +*/ void DESX::enc(const byte in[], byte out[]) const { xor_buf(out, in, K1.begin(), BLOCK_SIZE); @@ -18,9 +20,9 @@ void DESX::enc(const byte in[], byte out[]) const xor_buf(out, K2.begin(), BLOCK_SIZE); } -/************************************************* -* DESX Decryption * -*************************************************/ +/* +* DESX Decryption +*/ void DESX::dec(const byte in[], byte out[]) const { xor_buf(out, in, K2.begin(), BLOCK_SIZE); @@ -28,9 +30,9 @@ void DESX::dec(const byte in[], byte out[]) const xor_buf(out, K1.begin(), BLOCK_SIZE); } -/************************************************* -* DESX Key Schedule * -*************************************************/ +/* +* DESX Key Schedule +*/ void DESX::key_schedule(const byte key[], u32bit) { K1.copy(key, 8); diff --git a/src/block/des/desx.h b/src/block/des/desx.h index 1fa68fcde..49ecc2421 100644 --- a/src/block/des/desx.h +++ b/src/block/des/desx.h @@ -1,7 +1,9 @@ -/************************************************* -* DESX Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* DESX +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_DESX_H__ #define BOTAN_DESX_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* DESX * -*************************************************/ +/* +* DESX +*/ class BOTAN_DLL DESX : public BlockCipher { public: diff --git a/src/block/gost_28147/gost_28147.cpp b/src/block/gost_28147/gost_28147.cpp index c8add16f6..0f29102de 100644 --- a/src/block/gost_28147/gost_28147.cpp +++ b/src/block/gost_28147/gost_28147.cpp @@ -1,6 +1,8 @@ /* * GOST 28147-89 * (C) 1999-2009 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/gost_28147.h> diff --git a/src/block/gost_28147/gost_28147.h b/src/block/gost_28147/gost_28147.h index d79bdb8d6..a58927e28 100644 --- a/src/block/gost_28147/gost_28147.h +++ b/src/block/gost_28147/gost_28147.h @@ -1,6 +1,8 @@ /* * GOST 28147-89 * (C) 1999-2009 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_GOST_28147_89_H__ diff --git a/src/block/idea/idea.cpp b/src/block/idea/idea.cpp index 88dc04a3d..5bbe47087 100644 --- a/src/block/idea/idea.cpp +++ b/src/block/idea/idea.cpp @@ -1,7 +1,9 @@ -/************************************************* -* IDEA Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* IDEA +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/idea.h> #include <botan/loadstor.h> @@ -10,9 +12,9 @@ namespace Botan { namespace { -/************************************************* -* Multiplication modulo 65537 * -*************************************************/ +/* +* Multiplication modulo 65537 +*/ inline u16bit mul(u16bit x, u16bit y) { if(x && y) @@ -26,9 +28,9 @@ inline u16bit mul(u16bit x, u16bit y) return static_cast<u16bit>(1 - x - y); } -/************************************************* -* Find multiplicative inverses modulo 65537 * -*************************************************/ +/* +* Find multiplicative inverses modulo 65537 +*/ u16bit mul_inv(u16bit x) { if(x <= 1) @@ -55,9 +57,9 @@ u16bit mul_inv(u16bit x) } -/************************************************* -* IDEA Encryption * -*************************************************/ +/* +* IDEA Encryption +*/ void IDEA::enc(const byte in[], byte out[]) const { u16bit X1 = load_be<u16bit>(in, 0); @@ -93,9 +95,9 @@ void IDEA::enc(const byte in[], byte out[]) const store_be(out, X1, X3, X2, X4); } -/************************************************* -* IDEA Decryption * -*************************************************/ +/* +* IDEA Decryption +*/ void IDEA::dec(const byte in[], byte out[]) const { u16bit X1 = load_be<u16bit>(in, 0); @@ -131,9 +133,9 @@ void IDEA::dec(const byte in[], byte out[]) const store_be(out, X1, X3, X2, X4); } -/************************************************* -* IDEA Key Schedule * -*************************************************/ +/* +* IDEA Key Schedule +*/ void IDEA::key_schedule(const byte key[], u32bit) { for(u32bit j = 0; j != 8; ++j) diff --git a/src/block/idea/idea.h b/src/block/idea/idea.h index cd47111a6..2c53cd0e4 100644 --- a/src/block/idea/idea.h +++ b/src/block/idea/idea.h @@ -1,7 +1,9 @@ -/************************************************* -* IDEA Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* IDEA +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_IDEA_H__ #define BOTAN_IDEA_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* IDEA * -*************************************************/ +/* +* IDEA +*/ class BOTAN_DLL IDEA : public BlockCipher { public: diff --git a/src/block/kasumi/kasumi.cpp b/src/block/kasumi/kasumi.cpp index 4be6c41a8..3887271a9 100644 --- a/src/block/kasumi/kasumi.cpp +++ b/src/block/kasumi/kasumi.cpp @@ -1,7 +1,9 @@ -/************************************************* -* KASUMI Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* KASUMI +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/kasumi.h> #include <botan/loadstor.h> @@ -11,9 +13,9 @@ namespace Botan { namespace { -/************************************************* -* KASUMI S-Boxes * -*************************************************/ +/* +* KASUMI S-Boxes +*/ const byte KASUMI_SBOX_S7[128] = { 0x36, 0x32, 0x3E, 0x38, 0x16, 0x22, 0x5E, 0x60, 0x26, 0x06, 0x3F, 0x5D, 0x02, 0x12, 0x7B, 0x21, 0x37, 0x71, 0x27, 0x72, 0x15, 0x43, 0x41, 0x0C, @@ -86,9 +88,9 @@ const u16bit KASUMI_SBOX_S9[512] = { 0x017C, 0x002B, 0x0042, 0x003C, 0x01C7, 0x0155, 0x01BD, 0x00CA, 0x01B0, 0x0008, 0x00ED, 0x000F, 0x0178, 0x01B4, 0x01D0, 0x003B, 0x01CD }; -/************************************************* -* KASUMI FI Function * -*************************************************/ +/* +* KASUMI FI Function +*/ u16bit FI(u16bit I, u16bit K) { u16bit D9 = (I >> 7); @@ -104,9 +106,9 @@ u16bit FI(u16bit I, u16bit K) } -/************************************************* -* KASUMI Encryption * -*************************************************/ +/* +* KASUMI Encryption +*/ void KASUMI::enc(const byte in[], byte out[]) const { u16bit B0 = load_be<u16bit>(in, 0); @@ -142,9 +144,9 @@ void KASUMI::enc(const byte in[], byte out[]) const store_be(out, B0, B1, B2, B3); } -/************************************************* -* KASUMI Decryption * -*************************************************/ +/* +* KASUMI Decryption +*/ void KASUMI::dec(const byte in[], byte out[]) const { u16bit B0 = load_be<u16bit>(in, 0); @@ -182,9 +184,9 @@ void KASUMI::dec(const byte in[], byte out[]) const store_be(out, B0, B1, B2, B3); } -/************************************************* -* KASUMI Key Schedule * -*************************************************/ +/* +* KASUMI Key Schedule +*/ void KASUMI::key_schedule(const byte key[], u32bit) { static const u16bit RC[] = { 0x0123, 0x4567, 0x89AB, 0xCDEF, diff --git a/src/block/kasumi/kasumi.h b/src/block/kasumi/kasumi.h index 27765e640..df49fa9eb 100644 --- a/src/block/kasumi/kasumi.h +++ b/src/block/kasumi/kasumi.h @@ -1,7 +1,9 @@ -/************************************************* -* KASUMI Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* KASUMI +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_KASUMI_H__ #define BOTAN_KASUMI_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* KASUMI * -*************************************************/ +/* +* KASUMI +*/ class BOTAN_DLL KASUMI : public BlockCipher { public: diff --git a/src/block/lion/lion.cpp b/src/block/lion/lion.cpp index f35cbf424..c7cdf6d13 100644 --- a/src/block/lion/lion.cpp +++ b/src/block/lion/lion.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Lion Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Lion +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/lion.h> #include <botan/xor_buf.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* Lion Encryption * -*************************************************/ +/* +* Lion Encryption +*/ void Lion::enc(const byte in[], byte out[]) const { SecureVector<byte> buffer(LEFT_SIZE); @@ -29,9 +31,9 @@ void Lion::enc(const byte in[], byte out[]) const cipher->encrypt(out + LEFT_SIZE, RIGHT_SIZE); } -/************************************************* -* Lion Decryption * -*************************************************/ +/* +* Lion Decryption +*/ void Lion::dec(const byte in[], byte out[]) const { SecureVector<byte> buffer(LEFT_SIZE); @@ -49,9 +51,9 @@ void Lion::dec(const byte in[], byte out[]) const cipher->encrypt(out + LEFT_SIZE, RIGHT_SIZE); } -/************************************************* -* Lion Key Schedule * -*************************************************/ +/* +* Lion Key Schedule +*/ void Lion::key_schedule(const byte key[], u32bit length) { clear(); @@ -60,9 +62,9 @@ void Lion::key_schedule(const byte key[], u32bit length) key2.copy(key + length / 2, length / 2); } -/************************************************* -* Return the name of this type * -*************************************************/ +/* +* Return the name of this type +*/ std::string Lion::name() const { return "Lion(" + hash->name() + "," + @@ -70,17 +72,17 @@ std::string Lion::name() const to_string(BLOCK_SIZE) + ")"; } -/************************************************* -* Return a clone of this object * -*************************************************/ +/* +* Return a clone of this object +*/ BlockCipher* Lion::clone() const { return new Lion(hash->clone(), cipher->clone(), BLOCK_SIZE); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void Lion::clear() throw() { hash->clear(); @@ -89,9 +91,9 @@ void Lion::clear() throw() key2.clear(); } -/************************************************* -* Lion Constructor * -*************************************************/ +/* +* Lion Constructor +*/ Lion::Lion(HashFunction* hash_in, StreamCipher* sc_in, u32bit block_len) : BlockCipher(std::max<u32bit>(2*hash_in->OUTPUT_LENGTH + 1, block_len), 2, 2*hash_in->OUTPUT_LENGTH, 2), diff --git a/src/block/lion/lion.h b/src/block/lion/lion.h index b16db966e..5bc4e72c0 100644 --- a/src/block/lion/lion.h +++ b/src/block/lion/lion.h @@ -1,7 +1,9 @@ -/************************************************* -* Lion Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Lion +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_LION_H__ #define BOTAN_LION_H__ @@ -12,9 +14,9 @@ namespace Botan { -/************************************************* -* Lion * -*************************************************/ +/* +* Lion +*/ class BOTAN_DLL Lion : public BlockCipher { public: diff --git a/src/block/lubyrack/lubyrack.cpp b/src/block/lubyrack/lubyrack.cpp index 5304d14d6..a9d2b1db2 100644 --- a/src/block/lubyrack/lubyrack.cpp +++ b/src/block/lubyrack/lubyrack.cpp @@ -1,16 +1,18 @@ -/************************************************* -* Luby-Rackoff Source File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Luby-Rackoff +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/lubyrack.h> #include <botan/xor_buf.h> namespace Botan { -/************************************************* -* Luby-Rackoff Encryption * -*************************************************/ +/* +* Luby-Rackoff Encryption +*/ void LubyRackoff::enc(const byte in[], byte out[]) const { const u32bit len = hash->OUTPUT_LENGTH; @@ -37,9 +39,9 @@ void LubyRackoff::enc(const byte in[], byte out[]) const xor_buf(out, buffer, len); } -/************************************************* -* Luby-Rackoff Decryption * -*************************************************/ +/* +* Luby-Rackoff Decryption +*/ void LubyRackoff::dec(const byte in[], byte out[]) const { const u32bit len = hash->OUTPUT_LENGTH; @@ -66,18 +68,18 @@ void LubyRackoff::dec(const byte in[], byte out[]) const xor_buf(out + len, buffer, len); } -/************************************************* -* Luby-Rackoff Key Schedule * -*************************************************/ +/* +* Luby-Rackoff Key Schedule +*/ void LubyRackoff::key_schedule(const byte key[], u32bit length) { K1.set(key, length / 2); K2.set(key + length / 2, length / 2); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void LubyRackoff::clear() throw() { K1.clear(); @@ -85,25 +87,25 @@ void LubyRackoff::clear() throw() hash->clear(); } -/************************************************* -* Return a clone of this object * -*************************************************/ +/* +* Return a clone of this object +*/ BlockCipher* LubyRackoff::clone() const { return new LubyRackoff(hash->clone()); } -/************************************************* -* Return the name of this type * -*************************************************/ +/* +* Return the name of this type +*/ std::string LubyRackoff::name() const { return "Luby-Rackoff(" + hash->name() + ")"; } -/************************************************* -* Luby-Rackoff Constructor * -*************************************************/ +/* +* Luby-Rackoff Constructor +*/ LubyRackoff::LubyRackoff(HashFunction* h) : BlockCipher(2 * (h ? h->OUTPUT_LENGTH: 0), 2, 32, 2), diff --git a/src/block/lubyrack/lubyrack.h b/src/block/lubyrack/lubyrack.h index 6fedc38fe..ebde31304 100644 --- a/src/block/lubyrack/lubyrack.h +++ b/src/block/lubyrack/lubyrack.h @@ -1,7 +1,9 @@ -/************************************************* -* Luby-Rackoff Header File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Luby-Rackoff +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_LUBY_RACKOFF_H__ #define BOTAN_LUBY_RACKOFF_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* Luby-Rackoff * -*************************************************/ +/* +* Luby-Rackoff +*/ class BOTAN_DLL LubyRackoff : public BlockCipher { public: diff --git a/src/block/mars/mars.cpp b/src/block/mars/mars.cpp index 5f93f2df4..7c3906ecf 100644 --- a/src/block/mars/mars.cpp +++ b/src/block/mars/mars.cpp @@ -1,7 +1,9 @@ -/************************************************* -* MARS Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* MARS +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/mars.h> #include <botan/loadstor.h> @@ -11,9 +13,9 @@ namespace Botan { namespace { -/************************************************* -* Generate a mask for runs of bits * -*************************************************/ +/* +* Generate a mask for runs of bits +*/ u32bit gen_mask(u32bit input) { u32bit mask = 0; @@ -45,9 +47,9 @@ u32bit gen_mask(u32bit input) } -/************************************************* -* MARS Encryption * -*************************************************/ +/* +* MARS Encryption +*/ void MARS::enc(const byte in[], byte out[]) const { u32bit A = load_le<u32bit>(in, 0) + EK[0]; @@ -82,9 +84,9 @@ void MARS::enc(const byte in[], byte out[]) const store_le(out, A, B, C, D); } -/************************************************* -* MARS Decryption * -*************************************************/ +/* +* MARS Decryption +*/ void MARS::dec(const byte in[], byte out[]) const { u32bit A = load_le<u32bit>(in, 3) + EK[39]; @@ -119,9 +121,9 @@ void MARS::dec(const byte in[], byte out[]) const store_le(out, D, C, B, A); } -/************************************************* -* MARS Forward Mixing Operation * -*************************************************/ +/* +* MARS Forward Mixing Operation +*/ void MARS::forward_mix(u32bit& A, u32bit& B, u32bit& C, u32bit& D) { for(u32bit j = 0; j != 2; ++j) @@ -144,9 +146,9 @@ void MARS::forward_mix(u32bit& A, u32bit& B, u32bit& C, u32bit& D) } } -/************************************************* -* MARS Reverse Mixing Operation * -*************************************************/ +/* +* MARS Reverse Mixing Operation +*/ void MARS::reverse_mix(u32bit& A, u32bit& B, u32bit& C, u32bit& D) { for(u32bit j = 0; j != 2; ++j) @@ -170,9 +172,9 @@ void MARS::reverse_mix(u32bit& A, u32bit& B, u32bit& C, u32bit& D) } } -/************************************************* -* MARS Encryption Round * -*************************************************/ +/* +* MARS Encryption Round +*/ void MARS::encrypt_round(u32bit& A, u32bit& B, u32bit& C, u32bit& D, u32bit round) const { @@ -190,9 +192,9 @@ void MARS::encrypt_round(u32bit& A, u32bit& B, u32bit& C, u32bit& D, B += rotate_left(Z, Y % 32); } -/************************************************* -* MARS Decryption Round * -*************************************************/ +/* +* MARS Decryption Round +*/ void MARS::decrypt_round(u32bit& A, u32bit& B, u32bit& C, u32bit& D, u32bit round) const { @@ -210,9 +212,9 @@ void MARS::decrypt_round(u32bit& A, u32bit& B, u32bit& C, u32bit& D, B -= rotate_left(Z, Y % 32); } -/************************************************* -* MARS Key Schedule * -*************************************************/ +/* +* MARS Key Schedule +*/ void MARS::key_schedule(const byte key[], u32bit length) { SecureBuffer<u32bit, 15> T; diff --git a/src/block/mars/mars.h b/src/block/mars/mars.h index 44f581549..ca49695af 100644 --- a/src/block/mars/mars.h +++ b/src/block/mars/mars.h @@ -1,7 +1,9 @@ -/************************************************* -* MARS Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* MARS +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_MARS_H__ #define BOTAN_MARS_H__ diff --git a/src/block/mars/mars_tab.cpp b/src/block/mars/mars_tab.cpp index 07381e9cb..fb8f34542 100644 --- a/src/block/mars/mars_tab.cpp +++ b/src/block/mars/mars_tab.cpp @@ -1,7 +1,9 @@ -/************************************************* -* S-Box Table for MARS * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* S-Box Table for MARS +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/mars.h> diff --git a/src/block/misty1/misty1.cpp b/src/block/misty1/misty1.cpp index bac5e43eb..a35ff584d 100644 --- a/src/block/misty1/misty1.cpp +++ b/src/block/misty1/misty1.cpp @@ -1,7 +1,9 @@ -/************************************************* -* MISTY1 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* MISTY1 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/misty1.h> #include <botan/loadstor.h> @@ -83,9 +85,9 @@ static const u16bit MISTY1_SBOX_S9[512] = { 0x00BE, 0x0078, 0x0000, 0x00AC, 0x0110, 0x015E, 0x0124, 0x0002, 0x01BC, 0x00A2, 0x00EA, 0x0070, 0x01FC, 0x0116, 0x015C, 0x004C, 0x01C2 }; -/************************************************* -* MISTY1 FI Function * -*************************************************/ +/* +* MISTY1 FI Function +*/ u16bit FI(u16bit input, u16bit key7, u16bit key9) { u16bit D9 = input >> 7, D7 = input & 0x7F; @@ -97,9 +99,9 @@ u16bit FI(u16bit input, u16bit key7, u16bit key9) } -/************************************************* -* MISTY1 Encryption * -*************************************************/ +/* +* MISTY1 Encryption +*/ void MISTY1::enc(const byte in[], byte out[]) const { u16bit B0 = load_be<u16bit>(in, 0); @@ -141,9 +143,9 @@ void MISTY1::enc(const byte in[], byte out[]) const store_be(out, B2, B3, B0, B1); } -/************************************************* -* MISTY1 Decryption * -*************************************************/ +/* +* MISTY1 Decryption +*/ void MISTY1::dec(const byte in[], byte out[]) const { u16bit B0 = load_be<u16bit>(in, 2); @@ -185,9 +187,9 @@ void MISTY1::dec(const byte in[], byte out[]) const store_be(out, B0, B1, B2, B3); } -/************************************************* -* MISTY1 Key Schedule * -*************************************************/ +/* +* MISTY1 Key Schedule +*/ void MISTY1::key_schedule(const byte key[], u32bit length) { SecureBuffer<u16bit, 32> KS; @@ -234,9 +236,9 @@ void MISTY1::key_schedule(const byte key[], u32bit length) } } -/************************************************* -* MISTY1 Constructor * -*************************************************/ +/* +* MISTY1 Constructor +*/ MISTY1::MISTY1(u32bit rounds) : BlockCipher(8, 16) { if(rounds != 8) diff --git a/src/block/misty1/misty1.h b/src/block/misty1/misty1.h index 8da93184f..62d4f856f 100644 --- a/src/block/misty1/misty1.h +++ b/src/block/misty1/misty1.h @@ -1,6 +1,8 @@ /** -* MISTY1 Header File +* MISTY1 * (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_MISTY1_H__ diff --git a/src/block/noekeon/noekeon.cpp b/src/block/noekeon/noekeon.cpp index 1a783b432..256744b22 100644 --- a/src/block/noekeon/noekeon.cpp +++ b/src/block/noekeon/noekeon.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Noekeon Source File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Noekeon +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/noekeon.h> #include <botan/loadstor.h> @@ -11,9 +13,9 @@ namespace Botan { namespace { -/************************************************* -* Noekeon's Theta Operation * -*************************************************/ +/* +* Noekeon's Theta Operation +*/ inline void theta(u32bit& A0, u32bit& A1, u32bit& A2, u32bit& A3, const u32bit EK[4]) @@ -34,9 +36,9 @@ inline void theta(u32bit& A0, u32bit& A1, A2 ^= T; } -/************************************************* -* Theta With Null Key * -*************************************************/ +/* +* Theta With Null Key +*/ inline void theta(u32bit& A0, u32bit& A1, u32bit& A2, u32bit& A3) { @@ -51,9 +53,9 @@ inline void theta(u32bit& A0, u32bit& A1, A2 ^= T; } -/************************************************* -* Noekeon's Gamma S-Box Layer * -*************************************************/ +/* +* Noekeon's Gamma S-Box Layer +*/ inline void gamma(u32bit& A0, u32bit& A1, u32bit& A2, u32bit& A3) { A1 ^= ~A3 & ~A2; @@ -71,17 +73,17 @@ inline void gamma(u32bit& A0, u32bit& A1, u32bit& A2, u32bit& A3) } -/************************************************* -* Noekeon Round Constants * -*************************************************/ +/* +* Noekeon Round Constants +*/ const byte Noekeon::RC[] = { 0x80, 0x1B, 0x36, 0x6C, 0xD8, 0xAB, 0x4D, 0x9A, 0x2F, 0x5E, 0xBC, 0x63, 0xC6, 0x97, 0x35, 0x6A, 0xD4 }; -/************************************************* -* Noekeon Encryption * -*************************************************/ +/* +* Noekeon Encryption +*/ void Noekeon::enc(const byte in[], byte out[]) const { u32bit A0 = load_be<u32bit>(in, 0); @@ -111,9 +113,9 @@ void Noekeon::enc(const byte in[], byte out[]) const store_be(out, A0, A1, A2, A3); } -/************************************************* -* Noekeon Encryption * -*************************************************/ +/* +* Noekeon Encryption +*/ void Noekeon::dec(const byte in[], byte out[]) const { u32bit A0 = load_be<u32bit>(in, 0); @@ -143,9 +145,9 @@ void Noekeon::dec(const byte in[], byte out[]) const store_be(out, A0, A1, A2, A3); } -/************************************************* -* Noekeon Key Schedule * -*************************************************/ +/* +* Noekeon Key Schedule +*/ void Noekeon::key_schedule(const byte key[], u32bit) { u32bit A0 = load_be<u32bit>(key, 0); @@ -184,9 +186,9 @@ void Noekeon::key_schedule(const byte key[], u32bit) EK[3] = A3; } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void Noekeon::clear() throw() { EK.clear(); diff --git a/src/block/noekeon/noekeon.h b/src/block/noekeon/noekeon.h index 9d4e896b9..893892446 100644 --- a/src/block/noekeon/noekeon.h +++ b/src/block/noekeon/noekeon.h @@ -1,7 +1,9 @@ -/************************************************* -* Noekeon Header File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Noekeon +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_NOEKEON_H__ #define BOTAN_NOEKEON_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Noekeon * -*************************************************/ +/* +* Noekeon +*/ class BOTAN_DLL Noekeon : public BlockCipher { public: diff --git a/src/block/rc2/rc2.cpp b/src/block/rc2/rc2.cpp index 56d0db78c..bf588bbf3 100644 --- a/src/block/rc2/rc2.cpp +++ b/src/block/rc2/rc2.cpp @@ -1,7 +1,9 @@ -/************************************************* -* RC2 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* RC2 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/rc2.h> #include <botan/loadstor.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* RC2 Encryption * -*************************************************/ +/* +* RC2 Encryption +*/ void RC2::enc(const byte in[], byte out[]) const { u16bit R0 = load_le<u16bit>(in, 0); @@ -45,9 +47,9 @@ void RC2::enc(const byte in[], byte out[]) const store_le(out, R0, R1, R2, R3); } -/************************************************* -* RC2 Decryption * -*************************************************/ +/* +* RC2 Decryption +*/ void RC2::dec(const byte in[], byte out[]) const { u16bit R0 = load_le<u16bit>(in, 0); @@ -81,9 +83,9 @@ void RC2::dec(const byte in[], byte out[]) const store_le(out, R0, R1, R2, R3); } -/************************************************* -* RC2 Key Schedule * -*************************************************/ +/* +* RC2 Key Schedule +*/ void RC2::key_schedule(const byte key[], u32bit length) { static const byte TABLE[256] = { @@ -123,9 +125,9 @@ void RC2::key_schedule(const byte key[], u32bit length) K[j] = load_le<u16bit>(L, j); } -/************************************************* -* Return the code of the effective key bits * -*************************************************/ +/* +* Return the code of the effective key bits +*/ byte RC2::EKB_code(u32bit ekb) { const byte EKB[256] = { diff --git a/src/block/rc2/rc2.h b/src/block/rc2/rc2.h index a1fe4ecfa..cb6f58f04 100644 --- a/src/block/rc2/rc2.h +++ b/src/block/rc2/rc2.h @@ -1,7 +1,9 @@ -/************************************************* -* RC2 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* RC2 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_RC2_H__ #define BOTAN_RC2_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* RC2 * -*************************************************/ +/* +* RC2 +*/ class BOTAN_DLL RC2 : public BlockCipher { public: diff --git a/src/block/rc5/rc5.cpp b/src/block/rc5/rc5.cpp index c4e4bf9b0..57219f413 100644 --- a/src/block/rc5/rc5.cpp +++ b/src/block/rc5/rc5.cpp @@ -1,7 +1,9 @@ -/************************************************* -* RC5 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* RC5 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/rc5.h> #include <botan/loadstor.h> @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* RC5 Encryption * -*************************************************/ +/* +* RC5 Encryption +*/ void RC5::enc(const byte in[], byte out[]) const { u32bit A = load_le<u32bit>(in, 0), B = load_le<u32bit>(in, 1); @@ -34,9 +36,9 @@ void RC5::enc(const byte in[], byte out[]) const store_le(out, A, B); } -/************************************************* -* RC5 Decryption * -*************************************************/ +/* +* RC5 Decryption +*/ void RC5::dec(const byte in[], byte out[]) const { u32bit A = load_le<u32bit>(in, 0), B = load_le<u32bit>(in, 1); @@ -57,9 +59,9 @@ void RC5::dec(const byte in[], byte out[]) const store_le(out, A, B); } -/************************************************* -* RC5 Key Schedule * -*************************************************/ +/* +* RC5 Key Schedule +*/ void RC5::key_schedule(const byte key[], u32bit length) { const u32bit WORD_KEYLENGTH = (((length - 1) / 4) + 1), @@ -80,17 +82,17 @@ void RC5::key_schedule(const byte key[], u32bit length) } } -/************************************************* -* Return the name of this type * -*************************************************/ +/* +* Return the name of this type +*/ std::string RC5::name() const { return "RC5(" + to_string(ROUNDS) + ")"; } -/************************************************* -* RC5 Constructor * -*************************************************/ +/* +* RC5 Constructor +*/ RC5::RC5(u32bit r) : BlockCipher(8, 1, 32), ROUNDS(r) { if(ROUNDS < 8 || ROUNDS > 32 || (ROUNDS % 4 != 0)) diff --git a/src/block/rc5/rc5.h b/src/block/rc5/rc5.h index 6fbeb7c51..083224720 100644 --- a/src/block/rc5/rc5.h +++ b/src/block/rc5/rc5.h @@ -1,7 +1,9 @@ -/************************************************* -* RC5 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* RC5 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_RC5_H__ #define BOTAN_RC5_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* RC5 * -*************************************************/ +/* +* RC5 +*/ class BOTAN_DLL RC5 : public BlockCipher { public: diff --git a/src/block/rc6/rc6.cpp b/src/block/rc6/rc6.cpp index 1295592d8..f83819614 100644 --- a/src/block/rc6/rc6.cpp +++ b/src/block/rc6/rc6.cpp @@ -1,7 +1,9 @@ -/************************************************* -* RC6 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* RC6 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/rc6.h> #include <botan/loadstor.h> @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* RC6 Encryption * -*************************************************/ +/* +* RC6 Encryption +*/ void RC6::enc(const byte in[], byte out[]) const { u32bit A = load_le<u32bit>(in, 0); @@ -52,9 +54,9 @@ void RC6::enc(const byte in[], byte out[]) const store_le(out, A, B, C, D); } -/************************************************* -* RC6 Decryption * -*************************************************/ +/* +* RC6 Decryption +*/ void RC6::dec(const byte in[], byte out[]) const { u32bit A = load_le<u32bit>(in, 0); @@ -94,9 +96,9 @@ void RC6::dec(const byte in[], byte out[]) const store_le(out, A, B, C, D); } -/************************************************* -* RC6 Key Schedule * -*************************************************/ +/* +* RC6 Key Schedule +*/ void RC6::key_schedule(const byte key[], u32bit length) { const u32bit WORD_KEYLENGTH = (((length - 1) / 4) + 1), diff --git a/src/block/rc6/rc6.h b/src/block/rc6/rc6.h index fd10070b8..cb2800be7 100644 --- a/src/block/rc6/rc6.h +++ b/src/block/rc6/rc6.h @@ -1,7 +1,9 @@ -/************************************************* -* RC6 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* RC6 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_RC6_H__ #define BOTAN_RC6_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* RC6 * -*************************************************/ +/* +* RC6 +*/ class BOTAN_DLL RC6 : public BlockCipher { public: diff --git a/src/block/safer/safe_tab.cpp b/src/block/safer/safe_tab.cpp index 06de7fa49..e265a40eb 100644 --- a/src/block/safer/safe_tab.cpp +++ b/src/block/safer/safe_tab.cpp @@ -1,7 +1,9 @@ -/************************************************* -* S-Box Tables for SAFER-SK * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* S-Box Tables for SAFER-SK +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/safer_sk.h> diff --git a/src/block/safer/safer_sk.cpp b/src/block/safer/safer_sk.cpp index 00e57e2a4..b774c91b4 100644 --- a/src/block/safer/safer_sk.cpp +++ b/src/block/safer/safer_sk.cpp @@ -1,7 +1,9 @@ -/************************************************* -* SAFER-SK Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* SAFER-SK +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/safer_sk.h> #include <botan/bit_ops.h> @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* SAFER-SK Encryption * -*************************************************/ +/* +* SAFER-SK Encryption +*/ void SAFER_SK::enc(const byte in[], byte out[]) const { byte A = in[0], B = in[1], C = in[2], D = in[3], @@ -36,9 +38,9 @@ void SAFER_SK::enc(const byte in[], byte out[]) const out[6] = G + EK[16*ROUNDS+6]; out[7] = H ^ EK[16*ROUNDS+7]; } -/************************************************* -* SAFER-SK Decryption * -*************************************************/ +/* +* SAFER-SK Decryption +*/ void SAFER_SK::dec(const byte in[], byte out[]) const { byte A = in[0], B = in[1], C = in[2], D = in[3], @@ -63,9 +65,9 @@ void SAFER_SK::dec(const byte in[], byte out[]) const out[4] = E; out[5] = F; out[6] = G; out[7] = H; } -/************************************************* -* SAFER-SK Key Schedule * -*************************************************/ +/* +* SAFER-SK Key Schedule +*/ void SAFER_SK::key_schedule(const byte key[], u32bit) { SecureBuffer<byte, 18> KB; @@ -84,25 +86,25 @@ void SAFER_SK::key_schedule(const byte key[], u32bit) } } -/************************************************* -* Return the name of this type * -*************************************************/ +/* +* Return the name of this type +*/ std::string SAFER_SK::name() const { return "SAFER-SK(" + to_string(ROUNDS) + ")"; } -/************************************************* -* Return a clone of this object * -*************************************************/ +/* +* Return a clone of this object +*/ BlockCipher* SAFER_SK::clone() const { return new SAFER_SK(ROUNDS); } -/************************************************* -* SAFER-SK Constructor * -*************************************************/ +/* +* SAFER-SK Constructor +*/ SAFER_SK::SAFER_SK(u32bit rounds) : BlockCipher(8, 16), EK(16 * rounds + 8), ROUNDS(rounds) { diff --git a/src/block/safer/safer_sk.h b/src/block/safer/safer_sk.h index 0db32e20f..e52c5837c 100644 --- a/src/block/safer/safer_sk.h +++ b/src/block/safer/safer_sk.h @@ -1,7 +1,9 @@ -/************************************************* -* SAFER-SK Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* SAFER-SK +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_SAFER_SK_H__ #define BOTAN_SAFER_SK_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* SAFER-SK * -*************************************************/ +/* +* SAFER-SK +*/ class BOTAN_DLL SAFER_SK : public BlockCipher { public: diff --git a/src/block/seed/seed.cpp b/src/block/seed/seed.cpp index 0b63ff341..b06a7cd77 100644 --- a/src/block/seed/seed.cpp +++ b/src/block/seed/seed.cpp @@ -1,25 +1,27 @@ -/************************************************* -* SEED Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* SEED +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/seed.h> #include <botan/loadstor.h> namespace Botan { -/************************************************* -* SEED G Function * -*************************************************/ +/* +* SEED G Function +*/ u32bit SEED::G_FUNC::operator()(u32bit X) const { return (S0[get_byte(3, X)] ^ S1[get_byte(2, X)] ^ S2[get_byte(1, X)] ^ S3[get_byte(0, X)]); } -/************************************************* -* SEED Encryption * -*************************************************/ +/* +* SEED Encryption +*/ void SEED::enc(const byte in[], byte out[]) const { u32bit B0 = load_be<u32bit>(in, 0); @@ -51,9 +53,9 @@ void SEED::enc(const byte in[], byte out[]) const store_be(out, B2, B3, B0, B1); } -/************************************************* -* SEED Decryption * -*************************************************/ +/* +* SEED Decryption +*/ void SEED::dec(const byte in[], byte out[]) const { u32bit B0 = load_be<u32bit>(in, 0); @@ -85,9 +87,9 @@ void SEED::dec(const byte in[], byte out[]) const store_be(out, B2, B3, B0, B1); } -/************************************************* -* SEED Key Schedule * -*************************************************/ +/* +* SEED Key Schedule +*/ void SEED::key_schedule(const byte key[], u32bit) { const u32bit RC[16] = { diff --git a/src/block/seed/seed.h b/src/block/seed/seed.h index 9f7d1cd2b..54c25d580 100644 --- a/src/block/seed/seed.h +++ b/src/block/seed/seed.h @@ -1,7 +1,9 @@ -/************************************************* -* SEED Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* SEED +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_SEED_H__ #define BOTAN_SEED_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* SEED * -*************************************************/ +/* +* SEED +*/ class BOTAN_DLL SEED : public BlockCipher { public: diff --git a/src/block/seed/seed_tab.cpp b/src/block/seed/seed_tab.cpp index 5880f0489..6ada36e52 100644 --- a/src/block/seed/seed_tab.cpp +++ b/src/block/seed/seed_tab.cpp @@ -1,7 +1,9 @@ -/************************************************* -* S-Box Tables for SEED * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* S-Box Tables for SEED +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/seed.h> diff --git a/src/block/serpent/serpent.cpp b/src/block/serpent/serpent.cpp index 07ff8b2cf..0c4589510 100644 --- a/src/block/serpent/serpent.cpp +++ b/src/block/serpent/serpent.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Serpent Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Serpent +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/serpent.h> #include <botan/loadstor.h> @@ -11,9 +13,9 @@ namespace Botan { namespace { -/************************************************* -* Serpent Encryption S-Box 1 * -*************************************************/ +/* +* Serpent Encryption S-Box 1 +*/ inline void SBoxE1(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -23,9 +25,9 @@ inline void SBoxE1(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T1; B1 = T4; B2 = T2; B3 = T0; } -/************************************************* -* Serpent Encryption S-Box 2 * -*************************************************/ +/* +* Serpent Encryption S-Box 2 +*/ inline void SBoxE2(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -35,9 +37,9 @@ inline void SBoxE2(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T2; B1 = T0; B2 = T3; B3 = T1; } -/************************************************* -* Serpent Encryption S-Box 3 * -*************************************************/ +/* +* Serpent Encryption S-Box 3 +*/ inline void SBoxE3(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -47,9 +49,9 @@ inline void SBoxE3(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T2; B1 = T3; B2 = T1; B3 = T4; } -/************************************************* -* Serpent Encryption S-Box 4 * -*************************************************/ +/* +* Serpent Encryption S-Box 4 +*/ inline void SBoxE4(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -59,9 +61,9 @@ inline void SBoxE4(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T1; B1 = T2; B2 = T3; B3 = T4; } -/************************************************* -* Serpent Encryption S-Box 5 * -*************************************************/ +/* +* Serpent Encryption S-Box 5 +*/ inline void SBoxE5(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -71,9 +73,9 @@ inline void SBoxE5(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T1; B1 = T4; B2 = T0; B3 = T3; } -/************************************************* -* Serpent Encryption S-Box 6 * -*************************************************/ +/* +* Serpent Encryption S-Box 6 +*/ inline void SBoxE6(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -83,9 +85,9 @@ inline void SBoxE6(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T1; B1 = T3; B2 = T0; B3 = T2; } -/************************************************* -* Serpent Encryption S-Box 7 * -*************************************************/ +/* +* Serpent Encryption S-Box 7 +*/ inline void SBoxE7(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -95,9 +97,9 @@ inline void SBoxE7(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T0; B1 = T1; B2 = T4; B3 = T2; } -/************************************************* -* Serpent Encryption S-Box 8 * -*************************************************/ +/* +* Serpent Encryption S-Box 8 +*/ inline void SBoxE8(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -107,9 +109,9 @@ inline void SBoxE8(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T4; B1 = T3; B2 = T1; B3 = T0; } -/************************************************* -* Serpent Decryption S-Box 1 * -*************************************************/ +/* +* Serpent Decryption S-Box 1 +*/ inline void SBoxD1(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -119,9 +121,9 @@ inline void SBoxD1(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T0; B1 = T4; B2 = T1; B3 = T3; } -/************************************************* -* Serpent Decryption S-Box 2 * -*************************************************/ +/* +* Serpent Decryption S-Box 2 +*/ inline void SBoxD2(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -131,9 +133,9 @@ inline void SBoxD2(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T4; B1 = T0; B2 = T3; B3 = T2; } -/************************************************* -* Serpent Decryption S-Box 3 * -*************************************************/ +/* +* Serpent Decryption S-Box 3 +*/ inline void SBoxD3(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -143,9 +145,9 @@ inline void SBoxD3(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T1; B1 = T4; B2 = T2; B3 = T3; } -/************************************************* -* Serpent Decryption S-Box 4 * -*************************************************/ +/* +* Serpent Decryption S-Box 4 +*/ inline void SBoxD4(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -155,9 +157,9 @@ inline void SBoxD4(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T2; B1 = T1; B2 = T3; B3 = T0; } -/************************************************* -* Serpent Decryption S-Box 5 * -*************************************************/ +/* +* Serpent Decryption S-Box 5 +*/ inline void SBoxD5(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -167,9 +169,9 @@ inline void SBoxD5(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T0; B1 = T3; B2 = T2; B3 = T4; } -/************************************************* -* Serpent Decryption S-Box 6 * -*************************************************/ +/* +* Serpent Decryption S-Box 6 +*/ inline void SBoxD6(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -179,9 +181,9 @@ inline void SBoxD6(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T1; B1 = T4; B2 = T3; B3 = T2; } -/************************************************* -* Serpent Decryption S-Box 7 * -*************************************************/ +/* +* Serpent Decryption S-Box 7 +*/ inline void SBoxD7(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -191,9 +193,9 @@ inline void SBoxD7(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T1; B1 = T2; B2 = T4; B3 = T3; } -/************************************************* -* Serpent Decryption S-Box 8 * -*************************************************/ +/* +* Serpent Decryption S-Box 8 +*/ inline void SBoxD8(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -203,9 +205,9 @@ inline void SBoxD8(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T3; B1 = T0; B2 = T1; B3 = T4; } -/************************************************* -* Serpent's Linear Transformation * -*************************************************/ +/* +* Serpent's Linear Transformation +*/ inline void transform(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { B0 = rotate_left(B0, 13); B2 = rotate_left(B2, 3); @@ -215,9 +217,9 @@ inline void transform(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = rotate_left(B0, 5); B2 = rotate_left(B2, 22); } -/************************************************* -* Serpent's Inverse Linear Transformation * -*************************************************/ +/* +* Serpent's Inverse Linear Transformation +*/ inline void i_transform(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { B2 = rotate_right(B2, 22); B0 = rotate_right(B0, 5); @@ -229,18 +231,18 @@ inline void i_transform(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) } -/************************************************* -* XOR a key block with a data block * -*************************************************/ +/* +* XOR a key block with a data block +*/ #define key_xor(round, B0, B1, B2, B3) \ B0 ^= round_key[4*round ]; \ B1 ^= round_key[4*round+1]; \ B2 ^= round_key[4*round+2]; \ B3 ^= round_key[4*round+3]; -/************************************************* -* Serpent Encryption * -*************************************************/ +/* +* Serpent Encryption +*/ void Serpent::enc(const byte in[], byte out[]) const { u32bit B0 = load_le<u32bit>(in, 0); @@ -284,9 +286,9 @@ void Serpent::enc(const byte in[], byte out[]) const store_le(out, B0, B1, B2, B3); } -/************************************************* -* Serpent Decryption * -*************************************************/ +/* +* Serpent Decryption +*/ void Serpent::dec(const byte in[], byte out[]) const { u32bit B0 = load_le<u32bit>(in, 0); @@ -330,9 +332,9 @@ void Serpent::dec(const byte in[], byte out[]) const store_le(out, B0, B1, B2, B3); } -/************************************************* -* Serpent Key Schedule * -*************************************************/ +/* +* Serpent Key Schedule +*/ void Serpent::key_schedule(const byte key[], u32bit length) { const u32bit PHI = 0x9E3779B9; diff --git a/src/block/serpent/serpent.h b/src/block/serpent/serpent.h index fd26d9f7f..5b9be257f 100644 --- a/src/block/serpent/serpent.h +++ b/src/block/serpent/serpent.h @@ -1,7 +1,9 @@ -/************************************************* -* Serpent Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Serpent +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_SERPENT_H__ #define BOTAN_SERPENT_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Serpent * -*************************************************/ +/* +* Serpent +*/ class BOTAN_DLL Serpent : public BlockCipher { public: diff --git a/src/block/serpent_ia32/serp_ia32.cpp b/src/block/serpent_ia32/serp_ia32.cpp index ec7574799..37dd4e637 100644 --- a/src/block/serpent_ia32/serp_ia32.cpp +++ b/src/block/serpent_ia32/serp_ia32.cpp @@ -1,7 +1,9 @@ -/************************************************* -* IA-32 Serpent Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* IA-32 Serpent +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/serp_ia32.h> #include <botan/loadstor.h> @@ -16,25 +18,25 @@ void botan_serpent_ia32_key_schedule(u32bit[140]); } -/************************************************* -* Serpent Encryption * -*************************************************/ +/* +* Serpent Encryption +*/ void Serpent_IA32::enc(const byte in[], byte out[]) const { botan_serpent_ia32_encrypt(in, out, round_key); } -/************************************************* -* Serpent Decryption * -*************************************************/ +/* +* Serpent Decryption +*/ void Serpent_IA32::dec(const byte in[], byte out[]) const { botan_serpent_ia32_decrypt(in, out, round_key); } -/************************************************* -* Serpent Key Schedule * -*************************************************/ +/* +* Serpent Key Schedule +*/ void Serpent_IA32::key_schedule(const byte key[], u32bit length) { SecureBuffer<u32bit, 140> W; diff --git a/src/block/serpent_ia32/serp_ia32.h b/src/block/serpent_ia32/serp_ia32.h index 4afa6a305..565e9889d 100644 --- a/src/block/serpent_ia32/serp_ia32.h +++ b/src/block/serpent_ia32/serp_ia32.h @@ -1,7 +1,9 @@ -/************************************************* -* Serpent (IA-32) Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Serpent (IA-32) +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_SERPENT_IA32_H__ #define BOTAN_SERPENT_IA32_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Serpent * -*************************************************/ +/* +* Serpent +*/ class BOTAN_DLL Serpent_IA32 : public Serpent { public: diff --git a/src/block/skipjack/skipjack.cpp b/src/block/skipjack/skipjack.cpp index 62918a3fd..f5ffc861e 100644 --- a/src/block/skipjack/skipjack.cpp +++ b/src/block/skipjack/skipjack.cpp @@ -1,16 +1,18 @@ -/************************************************* -* Skipjack Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Skipjack +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/skipjack.h> #include <botan/loadstor.h> namespace Botan { -/************************************************* -* Skipjack Encryption * -*************************************************/ +/* +* Skipjack Encryption +*/ void Skipjack::enc(const byte in[], byte out[]) const { u16bit W1 = load_le<u16bit>(in, 3); @@ -33,9 +35,9 @@ void Skipjack::enc(const byte in[], byte out[]) const store_le(out, W4, W3, W2, W1); } -/************************************************* -* Skipjack Decryption * -*************************************************/ +/* +* Skipjack Decryption +*/ void Skipjack::dec(const byte in[], byte out[]) const { u16bit W1 = load_le<u16bit>(in, 3); @@ -58,9 +60,9 @@ void Skipjack::dec(const byte in[], byte out[]) const store_le(out, W4, W3, W2, W1); } -/************************************************* -* Skipjack Stepping Rule 'A' * -*************************************************/ +/* +* Skipjack Stepping Rule 'A' +*/ void Skipjack::step_A(u16bit& W1, u16bit& W4, u32bit round) const { byte G1 = get_byte(0, W1), G2 = get_byte(1, W1), G3; @@ -72,9 +74,9 @@ void Skipjack::step_A(u16bit& W1, u16bit& W4, u32bit round) const W4 ^= W1 ^ round; } -/************************************************* -* Skipjack Stepping Rule 'B' * -*************************************************/ +/* +* Skipjack Stepping Rule 'B' +*/ void Skipjack::step_B(u16bit& W1, u16bit& W2, u32bit round) const { W2 ^= W1 ^ round; @@ -86,9 +88,9 @@ void Skipjack::step_B(u16bit& W1, u16bit& W2, u32bit round) const W1 = make_u16bit(G2, G3); } -/************************************************* -* Skipjack Invserse Stepping Rule 'A' * -*************************************************/ +/* +* Skipjack Invserse Stepping Rule 'A' +*/ void Skipjack::step_Ai(u16bit& W1, u16bit& W2, u32bit round) const { W1 ^= W2 ^ round; @@ -100,9 +102,9 @@ void Skipjack::step_Ai(u16bit& W1, u16bit& W2, u32bit round) const W2 = make_u16bit(G3, G2); } -/************************************************* -* Skipjack Invserse Stepping Rule 'B' * -*************************************************/ +/* +* Skipjack Invserse Stepping Rule 'B' +*/ void Skipjack::step_Bi(u16bit& W2, u16bit& W3, u32bit round) const { byte G1 = get_byte(1, W2), G2 = get_byte(0, W2), G3; @@ -114,9 +116,9 @@ void Skipjack::step_Bi(u16bit& W2, u16bit& W3, u32bit round) const W3 ^= W2 ^ round; } -/************************************************* -* Skipjack Key Schedule * -*************************************************/ +/* +* Skipjack Key Schedule +*/ void Skipjack::key_schedule(const byte key[], u32bit) { static const byte F[256] = { @@ -148,9 +150,9 @@ void Skipjack::key_schedule(const byte key[], u32bit) FTABLE[j][k] = F[k ^ key[9-j]]; } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void Skipjack::clear() throw() { for(u32bit j = 0; j != 10; ++j) diff --git a/src/block/skipjack/skipjack.h b/src/block/skipjack/skipjack.h index 2d8956215..231cd9c87 100644 --- a/src/block/skipjack/skipjack.h +++ b/src/block/skipjack/skipjack.h @@ -1,7 +1,9 @@ -/************************************************* -* Skipjack Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Skipjack +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_SKIPJACK_H__ #define BOTAN_SKIPJACK_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Skipjack * -*************************************************/ +/* +* Skipjack +*/ class BOTAN_DLL Skipjack : public BlockCipher { public: diff --git a/src/block/square/sqr_tab.cpp b/src/block/square/sqr_tab.cpp index 248ace4cd..331bf3ea1 100644 --- a/src/block/square/sqr_tab.cpp +++ b/src/block/square/sqr_tab.cpp @@ -1,7 +1,9 @@ -/************************************************* -* S-Box and Diffusion Tables for Square * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* S-Box and Diffusion Tables for Square +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/square.h> diff --git a/src/block/square/square.cpp b/src/block/square/square.cpp index 44fb26bfd..5aaef6ee4 100644 --- a/src/block/square/square.cpp +++ b/src/block/square/square.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Square Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Square +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/square.h> #include <botan/loadstor.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* Square Encryption * -*************************************************/ +/* +* Square Encryption +*/ void Square::enc(const byte in[], byte out[]) const { u32bit T0, T1, T2, T3, B0, B1, B2, B3; @@ -60,9 +62,9 @@ void Square::enc(const byte in[], byte out[]) const out[15] = SE[get_byte(3, B3)] ^ ME[31]; } -/************************************************* -* Square Decryption * -*************************************************/ +/* +* Square Decryption +*/ void Square::dec(const byte in[], byte out[]) const { u32bit T0, T1, T2, T3, B0, B1, B2, B3; @@ -111,9 +113,9 @@ void Square::dec(const byte in[], byte out[]) const out[15] = SD[get_byte(3, B3)] ^ MD[31]; } -/************************************************* -* Square Key Schedule * -*************************************************/ +/* +* Square Key Schedule +*/ void Square::key_schedule(const byte key[], u32bit) { SecureBuffer<u32bit, 36> XEK, XDK; @@ -140,9 +142,9 @@ void Square::key_schedule(const byte key[], u32bit) DK.copy(XDK + 4, 28); } -/************************************************* -* Square's Inverse Linear Transformation * -*************************************************/ +/* +* Square's Inverse Linear Transformation +*/ void Square::transform(u32bit round_key[4]) { static const byte G[4][4] = { @@ -171,9 +173,9 @@ void Square::transform(u32bit round_key[4]) } } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void Square::clear() throw() { EK.clear(); diff --git a/src/block/square/square.h b/src/block/square/square.h index 4c4d89100..94a1fc370 100644 --- a/src/block/square/square.h +++ b/src/block/square/square.h @@ -1,7 +1,9 @@ -/************************************************* -* Square Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Square +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_SQUARE_H__ #define BOTAN_SQUARE_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Square * -*************************************************/ +/* +* Square +*/ class BOTAN_DLL Square : public BlockCipher { public: diff --git a/src/block/tea/tea.cpp b/src/block/tea/tea.cpp index 7b79d86d1..2b4212d9c 100644 --- a/src/block/tea/tea.cpp +++ b/src/block/tea/tea.cpp @@ -1,16 +1,18 @@ -/************************************************* -* TEA Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* TEA +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/tea.h> #include <botan/loadstor.h> namespace Botan { -/************************************************* -* TEA Encryption * -*************************************************/ +/* +* TEA Encryption +*/ void TEA::enc(const byte in[], byte out[]) const { u32bit L = load_be<u32bit>(in, 0), R = load_be<u32bit>(in, 1); @@ -26,9 +28,9 @@ void TEA::enc(const byte in[], byte out[]) const store_be(out, L, R); } -/************************************************* -* TEA Decryption * -*************************************************/ +/* +* TEA Decryption +*/ void TEA::dec(const byte in[], byte out[]) const { u32bit L = load_be<u32bit>(in, 0), R = load_be<u32bit>(in, 1); @@ -44,9 +46,9 @@ void TEA::dec(const byte in[], byte out[]) const store_be(out, L, R); } -/************************************************* -* TEA Key Schedule * -*************************************************/ +/* +* TEA Key Schedule +*/ void TEA::key_schedule(const byte key[], u32bit) { for(u32bit j = 0; j != 4; ++j) diff --git a/src/block/tea/tea.h b/src/block/tea/tea.h index b751eda4e..8ddf3e330 100644 --- a/src/block/tea/tea.h +++ b/src/block/tea/tea.h @@ -1,7 +1,9 @@ -/************************************************* -* TEA Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* TEA +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_TEA_H__ #define BOTAN_TEA_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* TEA * -*************************************************/ +/* +* TEA +*/ class BOTAN_DLL TEA : public BlockCipher { public: diff --git a/src/block/twofish/two_tab.cpp b/src/block/twofish/two_tab.cpp index 7d349312b..19ba58de6 100644 --- a/src/block/twofish/two_tab.cpp +++ b/src/block/twofish/two_tab.cpp @@ -1,7 +1,9 @@ -/************************************************* -* S-Box and MDS Tables for Twofish * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* S-Box and MDS Tables for Twofish +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/twofish.h> diff --git a/src/block/twofish/twofish.cpp b/src/block/twofish/twofish.cpp index d6bab2fc5..edc476d15 100644 --- a/src/block/twofish/twofish.cpp +++ b/src/block/twofish/twofish.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Twofish Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Twofish +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/twofish.h> #include <botan/loadstor.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* Twofish Encryption * -*************************************************/ +/* +* Twofish Encryption +*/ void Twofish::enc(const byte in[], byte out[]) const { u32bit A = load_le<u32bit>(in, 0) ^ round_key[0]; @@ -54,9 +56,9 @@ void Twofish::enc(const byte in[], byte out[]) const store_le(out, C, D, A, B); } -/************************************************* -* Twofish Decryption * -*************************************************/ +/* +* Twofish Decryption +*/ void Twofish::dec(const byte in[], byte out[]) const { u32bit A = load_le<u32bit>(in, 0) ^ round_key[4]; @@ -99,9 +101,9 @@ void Twofish::dec(const byte in[], byte out[]) const store_le(out, C, D, A, B); } -/************************************************* -* Twofish Key Schedule * -*************************************************/ +/* +* Twofish Key Schedule +*/ void Twofish::key_schedule(const byte key[], u32bit length) { SecureBuffer<byte, 16> S; @@ -180,9 +182,9 @@ void Twofish::key_schedule(const byte key[], u32bit length) } } -/************************************************* -* Do one column of the RS matrix multiplcation * -*************************************************/ +/* +* Do one column of the RS matrix multiplcation +*/ void Twofish::rs_mul(byte S[4], byte key, u32bit offset) { if(key) @@ -201,9 +203,9 @@ void Twofish::rs_mul(byte S[4], byte key, u32bit offset) } } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void Twofish::clear() throw() { SBox0.clear(); diff --git a/src/block/twofish/twofish.h b/src/block/twofish/twofish.h index 39f0a6121..0640e32f8 100644 --- a/src/block/twofish/twofish.h +++ b/src/block/twofish/twofish.h @@ -1,7 +1,9 @@ -/************************************************* -* Twofish Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Twofish +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_TWOFISH_H__ #define BOTAN_TWOFISH_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Twofish * -*************************************************/ +/* +* Twofish +*/ class BOTAN_DLL Twofish : public BlockCipher { public: diff --git a/src/block/xtea/xtea.cpp b/src/block/xtea/xtea.cpp index d13173f02..1b24dd159 100644 --- a/src/block/xtea/xtea.cpp +++ b/src/block/xtea/xtea.cpp @@ -1,7 +1,9 @@ -/************************************************* -* XTEA Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* XTEA +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/xtea.h> #include <botan/loadstor.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* XTEA Encryption * -*************************************************/ +/* +* XTEA Encryption +*/ void XTEA::enc(const byte in[], byte out[]) const { u32bit L = load_be<u32bit>(in, 0), R = load_be<u32bit>(in, 1); @@ -25,9 +27,9 @@ void XTEA::enc(const byte in[], byte out[]) const store_be(out, L, R); } -/************************************************* -* XTEA Decryption * -*************************************************/ +/* +* XTEA Decryption +*/ void XTEA::dec(const byte in[], byte out[]) const { u32bit L = load_be<u32bit>(in, 0), R = load_be<u32bit>(in, 1); @@ -41,9 +43,9 @@ void XTEA::dec(const byte in[], byte out[]) const store_be(out, L, R); } -/************************************************* -* XTEA Key Schedule * -*************************************************/ +/* +* XTEA Key Schedule +*/ void XTEA::key_schedule(const byte key[], u32bit) { static const u32bit DELTAS[64] = { diff --git a/src/block/xtea/xtea.h b/src/block/xtea/xtea.h index 630da4064..d9c6066cb 100644 --- a/src/block/xtea/xtea.h +++ b/src/block/xtea/xtea.h @@ -1,7 +1,9 @@ -/************************************************* -* XTEA Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* XTEA +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_XTEA_H__ #define BOTAN_XTEA_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* XTEA * -*************************************************/ +/* +* XTEA +*/ class BOTAN_DLL XTEA : public BlockCipher { public: |