]> andersk Git - gssapi-openssh.git/blobdiff - openssh/key.c
Import of OpenSSH 4.9p1
[gssapi-openssh.git] / openssh / key.c
index f3b3d6b9460f6df78f76221acf6c381c3ce0370b..62bf8361d6791caea9bae2be052eb3ae125cc269 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: key.c,v 1.67 2006/08/03 03:34:42 deraadt Exp $ */
+/* $OpenBSD: key.c,v 1.69 2007/07/12 05:48:05 ray Exp $ */
 /*
  * read_bignum():
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -38,6 +38,7 @@
 #include <sys/types.h>
 
 #include <openssl/evp.h>
+#include <openbsd-compat/openssl-compat.h>
 
 #include <stdarg.h>
 #include <stdio.h>
@@ -170,9 +171,7 @@ key_equal(const Key *a, const Key *b)
                    BN_cmp(a->dsa->pub_key, b->dsa->pub_key) == 0;
        default:
                fatal("key_equal: bad key type %d", a->type);
-               break;
        }
-       return 0;
 }
 
 u_char*
@@ -617,16 +616,18 @@ key_from_private(const Key *k)
        switch (k->type) {
        case KEY_DSA:
                n = key_new(k->type);
-               BN_copy(n->dsa->p, k->dsa->p);
-               BN_copy(n->dsa->q, k->dsa->q);
-               BN_copy(n->dsa->g, k->dsa->g);
-               BN_copy(n->dsa->pub_key, k->dsa->pub_key);
+               if ((BN_copy(n->dsa->p, k->dsa->p) == NULL) ||
+                   (BN_copy(n->dsa->q, k->dsa->q) == NULL) ||
+                   (BN_copy(n->dsa->g, k->dsa->g) == NULL) ||
+                   (BN_copy(n->dsa->pub_key, k->dsa->pub_key) == NULL))
+                       fatal("key_from_private: BN_copy failed");
                break;
        case KEY_RSA:
        case KEY_RSA1:
                n = key_new(k->type);
-               BN_copy(n->rsa->n, k->rsa->n);
-               BN_copy(n->rsa->e, k->rsa->e);
+               if ((BN_copy(n->rsa->n, k->rsa->n) == NULL) ||
+                   (BN_copy(n->rsa->e, k->rsa->e) == NULL))
+                       fatal("key_from_private: BN_copy failed");
                break;
        default:
                fatal("key_from_private: unknown type %d", k->type);
This page took 0.033667 seconds and 4 git commands to generate.