diff options
author | Eric Faurot <eric@cvs.openbsd.org> | 2014-02-04 09:50:32 +0000 |
---|---|---|
committer | Eric Faurot <eric@cvs.openbsd.org> | 2014-02-04 09:50:32 +0000 |
commit | e393faadf4a93717ef8c752e5b81a417a7c54f1c (patch) | |
tree | 897c29bbe8e708bbde0e7335bb530fbfa11182cc /usr.sbin/smtpd/util.c | |
parent | 7371140cd578c1630d5af9d9fd2ee1e474ac9cfd (diff) |
add base64_encode/base64_decode helpers
Diffstat (limited to 'usr.sbin/smtpd/util.c')
-rw-r--r-- | usr.sbin/smtpd/util.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/util.c b/usr.sbin/smtpd/util.c index 94e618e376b..47f23994731 100644 --- a/usr.sbin/smtpd/util.c +++ b/usr.sbin/smtpd/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.106 2014/02/04 09:05:06 eric Exp $ */ +/* $OpenBSD: util.c,v 1.107 2014/02/04 09:50:31 eric Exp $ */ /* * Copyright (c) 2000,2001 Markus Friedl. All rights reserved. @@ -39,6 +39,7 @@ #include <libgen.h> #include <netdb.h> #include <pwd.h> +#include <resolv.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> @@ -799,3 +800,16 @@ end: fclose(fp); return ret; } + +int +base64_encode(unsigned char const *src, size_t srclen, + char *dest, size_t destsize) +{ + return __b64_ntop(src, srclen, dest, destsize); +} + +int +base64_decode(char const *src, unsigned char *dest, size_t destsize) +{ + return __b64_pton(src, dest, destsize); +} |