Skip to main content

mbedtls_nist_kw_wrap

Function mbedtls_nist_kw_wrap 

Source
pub unsafe extern "C" fn mbedtls_nist_kw_wrap(
    ctx: *mut mbedtls_nist_kw_context,
    mode: mbedtls_nist_kw_mode_t,
    input: *const c_uchar,
    in_len: usize,
    output: *mut c_uchar,
    out_len: *mut usize,
    out_size: usize,
) -> c_int
Expand description

\brief This function encrypts a buffer using key wrapping.

\param ctx The key wrapping context to use for encryption. \param mode The key wrapping mode to use (MBEDTLS_KW_MODE_KW or MBEDTLS_KW_MODE_KWP) \param input The buffer holding the input data. \param in_len The length of the input data in Bytes. The input uses units of 8 Bytes called semiblocks.

  • For KW mode: a multiple of 8 bytes between 16 and 2^57-8 inclusive.
  • For KWP mode: any length between 1 and 2^32-1 inclusive.
\param[out] output The buffer holding the output data.
  • For KW mode: Must be at least 8 bytes larger than \p in_len.
  • For KWP mode: Must be at least 8 bytes larger rounded up to a multiple of 8 bytes for KWP (15 bytes at most).
\param[out] out_len The number of bytes written to the output buffer. \c 0 on failure. \param[in] out_size The capacity of the output buffer.

\return \c 0 on success. \return \c MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA for invalid input length. \return cipher-specific error code on failure of the underlying cipher.