-
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.
Merge pull request #315 from Hwatwasthat/master
Implemented crypto example
- Loading branch information
Showing
2 changed files
with
48 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
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!(); | ||
} | ||
} | ||
} |