aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2015-06-26 11:28:13 +0200
committerSimon Warta <[email protected]>2015-06-27 11:15:18 +0200
commit4b70dbf7c24dc4f60349e96220601f6c55c81c52 (patch)
treeb20cb7ace806a5937444a926d597987588a9856b /src
parent922336151782c42455d08cca787215b0a4e7b617 (diff)
lib/block: Convert &vec[0] to vec.data()
Diffstat (limited to 'src')
-rw-r--r--src/lib/block/aes/aes.cpp4
-rw-r--r--src/lib/block/aes_ni/aes_ni.cpp26
-rw-r--r--src/lib/block/aes_ssse3/aes_ssse3.cpp24
-rw-r--r--src/lib/block/block_cipher.h8
-rw-r--r--src/lib/block/camellia/camellia.cpp2
-rw-r--r--src/lib/block/cast/cast128.cpp2
-rw-r--r--src/lib/block/des/des.cpp6
-rw-r--r--src/lib/block/des/desx.cpp8
-rw-r--r--src/lib/block/idea/idea.cpp4
-rw-r--r--src/lib/block/lion/lion.cpp16
-rw-r--r--src/lib/block/noekeon/noekeon.cpp8
-rw-r--r--src/lib/block/rc2/rc2.cpp4
-rw-r--r--src/lib/block/serpent_x86_32/serp_x86_32.cpp6
13 files changed, 59 insertions, 59 deletions
diff --git a/src/lib/block/aes/aes.cpp b/src/lib/block/aes/aes.cpp
index ff8c97b76..b9e00fe6c 100644
--- a/src/lib/block/aes/aes.cpp
+++ b/src/lib/block/aes/aes.cpp
@@ -677,8 +677,8 @@ void aes_key_schedule(const byte key[], size_t length,
EK.resize(length + 24);
DK.resize(length + 24);
- copy_mem(&EK[0], &XEK[0], EK.size());
- copy_mem(&DK[0], &XDK[0], DK.size());
+ copy_mem(EK.data(), XEK.data(), EK.size());
+ copy_mem(DK.data(), XDK.data(), DK.size());
}
}
diff --git a/src/lib/block/aes_ni/aes_ni.cpp b/src/lib/block/aes_ni/aes_ni.cpp
index 96a629d06..20aa63c54 100644
--- a/src/lib/block/aes_ni/aes_ni.cpp
+++ b/src/lib/block/aes_ni/aes_ni.cpp
@@ -113,7 +113,7 @@ void AES_128_NI::encrypt_n(const byte in[], byte out[], size_t blocks) const
const __m128i* in_mm = reinterpret_cast<const __m128i*>(in);
__m128i* out_mm = reinterpret_cast<__m128i*>(out);
- const __m128i* key_mm = reinterpret_cast<const __m128i*>(&EK[0]);
+ const __m128i* key_mm = reinterpret_cast<const __m128i*>(EK.data());
__m128i K0 = _mm_loadu_si128(key_mm);
__m128i K1 = _mm_loadu_si128(key_mm + 1);
@@ -189,7 +189,7 @@ void AES_128_NI::decrypt_n(const byte in[], byte out[], size_t blocks) const
const __m128i* in_mm = reinterpret_cast<const __m128i*>(in);
__m128i* out_mm = reinterpret_cast<__m128i*>(out);
- const __m128i* key_mm = reinterpret_cast<const __m128i*>(&DK[0]);
+ const __m128i* key_mm = reinterpret_cast<const __m128i*>(DK.data());
__m128i K0 = _mm_loadu_si128(key_mm);
__m128i K1 = _mm_loadu_si128(key_mm + 1);
@@ -280,7 +280,7 @@ void AES_128_NI::key_schedule(const byte key[], size_t)
__m128i K9 = AES_128_key_exp(K8, 0x1B);
__m128i K10 = AES_128_key_exp(K9, 0x36);
- __m128i* EK_mm = reinterpret_cast<__m128i*>(&EK[0]);
+ __m128i* EK_mm = reinterpret_cast<__m128i*>(EK.data());
_mm_storeu_si128(EK_mm , K0);
_mm_storeu_si128(EK_mm + 1, K1);
_mm_storeu_si128(EK_mm + 2, K2);
@@ -295,7 +295,7 @@ void AES_128_NI::key_schedule(const byte key[], size_t)
// Now generate decryption keys
- __m128i* DK_mm = reinterpret_cast<__m128i*>(&DK[0]);
+ __m128i* DK_mm = reinterpret_cast<__m128i*>(DK.data());
_mm_storeu_si128(DK_mm , K10);
_mm_storeu_si128(DK_mm + 1, _mm_aesimc_si128(K9));
_mm_storeu_si128(DK_mm + 2, _mm_aesimc_si128(K8));
@@ -326,7 +326,7 @@ void AES_192_NI::encrypt_n(const byte in[], byte out[], size_t blocks) const
const __m128i* in_mm = reinterpret_cast<const __m128i*>(in);
__m128i* out_mm = reinterpret_cast<__m128i*>(out);
- const __m128i* key_mm = reinterpret_cast<const __m128i*>(&EK[0]);
+ const __m128i* key_mm = reinterpret_cast<const __m128i*>(EK.data());
__m128i K0 = _mm_loadu_si128(key_mm);
__m128i K1 = _mm_loadu_si128(key_mm + 1);
@@ -408,7 +408,7 @@ void AES_192_NI::decrypt_n(const byte in[], byte out[], size_t blocks) const
const __m128i* in_mm = reinterpret_cast<const __m128i*>(in);
__m128i* out_mm = reinterpret_cast<__m128i*>(out);
- const __m128i* key_mm = reinterpret_cast<const __m128i*>(&DK[0]);
+ const __m128i* key_mm = reinterpret_cast<const __m128i*>(DK.data());
__m128i K0 = _mm_loadu_si128(key_mm);
__m128i K1 = _mm_loadu_si128(key_mm + 1);
@@ -494,7 +494,7 @@ void AES_192_NI::key_schedule(const byte key[], size_t)
__m128i K1 = _mm_loadu_si128(reinterpret_cast<const __m128i*>(key + 8));
K1 = _mm_srli_si128(K1, 8);
- load_le(&EK[0], key, 6);
+ load_le(EK.data(), key, 6);
#define AES_192_key_exp(RCON, EK_OFF) \
aes_192_key_expansion(&K0, &K1, \
@@ -513,9 +513,9 @@ void AES_192_NI::key_schedule(const byte key[], size_t)
#undef AES_192_key_exp
// Now generate decryption keys
- const __m128i* EK_mm = reinterpret_cast<const __m128i*>(&EK[0]);
+ const __m128i* EK_mm = reinterpret_cast<const __m128i*>(EK.data());
- __m128i* DK_mm = reinterpret_cast<__m128i*>(&DK[0]);
+ __m128i* DK_mm = reinterpret_cast<__m128i*>(DK.data());
_mm_storeu_si128(DK_mm , _mm_loadu_si128(EK_mm + 12));
_mm_storeu_si128(DK_mm + 1, _mm_aesimc_si128(_mm_loadu_si128(EK_mm + 11)));
_mm_storeu_si128(DK_mm + 2, _mm_aesimc_si128(_mm_loadu_si128(EK_mm + 10)));
@@ -548,7 +548,7 @@ void AES_256_NI::encrypt_n(const byte in[], byte out[], size_t blocks) const
const __m128i* in_mm = reinterpret_cast<const __m128i*>(in);
__m128i* out_mm = reinterpret_cast<__m128i*>(out);
- const __m128i* key_mm = reinterpret_cast<const __m128i*>(&EK[0]);
+ const __m128i* key_mm = reinterpret_cast<const __m128i*>(EK.data());
__m128i K0 = _mm_loadu_si128(key_mm);
__m128i K1 = _mm_loadu_si128(key_mm + 1);
@@ -636,7 +636,7 @@ void AES_256_NI::decrypt_n(const byte in[], byte out[], size_t blocks) const
const __m128i* in_mm = reinterpret_cast<const __m128i*>(in);
__m128i* out_mm = reinterpret_cast<__m128i*>(out);
- const __m128i* key_mm = reinterpret_cast<const __m128i*>(&DK[0]);
+ const __m128i* key_mm = reinterpret_cast<const __m128i*>(DK.data());
__m128i K0 = _mm_loadu_si128(key_mm);
__m128i K1 = _mm_loadu_si128(key_mm + 1);
@@ -747,7 +747,7 @@ void AES_256_NI::key_schedule(const byte key[], size_t)
__m128i K14 = aes_128_key_expansion(K12, _mm_aeskeygenassist_si128(K13, 0x40));
- __m128i* EK_mm = reinterpret_cast<__m128i*>(&EK[0]);
+ __m128i* EK_mm = reinterpret_cast<__m128i*>(EK.data());
_mm_storeu_si128(EK_mm , K0);
_mm_storeu_si128(EK_mm + 1, K1);
_mm_storeu_si128(EK_mm + 2, K2);
@@ -765,7 +765,7 @@ void AES_256_NI::key_schedule(const byte key[], size_t)
_mm_storeu_si128(EK_mm + 14, K14);
// Now generate decryption keys
- __m128i* DK_mm = reinterpret_cast<__m128i*>(&DK[0]);
+ __m128i* DK_mm = reinterpret_cast<__m128i*>(DK.data());
_mm_storeu_si128(DK_mm , K14);
_mm_storeu_si128(DK_mm + 1, _mm_aesimc_si128(K13));
_mm_storeu_si128(DK_mm + 2, _mm_aesimc_si128(K12));
diff --git a/src/lib/block/aes_ssse3/aes_ssse3.cpp b/src/lib/block/aes_ssse3/aes_ssse3.cpp
index b9731d010..f0d506b6e 100644
--- a/src/lib/block/aes_ssse3/aes_ssse3.cpp
+++ b/src/lib/block/aes_ssse3/aes_ssse3.cpp
@@ -348,7 +348,7 @@ void AES_128_SSSE3::encrypt_n(const byte in[], byte out[], size_t blocks) const
const __m128i* in_mm = reinterpret_cast<const __m128i*>(in);
__m128i* out_mm = reinterpret_cast<__m128i*>(out);
- const __m128i* keys = reinterpret_cast<const __m128i*>(&EK[0]);
+ const __m128i* keys = reinterpret_cast<const __m128i*>(EK.data());
for(size_t i = 0; i != blocks; ++i)
{
@@ -365,7 +365,7 @@ void AES_128_SSSE3::decrypt_n(const byte in[], byte out[], size_t blocks) const
const __m128i* in_mm = reinterpret_cast<const __m128i*>(in);
__m128i* out_mm = reinterpret_cast<__m128i*>(out);
- const __m128i* keys = reinterpret_cast<const __m128i*>(&DK[0]);
+ const __m128i* keys = reinterpret_cast<const __m128i*>(DK.data());
for(size_t i = 0; i != blocks; ++i)
{
@@ -387,8 +387,8 @@ void AES_128_SSSE3::key_schedule(const byte keyb[], size_t)
EK.resize(11*4);
DK.resize(11*4);
- __m128i* EK_mm = reinterpret_cast<__m128i*>(&EK[0]);
- __m128i* DK_mm = reinterpret_cast<__m128i*>(&DK[0]);
+ __m128i* EK_mm = reinterpret_cast<__m128i*>(EK.data());
+ __m128i* DK_mm = reinterpret_cast<__m128i*>(DK.data());
_mm_storeu_si128(DK_mm + 10, _mm_shuffle_epi8(key, sr[2]));
@@ -426,7 +426,7 @@ void AES_192_SSSE3::encrypt_n(const byte in[], byte out[], size_t blocks) const
const __m128i* in_mm = reinterpret_cast<const __m128i*>(in);
__m128i* out_mm = reinterpret_cast<__m128i*>(out);
- const __m128i* keys = reinterpret_cast<const __m128i*>(&EK[0]);
+ const __m128i* keys = reinterpret_cast<const __m128i*>(EK.data());
for(size_t i = 0; i != blocks; ++i)
{
@@ -443,7 +443,7 @@ void AES_192_SSSE3::decrypt_n(const byte in[], byte out[], size_t blocks) const
const __m128i* in_mm = reinterpret_cast<const __m128i*>(in);
__m128i* out_mm = reinterpret_cast<__m128i*>(out);
- const __m128i* keys = reinterpret_cast<const __m128i*>(&DK[0]);
+ const __m128i* keys = reinterpret_cast<const __m128i*>(DK.data());
for(size_t i = 0; i != blocks; ++i)
{
@@ -463,8 +463,8 @@ void AES_192_SSSE3::key_schedule(const byte keyb[], size_t)
EK.resize(13*4);
DK.resize(13*4);
- __m128i* EK_mm = reinterpret_cast<__m128i*>(&EK[0]);
- __m128i* DK_mm = reinterpret_cast<__m128i*>(&DK[0]);
+ __m128i* EK_mm = reinterpret_cast<__m128i*>(EK.data());
+ __m128i* DK_mm = reinterpret_cast<__m128i*>(DK.data());
__m128i key1 = _mm_loadu_si128(reinterpret_cast<const __m128i*>(keyb));
__m128i key2 = _mm_loadu_si128(reinterpret_cast<const __m128i*>((keyb + 8)));
@@ -533,7 +533,7 @@ void AES_256_SSSE3::encrypt_n(const byte in[], byte out[], size_t blocks) const
const __m128i* in_mm = reinterpret_cast<const __m128i*>(in);
__m128i* out_mm = reinterpret_cast<__m128i*>(out);
- const __m128i* keys = reinterpret_cast<const __m128i*>(&EK[0]);
+ const __m128i* keys = reinterpret_cast<const __m128i*>(EK.data());
for(size_t i = 0; i != blocks; ++i)
{
@@ -550,7 +550,7 @@ void AES_256_SSSE3::decrypt_n(const byte in[], byte out[], size_t blocks) const
const __m128i* in_mm = reinterpret_cast<const __m128i*>(in);
__m128i* out_mm = reinterpret_cast<__m128i*>(out);
- const __m128i* keys = reinterpret_cast<const __m128i*>(&DK[0]);
+ const __m128i* keys = reinterpret_cast<const __m128i*>(DK.data());
for(size_t i = 0; i != blocks; ++i)
{
@@ -570,8 +570,8 @@ void AES_256_SSSE3::key_schedule(const byte keyb[], size_t)
EK.resize(15*4);
DK.resize(15*4);
- __m128i* EK_mm = reinterpret_cast<__m128i*>(&EK[0]);
- __m128i* DK_mm = reinterpret_cast<__m128i*>(&DK[0]);
+ __m128i* EK_mm = reinterpret_cast<__m128i*>(EK.data());
+ __m128i* DK_mm = reinterpret_cast<__m128i*>(DK.data());
__m128i key1 = _mm_loadu_si128(reinterpret_cast<const __m128i*>(keyb));
__m128i key2 = _mm_loadu_si128(reinterpret_cast<const __m128i*>((keyb + 16)));
diff --git a/src/lib/block/block_cipher.h b/src/lib/block/block_cipher.h
index 73e67b790..060dbb29b 100644
--- a/src/lib/block/block_cipher.h
+++ b/src/lib/block/block_cipher.h
@@ -82,7 +82,7 @@ class BOTAN_DLL BlockCipher : public SymmetricAlgorithm
template<typename Alloc>
void encrypt(std::vector<byte, Alloc>& block) const
{
- return encrypt_n(&block[0], &block[0], block.size() / block_size());
+ return encrypt_n(block.data(), block.data(), block.size() / block_size());
}
/**
@@ -92,7 +92,7 @@ class BOTAN_DLL BlockCipher : public SymmetricAlgorithm
template<typename Alloc>
void decrypt(std::vector<byte, Alloc>& block) const
{
- return decrypt_n(&block[0], &block[0], block.size() / block_size());
+ return decrypt_n(block.data(), block.data(), block.size() / block_size());
}
/**
@@ -104,7 +104,7 @@ class BOTAN_DLL BlockCipher : public SymmetricAlgorithm
void encrypt(const std::vector<byte, Alloc>& in,
std::vector<byte, Alloc2>& out) const
{
- return encrypt_n(&in[0], &out[0], in.size() / block_size());
+ return encrypt_n(in.data(), out.data(), in.size() / block_size());
}
/**
@@ -116,7 +116,7 @@ class BOTAN_DLL BlockCipher : public SymmetricAlgorithm
void decrypt(const std::vector<byte, Alloc>& in,
std::vector<byte, Alloc2>& out) const
{
- return decrypt_n(&in[0], &out[0], in.size() / block_size());
+ return decrypt_n(in.data(), out.data(), in.size() / block_size());
}
/**
diff --git a/src/lib/block/camellia/camellia.cpp b/src/lib/block/camellia/camellia.cpp
index 5f04c9d12..887878910 100644
--- a/src/lib/block/camellia/camellia.cpp
+++ b/src/lib/block/camellia/camellia.cpp
@@ -127,7 +127,7 @@ void encrypt(const byte in[], byte out[], size_t blocks,
u64bit D1 = load_be<u64bit>(in, 0);
u64bit D2 = load_be<u64bit>(in, 1);
- const u64bit* K = &SK[0];
+ const u64bit* K = SK.data();
D1 ^= *K++;
D2 ^= *K++;
diff --git a/src/lib/block/cast/cast128.cpp b/src/lib/block/cast/cast128.cpp
index 3ac54f5e8..e19c6dcb1 100644
--- a/src/lib/block/cast/cast128.cpp
+++ b/src/lib/block/cast/cast128.cpp
@@ -338,7 +338,7 @@ void CAST_128::cast_ks(secure_vector<u32bit>& K,
};
secure_vector<u32bit> Z(4);
- ByteReader x(&X[0]), z(&Z[0]);
+ ByteReader x(X.data()), z(Z.data());
Z[0] = X[0] ^ S5[x(13)] ^ S6[x(15)] ^ S7[x(12)] ^ S8[x(14)] ^ S7[x( 8)];
Z[1] = X[2] ^ S5[z( 0)] ^ S6[z( 2)] ^ S7[z( 1)] ^ S8[z( 3)] ^ S8[x(10)];
diff --git a/src/lib/block/des/des.cpp b/src/lib/block/des/des.cpp
index 2994b7cb2..c1013b9af 100644
--- a/src/lib/block/des/des.cpp
+++ b/src/lib/block/des/des.cpp
@@ -157,7 +157,7 @@ void DES::encrypt_n(const byte in[], byte out[], size_t blocks) const
u32bit L = static_cast<u32bit>(T >> 32);
u32bit R = static_cast<u32bit>(T);
- des_encrypt(L, R, &round_key[0]);
+ des_encrypt(L, R, round_key.data());
T = (DES_FPTAB1[get_byte(0, L)] << 5) | (DES_FPTAB1[get_byte(1, L)] << 3) |
(DES_FPTAB1[get_byte(2, L)] << 1) | (DES_FPTAB2[get_byte(3, L)] << 1) |
@@ -187,7 +187,7 @@ void DES::decrypt_n(const byte in[], byte out[], size_t blocks) const
u32bit L = static_cast<u32bit>(T >> 32);
u32bit R = static_cast<u32bit>(T);
- des_decrypt(L, R, &round_key[0]);
+ des_decrypt(L, R, round_key.data());
T = (DES_FPTAB1[get_byte(0, L)] << 5) | (DES_FPTAB1[get_byte(1, L)] << 3) |
(DES_FPTAB1[get_byte(2, L)] << 1) | (DES_FPTAB2[get_byte(3, L)] << 1) |
@@ -209,7 +209,7 @@ void DES::decrypt_n(const byte in[], byte out[], size_t blocks) const
void DES::key_schedule(const byte key[], size_t)
{
round_key.resize(32);
- des_key_schedule(&round_key[0], key);
+ des_key_schedule(round_key.data(), key);
}
void DES::clear()
diff --git a/src/lib/block/des/desx.cpp b/src/lib/block/des/desx.cpp
index 92cfc83cc..0e19460fc 100644
--- a/src/lib/block/des/desx.cpp
+++ b/src/lib/block/des/desx.cpp
@@ -19,9 +19,9 @@ void DESX::encrypt_n(const byte in[], byte out[], size_t blocks) const
{
for(size_t i = 0; i != blocks; ++i)
{
- xor_buf(out, in, &K1[0], BLOCK_SIZE);
+ xor_buf(out, in, K1.data(), BLOCK_SIZE);
des.encrypt(out);
- xor_buf(out, &K2[0], BLOCK_SIZE);
+ xor_buf(out, K2.data(), BLOCK_SIZE);
in += BLOCK_SIZE;
out += BLOCK_SIZE;
@@ -35,9 +35,9 @@ void DESX::decrypt_n(const byte in[], byte out[], size_t blocks) const
{
for(size_t i = 0; i != blocks; ++i)
{
- xor_buf(out, in, &K2[0], BLOCK_SIZE);
+ xor_buf(out, in, K2.data(), BLOCK_SIZE);
des.decrypt(out);
- xor_buf(out, &K1[0], BLOCK_SIZE);
+ xor_buf(out, K1.data(), BLOCK_SIZE);
in += BLOCK_SIZE;
out += BLOCK_SIZE;
diff --git a/src/lib/block/idea/idea.cpp b/src/lib/block/idea/idea.cpp
index fa98e3754..764115013 100644
--- a/src/lib/block/idea/idea.cpp
+++ b/src/lib/block/idea/idea.cpp
@@ -110,7 +110,7 @@ void idea_op(const byte in[], byte out[], size_t blocks, const u16bit K[52])
*/
void IDEA::encrypt_n(const byte in[], byte out[], size_t blocks) const
{
- idea_op(in, out, blocks, &EK[0]);
+ idea_op(in, out, blocks, EK.data());
}
/*
@@ -118,7 +118,7 @@ void IDEA::encrypt_n(const byte in[], byte out[], size_t blocks) const
*/
void IDEA::decrypt_n(const byte in[], byte out[], size_t blocks) const
{
- idea_op(in, out, blocks, &DK[0]);
+ idea_op(in, out, blocks, DK.data());
}
/*
diff --git a/src/lib/block/lion/lion.cpp b/src/lib/block/lion/lion.cpp
index a3f15fb51..a487e3eb0 100644
--- a/src/lib/block/lion/lion.cpp
+++ b/src/lib/block/lion/lion.cpp
@@ -42,11 +42,11 @@ void Lion::encrypt_n(const byte in[], byte out[], size_t blocks) const
const size_t RIGHT_SIZE = right_size();
secure_vector<byte> buffer_vec(LEFT_SIZE);
- byte* buffer = &buffer_vec[0];
+ byte* buffer = buffer_vec.data();
for(size_t i = 0; i != blocks; ++i)
{
- xor_buf(buffer, in, &m_key1[0], LEFT_SIZE);
+ xor_buf(buffer, in, m_key1.data(), LEFT_SIZE);
m_cipher->set_key(buffer, LEFT_SIZE);
m_cipher->cipher(in + LEFT_SIZE, out + LEFT_SIZE, RIGHT_SIZE);
@@ -54,7 +54,7 @@ void Lion::encrypt_n(const byte in[], byte out[], size_t blocks) const
m_hash->final(buffer);
xor_buf(out, in, buffer, LEFT_SIZE);
- xor_buf(buffer, out, &m_key2[0], LEFT_SIZE);
+ xor_buf(buffer, out, m_key2.data(), LEFT_SIZE);
m_cipher->set_key(buffer, LEFT_SIZE);
m_cipher->cipher1(out + LEFT_SIZE, RIGHT_SIZE);
@@ -72,11 +72,11 @@ void Lion::decrypt_n(const byte in[], byte out[], size_t blocks) const
const size_t RIGHT_SIZE = right_size();
secure_vector<byte> buffer_vec(LEFT_SIZE);
- byte* buffer = &buffer_vec[0];
+ byte* buffer = buffer_vec.data();
for(size_t i = 0; i != blocks; ++i)
{
- xor_buf(buffer, in, &m_key2[0], LEFT_SIZE);
+ xor_buf(buffer, in, m_key2.data(), LEFT_SIZE);
m_cipher->set_key(buffer, LEFT_SIZE);
m_cipher->cipher(in + LEFT_SIZE, out + LEFT_SIZE, RIGHT_SIZE);
@@ -84,7 +84,7 @@ void Lion::decrypt_n(const byte in[], byte out[], size_t blocks) const
m_hash->final(buffer);
xor_buf(out, in, buffer, LEFT_SIZE);
- xor_buf(buffer, out, &m_key1[0], LEFT_SIZE);
+ xor_buf(buffer, out, m_key1.data(), LEFT_SIZE);
m_cipher->set_key(buffer, LEFT_SIZE);
m_cipher->cipher1(out + LEFT_SIZE, RIGHT_SIZE);
@@ -101,8 +101,8 @@ void Lion::key_schedule(const byte key[], size_t length)
clear();
const size_t half = length / 2;
- copy_mem(&m_key1[0], key, half);
- copy_mem(&m_key2[0], key + half, half);
+ copy_mem(m_key1.data(), key, half);
+ copy_mem(m_key2.data(), key + half, half);
}
/*
diff --git a/src/lib/block/noekeon/noekeon.cpp b/src/lib/block/noekeon/noekeon.cpp
index 09a2f6c15..fb1a215fe 100644
--- a/src/lib/block/noekeon/noekeon.cpp
+++ b/src/lib/block/noekeon/noekeon.cpp
@@ -97,7 +97,7 @@ void Noekeon::encrypt_n(const byte in[], byte out[], size_t blocks) const
for(size_t j = 0; j != 16; ++j)
{
A0 ^= RC[j];
- theta(A0, A1, A2, A3, &EK[0]);
+ theta(A0, A1, A2, A3, EK.data());
A1 = rotate_left(A1, 1);
A2 = rotate_left(A2, 5);
@@ -111,7 +111,7 @@ void Noekeon::encrypt_n(const byte in[], byte out[], size_t blocks) const
}
A0 ^= RC[16];
- theta(A0, A1, A2, A3, &EK[0]);
+ theta(A0, A1, A2, A3, EK.data());
store_be(out, A0, A1, A2, A3);
@@ -134,7 +134,7 @@ void Noekeon::decrypt_n(const byte in[], byte out[], size_t blocks) const
for(size_t j = 16; j != 0; --j)
{
- theta(A0, A1, A2, A3, &DK[0]);
+ theta(A0, A1, A2, A3, DK.data());
A0 ^= RC[j];
A1 = rotate_left(A1, 1);
@@ -148,7 +148,7 @@ void Noekeon::decrypt_n(const byte in[], byte out[], size_t blocks) const
A3 = rotate_right(A3, 2);
}
- theta(A0, A1, A2, A3, &DK[0]);
+ theta(A0, A1, A2, A3, DK.data());
A0 ^= RC[0];
store_be(out, A0, A1, A2, A3);
diff --git a/src/lib/block/rc2/rc2.cpp b/src/lib/block/rc2/rc2.cpp
index 54f85ce00..d1fc8a2e6 100644
--- a/src/lib/block/rc2/rc2.cpp
+++ b/src/lib/block/rc2/rc2.cpp
@@ -126,7 +126,7 @@ void RC2::key_schedule(const byte key[], size_t length)
0xFE, 0x7F, 0xC1, 0xAD };
secure_vector<byte> L(128);
- copy_mem(&L[0], key, length);
+ copy_mem(L.data(), key, length);
for(size_t i = length; i != 128; ++i)
L[i] = TABLE[(L[i-1] + L[i-length]) % 256];
@@ -137,7 +137,7 @@ void RC2::key_schedule(const byte key[], size_t length)
L[i] = TABLE[L[i+1] ^ L[i+length]];
K.resize(64);
- load_le<u16bit>(&K[0], &L[0], 64);
+ load_le<u16bit>(K.data(), L.data(), 64);
}
void RC2::clear()
diff --git a/src/lib/block/serpent_x86_32/serp_x86_32.cpp b/src/lib/block/serpent_x86_32/serp_x86_32.cpp
index 7e52a5118..f055880b3 100644
--- a/src/lib/block/serpent_x86_32/serp_x86_32.cpp
+++ b/src/lib/block/serpent_x86_32/serp_x86_32.cpp
@@ -52,7 +52,7 @@ void Serpent_X86_32::encrypt_n(const byte in[], byte out[], size_t blocks) const
for(size_t i = 0; i != blocks; ++i)
{
- botan_serpent_x86_32_encrypt(in, out, &keys[0]);
+ botan_serpent_x86_32_encrypt(in, out, keys.data());
in += BLOCK_SIZE;
out += BLOCK_SIZE;
}
@@ -67,7 +67,7 @@ void Serpent_X86_32::decrypt_n(const byte in[], byte out[], size_t blocks) const
for(size_t i = 0; i != blocks; ++i)
{
- botan_serpent_x86_32_decrypt(in, out, &keys[0]);
+ botan_serpent_x86_32_decrypt(in, out, keys.data());
in += BLOCK_SIZE;
out += BLOCK_SIZE;
}
@@ -83,7 +83,7 @@ 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[0]);
+ botan_serpent_x86_32_key_schedule(W.data());
this->set_round_keys(&W[8]);
}