-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented example for /dev/crypto parser
- Loading branch information
Chris Bury
committed
Aug 5, 2024
1 parent
784dd2c
commit e0dec8b
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use std::env::args; | ||
|
||
use procfs::crypto; | ||
|
||
pub fn main() { | ||
let crypto = crypto().expect("Was not able to access current crypto"); | ||
let name_arg = args().nth(1); | ||
for (name, entries) in crypto.crypto_blocks { | ||
if let Some(ref name_find) = name_arg { | ||
if !name.contains(name_find) { | ||
continue; | ||
} | ||
} | ||
println!("Type: {name}"); | ||
for block in entries { | ||
println!("{:>14}: {}", "Name", block.name); | ||
println!("{:>14}: {}", "Driver", block.driver); | ||
println!("{:>14}: {}", "Module", block.module); | ||
println!("{:>14}: {}", "Priority", block.priority); | ||
println!("{:>14}: {}", "Ref Count", block.ref_count); | ||
println!("{:>14}: {:?}", "Self Test", block.self_test); | ||
println!("{:>14}: {}", "Internal", block.internal); | ||
println!("{:>14}: {}", "fips enabled", block.fips_enabled); | ||
println!("{:>14}: {:?}", "Type Details", block.crypto_type); | ||
println!(); | ||
} | ||
} | ||
} |