Rust wrappers around the SSC C library.
| Module | Contents |
|---|---|
c |
FFI type aliases mirroring SSC_Typedef.h, and the shared SscError type. |
cli |
Command-line argument classification and parsing (CommandLineArg.h). |
file |
File handles and path procedures (File.h). |
mem |
System memory queries and the OS page size (Memory.h). |
mmap |
Memory-mapped files, including secret RAM-backed maps (MemMap.h). |
op |
Secure zeroing, constant-time comparison, and zero checks (Operation.h). |
print |
Byte printing in hexadecimal/binary (Print.h). |
proc |
Executable path and processor count (Process.h). |
rand |
OS entropy (Random.h). |
sbox |
Secret-memory boxes whose contents are securely zeroed on drop. |
SSC's header-only inline procedures (e.g. SSC_getPageSize, SSC_alignedMalloc,
SSC_printBytes) are not exported by the compiled library and therefore cannot be
linked from Rust; where useful they are reimplemented in Rust (see
mem::get_page_size, print::print_bytes_hex, cli::one_opt).
Build and install (or otherwise make linkable) the SSC C library first, e.g.:
cmake -S /path/to/SSC -B /path/to/SSC/build
cmake --build /path/to/SSC/buildThen point this crate's build script at the directory containing
libSSC.so / libSSC.dylib / SSC.lib:
SSC_DIR=/path/to/SSC/build cargo buildWhen SSC_DIR is unset, the system default library search paths are used.
Linux and Windows, mirroring the platforms supported by SSC.
A handful of procedures are platform-specific in SSC itself and are gated
accordingly (e.g. secret files/maps require Linux with memfd_secret() support,
kernel >= 5.14). Secret file/map features are additionally runtime-probed via
SSC_File_createSecretIsAvailable(); see file::File::create_secret_is_available
and mmap::Map::supports_secret.
Cargo features mirror SSC's compile-time availability macros, and are all enabled by default:
SSC_File_createSecret,SSC_MemMap_initSecret(Linux only)SSC_getExecutablePath(Linux/Windows)SSC_getNumberProcessors,SSC_getTotalSystemMemory,SSC_getAvailableSystemMemory(Unix-like/Windows)
SSC_DIR=/path/to/SSC/build cargo run --example memmap_demoSSC_DIR=/path/to/SSC/build cargo testGPL-3.0-or-later, matching the SSC C library. See LICENSE.