cleanup: use ssh_ prefix in the packet (non-static) functions
Having "ssh_" prefix in the functions' name will avoid possible clashes when compiling libssh statically. Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Этот коммит содержится в:
родитель
310c41a89a
Коммит
e368d01385
@ -43,10 +43,10 @@ enum ssh_packet_state_e {
|
||||
PACKET_STATE_PROCESSING
|
||||
};
|
||||
|
||||
int packet_send(ssh_session session);
|
||||
int ssh_packet_send(ssh_session session);
|
||||
|
||||
#ifdef WITH_SSH1
|
||||
int packet_send1(ssh_session session) ;
|
||||
int ssh_packet_send1(ssh_session session) ;
|
||||
void ssh_packet_set_default_callbacks1(ssh_session session);
|
||||
|
||||
SSH_PACKET_CALLBACK(ssh_packet_disconnect1);
|
||||
@ -78,12 +78,12 @@ void ssh_packet_set_default_callbacks(ssh_session session);
|
||||
void ssh_packet_process(ssh_session session, uint8_t type);
|
||||
|
||||
/* PACKET CRYPT */
|
||||
uint32_t packet_decrypt_len(ssh_session session, char *crypted);
|
||||
int packet_decrypt(ssh_session session, void *packet, unsigned int len);
|
||||
unsigned char *packet_encrypt(ssh_session session,
|
||||
void *packet,
|
||||
unsigned int len);
|
||||
int packet_hmac_verify(ssh_session session,ssh_buffer buffer,
|
||||
unsigned char *mac, enum ssh_hmac_e type);
|
||||
uint32_t ssh_packet_decrypt_len(ssh_session session, char *crypted);
|
||||
int ssh_packet_decrypt(ssh_session session, void *packet, unsigned int len);
|
||||
unsigned char *ssh_packet_encrypt(ssh_session session,
|
||||
void *packet,
|
||||
unsigned int len);
|
||||
int ssh_packet_hmac_verify(ssh_session session,ssh_buffer buffer,
|
||||
unsigned char *mac, enum ssh_hmac_e type);
|
||||
|
||||
#endif /* PACKET_H_ */
|
||||
|
14
src/auth.c
14
src/auth.c
@ -391,7 +391,7 @@ int ssh_userauth_none(ssh_session session, const char *username) {
|
||||
|
||||
session->auth_state = SSH_AUTH_STATE_NONE;
|
||||
session->pending_call_state = SSH_PENDING_CALL_AUTH_NONE;
|
||||
rc = packet_send(session);
|
||||
rc = ssh_packet_send(session);
|
||||
if (rc == SSH_ERROR) {
|
||||
return SSH_AUTH_ERROR;
|
||||
}
|
||||
@ -503,7 +503,7 @@ int ssh_userauth_try_publickey(ssh_session session,
|
||||
|
||||
session->auth_state = SSH_AUTH_STATE_NONE;
|
||||
session->pending_call_state = SSH_PENDING_CALL_AUTH_OFFER_PUBKEY;
|
||||
rc = packet_send(session);
|
||||
rc = ssh_packet_send(session);
|
||||
if (rc == SSH_ERROR) {
|
||||
return SSH_AUTH_ERROR;
|
||||
}
|
||||
@ -623,7 +623,7 @@ int ssh_userauth_publickey(ssh_session session,
|
||||
|
||||
session->auth_state = SSH_AUTH_STATE_NONE;
|
||||
session->pending_call_state = SSH_PENDING_CALL_AUTH_PUBKEY;
|
||||
rc = packet_send(session);
|
||||
rc = ssh_packet_send(session);
|
||||
if (rc == SSH_ERROR) {
|
||||
return SSH_AUTH_ERROR;
|
||||
}
|
||||
@ -707,7 +707,7 @@ static int ssh_userauth_agent_publickey(ssh_session session,
|
||||
|
||||
session->auth_state = SSH_AUTH_STATE_NONE;
|
||||
session->pending_call_state = SSH_PENDING_CALL_AUTH_AGENT;
|
||||
rc = packet_send(session);
|
||||
rc = ssh_packet_send(session);
|
||||
if (rc == SSH_ERROR) {
|
||||
return SSH_AUTH_ERROR;
|
||||
}
|
||||
@ -1151,7 +1151,7 @@ int ssh_userauth_password(ssh_session session,
|
||||
|
||||
session->auth_state = SSH_AUTH_STATE_NONE;
|
||||
session->pending_call_state = SSH_PENDING_CALL_AUTH_OFFER_PUBKEY;
|
||||
rc = packet_send(session);
|
||||
rc = ssh_packet_send(session);
|
||||
if (rc == SSH_ERROR) {
|
||||
return SSH_AUTH_ERROR;
|
||||
}
|
||||
@ -1320,7 +1320,7 @@ static int ssh_userauth_kbdint_init(ssh_session session,
|
||||
SSH_LOG(SSH_LOG_DEBUG,
|
||||
"Sending keyboard-interactive init request");
|
||||
|
||||
rc = packet_send(session);
|
||||
rc = ssh_packet_send(session);
|
||||
if (rc == SSH_ERROR) {
|
||||
return SSH_AUTH_ERROR;
|
||||
}
|
||||
@ -1381,7 +1381,7 @@ static int ssh_userauth_kbdint_send(ssh_session session)
|
||||
SSH_LOG(SSH_LOG_DEBUG,
|
||||
"Sending keyboard-interactive response packet");
|
||||
|
||||
rc = packet_send(session);
|
||||
rc = ssh_packet_send(session);
|
||||
if (rc == SSH_ERROR) {
|
||||
return SSH_AUTH_ERROR;
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ static int send_username(ssh_session session, const char *username) {
|
||||
ssh_string_free(user);
|
||||
session->auth_state=SSH_AUTH_STATE_NONE;
|
||||
session->auth_service_state = SSH_AUTH_SERVICE_SENT;
|
||||
if (packet_send(session) == SSH_ERROR) {
|
||||
if (ssh_packet_send(session) == SSH_ERROR) {
|
||||
return SSH_AUTH_ERROR;
|
||||
}
|
||||
pending:
|
||||
@ -214,7 +214,7 @@ int ssh_userauth1_password(ssh_session session, const char *username,
|
||||
ssh_string_free(pwd);
|
||||
session->auth_state=SSH_AUTH_STATE_NONE;
|
||||
session->pending_call_state = SSH_PENDING_CALL_AUTH_PASSWORD;
|
||||
if (packet_send(session) == SSH_ERROR) {
|
||||
if (ssh_packet_send(session) == SSH_ERROR) {
|
||||
return SSH_AUTH_ERROR;
|
||||
}
|
||||
pending:
|
||||
|
@ -293,7 +293,7 @@ static int channel_open(ssh_channel channel, const char *type, int window,
|
||||
}
|
||||
}
|
||||
channel->state = SSH_CHANNEL_STATE_OPENING;
|
||||
if (packet_send(session) == SSH_ERROR) {
|
||||
if (ssh_packet_send(session) == SSH_ERROR) {
|
||||
|
||||
return err;
|
||||
}
|
||||
@ -374,7 +374,7 @@ static int grow_window(ssh_session session, ssh_channel channel, int minimumsize
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (packet_send(session) == SSH_ERROR) {
|
||||
if (ssh_packet_send(session) == SSH_ERROR) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -752,7 +752,7 @@ SSH_PACKET_CALLBACK(channel_rcv_request) {
|
||||
if (rc != SSH_OK) {
|
||||
return SSH_PACKET_USED;
|
||||
}
|
||||
packet_send(session);
|
||||
ssh_packet_send(session);
|
||||
|
||||
return SSH_PACKET_USED;
|
||||
}
|
||||
@ -1082,7 +1082,7 @@ int ssh_channel_send_eof(ssh_channel channel){
|
||||
goto error;
|
||||
}
|
||||
|
||||
rc = packet_send(session);
|
||||
rc = ssh_packet_send(session);
|
||||
SSH_LOG(SSH_LOG_PACKET,
|
||||
"Sent a EOF on client channel (%d:%d)",
|
||||
channel->local_channel,
|
||||
@ -1141,7 +1141,7 @@ int ssh_channel_close(ssh_channel channel){
|
||||
goto error;
|
||||
}
|
||||
|
||||
rc = packet_send(session);
|
||||
rc = ssh_packet_send(session);
|
||||
SSH_LOG(SSH_LOG_PACKET,
|
||||
"Sent a close on client channel (%d:%d)",
|
||||
channel->local_channel,
|
||||
@ -1318,7 +1318,7 @@ static int channel_write_common(ssh_channel channel,
|
||||
goto error;
|
||||
}
|
||||
|
||||
rc = packet_send(session);
|
||||
rc = ssh_packet_send(session);
|
||||
if (rc == SSH_ERROR) {
|
||||
return SSH_ERROR;
|
||||
}
|
||||
@ -1547,7 +1547,7 @@ static int channel_request(ssh_channel channel, const char *request,
|
||||
}
|
||||
}
|
||||
channel->request_state = SSH_CHANNEL_REQ_STATE_PENDING;
|
||||
if (packet_send(session) == SSH_ERROR) {
|
||||
if (ssh_packet_send(session) == SSH_ERROR) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -2109,7 +2109,7 @@ static int global_request(ssh_session session, const char *request,
|
||||
}
|
||||
|
||||
session->global_req_state = SSH_CHANNEL_REQ_STATE_PENDING;
|
||||
rc = packet_send(session);
|
||||
rc = ssh_packet_send(session);
|
||||
if (rc == SSH_ERROR) {
|
||||
return rc;
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ int ssh_channel_request_pty_size1(ssh_channel channel, const char *terminal, int
|
||||
|
||||
SSH_LOG(SSH_LOG_FUNCTIONS, "Opening a ssh1 pty");
|
||||
channel->request_state = SSH_CHANNEL_REQ_STATE_PENDING;
|
||||
if (packet_send(session) == SSH_ERROR) {
|
||||
if (ssh_packet_send(session) == SSH_ERROR) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -178,7 +178,7 @@ int ssh_channel_change_pty_size1(ssh_channel channel, int cols, int rows) {
|
||||
return SSH_ERROR;
|
||||
}
|
||||
channel->request_state=SSH_CHANNEL_REQ_STATE_PENDING;
|
||||
if (packet_send(session) == SSH_ERROR) {
|
||||
if (ssh_packet_send(session) == SSH_ERROR) {
|
||||
return SSH_ERROR;
|
||||
}
|
||||
|
||||
@ -219,7 +219,7 @@ int ssh_channel_request_shell1(ssh_channel channel) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (packet_send(session) == SSH_ERROR) {
|
||||
if (ssh_packet_send(session) == SSH_ERROR) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -249,7 +249,7 @@ int ssh_channel_request_exec1(ssh_channel channel, const char *cmd) {
|
||||
}
|
||||
ssh_string_free(command);
|
||||
|
||||
if(packet_send(session) == SSH_ERROR) {
|
||||
if(ssh_packet_send(session) == SSH_ERROR) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -314,7 +314,7 @@ SSH_PACKET_CALLBACK(ssh_packet_close1){
|
||||
if (rc < 0) {
|
||||
return SSH_PACKET_NOT_USED;
|
||||
}
|
||||
packet_send(session);
|
||||
ssh_packet_send(session);
|
||||
|
||||
return SSH_PACKET_USED;
|
||||
}
|
||||
@ -364,7 +364,7 @@ int ssh_channel_write1(ssh_channel channel, const void *data, int len) {
|
||||
ptr += effectivelen;
|
||||
len -= effectivelen;
|
||||
|
||||
if (packet_send(session) == SSH_ERROR) {
|
||||
if (ssh_packet_send(session) == SSH_ERROR) {
|
||||
return -1;
|
||||
}
|
||||
ssh_handle_packets(session, SSH_TIMEOUT_NONBLOCKING);
|
||||
|
@ -283,7 +283,7 @@ int ssh_service_request(ssh_session session, const char *service) {
|
||||
return SSH_ERROR;
|
||||
}
|
||||
session->auth_service_state=SSH_AUTH_SERVICE_SENT;
|
||||
if (packet_send(session) == SSH_ERROR) {
|
||||
if (ssh_packet_send(session) == SSH_ERROR) {
|
||||
ssh_set_error(session, SSH_FATAL,
|
||||
"Sending SSH2_MSG_SERVICE_REQUEST failed.");
|
||||
return SSH_ERROR;
|
||||
@ -643,7 +643,7 @@ void ssh_disconnect(ssh_session session) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
packet_send(session);
|
||||
ssh_packet_send(session);
|
||||
ssh_socket_close(session->socket);
|
||||
}
|
||||
error:
|
||||
|
@ -64,7 +64,7 @@ int ssh_client_curve25519_init(ssh_session session){
|
||||
return SSH_ERROR;
|
||||
}
|
||||
|
||||
rc = packet_send(session);
|
||||
rc = ssh_packet_send(session);
|
||||
|
||||
return rc;
|
||||
}
|
||||
@ -147,7 +147,7 @@ int ssh_client_curve25519_reply(ssh_session session, ssh_buffer packet){
|
||||
goto error;
|
||||
}
|
||||
|
||||
rc=packet_send(session);
|
||||
rc=ssh_packet_send(session);
|
||||
SSH_LOG(SSH_LOG_PROTOCOL, "SSH_MSG_NEWKEYS sent");
|
||||
return rc;
|
||||
error:
|
||||
@ -260,7 +260,7 @@ int ssh_server_curve25519_init(ssh_session session, ssh_buffer packet){
|
||||
}
|
||||
|
||||
SSH_LOG(SSH_LOG_PROTOCOL, "SSH_MSG_KEX_ECDH_REPLY sent");
|
||||
rc = packet_send(session);
|
||||
rc = ssh_packet_send(session);
|
||||
if (rc == SSH_ERROR) {
|
||||
return SSH_ERROR;
|
||||
}
|
||||
@ -272,7 +272,7 @@ int ssh_server_curve25519_init(ssh_session session, ssh_buffer packet){
|
||||
}
|
||||
|
||||
session->dh_handshake_state = DH_STATE_NEWKEYS_SENT;
|
||||
rc = packet_send(session);
|
||||
rc = ssh_packet_send(session);
|
||||
SSH_LOG(SSH_LOG_PROTOCOL, "SSH_MSG_NEWKEYS sent");
|
||||
|
||||
return rc;
|
||||
|
4
src/dh.c
4
src/dh.c
@ -456,7 +456,7 @@ int ssh_client_dh_init(ssh_session session){
|
||||
ssh_string_free(e);
|
||||
e=NULL;
|
||||
|
||||
rc = packet_send(session);
|
||||
rc = ssh_packet_send(session);
|
||||
return rc;
|
||||
error:
|
||||
if(e != NULL){
|
||||
@ -509,7 +509,7 @@ int ssh_client_dh_reply(ssh_session session, ssh_buffer packet){
|
||||
goto error;
|
||||
}
|
||||
|
||||
rc=packet_send(session);
|
||||
rc=ssh_packet_send(session);
|
||||
SSH_LOG(SSH_LOG_PROTOCOL, "SSH_MSG_NEWKEYS sent");
|
||||
return rc;
|
||||
error:
|
||||
|
@ -87,7 +87,7 @@ int ssh_client_ecdh_init(ssh_session session){
|
||||
session->next_crypto->ecdh_privkey = key;
|
||||
session->next_crypto->ecdh_client_pubkey = client_pubkey;
|
||||
|
||||
rc = packet_send(session);
|
||||
rc = ssh_packet_send(session);
|
||||
|
||||
return rc;
|
||||
}
|
||||
@ -212,7 +212,7 @@ int ssh_client_ecdh_reply(ssh_session session, ssh_buffer packet){
|
||||
goto error;
|
||||
}
|
||||
|
||||
rc=packet_send(session);
|
||||
rc=ssh_packet_send(session);
|
||||
SSH_LOG(SSH_LOG_PROTOCOL, "SSH_MSG_NEWKEYS sent");
|
||||
return rc;
|
||||
error:
|
||||
@ -326,7 +326,7 @@ int ssh_server_ecdh_init(ssh_session session, ssh_buffer packet){
|
||||
}
|
||||
|
||||
SSH_LOG(SSH_LOG_PROTOCOL, "SSH_MSG_KEXDH_REPLY sent");
|
||||
rc = packet_send(session);
|
||||
rc = ssh_packet_send(session);
|
||||
if (rc == SSH_ERROR) {
|
||||
return SSH_ERROR;
|
||||
}
|
||||
@ -338,7 +338,7 @@ int ssh_server_ecdh_init(ssh_session session, ssh_buffer packet){
|
||||
}
|
||||
|
||||
session->dh_handshake_state = DH_STATE_NEWKEYS_SENT;
|
||||
rc = packet_send(session);
|
||||
rc = ssh_packet_send(session);
|
||||
SSH_LOG(SSH_LOG_PROTOCOL, "SSH_MSG_NEWKEYS sent");
|
||||
|
||||
return rc;
|
||||
|
14
src/gssapi.c
14
src/gssapi.c
@ -121,7 +121,7 @@ static int ssh_gssapi_send_response(ssh_session session, ssh_string oid){
|
||||
return SSH_ERROR;
|
||||
}
|
||||
|
||||
packet_send(session);
|
||||
ssh_packet_send(session);
|
||||
SSH_LOG(SSH_LOG_PACKET,
|
||||
"Sent SSH_MSG_USERAUTH_GSSAPI_RESPONSE");
|
||||
return SSH_OK;
|
||||
@ -319,7 +319,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_gssapi_token_server){
|
||||
ssh_set_error_oom(session);
|
||||
return SSH_PACKET_USED;
|
||||
}
|
||||
packet_send(session);
|
||||
ssh_packet_send(session);
|
||||
ssh_string_free(out_token);
|
||||
} else {
|
||||
session->gssapi->state = SSH_GSSAPI_STATE_RCV_MIC;
|
||||
@ -358,7 +358,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_gssapi_token_server){
|
||||
SSH2_MSG_USERAUTH_GSSAPI_TOKEN,
|
||||
output_token.length,
|
||||
(size_t)output_token.length, output_token.value);
|
||||
packet_send(session);
|
||||
ssh_packet_send(session);
|
||||
}
|
||||
if(maj_stat == GSS_S_COMPLETE){
|
||||
session->gssapi->state = SSH_GSSAPI_STATE_RCV_MIC;
|
||||
@ -540,7 +540,7 @@ static int ssh_gssapi_send_auth_mic(ssh_session session, ssh_string *oid_set, in
|
||||
}
|
||||
|
||||
session->auth_state = SSH_AUTH_STATE_GSSAPI_REQUEST_SENT;
|
||||
return packet_send(session);
|
||||
return ssh_packet_send(session);
|
||||
fail:
|
||||
ssh_buffer_reinit(session->out_buffer);
|
||||
return SSH_ERROR;
|
||||
@ -771,7 +771,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_gssapi_response){
|
||||
SSH2_MSG_USERAUTH_GSSAPI_TOKEN,
|
||||
output_token.length,
|
||||
(size_t)output_token.length, output_token.value);
|
||||
packet_send(session);
|
||||
ssh_packet_send(session);
|
||||
session->auth_state = SSH_AUTH_STATE_GSSAPI_TOKEN;
|
||||
}
|
||||
return SSH_PACKET_USED;
|
||||
@ -812,7 +812,7 @@ static int ssh_gssapi_send_mic(ssh_session session){
|
||||
return SSH_ERROR;
|
||||
}
|
||||
|
||||
return packet_send(session);
|
||||
return ssh_packet_send(session);
|
||||
}
|
||||
|
||||
SSH_PACKET_CALLBACK(ssh_packet_userauth_gssapi_token_client){
|
||||
@ -866,7 +866,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_gssapi_token_client){
|
||||
SSH2_MSG_USERAUTH_GSSAPI_TOKEN,
|
||||
output_token.length,
|
||||
(size_t)output_token.length, output_token.value);
|
||||
packet_send(session);
|
||||
ssh_packet_send(session);
|
||||
}
|
||||
if(maj_stat == GSS_S_COMPLETE){
|
||||
session->auth_state = SSH_AUTH_STATE_NONE;
|
||||
|
@ -642,7 +642,7 @@ int ssh_send_kex(ssh_session session, int server_kex) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (packet_send(session) == SSH_ERROR) {
|
||||
if (ssh_packet_send(session) == SSH_ERROR) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -443,7 +443,7 @@ SSH_PACKET_CALLBACK(ssh_packet_publickey1){
|
||||
goto error;
|
||||
}
|
||||
session->session_state=SSH_SESSION_STATE_KEXINIT_RECEIVED;
|
||||
if (packet_send(session) == SSH_ERROR) {
|
||||
if (ssh_packet_send(session) == SSH_ERROR) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ static int ssh_message_reply_default(ssh_message msg) {
|
||||
if (ssh_buffer_add_u32(msg->session->out_buffer,
|
||||
htonl(msg->session->recv_seq-1)) < 0)
|
||||
goto error;
|
||||
return packet_send(msg->session);
|
||||
return ssh_packet_send(msg->session);
|
||||
error:
|
||||
return SSH_ERROR;
|
||||
}
|
||||
@ -1138,7 +1138,7 @@ int ssh_message_channel_request_open_reply_accept_channel(ssh_message msg, ssh_c
|
||||
"Accepting a channel request_open for chan %d",
|
||||
chan->remote_channel);
|
||||
|
||||
rc = packet_send(session);
|
||||
rc = ssh_packet_send(session);
|
||||
|
||||
return rc;
|
||||
}
|
||||
@ -1319,7 +1319,7 @@ int ssh_message_channel_request_reply_success(ssh_message msg) {
|
||||
return SSH_ERROR;
|
||||
}
|
||||
|
||||
return packet_send(msg->session);
|
||||
return ssh_packet_send(msg->session);
|
||||
}
|
||||
|
||||
SSH_LOG(SSH_LOG_PACKET,
|
||||
|
14
src/packet.c
14
src/packet.c
@ -192,7 +192,7 @@ int ssh_packet_socket_callback(const void *data, size_t receivedlen, void *user)
|
||||
|
||||
memcpy(buffer, data, blocksize);
|
||||
processed += blocksize;
|
||||
len = packet_decrypt_len(session, buffer);
|
||||
len = ssh_packet_decrypt_len(session, buffer);
|
||||
|
||||
rc = ssh_buffer_add_data(session->in_buffer, buffer, blocksize);
|
||||
if (rc < 0) {
|
||||
@ -260,7 +260,7 @@ int ssh_packet_socket_callback(const void *data, size_t receivedlen, void *user)
|
||||
uint8_t *payload = ((uint8_t*)ssh_buffer_get_rest(session->in_buffer) + blocksize);
|
||||
uint32_t plen = buffer_len - blocksize;
|
||||
|
||||
rc = packet_decrypt(session, payload, plen);
|
||||
rc = ssh_packet_decrypt(session, payload, plen);
|
||||
if (rc < 0) {
|
||||
ssh_set_error(session, SSH_FATAL, "Decrypt error");
|
||||
goto error;
|
||||
@ -271,7 +271,7 @@ int ssh_packet_socket_callback(const void *data, size_t receivedlen, void *user)
|
||||
packet = ((uint8_t *)data) + processed;
|
||||
memcpy(mac, packet, current_macsize);
|
||||
|
||||
rc = packet_hmac_verify(session, session->in_buffer, mac, session->current_crypto->in_hmac);
|
||||
rc = ssh_packet_hmac_verify(session, session->in_buffer, mac, session->current_crypto->in_hmac);
|
||||
if (rc < 0) {
|
||||
ssh_set_error(session, SSH_FATAL, "HMAC error");
|
||||
goto error;
|
||||
@ -452,7 +452,7 @@ int ssh_packet_send_unimplemented(ssh_session session, uint32_t seqnum){
|
||||
ssh_set_error_oom(session);
|
||||
return SSH_ERROR;
|
||||
}
|
||||
rc = packet_send(session);
|
||||
rc = ssh_packet_send(session);
|
||||
|
||||
return rc;
|
||||
}
|
||||
@ -567,7 +567,7 @@ static int packet_send2(ssh_session session) {
|
||||
,ssh_buffer_get_rest_len(session->out_buffer));
|
||||
}
|
||||
#endif
|
||||
hmac = packet_encrypt(session, ssh_buffer_get_rest(session->out_buffer),
|
||||
hmac = ssh_packet_encrypt(session, ssh_buffer_get_rest(session->out_buffer),
|
||||
ssh_buffer_get_rest_len(session->out_buffer));
|
||||
if (hmac) {
|
||||
rc = ssh_buffer_add_data(session->out_buffer, hmac, hmac_digest_len(hmac_type));
|
||||
@ -595,10 +595,10 @@ error:
|
||||
}
|
||||
|
||||
|
||||
int packet_send(ssh_session session) {
|
||||
int ssh_packet_send(ssh_session session) {
|
||||
#ifdef WITH_SSH1
|
||||
if (session->version == 1) {
|
||||
return packet_send1(session);
|
||||
return ssh_packet_send1(session);
|
||||
}
|
||||
#endif
|
||||
return packet_send2(session);
|
||||
|
@ -171,7 +171,7 @@ int ssh_packet_socket_callback1(const void *data, size_t receivedlen, void *user
|
||||
buffer_len = ssh_buffer_get_len(session->in_buffer);
|
||||
if (buffer_len > 0) {
|
||||
int rc;
|
||||
rc = packet_decrypt(session,
|
||||
rc = ssh_packet_decrypt(session,
|
||||
ssh_buffer_get_begin(session->in_buffer),
|
||||
buffer_len);
|
||||
if (rc < 0) {
|
||||
@ -252,7 +252,7 @@ error:
|
||||
}
|
||||
|
||||
|
||||
int packet_send1(ssh_session session) {
|
||||
int ssh_packet_send1(ssh_session session) {
|
||||
unsigned int blocksize = (session->current_crypto ?
|
||||
session->current_crypto->out_cipher->blocksize : 8);
|
||||
uint32_t currentlen = ssh_buffer_get_len(session->out_buffer) + sizeof(uint32_t);
|
||||
@ -306,8 +306,8 @@ int packet_send1(ssh_session session) {
|
||||
#endif
|
||||
|
||||
/* session->out_buffer should have more than sizeof(uint32_t) bytes
|
||||
in it as required for packet_encrypt */
|
||||
packet_encrypt(session, (unsigned char *)ssh_buffer_get_begin(session->out_buffer) + sizeof(uint32_t),
|
||||
in it as required for ssh_packet_encrypt */
|
||||
ssh_packet_encrypt(session, (unsigned char *)ssh_buffer_get_begin(session->out_buffer) + sizeof(uint32_t),
|
||||
ssh_buffer_get_len(session->out_buffer) - sizeof(uint32_t));
|
||||
|
||||
#ifdef DEBUG_CRYPTO
|
||||
|
@ -44,11 +44,11 @@
|
||||
#include "libssh/crypto.h"
|
||||
#include "libssh/buffer.h"
|
||||
|
||||
uint32_t packet_decrypt_len(ssh_session session, char *crypted){
|
||||
uint32_t ssh_packet_decrypt_len(ssh_session session, char *crypted){
|
||||
uint32_t decrypted;
|
||||
|
||||
if (session->current_crypto) {
|
||||
if (packet_decrypt(session, crypted,
|
||||
if (ssh_packet_decrypt(session, crypted,
|
||||
session->current_crypto->in_cipher->blocksize) < 0) {
|
||||
return 0;
|
||||
}
|
||||
@ -57,7 +57,7 @@ uint32_t packet_decrypt_len(ssh_session session, char *crypted){
|
||||
return ntohl(decrypted);
|
||||
}
|
||||
|
||||
int packet_decrypt(ssh_session session, void *data,uint32_t len) {
|
||||
int ssh_packet_decrypt(ssh_session session, void *data,uint32_t len) {
|
||||
struct ssh_cipher_struct *crypto = session->current_crypto->in_cipher;
|
||||
char *out = NULL;
|
||||
|
||||
@ -80,7 +80,7 @@ int packet_decrypt(ssh_session session, void *data,uint32_t len) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned char *packet_encrypt(ssh_session session, void *data, uint32_t len) {
|
||||
unsigned char *ssh_packet_encrypt(ssh_session session, void *data, uint32_t len) {
|
||||
struct ssh_cipher_struct *crypto = NULL;
|
||||
HMACCTX ctx = NULL;
|
||||
char *out = NULL;
|
||||
@ -149,7 +149,7 @@ unsigned char *packet_encrypt(ssh_session session, void *data, uint32_t len) {
|
||||
* @return 0 if hmac and mac are equal, < 0 if not or an error
|
||||
* occurred.
|
||||
*/
|
||||
int packet_hmac_verify(ssh_session session, ssh_buffer buffer,
|
||||
int ssh_packet_hmac_verify(ssh_session session, ssh_buffer buffer,
|
||||
unsigned char *mac, enum ssh_hmac_e type) {
|
||||
unsigned char hmacbuf[DIGEST_MAX_LEN] = {0};
|
||||
HMACCTX ctx;
|
||||
|
24
src/server.c
24
src/server.c
@ -321,7 +321,7 @@ static int dh_handshake_server(ssh_session session) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (packet_send(session) == SSH_ERROR) {
|
||||
if (ssh_packet_send(session) == SSH_ERROR) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -330,7 +330,7 @@ static int dh_handshake_server(ssh_session session) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (packet_send(session) == SSH_ERROR) {
|
||||
if (ssh_packet_send(session) == SSH_ERROR) {
|
||||
return -1;
|
||||
}
|
||||
SSH_LOG(SSH_LOG_PACKET, "SSH_MSG_NEWKEYS sent");
|
||||
@ -659,7 +659,7 @@ int ssh_auth_reply_default(ssh_session session,int partial) {
|
||||
ssh_set_error_oom(session);
|
||||
return SSH_ERROR;
|
||||
}
|
||||
rc = packet_send(session);
|
||||
rc = ssh_packet_send(session);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -680,7 +680,7 @@ static int ssh_message_channel_request_open_reply_default(ssh_message msg) {
|
||||
return SSH_ERROR;
|
||||
}
|
||||
|
||||
rc = packet_send(msg->session);
|
||||
rc = ssh_packet_send(msg->session);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -702,7 +702,7 @@ static int ssh_message_channel_request_reply_default(ssh_message msg) {
|
||||
ssh_set_error_oom(msg->session);
|
||||
return SSH_ERROR;
|
||||
}
|
||||
return packet_send(msg->session);
|
||||
return ssh_packet_send(msg->session);
|
||||
}
|
||||
|
||||
SSH_LOG(SSH_LOG_PACKET,
|
||||
@ -736,7 +736,7 @@ int ssh_message_service_reply_success(ssh_message msg) {
|
||||
ssh_set_error_oom(session);
|
||||
return SSH_ERROR;
|
||||
}
|
||||
rc = packet_send(msg->session);
|
||||
rc = ssh_packet_send(msg->session);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -760,7 +760,7 @@ int ssh_message_global_request_reply_success(ssh_message msg, uint16_t bound_por
|
||||
}
|
||||
}
|
||||
|
||||
return packet_send(msg->session);
|
||||
return ssh_packet_send(msg->session);
|
||||
}
|
||||
|
||||
if(msg->global_request.type == SSH_GLOBAL_REQUEST_TCPIP_FORWARD
|
||||
@ -782,7 +782,7 @@ static int ssh_message_global_request_reply_default(ssh_message msg) {
|
||||
, SSH2_MSG_REQUEST_FAILURE) < 0) {
|
||||
goto error;
|
||||
}
|
||||
return packet_send(msg->session);
|
||||
return ssh_packet_send(msg->session);
|
||||
}
|
||||
SSH_LOG(SSH_LOG_PACKET,
|
||||
"The client doesn't want to know the request failed!");
|
||||
@ -919,7 +919,7 @@ int ssh_message_auth_interactive_request(ssh_message msg, const char *name,
|
||||
}
|
||||
}
|
||||
|
||||
rc = packet_send(msg->session);
|
||||
rc = ssh_packet_send(msg->session);
|
||||
|
||||
/* fill in the kbdint structure */
|
||||
if (msg->session->kbdint == NULL) {
|
||||
@ -1006,7 +1006,7 @@ int ssh_auth_reply_success(ssh_session session, int partial) {
|
||||
return SSH_ERROR;
|
||||
}
|
||||
|
||||
r = packet_send(session);
|
||||
r = ssh_packet_send(session);
|
||||
if(session->current_crypto && session->current_crypto->delayed_compress_out){
|
||||
SSH_LOG(SSH_LOG_PROTOCOL,"Enabling delayed compression OUT");
|
||||
session->current_crypto->do_compress_out=1;
|
||||
@ -1041,7 +1041,7 @@ int ssh_message_auth_reply_pk_ok(ssh_message msg, ssh_string algo, ssh_string pu
|
||||
return SSH_ERROR;
|
||||
}
|
||||
|
||||
rc = packet_send(msg->session);
|
||||
rc = ssh_packet_send(msg->session);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -1208,7 +1208,7 @@ int ssh_send_keepalive(ssh_session session)
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (packet_send(session) == SSH_ERROR) {
|
||||
if (ssh_packet_send(session) == SSH_ERROR) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -828,7 +828,7 @@ int ssh_send_ignore (ssh_session session, const char *data) {
|
||||
ssh_set_error_oom(session);
|
||||
goto error;
|
||||
}
|
||||
packet_send(session);
|
||||
ssh_packet_send(session);
|
||||
ssh_handle_packets(session, 0);
|
||||
}
|
||||
|
||||
@ -864,7 +864,7 @@ int ssh_send_debug (ssh_session session, const char *message, int always_display
|
||||
ssh_set_error_oom(session);
|
||||
goto error;
|
||||
}
|
||||
packet_send(session);
|
||||
ssh_packet_send(session);
|
||||
ssh_handle_packets(session, 0);
|
||||
}
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user