From 399195dc6f40e04117aa2994f0763394c6c7f70f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Thu, 31 Mar 2022 23:35:37 +0200 Subject: Channel: fix nonce copying into header --- src/channel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') 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 +#include #include using std::remove_const; @@ -141,7 +142,7 @@ vector Channel::encrypt(const vector & plain) array 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); -- cgit v1.2.3