keymgr: Import internal! (fmt).

This commit is contained in:
Gabriela Moldovan 2023-07-25 11:53:59 +01:00
parent 0b109f3ee8
commit abf83ecfa6
No known key found for this signature in database
GPG Key ID: 3946E0ADE72BAC99
1 changed files with 2 additions and 4 deletions

View File

@ -8,7 +8,7 @@ use ssh_key::Algorithm;
use crate::{ErasedKey, KeyType, KeystoreError, Result}; use crate::{ErasedKey, KeyType, KeystoreError, Result};
use tor_error::{ErrorKind, HasKind, internal}; use tor_error::{internal, ErrorKind, HasKind};
use tor_llcrypto::pk::{curve25519, ed25519}; use tor_llcrypto::pk::{curve25519, ed25519};
use zeroize::Zeroizing; use zeroize::Zeroizing;
@ -165,9 +165,7 @@ impl KeyType {
// we're using internally). // we're using internally).
match sk.key_data() { match sk.key_data() {
KeypairData::Ed25519(key) => Ok(ed25519::Keypair::from_bytes(&key.to_bytes()) KeypairData::Ed25519(key) => Ok(ed25519::Keypair::from_bytes(&key.to_bytes())
.map_err(|_| { .map_err(|_| internal!("failed to build ed25519 key out of ed25519 OpenSSH key"))
internal!("failed to build ed25519 key out of ed25519 OpenSSH key")
})
.map(Box::new)?), .map(Box::new)?),
KeypairData::Other(key) KeypairData::Other(key)
if SshKeyAlgorithm::from(key.algorithm()) == SshKeyAlgorithm::X25519 => if SshKeyAlgorithm::from(key.algorithm()) == SshKeyAlgorithm::X25519 =>