diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-03-28 23:11:02 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-03-28 23:11:02 +0200 |
commit | 63e123738a9636618421d35ff97a278c06b69703 (patch) | |
tree | 8fbe549dec4e423f9173917a305bb5ddfa408c88 | |
parent | 0c1296cb862b92a936d57bc1e509e34e7cd65a17 (diff) | |
download | fastd-63e123738a9636618421d35ff97a278c06b69703.tar fastd-63e123738a9636618421d35ff97a278c06b69703.zip |
Stop handshake when key is identity
-rw-r--r-- | src/protocol_ec25519_fhmqvc_xsalsa20_poly1305.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/protocol_ec25519_fhmqvc_xsalsa20_poly1305.c b/src/protocol_ec25519_fhmqvc_xsalsa20_poly1305.c index 6d7e652..9d7eaa7 100644 --- a/src/protocol_ec25519_fhmqvc_xsalsa20_poly1305.c +++ b/src/protocol_ec25519_fhmqvc_xsalsa20_poly1305.c @@ -336,6 +336,9 @@ static void respond_handshake(fastd_context *ctx, fastd_peer *peer) { ecc_25519_add(&work, &workX, &work); ecc_25519_scalarmult(&work, &s, &work); + if (ecc_25519_is_identity(&work)) + return; + ecc_25519_store(&peer->protocol_state->accepting_handshake->sigma, &work); 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_scalarmult(&work, &s, &work); + if (ecc_25519_is_identity(&work)) + return; + ecc_25519_store(&peer->protocol_state->initiating_handshake->sigma, &work); memcpy(hashinput+4*PUBLICKEYBYTES, peer->protocol_state->initiating_handshake->sigma.p, PUBLICKEYBYTES); |