diff --git a/include/llarp/encrypted_frame.hpp b/include/llarp/encrypted_frame.hpp index 38be82701..84b45ddea 100644 --- a/include/llarp/encrypted_frame.hpp +++ b/include/llarp/encrypted_frame.hpp @@ -10,14 +10,12 @@ namespace llarp { struct EncryptedFrame : public Encrypted { - static constexpr size_t OverheadSize = - PUBKEYSIZE + TUNNONCESIZE + SHORTHASHSIZE; - EncryptedFrame() = default; EncryptedFrame(byte_t* buf, size_t sz) : Encrypted(buf, sz) { } - EncryptedFrame(size_t sz) : Encrypted(sz + OverheadSize) + EncryptedFrame(size_t sz) + : Encrypted(sz + PUBKEYSIZE + TUNNONCESIZE + SHORTHASHSIZE) { } @@ -68,7 +66,8 @@ namespace llarp // TODO: should we own otherKey? otherKey = other; frame = new EncryptedFrame(buf.sz); - memcpy(frame->data + EncryptedFrame::OverheadSize, buf.base, buf.sz); + memcpy(frame->data + PUBKEYSIZE + TUNNONCESIZE + SHORTHASHSIZE, buf.base, + buf.sz); user = u; llarp_threadpool_queue_job(worker, {this, &Encrypt}); } @@ -110,6 +109,6 @@ namespace llarp llarp_threadpool_queue_job(worker, {this, &Decrypt}); } }; -} +} // namespace llarp #endif diff --git a/include/llarp/path.hpp b/include/llarp/path.hpp index 5189b3f18..67c8c0975 100644 --- a/include/llarp/path.hpp +++ b/include/llarp/path.hpp @@ -111,7 +111,7 @@ namespace llarp auto& hop = ctx->path.hops[ctx->idx]; ctx->dh(hop.shared, hop.encryptionKey, hop.nonce, ctx->secretkey); ++ctx->idx; - if(ctx->idx < ctx.path.hops.size()) + if(ctx->idx < ctx->path.hops.size()) { llarp_threadpool_queue_job(ctx->worker, {ctx, &GenerateNextKey}); } @@ -294,4 +294,4 @@ namespace llarp }; } -#endif \ No newline at end of file +#endif diff --git a/llarp/encrypted_frame.cpp b/llarp/encrypted_frame.cpp index 3f65894df..971df0795 100644 --- a/llarp/encrypted_frame.cpp +++ b/llarp/encrypted_frame.cpp @@ -2,6 +2,8 @@ #include #include "logger.hpp" +#define OverheadSize (PUBKEYSIZE + TUNNONCESIZE + SHORTHASHSIZE) + namespace llarp { Encrypted::Encrypted(const byte_t* buf, size_t sz) diff --git a/vendor/cppbackport-master/lib/fs/path.h b/vendor/cppbackport-master/lib/fs/path.h index 68c62c6b0..e72d1a585 100644 --- a/vendor/cppbackport-master/lib/fs/path.h +++ b/vendor/cppbackport-master/lib/fs/path.h @@ -31,6 +31,7 @@ #include #include #include +#include namespace cpp17 {