diff options
author | Andreas Schneider <mail@cynapses.org> | 2009-04-18 14:56:56 +0000 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2009-04-18 14:56:56 +0000 |
commit | a58b7b93de0d904286632804f01647fdeba47f98 (patch) | |
tree | c4bcfdd36b7b1c99c23fb47ab8976f273cecbf68 /libssh/keyfiles.c | |
parent | c373e9bb03df8c3c88c9d3e8e70ea37b646d2306 (diff) | |
download | libssh-a58b7b93de0d904286632804f01647fdeba47f98.tar.gz libssh-a58b7b93de0d904286632804f01647fdeba47f98.tar.xz libssh-a58b7b93de0d904286632804f01647fdeba47f98.zip |
Reformat some functions.
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@550 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/keyfiles.c')
-rw-r--r-- | libssh/keyfiles.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/libssh/keyfiles.c b/libssh/keyfiles.c index b23e445f..c6c9caed 100644 --- a/libssh/keyfiles.c +++ b/libssh/keyfiles.c @@ -62,8 +62,7 @@ static int load_iv(char *header, unsigned char *iv, int iv_len) { int k; memset(iv, 0, iv_len); - for (i=0; i < iv_len; i++) - { + for (i = 0; i < iv_len; i++) { if ((header[2*i] >= '0') && (header[2*i] <= '9')) j = header[2*i] - '0'; else if ((header[2*i] >= 'A') && (header[2*i] <= 'F')) @@ -89,7 +88,7 @@ static u32 char_to_u32(unsigned char *data, u32 size) { u32 ret; u32 i; - for (i=0,ret=0;i<size;ret=ret<<8,ret+=data[i++]) + for (i = 0, ret = 0; i < size; ret = ret << 8, ret += data[i++]) ; return ret; } @@ -98,19 +97,23 @@ static u32 asn1_get_len(BUFFER *buffer) { u32 len; unsigned char tmp[4]; - if (!buffer_get_data(buffer,tmp,1)) + if (buffer_get_data(buffer,tmp,1) == 0) { return 0; - if (tmp[0] > 127) - { - len=tmp[0] & 127; - if (len>4) + } + + if (tmp[0] > 127) { + len = tmp[0] & 127; + if (len > 4) { return 0; /* Length doesn't fit in u32. Can this really happen? */ - if (!buffer_get_data(buffer,tmp,len)) + } + if (buffer_get_data(buffer,tmp,len) == 0) { return 0; - len=char_to_u32(tmp,len); + } + len = char_to_u32(tmp, len); + } else { + len = char_to_u32(tmp, 1); } - else - len=char_to_u32(tmp,1); + return len; } |