X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/blobdiff_plain/e02c731dfbb288c736f2cd09a9b6df0507c59ddd..ae384229c538b20b429ea640ec30071ae944c0e7:/armor.c?ds=inline diff --git a/armor.c b/armor.c index 9f5c19a..f2e97fc 100644 --- a/armor.c +++ b/armor.c @@ -4,6 +4,8 @@ * Jonathan McDowell * * Copyright 2002 Project Purple + * + * $Id: armor.c,v 1.7 2003/09/30 20:40:10 noodles Exp $ */ #include @@ -209,16 +211,19 @@ static void dearmor_init(struct dearmor_context *ctx) static void dearmor_finish(struct dearmor_context *state) { - // Check the checksum, + /* + * Check the checksum + */ state->crc24 &= 0xffffffL; -// state->putchar_func(state->ctx, '\n'); -// state->putchar_func(state->ctx, '='); -// state->putchar_func(state->ctx, encode64(state->crc24 >> 18)); -// state->putchar_func(state->ctx, encode64((state->crc24 >> 12) & 0x3F)); -// state->putchar_func(state->ctx, encode64((state->crc24 >> 6) & 0x3F)); -// state->putchar_func(state->ctx, encode64(state->crc24 & 0x3F)); - + /* + state->putchar_func(state->ctx, '\n'); + state->putchar_func(state->ctx, '='); + state->putchar_func(state->ctx, encode64(state->crc24 >> 18)); + state->putchar_func(state->ctx, encode64((state->crc24 >> 12) & 0x3F)); + state->putchar_func(state->ctx, encode64((state->crc24 >> 6) & 0x3F)); + state->putchar_func(state->ctx, encode64(state->crc24 & 0x3F)); + */ } @@ -303,9 +308,9 @@ int armor_openpgp_stream(int (*putchar_func)(void *ctx, size_t count, /* * Print armor header */ - putchar_func(ctx, sizeof("-----BEGIN PGP PUBLIC KEY BLOCK-----\n"), + 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 " VERSION "\n\n"), + putchar_func(ctx, sizeof("Version: onak " VERSION "\n\n") - 1, (unsigned char *) "Version: onak " VERSION "\n\n"); armor_init(&armor_ctx); @@ -317,7 +322,7 @@ int armor_openpgp_stream(int (*putchar_func)(void *ctx, size_t count, /* * Print armor footer */ - putchar_func(ctx, sizeof("-----END PGP PUBLIC KEY BLOCK-----\n"), + putchar_func(ctx, sizeof("-----END PGP PUBLIC KEY BLOCK-----\n") - 1, (unsigned char *) "-----END PGP PUBLIC KEY BLOCK-----\n"); return 0; @@ -391,9 +396,12 @@ int dearmor_openpgp_stream(int (*getchar_func)(void *ctx, size_t count, dearmor_init(&dearmor_ctx); dearmor_ctx.getchar_func = getchar_func; dearmor_ctx.ctx = ctx; - read_openpgp_stream(dearmor_getchar_c, &dearmor_ctx, packets); + read_openpgp_stream(dearmor_getchar_c, &dearmor_ctx, + packets, 0); dearmor_finish(&dearmor_ctx); - // TODO: Look for armor footer + /* + * TODO: Look for armor footer + */ } return 0;