Function bearssl::br_hmac_outCT [] [src]

pub unsafe extern "C" fn br_hmac_outCT(
    ctx: *const br_hmac_context,
    data: *const c_void,
    len: usize,
    min_len: usize,
    max_len: usize,
    out: *mut c_void
) -> usize

\brief Constant-time HMAC computation.

This function compute the HMAC output in constant time. Some extra input bytes are processed, then the output is computed. The extra input consists in the len bytes pointed to by data. The len parameter must lie between min_len and max_len (inclusive); max_len bytes are actually read from data. Computing time (and memory access pattern) will not depend upon the data byte contents or the value of len.

The output is written in the out buffer, that MUST be large enough to receive it.

The difference max_len - min_len MUST be less than 230 (i.e. about one gigabyte).

This function computes the output properly only if the underlying hash function uses MD padding (i.e. MD5, SHA-1, SHA-224, SHA-256, SHA-384 or SHA-512).

The provided context is NOT modified.

\param ctx the (already initialised) HMAC computation context. \param data the extra input bytes. \param len the extra input length (in bytes). \param min_len minimum extra input length (in bytes). \param max_len maximum extra input length (in bytes). \param out destination buffer for the HMAC output. \return the produced value length (in bytes).