mirror of
https://github.com/yuzu-emu/mbedtls
synced 2024-11-24 15:28:14 +00:00
Improve documentation of mbedtls_x509_get_ext()
- Explain the use of explicit ASN.1 tagging for the extensions structuree - Remove misleading comment which suggests that mbedtls_x509_get_ext() also parsed the header of the first extension, which is not the case.
This commit is contained in:
parent
a49d4a6607
commit
c74ce446b9
1 changed files with 3 additions and 5 deletions
|
@ -713,6 +713,9 @@ int mbedtls_x509_get_ext( unsigned char **p, const unsigned char *end,
|
||||||
int ret;
|
int ret;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
|
/* Extension structure use EXPLICIT tagging. That is, the actual
|
||||||
|
* `Extensions` structure is wrapped by a tag-length pair using
|
||||||
|
* the respective context-specific tag. */
|
||||||
ret = mbedtls_asn1_get_tag( p, end, &ext->len,
|
ret = mbedtls_asn1_get_tag( p, end, &ext->len,
|
||||||
MBEDTLS_ASN1_CONTEXT_SPECIFIC | MBEDTLS_ASN1_CONSTRUCTED | tag );
|
MBEDTLS_ASN1_CONTEXT_SPECIFIC | MBEDTLS_ASN1_CONSTRUCTED | tag );
|
||||||
if( ret != 0 )
|
if( ret != 0 )
|
||||||
|
@ -724,11 +727,6 @@ int mbedtls_x509_get_ext( unsigned char **p, const unsigned char *end,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension
|
* Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension
|
||||||
*
|
|
||||||
* Extension ::= SEQUENCE {
|
|
||||||
* extnID OBJECT IDENTIFIER,
|
|
||||||
* critical BOOLEAN DEFAULT FALSE,
|
|
||||||
* extnValue OCTET STRING }
|
|
||||||
*/
|
*/
|
||||||
if( ( ret = mbedtls_asn1_get_tag( p, end, &len,
|
if( ( ret = mbedtls_asn1_get_tag( p, end, &len,
|
||||||
MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) ) != 0 )
|
MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) ) != 0 )
|
||||||
|
|
Loading…
Reference in a new issue