mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 20:13:44 +02:00
hash() -> fingerprint()
This commit is contained in:
parent
dcb3d49d35
commit
1b71b6d01a
10 changed files with 19 additions and 19 deletions
|
@ -1295,7 +1295,7 @@ void EmbeddedNetworkController::_request(
|
|||
nc->credentialTimeMaxDelta = credentialtmd;
|
||||
nc->revision = OSUtils::jsonInt(network["revision"],0ULL);
|
||||
nc->issuedTo = identity.address();
|
||||
memcpy(nc->issuedToIdentityHash,identity.hash(),sizeof(nc->issuedToIdentityHash));
|
||||
memcpy(nc->issuedToIdentityHash,identity.fingerprint(),sizeof(nc->issuedToIdentityHash));
|
||||
if (OSUtils::jsonBool(network["enableBroadcast"],true)) nc->flags |= ZT_NETWORKCONFIG_FLAG_ENABLE_BROADCAST;
|
||||
Utils::scopy(nc->name,sizeof(nc->name),OSUtils::jsonString(network["name"],"").c_str());
|
||||
nc->mtu = std::max(std::min((unsigned int)OSUtils::jsonInt(network["mtu"],ZT_DEFAULT_MTU),(unsigned int)ZT_MAX_MTU),(unsigned int)ZT_MIN_MTU);
|
||||
|
|
|
@ -615,7 +615,7 @@ void ZT_Identity_hash(const ZT_Identity *id,uint8_t h[48],int includePrivate)
|
|||
{
|
||||
if (includePrivate)
|
||||
reinterpret_cast<const ZeroTier::Identity *>(id)->hashWithPrivate(h);
|
||||
else memcpy(h,reinterpret_cast<const ZeroTier::Identity *>(id)->hash().data(),ZT_IDENTITY_HASH_SIZE);
|
||||
else memcpy(h,reinterpret_cast<const ZeroTier::Identity *>(id)->fingerprint().data(),ZT_IDENTITY_HASH_SIZE);
|
||||
}
|
||||
|
||||
ZT_SDK_API void ZT_Identity_delete(ZT_Identity *id)
|
||||
|
|
|
@ -128,7 +128,7 @@ public:
|
|||
*
|
||||
* @return 384-bit/48-byte hash
|
||||
*/
|
||||
ZT_ALWAYS_INLINE const Hash<384> &hash() const noexcept { return _hash; }
|
||||
ZT_ALWAYS_INLINE const Hash<384> &fingerprint() const noexcept { return _hash; }
|
||||
|
||||
/**
|
||||
* Compute a hash of this identity's public and private keys.
|
||||
|
|
|
@ -1010,7 +1010,7 @@ int Network::setConfiguration(void *tPtr,const NetworkConfig &nconf,bool saveToD
|
|||
try {
|
||||
if ((nconf.issuedTo != RR->identity.address())||(nconf.networkId != _id))
|
||||
return 0; // invalid config that is not for us or not for this network
|
||||
if ((!Utils::allZero(nconf.issuedToIdentityHash,ZT_IDENTITY_HASH_SIZE))&&(memcmp(nconf.issuedToIdentityHash,RR->identity.hash().data(),ZT_IDENTITY_HASH_SIZE) != 0))
|
||||
if ((!Utils::allZero(nconf.issuedToIdentityHash,ZT_IDENTITY_HASH_SIZE))&&(memcmp(nconf.issuedToIdentityHash,RR->identity.fingerprint().data(),ZT_IDENTITY_HASH_SIZE) != 0))
|
||||
return 0; // full identity hash is present and does not match
|
||||
|
||||
if (_config == nconf)
|
||||
|
|
|
@ -482,7 +482,7 @@ ZT_PeerList *Node::peers() const
|
|||
p->address = (*pi)->address().toInt();
|
||||
identities[pl->peerCount] = (*pi)->identity(); // need to make a copy in case peer gets deleted
|
||||
p->identity = &identities[pl->peerCount];
|
||||
memcpy(p->identityHash,(*pi)->identity().hash().data(),ZT_IDENTITY_HASH_SIZE);
|
||||
memcpy(p->identityHash,(*pi)->identity().fingerprint().data(),ZT_IDENTITY_HASH_SIZE);
|
||||
if ((*pi)->remoteVersionKnown()) {
|
||||
p->versionMajor = (int)(*pi)->remoteVersionMajor();
|
||||
p->versionMinor = (int)(*pi)->remoteVersionMinor();
|
||||
|
|
|
@ -123,7 +123,7 @@ void Peer::received(
|
|||
RR->t->learnedNewPath(tPtr,0x582fabdd,packetId,_id,path->address(),old);
|
||||
} else {
|
||||
if (RR->node->shouldUsePathForZeroTierTraffic(tPtr,_id,path->localSocket(),path->address())) {
|
||||
RR->t->tryingNewPath(tPtr,0xb7747ddd,_id,path->address(),path->address(),packetId,(uint8_t)verb,_id.address(),_id.hash().data(),ZT_TRACE_TRYING_NEW_PATH_REASON_PACKET_RECEIVED_FROM_UNKNOWN_PATH);
|
||||
RR->t->tryingNewPath(tPtr,0xb7747ddd,_id,path->address(),path->address(),packetId,(uint8_t)verb,_id.address(),_id.fingerprint().data(),ZT_TRACE_TRYING_NEW_PATH_REASON_PACKET_RECEIVED_FROM_UNKNOWN_PATH);
|
||||
path->sent(now,sendHELLO(tPtr,path->localSocket(),path->address(),now));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@ namespace Protocol {
|
|||
uint64_t createProbe(const Identity &sender,const Identity &recipient,const uint8_t key[ZT_PEER_SECRET_KEY_LENGTH]) noexcept
|
||||
{
|
||||
uint8_t tmp[ZT_IDENTITY_HASH_SIZE + ZT_IDENTITY_HASH_SIZE];
|
||||
memcpy(tmp,sender.hash().data(),ZT_IDENTITY_HASH_SIZE);
|
||||
memcpy(tmp + ZT_IDENTITY_HASH_SIZE,recipient.hash().data(),ZT_IDENTITY_HASH_SIZE);
|
||||
memcpy(tmp,sender.fingerprint().data(),ZT_IDENTITY_HASH_SIZE);
|
||||
memcpy(tmp + ZT_IDENTITY_HASH_SIZE,recipient.fingerprint().data(),ZT_IDENTITY_HASH_SIZE);
|
||||
uint64_t hash[6];
|
||||
SHA384(hash,tmp,sizeof(tmp),key,ZT_PEER_SECRET_KEY_LENGTH);
|
||||
return hash[0];
|
||||
|
|
|
@ -68,7 +68,7 @@ Topology::Topology(const RuntimeEnvironment *renv,void *tPtr) :
|
|||
_rootPeers.push_back(p);
|
||||
_peers[p->address()] = p;
|
||||
_peersByIncomingProbe[p->incomingProbe()] = p;
|
||||
_peersByIdentityHash[p->identity().hash()] = p;
|
||||
_peersByIdentityHash[p->identity().fingerprint()] = p;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,13 +87,13 @@ SharedPtr<Peer> Topology::add(void *tPtr,const SharedPtr<Peer> &peer)
|
|||
_loadCached(tPtr,peer->address(),hp);
|
||||
if (hp) {
|
||||
_peersByIncomingProbe[peer->incomingProbe()] = hp;
|
||||
_peersByIdentityHash[peer->identity().hash()] = hp;
|
||||
_peersByIdentityHash[peer->identity().fingerprint()] = hp;
|
||||
return hp;
|
||||
}
|
||||
|
||||
hp = peer;
|
||||
_peersByIncomingProbe[peer->incomingProbe()] = peer;
|
||||
_peersByIdentityHash[peer->identity().hash()] = peer;
|
||||
_peersByIdentityHash[peer->identity().fingerprint()] = peer;
|
||||
|
||||
return peer;
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ void Topology::addRoot(void *tPtr,const Identity &id,const InetAddress &bootstra
|
|||
if (bootstrap)
|
||||
p->setBootstrap(Endpoint(bootstrap));
|
||||
_peersByIncomingProbe[p->incomingProbe()] = p;
|
||||
_peersByIdentityHash[p->identity().hash()] = p;
|
||||
_peersByIdentityHash[p->identity().fingerprint()] = p;
|
||||
}
|
||||
_rootPeers.push_back(p);
|
||||
|
||||
|
@ -212,7 +212,7 @@ void Topology::doPeriodicTasks(void *tPtr,const int64_t now)
|
|||
if ( (!(*p)->alive(now)) && (_roots.count((*p)->identity()) == 0) ) {
|
||||
(*p)->save(tPtr);
|
||||
_peersByIncomingProbe.erase((*p)->incomingProbe());
|
||||
_peersByIdentityHash.erase((*p)->identity().hash());
|
||||
_peersByIdentityHash.erase((*p)->identity().fingerprint());
|
||||
_peers.erase(*a);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ void Trace::_tryingNewPath(
|
|||
ev.evType = ZT_CONST_TO_BE_UINT16(ZT_TRACE_VL1_TRYING_NEW_PATH);
|
||||
ev.codeLocation = Utils::hton(codeLocation);
|
||||
ev.address = Utils::hton(trying.address().toInt());
|
||||
memcpy(ev.identityHash,trying.hash().data(),48);
|
||||
memcpy(ev.identityHash,trying.fingerprint().data(),48);
|
||||
physicalAddress.forTrace(ev.physicalAddress);
|
||||
triggerAddress.forTrace(ev.triggerAddress);
|
||||
ev.triggeringPacketId = triggeringPacketId;
|
||||
|
@ -145,7 +145,7 @@ void Trace::_learnedNewPath(
|
|||
ev.codeLocation = Utils::hton(codeLocation);
|
||||
ev.packetId = packetId; // packet IDs are kept in big-endian
|
||||
ev.address = Utils::hton(peerIdentity.address().toInt());
|
||||
memcpy(ev.identityHash,peerIdentity.hash().data(),ZT_IDENTITY_HASH_SIZE);
|
||||
memcpy(ev.identityHash,peerIdentity.fingerprint().data(),ZT_IDENTITY_HASH_SIZE);
|
||||
physicalAddress.forTrace(ev.physicalAddress);
|
||||
replaced.forTrace(ev.replaced);
|
||||
|
||||
|
@ -171,7 +171,7 @@ void Trace::_incomingPacketDropped(
|
|||
ev.networkId = Utils::hton(networkId);
|
||||
if (peerIdentity) {
|
||||
ev.address = Utils::hton(peerIdentity.address().toInt());
|
||||
memcpy(ev.identityHash,peerIdentity.hash().data(),ZT_IDENTITY_HASH_SIZE);
|
||||
memcpy(ev.identityHash,peerIdentity.fingerprint().data(),ZT_IDENTITY_HASH_SIZE);
|
||||
} else {
|
||||
ev.address = 0;
|
||||
memset(ev.identityHash,0,ZT_IDENTITY_HASH_SIZE);
|
||||
|
|
|
@ -823,7 +823,7 @@ bool VL1::_RENDEZVOUS(void *tPtr,const SharedPtr<Path> &path,const SharedPtr<Pee
|
|||
if ((sizeof(Protocol::RENDEZVOUS) + rdv.addressLength) <= packetSize) {
|
||||
const InetAddress atAddr(pkt.unsafeData + sizeof(Protocol::RENDEZVOUS),rdv.addressLength,port);
|
||||
peer->contact(tPtr,Endpoint(atAddr),now,false);
|
||||
RR->t->tryingNewPath(tPtr,0x55a19aaa,with->identity(),atAddr,path->address(),Protocol::packetId(pkt,packetSize),Protocol::VERB_RENDEZVOUS,peer->address(),peer->identity().hash().data(),ZT_TRACE_TRYING_NEW_PATH_REASON_RENDEZVOUS);
|
||||
RR->t->tryingNewPath(tPtr,0x55a19aaa,with->identity(),atAddr,path->address(),Protocol::packetId(pkt,packetSize),Protocol::VERB_RENDEZVOUS,peer->address(),peer->identity().fingerprint().data(),ZT_TRACE_TRYING_NEW_PATH_REASON_RENDEZVOUS);
|
||||
}
|
||||
break;
|
||||
case 255: {
|
||||
|
@ -835,7 +835,7 @@ bool VL1::_RENDEZVOUS(void *tPtr,const SharedPtr<Path> &path,const SharedPtr<Pee
|
|||
case Endpoint::TYPE_INETADDR_V4:
|
||||
case Endpoint::TYPE_INETADDR_V6:
|
||||
peer->contact(tPtr,ep,now,false);
|
||||
RR->t->tryingNewPath(tPtr,0x55a19aab,with->identity(),ep.inetAddr(),path->address(),Protocol::packetId(pkt,packetSize),Protocol::VERB_RENDEZVOUS,peer->address(),peer->identity().hash().data(),ZT_TRACE_TRYING_NEW_PATH_REASON_RENDEZVOUS);
|
||||
RR->t->tryingNewPath(tPtr,0x55a19aab,with->identity(),ep.inetAddr(),path->address(),Protocol::packetId(pkt,packetSize),Protocol::VERB_RENDEZVOUS,peer->address(),peer->identity().fingerprint().data(),ZT_TRACE_TRYING_NEW_PATH_REASON_RENDEZVOUS);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -969,7 +969,7 @@ bool VL1::_PUSH_DIRECT_PATHS(void *tPtr,const SharedPtr<Path> &path,const Shared
|
|||
}
|
||||
|
||||
if (a) {
|
||||
RR->t->tryingNewPath(tPtr,0xa5ab1a43,peer->identity(),a,path->address(),Protocol::packetId(pkt,packetSize),Protocol::VERB_RENDEZVOUS,peer->address(),peer->identity().hash().data(),ZT_TRACE_TRYING_NEW_PATH_REASON_RECEIVED_PUSH_DIRECT_PATHS);
|
||||
RR->t->tryingNewPath(tPtr,0xa5ab1a43,peer->identity(),a,path->address(),Protocol::packetId(pkt,packetSize),Protocol::VERB_RENDEZVOUS,peer->address(),peer->identity().fingerprint().data(),ZT_TRACE_TRYING_NEW_PATH_REASON_RECEIVED_PUSH_DIRECT_PATHS);
|
||||
}
|
||||
|
||||
ptr += (int)addrRecordLen;
|
||||
|
|
Loading…
Add table
Reference in a new issue