]> err.no Git - yubikey-server-c/commitdiff
Switch to ysc_b64_encode, get rid of glib dependency
authorTollef Fog Heen <tfheen@err.no>
Mon, 12 Oct 2009 08:32:39 +0000 (10:32 +0200)
committerTollef Fog Heen <tfheen@err.no>
Mon, 12 Oct 2009 08:32:39 +0000 (10:32 +0200)
src/main.c

index 765be2a2a6d2901fbfce1454c5d0b6f914a45b56..3cd883bb5e8dad446a940d00b881e86f6273a6ac 100644 (file)
@@ -30,7 +30,6 @@
 #include <libpq-fe.h>
 #include <yubikey.h>
 #include <time.h>
-#include <glib.h>
 #include <gcrypt.h>
 #include "util.h"
 #include <arpa/inet.h>
@@ -79,10 +78,10 @@ char *get_timestamp(void) {
        return ts;
 }
 
-gchar *sign_request(char *key, size_t key_len, char *info, char *status, 
+char *sign_request(char *key, size_t key_len, char *info, char *status,
                   char *timestamp) {
        char *line;
-       gchar *ret;
+       char *ret;
        gcry_md_hd_t hd;
        if (info != NULL) {
                asprintf(&line, "info=%s&status=%s&timestamp=%s", info,
@@ -94,7 +93,8 @@ gchar *sign_request(char *key, size_t key_len, char *info, char *status,
        gcry_md_setkey(hd, key, key_len);
        gcry_md_write(hd, line, strlen(line));
        gcry_md_final(hd);
-       ret = g_base64_encode(gcry_md_read(hd, 0), gcry_md_get_algo_dlen(GCRY_MD_SHA1));
+       ret = ysc_b64_encode((char *) gcry_md_read(hd, 0),
+                            gcry_md_get_algo_dlen(GCRY_MD_SHA1));
        gcry_md_close(hd);
        free(line);
        return ret;