Minor style and documentation improvements
Co-authored-by: Gilles Peskine <gilles.peskine@arm.com>
Signed-off-by: Nicola Di Lieto <nicola.dilieto@gmail.com>
diff --git a/include/mbedtls/x509_crt.h b/include/mbedtls/x509_crt.h
index 19de1e9..13687b5 100644
--- a/include/mbedtls/x509_crt.h
+++ b/include/mbedtls/x509_crt.h
@@ -310,14 +310,15 @@
* mbedtls_x509_crt_parse_der_ext() routine when it encounters
* an unsupported extension.
*
- * \param crt Pointer to the certificate being parsed
- * \param oid Extension's OID
- * \param critical If the extension is critical (per the RFC's definition)
- * \param p On entry \c *p points to the start of the extension ASN.1
- * data. On successful completion \c *p must point to the
- * first byte after it.
- * On error, the value of \c *p is undefined.
- * \param end End of extension data.
+ * \param crt The certificate being parsed.
+ * \param oid The OID of the extension.
+ * \param critical Whether the extension is critical.
+ * \param p On entry, \c *p points to the start of the extension value
+ * (the content of the OCTET STRING).
+ * On successful completion, \c *p must point to the
+ * first byte after the extension value.
+ * On error, the value of \c *p is not undefined.
+ * \param end End of extension value.
*
* \note The callback must fail and return a negative error code if
* it can not parse or does not support the extension.
@@ -326,10 +327,10 @@
* \return A negative error code on failure.
*/
typedef int (*mbedtls_x509_crt_ext_cb_t)( mbedtls_x509_crt const *crt,
- mbedtls_x509_buf const *oid,
- int critical,
- unsigned char **p,
- const unsigned char *end );
+ mbedtls_x509_buf const *oid,
+ int critical,
+ unsigned char **p,
+ const unsigned char *end );
/**
* \brief Parse a single DER formatted certificate and add it
@@ -354,10 +355,9 @@
* \return A negative error code on failure.
*/
int mbedtls_x509_crt_parse_der_ext( mbedtls_x509_crt *chain,
- const unsigned char *buf,
- size_t buflen,
- mbedtls_x509_crt_ext_cb_t cb
- );
+ const unsigned char *buf,
+ size_t buflen,
+ mbedtls_x509_crt_ext_cb_t cb );
/**
* \brief Parse a single DER formatted certificate and add it
diff --git a/library/x509_crt.c b/library/x509_crt.c
index 9076b32..a0d35ae 100644
--- a/library/x509_crt.c
+++ b/library/x509_crt.c
@@ -957,7 +957,7 @@
if( ret != 0 )
{
/* Give the callback (if any) a chance to handle the extension */
- if (cb && cb(crt, &extn_oid, is_critical, p, end_ext_octet) == 0)
+ if( cb != NULL && cb( crt, &extn_oid, is_critical, p, end_ext_octet ) == 0 )
continue;
/* No parser found, skip extension */