aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-10-13 16:06:11 +0000
committerlloyd <[email protected]>2010-10-13 16:06:11 +0000
commit18d3acffbe2324a90c505cf23ff17c1392c3be4d (patch)
tree5a7f99e16dbf7cc59015bc94220174075755289a
parent12617c8a0942a5af35ffe72891f3cd63c8b7fe18 (diff)
More size_t
-rw-r--r--src/engine/core_engine/core_modes.cpp2
-rw-r--r--src/engine/core_engine/lookup_block.cpp2
-rw-r--r--src/engine/gnump/gmp_mem.cpp2
-rw-r--r--src/engine/gnump/gmp_wrap.cpp6
-rw-r--r--src/engine/gnump/gmp_wrap.h6
-rw-r--r--src/engine/openssl/bn_wrap.cpp6
-rw-r--r--src/engine/openssl/bn_wrap.h6
-rw-r--r--src/engine/openssl/ossl_bc.cpp6
-rw-r--r--src/hash/mdx_hash/mdx_hash.h2
-rw-r--r--src/utils/mem_ops.h10
-rw-r--r--src/utils/rotate.h4
11 files changed, 26 insertions, 26 deletions
diff --git a/src/engine/core_engine/core_modes.cpp b/src/engine/core_engine/core_modes.cpp
index 7bd981c21..7cf7cf460 100644
--- a/src/engine/core_engine/core_modes.cpp
+++ b/src/engine/core_engine/core_modes.cpp
@@ -140,7 +140,7 @@ Keyed_Filter* get_cipher_mode(const BlockCipher* block_cipher,
if(mode.find("CFB") != std::string::npos ||
mode.find("EAX") != std::string::npos)
{
- u32bit bits = 0;
+ size_t bits = 0;
std::vector<std::string> algo_info = parse_algorithm_name(mode);
std::string mode_name = algo_info[0];
diff --git a/src/engine/core_engine/lookup_block.cpp b/src/engine/core_engine/lookup_block.cpp
index cbfaf2972..77436c8c1 100644
--- a/src/engine/core_engine/lookup_block.cpp
+++ b/src/engine/core_engine/lookup_block.cpp
@@ -257,7 +257,7 @@ BlockCipher* Core_Engine::find_block_cipher(const SCAN_Name& request,
#if defined(BOTAN_HAS_LION)
if(request.algo_name() == "Lion" && request.arg_count_between(2, 3))
{
- const u32bit block_size = request.arg_as_integer(2, 1024);
+ const size_t block_size = request.arg_as_integer(2, 1024);
const HashFunction* hash =
af.prototype_hash_function(request.arg(0));
diff --git a/src/engine/gnump/gmp_mem.cpp b/src/engine/gnump/gmp_mem.cpp
index f3650e716..7cf11654d 100644
--- a/src/engine/gnump/gmp_mem.cpp
+++ b/src/engine/gnump/gmp_mem.cpp
@@ -17,7 +17,7 @@ namespace {
* Allocator used by GNU MP
*/
Allocator* gmp_alloc = 0;
-u32bit gmp_alloc_refcnt = 0;
+size_t gmp_alloc_refcnt = 0;
/*
* Allocation Function for GNU MP
diff --git a/src/engine/gnump/gmp_wrap.cpp b/src/engine/gnump/gmp_wrap.cpp
index 39d107a78..107823ab3 100644
--- a/src/engine/gnump/gmp_wrap.cpp
+++ b/src/engine/gnump/gmp_wrap.cpp
@@ -32,7 +32,7 @@ GMP_MPZ::GMP_MPZ(const BigInt& in)
/*
* GMP_MPZ Constructor
*/
-GMP_MPZ::GMP_MPZ(const byte in[], u32bit length)
+GMP_MPZ::GMP_MPZ(const byte in[], size_t length)
{
mpz_init(value);
mpz_import(value, length, 1, 1, 0, 0, in);
@@ -66,7 +66,7 @@ GMP_MPZ& GMP_MPZ::operator=(const GMP_MPZ& other)
/*
* Export the mpz_t as a bytestring
*/
-void GMP_MPZ::encode(byte out[], u32bit length) const
+void GMP_MPZ::encode(byte out[], size_t length) const
{
size_t dummy = 0;
mpz_export(out + (length - bytes()), &dummy, 1, 1, 0, 0, value);
@@ -75,7 +75,7 @@ void GMP_MPZ::encode(byte out[], u32bit length) const
/*
* Return the number of significant bytes
*/
-u32bit GMP_MPZ::bytes() const
+size_t GMP_MPZ::bytes() const
{
return ((mpz_sizeinbase(value, 2) + 7) / 8);
}
diff --git a/src/engine/gnump/gmp_wrap.h b/src/engine/gnump/gmp_wrap.h
index 52d130d6b..fc7aa856e 100644
--- a/src/engine/gnump/gmp_wrap.h
+++ b/src/engine/gnump/gmp_wrap.h
@@ -22,8 +22,8 @@ class GMP_MPZ
mpz_t value;
BigInt to_bigint() const;
- void encode(byte[], u32bit) const;
- u32bit bytes() const;
+ void encode(byte[], size_t) const;
+ size_t bytes() const;
SecureVector<byte> to_bytes() const
{ return BigInt::encode(to_bigint()); }
@@ -32,7 +32,7 @@ class GMP_MPZ
GMP_MPZ(const GMP_MPZ&);
GMP_MPZ(const BigInt& = 0);
- GMP_MPZ(const byte[], u32bit);
+ GMP_MPZ(const byte[], size_t);
~GMP_MPZ();
};
diff --git a/src/engine/openssl/bn_wrap.cpp b/src/engine/openssl/bn_wrap.cpp
index 6f1b5ef25..779956824 100644
--- a/src/engine/openssl/bn_wrap.cpp
+++ b/src/engine/openssl/bn_wrap.cpp
@@ -23,7 +23,7 @@ OSSL_BN::OSSL_BN(const BigInt& in)
/*
* OSSL_BN Constructor
*/
-OSSL_BN::OSSL_BN(const byte in[], u32bit length)
+OSSL_BN::OSSL_BN(const byte in[], size_t length)
{
value = BN_new();
BN_bin2bn(in, length, value);
@@ -57,7 +57,7 @@ OSSL_BN& OSSL_BN::operator=(const OSSL_BN& other)
/*
* Export the BIGNUM as a bytestring
*/
-void OSSL_BN::encode(byte out[], u32bit length) const
+void OSSL_BN::encode(byte out[], size_t length) const
{
BN_bn2bin(value, out + (length - bytes()));
}
@@ -65,7 +65,7 @@ void OSSL_BN::encode(byte out[], u32bit length) const
/*
* Return the number of significant bytes
*/
-u32bit OSSL_BN::bytes() const
+size_t OSSL_BN::bytes() const
{
return BN_num_bytes(value);
}
diff --git a/src/engine/openssl/bn_wrap.h b/src/engine/openssl/bn_wrap.h
index 372f5a329..c5c07a35c 100644
--- a/src/engine/openssl/bn_wrap.h
+++ b/src/engine/openssl/bn_wrap.h
@@ -22,8 +22,8 @@ class OSSL_BN
BIGNUM* value;
BigInt to_bigint() const;
- void encode(byte[], u32bit) const;
- u32bit bytes() const;
+ void encode(byte[], size_t) const;
+ size_t bytes() const;
SecureVector<byte> to_bytes() const
{ return BigInt::encode(to_bigint()); }
@@ -32,7 +32,7 @@ class OSSL_BN
OSSL_BN(const OSSL_BN&);
OSSL_BN(const BigInt& = 0);
- OSSL_BN(const byte[], u32bit);
+ OSSL_BN(const byte[], size_t);
~OSSL_BN();
};
diff --git a/src/engine/openssl/ossl_bc.cpp b/src/engine/openssl/ossl_bc.cpp
index 64b5fa3b4..74f0316dc 100644
--- a/src/engine/openssl/ossl_bc.cpp
+++ b/src/engine/openssl/ossl_bc.cpp
@@ -27,7 +27,7 @@ class EVP_BlockCipher : public BlockCipher
EVP_BlockCipher(const EVP_CIPHER*, const std::string&);
EVP_BlockCipher(const EVP_CIPHER*, const std::string&,
- u32bit, u32bit, u32bit);
+ size_t, size_t, size_t);
~EVP_BlockCipher();
private:
@@ -67,8 +67,8 @@ EVP_BlockCipher::EVP_BlockCipher(const EVP_CIPHER* algo,
*/
EVP_BlockCipher::EVP_BlockCipher(const EVP_CIPHER* algo,
const std::string& algo_name,
- u32bit key_min, u32bit key_max,
- u32bit key_mod) :
+ size_t key_min, size_t key_max,
+ size_t key_mod) :
BlockCipher(key_min, key_max, key_mod),
block_sz(EVP_CIPHER_block_size(algo)),
cipher_name(algo_name)
diff --git a/src/hash/mdx_hash/mdx_hash.h b/src/hash/mdx_hash/mdx_hash.h
index 5591f2b80..d1260180e 100644
--- a/src/hash/mdx_hash/mdx_hash.h
+++ b/src/hash/mdx_hash/mdx_hash.h
@@ -64,7 +64,7 @@ class BOTAN_DLL MDx_HashFunction : public HashFunction
size_t position;
const bool BIG_BYTE_ENDIAN, BIG_BIT_ENDIAN;
- const u32bit COUNT_SIZE;
+ const size_t COUNT_SIZE;
};
}
diff --git a/src/utils/mem_ops.h b/src/utils/mem_ops.h
index 503be90b3..fc59c90d6 100644
--- a/src/utils/mem_ops.h
+++ b/src/utils/mem_ops.h
@@ -19,7 +19,7 @@ namespace Botan {
* @param in the source array
* @param n the number of elements of in/out
*/
-template<typename T> inline void copy_mem(T* out, const T* in, u32bit n)
+template<typename T> inline void copy_mem(T* out, const T* in, size_t n)
{
std::memmove(out, in, sizeof(T)*n);
}
@@ -29,7 +29,7 @@ template<typename T> inline void copy_mem(T* out, const T* in, u32bit n)
* @param ptr a pointer to an array
* @param n the number of Ts pointed to by ptr
*/
-template<typename T> inline void clear_mem(T* ptr, u32bit n)
+template<typename T> inline void clear_mem(T* ptr, size_t n)
{
if(n) // avoid glibc warning if n == 0
std::memset(ptr, 0, sizeof(T)*n);
@@ -42,7 +42,7 @@ template<typename T> inline void clear_mem(T* ptr, u32bit n)
* @param val the value to set each byte to
*/
template<typename T>
-inline void set_mem(T* ptr, u32bit n, byte val)
+inline void set_mem(T* ptr, size_t n, byte val)
{
std::memset(ptr, val, sizeof(T)*n);
}
@@ -54,11 +54,11 @@ inline void set_mem(T* ptr, u32bit n, byte val)
* @param n the number of Ts in p1 and p2
* @return true iff p1[i] == p2[i] forall i in [0...n)
*/
-template<typename T> inline bool same_mem(const T* p1, const T* p2, u32bit n)
+template<typename T> inline bool same_mem(const T* p1, const T* p2, size_t n)
{
bool is_same = true;
- for(u32bit i = 0; i != n; ++i)
+ for(size_t i = 0; i != n; ++i)
is_same &= (p1[i] == p2[i]);
return is_same;
diff --git a/src/utils/rotate.h b/src/utils/rotate.h
index c8f8d4a1a..5e3eef304 100644
--- a/src/utils/rotate.h
+++ b/src/utils/rotate.h
@@ -15,12 +15,12 @@ namespace Botan {
/*
* Word Rotation Functions
*/
-template<typename T> inline T rotate_left(T input, u32bit rot)
+template<typename T> inline T rotate_left(T input, size_t rot)
{
return static_cast<T>((input << rot) | (input >> (8*sizeof(T)-rot)));;
}
-template<typename T> inline T rotate_right(T input, u32bit rot)
+template<typename T> inline T rotate_right(T input, size_t rot)
{
return static_cast<T>((input >> rot) | (input << (8*sizeof(T)-rot)));
}