version 1.98, 2014/02/02 03:44:31 |
version 1.99, 2014/04/29 18:01:49 |
|
|
#include <stdlib.h> |
#include <stdlib.h> |
#include <string.h> |
#include <string.h> |
|
|
|
#ifdef WITH_OPENSSL |
#include <openssl/crypto.h> |
#include <openssl/crypto.h> |
|
#endif |
|
|
#include "xmalloc.h" |
#include "xmalloc.h" |
#include "ssh2.h" |
#include "ssh2.h" |
|
|
int hash_alg; |
int hash_alg; |
}; |
}; |
static const struct kexalg kexalgs[] = { |
static const struct kexalg kexalgs[] = { |
|
#ifdef WITH_OPENSSL |
{ KEX_DH1, KEX_DH_GRP1_SHA1, 0, SSH_DIGEST_SHA1 }, |
{ KEX_DH1, KEX_DH_GRP1_SHA1, 0, SSH_DIGEST_SHA1 }, |
{ KEX_DH14, KEX_DH_GRP14_SHA1, 0, SSH_DIGEST_SHA1 }, |
{ KEX_DH14, KEX_DH_GRP14_SHA1, 0, SSH_DIGEST_SHA1 }, |
{ KEX_DHGEX_SHA1, KEX_DH_GEX_SHA1, 0, SSH_DIGEST_SHA1 }, |
{ KEX_DHGEX_SHA1, KEX_DH_GEX_SHA1, 0, SSH_DIGEST_SHA1 }, |
|
|
SSH_DIGEST_SHA384 }, |
SSH_DIGEST_SHA384 }, |
{ KEX_ECDH_SHA2_NISTP521, KEX_ECDH_SHA2, NID_secp521r1, |
{ KEX_ECDH_SHA2_NISTP521, KEX_ECDH_SHA2, NID_secp521r1, |
SSH_DIGEST_SHA512 }, |
SSH_DIGEST_SHA512 }, |
|
#endif |
{ KEX_CURVE25519_SHA256, KEX_C25519_SHA256, 0, SSH_DIGEST_SHA256 }, |
{ KEX_CURVE25519_SHA256, KEX_C25519_SHA256, 0, SSH_DIGEST_SHA256 }, |
{ NULL, -1, -1, -1}, |
{ NULL, -1, -1, -1}, |
}; |
}; |
|
|
} |
} |
} |
} |
|
|
|
#ifdef WITH_OPENSSL |
void |
void |
kex_derive_keys_bn(Kex *kex, u_char *hash, u_int hashlen, const BIGNUM *secret) |
kex_derive_keys_bn(Kex *kex, u_char *hash, u_int hashlen, const BIGNUM *secret) |
{ |
{ |
|
|
buffer_ptr(&shared_secret), buffer_len(&shared_secret)); |
buffer_ptr(&shared_secret), buffer_len(&shared_secret)); |
buffer_free(&shared_secret); |
buffer_free(&shared_secret); |
} |
} |
|
#endif |
|
|
Newkeys * |
Newkeys * |
kex_get_newkeys(int mode) |
kex_get_newkeys(int mode) |
|
|
return ret; |
return ret; |
} |
} |
|
|
|
#ifdef WITH_SSH1 |
void |
void |
derive_ssh1_session_id(BIGNUM *host_modulus, BIGNUM *server_modulus, |
derive_ssh1_session_id(BIGNUM *host_modulus, BIGNUM *server_modulus, |
u_int8_t cookie[8], u_int8_t id[16]) |
u_int8_t cookie[8], u_int8_t id[16]) |
|
|
explicit_bzero(nbuf, sizeof(nbuf)); |
explicit_bzero(nbuf, sizeof(nbuf)); |
explicit_bzero(obuf, sizeof(obuf)); |
explicit_bzero(obuf, sizeof(obuf)); |
} |
} |
|
#endif |
|
|
#if defined(DEBUG_KEX) || defined(DEBUG_KEXDH) || defined(DEBUG_KEXECDH) |
#if defined(DEBUG_KEX) || defined(DEBUG_KEXDH) || defined(DEBUG_KEXECDH) |
void |
void |