dtls_encrypt_params method

int dtls_encrypt_params(
  1. Pointer<dtls_ccm_params_t> params,
  2. Pointer<Uint8> src,
  3. int length,
  4. Pointer<Uint8> buf,
  5. Pointer<Uint8> key,
  6. int keylen,
  7. Pointer<Uint8> aad,
  8. int aad_length,
)

Encrypts the specified \p src of given \p length, writing the result to \p buf. The cipher implementation may add more data to the result buffer such as an initialization vector or padding (e.g. for block ciphers in CBC mode). The caller therefore must ensure that \p buf provides sufficient storage to hold the result. Usually this means ( 2 + \p length / blocksize ) * blocksize. The function returns a value less than zero on error or otherwise the number of bytes written. The provided \p src and \p buf may overlap.

\param params AEAD parameters: Nonce, M and L. \param src The data to encrypt. \param length The actual size of of \p src. \param buf The result buffer. \param aad additional data for AEAD ciphers \param aad_length actual size of @p aad \return The number of encrypted bytes on success, less than zero otherwise.

Implementation

int dtls_encrypt_params(
  ffi.Pointer<dtls_ccm_params_t> params,
  ffi.Pointer<ffi.Uint8> src,
  int length,
  ffi.Pointer<ffi.Uint8> buf,
  ffi.Pointer<ffi.Uint8> key,
  int keylen,
  ffi.Pointer<ffi.Uint8> aad,
  int aad_length,
) {
  return _dtls_encrypt_params(
    params,
    src,
    length,
    buf,
    key,
    keylen,
    aad,
    aad_length,
  );
}