version 1.32, 2019/01/21 09:55:52 |
version 1.33, 2019/01/21 10:00:23 |
|
|
#include "sshkey.h" |
#include "sshkey.h" |
#include "cipher.h" |
#include "cipher.h" |
#include "digest.h" |
#include "digest.h" |
|
#include "dh.h" |
#include "kex.h" |
#include "kex.h" |
#include "log.h" |
#include "log.h" |
#include "packet.h" |
#include "packet.h" |
#include "dh.h" |
|
#include "ssh2.h" |
#include "ssh2.h" |
|
|
#include "dispatch.h" |
#include "dispatch.h" |
|
|
int r; |
int r; |
|
|
/* generate server DH public key */ |
/* generate server DH public key */ |
switch (kex->kex_type) { |
if ((r = kex_dh_keygen(kex)) != 0) |
case KEX_DH_GRP1_SHA1: |
return r; |
kex->dh = dh_new_group1(); |
|
break; |
|
case KEX_DH_GRP14_SHA1: |
|
case KEX_DH_GRP14_SHA256: |
|
kex->dh = dh_new_group14(); |
|
break; |
|
case KEX_DH_GRP16_SHA512: |
|
kex->dh = dh_new_group16(); |
|
break; |
|
case KEX_DH_GRP18_SHA512: |
|
kex->dh = dh_new_group18(); |
|
break; |
|
default: |
|
r = SSH_ERR_INVALID_ARGUMENT; |
|
goto out; |
|
} |
|
if (kex->dh == NULL) { |
|
r = SSH_ERR_ALLOC_FAIL; |
|
goto out; |
|
} |
|
if ((r = dh_gen_key(kex->dh, kex->we_need * 8)) != 0) |
|
goto out; |
|
|
|
debug("expecting SSH2_MSG_KEXDH_INIT"); |
debug("expecting SSH2_MSG_KEXDH_INIT"); |
ssh_dispatch_set(ssh, SSH2_MSG_KEXDH_INIT, &input_kex_dh_init); |
ssh_dispatch_set(ssh, SSH2_MSG_KEXDH_INIT, &input_kex_dh_init); |
r = 0; |
return 0; |
out: |
|
return r; |
|
} |
} |
|
|
int |
int |