libalpm
Arch Linux Package Manager Library
base64.c File Reference
#include <stdint.h>
#include "base64.h"
Include dependency graph for base64.c:

Functions

int base64_decode (unsigned char *dst, size_t *dlen, const unsigned char *src, size_t slen)
 Decode a base64-formatted buffer.
 

Variables

static const unsigned char base64_dec_map [128]
 

Function Documentation

◆ base64_decode()

int base64_decode ( unsigned char * dst,
size_t * dlen,
const unsigned char * src,
size_t slen )

Decode a base64-formatted buffer.

Parameters
dstdestination buffer
dlensize of the buffer
srcsource buffer
slenamount of data to be decoded
Returns
0 if successful, POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL, or POLARSSL_ERR_BASE64_INVALID_DATA if the input data is not correct. *dlen is always updated to reflect the amount of data that has (or would have) been written.
Note
Call this function with *dlen = 0 to obtain the required buffer size in *dlen

References base64_dec_map, POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL, and POLARSSL_ERR_BASE64_INVALID_CHARACTER.

Referenced by alpm_decode_signature().

Variable Documentation

◆ base64_dec_map

const unsigned char base64_dec_map[128]
static
Initial value:
=
{
127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
127, 127, 127, 62, 127, 127, 127, 63, 52, 53,
54, 55, 56, 57, 58, 59, 60, 61, 127, 127,
127, 64, 127, 127, 127, 0, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 127, 127, 127, 127, 127, 127, 26, 27, 28,
29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, 127, 127, 127, 127, 127
}

Referenced by base64_decode().