Function esp_idf_svc::hal::sys::mbedtls_x509_crt_parse_der_with_ext_cb
source · pub unsafe extern "C" fn mbedtls_x509_crt_parse_der_with_ext_cb(
chain: *mut mbedtls_x509_crt,
buf: *const u8,
buflen: usize,
make_copy: i32,
cb: Option<unsafe extern "C" fn(_: *mut c_void, _: *const mbedtls_x509_crt, _: *const mbedtls_asn1_buf, _: i32, _: *const u8, _: *const u8) -> i32>,
p_ctx: *mut c_void,
) -> i32
Expand description
\brief Parse a single DER formatted certificate and add it to the end of the provided chained list.
\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 buffer holding the DER encoded certificate. \param buflen The size in Bytes of \p buf. \param make_copy When not zero this function makes an internal copy of the CRT buffer \p buf. In particular, \p buf may be destroyed or reused after this call returns. When zero this function avoids duplicating the CRT buffer by taking temporary ownership thereof until the CRT is destroyed (like mbedtls_x509_crt_parse_der_nocopy()) \param cb A callback invoked for every unsupported certificate extension. \param p_ctx An opaque context passed to the callback.
\note This call is functionally equivalent to mbedtls_x509_crt_parse_der(), and/or mbedtls_x509_crt_parse_der_nocopy() but it calls the callback with every unsupported certificate extension and additionally the “certificate policies” extension if it contains any unsupported certificate policies. The callback must return a negative error code if it does not know how to handle such an extension. When the callback fails to parse a critical extension mbedtls_x509_crt_parse_der_with_ext_cb() also fails. When the callback fails to parse a non critical extension mbedtls_x509_crt_parse_der_with_ext_cb() simply skips the extension and continues parsing. Future versions of the library may invoke the callback in other cases, if and when the need arises.
\return \c 0 if successful. \return A negative error code on failure.