diff options
author | lloyd <[email protected]> | 2010-10-18 17:35:11 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-10-18 17:35:11 +0000 |
commit | 1c68b5c2e6b70693b42f417733599cd51d578b4d (patch) | |
tree | 87d27e59d4b9b8b5348b0ea4e7d3457b8169b8ff /src/constructs/aont | |
parent | 2420a7b38f2107e6671bd53ccd66a320f791c6d7 (diff) |
s/u32bit/size_t/
Diffstat (limited to 'src/constructs/aont')
-rw-r--r-- | src/constructs/aont/package.cpp | 24 | ||||
-rw-r--r-- | src/constructs/aont/package.h | 4 |
2 files changed, 14 insertions, 14 deletions
diff --git a/src/constructs/aont/package.cpp b/src/constructs/aont/package.cpp index a773d6558..4d92a789c 100644 --- a/src/constructs/aont/package.cpp +++ b/src/constructs/aont/package.cpp @@ -16,7 +16,7 @@ namespace Botan { void aont_package(RandomNumberGenerator& rng, BlockCipher* cipher, - const byte input[], u32bit input_len, + const byte input[], size_t input_len, byte output[]) { const size_t BLOCK_SIZE = cipher->block_size(); @@ -39,7 +39,7 @@ void aont_package(RandomNumberGenerator& rng, SecureVector<byte> buf(BLOCK_SIZE); - const u32bit blocks = + const size_t blocks = (input_len + BLOCK_SIZE - 1) / BLOCK_SIZE; byte* final_block = output + input_len; @@ -48,14 +48,14 @@ void aont_package(RandomNumberGenerator& rng, // XOR the hash blocks into the final block for(u32bit i = 0; i != blocks; ++i) { - u32bit left = std::min<u32bit>(BLOCK_SIZE, - input_len - BLOCK_SIZE * i); + const size_t left = std::min<size_t>(BLOCK_SIZE, + input_len - BLOCK_SIZE * i); zeroise(buf); copy_mem(&buf[0], output + BLOCK_SIZE * i, left); - for(u32bit j = 0; j != 4; ++j) - buf[BLOCK_SIZE - 1 - j] ^= get_byte(3-j, i); + for(size_t j = 0; j != sizeof(i); ++j) + buf[BLOCK_SIZE - 1 - j] ^= get_byte(sizeof(i)-1-j, i); cipher->encrypt(buf); @@ -67,7 +67,7 @@ void aont_package(RandomNumberGenerator& rng, } void aont_unpackage(BlockCipher* cipher, - const byte input[], u32bit input_len, + const byte input[], size_t input_len, byte output[]) { const size_t BLOCK_SIZE = cipher->block_size(); @@ -91,19 +91,19 @@ void aont_unpackage(BlockCipher* cipher, input + (input_len - BLOCK_SIZE), BLOCK_SIZE); - const u32bit blocks = ((input_len - 1) / BLOCK_SIZE); + const size_t blocks = ((input_len - 1) / BLOCK_SIZE); // XOR the blocks into the package key bits for(u32bit i = 0; i != blocks; ++i) { - u32bit left = std::min<u32bit>(BLOCK_SIZE, - input_len - BLOCK_SIZE * (i+1)); + const size_t left = std::min<size_t>(BLOCK_SIZE, + input_len - BLOCK_SIZE * (i+1)); zeroise(buf); copy_mem(&buf[0], input + BLOCK_SIZE * i, left); - for(u32bit j = 0; j != 4; ++j) - buf[BLOCK_SIZE - 1 - j] ^= get_byte(3-j, i); + for(size_t j = 0; j != sizeof(i); ++j) + buf[BLOCK_SIZE - 1 - j] ^= get_byte(sizeof(i)-1-j, i); cipher->encrypt(buf); diff --git a/src/constructs/aont/package.h b/src/constructs/aont/package.h index 34e0f35d5..52d1c2190 100644 --- a/src/constructs/aont/package.h +++ b/src/constructs/aont/package.h @@ -24,7 +24,7 @@ namespace Botan { */ void BOTAN_DLL aont_package(RandomNumberGenerator& rng, BlockCipher* cipher, - const byte input[], u32bit input_len, + const byte input[], size_t input_len, byte output[]); /** @@ -36,7 +36,7 @@ void BOTAN_DLL aont_package(RandomNumberGenerator& rng, * input_len - cipher->BLOCK_SIZE bytes long) */ void BOTAN_DLL aont_unpackage(BlockCipher* cipher, - const byte input[], u32bit input_len, + const byte input[], size_t input_len, byte output[]); } |