Skip to documentation
SLOP

tiny.reticulum.crypto

Reference tiny.reticulum crypto

Defined in tiny.reticulum.

The constructions a Reticulum payload is sealed with once both ends already share a key: AES in cipher block chaining mode, the padding that fills a plaintext out to whole blocks, HMAC-SHA256, the key derivation that turns one secret into as many bytes as a caller needs, and the sealed format that composes them.

API (5)

Namespaces

Public namespaces.

No direct callersNo direct callstiny.reticulumcrypto
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: lib/reticulum/src/crypto/root.zig

zig
//! The constructions a Reticulum payload is sealed with once both ends already//! share a key: AES in cipher block chaining mode, the padding that fills a//! plaintext out to whole blocks, HMAC-SHA256, the key derivation that turns//! one secret into as many bytes as a caller needs, and the sealed format that//! composes them.//!//! What this code produces has to match the reference byte for byte, because//! the program at the other end is a different implementation. The code runs//! where memory is fixed before the program starts, so every call works in a//! buffer the caller owns. A tag comparison that gives away how many bytes//! matched would hand an attacker a way to forge one, so the comparison runs in//! constant time.//!//! The primitives themselves come from the standard library, and what//! interoperability turns on is the framing around them: where the//! initialization vector sits, where the tag sits, which half of a key does//! which job, and how the derivation counts its blocks. The reference is//! written in Python, and its unpadding inherits Python's own slicing behavior//! when the final byte claims more padding than the data holds.//!//! The subtree follows Reticulum 1.5.0, the reference implementation, pinned to//! one upstream commit by the package README and the generated conformance//! corpus. What it takes is the block cipher use of Reticulum@1.5.0//! RNS/Cryptography/AES.py:43-111, the padding of Reticulum@1.5.0//! RNS/Cryptography/PKCS7.py:32-48, the signing and comparison of//! Reticulum@1.5.0 RNS/Cryptography/HMAC.py:27-45,185-188, the derivation of//! Reticulum@1.5.0 RNS/Cryptography/HKDF.py:35-62, and the sealed layout of//! Reticulum@1.5.0 RNS/Cryptography/Token.py:61-114. The package generates//! token, derivation, and padding vectors from that release and replays them in//! tests, so each of those claims is checkable from this tree.//!//! Every call here writes into a slice the caller supplied and returns a slice//! of it, so this code calls no allocator. The sealed format (a *token*)//! borrows its two key halves from the caller's bytes and copies nothing. A//! call whose input and output buffers overlap is refused, and the block cipher//! allows the one case where they start at the same address. Unpadding//! reproduces the reference's Python slicing, so a final byte claiming more//! padding than the data holds gives what the reference gives. The subtree//! names its pieces: the block cipher, the derivation, the tag, the padding,//! and the sealed format.//!//! - *token key*: 32 or 64 bytes split in half, the first half signing and the//!   second half encrypting, with the total length picking AES-128 or AES-256.pub const cbc = @import("cbc.zig");pub const hkdf = @import("hkdf.zig");pub const hmac = @import("hmac.zig");pub const pkcs7 = @import("pkcs7.zig");pub const token = @import("token.zig");

Source: lib/reticulum/src/root.zig:59

zig
pub const crypto = @import("crypto/root.zig");

Audit

Definitions1
Public names1
Members0
Version26.7.0
Revisiondaab053ee433