aboutsummaryrefslogtreecommitdiff
path: root/libssh/crypt.c
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-04-15 07:56:57 +0000
committerAndreas Schneider <mail@cynapses.org>2009-04-15 07:56:57 +0000
commit576187c68623df68b0173be6013aef8bdacaaa9c (patch)
treeac0a5bca17712d15cf75352f38c75dbb3ca0d2ce /libssh/crypt.c
parentaf454c0f3473dcd3afb3e08958eb3d4a26732729 (diff)
downloadlibssh-576187c68623df68b0173be6013aef8bdacaaa9c.tar.gz
libssh-576187c68623df68b0173be6013aef8bdacaaa9c.tar.xz
libssh-576187c68623df68b0173be6013aef8bdacaaa9c.zip
Reformat packet_decrypt_len().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@478 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/crypt.c')
-rw-r--r--libssh/crypt.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/libssh/crypt.c b/libssh/crypt.c
index 386d0259..472cb9fb 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);