Skip to content
stuartcalderPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

24 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rssc

Rust wrappers around the SSC C library.

Modules

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).

Requirements

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/build

Then point this crate's build script at the directory containing libSSC.so / libSSC.dylib / SSC.lib:

SSC_DIR=/path/to/SSC/build cargo build

When SSC_DIR is unset, the system default library search paths are used.

Platform support

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.

Features

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)

Example

SSC_DIR=/path/to/SSC/build cargo run --example memmap_demo

See examples/memmap_demo.rs.

Testing

SSC_DIR=/path/to/SSC/build cargo test

License

GPL-3.0-or-later, matching the SSC C library. See LICENSE.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages