assh/assh.h header reference

Description [link] 

This header contains declarations of types used across the library as well as error related enums and macros.

Header inclusion [link] 

Members [link] 

Types [link] 

Functions [link] 

Macros [link] 

Members detail [link] 

#define ASSH_SEVERITY(code) [link] 

This macro is declared in assh/assh.h source file, line 253.

This macro extracts the enum assh_severity_e part of an status code returned by a function.

This macro expands to:

((enum assh_severity_e)((code) & 0xf000))

See also assh_status_t, enum assh_severity_e and Error handling.

#define ASSH_STATUS(code) [link] 

This macro is declared in assh/assh.h source file, line 244.

This macro extracts the enum assh_status_e part of an status code returned by a function.

This macro expands to:

((enum assh_status_e)((code) & 0xfff))

See also assh_status_t, enum assh_status_e, ASSH_SUCCESS and Error handling.

#define ASSH_SUCCESS(code) [link] 

This macro is declared in assh/assh.h source file, line 248.

This macro evaluate to true when the status code is not an error.

This macro expands to:

(ASSH_STATUS(code) < 0x100)

See also ASSH_STATUS and Error handling.

typedef assh_status_t (assh_allocator_t)(void *alloc_pv, void **ptr, size_t size, enum assh_alloc_type_e type) [link] 

This typedef is declared in assh/assh.h source file, line 506.

This declaration involves expansion of the ASSH_ALLOCATOR macro.

This is the memory allocator function type. A pointer to function of this type may be passed to the assh_context_create function. The same behavior as the standard realloc function is expected.

See also coremod.

typedef uint8_t assh_bool_t [link] 

This typedef is declared in assh/assh.h source file, line 138.

A simple boolean type used in libassh.

const char * assh_error_str(assh_status_t err) [link] 

This function is declared in assh/assh.h source file, line 239.

This function returns an error string description of the passed error code.

enum assh_severity_e [link] 

This enum is declared in assh/assh.h source file, line 162.

This enum specifies the error severity and must be ored with an enum assh_status_e value.

These values indicate how the state of the session is impacted by the associated error.

Multiple error severity bits may be ored together; in this case the highest bit set prevails. This allows increasing the error severity returned by a callee from the caller function.

See also Error handling.

IdentifierValueDescription
ASSH_ERRSV_CONTINUE0x0000The error is not critical and the connection may continue. This is the default when no severity is specified.
ASSH_ERRSV_DISCONNECT0x2000The error prevent further communication with the remote host but a disconnect packet may still be send before closing the connection.

enum assh_status_e [link] 

This enum is declared in assh/assh.h source file, line 176.

This enum specifies the possible errors returned by the libassh functions and passed to the assh_event_done function.

See also Error handling.

IdentifierValueDescription
ASSH_OK0Success.
ASSH_NO_DATA1No data were available, This is not an error.
ASSH_NOT_FOUND2The requested entry was not found, This is not an error.
ASSH_ERR_IO0x100IO error.
ASSH_ERR_MEM0x101Memory allocation error.
ASSH_ERR_INPUT_OVERFLOW0x102Buffer overflow in input data. Input data contains bad or corrupt data which would result in memory access outside allowed bounds.
ASSH_ERR_OUTPUT_OVERFLOW0x103Output buffer is not large enough to write expected data.
ASSH_ERR_NUM_OVERFLOW0x104Arithmetic overflow on big number.
ASSH_ERR_NUM_COMPARE_FAILED0x105Compare failed on big number.
ASSH_ERR_BAD_VERSION0x106Bad version of the ssh protocol.
ASSH_ERR_BAD_DATA0x107Packet or buffer contains unexpected or corrupt data.
ASSH_ERR_BAD_ARG0x108Invalid function arguments
ASSH_ERR_MAC0x109Message authentication code error.
ASSH_ERR_PROTOCOL0x10aPacket content doesn't match current state of the protocol.
ASSH_ERR_BUSY0x10bRequested operation can not be performed at this time.
ASSH_ERR_CRYPTO0x10cCrypto initialization or processing error.
ASSH_ERR_NOTSUP0x10dUnsupported parameter value.
ASSH_ERR_KEX_FAILED0x10fThe key exchange has failed
ASSH_ERR_MISSING_KEY0x110The required key is not available.
ASSH_ERR_MISSING_ALGO0x111The required algorithm is not available.
ASSH_ERR_WRONG_KEY0x112The key failed to decipher
ASSH_ERR_HOSTKEY_SIGNATURE0x113The host key verification has failed
ASSH_ERR_SERVICE_NA0x114The requested service is not available
ASSH_ERR_NO_AUTH0x115No more authentication method available.
ASSH_ERR_NO_MORE_SERVICE0x116The client has reached the end of list of services to request.
ASSH_ERR_WEAK_ALGORITHM0x117Algorithm or key security level is below defined threshold.
ASSH_ERR_TIMEOUT0x118Protocol timeout.
ASSH_ERR_count1

typedef int_fast16_t assh_status_t [link] 

This typedef is declared in assh/assh.h source file, line 147.

The error code integer type returned by assh functions. It is composed of two parts specified by the enum assh_status_e and enum assh_severity_e enums.

See also ASSH_STATUS, ASSH_SEVERITY and Error handling.

#define ASSH_ALLOCATOR(n) [link] 

This macro is for internal use only.

This macro is declared in assh/assh.h source file, line 498.

This macro specifies the prototype of a memory allocator function.

This macro expands to:

assh_status_t (n)(void *alloc_pv, void **ptr,
size_t size, enum assh_alloc_type_e type)

See also assh_allocator_t.

#define ASSH_ASSERT(expr) [link] 

This macro is for internal use only.

This macro is declared in assh/assh.h source file, line 294.

This macro takes an assh_status_t value returned by a function and asserts that the error code is ASSH_OK.

This macro expands to:

do {
assh_status_t _e_ = (expr);
(void)_e_;
assert((_e_ & 0xfff) == ASSH_OK);
} while(0)

#define ASSH_CT_CTLZ_GEN(n, l) [link] 

This macro is for internal use only.

This macro is declared in assh/assh.h source file, line 566.

This macro generates contant time ctz and clz functions

This macro expands to:

/** @internal @This computes the number of trailing zero bits of a
n bits value in constant time */

ASSH_PV ASSH_INLINE uint_fast8_t assh_ct_ctz##n(uint##n##_t x)
{
x &= -x;
uint##n##_t c = (x & (uint##n##_t)0x5555555555555555ULL) - 1;
c = (c >> 1) ^ ((x & (uint##n##_t)0x3333333333333333ULL) - 1);
c = (c >> 1) ^ ((x & (uint##n##_t)0x0f0f0f0f0f0f0f0fULL) - 1);
if (n > 8)
c = (c >> 1) ^ ((x & (uint##n##_t)0x00ff00ff00ff00ffULL) - 1);
if (n > 16)
c = (c >> 1) ^ ((x & (uint##n##_t)0x0000ffff0000ffffULL) - 1);
if (n > 32)
c = (c >> 1) ^ ((x & (uint##n##_t)0x00000000ffffffffULL) - 1);
return (c >> (n - l)) ^ (c >> (n - l + 1));
}

/** @internal @This computes the number of leading zero bits of a
n bits value in constant time */

ASSH_PV ASSH_INLINE uint_fast8_t assh_ct_clz##n(uint##n##_t x)
{
uint##n##_t a0, a1, a2, a3, a4, j = 0;
a0 = x | (( x & (uint##n##_t)0xaaaaaaaaaaaaaaaaULL) >> 1);
a1 = a0 | ((a0 & (uint##n##_t)0xccccccccccccccccULL) >> 2);
a2 = a1 | ((a1 & (uint##n##_t)0xf0f0f0f0f0f0f0f0ULL) >> 4);
a3 = a2 | ((a2 & (uint##n##_t)0xff00ff00ff00ff00ULL) >> 8);
a4 = a3 | ((a3 & (uint##n##_t)0xffff0000ffff0000ULL) >> 16);
if (n > 32)
j |= (a4 >> (j + 32-5)) & 32;
if (n > 16)
j |= (a3 >> (j + 16-4)) & 16;
if (n > 8)
j |= (a2 >> (j + 8-3)) & 8;
j |= (a1 >> (j + 4-2)) & 4;
j |= (a0 >> (j + 2-1)) & 2;
j |= (x >> (j + 1-0)) & 1;
return j ^ (n - 1);
}

/** @internal @This computes the number of one bits of a
n bits value in constant time */

ASSH_INLINE uint_fast8_t assh_ct_popc##n(uint##n##_t x)
{
x = (x & (uint##n##_t)0x5555555555555555ULL) +
((x >> 1) & (uint##n##_t)0x5555555555555555ULL);
x = (x & (uint##n##_t)0x3333333333333333ULL) +
((x >> 2) & (uint##n##_t)0x3333333333333333ULL);
x = (x & (uint##n##_t)0x0f0f0f0f0f0f0f0fULL) +
((x >> 4) & (uint##n##_t)0x0f0f0f0f0f0f0f0fULL);
if (n > 8)
x = (x & (uint##n##_t)0x00ff00ff00ff00ffULL) +
((x >> 8) & (uint##n##_t)0x00ff00ff00ff00ffULL);
if (n > 16)
x = (x & (uint##n##_t)0x0000ffff0000ffffULL) +
((x >> 16) & (uint##n##_t)0x0000ffff0000ffffULL);
if (n > 32)
x = (x & 0x00000000ffffffffULL) +
(((uint64_t)x >> 32) & 0x00000000ffffffffULL);
return x;
}

#define ASSH_FIRST_FIELD_ASSERT(struct_name, field) [link] 

This macro is for internal use only.

This macro is declared in assh/assh.h source file, line 513.

This checks at compile time that a field is at offset 0 in a structure.

#define ASSH_IDENT [link] 

This macro is for internal use only.

This macro is declared in assh/assh.h source file, line 494.

The SSH implementation identification string. Because this is involved in the shared secret generation process, Changing this breaks the testsuite.

This macro expands to:

"SSH-2.0-LIBASSH\r\n"

#define ASSH_JMP_IF_TRUE(cond, err, label) [link] 

This macro is for internal use only.

This macro is declared in assh/assh.h source file, line 483.

This macro reports on error to the ASSH_JMP_ON_ERR macro if the given expression is true.

This macro expands to:

ASSH_JMP_ON_ERR(cond ? err : 0, label)

#define ASSH_JMP_ON_ERR(expr, label) [link] 

This macro is for internal use only.

This macro is declared in assh/assh.h source file, line 320.

Preprocessor condition: not defined( CONFIG_ASSH_DEBUG )

This macro takes an assh_status_t value returned by a function of the library and assigns it to the locally defined err variable.

It jumps to the provided label for any error codes >= 256. If the code is not an error, the execution continues to the next line..

It can be made verbose by defining the CONFIG_ASSH_DEBUG and CONFIG_ASSH_CALLTRACE macros.

This macro expands to:

do {
if ((err = (expr)) & 0x100)
goto label;
} while (0)

See also enum assh_status_e, assh_status_t, ASSH_RET_ON_ERR and ASSH_RETURN.

#define ASSH_MAX_BLOCK_SIZE 16 [link] 

This macro is for internal use only.

This macro is declared in assh/assh.h source file, line 277.

Maximum cipher block size in bytes. must be >= 16.

#define ASSH_MAX_EKEY_SIZE 64 [link] 

This macro is for internal use only.

This macro is declared in assh/assh.h source file, line 268.

Maximum size of cipher algorithms keys in bytes.

#define ASSH_MAX_HASH_SIZE 64 [link] 

This macro is for internal use only.

This macro is declared in assh/assh.h source file, line 265.

Maximum size of hash algorithms output in bytes.

#define ASSH_MAX_IKEY_SIZE 64 [link] 

This macro is for internal use only.

This macro is declared in assh/assh.h source file, line 271.

Maximum size of mac algorithms keys in bytes.

#define ASSH_MAX_MAC_SIZE 64 [link] 

This macro is for internal use only.

This macro is declared in assh/assh.h source file, line 283.

Maximum mac output size in bytes.

#define ASSH_MAX_SYMKEY_SIZE 64 [link] 

This macro is for internal use only.

This macro is declared in assh/assh.h source file, line 280.

Maximum size of cipher/mac keys or iv in bytes.

#define ASSH_MIN(a, b) [link] 

This macro is for internal use only.

This macro is declared in assh/assh.h source file, line 563.

Use only for constant expressions.

This macro expands to:

((a) < (b) ? (a) : (b))

See also assh_min_int and assh_min_uint.

#define ASSH_MIN_BLOCK_SIZE 8 [link] 

This macro is for internal use only.

This macro is declared in assh/assh.h source file, line 274.

Minimal cipher block size in bytes. Spec says 8

#define ASSH_PCK_POOL_MAX 16 [link] 

This macro is for internal use only.

This macro is declared in assh/assh.h source file, line 260.

Log2 of largest packet size bucket in the packet allocator pool.

#define ASSH_PCK_POOL_MIN 6 [link] 

This macro is for internal use only.

This macro is declared in assh/assh.h source file, line 257.

Log2 of smallest packet size bucket in the packet allocator pool.

#define ASSH_PCK_POOL_SIZE [link] 

This macro is for internal use only.

This macro is declared in assh/assh.h source file, line 262.

Number of buckets in the packet allocator pool

This macro expands to:

#define ASSH_REKEX_THRESHOLD [link] 

This macro is for internal use only.

This macro is declared in assh/assh.h source file, line 286.

Default key re-echange threshold in bytes

This macro expands to:

(1 << 31)

#define ASSH_RETURN(expr) [link] 

This macro is for internal use only.

This macro is declared in assh/assh.h source file, line 355.

Preprocessor condition: not defined( CONFIG_ASSH_DEBUG )

This macro takes an assh_status_t value returned by a function and forwards it to the calling function in any case.

The execution never continues to the next line.

It can be made verbose by defining the CONFIG_ASSH_DEBUG and CONFIG_ASSH_CALLTRACE macros. In the other case, it only performs a function return.

This macro expands to:

do {
(void)err;
return (expr);
} while (0)

See also assh_status_t, ASSH_JMP_ON_ERR and ASSH_RET_ON_ERR.

#define ASSH_RET_IF_TRUE(cond, err) [link] 

This macro is for internal use only.

This macro is declared in assh/assh.h source file, line 488.

This macro reports on error to the ASSH_RET_ON_ERR macro if the given expression is true.

This macro expands to:

ASSH_RET_ON_ERR(cond ? err : 0)

#define ASSH_RET_ON_ERR(expr) [link] 

This macro is for internal use only.

This macro is declared in assh/assh.h source file, line 338.

Preprocessor condition: not defined( CONFIG_ASSH_DEBUG )

This macro takes an assh_status_t value returned by a function and assigns it to the locally defined err variable.

It forwards the error to the calling function for any error codes >= 256. If the code is not an error, the execution continues to the next line.

It can be made verbose by defining the CONFIG_ASSH_DEBUG and CONFIG_ASSH_CALLTRACE macros.

This macro expands to:

do {
if ((err = (expr)) & 0x100)
return err;
} while (0)

See also enum assh_status_e, assh_status_t, ASSH_JMP_ON_ERR and ASSH_RETURN.

#define ASSH_SET_STATE(obj, field, value) [link] 

This macro is for internal use only.

This macro is declared in assh/assh.h source file, line 467.

Preprocessor condition: defined( CONFIG_ASSH_FSMTRACE )

This macro is used to change the state variable of finite state machines. It can be made verbose by defining the CONFIG_ASSH_FSMTRACE macro.

This macro expands to:

do {
fprintf(stderr, "%s:%u:%s: " #field " update %u -> %u:" #value" \n",
__FILE__, __LINE__, __func__, (obj)->field, value);
(obj)->field = value;
} while (0)

#define ASSH_STATIC_ASSERT(expr, msgid) [link] 

This macro is for internal use only.

This macro is declared in assh/assh.h source file, line 508.

This checks expression at compile time.

const char ** assh_charptr_cast(char **p) [link] 

This function is for internal use only.

This function is declared in assh/assh.h source file, line 521.

uint_fast8_t assh_ct_clz16(uint16_t x) [link] 

This function is for internal use only.

This function is declared in ASSH_CT_CTLZ_GEN function like macro expansion, line 22 in assh/assh.h source file, line 630.

This function computes the number of leading zero bits of a 16 bits value in constant time

uint_fast8_t assh_ct_clz32(uint32_t x) [link] 

This function is for internal use only.

This function is declared in ASSH_CT_CTLZ_GEN function like macro expansion, line 22 in assh/assh.h source file, line 631.

This function computes the number of leading zero bits of a 32 bits value in constant time

uint_fast8_t assh_ct_clz64(uint64_t x) [link] 

This function is for internal use only.

This function is declared in ASSH_CT_CTLZ_GEN function like macro expansion, line 22 in assh/assh.h source file, line 632.

This function computes the number of leading zero bits of a 64 bits value in constant time

uint_fast8_t assh_ct_clz8(uint8_t x) [link] 

This function is for internal use only.

This function is declared in ASSH_CT_CTLZ_GEN function like macro expansion, line 22 in assh/assh.h source file, line 629.

This function computes the number of leading zero bits of a 8 bits value in constant time

uint_fast8_t assh_ct_ctz16(uint16_t x) [link] 

This function is for internal use only.

This function is declared in ASSH_CT_CTLZ_GEN function like macro expansion, line 5 in assh/assh.h source file, line 630.

This function computes the number of trailing zero bits of a 16 bits value in constant time

uint_fast8_t assh_ct_ctz32(uint32_t x) [link] 

This function is for internal use only.

This function is declared in ASSH_CT_CTLZ_GEN function like macro expansion, line 5 in assh/assh.h source file, line 631.

This function computes the number of trailing zero bits of a 32 bits value in constant time

uint_fast8_t assh_ct_ctz64(uint64_t x) [link] 

This function is for internal use only.

This function is declared in ASSH_CT_CTLZ_GEN function like macro expansion, line 5 in assh/assh.h source file, line 632.

This function computes the number of trailing zero bits of a 64 bits value in constant time

uint_fast8_t assh_ct_ctz8(uint8_t x) [link] 

This function is for internal use only.

This function is declared in ASSH_CT_CTLZ_GEN function like macro expansion, line 5 in assh/assh.h source file, line 629.

This function computes the number of trailing zero bits of a 8 bits value in constant time

uint_fast8_t assh_ct_popc16(uint16_t x) [link] 

This function is for internal use only.

This function is declared in ASSH_CT_CTLZ_GEN function like macro expansion, line 44 in assh/assh.h source file, line 630.

This function computes the number of one bits of a 16 bits value in constant time

uint_fast8_t assh_ct_popc32(uint32_t x) [link] 

This function is for internal use only.

This function is declared in ASSH_CT_CTLZ_GEN function like macro expansion, line 44 in assh/assh.h source file, line 631.

This function computes the number of one bits of a 32 bits value in constant time

uint_fast8_t assh_ct_popc64(uint64_t x) [link] 

This function is for internal use only.

This function is declared in ASSH_CT_CTLZ_GEN function like macro expansion, line 44 in assh/assh.h source file, line 632.

This function computes the number of one bits of a 64 bits value in constant time

uint_fast8_t assh_ct_popc8(uint8_t x) [link] 

This function is for internal use only.

This function is declared in ASSH_CT_CTLZ_GEN function like macro expansion, line 44 in assh/assh.h source file, line 629.

This function computes the number of one bits of a 8 bits value in constant time

void assh_hexdump(void *stream, const char *name, const void *data, size_t len) [link] 

This function is for internal use only.

This function is declared in assh/assh.h source file, line 291.

intptr_t assh_max_int(intptr_t a, intptr_t b) [link] 

This function is for internal use only.

This function is declared in assh/assh.h source file, line 539.

uintptr_t assh_max_uint(uintptr_t a, uintptr_t b) [link] 

This function is for internal use only.

This function is declared in assh/assh.h source file, line 533.

intptr_t assh_min_int(intptr_t a, intptr_t b) [link] 

This function is for internal use only.

This function is declared in assh/assh.h source file, line 551.

uintptr_t assh_min_uint(uintptr_t a, uintptr_t b) [link] 

This function is for internal use only.

This function is declared in assh/assh.h source file, line 545.

const uint8_t ** assh_uint8ptr_cast(uint8_t **p) [link] 

This function is for internal use only.

This function is declared in assh/assh.h source file, line 527.

Valid XHTML 1.0 StrictGenerated by diaxen on Sun Oct 25 23:31:03 2020 using MkDoc