diff options
author | lloyd <[email protected]> | 2010-10-13 01:34:15 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-10-13 01:34:15 +0000 |
commit | fe4119c74b5e81a354a5313e4d2efbf9a135aa81 (patch) | |
tree | 5c5254cc3a4e5713169ef1d52a83db19c8c4ed65 /src/sym_algo | |
parent | 60fb91d8cb1710d07041f76050d24229ce91131b (diff) |
Use size_t rather than u32bit in SymmetricAlgorithm
Diffstat (limited to 'src/sym_algo')
-rw-r--r-- | src/sym_algo/sym_algo.h | 14 | ||||
-rw-r--r-- | src/sym_algo/symkey.cpp | 8 | ||||
-rw-r--r-- | src/sym_algo/symkey.h | 8 |
3 files changed, 15 insertions, 15 deletions
diff --git a/src/sym_algo/sym_algo.h b/src/sym_algo/sym_algo.h index 60180de90..0a1423f13 100644 --- a/src/sym_algo/sym_algo.h +++ b/src/sym_algo/sym_algo.h @@ -24,17 +24,17 @@ class BOTAN_DLL SymmetricAlgorithm /** * The maximum allowed key length. */ - const u32bit MAXIMUM_KEYLENGTH; + const size_t MAXIMUM_KEYLENGTH; /** * The minimal allowed key length. */ - const u32bit MINIMUM_KEYLENGTH; + const size_t MINIMUM_KEYLENGTH; /** * A valid keylength is a multiple of this value. */ - const u32bit KEYLENGTH_MULTIPLE; + const size_t KEYLENGTH_MULTIPLE; /** * The name of the algorithm. @@ -54,7 +54,7 @@ class BOTAN_DLL SymmetricAlgorithm * @param key the to be set as a byte array. * @param length in bytes of key param */ - void set_key(const byte key[], u32bit length) + void set_key(const byte key[], size_t length) { if(!valid_keylength(length)) throw Invalid_Key_Length(name(), length); @@ -66,7 +66,7 @@ class BOTAN_DLL SymmetricAlgorithm * @param length the key length to be checked. * @return true if the key length is valid. */ - bool valid_keylength(u32bit length) const + bool valid_keylength(size_t length) const { return ((length >= MINIMUM_KEYLENGTH) && (length <= MAXIMUM_KEYLENGTH) && @@ -79,7 +79,7 @@ class BOTAN_DLL SymmetricAlgorithm * @param key_max the maximum allowed key length * @param key_mod any valid key length must be a multiple of this value */ - SymmetricAlgorithm(u32bit key_min, u32bit key_max, u32bit key_mod) : + SymmetricAlgorithm(size_t key_min, size_t key_max, size_t key_mod) : MAXIMUM_KEYLENGTH(key_max ? key_max : key_min), MINIMUM_KEYLENGTH(key_min), KEYLENGTH_MULTIPLE(key_mod) @@ -92,7 +92,7 @@ class BOTAN_DLL SymmetricAlgorithm * @param key the key * @param length of key */ - virtual void key_schedule(const byte key[], u32bit length) = 0; + virtual void key_schedule(const byte key[], size_t length) = 0; }; /** diff --git a/src/sym_algo/symkey.cpp b/src/sym_algo/symkey.cpp index 4452fd8fb..e8b9ddd21 100644 --- a/src/sym_algo/symkey.cpp +++ b/src/sym_algo/symkey.cpp @@ -18,7 +18,7 @@ namespace Botan { * Create an OctetString from RNG output */ OctetString::OctetString(RandomNumberGenerator& rng, - u32bit length) + size_t length) { bits = rng.random_vec(length); } @@ -30,7 +30,7 @@ void OctetString::change(const std::string& hex_string) { SecureVector<byte> decoded(1 + hex_string.length() / 2); - u32bit written = hex_decode(&decoded[0], hex_string); + size_t written = hex_decode(&decoded[0], hex_string); bits.set(&decoded[0], written); } @@ -38,7 +38,7 @@ void OctetString::change(const std::string& hex_string) /* * Create an OctetString from a byte string */ -void OctetString::change(const byte in[], u32bit n) +void OctetString::change(const byte in[], size_t n) { bits.resize(n); bits.copy(in, n); @@ -73,7 +73,7 @@ void OctetString::set_odd_parity() 0xF1, 0xF1, 0xF2, 0xF2, 0xF4, 0xF4, 0xF7, 0xF7, 0xF8, 0xF8, 0xFB, 0xFB, 0xFD, 0xFD, 0xFE, 0xFE }; - for(u32bit j = 0; j != bits.size(); ++j) + for(size_t j = 0; j != bits.size(); ++j) bits[j] = ODD_PARITY[bits[j]]; } diff --git a/src/sym_algo/symkey.h b/src/sym_algo/symkey.h index 154ae59da..6735b2b87 100644 --- a/src/sym_algo/symkey.h +++ b/src/sym_algo/symkey.h @@ -22,7 +22,7 @@ class BOTAN_DLL OctetString /** * @return size of this octet string in bytes */ - u32bit length() const { return bits.size(); } + size_t length() const { return bits.size(); } /** * @return this object as a SecureVector<byte> @@ -67,7 +67,7 @@ class BOTAN_DLL OctetString * @param in the input * @param length of in in bytes */ - void change(const byte in[], u32bit length); + void change(const byte in[], size_t length); /** * Change the contents of this octet string @@ -80,7 +80,7 @@ class BOTAN_DLL OctetString * @param rng is a random number generator * @param len is the desired length in bytes */ - OctetString(class RandomNumberGenerator& rng, u32bit len); + OctetString(class RandomNumberGenerator& rng, size_t len); /** * Create a new OctetString @@ -93,7 +93,7 @@ class BOTAN_DLL OctetString * @param in is an array * @param len is the length of in in bytes */ - OctetString(const byte in[], u32bit len) { change(in, len); } + OctetString(const byte in[], size_t len) { change(in, len); } /** * Create a new OctetString |