Skip to main content

apply_security

Function apply_security 

Source
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:

  1. Writes the Security Header after header_end
  2. Encrypts the data field if needed (AEAD for GCM)
  3. Computes and writes the MAC if needed

The caller must have left room for the security overhead.