Fixes for Hati

Signed-off-by: Luca Fulchir <luca.fulchir@runesauth.com>
This commit is contained in:
Luca Fulchir 2023-06-07 11:07:46 +02:00
parent 6da5464c68
commit 787e11e8e4
Signed by: luca.fulchir
GPG Key ID: 8F6440603D13A78E
2 changed files with 11 additions and 2 deletions

View File

@ -282,11 +282,19 @@ impl PrivKey {
PrivKey::Signing => todo!(),
}
}
/// return the kind of public key
pub fn kind(&self) -> KeyKind {
match self {
PrivKey::Signing => todo!(),
PrivKey::Exchange(ex) => ex.kind(),
}
}
/// serialize the key into the buffer
/// NOTE: Assumes there is enough space
pub fn serialize_into(&self, out: &mut [u8]) {
out[0] = self.kind() as u8;
match self {
PrivKey::Exchange(ex) => ex.serialize_into(out),
PrivKey::Exchange(ex) => ex.serialize_into(&mut out[1..]),
PrivKey::Signing => todo!(),
}
}
@ -336,7 +344,7 @@ impl ExchangePrivKey {
pub fn serialize_into(&self, out: &mut [u8]) {
match self {
ExchangePrivKey::X25519(key) => {
out[..32].copy_from_slice(&key.to_bytes());
out[0..32].copy_from_slice(&key.to_bytes());
}
}
}

View File

@ -354,6 +354,7 @@ impl Fenrir {
}
}
// TODO: start work on a LocalSet provided by the user
/// Start one working thread for each physical cpu
/// threads are pinned to each cpu core.
/// Work will be divided and rerouted so that there is no need to lock