aboutsummaryrefslogtreecommitdiffstats
path: root/src/block/gost_28147
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-10-12 19:41:37 +0000
committerlloyd <[email protected]>2010-10-12 19:41:37 +0000
commitff2210b035a1598bf99e18a578ff075bece8fbe5 (patch)
tree4efe3a23daac9e2cd8b9f2b794d95089ba4cdfb2 /src/block/gost_28147
parente7e3af16a3540e1d7a84e085aa1ea7c55f627930 (diff)
Use size_t rather than u32bit for the blocks argument of encrypt_n
Diffstat (limited to 'src/block/gost_28147')
-rw-r--r--src/block/gost_28147/gost_28147.cpp20
-rw-r--r--src/block/gost_28147/gost_28147.h6
2 files changed, 14 insertions, 12 deletions
diff --git a/src/block/gost_28147/gost_28147.cpp b/src/block/gost_28147/gost_28147.cpp
index 8d7e950c6..c23c31dfb 100644
--- a/src/block/gost_28147/gost_28147.cpp
+++ b/src/block/gost_28147/gost_28147.cpp
@@ -11,7 +11,7 @@
namespace Botan {
-byte GOST_28147_89_Params::sbox_entry(u32bit row, u32bit col) const
+byte GOST_28147_89_Params::sbox_entry(size_t row, size_t col) const
{
byte x = sboxes[4 * col + (row / 2)];
@@ -85,11 +85,12 @@ GOST_28147_89::GOST_28147_89(const GOST_28147_89_Params& param) :
/*
* GOST Encryption
*/
-void GOST_28147_89::encrypt_n(const byte in[], byte out[], u32bit blocks) const
+void GOST_28147_89::encrypt_n(const byte in[], byte out[], size_t blocks) const
{
- for(u32bit i = 0; i != blocks; ++i)
+ for(size_t i = 0; i != blocks; ++i)
{
- u32bit N1 = load_le<u32bit>(in, 0), N2 = load_le<u32bit>(in, 1);
+ u32bit N1 = load_le<u32bit>(in, 0);
+ u32bit N2 = load_le<u32bit>(in, 1);
for(size_t j = 0; j != 3; ++j)
{
@@ -114,11 +115,12 @@ void GOST_28147_89::encrypt_n(const byte in[], byte out[], u32bit blocks) const
/*
* GOST Decryption
*/
-void GOST_28147_89::decrypt_n(const byte in[], byte out[], u32bit blocks) const
+void GOST_28147_89::decrypt_n(const byte in[], byte out[], size_t blocks) const
{
- for(u32bit i = 0; i != blocks; ++i)
+ for(size_t i = 0; i != blocks; ++i)
{
- u32bit N1 = load_le<u32bit>(in, 0), N2 = load_le<u32bit>(in, 1);
+ u32bit N1 = load_le<u32bit>(in, 0);
+ u32bit N2 = load_le<u32bit>(in, 1);
GOST_2ROUND(N1, N2, 0, 1);
GOST_2ROUND(N1, N2, 2, 3);
@@ -144,8 +146,8 @@ void GOST_28147_89::decrypt_n(const byte in[], byte out[], u32bit blocks) const
*/
void GOST_28147_89::key_schedule(const byte key[], u32bit)
{
- for(u32bit j = 0; j != 8; ++j)
- EK[j] = load_le<u32bit>(key, j);
+ for(size_t i = 0; i != 8; ++i)
+ EK[i] = load_le<u32bit>(key, i);
}
}
diff --git a/src/block/gost_28147/gost_28147.h b/src/block/gost_28147/gost_28147.h
index 501e621e0..f70c6650f 100644
--- a/src/block/gost_28147/gost_28147.h
+++ b/src/block/gost_28147/gost_28147.h
@@ -26,7 +26,7 @@ class BOTAN_DLL GOST_28147_89_Params
* @param col the column
* @return sbox entry at this row/column
*/
- byte sbox_entry(u32bit row, u32bit col) const;
+ byte sbox_entry(size_t row, size_t col) const;
/**
* @return name of this parameter set
@@ -52,8 +52,8 @@ class BOTAN_DLL GOST_28147_89_Params
class BOTAN_DLL GOST_28147_89 : public BlockCipher
{
public:
- void encrypt_n(const byte in[], byte out[], u32bit blocks) const;
- void decrypt_n(const byte in[], byte out[], u32bit blocks) const;
+ void encrypt_n(const byte in[], byte out[], size_t blocks) const;
+ void decrypt_n(const byte in[], byte out[], size_t blocks) const;
void clear() { zeroise(EK); }