From d09175ffe335d9be6846b4ac5e9e622d96213a00 Mon Sep 17 00:00:00 2001 From: Adam Langley Date: Fri, 20 May 2016 10:51:48 -0700 Subject: Replace base64 decoding. This code has caused a long history of problems. This change rewrites it completely with something that is, hopefully, much simplier and robust and adds more testing. Change-Id: Ibeef51f9386afd95d5b73316e451eb3a2d7ec4e0 Reviewed-on: https://boringssl-review.googlesource.com/8033 Reviewed-by: Adam Langley --- decrepit/bio/base64_bio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'decrepit') diff --git a/decrepit/bio/base64_bio.c b/decrepit/bio/base64_bio.c index 2056138f..8415bfed 100644 --- a/decrepit/bio/base64_bio.c +++ b/decrepit/bio/base64_bio.c @@ -452,7 +452,7 @@ static long b64_ctrl(BIO *b, int cmd, long num, void *ptr) { case BIO_CTRL_WPENDING: /* More to write in buffer */ assert(ctx->buf_len >= ctx->buf_off); ret = ctx->buf_len - ctx->buf_off; - if ((ret == 0) && (ctx->encode != B64_NONE) && (ctx->base64.num != 0)) { + if ((ret == 0) && (ctx->encode != B64_NONE) && (ctx->base64.data_used != 0)) { ret = 1; } else if (ret <= 0) { ret = BIO_ctrl(b->next_bio, cmd, num, ptr); @@ -484,7 +484,7 @@ static long b64_ctrl(BIO *b, int cmd, long num, void *ptr) { ctx->tmp_len = 0; goto again; } - } else if (ctx->encode != B64_NONE && ctx->base64.num != 0) { + } else if (ctx->encode != B64_NONE && ctx->base64.data_used != 0) { ctx->buf_off = 0; EVP_EncodeFinal(&(ctx->base64), (uint8_t *)ctx->buf, &(ctx->buf_len)); /* push out the bytes */ -- cgit v1.2.3