diff options
author | Simon Warta <[email protected]> | 2015-06-23 21:07:00 +0200 |
---|---|---|
committer | Simon Warta <[email protected]> | 2015-06-24 12:22:07 +0200 |
commit | b6c79e70b16e862a7ffd3b54e980263548c1d251 (patch) | |
tree | 98cb253307a7096c5466bc2e2b6c471cffd08e49 /src/lib/modes/cfb | |
parent | d4811ce2ea1c041795804e3ebd2a661d7e043d17 (diff) |
lib/modes: Convert &vec[0] to vec.data()
Diffstat (limited to 'src/lib/modes/cfb')
-rw-r--r-- | src/lib/modes/cfb/cfb.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/modes/cfb/cfb.cpp b/src/lib/modes/cfb/cfb.cpp index c1fd98dfb..7e4048a2b 100644 --- a/src/lib/modes/cfb/cfb.cpp +++ b/src/lib/modes/cfb/cfb.cpp @@ -87,7 +87,7 @@ void CFB_Encryption::update(secure_vector<byte>& buffer, size_t offset) { BOTAN_ASSERT(buffer.size() >= offset, "Offset is sane"); size_t sz = buffer.size() - offset; - byte* buf = &buffer[offset]; + byte* buf = buffer.data() + offset; const size_t BS = cipher().block_size(); @@ -97,11 +97,11 @@ void CFB_Encryption::update(secure_vector<byte>& buffer, size_t offset) while(sz) { const size_t took = std::min(shift, sz); - xor_buf(&buf[0], &keystream_buf()[0], took); + xor_buf(buf, &keystream_buf()[0], took); // Assumes feedback-sized block except for last input - copy_mem(&state[0], &state[shift], BS - shift); - copy_mem(&state[BS-shift], &buf[0], took); + copy_mem(state.data(), &state[shift], BS - shift); + copy_mem(&state[BS-shift], buf, took); cipher().encrypt(state, keystream_buf()); buf += took; @@ -118,7 +118,7 @@ void CFB_Decryption::update(secure_vector<byte>& buffer, size_t offset) { BOTAN_ASSERT(buffer.size() >= offset, "Offset is sane"); size_t sz = buffer.size() - offset; - byte* buf = &buffer[offset]; + byte* buf = buffer.data() + offset; const size_t BS = cipher().block_size(); @@ -130,11 +130,11 @@ void CFB_Decryption::update(secure_vector<byte>& buffer, size_t offset) const size_t took = std::min(shift, sz); // first update shift register with ciphertext - copy_mem(&state[0], &state[shift], BS - shift); - copy_mem(&state[BS-shift], &buf[0], took); + copy_mem(state.data(), &state[shift], BS - shift); + copy_mem(&state[BS-shift], buf, took); // then decrypt - xor_buf(&buf[0], &keystream_buf()[0], took); + xor_buf(buf, &keystream_buf()[0], took); // then update keystream cipher().encrypt(state, keystream_buf()); |