1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00

make it work on mac os with makefiles

This commit is contained in:
Jeff 2018-06-14 16:13:07 -04:00
parent 22d4d5b3d0
commit 98f332f7a5
4 changed files with 10 additions and 8 deletions

View file

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

View file

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

View file

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

View file

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