wg: Port #35: refactor noise keypair functions to avoid epoch
commit13a64e4bd4b7331d26512c60470c49c295cc15ae
authorAaron LI <aly@aaronly.me>
Fri, 5 Jan 2024 13:09:33 +0000 (5 21:09 +0800)
committerAaron LI <aly@aaronly.me>
Thu, 8 Feb 2024 06:44:46 +0000 (8 14:44 +0800)
treef532a7e0a17399dd4295829455a00ff700a5bd7f
parente2854f7ec3b20b8bcf2d120cad8e72bb247ee125
wg: Port #35: refactor noise keypair functions to avoid epoch

- Refactor the functions to avoid using epoch or deferred operations.
  So noise_keypair_put() is simplified and remove the obsolete
  noise_keypair_smr_free() function.
- Remove 'refcount_acquire_if_not_zero()' and use plain refcount instead,
  since there's no more deferred frees.
- Use shared locks instead of epoch sections; meanwhile, rename
  'r_keypair_mtx' to 'r_keypair_lock' because it now supports both
  shared and exclusive locks.
sys/net/wg/wg_noise.c