aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/noise.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-05-24 19:18:04 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-05-30 18:07:28 +0200
commit6e6986e17d0dc99903c5134c7c0c8e78fbec7831 (patch)
treef1a571f1c04e021113abb3572dc31b44401a7634 /src/noise.c
parentnoise: precompute static-static ECDH operation (diff)
downloadwireguard-monolithic-historical-6e6986e17d0dc99903c5134c7c0c8e78fbec7831.tar.xz
wireguard-monolithic-historical-6e6986e17d0dc99903c5134c7c0c8e78fbec7831.zip
peer: use iterator macro instead of callback
Diffstat (limited to 'src/noise.c')
-rw-r--r--src/noise.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/noise.c b/src/noise.c
index 9e7fab0..c9d8148 100644
--- a/src/noise.c
+++ b/src/noise.c
@@ -38,12 +38,12 @@ void noise_init(void)
blake2s_final(&blake, handshake_init_hash, NOISE_HASH_LEN);
}
-int noise_precompute_static_static(struct wireguard_peer *peer, void *ctx)
+bool noise_precompute_static_static(struct wireguard_peer *peer)
{
if (peer->handshake.static_identity->has_identity)
- return curve25519(peer->handshake.precomputed_static_static, peer->handshake.static_identity->static_private, peer->handshake.remote_static) ? 0 : -EINVAL;
+ return curve25519(peer->handshake.precomputed_static_static, peer->handshake.static_identity->static_private, peer->handshake.remote_static);
memset(peer->handshake.precomputed_static_static, 0, NOISE_PUBLIC_KEY_LEN);
- return 0;
+ return true;
}
bool noise_handshake_init(struct noise_handshake *handshake, struct noise_static_identity *static_identity, const u8 peer_public_key[NOISE_PUBLIC_KEY_LEN], const u8 peer_preshared_key[NOISE_SYMMETRIC_KEY_LEN], struct wireguard_peer *peer)
@@ -56,7 +56,7 @@ bool noise_handshake_init(struct noise_handshake *handshake, struct noise_static
memcpy(handshake->preshared_key, peer_preshared_key, NOISE_SYMMETRIC_KEY_LEN);
handshake->static_identity = static_identity;
handshake->state = HANDSHAKE_ZEROED;
- return !noise_precompute_static_static(peer, static_identity);
+ return noise_precompute_static_static(peer);
}
void noise_handshake_clear(struct noise_handshake *handshake)