X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/blobdiff_plain/fe84894a4052c71965c6a75b013db3dcec23d67d..4c8bebffd4bc105ebaa09256b7a57f4a6201bd52:/armor.c diff --git a/armor.c b/armor.c index a192f77..a730acd 100644 --- a/armor.c +++ b/armor.c @@ -1,9 +1,20 @@ /* * armor.c - Routines to (de)armor OpenPGP packet streams. * - * Jonathan McDowell + * Copyright 2002-2004, 2011 Jonathan McDowell * - * Copyright 2002 Project Purple + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 51 + * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include @@ -77,7 +88,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 +195,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 +221,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 +302,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 +323,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) { @@ -352,7 +363,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) {