40 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
54 size_t raw_bit_len = ( 8 *
raw_len );
61 for (
bit = 0 ;
bit < raw_bit_len ;
bit += 6, used++ ) {
64 tmp = ( raw_bytes[
byte] << shift );
66 tmp |= ( raw_bytes[
byte + 1 ] >> ( 8 - shift ) );
67 tmp = ( (
tmp >> 2 ) & 0x3f );
71 for ( ; (
bit % 8 ) != 0 ;
bit += 6, used++ ) {
92 const char *
in = encoded;
98 unsigned int pad_count = 0;
105 while ( ( in_char = *(
in++) ) ) {
112 if ( in_char ==
'=' ) {
113 if ( pad_count >= 2 ) {
114 DBG (
"Base64-encoded string \"%s\" has too " 115 "many pad characters\n", encoded );
123 DBG (
"Base64-encoded string \"%s\" has invalid pad " 124 "sequence\n", encoded );
131 DBG (
"Base64-encoded string \"%s\" contains invalid " 132 "character '%c'\n", encoded, in_char );
135 in_bits = ( match -
base64 );
149 if ( (
bit % 8 ) != 0 ) {
150 DBG (
"Base64-encoded string \"%s\" has invalid bit length " 151 "%d\n", encoded,
bit );
#define EINVAL
Invalid argument.
static unsigned int unsigned int bit
int base64_decode(const char *encoded, void *data, size_t len)
Base64-decode string.
static const char base64[64+1]
char * strchr(const char *src, int character)
Find character within a string.
int isspace(int character)
Check to see if character is a space.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
uint8_t data[48]
Additional event data.
uint16_t offset
Offset to command line.
#define DBG(...)
Print a debugging message.
size_t base64_encode(const void *raw, size_t raw_len, char *data, size_t len)
Base64-encode data.
void * memset(void *dest, int character, size_t len) __nonnull