diff options
Diffstat (limited to 'src/block')
-rw-r--r-- | src/block/des/desx.cpp | 4 | ||||
-rw-r--r-- | src/block/lion/lion.cpp | 6 | ||||
-rw-r--r-- | src/block/misty1/misty1.cpp | 2 | ||||
-rw-r--r-- | src/block/rc2/rc2.cpp | 2 | ||||
-rw-r--r-- | src/block/rc5/rc5.cpp | 4 | ||||
-rw-r--r-- | src/block/safer/safer_sk.cpp | 2 | ||||
-rw-r--r-- | src/block/serpent/serpent.cpp | 3 | ||||
-rw-r--r-- | src/block/square/square.cpp | 7 |
8 files changed, 17 insertions, 13 deletions
diff --git a/src/block/des/desx.cpp b/src/block/des/desx.cpp index b92011e56..7f68e406a 100644 --- a/src/block/des/desx.cpp +++ b/src/block/des/desx.cpp @@ -47,9 +47,9 @@ void DESX::decrypt_n(const byte in[], byte out[], size_t blocks) const */ void DESX::key_schedule(const byte key[], size_t) { - K1.copy(key, 8); + K1.assign(key, key + 8); des.set_key(key + 8, 8); - K2.copy(key + 16, 8); + K2.assign(key + 16, key + 24); } } diff --git a/src/block/lion/lion.cpp b/src/block/lion/lion.cpp index 46308e428..4a9e8b901 100644 --- a/src/block/lion/lion.cpp +++ b/src/block/lion/lion.cpp @@ -72,8 +72,8 @@ void Lion::key_schedule(const byte key[], size_t length) { clear(); - key1.copy(key, length / 2); - key2.copy(key + length / 2, length / 2); + key1.assign(key, key + (length / 2)); + key2.assign(key + (length / 2), key + length); } /* @@ -83,7 +83,7 @@ std::string Lion::name() const { return "Lion(" + hash->name() + "," + cipher->name() + "," + - to_string(BLOCK_SIZE) + ")"; + std::to_string(BLOCK_SIZE) + ")"; } /* diff --git a/src/block/misty1/misty1.cpp b/src/block/misty1/misty1.cpp index 36c25a814..77d1047b1 100644 --- a/src/block/misty1/misty1.cpp +++ b/src/block/misty1/misty1.cpp @@ -255,7 +255,7 @@ MISTY1::MISTY1(size_t rounds) : EK(100), DK(100) { if(rounds != 8) throw Invalid_Argument("MISTY1: Invalid number of rounds: " - + to_string(rounds)); + + std::to_string(rounds)); } } diff --git a/src/block/rc2/rc2.cpp b/src/block/rc2/rc2.cpp index 97ca5d577..071e4e209 100644 --- a/src/block/rc2/rc2.cpp +++ b/src/block/rc2/rc2.cpp @@ -125,7 +125,7 @@ void RC2::key_schedule(const byte key[], size_t length) 0xFE, 0x7F, 0xC1, 0xAD }; SecureVector<byte> L(128); - L.copy(key, length); + copy_mem(&L[0], key, length); for(size_t i = length; i != 128; ++i) L[i] = TABLE[(L[i-1] + L[i-length]) % 256]; diff --git a/src/block/rc5/rc5.cpp b/src/block/rc5/rc5.cpp index cfcc4cb64..981f73564 100644 --- a/src/block/rc5/rc5.cpp +++ b/src/block/rc5/rc5.cpp @@ -116,7 +116,7 @@ void RC5::key_schedule(const byte key[], size_t length) */ std::string RC5::name() const { - return "RC5(" + to_string(get_rounds()) + ")"; + return "RC5(" + std::to_string(get_rounds()) + ")"; } /* @@ -126,7 +126,7 @@ RC5::RC5(size_t rounds) { if(rounds < 8 || rounds > 32 || (rounds % 4 != 0)) throw Invalid_Argument("RC5: Invalid number of rounds " + - to_string(rounds)); + std::to_string(rounds)); S.resize(2*rounds + 2); } diff --git a/src/block/safer/safer_sk.cpp b/src/block/safer/safer_sk.cpp index a3a6cefd8..5275a0781 100644 --- a/src/block/safer/safer_sk.cpp +++ b/src/block/safer/safer_sk.cpp @@ -230,7 +230,7 @@ void SAFER_SK::key_schedule(const byte key[], size_t) */ std::string SAFER_SK::name() const { - return "SAFER-SK(" + to_string(get_rounds()) + ")"; + return "SAFER-SK(" + std::to_string(get_rounds()) + ")"; } /* diff --git a/src/block/serpent/serpent.cpp b/src/block/serpent/serpent.cpp index b3cf0f6c9..b1e632c29 100644 --- a/src/block/serpent/serpent.cpp +++ b/src/block/serpent/serpent.cpp @@ -387,7 +387,8 @@ void Serpent::key_schedule(const byte key[], size_t length) SBoxE8(W[120],W[121],W[122],W[123]); SBoxE7(W[124],W[125],W[126],W[127]); SBoxE6(W[128],W[129],W[130],W[131]); SBoxE5(W[132],W[133],W[134],W[135]); SBoxE4(W[136],W[137],W[138],W[139]); - round_key.copy(&W[8], 132); + + round_key.assign(&W[8], &W[140]); } } diff --git a/src/block/square/square.cpp b/src/block/square/square.cpp index cd1865582..ff98c040e 100644 --- a/src/block/square/square.cpp +++ b/src/block/square/square.cpp @@ -160,6 +160,9 @@ void Square::key_schedule(const byte key[], size_t) transform(&XEK[4*i]); } + ME.resize(16); + MD.resize(16); + for(size_t i = 0; i != 4; ++i) for(size_t j = 0; j != 4; ++j) { @@ -169,8 +172,8 @@ void Square::key_schedule(const byte key[], size_t) MD[4*i+j+16] = get_byte(j, XEK[i ]); } - EK.copy(&XEK[4], 28); - DK.copy(&XDK[4], 28); + EK.assign(&XEK[4], &XEK[36]); + DK.assign(&XDK[4], &XDK[36]); } /* |