diff options
author | Damien Miller <djm@mindrot.org> | 2000-06-22 21:32:31 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2000-06-22 21:32:31 +1000 |
commit | 6536c7d3c9d0e794c5c85d4f1746b958d7e04343 (patch) | |
tree | 9551d0d84924d6a206130fb575df5d90f1cc7a28 /key.c | |
parent | 099f505f9526311e48f828e95d90d488fe237219 (diff) | |
download | openssh-git-6536c7d3c9d0e794c5c85d4f1746b958d7e04343.tar.gz |
- OpenBSD CVS Updates:
- markus@cvs.openbsd.org 2000/06/18 18:50:11
[auth2.c compat.c compat.h sshconnect2.c]
make userauth+pubkey interop with ssh.com-2.2.0
- markus@cvs.openbsd.org 2000/06/18 20:56:17
[dsa.c]
mem leak + be more paranoid in dsa_verify.
- markus@cvs.openbsd.org 2000/06/18 21:29:50
[key.c]
cleanup fingerprinting, less hardcoded sizes
- markus@cvs.openbsd.org 2000/06/19 19:39:45
[atomicio.c auth-options.c auth-passwd.c auth-rh-rsa.c auth-rhosts.c]
[auth-rsa.c auth-skey.c authfd.c authfd.h authfile.c bufaux.c bufaux.h]
[buffer.c buffer.h canohost.c channels.c channels.h cipher.c cipher.h]
[clientloop.c compat.c compat.h compress.c compress.h crc32.c crc32.h]
[deattack.c dispatch.c dsa.c fingerprint.c fingerprint.h getput.h hmac.c]
[kex.c log-client.c log-server.c login.c match.c mpaux.c mpaux.h nchan.c]
[nchan.h packet.c packet.h pty.c pty.h readconf.c readconf.h readpass.c]
[rsa.c rsa.h scp.c servconf.c servconf.h ssh-add.c ssh-keygen.c ssh.c]
[ssh.h tildexpand.c ttymodes.c ttymodes.h uidswap.c xmalloc.c xmalloc.h]
OpenBSD tag
- markus@cvs.openbsd.org 2000/06/21 10:46:10
sshconnect2.c missing free; nuke old comment
Diffstat (limited to 'key.c')
-rw-r--r-- | key.c | 27 |
1 files changed, 16 insertions, 11 deletions
@@ -121,8 +121,6 @@ key_equal(Key *a, Key *b) return 0; } -#define FPRINT "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x" - /* * Generate key fingerprint in ascii format. * Based on ideas and code from Bjoern Groenvall <bg@sics.se> @@ -130,7 +128,7 @@ key_equal(Key *a, Key *b) char * key_fingerprint(Key *k) { - static char retval[80]; + static char retval[(EVP_MAX_MD_SIZE+1)*3]; unsigned char *blob = NULL; int len = 0; int nlen, elen; @@ -151,15 +149,22 @@ key_fingerprint(Key *k) fatal("key_fingerprint: bad key type %d", k->type); break; } + retval[0] = '\0'; + if (blob != NULL) { - unsigned char d[16]; - EVP_MD_CTX md; - EVP_DigestInit(&md, EVP_md5()); - EVP_DigestUpdate(&md, blob, len); - EVP_DigestFinal(&md, d, NULL); - snprintf(retval, sizeof(retval), FPRINT, - d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], - d[8], d[9], d[10], d[11], d[12], d[13], d[14], d[15]); + int i; + unsigned char digest[EVP_MAX_MD_SIZE]; + EVP_MD *md = EVP_md5(); + EVP_MD_CTX ctx; + EVP_DigestInit(&ctx, md); + EVP_DigestUpdate(&ctx, blob, len); + EVP_DigestFinal(&ctx, digest, NULL); + for(i = 0; i < md->md_size; i++) { + char hex[4]; + snprintf(hex, sizeof(hex), "%02x:", digest[i]); + strlcat(retval, hex, sizeof(retval)); + } + retval[strlen(retval) - 1] = '\0'; memset(blob, 0, len); xfree(blob); } |