Skip to content

Commit 92d5b75

Browse files
asn1_write documentation: say that integers must be non-negative
The documentation never said it explicitly, but the ASN.1 library doesn't support negative integers. Say it explicitly. Also fix a copypasta error.
1 parent 02d5996 commit 92d5b75

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

include/mbedtls/asn1write.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ int mbedtls_asn1_write_raw_buffer( unsigned char **p, unsigned char *start,
9999
* \param p The reference to the current position pointer.
100100
* \param start The start of the buffer, for bounds-checking.
101101
* \param X The MPI to write.
102+
* It must be non-negative.
102103
*
103104
* \return The number of bytes written to \p p on success.
104105
* \return A negative \c MBEDTLS_ERR_ASN1_XXX error code on failure.
@@ -183,6 +184,7 @@ int mbedtls_asn1_write_bool( unsigned char **p, unsigned char *start,
183184
* \param p The reference to the current position pointer.
184185
* \param start The start of the buffer, for bounds-checking.
185186
* \param val The integer value to write.
187+
* It must be non-negative.
186188
*
187189
* \return The number of bytes written to \p p on success.
188190
* \return A negative \c MBEDTLS_ERR_ASN1_XXX error code on failure.
@@ -231,7 +233,7 @@ int mbedtls_asn1_write_printable_string( unsigned char **p,
231233

232234
/**
233235
* \brief Write a UTF8 string in ASN.1 format using the UTF8String
234-
* string encoding tag (#MBEDTLS_ASN1_PRINTABLE_STRING).
236+
* string encoding tag (#MBEDTLS_ASN1_UTF8_STRING).
235237
*
236238
* \note This function works backwards in data buffer.
237239
*

0 commit comments

Comments
 (0)