diff options
Diffstat (limited to 'src/block/serpent_x86_32')
-rw-r--r-- | src/block/serpent_x86_32/serp_x86_32.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/block/serpent_x86_32/serp_x86_32.cpp b/src/block/serpent_x86_32/serp_x86_32.cpp index 9566ed8a6..afff5835c 100644 --- a/src/block/serpent_x86_32/serp_x86_32.cpp +++ b/src/block/serpent_x86_32/serp_x86_32.cpp @@ -46,9 +46,11 @@ void botan_serpent_x86_32_key_schedule(u32bit ks[140]); */ void Serpent_X86_32::encrypt_n(const byte in[], byte out[], size_t blocks) const { + auto keys = this->get_round_keys(); + for(size_t i = 0; i != blocks; ++i) { - botan_serpent_x86_32_encrypt(in, out, this->get_round_keys()); + botan_serpent_x86_32_encrypt(in, out, &keys[0]); in += BLOCK_SIZE; out += BLOCK_SIZE; } @@ -59,9 +61,11 @@ void Serpent_X86_32::encrypt_n(const byte in[], byte out[], size_t blocks) const */ void Serpent_X86_32::decrypt_n(const byte in[], byte out[], size_t blocks) const { + auto keys = this->get_round_keys(); + for(size_t i = 0; i != blocks; ++i) { - botan_serpent_x86_32_decrypt(in, out, this->get_round_keys()); + botan_serpent_x86_32_decrypt(in, out, &keys[0]); in += BLOCK_SIZE; out += BLOCK_SIZE; } @@ -77,8 +81,8 @@ void Serpent_X86_32::key_schedule(const byte key[], size_t length) W[i] = load_le<u32bit>(key, i); W[length / 4] |= u32bit(1) << ((length%4)*8); - botan_serpent_x86_32_key_schedule(W); - this->set_round_keys(W + 8); + botan_serpent_x86_32_key_schedule(&W[0]); + this->set_round_keys(&W[8]); } } |