Function bearssl::br_gcm_get_tag [] [src]

pub unsafe extern "C" fn br_gcm_get_tag(
    ctx: *mut br_gcm_context,
    tag: *mut c_void
)

\brief Compute GCM authentication tag.

Compute the GCM authentication tag. The tag is a 16-byte value which is written in the provided tag buffer. This call terminates the GCM run: no data may be processed with that GCM context afterwards, until br_gcm_reset() is called to initiate a new GCM run.

The tag value must normally be sent along with the encrypted data. When decrypting, the tag value must be recomputed and compared with the received tag: if the two tag values differ, then either the tag or the encrypted data was altered in transit. As an alternative to this function, the br_gcm_check_tag() function can be used to compute and check the tag value.

\param ctx GCM context structure. \param tag destination buffer for the tag (16 bytes).