1 #include <freeradius-devel/util/acutest.h>
2 #include <freeradius-devel/util/acutest_helpers.h>
24 {
L(
"fo"),
L(
"666f") },
25 {
L(
"foo"),
L(
"666f6f") },
26 {
L(
"foob"),
L(
"666f6f62") },
27 {
L(
"fooba"),
L(
"666f6f6261") },
28 {
L(
"foobar"),
L(
"666f6f626172") }
33 {
L(
"f"),
L(
"MY======") },
34 {
L(
"fo"),
L(
"MZXQ====") },
35 {
L(
"foo"),
L(
"MZXW6===") },
36 {
L(
"foob"),
L(
"MZXW6YQ=") },
37 {
L(
"fooba"),
L(
"MZXW6YTB") },
38 {
L(
"foobar"),
L(
"MZXW6YTBOI======") }
43 {
L(
"f"),
L(
"CO======") },
44 {
L(
"fo"),
L(
"CPNG====") },
45 {
L(
"foo"),
L(
"CPNMU===") },
46 {
L(
"foob"),
L(
"CPNMUOG=") },
47 {
L(
"fooba"),
L(
"CPNMUOJ1") },
48 {
L(
"foobar"),
L(
"CPNMUOJ1E8======") }
53 {
L(
"f"),
L(
"Zg==") },
54 {
L(
"fo"),
L(
"Zm8=") },
55 {
L(
"foo"),
L(
"Zm9v") },
56 {
L(
"foob"),
L(
"Zm9vYg==") },
57 {
L(
"fooba"),
L(
"Zm9vYmE=") },
58 {
L(
"foobar"),
L(
"Zm9vYmFy") }
63 char buffer[17] = { 0xff };
70 fr_sbuff_set_to_start(&
out);
77 fr_sbuff_set_to_start(&
out);
107 char buffer[17] = { 0xff };
114 fr_sbuff_set_to_start(&
out);
122 fr_sbuff_set_to_start(&
out);
129 char buffer[7] = { 0xff };
154 char buffer[17] = { 0xff };
161 fr_sbuff_set_to_start(&
out);
169 fr_sbuff_set_to_start(&
out);
176 char buffer[7] = { 0xff };
201 char buffer[17] = { 0xff };
208 fr_sbuff_set_to_start(&
out);
216 fr_sbuff_set_to_start(&
out);
223 char buffer[7] = { 0xff };
static int const char char buffer[256]
#define TEST_CHECK_SLEN(_got, _exp)
#define TEST_CHECK_STRCMP(_got, _exp)
#define fr_base16_encode(_out, _in)
#define fr_base16_decode(_err, _out, _in, _no_trailing)
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.
uint8_t const fr_base32_hex_alphabet_decode[UINT8_MAX]
fr_slen_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])
char const fr_base32_hex_alphabet_encode[UINT8_MAX]
#define fr_base32_encode(_out, _in, _add_padding)
#define fr_base32_decode(_out, _in, _expect_padding, _no_trailing)
#define fr_base64_decode(_out, _in, _expect_padding, _no_trailing)
size_t fr_base64_encode(char *restrict out, size_t outlen, uint8_t const *restrict in, size_t inlen)
static void test_base64_decode(void)
struct test_vector::@106 encoded
static void test_base64_encode(void)
static const test_vector base32_hex_vectors[]
static void test_base16_encode(void)
static void test_base32_hex_encode(void)
struct test_vector::@105 cleartext
static const test_vector base32_vectors[]
static void test_base32_encode(void)
static const test_vector base16_vectors[]
static void test_base32_hex_decode(void)
static void test_base32_decode(void)
static void test_base16_decode(void)
static const test_vector base64_vectors[]
#define L(_str)
Helper for initialising arrays of string literals.
#define fr_dbuff_current(_dbuff_or_marker)
Return the 'current' position of a dbuff or marker.
#define fr_dbuff_init(_out, _start, _len_or_end)
Initialise an dbuff for encoding or decoding.
#define fr_dbuff_set_to_start(_dbuff_or_marker)
Reset the 'current' position of the dbuff or marker to the 'start' of the buffer.
#define fr_dbuff_in_bytes(_dbuff_or_marker,...)
Copy a byte sequence into a dbuff or marker.
#define FR_DBUFF_TMP(_start, _len_or_end)
Creates a compound literal to pass into functions which accept a dbuff.
#define FR_SBUFF_IN(_start, _len_or_end)
#define fr_sbuff_current(_sbuff_or_marker)
#define fr_sbuff_init_out(_out, _start, _len_or_end)
char const * fr_strerror(void)
Get the last library error.
static size_t char ** out