mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-08-08 19:02:06 +03:00
priv: Move kex functions to kex header.
This commit is contained in:
@@ -80,8 +80,8 @@ struct ssh_crypto_struct {
|
|||||||
void *compress_out_ctx; /* don't touch it */
|
void *compress_out_ctx; /* don't touch it */
|
||||||
void *compress_in_ctx; /* really, don't */
|
void *compress_in_ctx; /* really, don't */
|
||||||
/* kex sent by server, client, and mutually elected methods */
|
/* kex sent by server, client, and mutually elected methods */
|
||||||
KEX server_kex;
|
struct ssh_kex_struct server_kex;
|
||||||
KEX client_kex;
|
struct ssh_kex_struct client_kex;
|
||||||
char *kex_methods[SSH_KEX_METHODS];
|
char *kex_methods[SSH_KEX_METHODS];
|
||||||
enum ssh_key_exchange_e kex_type;
|
enum ssh_key_exchange_e kex_type;
|
||||||
enum ssh_mac_e mac_type; /* Mac operations to use for key gen */
|
enum ssh_mac_e mac_type; /* Mac operations to use for key gen */
|
||||||
|
@@ -27,14 +27,24 @@
|
|||||||
|
|
||||||
#define SSH_KEX_METHODS 10
|
#define SSH_KEX_METHODS 10
|
||||||
|
|
||||||
typedef struct ssh_kex_struct {
|
struct ssh_kex_struct {
|
||||||
unsigned char cookie[16];
|
unsigned char cookie[16];
|
||||||
char *methods[SSH_KEX_METHODS];
|
char *methods[SSH_KEX_METHODS];
|
||||||
} KEX;
|
};
|
||||||
|
|
||||||
SSH_PACKET_CALLBACK(ssh_packet_kexinit);
|
SSH_PACKET_CALLBACK(ssh_packet_kexinit);
|
||||||
#ifdef WITH_SSH1
|
#ifdef WITH_SSH1
|
||||||
SSH_PACKET_CALLBACK(ssh_packet_publickey1);
|
SSH_PACKET_CALLBACK(ssh_packet_publickey1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern const char *ssh_kex_nums[];
|
||||||
|
int ssh_send_kex(ssh_session session, int server_kex);
|
||||||
|
void ssh_list_kex(ssh_session session, struct ssh_kex_struct *kex);
|
||||||
|
int set_client_kex(ssh_session session);
|
||||||
|
int ssh_kex_select_methods(ssh_session session);
|
||||||
|
int verify_existing_algo(int algo, const char *name);
|
||||||
|
char **space_tokenize(const char *chain);
|
||||||
|
int ssh_get_kex1(ssh_session session);
|
||||||
|
char *ssh_find_matching(const char *in_d, const char *what_d);
|
||||||
|
|
||||||
#endif /* KEX_H_ */
|
#endif /* KEX_H_ */
|
||||||
|
@@ -128,13 +128,12 @@ extern "C" {
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* error handling structure */
|
||||||
struct error_struct {
|
struct error_struct {
|
||||||
/* error handling */
|
|
||||||
int error_code;
|
int error_code;
|
||||||
char error_buffer[ERROR_BUFFERLEN];
|
char error_buffer[ERROR_BUFFERLEN];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ssh_message_struct;
|
|
||||||
struct ssh_common_struct;
|
struct ssh_common_struct;
|
||||||
struct ssh_kex_struct;
|
struct ssh_kex_struct;
|
||||||
|
|
||||||
@@ -192,18 +191,6 @@ socket_t ssh_connect_host_nonblocking(ssh_session session, const char *host,
|
|||||||
void ssh_sock_set_nonblocking(socket_t sock);
|
void ssh_sock_set_nonblocking(socket_t sock);
|
||||||
void ssh_sock_set_blocking(socket_t sock);
|
void ssh_sock_set_blocking(socket_t sock);
|
||||||
|
|
||||||
/* in kex.c */
|
|
||||||
extern const char *ssh_kex_nums[];
|
|
||||||
int ssh_send_kex(ssh_session session, int server_kex);
|
|
||||||
void ssh_list_kex(ssh_session session, struct ssh_kex_struct *kex);
|
|
||||||
int set_client_kex(ssh_session session);
|
|
||||||
int ssh_kex_select_methods(ssh_session session);
|
|
||||||
int verify_existing_algo(int algo, const char *name);
|
|
||||||
char **space_tokenize(const char *chain);
|
|
||||||
int ssh_get_kex1(ssh_session session);
|
|
||||||
char *ssh_find_matching(const char *in_d, const char *what_d);
|
|
||||||
|
|
||||||
|
|
||||||
/* in base64.c */
|
/* in base64.c */
|
||||||
ssh_buffer base64_to_bin(const char *source);
|
ssh_buffer base64_to_bin(const char *source);
|
||||||
unsigned char *bin_to_base64(const unsigned char *source, int len);
|
unsigned char *bin_to_base64(const unsigned char *source, int len);
|
||||||
|
@@ -22,6 +22,7 @@
|
|||||||
#ifndef SESSION_H_
|
#ifndef SESSION_H_
|
||||||
#define SESSION_H_
|
#define SESSION_H_
|
||||||
#include "libssh/priv.h"
|
#include "libssh/priv.h"
|
||||||
|
#include "libssh/kex.h"
|
||||||
#include "libssh/packet.h"
|
#include "libssh/packet.h"
|
||||||
#include "libssh/pcap.h"
|
#include "libssh/pcap.h"
|
||||||
#include "libssh/auth.h"
|
#include "libssh/auth.h"
|
||||||
|
@@ -41,6 +41,7 @@
|
|||||||
#include "libssh/threads.h"
|
#include "libssh/threads.h"
|
||||||
#include "libssh/misc.h"
|
#include "libssh/misc.h"
|
||||||
#include "libssh/pki.h"
|
#include "libssh/pki.h"
|
||||||
|
#include "libssh/kex.h"
|
||||||
|
|
||||||
#define set_status(session, status) do {\
|
#define set_status(session, status) do {\
|
||||||
if (session->common.callbacks && session->common.callbacks->connect_status_function) \
|
if (session->common.callbacks && session->common.callbacks->connect_status_function) \
|
||||||
|
10
src/kex.c
10
src/kex.c
@@ -327,7 +327,7 @@ error:
|
|||||||
return SSH_PACKET_USED;
|
return SSH_PACKET_USED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ssh_list_kex(ssh_session session, KEX *kex) {
|
void ssh_list_kex(ssh_session session, struct ssh_kex_struct *kex) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
#ifdef DEBUG_CRYPTO
|
#ifdef DEBUG_CRYPTO
|
||||||
@@ -348,7 +348,7 @@ void ssh_list_kex(ssh_session session, KEX *kex) {
|
|||||||
* in function of the options and available methods.
|
* in function of the options and available methods.
|
||||||
*/
|
*/
|
||||||
int set_client_kex(ssh_session session){
|
int set_client_kex(ssh_session session){
|
||||||
KEX *client= &session->next_crypto->client_kex;
|
struct ssh_kex_struct *client= &session->next_crypto->client_kex;
|
||||||
int i;
|
int i;
|
||||||
const char *wanted;
|
const char *wanted;
|
||||||
enter_function();
|
enter_function();
|
||||||
@@ -368,8 +368,8 @@ int set_client_kex(ssh_session session){
|
|||||||
* server's kex messages, and watches out if a match is possible.
|
* server's kex messages, and watches out if a match is possible.
|
||||||
*/
|
*/
|
||||||
int ssh_kex_select_methods (ssh_session session){
|
int ssh_kex_select_methods (ssh_session session){
|
||||||
KEX *server = &session->next_crypto->server_kex;
|
struct ssh_kex_struct *server = &session->next_crypto->server_kex;
|
||||||
KEX *client = &session->next_crypto->client_kex;
|
struct ssh_kex_struct *client = &session->next_crypto->client_kex;
|
||||||
int rc = SSH_ERROR;
|
int rc = SSH_ERROR;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -400,7 +400,7 @@ error:
|
|||||||
|
|
||||||
/* this function only sends the predefined set of kex methods */
|
/* this function only sends the predefined set of kex methods */
|
||||||
int ssh_send_kex(ssh_session session, int server_kex) {
|
int ssh_send_kex(ssh_session session, int server_kex) {
|
||||||
KEX *kex = (server_kex ? &session->next_crypto->server_kex :
|
struct ssh_kex_struct *kex = (server_kex ? &session->next_crypto->server_kex :
|
||||||
&session->next_crypto->client_kex);
|
&session->next_crypto->client_kex);
|
||||||
ssh_string str = NULL;
|
ssh_string str = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
@@ -84,7 +84,7 @@ extern const char *supported_methods[];
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static int server_set_kex(ssh_session session) {
|
static int server_set_kex(ssh_session session) {
|
||||||
KEX *server = &session->next_crypto->server_kex;
|
struct ssh_kex_struct *server = &session->next_crypto->server_kex;
|
||||||
int i, j;
|
int i, j;
|
||||||
const char *wanted;
|
const char *wanted;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user