pub unsafe extern "C" fn mbedtls_x509_crt_parse_der_nocopy(
    chain: *mut mbedtls_x509_crt,
    buf: *const c_uchar,
    buflen: usize
) -> c_int
Expand description

\brief Parse a single DER formatted certificate and add it to the end of the provided chained list. This is a variant of mbedtls_x509_crt_parse_der() which takes temporary ownership of the CRT buffer until the CRT is destroyed.

\note If #MBEDTLS_USE_PSA_CRYPTO is enabled, the PSA crypto subsystem must have been initialized by calling psa_crypto_init() before calling this function.

\param chain The pointer to the start of the CRT chain to attach to. When parsing the first CRT in a chain, this should point to an instance of ::mbedtls_x509_crt initialized through mbedtls_x509_crt_init(). \param buf The address of the readable buffer holding the DER encoded certificate to use. On success, this buffer must be retained and not be changed for the lifetime of the CRT chain \p chain, that is, until \p chain is destroyed through a call to mbedtls_x509_crt_free(). \param buflen The size in Bytes of \p buf.

\note This call is functionally equivalent to mbedtls_x509_crt_parse_der(), but it avoids creating a copy of the input buffer at the cost of stronger lifetime constraints. This is useful in constrained environments where duplication of the CRT cannot be tolerated.

\return \c 0 if successful. \return A negative error code on failure.