File: crypto.rs

package info (click to toggle)
rust-procfs 0.17.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 664 kB
  • sloc: makefile: 2
file content (28 lines) | stat: -rw-r--r-- 1,048 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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!();
        }
    }
}