From b6c79e70b16e862a7ffd3b54e980263548c1d251 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Tue, 23 Jun 2015 21:07:00 +0200 Subject: lib/modes: Convert &vec[0] to vec.data() --- src/lib/modes/cbc/cbc.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/lib/modes/cbc/cbc.cpp') diff --git a/src/lib/modes/cbc/cbc.cpp b/src/lib/modes/cbc/cbc.cpp index 7cee72081..27f2bce4a 100644 --- a/src/lib/modes/cbc/cbc.cpp +++ b/src/lib/modes/cbc/cbc.cpp @@ -112,7 +112,7 @@ void CBC_Encryption::update(secure_vector& buffer, size_t offset) { BOTAN_ASSERT(buffer.size() >= offset, "Offset is sane"); const size_t sz = buffer.size() - offset; - byte* buf = &buffer[offset]; + byte* buf = buffer.data() + offset; const size_t BS = cipher().block_size(); @@ -168,7 +168,7 @@ size_t CTS_Encryption::output_length(size_t input_length) const void CTS_Encryption::finish(secure_vector& buffer, size_t offset) { BOTAN_ASSERT(buffer.size() >= offset, "Offset is sane"); - byte* buf = &buffer[offset]; + byte* buf = buffer.data() + offset; const size_t sz = buffer.size() - offset; const size_t BS = cipher().block_size(); @@ -194,8 +194,8 @@ void CTS_Encryption::finish(secure_vector& buffer, size_t offset) buffer.resize(full_blocks + offset); update(buffer, offset); - xor_buf(&last[0], state_ptr(), BS); - cipher().encrypt(&last[0]); + xor_buf(last.data(), state_ptr(), BS); + cipher().encrypt(last.data()); for(size_t i = 0; i != final_bytes - BS; ++i) { @@ -203,7 +203,7 @@ void CTS_Encryption::finish(secure_vector& buffer, size_t offset) last[i + BS] ^= last[i]; } - cipher().encrypt(&last[0]); + cipher().encrypt(last.data()); buffer += last; } @@ -223,7 +223,7 @@ void CBC_Decryption::update(secure_vector& buffer, size_t offset) { BOTAN_ASSERT(buffer.size() >= offset, "Offset is sane"); const size_t sz = buffer.size() - offset; - byte* buf = &buffer[offset]; + byte* buf = buffer.data() + offset; const size_t BS = cipher().block_size(); @@ -234,13 +234,13 @@ void CBC_Decryption::update(secure_vector& buffer, size_t offset) { const size_t to_proc = std::min(BS * blocks, m_tempbuf.size()); - cipher().decrypt_n(buf, &m_tempbuf[0], to_proc / BS); + cipher().decrypt_n(buf, m_tempbuf.data(), to_proc / BS); - xor_buf(&m_tempbuf[0], state_ptr(), BS); + xor_buf(m_tempbuf.data(), state_ptr(), BS); xor_buf(&m_tempbuf[BS], buf, to_proc - BS); copy_mem(state_ptr(), buf + (to_proc - BS), BS); - copy_mem(buf, &m_tempbuf[0], to_proc); + copy_mem(buf, m_tempbuf.data(), to_proc); buf += to_proc; blocks -= to_proc / BS; @@ -277,7 +277,7 @@ void CTS_Decryption::finish(secure_vector& buffer, size_t offset) { BOTAN_ASSERT(buffer.size() >= offset, "Offset is sane"); const size_t sz = buffer.size() - offset; - byte* buf = &buffer[offset]; + byte* buf = buffer.data() + offset; const size_t BS = cipher().block_size(); @@ -303,15 +303,15 @@ void CTS_Decryption::finish(secure_vector& buffer, size_t offset) buffer.resize(full_blocks + offset); update(buffer, offset); - cipher().decrypt(&last[0]); + cipher().decrypt(last.data()); - xor_buf(&last[0], &last[BS], final_bytes - BS); + xor_buf(last.data(), &last[BS], final_bytes - BS); for(size_t i = 0; i != final_bytes - BS; ++i) std::swap(last[i], last[i + BS]); - cipher().decrypt(&last[0]); - xor_buf(&last[0], state_ptr(), BS); + cipher().decrypt(last.data()); + xor_buf(last.data(), state_ptr(), BS); buffer += last; } -- cgit v1.2.3