blob: 11ce26eeb01cf40809baa5072c16388d82909e98 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
int _gnutls_base64_encode(const uint8 * data, size_t data_size,
uint8 ** result);
int _gnutls_fbase64_encode(const char *msg, const uint8 * data,
int data_size, uint8 ** result);
int _gnutls_base64_decode(const uint8 * data, size_t data_size,
uint8 ** result);
int _gnutls_fbase64_decode(const char *header, const uint8 * data,
size_t data_size, uint8 ** result);
#define B64SIZE( data_size) ((data_size%3==0)?((data_size*4)/3):(4+((data_size/3)*4)))
/* The size for B64 encoding + newlines plus header
*/
#define HEADSIZE( hsize) \
sizeof("-----BEGIN ")-1+sizeof("-----")-1+ \
sizeof("\n-----END ")-1+sizeof("-----\n")-1+hsize+hsize
#define B64FSIZE( hsize, dsize) \
(B64SIZE(dsize) + HEADSIZE(hsize) + /*newlines*/ \
B64SIZE(dsize)/64 + (((B64SIZE(dsize) % 64) > 0) ? 1 : 0))
|