浏览代码

no trailing = for base64url

Karel Miko 8 年之前
父节点
当前提交
006c601efb
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/misc/base64/base64_decode.c

+ 2 - 2
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