Skip to content

Commit 334df44

Browse files
author
Hanno Becker
committed
ASN.1: Improve documentation of mbedtls_asn1_get_sequence_of()
1 parent 5fd73eb commit 334df44

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

include/mbedtls/asn1.h

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,13 +276,28 @@ int mbedtls_asn1_get_bitstring_null( unsigned char **p, const unsigned char *end
276276
size_t *len );
277277

278278
/**
279-
* \brief Parses and splits an ASN.1 "SEQUENCE OF <tag>"
280-
* Updated the pointer to immediately behind the full sequence tag.
279+
* \brief This function parses and splits an ASN.1 "SEQUENCE OF <tag>"
280+
* and updates the source buffer pointer to immediately behind
281+
* the full sequence.
281282
*
282-
* \param p The position in the ASN.1 data
283-
* \param end End of data
284-
* \param cur First variable in the chain to fill
285-
* \param tag Type of sequence
283+
* \param p The address of the pointer to the beginning of the
284+
* ASN.1 SEQUENCE OF structure, including ASN.1 tag+length header.
285+
* On success, `*p` is advanced to point to the first byte
286+
* following the parsed ASN.1 sequence.
287+
* \param end The end of the ASN.1 input buffer starting at \p p. This is
288+
* used for bounds checking.
289+
* \param cur The address at which to store the first entry in the parsed
290+
* sequence. Further entries are heap-allocated and referenced
291+
* from \p cur.
292+
* \param tag The common tag of the entries in the ASN.1 sequence.
293+
*
294+
* \note Ownership for the heap-allocated elements \c cur->next,
295+
* \c cur->next->next, ..., is passed to the caller. It
296+
* is hence the caller's responsibility to free them when
297+
* no longer needed, and mbedtls_asn1_sequence_free() can
298+
* be used for that, passing \c cur->next as the \c seq
299+
* argument (or \p cur if \p cur itself was heap-allocated
300+
* by the caller).
286301
*
287302
* \return 0 if successful or a specific ASN.1 error code.
288303
*/

0 commit comments

Comments
 (0)