smartalock / wireguard-lwip

WireGuard Implementation for lwIP
Other
192 stars 29 forks source link

about keypair_update #6

Closed Cjyoleon closed 1 year ago

inorick commented 1 year ago

I think the keypair_update function rotates the keys (prev <- curr <- next) if the next key pair has been acknowledged, i.e. if key_is_next in line 454 is true: https://github.com/smartalock/wireguard-lwip/blob/0c44df308984abfb9c9df628002cdf8154c55506/src/wireguard.c#L454

So the rotation looks good to me:

  1. Overwrite prev with curr.
  2. Overwrite curr with next.
  3. Destroy next as it has been rotated to curr.