mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
move the MAC (i.e. tag) above the variable length AAD field.
This commit is contained in:
parent
588e7aaf0a
commit
d9b29c2d06
1 changed files with 3 additions and 3 deletions
|
|
@ -38,13 +38,13 @@ impl SwapHeader {
|
||||||
// note that the nonce is in big-endian format, as is expected for cryptographic matter
|
// note that the nonce is in big-endian format, as is expected for cryptographic matter
|
||||||
data.write(&self.partial_nonce.to_be_bytes())?;
|
data.write(&self.partial_nonce.to_be_bytes())?;
|
||||||
|
|
||||||
|
// serialize the MAC data offset
|
||||||
|
data.write(&(self.mac_offset as u32).to_le_bytes())?; // LE because this is a size field
|
||||||
|
|
||||||
// serialize the AAD
|
// serialize the AAD
|
||||||
data.write(&(self.aad.len() as u32).to_le_bytes())?; // LE because this is a size field
|
data.write(&(self.aad.len() as u32).to_le_bytes())?; // LE because this is a size field
|
||||||
data.write(&self.aad)?; // BE because this is cryptographic matter
|
data.write(&self.aad)?; // BE because this is cryptographic matter
|
||||||
|
|
||||||
// serialize the MAC data offset
|
|
||||||
data.write(&(self.mac_offset as u32).to_le_bytes())?; // LE because this is a size field
|
|
||||||
|
|
||||||
output[..data.position() as usize].copy_from_slice(&data.into_inner());
|
output[..data.position() as usize].copy_from_slice(&data.into_inner());
|
||||||
|
|
||||||
Ok(output)
|
Ok(output)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue