The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Macros | Functions | Variables
base64.c File Reference

Encode/decode binary data using printable characters (base64 format) More...

#include "base64.h"
#include <freeradius-devel/util/value.h>
+ Include dependency graph for base64.c:

Go to the source code of this file.

Macros

#define us(x)   (uint8_t) x
 

Functions

fr_slen_t fr_base64_decode_nstd (fr_sbuff_parse_error_t *err, fr_dbuff_t *out, fr_sbuff_t *in, bool expect_padding, bool no_trailing, uint8_t const alphabet[static UINT8_MAX])
 
ssize_t fr_base64_encode_nstd (fr_sbuff_t *out, fr_dbuff_t *in, bool add_padding, char const alphabet[static UINT8_MAX])
 Base 64 encode binary data. More...
 

Variables

uint8_t const fr_base64_alphabet_decode [UINT8_MAX]
 
char const fr_base64_alphabet_encode [UINT8_MAX]
 
uint8_t const fr_base64_url_alphabet_decode [UINT8_MAX]
 
char const fr_base64_url_alphabet_encode [UINT8_MAX]
 

Detailed Description

Encode/decode binary data using printable characters (base64 format)

See also
RFC 4648 http://www.ietf.org/rfc/rfc4648.txt.

Definition in file base64.c.

Macro Definition Documentation

◆ us

#define us (   x)    (uint8_t) x

Definition at line 30 of file base64.c.

Function Documentation

◆ fr_base64_decode_nstd()

fr_slen_t fr_base64_decode_nstd ( fr_sbuff_parse_error_t err,
fr_dbuff_t out,
fr_sbuff_t in,
bool  expect_padding,
bool  no_trailing,
uint8_t const  alphabet[static UINT8_MAX] 
)

Definition at line 401 of file base64.c.

+ Here is the call graph for this function:

◆ fr_base64_encode_nstd()

ssize_t fr_base64_encode_nstd ( fr_sbuff_t out,
fr_dbuff_t in,
bool  add_padding,
char const  alphabet[static UINT8_MAX] 
)

Base 64 encode binary data.

Base64 encode in bytes to base64, writing to out.

Parameters
[out]outWhere to write Base64 string.
[in]inData to encode.
[in]add_paddingAdd padding bytes.
[in]alphabetto use for encoding.
Returns
  • Amount of data we wrote to the buffer.
  • <0 the number of bytes we would have needed in the ouput buffer.

Definition at line 326 of file base64.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ fr_base64_alphabet_decode

uint8_t const fr_base64_alphabet_decode[UINT8_MAX]

Definition at line 99 of file base64.c.

◆ fr_base64_alphabet_encode

char const fr_base64_alphabet_encode[UINT8_MAX]

Definition at line 32 of file base64.c.

◆ fr_base64_url_alphabet_decode

uint8_t const fr_base64_url_alphabet_decode[UINT8_MAX]

Definition at line 240 of file base64.c.

◆ fr_base64_url_alphabet_encode

char const fr_base64_url_alphabet_encode[UINT8_MAX]

Definition at line 173 of file base64.c.