summaryrefslogtreecommitdiffhomepage
path: root/signkey.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2005-07-08 13:28:03 +0000
committerMatt Johnston <matt@ucc.asn.au>2005-07-08 13:28:03 +0000
commitaaa0b1ec3c8e0fe9d827565f17a06e87abe8bfa3 (patch)
tree4e71aec4c8f68f799c9dbdf1107923af9efc7a94 /signkey.c
parent03731c723bda295a6f6ee8346d622ea45d796563 (diff)
parent215a369c2b0e49107f3a7e9d55175bd590145836 (diff)
merge of 9522146cb07d4576f161fc4567c2c2fbd6f61fbb
and b11630c15bc4d0649dba51c3572cac6f44e0ab0e --HG-- extra : convert_revision : e0686662cdbee8c0b06e72e6105a390ea4f4c007
Diffstat (limited to 'signkey.c')
-rw-r--r--signkey.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/signkey.c b/signkey.c
index b6b8bdc..8dee10b 100644
--- a/signkey.c
+++ b/signkey.c
@@ -279,7 +279,7 @@ static char * sign_key_md5_fingerprint(unsigned char* keyblob,
char * ret;
hash_state hs;
unsigned char hash[MD5_HASH_SIZE];
- unsigned int h, i;
+ unsigned int i;
unsigned int buflen;
md5_init(&hs);
@@ -296,10 +296,11 @@ static char * sign_key_md5_fingerprint(unsigned char* keyblob,
memset(ret, 'Z', buflen);
strcpy(ret, "md5 ");
- for (i = 4, h = 0; i < buflen; i+=3, h++) {
- ret[i] = hexdig(hash[h] >> 4);
- ret[i+1] = hexdig(hash[h] & 0x0f);
- ret[i+2] = ':';
+ for (i = 0; i < MD5_HASH_SIZE; i++) {
+ unsigned int pos = 4 + i*3;
+ ret[pos] = hexdig(hash[i] >> 4);
+ ret[pos+1] = hexdig(hash[i] & 0x0f);
+ ret[pos+2] = ':';
}
ret[buflen-1] = 0x0;
@@ -313,7 +314,7 @@ static char * sign_key_sha1_fingerprint(unsigned char* keyblob,
char * ret;
hash_state hs;
unsigned char hash[SHA1_HASH_SIZE];
- unsigned int h, i;
+ unsigned int i;
unsigned int buflen;
sha1_init(&hs);
@@ -329,10 +330,11 @@ static char * sign_key_sha1_fingerprint(unsigned char* keyblob,
strcpy(ret, "sha1 ");
- for (i = 5, h = 0; i < buflen; i+=3, h++) {
- ret[i] = hexdig(hash[h] >> 4);
- ret[i+1] = hexdig(hash[h] & 0x0f);
- ret[i+2] = ':';
+ for (i = 0; i < SHA1_HASH_SIZE; i++) {
+ unsigned int pos = 5 + 3*i;
+ ret[pos] = hexdig(hash[i] >> 4);
+ ret[pos+1] = hexdig(hash[i] & 0x0f);
+ ret[pos+2] = ':';
}
ret[buflen-1] = 0x0;