diff options
author | lloyd <[email protected]> | 2012-05-18 14:24:51 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2012-05-18 14:24:51 +0000 |
commit | ab5c922f0e2635dc0e45fc757b27be9f28986acb (patch) | |
tree | c21a18bbfb316196b1b13488ef05f184f12be9f0 /src/block | |
parent | 2c3dc93d6466a9215d585613fb55f5222ce70d10 (diff) |
Remove all uses of MemoryRegion::copy outside of internal uses in
secmem.h. Mostly replaced by assign or copy_mem.
Diffstat (limited to 'src/block')
-rw-r--r-- | src/block/des/desx.cpp | 4 | ||||
-rw-r--r-- | src/block/lion/lion.cpp | 4 | ||||
-rw-r--r-- | src/block/rc2/rc2.cpp | 2 | ||||
-rw-r--r-- | src/block/serpent/serpent.cpp | 3 | ||||
-rw-r--r-- | src/block/square/square.cpp | 7 |
5 files changed, 12 insertions, 8 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 8c39eee65..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); } /* 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/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]); } /* |