summaryrefslogtreecommitdiff
path: root/base64.h
blob: 0ee937893a007d7e141cb480593b121dd32486d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <gnutls/gnutls.h>

static inline void base64_getdecoded(const char *host, char **dec_host)
{
	gnutls_datum_t result;
	gnutls_base64_decode2(&(gnutls_datum_t){
			(unsigned char *)host,
			strlen(host)
		}, &result);
	*dec_host = malloc(result.size + 1);
	strlcpy(*dec_host, (const char *)result.data, result.size + 1);
	gnutls_free(result.data);
}