Type Definition bearssl::br_chacha20_run [] [src]

type br_chacha20_run = Option<unsafe extern "C" fn(_: *const c_void, _: *const c_void, _: u32, _: *mut c_void, _: usize) -> u32>;

\brief Type for a ChaCha20 implementation.

An implementation follows the description in RFC 7539:

  • Key is 256 bits (key points to exactly 32 bytes).

  • IV is 96 bits (iv points to exactly 12 bytes).

  • Block counter is over 32 bits and starts at value cc; the resulting value is returned.

Data (pointed to by data, of length len) is encrypted/decrypted in place. If len is not a multiple of 64, then the excess bytes from the last block processing are dropped (therefore, "chunked" processing works only as long as each non-final chunk has a length multiple of 64).

\param key secret key (32 bytes). \param iv IV (12 bytes). \param cc initial counter value. \param data data to encrypt or decrypt. \param len data length (in bytes).