diff options
Diffstat (limited to 'src/mac')
-rw-r--r-- | src/mac/cbc_mac/cbc_mac.cpp | 58 | ||||
-rw-r--r-- | src/mac/cbc_mac/cbc_mac.h | 16 | ||||
-rw-r--r-- | src/mac/cmac/cmac.cpp | 64 | ||||
-rw-r--r-- | src/mac/cmac/cmac.h | 16 | ||||
-rw-r--r-- | src/mac/hmac/hmac.cpp | 54 | ||||
-rw-r--r-- | src/mac/hmac/hmac.h | 16 | ||||
-rw-r--r-- | src/mac/mac.cpp | 2 | ||||
-rw-r--r-- | src/mac/mac.h | 2 | ||||
-rw-r--r-- | src/mac/ssl3mac/ssl3_mac.cpp | 52 | ||||
-rw-r--r-- | src/mac/ssl3mac/ssl3_mac.h | 16 | ||||
-rw-r--r-- | src/mac/x919_mac/x919_mac.cpp | 46 | ||||
-rw-r--r-- | src/mac/x919_mac/x919_mac.h | 10 |
12 files changed, 188 insertions, 164 deletions
diff --git a/src/mac/cbc_mac/cbc_mac.cpp b/src/mac/cbc_mac/cbc_mac.cpp index cbbf77991..f5d9e1567 100644 --- a/src/mac/cbc_mac/cbc_mac.cpp +++ b/src/mac/cbc_mac/cbc_mac.cpp @@ -1,7 +1,9 @@ -/************************************************* -* CBC-MAC Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CBC-MAC +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/cbc_mac.h> #include <botan/xor_buf.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* Update an CBC-MAC Calculation * -*************************************************/ +/* +* Update an CBC-MAC Calculation +*/ void CBC_MAC::add_data(const byte input[], u32bit length) { u32bit xored = std::min(OUTPUT_LENGTH - position, length); @@ -36,9 +38,9 @@ void CBC_MAC::add_data(const byte input[], u32bit length) position = length; } -/************************************************* -* Finalize an CBC-MAC Calculation * -*************************************************/ +/* +* Finalize an CBC-MAC Calculation +*/ void CBC_MAC::final_result(byte mac[]) { if(position) @@ -49,17 +51,17 @@ void CBC_MAC::final_result(byte mac[]) position = 0; } -/************************************************* -* CBC-MAC Key Schedule * -*************************************************/ +/* +* CBC-MAC Key Schedule +*/ void CBC_MAC::key_schedule(const byte key[], u32bit length) { e->set_key(key, length); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void CBC_MAC::clear() throw() { e->clear(); @@ -67,25 +69,25 @@ void CBC_MAC::clear() throw() position = 0; } -/************************************************* -* Return the name of this type * -*************************************************/ +/* +* Return the name of this type +*/ std::string CBC_MAC::name() const { return "CBC-MAC(" + e->name() + ")"; } -/************************************************* -* Return a clone of this object * -*************************************************/ +/* +* Return a clone of this object +*/ MessageAuthenticationCode* CBC_MAC::clone() const { return new CBC_MAC(e->clone()); } -/************************************************* -* CBC-MAC Constructor * -*************************************************/ +/* +* CBC-MAC Constructor +*/ CBC_MAC::CBC_MAC(BlockCipher* e_in) : MessageAuthenticationCode(e_in->BLOCK_SIZE, e_in->MINIMUM_KEYLENGTH, @@ -96,9 +98,9 @@ CBC_MAC::CBC_MAC(BlockCipher* e_in) : position = 0; } -/************************************************* -* CBC-MAC Destructor * -*************************************************/ +/* +* CBC-MAC Destructor +*/ CBC_MAC::~CBC_MAC() { delete e; diff --git a/src/mac/cbc_mac/cbc_mac.h b/src/mac/cbc_mac/cbc_mac.h index 1112970d6..d17d792d3 100644 --- a/src/mac/cbc_mac/cbc_mac.h +++ b/src/mac/cbc_mac/cbc_mac.h @@ -1,7 +1,9 @@ -/************************************************* -* CBC-MAC Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CBC-MAC +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_CBC_MAC_H__ #define BOTAN_CBC_MAC_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* CBC-MAC * -*************************************************/ +/* +* CBC-MAC +*/ class BOTAN_DLL CBC_MAC : public MessageAuthenticationCode { public: diff --git a/src/mac/cmac/cmac.cpp b/src/mac/cmac/cmac.cpp index bd3f174c1..84aa61e03 100644 --- a/src/mac/cmac/cmac.cpp +++ b/src/mac/cmac/cmac.cpp @@ -1,16 +1,18 @@ -/************************************************* -* CMAC Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CMAC +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/cmac.h> #include <botan/xor_buf.h> namespace Botan { -/************************************************* -* Perform CMAC's multiplication in GF(2^n) * -*************************************************/ +/* +* Perform CMAC's multiplication in GF(2^n) +*/ SecureVector<byte> CMAC::poly_double(const MemoryRegion<byte>& in, byte polynomial) { @@ -32,9 +34,9 @@ SecureVector<byte> CMAC::poly_double(const MemoryRegion<byte>& in, return out; } -/************************************************* -* Update an CMAC Calculation * -*************************************************/ +/* +* Update an CMAC Calculation +*/ void CMAC::add_data(const byte input[], u32bit length) { buffer.copy(position, input, length); @@ -57,9 +59,9 @@ void CMAC::add_data(const byte input[], u32bit length) position += length; } -/************************************************* -* Finalize an CMAC Calculation * -*************************************************/ +/* +* Finalize an CMAC Calculation +*/ void CMAC::final_result(byte mac[]) { xor_buf(state, buffer, position); @@ -84,9 +86,9 @@ void CMAC::final_result(byte mac[]) position = 0; } -/************************************************* -* CMAC Key Schedule * -*************************************************/ +/* +* CMAC Key Schedule +*/ void CMAC::key_schedule(const byte key[], u32bit length) { clear(); @@ -96,9 +98,9 @@ void CMAC::key_schedule(const byte key[], u32bit length) P = poly_double(B, polynomial); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void CMAC::clear() throw() { e->clear(); @@ -109,25 +111,25 @@ void CMAC::clear() throw() position = 0; } -/************************************************* -* Return the name of this type * -*************************************************/ +/* +* Return the name of this type +*/ std::string CMAC::name() const { return "CMAC(" + e->name() + ")"; } -/************************************************* -* Return a clone of this object * -*************************************************/ +/* +* Return a clone of this object +*/ MessageAuthenticationCode* CMAC::clone() const { return new CMAC(e->clone()); } -/************************************************* -* CMAC Constructor * -*************************************************/ +/* +* CMAC Constructor +*/ CMAC::CMAC(BlockCipher* e_in) : MessageAuthenticationCode(e_in->BLOCK_SIZE, e_in->MINIMUM_KEYLENGTH, @@ -149,9 +151,9 @@ CMAC::CMAC(BlockCipher* e_in) : position = 0; } -/************************************************* -* CMAC Destructor * -*************************************************/ +/* +* CMAC Destructor +*/ CMAC::~CMAC() { delete e; diff --git a/src/mac/cmac/cmac.h b/src/mac/cmac/cmac.h index 9f745ee22..5a6deb7b0 100644 --- a/src/mac/cmac/cmac.h +++ b/src/mac/cmac/cmac.h @@ -1,7 +1,9 @@ -/************************************************* -* CMAC Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CMAC +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_CMAC_H__ #define BOTAN_CMAC_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* CMAC * -*************************************************/ +/* +* CMAC +*/ class BOTAN_DLL CMAC : public MessageAuthenticationCode { public: diff --git a/src/mac/hmac/hmac.cpp b/src/mac/hmac/hmac.cpp index 15552b8ea..717e2640c 100644 --- a/src/mac/hmac/hmac.cpp +++ b/src/mac/hmac/hmac.cpp @@ -1,25 +1,27 @@ -/************************************************* -* HMAC Source File * -* (C) 1999-2007 Jack Lloyd * -* 2007 Yves Jerschow * -*************************************************/ +/* +* HMAC +* (C) 1999-2007 Jack Lloyd +* 2007 Yves Jerschow +* +* Distributed under the terms of the Botan license +*/ #include <botan/hmac.h> #include <botan/xor_buf.h> namespace Botan { -/************************************************* -* Update a HMAC Calculation * -*************************************************/ +/* +* Update a HMAC Calculation +*/ void HMAC::add_data(const byte input[], u32bit length) { hash->update(input, length); } -/************************************************* -* Finalize a HMAC Calculation * -*************************************************/ +/* +* Finalize a HMAC Calculation +*/ void HMAC::final_result(byte mac[]) { hash->final(mac); @@ -29,9 +31,9 @@ void HMAC::final_result(byte mac[]) hash->update(i_key); } -/************************************************* -* HMAC Key Schedule * -*************************************************/ +/* +* HMAC Key Schedule +*/ void HMAC::key_schedule(const byte key[], u32bit length) { hash->clear(); @@ -53,9 +55,9 @@ void HMAC::key_schedule(const byte key[], u32bit length) hash->update(i_key); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void HMAC::clear() throw() { hash->clear(); @@ -63,25 +65,25 @@ void HMAC::clear() throw() o_key.clear(); } -/************************************************* -* Return the name of this type * -*************************************************/ +/* +* Return the name of this type +*/ std::string HMAC::name() const { return "HMAC(" + hash->name() + ")"; } -/************************************************* -* Return a clone of this object * -*************************************************/ +/* +* Return a clone of this object +*/ MessageAuthenticationCode* HMAC::clone() const { return new HMAC(hash->clone()); } -/************************************************* -* HMAC Constructor * -*************************************************/ +/* +* HMAC Constructor +*/ HMAC::HMAC(HashFunction* hash_in) : MessageAuthenticationCode(hash_in->OUTPUT_LENGTH, 1, 2*hash_in->HASH_BLOCK_SIZE), diff --git a/src/mac/hmac/hmac.h b/src/mac/hmac/hmac.h index c3081edfd..932af71fc 100644 --- a/src/mac/hmac/hmac.h +++ b/src/mac/hmac/hmac.h @@ -1,7 +1,9 @@ -/************************************************* -* HMAC Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* HMAC +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_HMAC_H__ #define BOTAN_HMAC_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* HMAC * -*************************************************/ +/* +* HMAC +*/ class BOTAN_DLL HMAC : public MessageAuthenticationCode { public: diff --git a/src/mac/mac.cpp b/src/mac/mac.cpp index 63be1ea17..96df25503 100644 --- a/src/mac/mac.cpp +++ b/src/mac/mac.cpp @@ -1,6 +1,8 @@ /** Message Authentication Code base class (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/mac.h> diff --git a/src/mac/mac.h b/src/mac/mac.h index ff5939f6e..3ec5fff5f 100644 --- a/src/mac/mac.h +++ b/src/mac/mac.h @@ -1,6 +1,8 @@ /** * Base class for message authentiction codes * (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_MESSAGE_AUTH_CODE_BASE_H__ diff --git a/src/mac/ssl3mac/ssl3_mac.cpp b/src/mac/ssl3mac/ssl3_mac.cpp index 8bd22a779..c29296ced 100644 --- a/src/mac/ssl3mac/ssl3_mac.cpp +++ b/src/mac/ssl3mac/ssl3_mac.cpp @@ -1,23 +1,25 @@ -/************************************************* -* SSL3-MAC Source File * -* (C) 1999-2004 Jack Lloyd * -*************************************************/ +/* +* SSL3-MAC +* (C) 1999-2004 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/ssl3_mac.h> namespace Botan { -/************************************************* -* Update a SSL3-MAC Calculation * -*************************************************/ +/* +* Update a SSL3-MAC Calculation +*/ void SSL3_MAC::add_data(const byte input[], u32bit length) { hash->update(input, length); } -/************************************************* -* Finalize a SSL3-MAC Calculation * -*************************************************/ +/* +* Finalize a SSL3-MAC Calculation +*/ void SSL3_MAC::final_result(byte mac[]) { hash->final(mac); @@ -27,9 +29,9 @@ void SSL3_MAC::final_result(byte mac[]) hash->update(i_key); } -/************************************************* -* SSL3-MAC Key Schedule * -*************************************************/ +/* +* SSL3-MAC Key Schedule +*/ void SSL3_MAC::key_schedule(const byte key[], u32bit length) { hash->clear(); @@ -41,9 +43,9 @@ void SSL3_MAC::key_schedule(const byte key[], u32bit length) hash->update(i_key); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void SSL3_MAC::clear() throw() { hash->clear(); @@ -51,25 +53,25 @@ void SSL3_MAC::clear() throw() o_key.clear(); } -/************************************************* -* Return the name of this type * -*************************************************/ +/* +* Return the name of this type +*/ std::string SSL3_MAC::name() const { return "SSL3-MAC(" + hash->name() + ")"; } -/************************************************* -* Return a clone of this object * -*************************************************/ +/* +* Return a clone of this object +*/ MessageAuthenticationCode* SSL3_MAC::clone() const { return new SSL3_MAC(hash->clone()); } -/************************************************* -* SSL3-MAC Constructor * -*************************************************/ +/* +* SSL3-MAC Constructor +*/ SSL3_MAC::SSL3_MAC(HashFunction* hash_in) : MessageAuthenticationCode(hash_in->OUTPUT_LENGTH, hash_in->OUTPUT_LENGTH), diff --git a/src/mac/ssl3mac/ssl3_mac.h b/src/mac/ssl3mac/ssl3_mac.h index fad9e74cd..dcaf7f404 100644 --- a/src/mac/ssl3mac/ssl3_mac.h +++ b/src/mac/ssl3mac/ssl3_mac.h @@ -1,7 +1,9 @@ -/************************************************* -* SSL3-MAC Header File * -* (C) 1999-2004 Jack Lloyd * -*************************************************/ +/* +* SSL3-MAC +* (C) 1999-2004 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_SSL3_MAC_H__ #define BOTAN_SSL3_MAC_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* SSL3-MAC * -*************************************************/ +/* +* SSL3-MAC +*/ class BOTAN_DLL SSL3_MAC : public MessageAuthenticationCode { public: diff --git a/src/mac/x919_mac/x919_mac.cpp b/src/mac/x919_mac/x919_mac.cpp index 9db32c8a2..ef89cac9c 100644 --- a/src/mac/x919_mac/x919_mac.cpp +++ b/src/mac/x919_mac/x919_mac.cpp @@ -1,7 +1,9 @@ -/************************************************* -* ANSI X9.19 MAC Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* ANSI X9.19 MAC +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/x919_mac.h> #include <botan/xor_buf.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* Update an ANSI X9.19 MAC Calculation * -*************************************************/ +/* +* Update an ANSI X9.19 MAC Calculation +*/ void ANSI_X919_MAC::add_data(const byte input[], u32bit length) { u32bit xored = std::min(8 - position, length); @@ -35,9 +37,9 @@ void ANSI_X919_MAC::add_data(const byte input[], u32bit length) position = length; } -/************************************************* -* Finalize an ANSI X9.19 MAC Calculation * -*************************************************/ +/* +* Finalize an ANSI X9.19 MAC Calculation +*/ void ANSI_X919_MAC::final_result(byte mac[]) { if(position) @@ -48,9 +50,9 @@ void ANSI_X919_MAC::final_result(byte mac[]) position = 0; } -/************************************************* -* ANSI X9.19 MAC Key Schedule * -*************************************************/ +/* +* ANSI X9.19 MAC Key Schedule +*/ void ANSI_X919_MAC::key_schedule(const byte key[], u32bit length) { e->set_key(key, 8); @@ -58,9 +60,9 @@ void ANSI_X919_MAC::key_schedule(const byte key[], u32bit length) else d->set_key(key + 8, 8); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void ANSI_X919_MAC::clear() throw() { e->clear(); @@ -79,9 +81,9 @@ MessageAuthenticationCode* ANSI_X919_MAC::clone() const return new ANSI_X919_MAC(e->clone()); } -/************************************************* -* ANSI X9.19 MAC Constructor * -*************************************************/ +/* +* ANSI X9.19 MAC Constructor +*/ ANSI_X919_MAC::ANSI_X919_MAC(BlockCipher* e_in) : MessageAuthenticationCode(e_in->BLOCK_SIZE, e_in->MINIMUM_KEYLENGTH, @@ -93,9 +95,9 @@ ANSI_X919_MAC::ANSI_X919_MAC(BlockCipher* e_in) : throw Invalid_Argument("ANSI X9.19 MAC only supports DES"); } -/************************************************* -* ANSI X9.19 MAC Destructor * -le*************************************************/ +/* +* ANSI X9.19 MAC Destructor +le*/ ANSI_X919_MAC::~ANSI_X919_MAC() { delete e; diff --git a/src/mac/x919_mac/x919_mac.h b/src/mac/x919_mac/x919_mac.h index a2a40e3ca..1c2a06bee 100644 --- a/src/mac/x919_mac/x919_mac.h +++ b/src/mac/x919_mac/x919_mac.h @@ -1,7 +1,9 @@ -/************************************************* -* ANSI X9.19 MAC Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* ANSI X9.19 MAC +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_ANSI_X919_MAC_H__ #define BOTAN_ANSI_X919_MAC_H__ |