summaryrefslogtreecommitdiff
path: root/sbin/isakmpd/key.c
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/isakmpd/key.c')
-rw-r--r--sbin/isakmpd/key.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/sbin/isakmpd/key.c b/sbin/isakmpd/key.c
index fcc9d7e2bee..8c4a2573dcb 100644
--- a/sbin/isakmpd/key.c
+++ b/sbin/isakmpd/key.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: key.c,v 1.22 2005/04/08 22:32:10 cloder Exp $ */
+/* $OpenBSD: key.c,v 1.23 2005/11/15 21:49:04 cloder Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
*
@@ -95,24 +95,12 @@ key_serialize(int type, int private, void *key, u_int8_t **data,
char *
key_printable(int type, int private, u_int8_t *data, int datalen)
{
- char *s;
- int i;
-
switch (type) {
case ISAKMP_KEY_PASSPHRASE:
return strdup((char *)data);
case ISAKMP_KEY_RSA:
- s = malloc(datalen * 2 + 1);
- if (!s) {
- log_error("key_printable: malloc (%d) failed",
- datalen * 2 + 1);
- return 0;
- }
- for (i = 0; i < datalen; i++)
- snprintf(s + (2 * i), 2 * (datalen - i) + 1, "%02x",
- data[i]);
- return s;
+ return raw2hex(data, datalen);
default:
log_error("key_printable: unknown/unsupported key type %d",