make it work on mac os with makefiles

pull/1/head
Jeff 6 years ago
parent 22d4d5b3d0
commit 98f332f7a5

@ -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

@ -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
#endif

@ -2,6 +2,8 @@
#include <llarp/encrypted_frame.hpp>
#include "logger.hpp"
#define OverheadSize (PUBKEYSIZE + TUNNONCESIZE + SHORTHASHSIZE)
namespace llarp
{
Encrypted::Encrypted(const byte_t* buf, size_t sz)

@ -31,6 +31,7 @@
#include <string>
#include <iosfwd>
#include <iterator>
#include <iostream>
namespace cpp17
{

Loading…
Cancel
Save