41 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
55 size_t raw_bit_len = ( 8 *
raw_len );
62 for (
bit = 0 ;
bit < raw_bit_len ;
bit += 6, used++ ) {
65 tmp = ( raw_bytes[
byte] << shift );
67 tmp |= ( raw_bytes[
byte + 1 ] >> ( 8 - shift ) );
68 tmp = ( (
tmp >> 2 ) & 0x3f );
72 for ( ; (
bit % 8 ) != 0 ;
bit += 6, used++ ) {
93 const char *
in = encoded;
99 unsigned int pad_count = 0;
106 while ( ( in_char = *(
in++) ) ) {
113 if ( in_char ==
'=' ) {
114 if ( pad_count >= 2 ) {
115 DBG (
"Base64-encoded string \"%s\" has too "
116 "many pad characters\n", encoded );
124 DBG (
"Base64-encoded string \"%s\" has invalid pad "
125 "sequence\n", encoded );
132 DBG (
"Base64-encoded string \"%s\" contains invalid "
133 "character '%c'\n", encoded, in_char );
136 in_bits = ( match -
base64 );
150 if ( (
bit % 8 ) != 0 ) {
151 DBG (
"Base64-encoded string \"%s\" has invalid bit length "
152 "%d\n", encoded,
bit );
size_t base64_encode(const void *raw, size_t raw_len, char *data, size_t len)
Base64-encode data.
int base64_decode(const char *encoded, void *data, size_t len)
Base64-decode string.
static const char base64[64+1]
uint16_t offset
Offset to command line.
int isspace(int character)
Check to see if character is a space.
uint8_t data[48]
Additional event data.
#define DBG(...)
Print a debugging message.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
#define EINVAL
Invalid argument.
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
static unsigned int unsigned int bit
void * memset(void *dest, int character, size_t len) __nonnull
char * strchr(const char *src, int character)
Find character within a string.