pub fn apply_security(
sa: &mut SecurityAssociation,
crypto: &impl CryptoProvider,
frame: &mut [u8],
header_end: usize,
data_start: usize,
data_end: usize,
) -> Result<(), Error>Expand description
Apply security processing to a frame (sending side).
Given a frame buffer with the transfer frame header already written, this function:
- Writes the Security Header after
header_end - Encrypts the data field if needed (AEAD for GCM)
- Computes and writes the MAC if needed
The caller must have left room for the security overhead.