From 576187c68623df68b0173be6013aef8bdacaaa9c Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 15 Apr 2009 07:56:57 +0000 Subject: Reformat packet_decrypt_len(). git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@478 7dcaeef0-15fb-0310-b436-a5af3365683c --- libssh/crypt.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'libssh/crypt.c') diff --git a/libssh/crypt.c b/libssh/crypt.c index 386d025..472cb9f 100644 --- a/libssh/crypt.c +++ b/libssh/crypt.c @@ -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); -- cgit