mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-30 02:44:20 +01:00
mbedtls_x509_crt_parse_der_with_ext_cb enhancement
added make_copy parameter as suggested in https://github.com/ARMmbed/mbedtls/pull/3243#discussion_r431233555 Co-authored-by: Gilles Peskine <gilles.peskine@arm.com> Signed-off-by: Nicola Di Lieto <nicola.dilieto@gmail.com>
This commit is contained in:
parent
fae25a13d9
commit
4dbe5676af
@ -339,12 +339,20 @@ typedef int (*mbedtls_x509_crt_ext_cb_t)( mbedtls_x509_crt const *crt,
|
|||||||
* mbedtls_x509_crt_init().
|
* mbedtls_x509_crt_init().
|
||||||
* \param buf The buffer holding the DER encoded certificate.
|
* \param buf The buffer holding the DER encoded certificate.
|
||||||
* \param buflen The size in Bytes of \p buf.
|
* \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
|
* \param cb A callback invoked for every unsupported certificate
|
||||||
* extension.
|
* extension.
|
||||||
*
|
*
|
||||||
* \note This call is functionally equivalent to
|
* \note This call is functionally equivalent to
|
||||||
* mbedtls_x509_crt_parse_der(), but it calls the callback
|
* mbedtls_x509_crt_parse_der(), and/or
|
||||||
* with every unsupported certificate extension.
|
* mbedtls_x509_crt_parse_der_nocopy()
|
||||||
|
* but it calls the callback with every unsupported
|
||||||
|
* certificate extension.
|
||||||
* The callback must return a negative error code if it
|
* The callback must return a negative error code if it
|
||||||
* does not know how to handle such an extension.
|
* does not know how to handle such an extension.
|
||||||
*
|
*
|
||||||
@ -354,6 +362,7 @@ typedef int (*mbedtls_x509_crt_ext_cb_t)( mbedtls_x509_crt const *crt,
|
|||||||
int mbedtls_x509_crt_parse_der_with_ext_cb( mbedtls_x509_crt *chain,
|
int mbedtls_x509_crt_parse_der_with_ext_cb( mbedtls_x509_crt *chain,
|
||||||
const unsigned char *buf,
|
const unsigned char *buf,
|
||||||
size_t buflen,
|
size_t buflen,
|
||||||
|
int no_copy,
|
||||||
mbedtls_x509_crt_ext_cb_t cb );
|
mbedtls_x509_crt_ext_cb_t cb );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1392,9 +1392,10 @@ int mbedtls_x509_crt_parse_der_nocopy( mbedtls_x509_crt *chain,
|
|||||||
int mbedtls_x509_crt_parse_der_with_ext_cb( mbedtls_x509_crt *chain,
|
int mbedtls_x509_crt_parse_der_with_ext_cb( mbedtls_x509_crt *chain,
|
||||||
const unsigned char *buf,
|
const unsigned char *buf,
|
||||||
size_t buflen,
|
size_t buflen,
|
||||||
|
int make_copy,
|
||||||
mbedtls_x509_crt_ext_cb_t cb )
|
mbedtls_x509_crt_ext_cb_t cb )
|
||||||
{
|
{
|
||||||
return( mbedtls_x509_crt_parse_der_internal( chain, buf, buflen, 1, cb ) );
|
return( mbedtls_x509_crt_parse_der_internal( chain, buf, buflen, make_copy, cb ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbedtls_x509_crt_parse_der( mbedtls_x509_crt *chain,
|
int mbedtls_x509_crt_parse_der( mbedtls_x509_crt *chain,
|
||||||
|
Loading…
Reference in New Issue
Block a user