Skip to main content

mbedtls_nist_kw_unwrap

Function mbedtls_nist_kw_unwrap 

Source
pub unsafe extern "C" fn mbedtls_nist_kw_unwrap(
    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 decrypts a buffer using key wrapping.

\param ctx The key wrapping context to use for decryption. \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. The input must be a multiple of semiblocks.

  • For KW mode: a multiple of 8 bytes between 24 and 2^57 inclusive.
  • For KWP mode: a multiple of 8 bytes between 16 and 2^32 inclusive.
\param[out] output The buffer holding the output data. The output buffer’s minimal length is 8 bytes shorter than \p in_len. \param[out] out_len The number of bytes written to the output buffer. \c 0 on failure. For KWP mode, the length could be up to 15 bytes shorter than \p in_len, depending on how much padding was added to the data. \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 \c MBEDTLS_ERR_CIPHER_AUTH_FAILED for verification failure of the ciphertext. \return cipher-specific error code on failure of the underlying cipher.