dtls_mac method

void dtls_mac(
  1. Pointer<dtls_hmac_context_t> hmac_ctx,
  2. Pointer<Uint8> record,
  3. Pointer<Uint8> packet,
  4. int length,
  5. Pointer<Uint8> buf,
)

Calculates MAC for record + cleartext packet and places the result in \p buf. The given \p hmac_ctx must be initialized with the HMAC function to use and the proper secret. As the DTLS mac calculation requires data from the record header, \p record must point to a buffer of at least \c sizeof(dtls_record_header_t) bytes. Usually, the remaining packet will be encrypted, therefore, the cleartext is passed separately in \p packet.

\param hmac_ctx The HMAC context to use for MAC calculation. \param record The record header. \param packet Cleartext payload to apply the MAC to. \param length Size of \p packet. \param buf A result buffer that is large enough to hold the generated digest.

Implementation

void dtls_mac(
  ffi.Pointer<dtls_hmac_context_t> hmac_ctx,
  ffi.Pointer<ffi.Uint8> record,
  ffi.Pointer<ffi.Uint8> packet,
  int length,
  ffi.Pointer<ffi.Uint8> buf,
) {
  return _dtls_mac(
    hmac_ctx,
    record,
    packet,
    length,
    buf,
  );
}