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/aead/chacha20poly1305 | |
parent | d4811ce2ea1c041795804e3ebd2a661d7e043d17 (diff) |
lib/modes: Convert &vec[0] to vec.data()
Diffstat (limited to 'src/lib/modes/aead/chacha20poly1305')
-rw-r--r-- | src/lib/modes/aead/chacha20poly1305/chacha20poly1305.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/modes/aead/chacha20poly1305/chacha20poly1305.cpp b/src/lib/modes/aead/chacha20poly1305/chacha20poly1305.cpp index 37e0ef96b..3dc9d7f6d 100644 --- a/src/lib/modes/aead/chacha20poly1305/chacha20poly1305.cpp +++ b/src/lib/modes/aead/chacha20poly1305/chacha20poly1305.cpp @@ -63,7 +63,7 @@ secure_vector<byte> ChaCha20Poly1305_Mode::start_raw(const byte nonce[], size_t secure_vector<byte> zeros(64); m_chacha->encrypt(zeros); - m_poly1305->set_key(&zeros[0], 32); + m_poly1305->set_key(zeros.data(), 32); // Remainder of output is discard m_poly1305->update(m_ad); @@ -85,7 +85,7 @@ void ChaCha20Poly1305_Encryption::update(secure_vector<byte>& buffer, size_t off { BOTAN_ASSERT(buffer.size() >= offset, "Offset is sane"); const size_t sz = buffer.size() - offset; - byte* buf = &buffer[offset]; + byte* buf = buffer.data() + offset; m_chacha->cipher1(buf, sz); m_poly1305->update(buf, sz); // poly1305 of ciphertext @@ -104,7 +104,7 @@ void ChaCha20Poly1305_Encryption::finish(secure_vector<byte>& buffer, size_t off update_len(m_ctext_len); const secure_vector<byte> mac = m_poly1305->final(); - buffer += std::make_pair(&mac[0], tag_size()); + buffer += std::make_pair(mac.data(), tag_size()); m_ctext_len = 0; } @@ -112,7 +112,7 @@ void ChaCha20Poly1305_Decryption::update(secure_vector<byte>& buffer, size_t off { BOTAN_ASSERT(buffer.size() >= offset, "Offset is sane"); const size_t sz = buffer.size() - offset; - byte* buf = &buffer[offset]; + byte* buf = buffer.data() + offset; m_poly1305->update(buf, sz); // poly1305 of ciphertext m_chacha->cipher1(buf, sz); @@ -123,7 +123,7 @@ void ChaCha20Poly1305_Decryption::finish(secure_vector<byte>& buffer, size_t off { BOTAN_ASSERT(buffer.size() >= offset, "Offset is sane"); const size_t sz = buffer.size() - offset; - byte* buf = &buffer[offset]; + byte* buf = buffer.data() + offset; BOTAN_ASSERT(sz >= tag_size(), "Have the tag as part of final input"); @@ -150,7 +150,7 @@ void ChaCha20Poly1305_Decryption::finish(secure_vector<byte>& buffer, size_t off m_ctext_len = 0; - if(!same_mem(&mac[0], included_tag, tag_size())) + if(!same_mem(mac.data(), included_tag, tag_size())) throw Integrity_Failure("ChaCha20Poly1305 tag check failed"); buffer.resize(offset + remaining); } |