diff --git a/annotated.html b/annotated.html index 465e64c..c3f99f8 100644 --- a/annotated.html +++ b/annotated.html @@ -59,12 +59,14 @@
Here are the data structures with brief descriptions:
+ + @@ -72,7 +74,10 @@ + + + @@ -82,6 +87,9 @@ + + +
AANodeTree node
AATreeTree header, for storing helper functions
Bitmap256Bitmap of 256 bits
CfContextTop-level config information
CfKeyParameter description
CfLookupLookup entry for CF_LOOKUP table
CfOpsCallbacks for setting and getting a variable value
CfSectSection description
CfValueHelper structure for passing key info to CfOps
ChaChaChaCha state
CxMemMemory allocation context
CxOpsOps for allocator that takes context
DigestInfoAlgoright info
gaicbRequest data for getaddrinfo_a()
HashItemHashTab slot
HashTabSingle HashTab segment
JsonContextAllocation context
JsonValueJson value
KeccakContextKeccak state structure for all modes
KeccakPRNGState structure
ListStructure for both list nodes and heads
MappedFileInfo about mapped file
MBufMBuf structure
regex_tCompiled regex
regmatch_tMatch location
sha1_ctxSHA1 state
sha256_ctxState structure for both SHA256 and SHA224
SHA3ContextState structure
sha512_ctxState structure for both SHA512 and SHA384
SHListList node/head
StatListHeader structure for StatList
diff --git a/base_8h.html b/base_8h.html index 404fea5..502f33e 100644 --- a/base_8h.html +++ b/base_8h.html @@ -65,6 +65,18 @@ + + + + + + + + + + + + @@ -77,6 +89,8 @@ + + @@ -85,53 +99,154 @@ + + - - - - - + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + - + + +

Defines

#define PRIdZ
 printf 'd' format specifier for ssize_t
#define PRIiZ
 printf 'i' format specifier for ssize_t
#define PRIoZ
 printf 'o' format specifier for size_t
#define PRIuZ
 printf 'u' format specifier for size_t
#define PRIxZ
 printf 'x' format specifier for size_t
#define PRIXZ
 printf 'X' format specifier for size_t
#define offsetof(type, field)
 give offset of a field inside struct
#define container_of(ptr, type, field)
 preferred alignment
#define ARRAY_NELEM(a)
 number of elements in array
#define FLEX_ARRAY
 Compat helper to specify array with unknown length.
#define STR(x)
 Make string token from C expression.
#define CONCAT(a, b)
 Make single C token from 3 separate tokens.
#define CONCAT4(a, b, c, d)
 Make single C token from 4 separate tokens.
#define __func__
 Pre-processor macro for current function name.
#define static_assert(expr, msg)
 Compile-time assert.
#define Assert(e)
 assert() that uses <usual/logging> module
#define free(x)
 Compat: make free() accept const pointer.
Compiler attributes.
-#define _COMPILER_GNUC(maj, min)
-#define _COMPILER_CLANG(maj, min)
-#define _COMPILER_MSC(ver)
-#define _COMPILER_ICC(ver)
Compiler checks, mainly for internal usage.
#define _COMPILER_GNUC(maj, min)
 Pre-processor macro to check if compiler is GCC with high enough version.
#define _COMPILER_CLANG(maj, min)
 Pre-processor macro to check if compiler is CLANG with high enough version.
#define _COMPILER_MSC(ver)
 Pre-processor macro to check if compiler is Visual C with high enough version.
#define _COMPILER_ICC(ver)
 Pre-processor macro to check if compiler is Intel CC with high enough version.
+#define __has_builtin(x)
+#define __has_feature(x)
+#define __has_extension(x)
+#define __has_attribute(x)
Function/struct attributes.
#define _PACKED
 Disable padding for structure.
-#define __func__
-#define _MUSTCHECK
-#define _DEPRECATED
-#define _PRINTF(x, y)
-#define _MALLOC
-#define _UNUSED
-#define _NOINLINE
-#define _NORETURN
-#define unlikely(x)
-#define likely(x)
#define _MUSTCHECK
 Show warning if function result is not used.
#define _DEPRECATED
 Show warning if used.
#define _PRINTF(fmtpos, argpos)
 Check printf-style format and arg sanity.
#define _MALLOC
 Function returns new pointer.
#define _UNUSED
 Disable 'unused' warning for function/argument.
#define _NOINLINE
 Do not inline function.
#define _NORETURN
 Indicates that function never returns.
#define likely(x)
 Hint for compiler that expression (x) is likely to be true.
#define unlikely(x)
 Hint for compiler that expression (x) is likely to be false.

Functions

static _MUSTCHECK void * zmalloc (size_t len)
static _MUSTCHECK void * zmalloc (size_t len)
 Zeroing malloc.
int posix_memalign (void **ptr_p, size_t align, size_t len)
 Compat: posix_memalign()
void * reallocarray (void *p, size_t count, size_t size)
 Same as realloc(), but safely calculates total size.

Detailed Description

Basic C environment.


Define Documentation

+ +
+
+ + + + +
#define PRIdZ
+
+
+ +

printf 'd' format specifier for ssize_t

+ +
+
+ +
+
+ + + + +
#define PRIiZ
+
+
+ +

printf 'i' format specifier for ssize_t

+ +
+
+ +
+
+ + + + +
#define PRIoZ
+
+
+ +

printf 'o' format specifier for size_t

+ +
+
+ +
+
+ + + + +
#define PRIuZ
+
+
+ +

printf 'u' format specifier for size_t

+ +
+
+ +
+
+ + + + +
#define PRIxZ
+
+
+ +

printf 'x' format specifier for size_t

+ +
+
+ +
+
+ + + + +
#define PRIXZ
+
+
+ +

printf 'X' format specifier for size_t

+ +
+
@@ -282,6 +397,23 @@

number of elements in array

+
+
+ +
+
+ + + + +
#define FLEX_ARRAY
+
+
+ +

Compat helper to specify array with unknown length.

+

Usage:

+
 char flex_string[FLEX_ARRAY];
+
@@ -406,6 +538,117 @@

Make single C token from 4 separate tokens.

+ + + +
+
+ + + + +
#define __func__
+
+
+ +

Pre-processor macro for current function name.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
#define _COMPILER_GNUC( maj,
 min 
)
+
+
+ +

Pre-processor macro to check if compiler is GCC with high enough version.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
#define _COMPILER_CLANG( maj,
 min 
)
+
+
+ +

Pre-processor macro to check if compiler is CLANG with high enough version.

+ +
+
+ +
+
+ + + + + + + + +
#define _COMPILER_MSC( ver)
+
+
+ +

Pre-processor macro to check if compiler is Visual C with high enough version.

+ +
+
+ +
+
+ + + + + + + + +
#define _COMPILER_ICC( ver)
+
+
+ +

Pre-processor macro to check if compiler is Intel CC with high enough version.

+
@@ -421,6 +664,163 @@

Disable padding for structure.

+ + + +
+
+ + + + +
#define _MUSTCHECK
+
+
+ +

Show warning if function result is not used.

+ +
+
+ +
+
+ + + + +
#define _DEPRECATED
+
+
+ +

Show warning if used.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
#define _PRINTF( fmtpos,
 argpos 
)
+
+
+ +

Check printf-style format and arg sanity.

+ +
+
+ +
+
+ + + + +
#define _MALLOC
+
+
+ +

Function returns new pointer.

+ +
+
+ +
+
+ + + + +
#define _UNUSED
+
+
+ +

Disable 'unused' warning for function/argument.

+ +
+
+ +
+
+ + + + +
#define _NOINLINE
+
+
+ +

Do not inline function.

+ +
+
+ +
+
+ + + + +
#define _NORETURN
+
+
+ +

Indicates that function never returns.

+ +
+
+ +
+
+ + + + + + + + +
#define likely( x)
+
+
+ +

Hint for compiler that expression (x) is likely to be true.

+ +
+
+ +
+
+ + + + + + + + +
#define unlikely( x)
+
+
+ +

Hint for compiler that expression (x) is likely to be false.

+
@@ -500,7 +900,7 @@
- + @@ -547,6 +947,41 @@

Compat: posix_memalign()

+ + + +
+
+
static _MUSTCHECK void* zmalloc static _MUSTCHECK void* zmalloc ( size_t  len)
+ + + + + + + + + + + + + + + + + + + + + + + +
void* reallocarray (void * p,
size_t count,
size_t size 
)
+
+
+ +

Same as realloc(), but safely calculates total size.

+
diff --git a/bits_8h.html b/bits_8h.html index 46ea84e..cf606e8 100644 --- a/bits_8h.html +++ b/bits_8h.html @@ -64,8 +64,8 @@ - - + + @@ -79,17 +79,31 @@ - + - + - + - + - + - + + + + + + + + + + + + + + +

Functions

static int is_power_of_2 (int n)
 Checks if integer has only one bit set.
static bool is_power_of_2 (unsigned int n)
 Checks if integer has only one bit set.
static uint16_t rol16 (uint16_t v, int s)
 Rotate 16-bit int to left.
static uint32_t rol32 (uint32_t v, int s)
static uint64_t ror64 (uint64_t v, int s)
 Rotate 64-bit int to right.
static int fls (int x)
 Compat: Find last (MSB) set bit, 1-based ofs, 0 if arg == 0.
 Find last (highest) set bit, 1-based offset, 0 if arg == 0.
static int flsl (long x)
 Compat: Find last (MSB) set bit, 1-based ofs, 0 if arg == 0.
 Find last (highest) set bit, 1-based offset, 0 if arg == 0.
static int flsll (long long x)
 Compat: Find last (MSB) set bit, 1-based ofs, 0 if arg == 0.
 Find last (highest) set bit, 1-based offset, 0 if arg == 0.
static int ffs (int x)
 Compat: Find first (LSB) set bit, 1-based ofs, 0 if arg == 0.
 Find first (lowest) set bit, 1-based ofs, 0 if arg == 0.
static int ffsl (long x)
 Compat: Find first (LSB) set bit, 1-based ofs, 0 if arg == 0.
 Find first (lowest) set bit, 1-based ofs, 0 if arg == 0.
static int ffsll (long long x)
 Compat: Find first (LSB) set bit, 1-based ofs, 0 if arg == 0.
 Find first (lowest) set bit, 1-based ofs, 0 if arg == 0.
static bool safe_mul_uint (unsigned int *res_p, unsigned int a, unsigned int b)
 Multiply with overflow check for 'unsigned int'.
static bool safe_mul_ulong (unsigned long *res_p, unsigned long a, unsigned long b)
 Multiply with overflow check for 'unsigned long'.
static bool safe_mul_uint8 (uint8_t *res_p, uint8_t a, uint8_t b)
 Multiply with overflow check for 'uint8_t'.
static bool safe_mul_uint16 (uint16_t *res_p, uint16_t a, uint16_t b)
 Multiply with overflow check for 'uint16_t'.
static bool safe_mul_uint32 (uint32_t *res_p, uint32_t a, uint32_t b)
 Multiply with overflow check for 'uint32_t'.
static bool safe_mul_uint64 (uint64_t *res_p, uint64_t a, uint64_t b)
 Multiply with overflow check for 'uint64_t'.
static bool safe_mul_size (size_t *res_p, size_t a, size_t b)
 Multiply with overflow check for 'size_t'.

Detailed Description

Bit arithmetics.

@@ -101,14 +115,14 @@
  • ror16, ror32, ror64

  • Function Documentation

    - +
    - + - + @@ -321,7 +335,7 @@
    -

    Compat: Find last (MSB) set bit, 1-based ofs, 0 if arg == 0.

    +

    Find last (highest) set bit, 1-based offset, 0 if arg == 0.

    @@ -340,7 +354,7 @@
    -

    Compat: Find last (MSB) set bit, 1-based ofs, 0 if arg == 0.

    +

    Find last (highest) set bit, 1-based offset, 0 if arg == 0.

    @@ -359,7 +373,7 @@
    -

    Compat: Find last (MSB) set bit, 1-based ofs, 0 if arg == 0.

    +

    Find last (highest) set bit, 1-based offset, 0 if arg == 0.

    @@ -378,7 +392,7 @@
    -

    Compat: Find first (LSB) set bit, 1-based ofs, 0 if arg == 0.

    +

    Find first (lowest) set bit, 1-based ofs, 0 if arg == 0.

    @@ -397,7 +411,7 @@
    -

    Compat: Find first (LSB) set bit, 1-based ofs, 0 if arg == 0.

    +

    Find first (lowest) set bit, 1-based ofs, 0 if arg == 0.

    @@ -416,7 +430,252 @@
    -

    Compat: Find first (LSB) set bit, 1-based ofs, 0 if arg == 0.

    +

    Find first (lowest) set bit, 1-based ofs, 0 if arg == 0.

    + +
    + + +
    +
    +
    static int is_power_of_2 static bool is_power_of_2 (int unsigned int  n) [inline, static]
    + + + + + + + + + + + + + + + + + + + + + + + +
    static bool safe_mul_uint (unsigned int * res_p,
    unsigned int a,
    unsigned int b 
    ) [inline, static]
    +
    +
    + +

    Multiply with overflow check for 'unsigned int'.

    + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    static bool safe_mul_ulong (unsigned long * res_p,
    unsigned long a,
    unsigned long b 
    ) [inline, static]
    +
    +
    + +

    Multiply with overflow check for 'unsigned long'.

    + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    static bool safe_mul_uint8 (uint8_t * res_p,
    uint8_t a,
    uint8_t b 
    ) [inline, static]
    +
    +
    + +

    Multiply with overflow check for 'uint8_t'.

    + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    static bool safe_mul_uint16 (uint16_t * res_p,
    uint16_t a,
    uint16_t b 
    ) [inline, static]
    +
    +
    + +

    Multiply with overflow check for 'uint16_t'.

    + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    static bool safe_mul_uint32 (uint32_t * res_p,
    uint32_t a,
    uint32_t b 
    ) [inline, static]
    +
    +
    + +

    Multiply with overflow check for 'uint32_t'.

    + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    static bool safe_mul_uint64 (uint64_t * res_p,
    uint64_t a,
    uint64_t b 
    ) [inline, static]
    +
    +
    + +

    Multiply with overflow check for 'uint64_t'.

    + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    static bool safe_mul_size (size_t * res_p,
    size_t a,
    size_t b 
    ) [inline, static]
    +
    +
    + +

    Multiply with overflow check for 'size_t'.

    diff --git a/bytemap_8h.html b/bytemap_8h.html new file mode 100644 index 0000000..64716f0 --- /dev/null +++ b/bytemap_8h.html @@ -0,0 +1,223 @@ + + + + + +libusual: usual/bytemap.h File Reference + + + + + + + + +
    + + +
    + + + + + + + + + + + +
    +
    libusual +  0.1 +
    + +
    +
    + + + + +
    +
    +
    +Data Structures | +Defines | +Functions
    +
    +
    usual/bytemap.h File Reference
    +
    +
    + +

    Map 256 byte values to bit or int. +More...

    + + + + + + + + + + + + + + + + +

    +Data Structures

    struct  Bitmap256
     Bitmap of 256 bits. More...

    +Defines

    #define BITMAP256_CONST(check)
     Use C preprocessor to fill Bitmap256.
    #define INTMAP256_CONST(map_value)
     Use C preprocessor to generate array of 256 values.

    +Functions

    static void bitmap256_init (struct Bitmap256 *bmap)
     Clear bitmap.
    static void bitmap256_set (struct Bitmap256 *bmap, uint8_t byte)
     Set one bit.
    static bool bitmap256_is_set (const struct Bitmap256 *bmap, uint8_t byte)
     Check if bit is set.
    +

    Detailed Description

    +

    Map 256 byte values to bit or int.

    +

    Define Documentation

    + +
    +
    + + + + + + + + +
    #define BITMAP256_CONST( check)
    +
    +
    + +

    Use C preprocessor to fill Bitmap256.

    +

    Usage:

    +
     #define check_isdigit(c) ((c) >= '0' && (c) <= '9')
    + static const struct Bitmap256 map_isdigit = BITMAP256_CONST(check_isdigit);
    +
    +
    +
    + +
    +
    + + + + + + + + +
    #define INTMAP256_CONST( map_value)
    +
    +
    + +

    Use C preprocessor to generate array of 256 values.

    +

    Usage:

    +
     #define my_hexval(c) (((c) >= '0' && (c) <= '9') ? ((c) - '0') : ( \
    +                       ((c) >= 'A' && (c) <= 'F') ? ((c) - 'A' + 10) : ( \
    +                       ((c) >= 'a' && (c) <= 'f') ? ((c) - 'a' + 10) : -1 )))
    + static const int map_hexval[] = INTMAP256_CONST(my_hexval);
    +
    +
    +
    +

    Function Documentation

    + +
    +
    + + + + + + + + +
    static void bitmap256_init (struct Bitmap256bmap) [inline, static]
    +
    +
    + +

    Clear bitmap.

    + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + +
    static void bitmap256_set (struct Bitmap256bmap,
    uint8_t byte 
    ) [inline, static]
    +
    +
    + +

    Set one bit.

    + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + +
    static bool bitmap256_is_set (const struct Bitmap256bmap,
    uint8_t byte 
    ) [inline, static]
    +
    +
    + +

    Check if bit is set.

    + +
    +
    +
    + + + + + + diff --git a/cbtree_8h.html b/cbtree_8h.html index 821bc44..f6fcf1c 100644 --- a/cbtree_8h.html +++ b/cbtree_8h.html @@ -65,34 +65,34 @@ - - + + - + - + - - - - + + + +

    Typedefs

    typedef unsigned int(* cbtree_getkey_func )(void *ctx, void *obj, const void **dst_p)
     returns length of the key
    typedef size_t(* cbtree_getkey_func )(void *ctx, void *obj, const void **dst_p)
     returns length of the key
    typedef bool(* cbtree_walker_func )(void *ctx, void *obj)
     walk over tree

    Functions

    struct CBTree * cbtree_create (cbtree_getkey_func obj_key_cb, cbtree_walker_func obj_free_cb, void *cb_ctx, CxMem *cx)
    struct CBTree * cbtree_create (cbtree_getkey_func obj_key_cb, cbtree_walker_func obj_free_cb, void *cb_ctx, CxMem *cx)
     Create new tree.
    void cbtree_destroy (struct CBTree *tree)
     frees all resources allocated.
    bool cbtree_insert (struct CBTree *tree, void *obj) _MUSTCHECK
    bool cbtree_insert (struct CBTree *tree, void *obj) _MUSTCHECK
     Inserts new node to tree.
    bool cbtree_delete (struct CBTree *tree, const void *key, unsigned klen)
     Removed node from tree.
    void * cbtree_lookup (struct CBTree *tree, const void *key, unsigned klen)
     Lookup a key.
    bool cbtree_delete (struct CBTree *tree, const void *key, size_t klen)
     Removed node from tree.
    void * cbtree_lookup (struct CBTree *tree, const void *key, size_t klen)
     Lookup a key.
    bool cbtree_walk (struct CBTree *tree, cbtree_walker_func cb_func, void *cb_arg)
     Walk over tree.

    Detailed Description

    Crit-bit tree / binary radix tree.


    Typedef Documentation

    - +
    - +
    typedef unsigned int(* cbtree_getkey_func)(void *ctx, void *obj, const void **dst_p)typedef size_t(* cbtree_getkey_func)(void *ctx, void *obj, const void **dst_p)
    @@ -125,7 +125,7 @@ struct CBTree* cbtree_create ( - cbtree_getkey_func  + cbtree_getkey_func  obj_key_cb, @@ -217,12 +217,12 @@
    - +
    - + @@ -236,7 +236,7 @@ - + @@ -254,12 +254,12 @@ - +
    bool cbtree_delete bool cbtree_delete ( struct CBTree *  tree,
    unsigned size_t  klen 
    - + @@ -273,7 +273,7 @@ - + diff --git a/cfparser_8h.html b/cfparser_8h.html index 89f97bc..09fa27c 100644 --- a/cfparser_8h.html +++ b/cfparser_8h.html @@ -112,7 +112,7 @@ - + @@ -149,7 +149,7 @@ Simple line-by-line parser - +
    void* cbtree_lookup void* cbtree_lookup ( struct CBTree *  tree,
    unsigned size_t  klen 
     Ops for lookup, takes table as argument.

    Functions

    bool cf_load_file (const struct CfContext *cf, const char *fn) _MUSTCHECK
    bool cf_load_file (const struct CfContext *cf, const char *fn) _MUSTCHECK
     Load config from file.
    const char * cf_get (const struct CfContext *cf, const char *sect, const char *var, char *buf, int buflen)
     Get single value.
    typedef bool(* cf_handler_f )(void *arg, bool is_sect, const char *key, const char *val)
     Callback signarure for parse_ini_file()
    bool parse_ini_file (const char *fn, cf_handler_f user_handler, void *arg) _MUSTCHECK
    bool parse_ini_file (const char *fn, cf_handler_f user_handler, void *arg) _MUSTCHECK
     Simple parser, launches callback for each line.

    Detailed Description

    diff --git a/chacha_8h.html b/chacha_8h.html new file mode 100644 index 0000000..1ae4718 --- /dev/null +++ b/chacha_8h.html @@ -0,0 +1,271 @@ + + + + + +libusual: usual/crypto/chacha.h File Reference + + + + + + + + +
    + + +
    + + + + + + + + + + + +
    +
    libusual +  0.1 +
    + +
    +
    + + + + +
    +
    + +
    +
    usual/crypto/chacha.h File Reference
    +
    +
    + +

    ChaCha cipher. +More...

    + + + + + + + + + + + + + + + +

    +Data Structures

    struct  ChaCha
     ChaCha state. More...

    +Functions

    void chacha_set_key_256 (struct ChaCha *ctx, const void *key)
     Set 256-bit key.
    void chacha_set_key_128 (struct ChaCha *ctx, const void *key)
     Set 128-bit key.
    void chacha_set_nonce (struct ChaCha *ctx, uint32_t counter_low, uint32_t counter_high, const void *iv)
     Set 2x32-bit counter and 8-byte IV.
    void chacha_keystream (struct ChaCha *ctx, void *stream, size_t bytes)
     Extract plain keystream.
    void chacha_keystream_xor (struct ChaCha *ctx, const void *plain, void *encrypted, size_t bytes)
     XOR data with keystream.
    +

    Detailed Description

    +

    ChaCha cipher.

    +

    Function Documentation

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    void chacha_set_key_256 (struct ChaChactx,
    const void * key 
    )
    +
    +
    + +

    Set 256-bit key.

    + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + +
    void chacha_set_key_128 (struct ChaChactx,
    const void * key 
    )
    +
    +
    + +

    Set 128-bit key.

    + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    void chacha_set_nonce (struct ChaChactx,
    uint32_t counter_low,
    uint32_t counter_high,
    const void * iv 
    )
    +
    +
    + +

    Set 2x32-bit counter and 8-byte IV.

    + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    void chacha_keystream (struct ChaChactx,
    void * stream,
    size_t bytes 
    )
    +
    +
    + +

    Extract plain keystream.

    + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    void chacha_keystream_xor (struct ChaChactx,
    const void * plain,
    void * encrypted,
    size_t bytes 
    )
    +
    +
    + +

    XOR data with keystream.

    + +
    +
    +
    + + + + + + diff --git a/classes.html b/classes.html index f737e55..1fcbde7 100644 --- a/classes.html +++ b/classes.html @@ -56,37 +56,41 @@
    Data Structure Index
    -
    A | C | D | E | G | H | K | L | M | O | P | R | S
    +
    A | B | C | D | E | G | H | J | K | L | M | O | P | R | S
    - + - - + + + + + + - - - - + + + - - - - + +
      A  
    -
    CfValue   
      H  
    -
    MBuf   regmatch_t   
    CxMem   md5_ctx   
      S  
    +
    CfSect   
      H  
    +
      M  
    +
    regmatch_t   
    CfValue   
      S  
    AANode   CxOps   HashItem   
      O  
    -
    AATree   
      D  
    -
    HashTab   sha1_ctx   
    AANode   ChaCha   HashItem   MappedFile   
    AATree   CxMem   HashTab   MBuf   sha1_ctx   
      B  
    +
    CxOps   
      J  
    +
    md5_ctx   sha256_ctx   
      D  
    +
      O  
    +
    SHA3Context   
    Bitmap256   JsonContext   sha512_ctx   
      C  
    +
    DigestInfo   JsonValue   option   SHList   
      E  
      K  
    -
    option   SHList   
    DigestInfo   
      P  
    +
      P  
    StatList   
    CfContext   
      E  
    -
    KeccakContext   
    CfKey   
      L  
    -
    PStr   
    CfLookup   event   
      R  
    +
    CfContext   
    CfKey   event   KeccakContext   PStr   
    CfLookup   
      G  
    +
    KeccakPRNG   
      R  
    +
    CfOps   
      L  
    CfOps   
      G  
    -
    List   
    CfSect   
      M  
    -
    regex_t   
    gaicb   
    MappedFile   
    gaicb   regex_t   
    List   
    -
    A | C | D | E | G | H | K | L | M | O | P | R | S
    +
    A | B | C | D | E | G | H | J | K | L | M | O | P | R | S
    diff --git a/csrandom_8h.html b/csrandom_8h.html new file mode 100644 index 0000000..bde7bbd --- /dev/null +++ b/csrandom_8h.html @@ -0,0 +1,154 @@ + + + + + +libusual: usual/crypto/csrandom.h File Reference + + + + + + + + +
    + + +
    + + + + + + + + + + + +
    +
    libusual +  0.1 +
    + +
    +
    + + + + +
    +
    +
    +Functions
    +
    +
    usual/crypto/csrandom.h File Reference
    +
    +
    + +

    Cryptographically Secure Randomness. +More...

    + + + + + + + + +

    +Functions

    uint32_t csrandom (void)
     Return random uint32_t.
    uint32_t csrandom_range (uint32_t upper_bound)
     Return unsigned integer in range.
    void csrandom_bytes (void *buf, size_t nbytes)
     Fill buffer with random bytes.
    +

    Detailed Description

    +

    Cryptographically Secure Randomness.

    +

    Function Documentation

    + +
    +
    + + + + + + + + +
    uint32_t csrandom (void )
    +
    +
    + +

    Return random uint32_t.

    + +
    +
    + +
    +
    + + + + + + + + +
    uint32_t csrandom_range (uint32_t upper_bound)
    +
    +
    + +

    Return unsigned integer in range.

    + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + +
    void csrandom_bytes (void * buf,
    size_t nbytes 
    )
    +
    +
    + +

    Fill buffer with random bytes.

    + +
    +
    +
    + + + + + + diff --git a/cxalloc_8h.html b/cxalloc_8h.html index a42ab30..c5eea5b 100644 --- a/cxalloc_8h.html +++ b/cxalloc_8h.html @@ -77,7 +77,7 @@  Default allocator.

    Functions

    -void * cx_alloc (CxMem *cx, size_t len) _MALLOC +void * cx_alloc (CxMem *cx, size_t len) _MALLOC  Allocate memory from context.
    void * cx_realloc (CxMem *cx, void *ptr, size_t len)  Change existing allocation.
    @@ -85,16 +85,24 @@  Free existing allocation.
    void cx_destroy (CxMem *cx)  Release all memory allocated in context.
    -void * cx_alloc0 (CxMem *cx, size_t len) _MALLOC +void * cx_alloc0 (CxMem *cx, size_t len) _MALLOC  Allocate and zero-fill memory.
    -void * cx_memdup (CxMem *cx, const void *src, size_t len) _MALLOC +void * cx_memdup (CxMem *cx, const void *src, size_t len) _MALLOC  Allocate and copy.
    -void * cx_strdup (CxMem *cx, const char *str) _MALLOC +void * cx_strdup (CxMem *cx, const char *str) _MALLOC  Allocate and copy string.
    +int cx_asprintf (CxMem *cx, char **dst_p, const char *fmt,...) _PRINTF(3 + Print to allocated string, return length or -1 on error.
    +int int cx_vasprintf (CxMem *cx, char **dst_p, const char *fmt, va_list ap) _PRINTF(3 + Print to allocated string, return length or -1 on error.
    +int int char * cx_sprintf (CxMem *cx, const char *fmt,...) _PRINTF(2 + Print to allocated string, return new string or NULL on error.
    +int int char char * cx_vsprintf (CxMem *cx, const char *fmt, va_list ap) _PRINTF(2 + Print to allocated string, return new string or NULL on error.

    Variables

    -CxMem cx_libc_allocator - Allocator that uses libc malloc/realloc/free.
    +int int char char CxMem cx_libc_allocator + Allocator that uses libc malloc/realloc/free.

    Detailed Description

    Context-based Memory Allocator.

    @@ -338,15 +346,167 @@

    Allocate and copy string.

    +
    + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    int cx_asprintf (CxMemcx,
    char ** dst_p,
    const char * fmt,
     ... 
    )
    +
    +
    + +

    Print to allocated string, return length or -1 on error.

    + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    int int cx_vasprintf (CxMemcx,
    char ** dst_p,
    const char * fmt,
    va_list ap 
    )
    +
    +
    + +

    Print to allocated string, return length or -1 on error.

    + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    int int char* cx_sprintf (CxMemcx,
    const char * fmt,
     ... 
    )
    +
    +
    + +

    Print to allocated string, return new string or NULL on error.

    + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    int int char char* cx_vsprintf (CxMemcx,
    const char * fmt,
    va_list ap 
    )
    +
    +
    + +

    Print to allocated string, return new string or NULL on error.

    +

    Variable Documentation

    - +
    - +
    CxMem cx_libc_allocatorint int char char CxMem cx_libc_allocator
    diff --git a/cxextra_8h.html b/cxextra_8h.html index c98c937..4344136 100644 --- a/cxextra_8h.html +++ b/cxextra_8h.html @@ -65,8 +65,8 @@ - - + + - - - - - - - - - - + + + + + + + + + + + +

    Functions

    CxMemcx_new_pool (CxMem *parent)
     Creates allocator that pools all memory together, without keeping track of single objects, to be freed all together in one shot.
    CxMemcx_new_pool (CxMem *parent, size_t initial_size, unsigned int align)
     Creates allocator that pools all memory together, without keeping track of single objects, to be freed all together in one shot.
    CxMemcx_new_tree (CxMem *parent)
     Creates allocator that remebers all allocations done under it and allows all of it to be freed together.

    @@ -79,16 +79,32 @@

    Detailed Description

    Extra allocators for cxalloc.


    Function Documentation

    - +
    - + - + + + + + + + + + + + + + + + + +
    CxMem* cx_new_pool CxMem* cx_new_pool ( CxMemparent)parent,
    size_t initial_size,
    unsigned int align 
    )
    diff --git a/digest_8h.html b/digest_8h.html index a36c6f8..6c8a573 100644 --- a/digest_8h.html +++ b/digest_8h.html @@ -95,16 +95,18 @@
     SHA384 message digest.
    struct DigestInfodigest_SHA512 (void)
     SHA512 message digest.
    struct DigestInfodigest_KECCAK224 (void)
     Keccak-224 message digest.
    struct DigestInfodigest_KECCAK256 (void)
     Keccak-256 message digest.
    struct DigestInfodigest_KECCAK384 (void)
     Keccak-384 message digest.
    struct DigestInfodigest_KECCAK512 (void)
     Keccak-512 message digest.
    struct DigestInfodigest_KECCAK_STREAM (void)
     Keccak in arbitrary output length mode.
    struct DigestInfodigest_SHA3_224 (void)
     SHA3-224 message digest.
    struct DigestInfodigest_SHA3_256 (void)
     SHA3-256 message digest.
    struct DigestInfodigest_SHA3_384 (void)
     SHA3-384 message digest.
    struct DigestInfodigest_SHA3_512 (void)
     SHA3-512 message digest.
    struct DigestInfodigest_SHAKE128 (void)
     SHAKE128 in regular digest mode.
    struct DigestInfodigest_SHAKE256 (void)
     SHAKE256 in regular digest mode.

    Detailed Description

    Common API for cryptographic digests.

    @@ -393,12 +395,12 @@
    - +
    - + @@ -408,16 +410,16 @@
    -

    Keccak-224 message digest.

    +

    SHA3-224 message digest.

    - +
    struct DigestInfo* digest_KECCAK224 struct DigestInfo* digest_SHA3_224 ( void  )
    - + @@ -427,16 +429,16 @@
    -

    Keccak-256 message digest.

    +

    SHA3-256 message digest.

    - +
    struct DigestInfo* digest_KECCAK256 struct DigestInfo* digest_SHA3_256 ( void  )
    - + @@ -446,16 +448,16 @@
    -

    Keccak-384 message digest.

    +

    SHA3-384 message digest.

    - +
    struct DigestInfo* digest_KECCAK384 struct DigestInfo* digest_SHA3_384 ( void  )
    - + @@ -465,16 +467,16 @@
    -

    Keccak-512 message digest.

    +

    SHA3-512 message digest.

    - +
    struct DigestInfo* digest_KECCAK512 struct DigestInfo* digest_SHA3_512 ( void  )
    - + @@ -484,7 +486,26 @@
    -

    Keccak in arbitrary output length mode.

    +

    SHAKE128 in regular digest mode.

    + +
    + + +
    +
    +
    struct DigestInfo* digest_KECCAK_STREAM struct DigestInfo* digest_SHAKE128 ( void  )
    + + + + + + + +
    struct DigestInfo* digest_SHAKE256 (void ) [read]
    +
    +
    + +

    SHAKE256 in regular digest mode.

    diff --git a/endian_8h.html b/endian_8h.html index 9a1b786..f95b142 100644 --- a/endian_8h.html +++ b/endian_8h.html @@ -57,75 +57,846 @@
    -

    Endianess conversion macros. +

    Endianess conversion, convert integers to bytes. More...

    - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + +

    Defines

    Host <-> LE/BE
    -#define htobe16(x)
    -#define htobe32(x)
    -#define htobe64(x)
    -#define htole16(x)
    -#define htole32(x)
    -#define htole64(x)
    -#define be16toh(x)
    -#define be32toh(x)
    -#define be64toh(x)
    -#define le16toh(x)
    -#define le32toh(x)
    -#define le64toh(x)
    Convert host-endian int to BE/LE.
    #define htobe16(x)
     Convert native 16-bit int to big-endian.
    #define htobe32(x)
     Convert native 32-bit int to big-endian.
    #define htobe64(x)
     Convert native 64-bit int to big-endian.
    #define htole16(x)
     Convert native 16-bit int to little-endian.
    #define htole32(x)
     Convert native 32-bit int to little-endian.
    #define htole64(x)
     Convert native 64-bit int to little-endian.
    #define be16toh(x)
     Convert big-endian 16-bit int to host-endian.
    #define be32toh(x)
     Convert big-endian 32-bit int to host-endian.
    #define be64toh(x)
     Convert big-endian 64-bit int to host-endian.
    #define le16toh(x)
     Convert little-endian 64-bit int to host-endian.
    #define le32toh(x)
     Convert little-endian 64-bit int to host-endian.
    #define le64toh(x)
     Convert little-endian 64-bit int to host-endian.

    Functions

    Always swap.
    -static uint16_t bswap16 (uint16_t x)
    -static uint32_t bswap32 (uint32_t x)
    -static uint64_t bswap64 (uint64_t x)
    Read LE/BE values from memory and convert to host format
    -static uint16_t be16dec (const void *p)
    -static uint32_t be32dec (const void *p)
    -static uint64_t be64dec (const void *p)
    -static uint16_t le16dec (const void *p)
    -static uint32_t le32dec (const void *p)
    -static uint64_t le64dec (const void *p)
    static uint16_t bswap16 (uint16_t x)
     Swap 16-bit int.
    static uint32_t bswap32 (uint32_t x)
     Swap 32-bit int.
    static uint64_t bswap64 (uint64_t x)
     Swap 64-bit int.
    Read integer values from memory and convert to host format.
    static uint16_t be16dec (const void *p)
     Read big-endian 16-bit int from memory.
    static uint32_t be32dec (const void *p)
     Read big-endian 32-bit int from memory.
    static uint64_t be64dec (const void *p)
     Read big-endian 64-bit int from memory.
    static uint16_t le16dec (const void *p)
     Read little-endian 16-bit int from memory.
    static uint32_t le32dec (const void *p)
     Read little-endian 32-bit int from memory.
    static uint64_t le64dec (const void *p)
     Read little-endian 64-bit int from memory.
    static uint16_t h16dec (const void *p)
     Read host-endian 16-bit int from memory.
    static uint32_t h32dec (const void *p)
     Read host-endian 32-bit int from memory.
    static uint64_t h64dec (const void *p)
     Read host-endian 64-bit int from memory.
    Convert host value to LE/BE and write to memory
    -static void be16enc (void *p, uint16_t x)
    -static void be32enc (void *p, uint32_t x)
    -static void be64enc (void *p, uint64_t x)
    -static void le16enc (void *p, uint16_t x)
    -static void le32enc (void *p, uint32_t x)
    -static void le64enc (void *p, uint64_t x)
    static void be16enc (void *p, uint16_t x)
     Write big-endian 16-bit int to memory.
    static void be32enc (void *p, uint32_t x)
     Write big-endian 32-bit int to memory.
    static void be64enc (void *p, uint64_t x)
     Write big-endian 64-bit int to memory.
    static void le16enc (void *p, uint16_t x)
     Write little-endian 16-bit int to memory.
    static void le32enc (void *p, uint32_t x)
     Write little-endian 32-bit int to memory.
    static void le64enc (void *p, uint64_t x)
     Write little-endian 64-bit int to memory.
    static void h16enc (void *p, uint16_t x)
     Write host-endian 16-bit int to memory.
    static void h32enc (void *p, uint32_t x)
     Write host-endian 32-bit int to memory.
    static void h64enc (void *p, uint64_t x)
     Write host-endian 64-bit int to memory.

    Detailed Description

    -

    Endianess conversion macros.

    -
    +

    Endianess conversion, convert integers to bytes.

    +

    Define Documentation

    + +
    +
    + + + + + + + + +
    #define htobe16( x)
    +
    +
    + +

    Convert native 16-bit int to big-endian.

    + +

    Referenced by be16dec(), and be16enc().

    + +
    +
    + +
    +
    + + + + + + + + +
    #define htobe32( x)
    +
    +
    + +

    Convert native 32-bit int to big-endian.

    + +

    Referenced by be32dec(), and be32enc().

    + +
    +
    + +
    +
    + + + + + + + + +
    #define htobe64( x)
    +
    +
    + +

    Convert native 64-bit int to big-endian.

    + +

    Referenced by be64dec(), and be64enc().

    + +
    +
    + +
    +
    + + + + + + + + +
    #define htole16( x)
    +
    +
    + +

    Convert native 16-bit int to little-endian.

    + +

    Referenced by le16dec(), and le16enc().

    + +
    +
    + +
    +
    + + + + + + + + +
    #define htole32( x)
    +
    +
    + +

    Convert native 32-bit int to little-endian.

    + +

    Referenced by le32dec(), and le32enc().

    + +
    +
    + +
    +
    + + + + + + + + +
    #define htole64( x)
    +
    +
    + +

    Convert native 64-bit int to little-endian.

    + +

    Referenced by le64dec(), and le64enc().

    + +
    +
    + +
    +
    + + + + + + + + +
    #define be16toh( x)
    +
    +
    + +

    Convert big-endian 16-bit int to host-endian.

    + +
    +
    + +
    +
    + + + + + + + + +
    #define be32toh( x)
    +
    +
    + +

    Convert big-endian 32-bit int to host-endian.

    + +
    +
    + +
    +
    + + + + + + + + +
    #define be64toh( x)
    +
    +
    + +

    Convert big-endian 64-bit int to host-endian.

    + +
    +
    + +
    +
    + + + + + + + + +
    #define le16toh( x)
    +
    +
    + +

    Convert little-endian 64-bit int to host-endian.

    + +
    +
    + +
    +
    + + + + + + + + +
    #define le32toh( x)
    +
    +
    + +

    Convert little-endian 64-bit int to host-endian.

    + +
    +
    + +
    +
    + + + + + + + + +
    #define le64toh( x)
    +
    +
    + +

    Convert little-endian 64-bit int to host-endian.

    + +
    +
    +

    Function Documentation

    + +
    +
    + + + + + + + + +
    static uint16_t bswap16 (uint16_t x) [inline, static]
    +
    +
    + +

    Swap 16-bit int.

    + +
    +
    + +
    +
    + + + + + + + + +
    static uint32_t bswap32 (uint32_t x) [inline, static]
    +
    +
    + +

    Swap 32-bit int.

    + +

    Referenced by bswap64().

    + +
    +
    + +
    +
    + + + + + + + + +
    static uint64_t bswap64 (uint64_t x) [inline, static]
    +
    +
    + +

    Swap 64-bit int.

    + +

    References bswap32().

    + +
    +
    + +
    +
    + + + + + + + + +
    static uint16_t be16dec (const void * p) [inline, static]
    +
    +
    + +

    Read big-endian 16-bit int from memory.

    + +

    References htobe16.

    + +
    +
    + +
    +
    + + + + + + + + +
    static uint32_t be32dec (const void * p) [inline, static]
    +
    +
    + +

    Read big-endian 32-bit int from memory.

    + +

    References htobe32.

    + +
    +
    + +
    +
    + + + + + + + + +
    static uint64_t be64dec (const void * p) [inline, static]
    +
    +
    + +

    Read big-endian 64-bit int from memory.

    + +

    References htobe64.

    + +
    +
    + +
    +
    + + + + + + + + +
    static uint16_t le16dec (const void * p) [inline, static]
    +
    +
    + +

    Read little-endian 16-bit int from memory.

    + +

    References htole16.

    + +
    +
    + +
    +
    + + + + + + + + +
    static uint32_t le32dec (const void * p) [inline, static]
    +
    +
    + +

    Read little-endian 32-bit int from memory.

    + +

    References htole32.

    + +
    +
    + +
    +
    + + + + + + + + +
    static uint64_t le64dec (const void * p) [inline, static]
    +
    +
    + +

    Read little-endian 64-bit int from memory.

    + +

    References htole64.

    + +
    +
    + +
    +
    + + + + + + + + +
    static uint16_t h16dec (const void * p) [inline, static]
    +
    +
    + +

    Read host-endian 16-bit int from memory.

    + +
    +
    + +
    +
    + + + + + + + + +
    static uint32_t h32dec (const void * p) [inline, static]
    +
    +
    + +

    Read host-endian 32-bit int from memory.

    + +
    +
    + +
    +
    + + + + + + + + +
    static uint64_t h64dec (const void * p) [inline, static]
    +
    +
    + +

    Read host-endian 64-bit int from memory.

    + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + +
    static void be16enc (void * p,
    uint16_t x 
    ) [inline, static]
    +
    +
    + +

    Write big-endian 16-bit int to memory.

    + +

    References htobe16.

    + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + +
    static void be32enc (void * p,
    uint32_t x 
    ) [inline, static]
    +
    +
    + +

    Write big-endian 32-bit int to memory.

    + +

    References htobe32.

    + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + +
    static void be64enc (void * p,
    uint64_t x 
    ) [inline, static]
    +
    +
    + +

    Write big-endian 64-bit int to memory.

    + +

    References htobe64.

    + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + +
    static void le16enc (void * p,
    uint16_t x 
    ) [inline, static]
    +
    +
    + +

    Write little-endian 16-bit int to memory.

    + +

    References htole16.

    + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + +
    static void le32enc (void * p,
    uint32_t x 
    ) [inline, static]
    +
    +
    + +

    Write little-endian 32-bit int to memory.

    + +

    References htole32.

    + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + +
    static void le64enc (void * p,
    uint64_t x 
    ) [inline, static]
    +
    +
    + +

    Write little-endian 64-bit int to memory.

    + +

    References htole64.

    + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + +
    static void h16enc (void * p,
    uint16_t x 
    ) [inline, static]
    +
    +
    + +

    Write host-endian 16-bit int to memory.

    + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + +
    static void h32enc (void * p,
    uint32_t x 
    ) [inline, static]
    +
    +
    + +

    Write host-endian 32-bit int to memory.

    + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + +
    static void h64enc (void * p,
    uint64_t x 
    ) [inline, static]
    +
    +
    + +

    Write host-endian 64-bit int to memory.

    + +
    +
    +