X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/blobdiff_plain/f1e930585a5eb8ef184f5a0ad1e85759e01e60d0..e94ac8da0e87d66927f746e6053fdafbee85cd16:/parsekey.c?ds=inline diff --git a/parsekey.c b/parsekey.c index 4482d8b..fb9cf83 100644 --- a/parsekey.c +++ b/parsekey.c @@ -4,8 +4,6 @@ * Jonathan McDowell * * Copyright 2002 Project Purple - * - * $Id: parsekey.c,v 1.19 2004/05/27 18:42:22 noodles Exp $ */ #include @@ -334,6 +332,28 @@ int write_openpgp_stream(int (*putchar_func)(void *ctx, size_t count, curchar = (packets->packet->length - 192) & 0xFF; putchar_func(ctx, 1, &curchar); + } else if (packets->packet->length > 8382 && + packets->packet->length < 0xFFFFFFFF) { + logthing(LOGTHING_DEBUG, + "Writing 5 byte length"); + curchar = 255; + putchar_func(ctx, 1, &curchar); + + curchar = (packets->packet->length >> 24); + curchar &= 0xFF; + putchar_func(ctx, 1, &curchar); + + curchar = (packets->packet->length >> 16); + curchar &= 0xFF; + putchar_func(ctx, 1, &curchar); + + curchar = (packets->packet->length >> 8); + curchar &= 0xFF; + putchar_func(ctx, 1, &curchar); + + curchar = packets->packet->length; + curchar &= 0xFF; + putchar_func(ctx, 1, &curchar); } else { logthing(LOGTHING_ERROR, "Unsupported new format length.");