From 006c601efb298786f85b82fd4ebb2d12c198e4b4 Mon Sep 17 00:00:00 2001 From: Karel Miko Date: Tue, 21 Feb 2017 01:51:12 +0100 Subject: [PATCH] no trailing = for base64url --- src/misc/base64/base64_decode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/misc/base64/base64_decode.c b/src/misc/base64/base64_decode.c index 86060f6..1babfbc 100644 --- a/src/misc/base64/base64_decode.c +++ b/src/misc/base64/base64_decode.c @@ -119,7 +119,7 @@ static int _base64_decode_internal(const unsigned char *in, unsigned long inlen if (y != 0) { if (y == 1) return CRYPT_INVALID_PACKET; - if ((y + g) != 4 && is_strict) return CRYPT_INVALID_PACKET; + if ((y + g) != 4 && is_strict && map != map_base64url) return CRYPT_INVALID_PACKET; t = t << (6 * (4 - y)); if (z + y - 1 > *outlen) return CRYPT_BUFFER_OVERFLOW; if (y >= 2) out[z++] = (unsigned char) ((t >> 16) & 255); @@ -161,7 +161,7 @@ int base64_strict_decode(const unsigned char *in, unsigned long inlen, #if defined(LTC_BASE64_URL) /** - base64 (URL Safe, RFC 4648 section 5) decode a block of memory + Relaxed base64 (URL Safe, RFC 4648 section 5) decode a block of memory @param in The base64 data to decode @param inlen The length of the base64 data @param out [out] The destination of the binary decoded data