aboutsummaryrefslogtreecommitdiffstats
path: root/src/mac/cmac
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-10-12 23:29:55 +0000
committerlloyd <[email protected]>2010-10-12 23:29:55 +0000
commit2af9ba577730f071eef44b3ba492c3bfad0a8ec6 (patch)
tree92a4c4e973756225d42bb99a99110b2669be7299 /src/mac/cmac
parent97e8d6086171772cd5e45bcf2f5b1ea1e38e6bf5 (diff)
Use size_t for BufferedComputation::add_data
Diffstat (limited to 'src/mac/cmac')
-rw-r--r--src/mac/cmac/cmac.cpp12
-rw-r--r--src/mac/cmac/cmac.h4
2 files changed, 8 insertions, 8 deletions
diff --git a/src/mac/cmac/cmac.cpp b/src/mac/cmac/cmac.cpp
index 38b62c6cb..05fa7d037 100644
--- a/src/mac/cmac/cmac.cpp
+++ b/src/mac/cmac/cmac.cpp
@@ -21,10 +21,10 @@ SecureVector<byte> CMAC::poly_double(const MemoryRegion<byte>& in,
SecureVector<byte> out = in;
byte carry = 0;
- for(u32bit j = out.size(); j != 0; --j)
+ for(size_t i = out.size(); i != 0; --i)
{
- byte temp = out[j-1];
- out[j-1] = (temp << 1) | carry;
+ byte temp = out[i-1];
+ out[i-1] = (temp << 1) | carry;
carry = (temp >> 7);
}
@@ -37,7 +37,7 @@ SecureVector<byte> CMAC::poly_double(const MemoryRegion<byte>& in,
/*
* Update an CMAC Calculation
*/
-void CMAC::add_data(const byte input[], u32bit length)
+void CMAC::add_data(const byte input[], size_t length)
{
buffer.copy(position, input, length);
if(position + length > OUTPUT_LENGTH)
@@ -78,8 +78,8 @@ void CMAC::final_result(byte mac[])
e->encrypt(state);
- for(u32bit j = 0; j != OUTPUT_LENGTH; ++j)
- mac[j] = state[j];
+ for(size_t i = 0; i != OUTPUT_LENGTH; ++i)
+ mac[i] = state[i];
zeroise(state);
zeroise(buffer);
diff --git a/src/mac/cmac/cmac.h b/src/mac/cmac/cmac.h
index b5f3eec1a..5655e1eea 100644
--- a/src/mac/cmac/cmac.h
+++ b/src/mac/cmac/cmac.h
@@ -37,13 +37,13 @@ class BOTAN_DLL CMAC : public MessageAuthenticationCode
CMAC(BlockCipher* cipher);
~CMAC();
private:
- void add_data(const byte[], u32bit);
+ void add_data(const byte[], size_t);
void final_result(byte[]);
void key_schedule(const byte[], u32bit);
BlockCipher* e;
SecureVector<byte> buffer, state, B, P;
- u32bit position;
+ size_t position;
byte polynomial;
};