mirror of
https://github.com/neocturne/fastd.git
synced 2025-05-14 12:25:07 +02:00
Stop handshake when key is identity
This commit is contained in:
parent
0c1296cb86
commit
63e123738a
1 changed files with 6 additions and 0 deletions
|
@ -336,6 +336,9 @@ static void respond_handshake(fastd_context *ctx, fastd_peer *peer) {
|
||||||
ecc_25519_add(&work, &workX, &work);
|
ecc_25519_add(&work, &workX, &work);
|
||||||
ecc_25519_scalarmult(&work, &s, &work);
|
ecc_25519_scalarmult(&work, &s, &work);
|
||||||
|
|
||||||
|
if (ecc_25519_is_identity(&work))
|
||||||
|
return;
|
||||||
|
|
||||||
ecc_25519_store(&peer->protocol_state->accepting_handshake->sigma, &work);
|
ecc_25519_store(&peer->protocol_state->accepting_handshake->sigma, &work);
|
||||||
|
|
||||||
memcpy(hashinput+4*PUBLICKEYBYTES, peer->protocol_state->accepting_handshake->sigma.p, PUBLICKEYBYTES);
|
memcpy(hashinput+4*PUBLICKEYBYTES, peer->protocol_state->accepting_handshake->sigma.p, PUBLICKEYBYTES);
|
||||||
|
@ -419,6 +422,9 @@ static void finish_handshake(fastd_context *ctx, fastd_peer *peer, uint8_t t[HMA
|
||||||
ecc_25519_add(&work, &workY, &work);
|
ecc_25519_add(&work, &workY, &work);
|
||||||
ecc_25519_scalarmult(&work, &s, &work);
|
ecc_25519_scalarmult(&work, &s, &work);
|
||||||
|
|
||||||
|
if (ecc_25519_is_identity(&work))
|
||||||
|
return;
|
||||||
|
|
||||||
ecc_25519_store(&peer->protocol_state->initiating_handshake->sigma, &work);
|
ecc_25519_store(&peer->protocol_state->initiating_handshake->sigma, &work);
|
||||||
|
|
||||||
memcpy(hashinput+4*PUBLICKEYBYTES, peer->protocol_state->initiating_handshake->sigma.p, PUBLICKEYBYTES);
|
memcpy(hashinput+4*PUBLICKEYBYTES, peer->protocol_state->initiating_handshake->sigma.p, PUBLICKEYBYTES);
|
||||||
|
|
Loading…
Add table
Reference in a new issue