1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-08-10 06:23:01 +03:00

Reformat packet_decrypt_len().

git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@478 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
Andreas Schneider
2009-04-15 07:56:57 +00:00
parent af454c0f34
commit 576187c686

View File

@@ -38,21 +38,23 @@
#include "libssh/crypto.h"
u32 packet_decrypt_len(SSH_SESSION *session, char *crypted){
u32 decrypted;
if (session->current_crypto) {
if (packet_decrypt(session, crypted,
session->current_crypto->in_cipher->blocksize) < 0) {
return 0;
}
u32 decrypted;
if (session->current_crypto) {
if (packet_decrypt(session, crypted,
session->current_crypto->in_cipher->blocksize) < 0) {
return 0;
}
memcpy(&decrypted,crypted,sizeof(decrypted));
ssh_log(session, SSH_LOG_PACKET,
"Packet size decrypted: %lu (0x%lx)",
(long unsigned int) ntohl(decrypted),
(long unsigned int) ntohl(decrypted));
return ntohl(decrypted);
}
memcpy(&decrypted,crypted,sizeof(decrypted));
ssh_log(session, SSH_LOG_PACKET,
"Packet size decrypted: %lu (0x%lx)",
(long unsigned int) ntohl(decrypted),
(long unsigned int) ntohl(decrypted));
return ntohl(decrypted);
}
int packet_decrypt(SSH_SESSION *session, void *data,u32 len){
struct crypto_struct *crypto=session->current_crypto->in_cipher;
char *out=malloc(len);