mirror of
https://github.com/rosenpass/rosenpass.git
synced 2026-02-27 22:13:12 -08:00
Implements: - An additional allocator to use memfd_secret(2) and guard pages using mmap(2), implemented in quininer/memsec#16 - An allocator that abstracts away underlying allocators, and uses specified allocator set by rosenpass_secret_memory::policy functions (or a function that sets rosenpass_secret_memory::alloc::ALLOC_INIT - Updates to tests- integration, fuzz, bench: some tests use procspawn to spawn multiple processes with different allocator policies
50 lines
1.1 KiB
Rust
50 lines
1.1 KiB
Rust
use std::process::exit;
|
|
|
|
use cli::{Cli, Command};
|
|
use exchange::exchange;
|
|
use key::{genkey, pubkey};
|
|
use rosenpass_secret_memory::policy;
|
|
|
|
mod cli;
|
|
mod exchange;
|
|
mod key;
|
|
|
|
#[tokio::main]
|
|
async fn main() {
|
|
policy::secret_policy_try_use_memfd_secrets();
|
|
|
|
let cli = match Cli::parse(std::env::args().peekable()) {
|
|
Ok(cli) => cli,
|
|
Err(err) => {
|
|
eprintln!("{}", err);
|
|
exit(1);
|
|
}
|
|
};
|
|
|
|
let command = cli.command.unwrap();
|
|
|
|
let res = match command {
|
|
Command::GenKey { private_keys_dir } => genkey(&private_keys_dir),
|
|
Command::PubKey {
|
|
private_keys_dir,
|
|
public_keys_dir,
|
|
} => pubkey(&private_keys_dir, &public_keys_dir),
|
|
Command::Exchange(mut options) => {
|
|
options.verbose = cli.verbose;
|
|
exchange(options).await
|
|
}
|
|
Command::Help => {
|
|
println!("Usage: rp [verbose] genkey|pubkey|exchange [ARGS]...");
|
|
Ok(())
|
|
}
|
|
};
|
|
|
|
match res {
|
|
Ok(_) => {}
|
|
Err(err) => {
|
|
eprintln!("An error occurred: {}", err);
|
|
exit(1);
|
|
}
|
|
}
|
|
}
|