Fix Rsa serialization order

This commit is contained in:
Sosthène Guédon
2023-01-04 11:34:17 +01:00
parent be9a69d463
commit 17e470a3c1
+11 -11
View File
@@ -1040,26 +1040,26 @@ impl<'a, T: trussed::Client + trussed::client::Ed255> LoadedAuthenticator<'a, T>
AsymmetricAlgorithms::Rsa2048 | AsymmetricAlgorithms::Rsa4096 => {
reply.expand(&[0x7F, 0x49])?;
let offset = reply.len();
let serialized_e = syscall!(self.trussed.serialize_key(
parsed_mechanism.key_mechanism(),
public_key,
trussed::types::KeySerialization::RsaE
))
.serialized_key;
reply.expand(&[0x81])?;
reply.append_len(serialized_e.len())?;
reply.expand(&serialized_e)?;
let serialized_n = syscall!(self.trussed.serialize_key(
parsed_mechanism.key_mechanism(),
public_key,
trussed::types::KeySerialization::RsaN
))
.serialized_key;
reply.expand(&[0x82])?;
reply.expand(&[0x81])?;
reply.append_len(serialized_n.len())?;
reply.expand(&serialized_n)?;
let serialized_e = syscall!(self.trussed.serialize_key(
parsed_mechanism.key_mechanism(),
public_key,
trussed::types::KeySerialization::RsaE
))
.serialized_key;
reply.expand(&[0x82])?;
reply.append_len(serialized_e.len())?;
reply.expand(&serialized_e)?;
reply.prepend_len(offset)?;
}
};