diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2022-03-31 23:35:37 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2022-04-29 23:39:12 +0200 |
commit | 399195dc6f40e04117aa2994f0763394c6c7f70f (patch) | |
tree | 5c2bb494e29c2a6bfbce5b7772196dcbb688eab5 /src | |
parent | 0bee44226cc60f2d18188dfb23f485e166073363 (diff) |
Channel: fix nonce copying into header
Diffstat (limited to 'src')
-rw-r--r-- | src/channel.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/channel.cpp b/src/channel.cpp index f5cfb9c..49e9109 100644 --- a/src/channel.cpp +++ b/src/channel.cpp @@ -1,6 +1,7 @@ #include "channel.h" #include <algorithm> +#include <cstring> #include <stdexcept> using std::remove_const; @@ -141,7 +142,7 @@ vector<uint8_t> Channel::encrypt(const vector<uint8_t> & plain) array<uint8_t, 12> iv; uint64_t beCount = htobe64(nonceCounter++); - std::copy_n(&beCount, 6, res.begin()); + std::memcpy(res.data(), &beCount, 8); std::copy_n(nonceFixedOur.begin(), 6, iv.begin()); std::copy_n(res.begin() + 2, 6, iv.begin() + 6); |