Lines Matching refs:checker
19 void wg_cookie_checker_init(struct cookie_checker *checker, in wg_cookie_checker_init() argument
22 init_rwsem(&checker->secret_lock); in wg_cookie_checker_init()
23 checker->secret_birthdate = ktime_get_coarse_boottime_ns(); in wg_cookie_checker_init()
24 get_random_bytes(checker->secret, NOISE_HASH_LEN); in wg_cookie_checker_init()
25 checker->device = wg; in wg_cookie_checker_init()
45 void wg_cookie_checker_precompute_device_keys(struct cookie_checker *checker) in wg_cookie_checker_precompute_device_keys() argument
47 if (likely(checker->device->static_identity.has_identity)) { in wg_cookie_checker_precompute_device_keys()
48 precompute_key(checker->cookie_encryption_key, in wg_cookie_checker_precompute_device_keys()
49 checker->device->static_identity.static_public, in wg_cookie_checker_precompute_device_keys()
51 precompute_key(checker->message_mac1_key, in wg_cookie_checker_precompute_device_keys()
52 checker->device->static_identity.static_public, in wg_cookie_checker_precompute_device_keys()
55 memset(checker->cookie_encryption_key, 0, in wg_cookie_checker_precompute_device_keys()
57 memset(checker->message_mac1_key, 0, NOISE_SYMMETRIC_KEY_LEN); in wg_cookie_checker_precompute_device_keys()
92 struct cookie_checker *checker) in make_cookie() argument
96 if (wg_birthdate_has_expired(checker->secret_birthdate, in make_cookie()
98 down_write(&checker->secret_lock); in make_cookie()
99 checker->secret_birthdate = ktime_get_coarse_boottime_ns(); in make_cookie()
100 get_random_bytes(checker->secret, NOISE_HASH_LEN); in make_cookie()
101 up_write(&checker->secret_lock); in make_cookie()
104 down_read(&checker->secret_lock); in make_cookie()
106 blake2s_init_key(&state, COOKIE_LEN, checker->secret, NOISE_HASH_LEN); in make_cookie()
116 up_read(&checker->secret_lock); in make_cookie()
119 enum cookie_mac_state wg_cookie_validate_packet(struct cookie_checker *checker, in wg_cookie_validate_packet() argument
131 checker->message_mac1_key); in wg_cookie_validate_packet()
140 make_cookie(cookie, skb, checker); in wg_cookie_validate_packet()
147 if (!wg_ratelimiter_allow(skb, dev_net(checker->device->dev))) in wg_cookie_validate_packet()
182 struct cookie_checker *checker) in wg_cookie_message_create() argument
192 make_cookie(cookie, skb, checker); in wg_cookie_message_create()
195 checker->cookie_encryption_key); in wg_cookie_message_create()