]> asedeno.scripts.mit.edu Git - PuTTY.git/blobdiff - sshpubk.c
Fix an EOF-testing goof in winhandl.c.
[PuTTY.git] / sshpubk.c
index 2070fe41dd1605e93fc0bdd6471b4e691dd0ed35..5dacc97d70a329e1ee9235e847ee04cf8d3769a9 100644 (file)
--- a/sshpubk.c
+++ b/sshpubk.c
@@ -309,6 +309,8 @@ int rsakey_pubblob(const Filename *filename, void **blob, int *bloblen,
             *commentptr = commentp ? dupstr(commentp) : NULL;
         *blob = rsa_public_blob(&key, bloblen);
         freersakey(&key);
+        sfree(line);
+        fclose(fp);
         return 1;
 
       not_public_either:
@@ -853,7 +855,7 @@ struct ssh2_userkey *ssh2_load_userkey(const Filename *filename,
     ret = snew(struct ssh2_userkey);
     ret->alg = alg;
     ret->comment = comment;
-    ret->data = alg->createkey(public_blob, public_blob_len,
+    ret->data = alg->createkey(alg, public_blob, public_blob_len,
                               private_blob, private_blob_len);
     if (!ret->data) {
        sfree(ret);
@@ -1089,6 +1091,7 @@ unsigned char *openssh_loadpub(FILE *fp, char **algorithm,
         *commentptr = comment;
     else
         sfree(comment);
+    sfree(line);
     return pubblob;
 
   error:
@@ -1308,7 +1311,7 @@ int ssh2_save_userkey(const Filename *filename, struct ssh2_userkey *key,
     int passlen;
     int cipherblk;
     int i;
-    char *cipherstr;
+    const char *cipherstr;
     unsigned char priv_mac[20];
 
     /*
@@ -1600,7 +1603,7 @@ char *ssh2_fingerprint_blob(const void *blob, int bloblen)
          */
         alg = find_pubkey_alg_len(alglen, algstr);
         if (alg) {
-            int bits = alg->pubkey_bits(blob, bloblen);
+            int bits = alg->pubkey_bits(alg, blob, bloblen);
             return dupprintf("%.*s %d %s", alglen, algstr,
                              bits, fingerprint_str);
         } else {
@@ -1688,7 +1691,7 @@ int key_type(const Filename *filename)
  * Convert the type word to a string, for `wrong type' error
  * messages.
  */
-char *key_type_to_str(int type)
+const char *key_type_to_str(int type)
 {
     switch (type) {
       case SSH_KEYTYPE_UNOPENABLE: return "unable to open file"; break;