]> andersk Git - openssh.git/blobdiff - key.c
- markus@cvs.openbsd.org 2001/10/04 14:34:16
[openssh.git] / key.c
diff --git a/key.c b/key.c
index 0ddd3d9d476b67917c42a3aeddf0d177fc2f33f8..57df5b93aef7ae9015572cf93dcb89eaf0e1d29b 100644 (file)
--- a/key.c
+++ b/key.c
@@ -32,7 +32,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 #include "includes.h"
-RCSID("$OpenBSD: key.c,v 1.29 2001/06/26 20:14:10 markus Exp $");
+RCSID("$OpenBSD: key.c,v 1.33 2001/10/04 14:34:16 markus Exp $");
 
 #include <openssl/evp.h>
 
@@ -354,11 +354,11 @@ write_bignum(FILE *f, BIGNUM *num)
                return 0;
        }
        fprintf(f, " %s", buf);
-       xfree(buf);
+       OPENSSL_free(buf);
        return 1;
 }
 
-/* returns 1 ok, -1 error, 0 type mismatch */
+/* returns 1 ok, -1 error */
 int
 key_read(Key *ret, char **cpp)
 {
@@ -413,7 +413,7 @@ key_read(Key *ret, char **cpp)
                } else if (ret->type != type) {
                        /* is a key, but different type */
                        debug3("key_read: type mismatch");
-                       return 0;
+                       return -1;
                }
                len = 2*strlen(cp);
                blob = xmalloc(len);
@@ -653,7 +653,7 @@ key_names_valid2(const char *names)
 }
 
 Key *
-key_from_blob(char *blob, int blen)
+key_from_blob(u_char *blob, int blen)
 {
        Buffer b;
        char *ktype;
@@ -728,8 +728,9 @@ key_to_blob(Key *key, u_char **blobp, u_int *lenp)
                buffer_put_bignum2(&b, key->rsa->n);
                break;
        default:
-               error("key_to_blob: illegal key type %d", key->type);
-               break;
+               error("key_to_blob: unsupported key type %d", key->type);
+               buffer_free(&b);
+               return 0;
        }
        len = buffer_len(&b);
        buf = xmalloc(len);
This page took 0.048121 seconds and 4 git commands to generate.