Replace getrandom with rand_core (#276)
`rand_core::OsRng` provides a facade over `getrandom` which simplifies error handling.
This commit is contained in:
committed by
GitHub
parent
1018127843
commit
e249e91297
+10
-5
@@ -65,17 +65,22 @@ pub struct Config {
|
||||
pub mgm_type: MgmType,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
/// Get YubiKey config.
|
||||
pub(crate) fn get(yubikey: &mut YubiKey) -> Result<Config> {
|
||||
let mut config = Config {
|
||||
impl Default for Config {
|
||||
fn default() -> Config {
|
||||
Config {
|
||||
protected_data_available: false,
|
||||
puk_blocked: false,
|
||||
puk_noblock_on_upgrade: false,
|
||||
pin_last_changed: None,
|
||||
mgm_type: MgmType::Manual,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Config {
|
||||
/// Get YubiKey config.
|
||||
pub(crate) fn get(yubikey: &mut YubiKey) -> Result<Config> {
|
||||
let mut config = Self::default();
|
||||
let txn = yubikey.begin_transaction()?;
|
||||
|
||||
if let Ok(admin_data) = AdminData::read(&txn) {
|
||||
|
||||
Reference in New Issue
Block a user