aboutsummaryrefslogtreecommitdiffstats
path: root/src/pk_pad/eme1
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-10-12 20:00:20 +0000
committerlloyd <[email protected]>2010-10-12 20:00:20 +0000
commit9abeb56f7d355b8ff86cbb465ba1e0a08257ec12 (patch)
tree034f8a50d241c996e6ea1889e68a8650085bf2ff /src/pk_pad/eme1
parent39306575081f043d1c79ade43797d3595fd5aeec (diff)
Use size_t instead of u32bit in pk_pad
Diffstat (limited to 'src/pk_pad/eme1')
-rw-r--r--src/pk_pad/eme1/eme1.cpp14
-rw-r--r--src/pk_pad/eme1/eme1.h8
2 files changed, 11 insertions, 11 deletions
diff --git a/src/pk_pad/eme1/eme1.cpp b/src/pk_pad/eme1/eme1.cpp
index 4352231c9..4ad47f41a 100644
--- a/src/pk_pad/eme1/eme1.cpp
+++ b/src/pk_pad/eme1/eme1.cpp
@@ -15,8 +15,8 @@ namespace Botan {
/*
* EME1 Pad Operation
*/
-SecureVector<byte> EME1::pad(const byte in[], u32bit in_length,
- u32bit key_length,
+SecureVector<byte> EME1::pad(const byte in[], size_t in_length,
+ size_t key_length,
RandomNumberGenerator& rng) const
{
key_length /= 8;
@@ -44,8 +44,8 @@ SecureVector<byte> EME1::pad(const byte in[], u32bit in_length,
/*
* EME1 Unpad Operation
*/
-SecureVector<byte> EME1::unpad(const byte in[], u32bit in_length,
- u32bit key_length) const
+SecureVector<byte> EME1::unpad(const byte in[], size_t in_length,
+ size_t key_length) const
{
/*
Must be careful about error messages here; if an attacker can
@@ -76,10 +76,10 @@ SecureVector<byte> EME1::unpad(const byte in[], u32bit in_length,
const bool phash_ok = same_mem(&tmp[HASH_LENGTH], &Phash[0], Phash.size());
bool delim_ok = true;
- u32bit delim_idx = 0;
+ size_t delim_idx = 0;
// Is this vulnerable to timing attacks?
- for(u32bit i = HASH_LENGTH + Phash.size(); i != tmp.size(); ++i)
+ for(size_t i = HASH_LENGTH + Phash.size(); i != tmp.size(); ++i)
{
if(tmp[i] && !delim_idx)
{
@@ -102,7 +102,7 @@ SecureVector<byte> EME1::unpad(const byte in[], u32bit in_length,
/*
* Return the max input size for a given key size
*/
-u32bit EME1::maximum_input_size(u32bit keybits) const
+size_t EME1::maximum_input_size(size_t keybits) const
{
if(keybits / 8 > 2*HASH_LENGTH + 1)
return ((keybits / 8) - 2*HASH_LENGTH - 1);
diff --git a/src/pk_pad/eme1/eme1.h b/src/pk_pad/eme1/eme1.h
index 0ecdb279e..f99dceb8c 100644
--- a/src/pk_pad/eme1/eme1.h
+++ b/src/pk_pad/eme1/eme1.h
@@ -20,7 +20,7 @@ namespace Botan {
class BOTAN_DLL EME1 : public EME
{
public:
- u32bit maximum_input_size(u32bit) const;
+ size_t maximum_input_size(size_t) const;
/**
* @param hash object to use for hashing (takes ownership)
@@ -30,11 +30,11 @@ class BOTAN_DLL EME1 : public EME
~EME1() { delete mgf; }
private:
- SecureVector<byte> pad(const byte[], u32bit, u32bit,
+ SecureVector<byte> pad(const byte[], size_t, size_t,
RandomNumberGenerator&) const;
- SecureVector<byte> unpad(const byte[], u32bit, u32bit) const;
+ SecureVector<byte> unpad(const byte[], size_t, size_t) const;
- const u32bit HASH_LENGTH;
+ const size_t HASH_LENGTH;
SecureVector<byte> Phash;
MGF* mgf;
};