Bastion
Bastion is a hardened MLSigcrypt crate focused on strict operational constraints:
- MLSigcrypt-v3 level-3 signcryption over an algebraic encapsulation + ML-DSA-87
- shared signing-mask / encapsulation randomness in the packet path
- zeroization of sensitive material
- bounded public API with timing-floor normalization
- runtime dependency-free (
[dependencies]is empty) - allocation-aware measurement workflow
Public API
Only these crate-level functions are public:
mlsigcrypt_keygenmlsigcrypt_signcryptmlsigcrypt_unsigncrypt
The crate also exposes public size constants for buffer sizing:
MLSIGCRYPT_PUBLIC_KEY_SIZEMLSIGCRYPT_SECRET_KEY_SIZEMLSIGCRYPT_PACKET_OVERHEAD
Current signatures are buffer-oriented (caller provides output memory):
;
;
;
Install
[]
= "0.7.0"
Quick Start
MLSigcrypt-v3 Unified Signcryption
MLSIGCRYPT_PACKET_OVERHEAD is the fixed packet cost excluding the payload ciphertext.
use ;
let aad = b"context";
let msg = b"signcrypted";
let mut sender_pk = ;
let mut sender_sk = ;
let mut recipient_pk = ;
let mut recipient_sk = ;
let mut packet = vec!;
let mut plaintext = vec!;
mlsigcrypt_keygen?;
mlsigcrypt_keygen?;
let packet_len =
mlsigcrypt_signcrypt?;
let plain_len = mlsigcrypt_unsigncrypt?;
assert_eq!;
# Ok::
Security and Engineering Constraints
- Secret material is zeroized in internal key/signing paths.
- MLSigcrypt-v3 level 3 uses a split packet layout (
encap | z | c_tilde | h | ct_len | ct) with a 7657-byte fixed overhead in the current exact-encoding implementation. - Public key-generation paths are buffer-oriented and zeroize transient seeds/intermediates.
- Public API wrappers enforce timing floors.
- Public API paths are allocation-aware; measurements are generated by
write_results. - Key material stays as raw caller-owned byte buffers; no public heap-backed containers are exposed.
See SECURITY.md for the detailed model and verification process.
Verification Workflow
# Formatting and checks
# Benchmarks
# Allocation + memory + timing-spread report
# Fuzzing targets (cargo-fuzz + nightly)
Repository Layout
src/lib.rspublic MLSigcrypt APIsrc/mlsigcrypt/MLSigcrypt-v3 protocol orchestration and internal packet logicsrc/mlsigcrypt/specs/internal spec modules: algebraic encapsulation, Keccak/SHAKE, consolidated SHA3-512/SHA-512 hashing, MLsrc/constant_time.rsconstant-time comparison helperssrc/zeroize.rszeroization primitivesexamples/usage and reporting toolsbenches/criterion benchmark suitesfuzz/libFuzzer targets
License
Licensed under MIT OR Apache-2.0.