The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Macros | Functions | Variables
base32.h File Reference
#include <freeradius-devel/missing.h>
#include <freeradius-devel/util/sbuff.h>
#include <freeradius-devel/util/dbuff.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <sys/types.h>
+ Include dependency graph for base32.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define fr_base32_decode(_out, _in, _expect_padding, _no_trailing)    fr_base32_decode_nstd(NULL, _out, _in, _expect_padding, _no_trailing, fr_base32_alphabet_decode)
 
#define fr_base32_encode(_out, _in, _add_padding)    fr_base32_encode_nstd(_out, _in, _add_padding, fr_base32_alphabet_encode)
 

Functions

ssize_t fr_base32_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_base32_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...
 
static bool fr_is_base32_nstd (char c, uint8_t const alphabet[static UINT8_MAX])
 Check if char is in base32 alphabet. More...
 

Variables

uint8_t const fr_base32_alphabet_decode [UINT8_MAX]
 
char const fr_base32_alphabet_encode [UINT8_MAX]
 Encode/decode binary data using printable characters (base32 format) More...
 
uint8_t const fr_base32_hex_alphabet_decode [UINT8_MAX]
 
char const fr_base32_hex_alphabet_encode [UINT8_MAX]
 

Macro Definition Documentation

◆ fr_base32_decode

#define fr_base32_decode (   _out,
  _in,
  _expect_padding,
  _no_trailing 
)     fr_base32_decode_nstd(NULL, _out, _in, _expect_padding, _no_trailing, fr_base32_alphabet_decode)

Definition at line 69 of file base32.h.

◆ fr_base32_encode

#define fr_base32_encode (   _out,
  _in,
  _add_padding 
)     fr_base32_encode_nstd(_out, _in, _add_padding, fr_base32_alphabet_encode)

Definition at line 62 of file base32.h.

Function Documentation

◆ fr_base32_decode_nstd()

ssize_t fr_base32_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 315 of file base32.c.

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

◆ fr_base32_encode_nstd()

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

Base 64 encode binary data.

base32 encode in bytes to base32, writing to out.

Parameters
[out]outWhere to write base32 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 190 of file base32.c.

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

◆ fr_is_base32_nstd()

static bool fr_is_base32_nstd ( char  c,
uint8_t const  alphabet[static UINT8_MAX] 
)
inlinestatic

Check if char is in base32 alphabet.

Note that '=' is padding and not considered to be part of the alphabet.

Parameters
[in]cchar to check.
[in]alphabetto use.
Returns
  • true if c is a character from the base32 alphabet.
  • false if character is not in the base32 alphabet.

Definition at line 54 of file base32.h.

+ Here is the caller graph for this function:

Variable Documentation

◆ fr_base32_alphabet_decode

uint8_t const fr_base32_alphabet_decode[UINT8_MAX]
extern

Definition at line 67 of file base32.c.

◆ fr_base32_alphabet_encode

char const fr_base32_alphabet_encode[UINT8_MAX]
extern

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

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

Definition at line 32 of file base32.c.

◆ fr_base32_hex_alphabet_decode

uint8_t const fr_base32_hex_alphabet_decode[UINT8_MAX]
extern

Definition at line 140 of file base32.c.

◆ fr_base32_hex_alphabet_encode

char const fr_base32_hex_alphabet_encode[UINT8_MAX]
extern

Definition at line 105 of file base32.c.