aboutsummaryrefslogtreecommitdiffstats
path: root/src/mac/cmac
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-03-30 18:27:18 +0000
committerlloyd <[email protected]>2009-03-30 18:27:18 +0000
commit96d6eb6f29c55e16a37cf11899547886f735b065 (patch)
tree9f13901e9b44c98d58b2589c9b09c6a7443eb7cd /src/mac/cmac
parent3cc3dd72c5f87b76852a55c1f2d1821dba967d8c (diff)
Thomas Moschny passed along a request from the Fedora packagers which came
up during the Fedora submission review, that each source file include some text about the license. One handy Perl script later and each file now has the line Distributed under the terms of the Botan license after the copyright notices. While I was in there modifying every file anyway, I also stripped out the remainder of the block comments (lots of astericks before and after the text); this is stylistic thing I picked up when I was first learning C++ but in retrospect it is not a good style as the structure makes it harder to modify comments (with the result that comments become fewer, shorter and are less likely to be updated, which are not good things).
Diffstat (limited to 'src/mac/cmac')
-rw-r--r--src/mac/cmac/cmac.cpp64
-rw-r--r--src/mac/cmac/cmac.h16
2 files changed, 42 insertions, 38 deletions
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: