Function riot_sys::cose_sign_encode

source ·
pub unsafe extern "C" fn cose_sign_encode(
    sign: *mut cose_sign_enc_t,
    buf: *mut u8,
    len: size_t,
    out: *mut *mut u8
) -> c_long
Expand description

cose_sign_sign signs the data from the sign object with the attached signers. The output is placed in the supplied buffer, starting at the position indicated by the out parameter.

This function uses the buffer as scratch space to first calculate all the signatures. Therefore this buffer should be large enough to contain the headers, the payload, the additionally authenticated data and the signatures at the same time. This is a limitation caused by how the COSE signatures to be generated and how crypto libraries require their message as one continuous block of data.

@param sign Sign struct to encode @param buf Buffer to write in @param[out] out Pointer to where the COSE sign struct starts @param len Size of the buffer to write in

@return The number of bytes written @return Negative on error