/home/dko/projects/mobilec/trunk/src/security/xyssl-0.7/library/base64.c File Reference

#include "xyssl/base64.h"

Go to the source code of this file.

Defines

#define _CRT_SECURE_NO_DEPRECATE   1

Functions

int base64_encode (unsigned char *dst, int *dlen, unsigned char *src, int slen)
 Encode a buffer into base64 format.
int base64_decode (unsigned char *dst, int *dlen, unsigned char *src, int slen)
 Decode a base64-formatted buffer.
int base64_self_test (int verbose)
 Checkup routine.

Variables

static const int base64_enc_map [64]
static const int base64_dec_map [128]
static const char _base64_src [] = "_base64_src"


Define Documentation

#define _CRT_SECURE_NO_DEPRECATE   1

Definition at line 22 of file base64.c.


Function Documentation

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

Decode a base64-formatted buffer.

Parameters:
dst destination buffer
dlen size of the buffer (updated after call)
src source buffer
slen amount of data to be decoded
Returns:
0 if successful, ERR_BASE64_BUFFER_TOO_SMALL, or ERR_BASE64_INVALID_DATA if an invalid char is found. *dlen is always updated to reflect to amount of data that was written (or would have been written)
Note:
Call this function with *dlen = 0 to obtain the required buffer size in *dlen

Definition at line 118 of file base64.c.

References base64_dec_map, ERR_BASE64_BUFFER_TOO_SMALL, and ERR_BASE64_INVALID_CHARACTER.

Referenced by x509_add_certs(), and x509_parse_key().

int base64_encode ( unsigned char *  dst,
int dlen,
unsigned char *  src,
int  slen 
)

Encode a buffer into base64 format.

Parameters:
dst destination buffer
dlen size of the buffer (updated after call)
src source buffer
slen amount of data to be encoded
Returns:
0 if successful, or ERR_BASE64_BUFFER_TOO_SMALL. *dlen is always updated to reflect to amount of data that was written (or would have been written)
Note:
Call this function with *dlen = 0 to obtain the required buffer size in *dlen

Definition at line 58 of file base64.c.

References base64_enc_map, and ERR_BASE64_BUFFER_TOO_SMALL.

int base64_self_test ( int  verbose  ) 

Checkup routine.

Returns:
0 if successful, or 1 if the test failed

Definition at line 245 of file base64.c.

Referenced by main().


Variable Documentation

const char _base64_src[] = "_base64_src" [static]

Definition at line 179 of file base64.c.

const int 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
}

Definition at line 38 of file base64.c.

Referenced by base64_decode().

const int base64_enc_map[64] [static]

Initial value:

{
    'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
    'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
    'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd',
    'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
    'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
    'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7',
    '8', '9', '+', '/'
}

Definition at line 27 of file base64.c.

Referenced by base64_encode().


Generated on Fri May 16 14:49:56 2008 for Mobile-C by  doxygen 1.5.4