28 #define BASE64_TABLE_MAX 122
32 static const int b64table[] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
33 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
34 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
35 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
36 -1, -1, -1, 62, -1, -1, -1, 63, 52, 53,
37 54, 55, 56, 57, 58, 59, 60, 61, -1, -1,
38 -1, -1, -1, -1, -1, 0, 1, 2, 3, 4,
39 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
40 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
41 25, -1, -1, -1, -1, -1, -1, 26, 27, 28,
42 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
43 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
53 static inline int GetBase64Value(uint8_t c)
59 val = b64table[(int) c];
75 ascii[0] = (uint8_t) (b64[0] << 2) | (b64[1] >> 4);
76 ascii[1] = (uint8_t) (b64[1] << 4) | (b64[2] >> 2);
77 ascii[2] = (uint8_t) (b64[2] << 6) | (b64[3]);
95 uint32_t
padding = 0, numDecoded = 0, bbidx = 0, valid = 1, i;
100 for(i = 0; i <
len &&
src[i] != 0; i++) {
103 val = GetBase64Value(
src[i]);
119 b64[bbidx++] = (val > 0 ? (uint8_t)val : 0);
129 DecodeBase64Block(dptr, b64);
139 if (valid && bbidx > 0) {
143 DecodeBase64Block(dptr, b64);
146 if (numDecoded == 0) {