SilcCryptoAPI/silc_crypto_stack

SYNOPSIS

    SilcStack silc_crypto_stack(void);

DESCRIPTION

Returns the SILC Crypto Toolkit's global stack, the memory pool. Returns NULL if the stack does not exist.

A common way to use this is to allocate a child stack from the returned stack. That operation is thread-safe, usually does not allocate any memory and is very fast. Another way to use the stack is to push it when memory is needed and then pop it when it is not needed anymore. Note however, that is not thread-safe if the stack is used in multi-threaded environment.

EXAMPLE

    SilcStack stack;

    // Get child stack from global crypto stack
    stack = silc_stack_alloc(0, silc_crypto_stack());
    ...

    // Return memory back to the global crypto stack
    silc_stack_free(stack);