mirror of
https://github.com/CPunch/Laika.git
synced 2026-04-07 08:10:03 +00:00
CNC, Lib, Bot, Shell: New 2nd stage handshake
- New packet, LAIKAPKT_PEER_LOGIN_REQ - All peers must prove they have access to the sent pubkey by passing a challenge. A salt is now sent on the handshake response packet, which must be encrypted and sent back through the PEER_LOGIN packet - Protcol minor version incremented to 0.4
This commit is contained in:
@@ -28,6 +28,9 @@ struct sLaika_peer *laikaS_newPeer(struct sLaika_peerPacketInfo *pktTbl,
|
||||
memset(peer->inet, 0, LAIKA_INET_LEN);
|
||||
memset(peer->ipStr, 0, LAIKA_IPSTR_LEN);
|
||||
|
||||
/* generate peer's salt */
|
||||
laikaS_genSalt(peer);
|
||||
|
||||
return peer;
|
||||
}
|
||||
|
||||
@@ -37,6 +40,16 @@ void laikaS_freePeer(struct sLaika_peer *peer)
|
||||
laikaM_free(peer);
|
||||
}
|
||||
|
||||
void laikaS_setSalt(struct sLaika_peer *peer, uint8_t *salt)
|
||||
{
|
||||
memcpy(peer->salt, salt, LAIKA_HANDSHAKE_SALT_LEN);
|
||||
}
|
||||
|
||||
void laikaS_genSalt(struct sLaika_peer *peer)
|
||||
{
|
||||
randombytes_buf(peer->salt, LAIKA_HANDSHAKE_SALT_LEN);
|
||||
}
|
||||
|
||||
/* ===================================[[ Start/End Packets ]]=================================== */
|
||||
|
||||
void laikaS_emptyOutPacket(struct sLaika_peer *peer, LAIKAPKT_ID id)
|
||||
|
||||
Reference in New Issue
Block a user