A bunch of little warning removal and format fix things.

This commit is contained in:
Adam Ierymenko 2020-12-04 15:52:30 -05:00
parent ec76f6e1d2
commit 7d951783ca
No known key found for this signature in database
GPG key ID: C8877CF2D7A5D7F3
16 changed files with 484 additions and 376 deletions

View file

@ -11,8 +11,11 @@
*/ */
/****/ /****/
// Note that the actual code in C25519.cpp is in the public domain as per /*
// its original license. * The code in C25519.cpp is in the public domain rather than being under
* ZeroTier's license. Other than ZeroTier shims it contains public domain
* C25519/Ed25519 code by D. J. Bernstein and Matthew Dempsky.
*/
#ifndef ZT_C25519_HPP #ifndef ZT_C25519_HPP
#define ZT_C25519_HPP #define ZT_C25519_HPP

View file

@ -24,8 +24,8 @@ extern "C" {
// These macros make the idiom of passing buffers to outside code via the API work properly even // These macros make the idiom of passing buffers to outside code via the API work properly even
// if the first address of Buf does not overlap with its data field, since the C++ standard does // if the first address of Buf does not overlap with its data field, since the C++ standard does
// not absolutely guarantee this. // not absolutely guarantee this.
#define _ZT_PTRTOBUF(p) ((ZeroTier::Buf *)( ((uintptr_t)(p)) - ((uintptr_t)&(((ZeroTier::Buf *)0)->unsafeData[0])) )) #define ZT_PTRTOBUF(p) ((ZeroTier::Buf *)( ((uintptr_t)(p)) - ((uintptr_t)&(((ZeroTier::Buf *)0)->unsafeData[0])) ))
#define _ZT_BUFTOPTR(b) ((void *)(&((b)->unsafeData[0]))) #define ZT_BUFTOPTR(b) ((void *)(&((b)->unsafeData[0])))
void *ZT_getBuffer() void *ZT_getBuffer()
{ {
@ -35,7 +35,7 @@ void *ZT_getBuffer()
// When this occurs it's either sent back to the pool with Buf's delete operator or // When this occurs it's either sent back to the pool with Buf's delete operator or
// wrapped in a SharedPtr<> to be passed into the core. // wrapped in a SharedPtr<> to be passed into the core.
try { try {
return _ZT_BUFTOPTR(new ZeroTier::Buf()); return ZT_BUFTOPTR(new ZeroTier::Buf());
} catch (...) { } catch (...) {
return nullptr; // can only happen on out of memory condition return nullptr; // can only happen on out of memory condition
} }
@ -44,7 +44,7 @@ void *ZT_getBuffer()
void ZT_freeBuffer(void *b) void ZT_freeBuffer(void *b)
{ {
if (b) if (b)
delete _ZT_PTRTOBUF(b); delete ZT_PTRTOBUF(b);
} }
struct p_queryResultBase struct p_queryResultBase
@ -74,7 +74,7 @@ void ZT_version(int *major, int *minor, int *revision, int *build)
enum ZT_ResultCode ZT_Node_new(ZT_Node **node, void *uptr, void *tptr, const struct ZT_Node_Callbacks *callbacks, int64_t now) enum ZT_ResultCode ZT_Node_new(ZT_Node **node, void *uptr, void *tptr, const struct ZT_Node_Callbacks *callbacks, int64_t now)
{ {
*node = (ZT_Node *)0; *node = nullptr;
try { try {
*node = reinterpret_cast<ZT_Node *>(new ZeroTier::Node(uptr, tptr, callbacks, now)); *node = reinterpret_cast<ZT_Node *>(new ZeroTier::Node(uptr, tptr, callbacks, now));
return ZT_RESULT_OK; return ZT_RESULT_OK;
@ -107,7 +107,7 @@ enum ZT_ResultCode ZT_Node_processWirePacket(
volatile int64_t *nextBackgroundTaskDeadline) volatile int64_t *nextBackgroundTaskDeadline)
{ {
try { try {
ZeroTier::SharedPtr< ZeroTier::Buf > buf((isZtBuffer) ? _ZT_PTRTOBUF(packetData) : new ZeroTier::Buf(packetData, packetLength & ZT_BUF_MEM_MASK)); ZeroTier::SharedPtr< ZeroTier::Buf > buf((isZtBuffer) ? ZT_PTRTOBUF(packetData) : new ZeroTier::Buf(packetData, packetLength & ZT_BUF_MEM_MASK));
return reinterpret_cast<ZeroTier::Node *>(node)->processWirePacket(tptr, now, localSocket, remoteAddress, buf, packetLength, nextBackgroundTaskDeadline); return reinterpret_cast<ZeroTier::Node *>(node)->processWirePacket(tptr, now, localSocket, remoteAddress, buf, packetLength, nextBackgroundTaskDeadline);
} catch (std::bad_alloc &exc) { } catch (std::bad_alloc &exc) {
return ZT_RESULT_FATAL_ERROR_OUT_OF_MEMORY; return ZT_RESULT_FATAL_ERROR_OUT_OF_MEMORY;
@ -133,7 +133,7 @@ enum ZT_ResultCode ZT_Node_processVirtualNetworkFrame(
volatile int64_t *nextBackgroundTaskDeadline) volatile int64_t *nextBackgroundTaskDeadline)
{ {
try { try {
ZeroTier::SharedPtr< ZeroTier::Buf > buf((isZtBuffer) ? _ZT_PTRTOBUF(frameData) : new ZeroTier::Buf(frameData, frameLength & ZT_BUF_MEM_MASK)); ZeroTier::SharedPtr< ZeroTier::Buf > buf((isZtBuffer) ? ZT_PTRTOBUF(frameData) : new ZeroTier::Buf(frameData, frameLength & ZT_BUF_MEM_MASK));
return reinterpret_cast<ZeroTier::Node *>(node)->processVirtualNetworkFrame(tptr, now, nwid, sourceMac, destMac, etherType, vlanId, buf, frameLength, nextBackgroundTaskDeadline); return reinterpret_cast<ZeroTier::Node *>(node)->processVirtualNetworkFrame(tptr, now, nwid, sourceMac, destMac, etherType, vlanId, buf, frameLength, nextBackgroundTaskDeadline);
} catch (std::bad_alloc &exc) { } catch (std::bad_alloc &exc) {
return ZT_RESULT_FATAL_ERROR_OUT_OF_MEMORY; return ZT_RESULT_FATAL_ERROR_OUT_OF_MEMORY;

View file

@ -112,7 +112,7 @@ public:
* *
* @param RR Runtime environment to provide for peer lookup, etc. * @param RR Runtime environment to provide for peer lookup, etc.
*/ */
ZT_INLINE Credential::VerifyResult verify(const RuntimeEnvironment *RR,void *tPtr) const noexcept { return _verify(RR,tPtr,*this); } ZT_INLINE Credential::VerifyResult verify(const RuntimeEnvironment *RR,void *tPtr) const noexcept { return s_verify(RR, tPtr, *this); }
static constexpr int marshalSizeMax() noexcept { return ZT_CAPABILITY_MARSHAL_SIZE_MAX; } static constexpr int marshalSizeMax() noexcept { return ZT_CAPABILITY_MARSHAL_SIZE_MAX; }
int marshal(uint8_t data[ZT_CAPABILITY_MARSHAL_SIZE_MAX],bool forSign = false) const noexcept; int marshal(uint8_t data[ZT_CAPABILITY_MARSHAL_SIZE_MAX],bool forSign = false) const noexcept;

View file

@ -58,7 +58,7 @@ public:
Certificate &operator=(const ZT_Certificate &cert); Certificate &operator=(const ZT_Certificate &cert);
ZT_INLINE Certificate &operator=(const Certificate &cert) ZT_INLINE Certificate &operator=(const Certificate &cert) noexcept
{ {
if (likely(&cert != this)) { if (likely(&cert != this)) {
const ZT_Certificate *const sup = &cert; const ZT_Certificate *const sup = &cert;

View file

@ -43,7 +43,7 @@
namespace ZeroTier { namespace ZeroTier {
template<typename CRED> template<typename CRED>
static ZT_INLINE Credential::VerifyResult _credVerify(const RuntimeEnvironment *RR,void *tPtr,CRED credential) static ZT_INLINE Credential::VerifyResult p_credVerify(const RuntimeEnvironment *RR,void *tPtr,CRED credential)
{ {
uint8_t tmp[ZT_BUF_MEM_SIZE + 16]; uint8_t tmp[ZT_BUF_MEM_SIZE + 16];
@ -66,12 +66,12 @@ static ZT_INLINE Credential::VerifyResult _credVerify(const RuntimeEnvironment *
return Credential::VERIFY_BAD_SIGNATURE; return Credential::VERIFY_BAD_SIGNATURE;
} }
Credential::VerifyResult Credential::_verify(const RuntimeEnvironment *const RR,void *tPtr,const RevocationCredential &credential) const { return _credVerify(RR, tPtr, credential); } Credential::VerifyResult Credential::s_verify(const RuntimeEnvironment *RR, void *tPtr, const RevocationCredential &credential) { return p_credVerify(RR, tPtr, credential); }
Credential::VerifyResult Credential::_verify(const RuntimeEnvironment *const RR,void *tPtr,const TagCredential &credential) const { return _credVerify(RR, tPtr, credential); } Credential::VerifyResult Credential::s_verify(const RuntimeEnvironment *RR, void *tPtr, const TagCredential &credential) { return p_credVerify(RR, tPtr, credential); }
Credential::VerifyResult Credential::_verify(const RuntimeEnvironment *const RR,void *tPtr,const CapabilityCredential &credential) const { return _credVerify(RR, tPtr, credential); } Credential::VerifyResult Credential::s_verify(const RuntimeEnvironment *RR, void *tPtr, const CapabilityCredential &credential) { return p_credVerify(RR, tPtr, credential); }
Credential::VerifyResult Credential::_verify(const RuntimeEnvironment *const RR,void *tPtr,const OwnershipCredential &credential) const { return _credVerify(RR, tPtr, credential); } Credential::VerifyResult Credential::s_verify(const RuntimeEnvironment *RR, void *tPtr, const OwnershipCredential &credential) { return p_credVerify(RR, tPtr, credential); }
Credential::VerifyResult Credential::_verify(const RuntimeEnvironment *const RR,void *tPtr,const MembershipCredential &credential) const Credential::VerifyResult Credential::s_verify(const RuntimeEnvironment *RR, void *tPtr, const MembershipCredential &credential)
{ {
// Sanity check network ID. // Sanity check network ID.
if ((!credential.m_signedBy) || (credential.m_signedBy != Network::controllerFor(credential.m_networkId))) if ((!credential.m_signedBy) || (credential.m_signedBy != Network::controllerFor(credential.m_networkId)))

View file

@ -52,11 +52,11 @@ public:
}; };
protected: protected:
VerifyResult _verify(const RuntimeEnvironment *RR,void *tPtr,const MembershipCredential &credential) const; static VerifyResult s_verify(const RuntimeEnvironment *RR, void *tPtr, const MembershipCredential &credential);
VerifyResult _verify(const RuntimeEnvironment *RR,void *tPtr,const RevocationCredential &credential) const; static VerifyResult s_verify(const RuntimeEnvironment *RR, void *tPtr, const RevocationCredential &credential);
VerifyResult _verify(const RuntimeEnvironment *RR,void *tPtr,const TagCredential &credential) const; static VerifyResult s_verify(const RuntimeEnvironment *RR, void *tPtr, const TagCredential &credential);
VerifyResult _verify(const RuntimeEnvironment *RR,void *tPtr,const OwnershipCredential &credential) const; static VerifyResult s_verify(const RuntimeEnvironment *RR, void *tPtr, const OwnershipCredential &credential);
VerifyResult _verify(const RuntimeEnvironment *RR,void *tPtr,const CapabilityCredential &credential) const; static VerifyResult s_verify(const RuntimeEnvironment *RR, void *tPtr, const CapabilityCredential &credential);
}; };
} // namespace ZeroTier } // namespace ZeroTier

View file

@ -30,14 +30,12 @@ class Identity;
* This data structure is used for network configurations, node meta-data, * This data structure is used for network configurations, node meta-data,
* and other open-definition protocol objects. * and other open-definition protocol objects.
* *
* If this seems a little odd, it is. It dates back to the very first alpha * This is technically a binary encoding, but with delimiters chosen so that
* versions of ZeroTier and if it were redesigned today we'd use some kind * it looks like a series of key=value lines of the keys and values are
* of simple or standardized binary encoding. Nevertheless it is efficient * human-readable strings.
* and it works so there is no need to change it and break backward
* compatibility.
* *
* Use of the append functions is faster than building and then encoding a * The fastest way to build a dictionary to send is to use the append
* dictionary for creating outbound packets. * static functions, not to populate and then encode a Dictionary.
*/ */
class Dictionary class Dictionary
{ {
@ -408,7 +406,7 @@ private:
{ {
switch (c) { switch (c) {
case 0: case 0:
out.push_back(92); // backslash out.push_back(92);
out.push_back(48); out.push_back(48);
break; break;
case 10: case 10:

View file

@ -11,10 +11,21 @@
*/ */
/****/ /****/
// This is glue code to ease the use of the NIST P-384 elliptic curve. /*
* The contents of ECC384.cpp are third party code and are licensed under
// Note that the code inside ECC384.cpp is third party code and * the BSD 2-clause license.
// is under the BSD 2-clause license rather than ZeroTier's license. *
* The built-in implementation is easy-ecc by Kenneth MacKay and can be found
* here: https://github.com/esxgx/easy-ecc
*
* Our copy is trimmed down with unused stuff removed and also contains a few
* ZeroTier shims to implement these function interfaces. Otherwise it is
* unmodified from the original. It's a nice and fairly fast portable
* implementation that should build everywhere.
*
* For FIPS-compliant builds this will eventually link against FIPS-compliant
* crypto libraries instead of using the built-in version.
*/
#ifndef ZT_ECC384_HPP #ifndef ZT_ECC384_HPP
#define ZT_ECC384_HPP #define ZT_ECC384_HPP

View file

@ -70,7 +70,8 @@ FORCE_INLINE void LZ4_resetStream (LZ4_stream_t* streamPtr);
#define LZ4_HASHLOG (LZ4_MEMORY_USAGE-2) #define LZ4_HASHLOG (LZ4_MEMORY_USAGE-2)
#define LZ4_HASH_SIZE_U32 (1 << LZ4_HASHLOG) /* required as macro for static allocation */ #define LZ4_HASH_SIZE_U32 (1 << LZ4_HASHLOG) /* required as macro for static allocation */
typedef struct { typedef struct
{
uint32_t hashTable[LZ4_HASH_SIZE_U32]; uint32_t hashTable[LZ4_HASH_SIZE_U32];
uint32_t currentOffset; uint32_t currentOffset;
uint32_t initCheck; uint32_t initCheck;
@ -79,7 +80,8 @@ typedef struct {
uint32_t dictSize; uint32_t dictSize;
} LZ4_stream_t_internal; } LZ4_stream_t_internal;
typedef struct { typedef struct
{
const uint8_t *externalDict; const uint8_t *externalDict;
size_t extDictSize; size_t extDictSize;
const uint8_t *prefixEnd; const uint8_t *prefixEnd;
@ -87,13 +89,15 @@ typedef struct {
} LZ4_streamDecode_t_internal; } LZ4_streamDecode_t_internal;
#define LZ4_STREAMSIZE_U64 ((1 << (LZ4_MEMORY_USAGE-3)) + 4) #define LZ4_STREAMSIZE_U64 ((1 << (LZ4_MEMORY_USAGE-3)) + 4)
union LZ4_stream_u { union LZ4_stream_u
{
unsigned long long table[LZ4_STREAMSIZE_U64]; unsigned long long table[LZ4_STREAMSIZE_U64];
LZ4_stream_t_internal internal_donotuse; LZ4_stream_t_internal internal_donotuse;
}; /* previously typedef'd to LZ4_stream_t */ }; /* previously typedef'd to LZ4_stream_t */
#define LZ4_STREAMDECODESIZE_U64 4 #define LZ4_STREAMDECODESIZE_U64 4
union LZ4_streamDecode_u { union LZ4_streamDecode_u
{
unsigned long long table[LZ4_STREAMDECODESIZE_U64]; unsigned long long table[LZ4_STREAMDECODESIZE_U64];
LZ4_streamDecode_t_internal internal_donotuse; LZ4_streamDecode_t_internal internal_donotuse;
}; /* previously typedef'd to LZ4_streamDecode_t */ }; /* previously typedef'd to LZ4_streamDecode_t */
@ -130,11 +134,21 @@ typedef uintptr_t reg_t;
#endif #endif
#if defined(LZ4_FORCE_MEMORY_ACCESS) && (LZ4_FORCE_MEMORY_ACCESS == 2) #if defined(LZ4_FORCE_MEMORY_ACCESS) && (LZ4_FORCE_MEMORY_ACCESS == 2)
FORCE_INLINE U16 LZ4_read16(const void* memPtr) { return *(const U16*) memPtr; } FORCE_INLINE U16 LZ4_read16(const void *memPtr)
FORCE_INLINE U32 LZ4_read32(const void* memPtr) { return *(const U32*) memPtr; } { return *(const U16 *)memPtr; }
FORCE_INLINE reg_t LZ4_read_ARCH(const void* memPtr) { return *(const reg_t*) memPtr; }
FORCE_INLINE void LZ4_write16(void* memPtr, U16 value) { *(U16*)memPtr = value; } FORCE_INLINE U32 LZ4_read32(const void *memPtr)
FORCE_INLINE void LZ4_write32(void* memPtr, U32 value) { *(U32*)memPtr = value; } { return *(const U32 *)memPtr; }
FORCE_INLINE reg_t LZ4_read_ARCH(const void *memPtr)
{ return *(const reg_t *)memPtr; }
FORCE_INLINE void LZ4_write16(void *memPtr, U16 value)
{ *(U16 *)memPtr = value; }
FORCE_INLINE void LZ4_write32(void *memPtr, U32 value)
{ *(U32 *)memPtr = value; }
#elif defined(LZ4_FORCE_MEMORY_ACCESS) && (LZ4_FORCE_MEMORY_ACCESS == 1) #elif defined(LZ4_FORCE_MEMORY_ACCESS) && (LZ4_FORCE_MEMORY_ACCESS == 1)
typedef union { U16 u16; U32 u32; reg_t uArch; } __attribute__((packed)) unalign; typedef union { U16 u16; U32 u32; reg_t uArch; } __attribute__((packed)) unalign;
FORCE_INLINE U16 LZ4_read16(const void* ptr) { return ((const unalign*)ptr)->u16; } FORCE_INLINE U16 LZ4_read16(const void* ptr) { return ((const unalign*)ptr)->u16; }
@ -196,7 +210,12 @@ FORCE_INLINE void LZ4_wildCopy(void* dstPtr, const void* srcPtr, void* dstEnd)
BYTE *d = (BYTE *)dstPtr; BYTE *d = (BYTE *)dstPtr;
const BYTE *s = (const BYTE *)srcPtr; const BYTE *s = (const BYTE *)srcPtr;
BYTE *const e = (BYTE *)dstEnd; BYTE *const e = (BYTE *)dstEnd;
do { LZ4_copy8(d,s); d+=8; s+=8; } while (d<e); do {
LZ4_copy8(d, s);
d += 8;
s += 8;
}
while (d < e);
} }
#define MINMATCH 4 #define MINMATCH 4
@ -285,13 +304,23 @@ FORCE_INLINE unsigned LZ4_count(const BYTE* pIn, const BYTE* pMatch, const BYTE*
while (likely(pIn < pInLimit - (STEPSIZE - 1))) { while (likely(pIn < pInLimit - (STEPSIZE - 1))) {
reg_t const diff = LZ4_read_ARCH(pMatch) ^LZ4_read_ARCH(pIn); reg_t const diff = LZ4_read_ARCH(pMatch) ^LZ4_read_ARCH(pIn);
if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; } if (!diff) {
pIn += STEPSIZE;
pMatch += STEPSIZE;
continue;
}
pIn += LZ4_NbCommonBytes(diff); pIn += LZ4_NbCommonBytes(diff);
return (unsigned)(pIn - pStart); return (unsigned)(pIn - pStart);
} }
if ((STEPSIZE==8) && (pIn<(pInLimit-3)) && (LZ4_read32(pMatch) == LZ4_read32(pIn))) { pIn+=4; pMatch+=4; } if ((STEPSIZE == 8) && (pIn < (pInLimit - 3)) && (LZ4_read32(pMatch) == LZ4_read32(pIn))) {
if ((pIn<(pInLimit-1)) && (LZ4_read16(pMatch) == LZ4_read16(pIn))) { pIn+=2; pMatch+=2; } pIn += 4;
pMatch += 4;
}
if ((pIn < (pInLimit - 1)) && (LZ4_read16(pMatch) == LZ4_read16(pIn))) {
pIn += 2;
pMatch += 2;
}
if ((pIn < pInLimit) && (*pMatch == *pIn)) pIn++; if ((pIn < pInLimit) && (*pMatch == *pIn)) pIn++;
return (unsigned)(pIn - pStart); return (unsigned)(pIn - pStart);
} }
@ -299,16 +328,35 @@ FORCE_INLINE unsigned LZ4_count(const BYTE* pIn, const BYTE* pMatch, const BYTE*
static const int LZ4_64Klimit = ((64 KB) + (MFLIMIT - 1)); static const int LZ4_64Klimit = ((64 KB) + (MFLIMIT - 1));
static const U32 LZ4_skipTrigger = 6; /* Increase this value ==> compression run slower on incompressible data */ static const U32 LZ4_skipTrigger = 6; /* Increase this value ==> compression run slower on incompressible data */
typedef enum { notLimited = 0, limitedOutput = 1 } limitedOutput_directive; typedef enum
typedef enum { byPtr, byU32, byU16 } tableType_t; {
notLimited = 0, limitedOutput = 1
} limitedOutput_directive;
typedef enum
{
byPtr, byU32, byU16
} tableType_t;
typedef enum { noDict = 0, withPrefix64k, usingExtDict } dict_directive; typedef enum
typedef enum { noDictIssue = 0, dictSmall } dictIssue_directive; {
noDict = 0, withPrefix64k, usingExtDict
} dict_directive;
typedef enum
{
noDictIssue = 0, dictSmall
} dictIssue_directive;
typedef enum { endOnOutputSize = 0, endOnInputSize = 1 } endCondition_directive; typedef enum
typedef enum { full = 0, partial = 1 } earlyEnd_directive; {
endOnOutputSize = 0, endOnInputSize = 1
} endCondition_directive;
typedef enum
{
full = 0, partial = 1
} earlyEnd_directive;
FORCE_INLINE int LZ4_compressBound(int isize) { return LZ4_COMPRESSBOUND(isize); } FORCE_INLINE int LZ4_compressBound(int isize)
{ return LZ4_COMPRESSBOUND(isize); }
FORCE_INLINE U32 LZ4_hash4(U32 sequence, tableType_t const tableType) FORCE_INLINE U32 LZ4_hash4(U32 sequence, tableType_t const tableType)
{ {
@ -337,11 +385,22 @@ FORCE_INLINE U32 LZ4_hashPosition(const void* const p, tableType_t const tableTy
FORCE_INLINE void LZ4_putPositionOnHash(const BYTE *p, U32 h, void *tableBase, tableType_t const tableType, const BYTE *srcBase) FORCE_INLINE void LZ4_putPositionOnHash(const BYTE *p, U32 h, void *tableBase, tableType_t const tableType, const BYTE *srcBase)
{ {
switch (tableType) switch (tableType) {
{ case byPtr: {
case byPtr: { const BYTE** hashTable = (const BYTE**)tableBase; hashTable[h] = p; return; } const BYTE **hashTable = (const BYTE **)tableBase;
case byU32: { U32* hashTable = (U32*) tableBase; hashTable[h] = (U32)(p-srcBase); return; } hashTable[h] = p;
case byU16: { U16* hashTable = (U16*) tableBase; hashTable[h] = (U16)(p-srcBase); return; } return;
}
case byU32: {
U32 *hashTable = (U32 *)tableBase;
hashTable[h] = (U32)(p - srcBase);
return;
}
case byU16: {
U16 *hashTable = (U16 *)tableBase;
hashTable[h] = (U16)(p - srcBase);
return;
}
} }
} }
@ -353,9 +412,18 @@ FORCE_INLINE void LZ4_putPosition(const BYTE* p, void* tableBase, tableType_t ta
FORCE_INLINE const BYTE *LZ4_getPositionOnHash(U32 h, void *tableBase, tableType_t tableType, const BYTE *srcBase) FORCE_INLINE const BYTE *LZ4_getPositionOnHash(U32 h, void *tableBase, tableType_t tableType, const BYTE *srcBase)
{ {
if (tableType == byPtr) { const BYTE** hashTable = (const BYTE**) tableBase; return hashTable[h]; } if (tableType == byPtr) {
if (tableType == byU32) { const U32* const hashTable = (U32*) tableBase; return hashTable[h] + srcBase; } const BYTE **hashTable = (const BYTE **)tableBase;
{ const U16* const hashTable = (U16*) tableBase; return hashTable[h] + srcBase; } /* default, to ensure a return */ return hashTable[h];
}
if (tableType == byU32) {
const U32 *const hashTable = (U32 *)tableBase;
return hashTable[h] + srcBase;
}
{
const U16 *const hashTable = (U16 *)tableBase;
return hashTable[h] + srcBase;
} /* default, to ensure a return */
} }
FORCE_INLINE const BYTE *LZ4_getPosition(const BYTE *p, void *tableBase, tableType_t tableType, const BYTE *srcBase) FORCE_INLINE const BYTE *LZ4_getPosition(const BYTE *p, void *tableBase, tableType_t tableType, const BYTE *srcBase)
@ -395,8 +463,7 @@ FORCE_INLINE int LZ4_compress_generic(
/* Init conditions */ /* Init conditions */
if ((U32)inputSize > (U32)LZ4_MAX_INPUT_SIZE) return 0; /* Unsupported inputSize, too large (or negative) */ if ((U32)inputSize > (U32)LZ4_MAX_INPUT_SIZE) return 0; /* Unsupported inputSize, too large (or negative) */
switch(dict) switch (dict) {
{
case noDict: case noDict:
default: default:
base = (const BYTE *)source; base = (const BYTE *)source;
@ -416,7 +483,8 @@ FORCE_INLINE int LZ4_compress_generic(
/* First Byte */ /* First Byte */
LZ4_putPosition(ip, cctx->hashTable, tableType, base); LZ4_putPosition(ip, cctx->hashTable, tableType, base);
ip++; forwardH = LZ4_hashPosition(ip, tableType); ip++;
forwardH = LZ4_hashPosition(ip, tableType);
/* Main Loop */ /* Main Loop */
for (;;) { for (;;) {
@ -425,7 +493,8 @@ FORCE_INLINE int LZ4_compress_generic(
BYTE *token; BYTE *token;
/* Find a match */ /* Find a match */
{ const BYTE* forwardIp = ip; {
const BYTE *forwardIp = ip;
unsigned step = 1; unsigned step = 1;
unsigned searchMatchNb = acceleration << LZ4_skipTrigger; unsigned searchMatchNb = acceleration << LZ4_skipTrigger;
do { do {
@ -444,7 +513,8 @@ FORCE_INLINE int LZ4_compress_generic(
} else { } else {
refDelta = 0; refDelta = 0;
lowLimit = (const BYTE *)source; lowLimit = (const BYTE *)source;
} } }
}
forwardH = LZ4_hashPosition(forwardIp, tableType); forwardH = LZ4_hashPosition(forwardIp, tableType);
LZ4_putPositionOnHash(ip, h, cctx->hashTable, tableType, base); LZ4_putPositionOnHash(ip, h, cctx->hashTable, tableType, base);
@ -454,10 +524,14 @@ FORCE_INLINE int LZ4_compress_generic(
} }
/* Catch up */ /* Catch up */
while (((ip>anchor) & (match+refDelta > lowLimit)) && (unlikely(ip[-1]==match[refDelta-1]))) { ip--; match--; } while (((ip > anchor) & (match + refDelta > lowLimit)) && (unlikely(ip[-1] == match[refDelta - 1]))) {
ip--;
match--;
}
/* Encode Literals */ /* Encode Literals */
{ unsigned const litLength = (unsigned)(ip - anchor); {
unsigned const litLength = (unsigned)(ip - anchor);
token = op++; token = op++;
if ((outputLimited) && /* Check output buffer overflow */ if ((outputLimited) && /* Check output buffer overflow */
(unlikely(op + litLength + (2 + 1 + LASTLITERALS) + (litLength / 255) > olimit))) (unlikely(op + litLength + (2 + 1 + LASTLITERALS) + (litLength / 255) > olimit)))
@ -467,8 +541,7 @@ FORCE_INLINE int LZ4_compress_generic(
*token = (RUN_MASK << ML_BITS); *token = (RUN_MASK << ML_BITS);
for (; len >= 255; len -= 255) *op++ = 255; for (; len >= 255; len -= 255) *op++ = 255;
*op++ = (BYTE)len; *op++ = (BYTE)len;
} } else *token = (BYTE)(litLength << ML_BITS);
else *token = (BYTE)(litLength<<ML_BITS);
/* Copy Literals */ /* Copy Literals */
LZ4_wildCopy(op, anchor, op + litLength); LZ4_wildCopy(op, anchor, op + litLength);
@ -477,10 +550,12 @@ FORCE_INLINE int LZ4_compress_generic(
_next_match: _next_match:
/* Encode Offset */ /* Encode Offset */
LZ4_writeLE16(op, (U16)(ip-match)); op+=2; LZ4_writeLE16(op, (U16)(ip - match));
op += 2;
/* Encode MatchLength */ /* Encode MatchLength */
{ unsigned matchCode; {
unsigned matchCode;
if ((dict == usingExtDict) && (lowLimit == dictionary)) { if ((dict == usingExtDict) && (lowLimit == dictionary)) {
const BYTE *limit; const BYTE *limit;
@ -530,12 +605,16 @@ FORCE_INLINE int LZ4_compress_generic(
} else { } else {
refDelta = 0; refDelta = 0;
lowLimit = (const BYTE *)source; lowLimit = (const BYTE *)source;
} } }
}
LZ4_putPosition(ip, cctx->hashTable, tableType, base); LZ4_putPosition(ip, cctx->hashTable, tableType, base);
if (((dictIssue == dictSmall) ? (match >= lowRefLimit) : 1) if (((dictIssue == dictSmall) ? (match >= lowRefLimit) : 1)
&& (match + MAX_DISTANCE >= ip) && (match + MAX_DISTANCE >= ip)
&& (LZ4_read32(match+refDelta)==LZ4_read32(ip)) ) && (LZ4_read32(match + refDelta) == LZ4_read32(ip))) {
{ token=op++; *token=0; goto _next_match; } token = op++;
*token = 0;
goto _next_match;
}
/* Prepare next loop */ /* Prepare next loop */
forwardH = LZ4_hashPosition(++ip, tableType); forwardH = LZ4_hashPosition(++ip, tableType);
@ -543,7 +622,8 @@ FORCE_INLINE int LZ4_compress_generic(
_last_literals: _last_literals:
/* Encode Last Literals */ /* Encode Last Literals */
{ size_t const lastRun = (size_t)(iend - anchor); {
size_t const lastRun = (size_t)(iend - anchor);
if ((outputLimited) && /* Check output buffer overflow */ if ((outputLimited) && /* Check output buffer overflow */
((op - (BYTE *)dest) + lastRun + 1 + ((lastRun + 255 - RUN_MASK) / 255) > (U32)maxOutputSize)) ((op - (BYTE *)dest) + lastRun + 1 + ((lastRun + 255 - RUN_MASK) / 255) > (U32)maxOutputSize))
return 0; return 0;
@ -646,8 +726,7 @@ FORCE_INLINE int LZ4_decompress_generic(
/* copy literals */ /* copy literals */
cpy = op + length; cpy = op + length;
if (((endOnInput) && ((cpy > (partialDecoding ? oexit : oend - MFLIMIT)) || (ip + length > iend - (2 + 1 + LASTLITERALS)))) if (((endOnInput) && ((cpy > (partialDecoding ? oexit : oend - MFLIMIT)) || (ip + length > iend - (2 + 1 + LASTLITERALS))))
|| ((!endOnInput) && (cpy>oend-WILDCOPYLENGTH)) ) || ((!endOnInput) && (cpy > oend - WILDCOPYLENGTH))) {
{
if (partialDecoding) { if (partialDecoding) {
if (cpy > oend) goto _output_error; /* Error : write attempt beyond end of output buffer */ if (cpy > oend) goto _output_error; /* Error : write attempt beyond end of output buffer */
if ((endOnInput) && (ip + length > iend)) goto _output_error; /* Error : read attempt beyond end of input buffer */ if ((endOnInput) && (ip + length > iend)) goto _output_error; /* Error : read attempt beyond end of input buffer */
@ -661,10 +740,12 @@ FORCE_INLINE int LZ4_decompress_generic(
break; /* Necessarily EOF, due to parsing restrictions */ break; /* Necessarily EOF, due to parsing restrictions */
} }
LZ4_wildCopy(op, ip, cpy); LZ4_wildCopy(op, ip, cpy);
ip += length; op = cpy; ip += length;
op = cpy;
/* get offset */ /* get offset */
offset = LZ4_readLE16(ip); ip+=2; offset = LZ4_readLE16(ip);
ip += 2;
match = op - offset; match = op - offset;
if ((checkOffset) && (unlikely(match < lowLimit))) goto _output_error; /* Error : offset outside buffers */ if ((checkOffset) && (unlikely(match < lowLimit))) goto _output_error; /* Error : offset outside buffers */
LZ4_write32(op, (U32)offset); /* costs ~1%; silence an msan warning when offset==0 */ LZ4_write32(op, (U32)offset); /* costs ~1%; silence an msan warning when offset==0 */
@ -703,7 +784,8 @@ FORCE_INLINE int LZ4_decompress_generic(
} else { } else {
Utils::copy(op, lowPrefix, restSize); Utils::copy(op, lowPrefix, restSize);
op += restSize; op += restSize;
} } }
}
continue; continue;
} }
@ -718,7 +800,10 @@ FORCE_INLINE int LZ4_decompress_generic(
match += dec32table[offset]; match += dec32table[offset];
Utils::copy< 4 >(op + 4, match); Utils::copy< 4 >(op + 4, match);
match -= dec64; match -= dec64;
} else { LZ4_copy8(op, match); match+=8; } } else {
LZ4_copy8(op, match);
match += 8;
}
op += 8; op += 8;
if (unlikely(cpy > oend - 12)) { if (unlikely(cpy > oend - 12)) {

View file

@ -14,8 +14,6 @@
#ifndef ZT_CERTIFICATEOFMEMBERSHIP_HPP #ifndef ZT_CERTIFICATEOFMEMBERSHIP_HPP
#define ZT_CERTIFICATEOFMEMBERSHIP_HPP #define ZT_CERTIFICATEOFMEMBERSHIP_HPP
// TODO: redo
#include <string> #include <string>
#include <stdexcept> #include <stdexcept>
#include <algorithm> #include <algorithm>
@ -179,7 +177,7 @@ public:
* @param RR Runtime environment for looking up peers * @param RR Runtime environment for looking up peers
* @param tPtr Thread pointer to be handed through to any callbacks called as a result of this call * @param tPtr Thread pointer to be handed through to any callbacks called as a result of this call
*/ */
ZT_INLINE Credential::VerifyResult verify(const RuntimeEnvironment *RR,void *tPtr) const { return _verify(RR,tPtr,*this); } ZT_INLINE Credential::VerifyResult verify(const RuntimeEnvironment *RR,void *tPtr) const { return s_verify(RR, tPtr, *this); }
// NOTE: right now we use v1 serialization format which works with both ZeroTier 1.x and 2.x. V2 format // NOTE: right now we use v1 serialization format which works with both ZeroTier 1.x and 2.x. V2 format
// will be switched on once 1.x is pretty much dead and out of support. // will be switched on once 1.x is pretty much dead and out of support.

View file

@ -11,31 +11,43 @@
*/ */
/****/ /****/
// This include file uses various macros and other tricks to auto-detect, define, and
// canonicalize a bunch of macros and types used throughout the ZeroTier core.
#ifndef ZT_OS_HPP #ifndef ZT_OS_HPP
#define ZT_OS_HPP #define ZT_OS_HPP
#include <stdint.h> /* Uncomment this to force a whole lot of debug output. */
#include <stdlib.h> #define ZT_DEBUG_SPEW
#include <string.h>
#include <stdio.h> #if !defined(__GNUC__) && (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1) || defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) || defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) || defined(__INTEL_COMPILER) || defined(__clang__))
#define __GNUC__ 3
#endif
#if defined(_WIN32) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN64)
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x06010000
#endif
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(disable : 4290) #pragma warning(disable : 4290)
#pragma warning(disable : 4996) #pragma warning(disable : 4996)
#pragma warning(disable : 4101) #pragma warning(disable : 4101)
#endif #endif
#ifndef __WINDOWS__ #ifndef __WINDOWS__
#define __WINDOWS__ 1 #define __WINDOWS__ 1
#endif #endif
#ifndef NOMINMAX #ifndef NOMINMAX
#define NOMINMAX #define NOMINMAX
#endif #endif
#ifdef __UNIX_LIKE__
#undef __UNIX_LIKE__ #undef __UNIX_LIKE__
#endif
#ifdef __BSD__
#undef __BSD__ #undef __BSD__
#endif
#include <WinSock2.h> #include <WinSock2.h>
#include <ws2tcpip.h> #include <ws2tcpip.h>
#include <Windows.h> #include <Windows.h>
@ -43,68 +55,13 @@
#include <shlwapi.h> #include <shlwapi.h>
#include <Shlobj.h> #include <Shlobj.h>
#include <sys/param.h> #include <sys/param.h>
#endif
#ifdef SOCKET #endif /* Microsoft Windows */
#define ZT_SOCKET SOCKET
#else
#define ZT_SOCKET int
#endif
#ifdef INVALID_SOCKET
#define ZT_INVALID_SOCKET INVALID_SOCKET
#else
#define ZT_INVALID_SOCKET (-1)
#endif
#if !defined(__GNUC__) && (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1) || defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) || defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) || defined(__INTEL_COMPILER) || defined(__clang__)) #include <stdint.h>
#define __GNUC__ 3 #include <stdlib.h>
#endif #include <string.h>
#include <stdio.h>
#ifdef __cplusplus
#if __cplusplus > 199711L
#include <atomic>
#ifndef __CPP11__
#define __CPP11__
#endif
#endif
#ifndef __CPP11__
// Beyond that defining nullptr, constexpr, and noexcept should allow us to still build on these. So far we've
// avoided deeper C++11 features like lambdas in the core until we're 100% sure all the ancient targets are gone.
#error TODO: to build on pre-c++11 compilers we will need to make a subset of std::atomic for integers
#define nullptr (0)
#define constexpr ZT_INLINE
#define noexcept throw()
#endif
#endif
#ifdef __GNUC__
#ifndef ZT_DEBUG
#ifdef __clang__
#define ZT_INLINE __attribute__((always_inline)) inline
#else
#define ZT_INLINE inline
#endif
#endif
#ifndef restrict
#define restrict __restrict__
#endif
#ifndef likely
#define likely(x) __builtin_expect((x),1)
#endif
#ifndef unlikely
#define unlikely(x) __builtin_expect((x),0)
#endif
#else /* not GCC-like */
#ifndef restrict
#define restrict
#endif
#ifndef likely
#define likely(x) (x)
#endif
#ifndef unlikely
#define unlikely(x) (x)
#endif
#endif
#if (defined(__amd64) || defined(__amd64__) || defined(__x86_64) || defined(__x86_64__) || defined(__AMD64) || defined(__AMD64__) || defined(_M_X64)) #if (defined(__amd64) || defined(__amd64__) || defined(__x86_64) || defined(__x86_64__) || defined(__AMD64) || defined(__AMD64__) || defined(_M_X64))
#define ZT_ARCH_X64 1 #define ZT_ARCH_X64 1
@ -112,7 +69,6 @@
#include <emmintrin.h> #include <emmintrin.h>
#include <immintrin.h> #include <immintrin.h>
#endif #endif
#if defined(ZT_ARCH_X64) || defined(i386) || defined(__i386) || defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) || defined(_M_IX86) || defined(__X86__) || defined(_X86_) || defined(__I86__) || defined(__INTEL__) || defined(__386) #if defined(ZT_ARCH_X64) || defined(i386) || defined(__i386) || defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) || defined(_M_IX86) || defined(__X86__) || defined(_X86_) || defined(__I86__) || defined(__INTEL__) || defined(__386)
#define ZT_ARCH_X86 1 #define ZT_ARCH_X86 1
#endif #endif
@ -123,7 +79,7 @@
#endif #endif
#endif #endif
#if (defined(__ARM_NEON) || defined(__ARM_NEON__) || defined(ZT_ARCH_ARM_HAS_NEON)) #if defined(__ARM_NEON) || defined(__ARM_NEON__) || defined(ZT_ARCH_ARM_HAS_NEON)
#if (defined(__APPLE__) && !defined(__LP64__)) || (defined(__ANDROID__) && defined(__arm__)) #if (defined(__APPLE__) && !defined(__LP64__)) || (defined(__ANDROID__) && defined(__arm__))
#ifdef ZT_ARCH_ARM_HAS_NEON #ifdef ZT_ARCH_ARM_HAS_NEON
#undef ZT_ARCH_ARM_HAS_NEON #undef ZT_ARCH_ARM_HAS_NEON
@ -132,30 +88,10 @@
#ifndef ZT_ARCH_ARM_HAS_NEON #ifndef ZT_ARCH_ARM_HAS_NEON
#define ZT_ARCH_ARM_HAS_NEON 1 #define ZT_ARCH_ARM_HAS_NEON 1
#endif #endif
#endif
#include <arm_neon.h> #include <arm_neon.h>
/*#include <arm_acle.h>*/ /*#include <arm_acle.h>*/
#endif #endif
#endif
#if defined(__SIZEOF_INT128__) || ((defined(ZT_ARCH_X64) || defined(__aarch64__)) && defined(__GNUC__))
#ifdef __SIZEOF_INT128__
#define ZT_HAVE_UINT128 1
typedef unsigned __int128 uint128_t;
#else
#define ZT_HAVE_UINT128 1
typedef unsigned uint128_t __attribute__((mode(TI)));
#endif
#endif
#if defined(__linux__) || defined(linux) || defined(__LINUX__) || defined(__linux)
#ifndef __LINUX__
#define __LINUX__ 1
#endif
#ifndef __UNIX_LIKE__
#define __UNIX_LIKE__ 1
#endif
#include <endian.h>
#endif
#ifdef __APPLE__ #ifdef __APPLE__
#include <TargetConditionals.h> #include <TargetConditionals.h>
@ -173,6 +109,16 @@ typedef unsigned uint128_t __attribute__((mode(TI)));
#endif #endif
#endif #endif
#if defined(__linux__) || defined(linux) || defined(__LINUX__) || defined(__linux)
#ifndef __LINUX__
#define __LINUX__ 1
#endif
#ifndef __UNIX_LIKE__
#define __UNIX_LIKE__ 1
#endif
#include <endian.h>
#endif
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
#ifndef __UNIX_LIKE__ #ifndef __UNIX_LIKE__
#define __UNIX_LIKE__ 1 #define __UNIX_LIKE__ 1
@ -196,6 +142,81 @@ typedef unsigned uint128_t __attribute__((mode(TI)));
#define ZT_EOL_S "\n" #define ZT_EOL_S "\n"
#endif #endif
#ifdef SOCKET
#define ZT_SOCKET SOCKET
#else
#define ZT_SOCKET int
#endif
#ifdef INVALID_SOCKET
#define ZT_INVALID_SOCKET INVALID_SOCKET
#else
#define ZT_INVALID_SOCKET (-1)
#endif
#ifdef __cplusplus
#if __cplusplus > 199711L
#include <atomic>
#ifndef __CPP11__
#define __CPP11__ 1
#endif
#endif
/* Right now we fail if no C++11. The core could be ported to old C++ compilers
* if a shim for <atomic> were included. */
#ifndef __CPP11__
#error TODO: to build on pre-c++11 compilers we will need to make a subset of std::atomic for integers
#define nullptr (0)
#define constexpr ZT_INLINE
#define noexcept throw()
#endif
#endif
#ifndef ZT_INLINE
#ifdef ZT_DEBUG
#define ZT_INLINE
#else
#if defined(__GNUC__) || defined(__clang__)
#define ZT_INLINE __attribute__((always_inline)) inline
#else
#define ZT_INLINE inline
#endif
#endif
#endif
#ifndef restrict
#if defined(__GNUC__) || defined(__clang__)
#define restrict __restrict__
#else
#define restrict
#endif
#endif
#ifndef likely
#if defined(__GNUC__) || defined(__clang__)
#define likely(x) __builtin_expect((x),1)
#else
#define likely(x) x
#endif
#endif
#ifndef unlikely
#if defined(__GNUC__) || defined(__clang__)
#define unlikely(x) __builtin_expect((x),0)
#else
#define unlikely(x) x
#endif
#endif
#if defined(__SIZEOF_INT128__) || ((defined(ZT_ARCH_X64) || defined(__aarch64__)) && defined(__GNUC__))
#ifdef __SIZEOF_INT128__
#define ZT_HAVE_UINT128 1
typedef unsigned __int128 uint128_t;
#else
#define ZT_HAVE_UINT128 1
typedef unsigned uint128_t __attribute__((mode(TI)));
#endif
#endif
#if !defined(__BYTE_ORDER) && defined(__BYTE_ORDER__) #if !defined(__BYTE_ORDER) && defined(__BYTE_ORDER__)
#define __BYTE_ORDER __BYTE_ORDER__ #define __BYTE_ORDER __BYTE_ORDER__
#define __LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__ #define __LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
@ -212,17 +233,9 @@ typedef unsigned uint128_t __attribute__((mode(TI)));
#define __BIG_ENDIAN _BIG_ENDIAN #define __BIG_ENDIAN _BIG_ENDIAN
#endif #endif
#ifndef ZT_INLINE
#ifdef ZT_DEBUG
#define ZT_INLINE
#else
#define ZT_INLINE inline
#endif
#endif
#define ZT_DEBUG_SPEW
#ifdef ZT_DEBUG_SPEW
#define ZT_VA_ARGS(...) , ##__VA_ARGS__ #define ZT_VA_ARGS(...) , ##__VA_ARGS__
#ifdef ZT_DEBUG_SPEW
#define ZT_SPEW(f,...) fprintf(stderr,"%s:%d(%s): " f ZT_EOL_S,__FILE__,__LINE__,__FUNCTION__ ZT_VA_ARGS(__VA_ARGS__)) #define ZT_SPEW(f,...) fprintf(stderr,"%s:%d(%s): " f ZT_EOL_S,__FILE__,__LINE__,__FUNCTION__ ZT_VA_ARGS(__VA_ARGS__))
#else #else
#define ZT_SPEW(f,...) #define ZT_SPEW(f,...)

View file

@ -127,7 +127,7 @@ public:
* @param tPtr That pointer we pass around * @param tPtr That pointer we pass around
* @return Credential verification result: OK, bad signature, or identity needed * @return Credential verification result: OK, bad signature, or identity needed
*/ */
ZT_INLINE Credential::VerifyResult verify(const RuntimeEnvironment *RR,void *tPtr) const { return _verify(RR,tPtr,*this); } ZT_INLINE Credential::VerifyResult verify(const RuntimeEnvironment *RR,void *tPtr) const { return s_verify(RR, tPtr, *this); }
static constexpr int marshalSizeMax() noexcept { return ZT_CERTIFICATEOFOWNERSHIP_MARSHAL_SIZE_MAX; } static constexpr int marshalSizeMax() noexcept { return ZT_CERTIFICATEOFOWNERSHIP_MARSHAL_SIZE_MAX; }
int marshal(uint8_t data[ZT_CERTIFICATEOFOWNERSHIP_MARSHAL_SIZE_MAX],bool forSign = false) const noexcept; int marshal(uint8_t data[ZT_CERTIFICATEOFOWNERSHIP_MARSHAL_SIZE_MAX],bool forSign = false) const noexcept;

View file

@ -111,7 +111,7 @@ public:
* @param tPtr Thread pointer to be handed through to any callbacks called as a result of this call * @param tPtr Thread pointer to be handed through to any callbacks called as a result of this call
*/ */
ZT_INLINE Credential::VerifyResult verify(const RuntimeEnvironment *RR, void *tPtr) const noexcept ZT_INLINE Credential::VerifyResult verify(const RuntimeEnvironment *RR, void *tPtr) const noexcept
{ return _verify(RR, tPtr, *this); } { return s_verify(RR, tPtr, *this); }
static constexpr int marshalSizeMax() noexcept static constexpr int marshalSizeMax() noexcept
{ return ZT_REVOCATION_MARSHAL_SIZE_MAX; } { return ZT_REVOCATION_MARSHAL_SIZE_MAX; }

View file

@ -111,7 +111,7 @@ public:
* @param tPtr Thread pointer to be handed through to any callbacks called as a result of this call * @param tPtr Thread pointer to be handed through to any callbacks called as a result of this call
*/ */
ZT_INLINE Credential::VerifyResult verify(const RuntimeEnvironment *RR, void *tPtr) const noexcept ZT_INLINE Credential::VerifyResult verify(const RuntimeEnvironment *RR, void *tPtr) const noexcept
{ return _verify(RR, tPtr, *this); } { return s_verify(RR, tPtr, *this); }
static constexpr int marshalSizeMax() noexcept static constexpr int marshalSizeMax() noexcept
{ return ZT_TAG_MARSHAL_SIZE_MAX; } { return ZT_TAG_MARSHAL_SIZE_MAX; }