How afdursun/kyber-pake-c works
Kyber.PAKE extends Kyber’s lattice-based key encapsulation with password-based authentication, explicit mutual authentication, and a shared session key. The documented user-to-result workflow is a four-stage exchange—client C0, server S0, client C1, server S1—across three flows. The sampled protocol source shows password-derived polynomial material, Kyber key/ciphertext operations, and verification; the README documents the phase sequence. The graph also includes the CPA-Kyber and arithmetic/hash layers. S1’s implementation details and some protocol transitions are not visible in the excerpts, so those links are documented rather than inferred from code.
Main entry points: indcpa.c CPA Encryption · kyber-pake.c Client C0 · poly.c Polynomial Ops · symmetric.h Symmetric API
Components 20
PAKE Protocol
- Client C0
kyber-pake.c - Server S0
kyber-pake.c - Client C1
kyber-pake.c - Server S1
kyber-pake.c - Password Mapping
kyber-pake.c
Kyber KEM
- CPA Encryption
indcpa.c - KEM Operations
kyber-pake.c
Lattice Arithmetic
- Polynomial Ops
poly.c - Polynomial Vectors
polyvec.c - NTT Arithmetic
ntt.c - Modular Reduction
reduce.c - Noise Sampling
cbd.c
Crypto Primitives
- Symmetric API
symmetric.h - SHAKE / SHA-3
fips202.c - AES-CTR
aes256ctr.c - SHA-2
sha256.c - Random Bytes
randombytes.c - Verification
verify.c
Other components
- Client
- Server
Connections 26
- Client → Client C0: starts exchange
README.md - Client C0 → Server: sends flow
README.md - Server → Server S0: handles flow
README.md - Server S0 → Client: sends flow
README.md - Client → Client C1: continues exchange
README.md - Client C1 → Server: sends flow
README.md - Server → Server S1: handles flow
README.md - Client C0 → Password Mapping: derives password material
kyber-pake.c - Client C0 → Random Bytes: requests random bytes
kyber-pake.c - Client C0 → CPA Encryption: generates CPA keypair
kyber-pake.c - Server S0 → KEM Operations: encapsulates key
kyber-pake.c - Client C1 → KEM Operations: decapsulates key
kyber-pake.c - Client C1 → Verification: checks received data
kyber-pake.c - KEM Operations → CPA Encryption: encrypts and decrypts
kyber-pake.c - CPA Encryption → Polynomial Ops: uses polynomial ops
indcpa.c - CPA Encryption → Polynomial Vectors: uses vector ops
indcpa.c - CPA Encryption → Symmetric API: uses symmetric API
indcpa.c - CPA Encryption → Random Bytes: samples key seed
indcpa.c - Polynomial Ops → NTT Arithmetic: transforms coefficients
poly.c - Polynomial Ops → Noise Sampling: samples coefficients
poly.c - Polynomial Ops → Symmetric API: uses PRF
poly.c - Polynomial Vectors → Polynomial Ops: operates on polynomials
polyvec.c - NTT Arithmetic → Modular Reduction: reduces values
ntt.c - Symmetric API → SHAKE / SHA-3: selects SHAKE backend
- Symmetric API → AES-CTR: selects AES backend
- Symmetric API → SHA-2: selects SHA-2 backend
symmetric.h