diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-10-25 17:56:08 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-10-31 17:25:23 +0100 |
commit | e09ec4dc2af38fb44add2fac518a726ae605b400 (patch) | |
tree | 950512f15664d121e92677ec1c35a5b1b1b870dc /src/noise.c | |
parent | qemu: work around ccache bugs (diff) | |
download | wireguard-monolithic-historical-e09ec4dc2af38fb44add2fac518a726ae605b400.tar.xz wireguard-monolithic-historical-e09ec4dc2af38fb44add2fac518a726ae605b400.zip |
global: style nits
Diffstat (limited to 'src/noise.c')
-rw-r--r-- | src/noise.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/noise.c b/src/noise.c index 99c5f53..aab7f88 100644 --- a/src/noise.c +++ b/src/noise.c @@ -151,29 +151,34 @@ static void add_new_keypair(struct noise_keypairs *keypairs, struct noise_keypai current_keypair = rcu_dereference_protected(keypairs->current_keypair, lockdep_is_held(&keypairs->keypair_update_lock)); if (new_keypair->i_am_the_initiator) { /* If we're the initiator, it means we've sent a handshake, and received - * a confirmation response, which means this new keypair can now be used. */ + * a confirmation response, which means this new keypair can now be used. + */ if (next_keypair) { /* If there already was a next keypair pending, we demote it to be * the previous keypair, and free the existing current. * TODO: note that this means KCI can result in this transition. It * would perhaps be more sound to always just get rid of the unused * next keypair instead of putting it in the previous slot, but this - * might be a bit less robust. Something to think about and decide on. */ + * might be a bit less robust. Something to think about and decide on. + */ rcu_assign_pointer(keypairs->next_keypair, NULL); rcu_assign_pointer(keypairs->previous_keypair, next_keypair); noise_keypair_put(current_keypair); } else /* If there wasn't an existing next keypair, we replace the - * previous with the current one. */ + * previous with the current one. + */ rcu_assign_pointer(keypairs->previous_keypair, current_keypair); /* At this point we can get rid of the old previous keypair, and set up - * the new keypair. */ + * the new keypair. + */ noise_keypair_put(previous_keypair); rcu_assign_pointer(keypairs->current_keypair, new_keypair); } else { /* If we're the responder, it means we can't use the new keypair until * we receive confirmation via the first data packet, so we get rid of * the existing previous one, the possibly existing next one, and slide - * in the new next one. */ + * in the new next one. + */ rcu_assign_pointer(keypairs->next_keypair, new_keypair); noise_keypair_put(next_keypair); rcu_assign_pointer(keypairs->previous_keypair, NULL); @@ -201,7 +206,8 @@ bool noise_received_with_keypair(struct noise_keypairs *keypairs, struct noise_k /* When we've finally received the confirmation, we slide the next * into the current, the current into the previous, and get rid of - * the old previous. */ + * the old previous. + */ old_keypair = rcu_dereference_protected(keypairs->previous_keypair, lockdep_is_held(&keypairs->keypair_update_lock)); rcu_assign_pointer(keypairs->previous_keypair, rcu_dereference_protected(keypairs->current_keypair, lockdep_is_held(&keypairs->keypair_update_lock))); noise_keypair_put(old_keypair); |