#include "gnutls_int.h"#include "gnutls_errors.h"#include <gnutls_datum.h>#include <x509_b64.h>

Go to the source code of this file.
Defines | |
| #define | INCR(what, size) |
| #define | TOASCII(c) (c < 127 ? asciitable[c] : 0xff) |
| #define | ENDSTR "-----\n" |
| #define | ENDSTR2 "-----\r" |
Functions | |
| static int | encode (char *result, const uint8_t *data, int left) |
| static int | decode (uint8_t *result, const opaque *data) |
| int | MHD__gnutls_fbase64_encode (const char *msg, const uint8_t *data, int data_size, uint8_t **result) |
| int | MHD__gnutls_base64_decode (const uint8_t *data, size_t data_size, uint8_t **result) |
| static int | cpydata (const uint8_t *data, int data_size, uint8_t **result) |
| int | MHD__gnutls_fbase64_decode (const char *header, const opaque *data, size_t data_size, uint8_t **result) |
Variables | |
| static const uint8_t | b64table [] |
| static const uint8_t | asciitable [128] |
| #define ENDSTR "-----\n" |
| #define ENDSTR2 "-----\r" |
| #define INCR | ( | what, | |||
| size | ) |
Value:
do { \ what+=size; \ if (what > ret) { \ MHD_gnutls_assert(); \ MHD_gnutls_free( (*result)); *result = NULL; \ return GNUTLS_E_INTERNAL_ERROR; \ } \ } while(0)
Definition at line 61 of file x509_b64.c.
Referenced by MHD__gnutls_fbase64_encode().
| #define TOASCII | ( | c | ) | (c < 127 ? asciitable[c] : 0xff) |
| static int cpydata | ( | const uint8_t * | data, | |
| int | data_size, | |||
| uint8_t ** | result | |||
| ) | [inline, static] |
Definition at line 294 of file x509_b64.c.
References GNUTLS_E_MEMORY_ERROR, and MHD_gnutls_malloc.
Referenced by MHD__gnutls_fbase64_decode().

| static int decode | ( | uint8_t * | result, | |
| const opaque * | data | |||
| ) | [inline, static] |
Definition at line 121 of file x509_b64.c.
References TOASCII.
Referenced by MHD__gnutls_base64_decode().

| static int encode | ( | char * | result, | |
| const uint8_t * | data, | |||
| int | left | |||
| ) | [inline, static] |
Definition at line 73 of file x509_b64.c.
References b64table.
Referenced by MHD__gnutls_fbase64_encode().

| int MHD__gnutls_base64_decode | ( | const uint8_t * | data, | |
| size_t | data_size, | |||
| uint8_t ** | result | |||
| ) |
Definition at line 262 of file x509_b64.c.
References decode(), GNUTLS_E_MEMORY_ERROR, MHD_gnutls_free, and MHD_gnutls_malloc.
Referenced by MHD__gnutls_fbase64_decode().


| int MHD__gnutls_fbase64_decode | ( | const char * | header, | |
| const opaque * | data, | |||
| size_t | data_size, | |||
| uint8_t ** | result | |||
| ) |
Definition at line 320 of file x509_b64.c.
References cpydata(), ENDSTR, ENDSTR2, GNUTLS_E_BASE64_DECODING_ERROR, GNUTLS_E_BASE64_UNEXPECTED_HEADER_ERROR, MHD__gnutls_base64_decode(), MHD__gnutls_debug_log, MHD__gnutls_x509_log, MHD_gnutls_assert, MHD_gnutls_free, MHD_gtls_str_cat(), and MHD_gtls_str_cpy().
Referenced by MHD_gnutls_x509_crt_import(), MHD_gnutls_x509_privkey_import(), and parse_pem_cert_mem().


| int MHD__gnutls_fbase64_encode | ( | const char * | msg, | |
| const uint8_t * | data, | |||
| int | data_size, | |||
| uint8_t ** | result | |||
| ) |
Definition at line 156 of file x509_b64.c.
References B64FSIZE, encode(), GNUTLS_E_BASE64_ENCODING_ERROR, GNUTLS_E_MEMORY_ERROR, INCR, MHD_gnutls_assert, MHD_gnutls_calloc, and MHD_gnutls_free.
Referenced by MHD__gnutls_x509_export_int().


const uint8_t asciitable[128] [static] |
Initial value:
{
0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0x3e, 0xff, 0xff, 0xff, 0x3f,
0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
0x3a, 0x3b, 0x3c, 0x3d, 0xff, 0xff,
0xff, 0xf1, 0xff, 0xff, 0xff, 0x00,
0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c,
0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12,
0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x19, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e,
0x1f, 0x20, 0x21, 0x22, 0x23, 0x24,
0x25, 0x26, 0x27, 0x28, 0x29, 0x2a,
0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
0x31, 0x32, 0x33, 0xff, 0xff, 0xff,
0xff, 0xff
}
Definition at line 36 of file x509_b64.c.
const uint8_t b64table[] [static] |
Initial value:
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
Definition at line 33 of file x509_b64.c.
Referenced by encode().
1.5.7.1