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.
This commit is contained in:
Gilles Peskine 2019-03-01 19:28:41 +01:00
parent 1dbab67ce8
commit 105031b1e1

View file

@ -100,6 +100,7 @@ int mbedtls_asn1_write_raw_buffer( unsigned char **p, unsigned char *start,
* \param p The reference to the current position pointer. * \param p The reference to the current position pointer.
* \param start The start of the buffer, for bounds-checking. * \param start The start of the buffer, for bounds-checking.
* \param X The MPI to write. * \param X The MPI to write.
* It must be non-negative.
* *
* \return The number of bytes written to \p p on success. * \return The number of bytes written to \p p on success.
* \return A negative \c MBEDTLS_ERR_ASN1_XXX error code on failure. * \return A negative \c MBEDTLS_ERR_ASN1_XXX error code on failure.
@ -184,6 +185,7 @@ int mbedtls_asn1_write_bool( unsigned char **p, unsigned char *start,
* \param p The reference to the current position pointer. * \param p The reference to the current position pointer.
* \param start The start of the buffer, for bounds-checking. * \param start The start of the buffer, for bounds-checking.
* \param val The integer value to write. * \param val The integer value to write.
* It must be non-negative.
* *
* \return The number of bytes written to \p p on success. * \return The number of bytes written to \p p on success.
* \return A negative \c MBEDTLS_ERR_ASN1_XXX error code on failure. * \return A negative \c MBEDTLS_ERR_ASN1_XXX error code on failure.
@ -232,7 +234,7 @@ int mbedtls_asn1_write_printable_string( unsigned char **p,
/** /**
* \brief Write a UTF8 string in ASN.1 format using the UTF8String * \brief Write a UTF8 string in ASN.1 format using the UTF8String
* string encoding tag (#MBEDTLS_ASN1_PRINTABLE_STRING). * string encoding tag (#MBEDTLS_ASN1_UTF8_STRING).
* *
* \note This function works backwards in data buffer. * \note This function works backwards in data buffer.
* *