Add a test for key fetching by SKS hash
[onak.git] / armor.c
diff --git a/armor.c b/armor.c
index bb0085e348d3b73846367b7bab80938e0cc75f21..397118cb22b7bffae17b963b89d1b7acdc9227f6 100644 (file)
--- a/armor.c
+++ b/armor.c
@@ -9,11 +9,11 @@
 #include <stdlib.h>
 
 #include "armor.h"
-#include "config.h"
 #include "keystructs.h"
 #include "log.h"
 #include "onak-conf.h"
 #include "parsekey.h"
+#include "version.h"
 
 #define ARMOR_WIDTH 64
 
@@ -77,7 +77,7 @@ struct armor_context {
        int curoctet;
        int count;
        long crc24;
-       int (*putchar_func)(void *ctx, size_t count, unsigned char *c);
+       int (*putchar_func)(void *ctx, size_t count, void *c);
        void *ctx;
 };
 
@@ -184,14 +184,14 @@ static int armor_putchar_int(void *ctx, unsigned char c)
 }
 
 
-static int armor_putchar(void *ctx, size_t count, unsigned char *c)
+static int armor_putchar(void *ctx, size_t count, void *c)
 {
        int i;
 
        log_assert(c != NULL);
 
        for (i = 0; i < count; i++) {
-               armor_putchar_int(ctx, c[i]);
+               armor_putchar_int(ctx, ((char *) c)[i]);
        }
        
        return 0;
@@ -210,7 +210,7 @@ struct dearmor_context {
        int curoctet;
        int count;
        long crc24;
-       int (*getchar_func)(void *ctx, size_t count, unsigned char *c);
+       int (*getchar_func)(void *ctx, size_t count, void *c);
        void *ctx;
 };
 
@@ -291,12 +291,12 @@ static int dearmor_getchar(void *ctx, unsigned char *c)
        return (tmpc == 64);
 }
 
-static int dearmor_getchar_c(void *ctx, size_t count, unsigned char *c)
+static int dearmor_getchar_c(void *ctx, size_t count, void *c)
 {
        int i, rc = 0;
 
        for (i = 0; i < count && rc == 0; i++) {
-               rc = dearmor_getchar(ctx, &c[i]);
+               rc = dearmor_getchar(ctx, &((unsigned char *) c)[i]);
        }
 
        return rc;
@@ -312,7 +312,7 @@ static int dearmor_getchar_c(void *ctx, size_t count, unsigned char *c)
  *     using putchar_func.
  */
 int armor_openpgp_stream(int (*putchar_func)(void *ctx, size_t count,
-                                               unsigned char *c),
+                                               void *c),
                                void *ctx,
                                struct openpgp_packet_list *packets)
 {
@@ -323,8 +323,8 @@ int armor_openpgp_stream(int (*putchar_func)(void *ctx, size_t count,
         */
        putchar_func(ctx, sizeof("-----BEGIN PGP PUBLIC KEY BLOCK-----\n") - 1,
                (unsigned char *) "-----BEGIN PGP PUBLIC KEY BLOCK-----\n");
-       putchar_func(ctx, sizeof("Version: onak " PACKAGE_VERSION "\n\n") - 1,
-               (unsigned char *) "Version: onak " PACKAGE_VERSION "\n\n");
+       putchar_func(ctx, sizeof("Version: onak " ONAK_VERSION "\n\n") - 1,
+               (unsigned char *) "Version: onak " ONAK_VERSION "\n\n");
        
        armor_init(&armor_ctx);
        armor_ctx.putchar_func = putchar_func;
@@ -352,7 +352,7 @@ int armor_openpgp_stream(int (*putchar_func)(void *ctx, size_t count,
  *     packets.
  */
 int dearmor_openpgp_stream(int (*getchar_func)(void *ctx, size_t count,
-                                               unsigned char *c),
+                                               void *c),
                                void *ctx,
                                struct openpgp_packet_list **packets)
 {