* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "includes.h"
-RCSID("$OpenBSD: key.c,v 1.44 2002/05/31 13:16:48 markus Exp $");
+RCSID("$OpenBSD: key.c,v 1.53 2003/06/24 08:23:46 markus Exp $");
#include <openssl/evp.h>
#include "xmalloc.h"
#include "key.h"
#include "rsa.h"
-#include "ssh-dss.h"
-#include "ssh-rsa.h"
#include "uuencode.h"
#include "buffer.h"
#include "bufaux.h"
}
return k;
}
+
Key *
key_new_private(int type)
{
}
return k;
}
+
void
key_free(Key *k)
{
return 0;
}
-static u_char*
+u_char*
key_fingerprint_raw(Key *k, enum fp_type dgst_type, u_int *dgst_raw_length)
{
const EVP_MD *md = NULL;
return retval;
}
-static char*
-key_fingerprint_hex(u_char* dgst_raw, u_int dgst_raw_len)
+static char *
+key_fingerprint_hex(u_char *dgst_raw, u_int dgst_raw_len)
{
char *retval;
int i;
return retval;
}
-static char*
-key_fingerprint_bubblebabble(u_char* dgst_raw, u_int dgst_raw_len)
+static char *
+key_fingerprint_bubblebabble(u_char *dgst_raw, u_int dgst_raw_len)
{
char vowels[] = { 'a', 'e', 'i', 'o', 'u', 'y' };
char consonants[] = { 'b', 'c', 'd', 'f', 'g', 'h', 'k', 'l', 'm',
return retval;
}
-char*
+char *
key_fingerprint(Key *k, enum fp_type dgst_type, enum fp_rep dgst_rep)
{
char *retval = NULL;
*cpp = cp;
return 1;
}
+
static int
write_bignum(FILE *f, BIGNUM *num)
{
case KEY_DSA:
space = strchr(cp, ' ');
if (space == NULL) {
- debug3("key_read: no space");
+ debug3("key_read: missing whitespace");
return -1;
}
*space = '\0';
type = key_type_from_name(cp);
*space = ' ';
if (type == KEY_UNSPEC) {
- debug3("key_read: no key found");
+ debug3("key_read: missing keytype");
return -1;
}
cp = space+1;
xfree(blob);
return -1;
}
- k = key_from_blob(blob, n);
+ k = key_from_blob(blob, (u_int)n);
xfree(blob);
if (k == NULL) {
error("key_read: key_from_blob %s failed", cp);
}
return success;
}
+
int
key_write(Key *key, FILE *f)
{
int n, success = 0;
u_int len, bits = 0;
- u_char *blob, *uu;
+ u_char *blob;
+ char *uu;
if (key->type == KEY_RSA1 && key->rsa != NULL) {
/* size of modulus 'n' */
}
return success;
}
+
char *
key_type(Key *k)
{
}
return "unknown";
}
+
char *
key_ssh_name(Key *k)
{
}
return "ssh-unknown";
}
+
u_int
key_size(Key *k)
{
}
Key *
-key_from_blob(u_char *blob, int blen)
+key_from_blob(u_char *blob, u_int blen)
{
Buffer b;
char *ktype;
{
Buffer b;
int len;
- u_char *buf;
if (key == NULL) {
error("key_to_blob: key == NULL");
return 0;
}
len = buffer_len(&b);
- buf = xmalloc(len);
- memcpy(buf, buffer_ptr(&b), len);
- memset(buffer_ptr(&b), 0, len);
- buffer_free(&b);
if (lenp != NULL)
*lenp = len;
- if (blobp != NULL)
- *blobp = buf;
+ if (blobp != NULL) {
+ *blobp = xmalloc(len);
+ memcpy(*blobp, buffer_ptr(&b), len);
+ }
+ memset(buffer_ptr(&b), 0, len);
+ buffer_free(&b);
return len;
}
}
/* Converts a private to a public key */
-
Key *
key_demote(Key *k)
{