aboutsummaryrefslogtreecommitdiffstats
path: root/src/wg_noise.h
diff options
context:
space:
mode:
authorMatt Dunwoodie <ncon@noconroy.net>2021-04-20 15:35:58 +1000
committerMatt Dunwoodie <ncon@noconroy.net>2021-04-20 18:30:08 +1000
commit87a62f1322bff3d49c9d177243f886f09032d254 (patch)
tree7afeda5125b0c4c83128d51045fb8d6be4d08cad /src/wg_noise.h
parentwg_noise: insert/remove peer independent of alloc/destroy (diff)
downloadwireguard-freebsd-87a62f1322bff3d49c9d177243f886f09032d254.tar.xz
wireguard-freebsd-87a62f1322bff3d49c9d177243f886f09032d254.zip
wg_noise: avoid handshake/keypair type confusion
So the last change broke consuming responses, as it may return an invalid remote pointer. Thanks for the catch zx2c4. We just pass a flag "lookup_keypair" which will lookup the keypair when we want (for cookie) and will not when we don't (for consuming responses). It would be possible to merge both noise_remote_index_lookup and noise_keypair_lookup, but the result would probably need to return a void * (for both keypair and remote) or a noise_index * which would need to be cast to the relevant type somewhere. The trickiest thing here would be for if_wg to "put" the result of the function, as it may be a remote or a keypair (which store their refcount in different locations). Perhaps it would return a noise_index * which could contain the refcount for both keypair and remote. It all seems easier to leave them separate. The only argument for combining them would be to reduce duplication of (similar) functions. Signed-off-by: Matt Dunwoodie <ncon@noconroy.net>
Diffstat (limited to '')
-rw-r--r--src/wg_noise.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/wg_noise.h b/src/wg_noise.h
index 893f62c..aa52e8e 100644
--- a/src/wg_noise.h
+++ b/src/wg_noise.h
@@ -51,7 +51,7 @@ void noise_remote_disable(struct noise_remote *);
struct noise_remote *
noise_remote_lookup(struct noise_local *, const uint8_t[NOISE_PUBLIC_KEY_LEN]);
struct noise_remote *
- noise_remote_index_lookup(struct noise_local *, uint32_t);
+ noise_remote_index(struct noise_local *, uint32_t);
struct noise_remote *
noise_remote_ref(struct noise_remote *);
void noise_remote_put(struct noise_remote *);