Lines Matching refs:chaining_key
83 memset(&handshake->chaining_key, 0, NOISE_HASH_LEN); in handshake_zero()
346 size_t data_len, const u8 chaining_key[NOISE_HASH_LEN]) in kdf()
360 hmac(secret, data, chaining_key, data_len, NOISE_HASH_LEN); in kdf()
394 const u8 chaining_key[NOISE_HASH_LEN]) in derive_keys()
399 chaining_key); in derive_keys()
404 static bool __must_check mix_dh(u8 chaining_key[NOISE_HASH_LEN], in mix_dh()
413 kdf(chaining_key, key, NULL, dh_calculation, NOISE_HASH_LEN, in mix_dh()
414 NOISE_SYMMETRIC_KEY_LEN, 0, NOISE_PUBLIC_KEY_LEN, chaining_key); in mix_dh()
419 static bool __must_check mix_precomputed_dh(u8 chaining_key[NOISE_HASH_LEN], in mix_precomputed_dh()
426 kdf(chaining_key, key, NULL, precomputed, NOISE_HASH_LEN, in mix_precomputed_dh()
428 chaining_key); in mix_precomputed_dh()
442 static void mix_psk(u8 chaining_key[NOISE_HASH_LEN], u8 hash[NOISE_HASH_LEN], in mix_psk()
448 kdf(chaining_key, temp_hash, key, psk, NOISE_HASH_LEN, NOISE_HASH_LEN, in mix_psk()
449 NOISE_SYMMETRIC_KEY_LEN, NOISE_SYMMETRIC_KEY_LEN, chaining_key); in mix_psk()
454 static void handshake_init(u8 chaining_key[NOISE_HASH_LEN], in handshake_init()
459 memcpy(chaining_key, handshake_init_chaining_key, NOISE_HASH_LEN); in handshake_init()
487 u8 chaining_key[NOISE_HASH_LEN], in message_ephemeral()
493 kdf(chaining_key, NULL, NULL, ephemeral_src, NOISE_HASH_LEN, 0, 0, in message_ephemeral()
494 NOISE_PUBLIC_KEY_LEN, chaining_key); in message_ephemeral()
537 handshake_init(handshake->chaining_key, handshake->hash, in wg_noise_handshake_create_initiation()
546 dst->unencrypted_ephemeral, handshake->chaining_key, in wg_noise_handshake_create_initiation()
550 if (!mix_dh(handshake->chaining_key, key, handshake->ephemeral_private, in wg_noise_handshake_create_initiation()
560 if (!mix_precomputed_dh(handshake->chaining_key, key, in wg_noise_handshake_create_initiation()
591 u8 chaining_key[NOISE_HASH_LEN]; in wg_noise_handshake_consume_initiation() local
602 handshake_init(chaining_key, hash, wg->static_identity.static_public); in wg_noise_handshake_consume_initiation()
605 message_ephemeral(e, src->unencrypted_ephemeral, chaining_key, hash); in wg_noise_handshake_consume_initiation()
608 if (!mix_dh(chaining_key, key, wg->static_identity.static_private, e)) in wg_noise_handshake_consume_initiation()
623 if (!mix_precomputed_dh(chaining_key, key, in wg_noise_handshake_consume_initiation()
648 memcpy(handshake->chaining_key, chaining_key, NOISE_HASH_LEN); in wg_noise_handshake_consume_initiation()
660 memzero_explicit(chaining_key, NOISE_HASH_LEN); in wg_noise_handshake_consume_initiation()
693 dst->unencrypted_ephemeral, handshake->chaining_key, in wg_noise_handshake_create_response()
697 if (!mix_dh(handshake->chaining_key, NULL, handshake->ephemeral_private, in wg_noise_handshake_create_response()
702 if (!mix_dh(handshake->chaining_key, NULL, handshake->ephemeral_private, in wg_noise_handshake_create_response()
707 mix_psk(handshake->chaining_key, handshake->hash, key, in wg_noise_handshake_create_response()
736 u8 chaining_key[NOISE_HASH_LEN]; in wg_noise_handshake_consume_response() local
756 memcpy(chaining_key, handshake->chaining_key, NOISE_HASH_LEN); in wg_noise_handshake_consume_response()
767 message_ephemeral(e, src->unencrypted_ephemeral, chaining_key, hash); in wg_noise_handshake_consume_response()
770 if (!mix_dh(chaining_key, NULL, ephemeral_private, e)) in wg_noise_handshake_consume_response()
774 if (!mix_dh(chaining_key, NULL, wg->static_identity.static_private, e)) in wg_noise_handshake_consume_response()
778 mix_psk(chaining_key, hash, key, preshared_key); in wg_noise_handshake_consume_response()
796 memcpy(handshake->chaining_key, chaining_key, NOISE_HASH_LEN); in wg_noise_handshake_consume_response()
808 memzero_explicit(chaining_key, NOISE_HASH_LEN); in wg_noise_handshake_consume_response()
836 handshake->chaining_key); in wg_noise_handshake_begin_session()
839 handshake->chaining_key); in wg_noise_handshake_begin_session()