Type Definition bearssl::br_ghash [] [src]

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

\brief Type for a GHASH implementation.

GHASH is a sort of keyed hash meant to be used to implement GCM in combination with a block cipher (with 16-byte blocks).

The y array has length 16 bytes and is used for input and output; in a complete GHASH run, it starts with an all-zero value. h is a 16-byte value that serves as key (it is derived from the encryption key in GCM, using the block cipher). The data length (len) is expressed in bytes. The y array is updated.

If the data length is not a multiple of 16, then the data is implicitly padded with zeros up to the next multiple of 16. Thus, when using GHASH in GCM, this method may be called twice, for the associated data and for the ciphertext, respectively; the zero-padding implements exactly the GCM rules.

\param y the array to update. \param h the GHASH key. \param data the input data (may be NULL if len is zero). \param len the input data length (in bytes).