Skip to content

Declared in <galanthus/c_api/gln_capi.h>.

GLN_API gln_status_t GLN_CALL gln_load_local_cache(
    const char*  in_cache_path,
    const char*  in_key_path_or_null,
    uint8_t**    out_payload,
    size_t*      out_payload_len,
    gln_error_t* out_error);
  • Family: Local cache functions
  • Return type: gln_status_t

Purpose

Loads and decrypts one local-cache payload previously written by gln_save_local_cache.

A missing cache file is reported with GLN_ERR_NOT_FOUND after clearing the output payload pointer and length.

Nullable parameter slots (in_key_path_or_null, out_error) may be passed as NULL; all other non-value parameters follow the nullability shown in the table.

Return

Returns GLN_OK on success and a non-OK gln_status_t value on failure.

TypeNullabilityOwnership
gln_status_tvaluevalue

Parameters

NameDirectionTypeNullabilityOwnership
in_cache_pathinputconst char*nonnullborrowed
in_key_path_or_nullinputconst char*nullableborrowed
out_payloadoutputuint8_t**nonnulltransferred_out
out_payload_lenoutputsize_t*nonnullcaller_allocated_output
out_erroroutputgln_error_t*nullablecaller_allocated_output

Path Semantics

in_cache_path and in_key_path_or_null must identify the same payload and sidecar pair used for saving.

Missing Cache

When the payload has not been saved, the function returns GLN_ERR_NOT_FOUND and sets *out_payload to NULL and *out_payload_len to zero.

Output Ownership

On GLN_OK, *out_payload is owned by the caller and must be released with gln_release_buffer. A zero-length cache may return NULL with length zero.

Failure Cases

Tampering, wrong sidecar key, wrong protected-key purpose, malformed ciphertext, or payloads above the storage layer's maximum decompressed size return a non-OK status.

See Also