diff options
Diffstat (limited to 'src/block/noekeon/noekeon.cpp')
-rw-r--r-- | src/block/noekeon/noekeon.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/block/noekeon/noekeon.cpp b/src/block/noekeon/noekeon.cpp index 0bfce1882..c29fed93e 100644 --- a/src/block/noekeon/noekeon.cpp +++ b/src/block/noekeon/noekeon.cpp @@ -84,19 +84,19 @@ const byte Noekeon::RC[] = { /* * Noekeon Encryption */ -void Noekeon::encrypt_n(const byte in[], byte out[], u32bit blocks) const +void Noekeon::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 A0 = load_be<u32bit>(in, 0); u32bit A1 = load_be<u32bit>(in, 1); u32bit A2 = load_be<u32bit>(in, 2); u32bit A3 = load_be<u32bit>(in, 3); - for(u32bit j = 0; j != 16; ++j) + for(size_t j = 0; j != 16; ++j) { A0 ^= RC[j]; - theta(A0, A1, A2, A3, EK); + theta(A0, A1, A2, A3, &EK[0]); A1 = rotate_left(A1, 1); A2 = rotate_left(A2, 5); @@ -110,30 +110,30 @@ void Noekeon::encrypt_n(const byte in[], byte out[], u32bit blocks) const } A0 ^= RC[16]; - theta(A0, A1, A2, A3, EK); + theta(A0, A1, A2, A3, &EK[0]); store_be(out, A0, A1, A2, A3); - in += BLOCK_SIZE; - out += BLOCK_SIZE; + in += block_size(); + out += block_size(); } } /* * Noekeon Encryption */ -void Noekeon::decrypt_n(const byte in[], byte out[], u32bit blocks) const +void Noekeon::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 A0 = load_be<u32bit>(in, 0); u32bit A1 = load_be<u32bit>(in, 1); u32bit A2 = load_be<u32bit>(in, 2); u32bit A3 = load_be<u32bit>(in, 3); - for(u32bit j = 16; j != 0; --j) + for(size_t j = 16; j != 0; --j) { - theta(A0, A1, A2, A3, DK); + theta(A0, A1, A2, A3, &DK[0]); A0 ^= RC[j]; A1 = rotate_left(A1, 1); @@ -147,29 +147,29 @@ void Noekeon::decrypt_n(const byte in[], byte out[], u32bit blocks) const A3 = rotate_right(A3, 2); } - theta(A0, A1, A2, A3, DK); + theta(A0, A1, A2, A3, &DK[0]); A0 ^= RC[0]; store_be(out, A0, A1, A2, A3); - in += BLOCK_SIZE; - out += BLOCK_SIZE; + in += block_size(); + out += block_size(); } } /* * Noekeon Key Schedule */ -void Noekeon::key_schedule(const byte key[], u32bit) +void Noekeon::key_schedule(const byte key[], size_t) { u32bit A0 = load_be<u32bit>(key, 0); u32bit A1 = load_be<u32bit>(key, 1); u32bit A2 = load_be<u32bit>(key, 2); u32bit A3 = load_be<u32bit>(key, 3); - for(u32bit j = 0; j != 16; ++j) + for(size_t i = 0; i != 16; ++i) { - A0 ^= RC[j]; + A0 ^= RC[i]; theta(A0, A1, A2, A3); A1 = rotate_left(A1, 1); @@ -203,8 +203,8 @@ void Noekeon::key_schedule(const byte key[], u32bit) */ void Noekeon::clear() { - EK.clear(); - DK.clear(); + zeroise(EK); + zeroise(DK); } } |