Lines Matching refs:kex
47 kex_dh_keygen(struct kex *kex) in kex_dh_keygen() argument
49 switch (kex->kex_type) { in kex_dh_keygen()
51 kex->dh = dh_new_group1(); in kex_dh_keygen()
55 kex->dh = dh_new_group14(); in kex_dh_keygen()
58 kex->dh = dh_new_group16(); in kex_dh_keygen()
61 kex->dh = dh_new_group18(); in kex_dh_keygen()
66 if (kex->dh == NULL) in kex_dh_keygen()
68 return (dh_gen_key(kex->dh, kex->we_need * 8)); in kex_dh_keygen()
72 kex_dh_compute_key(struct kex *kex, BIGNUM *dh_pub, struct sshbuf *out) in kex_dh_compute_key() argument
84 DHparams_print_fp(stderr, kex->dh); in kex_dh_compute_key()
88 if (!dh_pub_is_valid(kex->dh, dh_pub)) { in kex_dh_compute_key()
92 klen = DH_size(kex->dh); in kex_dh_compute_key()
98 if ((kout = DH_compute_key(kbuf, dh_pub, kex->dh)) < 0 || in kex_dh_compute_key()
114 kex_dh_keypair(struct kex *kex) in kex_dh_keypair() argument
120 if ((r = kex_dh_keygen(kex)) != 0) in kex_dh_keypair()
122 DH_get0_key(kex->dh, &pub_key, NULL); in kex_dh_keypair()
129 DHparams_print_fp(stderr, kex->dh); in kex_dh_keypair()
134 kex->client_pub = buf; in kex_dh_keypair()
142 kex_dh_enc(struct kex *kex, const struct sshbuf *client_blob, in kex_dh_enc() argument
152 if ((r = kex_dh_keygen(kex)) != 0) in kex_dh_enc()
154 DH_get0_key(kex->dh, &pub_key, NULL); in kex_dh_enc()
162 if ((r = kex_dh_dec(kex, client_blob, shared_secretp)) != 0) in kex_dh_enc()
167 DH_free(kex->dh); in kex_dh_enc()
168 kex->dh = NULL; in kex_dh_enc()
174 kex_dh_dec(struct kex *kex, const struct sshbuf *dh_blob, in kex_dh_dec() argument
191 if ((r = kex_dh_compute_key(kex, dh_pub, buf)) != 0) in kex_dh_dec()
196 DH_free(kex->dh); in kex_dh_dec()
197 kex->dh = NULL; in kex_dh_dec()