⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

Module cipher

Module cipher 

Source
Expand description

TLS 1.3 Cipher Suites and Cryptographic Primitives

Implements all crypto needed for TLS 1.3:

  • HMAC-SHA256 (RFC 2104)
  • HKDF-SHA256 (RFC 5869)
  • X25519 key exchange (RFC 7748)
  • ChaCha20-Poly1305 AEAD (RFC 8439)
  • AES-128-GCM AEAD (NIST SP 800-38D)

Functions§

hkdf_expand
HKDF-Expand: OKM = T(1) || T(2) || … (truncated to length)
hkdf_expand_label
HKDF-Expand-Label (TLS 1.3 specific, RFC 8446 Section 7.1)
hkdf_extract
HKDF-Extract: PRK = HMAC-Hash(salt, IKM)
hmac_sha256
HMAC-SHA256 (RFC 2104)
x25519_keypair
Generate an X25519 keypair using the kernel’s CSPRNG
x25519_shared_secret
Compute X25519 shared secret: shared = scalar_mult(our_private, their_public)