summaryrefslogtreecommitdiff
path: root/usr.sbin/relayd/relayd.c
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2007-11-21 20:13:21 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2007-11-21 20:13:21 +0000
commit4f6f111953d49f763adfc382ca85d496fa69bf61 (patch)
tree6ace273054e4bf43533144b4e5f5d1ade13244ff /usr.sbin/relayd/relayd.c
parent44a09499b4dd3de4910ce3f9a1bc6509e2986b72 (diff)
move digest string handling into an extra function.
Diffstat (limited to 'usr.sbin/relayd/relayd.c')
-rw-r--r--usr.sbin/relayd/relayd.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/usr.sbin/relayd/relayd.c b/usr.sbin/relayd/relayd.c
index ae6380116ed..a3398365107 100644
--- a/usr.sbin/relayd/relayd.c
+++ b/usr.sbin/relayd/relayd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relayd.c,v 1.55 2007/11/20 15:54:55 reyk Exp $ */
+/* $OpenBSD: relayd.c,v 1.56 2007/11/21 20:13:20 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -32,6 +32,8 @@
#include <signal.h>
#include <unistd.h>
#include <pwd.h>
+#include <sha1.h>
+#include <md5.h>
#include <openssl/ssl.h>
@@ -892,3 +894,19 @@ translate_string(char *str)
}
*writer = '\0';
}
+
+char *
+digeststr(enum digest_type type, const u_int8_t *data, size_t len, char *buf)
+{
+ switch (type) {
+ case DIGEST_SHA1:
+ return (SHA1Data(data, len, buf));
+ break;
+ case DIGEST_MD5:
+ return (MD5Data(data, len, buf));
+ break;
+ default:
+ break;
+ }
+ return (NULL);
+}