diff signkey.c @ 436:7282370416a0

Improve known_hosts checking.
author Matt Johnston <matt@ucc.asn.au>
date Thu, 22 Feb 2007 15:29:32 +0000
parents eb7b9f2bb8e8
children c3f2ec71e3d4
line wrap: on
line diff
--- a/signkey.c	Thu Feb 22 14:53:49 2007 +0000
+++ b/signkey.c	Thu Feb 22 15:29:32 2007 +0000
@@ -432,9 +432,11 @@
 /* Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE when given a buffer containing
  * a key, a key, and a type. The buffer is positioned at the start of the
  * base64 data, and contains no trailing data */
+/* If fingerprint is non-NULL, it will be set to a malloc()ed fingerprint
+   of the key if it is successfully decoded */
 int cmp_base64_key(const unsigned char* keyblob, unsigned int keybloblen, 
 					const unsigned char* algoname, unsigned int algolen, 
-					buffer * line) {
+					buffer * line, char ** fingerprint) {
 
 	buffer * decodekey = NULL;
 	int ret = DROPBEAR_FAILURE;
@@ -456,6 +458,11 @@
 	TRACE(("checkpubkey: base64_decode success"))
 	buf_incrlen(decodekey, decodekeylen);
 	
+	if (fingerprint) {
+		*fingerprint = sign_key_fingerprint(buf_getptr(decodekey, decodekeylen),
+											decodekeylen);
+	}
+	
 	/* compare the keys */
 	if ( ( decodekeylen != keybloblen )
 			|| memcmp( buf_getptr(decodekey, decodekey->len),