summaryrefslogtreecommitdiff
path: root/kexdh.c
diff options
context:
space:
mode:
Diffstat (limited to 'kexdh.c')
-rw-r--r--kexdh.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/kexdh.c b/kexdh.c
index 34c55ef9f..916036994 100644
--- a/kexdh.c
+++ b/kexdh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: kexdh.c,v 1.27 2018/12/27 03:25:25 djm Exp $ */ 1/* $OpenBSD: kexdh.c,v 1.28 2019/01/21 10:00:23 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2001 Markus Friedl. All rights reserved. 3 * Copyright (c) 2001 Markus Friedl. All rights reserved.
4 * 4 *
@@ -39,11 +39,37 @@
39#include "sshkey.h" 39#include "sshkey.h"
40#include "cipher.h" 40#include "cipher.h"
41#include "kex.h" 41#include "kex.h"
42#include "dh.h"
42#include "ssherr.h" 43#include "ssherr.h"
43#include "sshbuf.h" 44#include "sshbuf.h"
44#include "digest.h" 45#include "digest.h"
45 46
46int 47int
48kex_dh_keygen(struct kex *kex)
49{
50 switch (kex->kex_type) {
51 case KEX_DH_GRP1_SHA1:
52 kex->dh = dh_new_group1();
53 break;
54 case KEX_DH_GRP14_SHA1:
55 case KEX_DH_GRP14_SHA256:
56 kex->dh = dh_new_group14();
57 break;
58 case KEX_DH_GRP16_SHA512:
59 kex->dh = dh_new_group16();
60 break;
61 case KEX_DH_GRP18_SHA512:
62 kex->dh = dh_new_group18();
63 break;
64 default:
65 return SSH_ERR_INVALID_ARGUMENT;
66 }
67 if (kex->dh == NULL)
68 return SSH_ERR_ALLOC_FAIL;
69 return (dh_gen_key(kex->dh, kex->we_need * 8));
70}
71
72int
47kex_dh_hash( 73kex_dh_hash(
48 int hash_alg, 74 int hash_alg,
49 const struct sshbuf *client_version, 75 const struct sshbuf *client_version,