Add documentation notes about the required size of the signature buffers
diff --git a/include/mbedtls/pk.h b/include/mbedtls/pk.h
index ee06b2f..8beb2af 100644
--- a/include/mbedtls/pk.h
+++ b/include/mbedtls/pk.h
@@ -343,6 +343,10 @@
*
* \note For RSA, md_alg may be MBEDTLS_MD_NONE if hash_len != 0.
* For ECDSA, md_alg may never be MBEDTLS_MD_NONE.
+ *
+ * \note In order to ensure enough space for the signature, the
+ * \p sig buffer size must be of at least
+ * `max(MBEDTLS_ECDSA_MAX_LEN, MBEDTLS_MPI_MAX_SIZE)` bytes.
*/
int mbedtls_pk_sign( mbedtls_pk_context *ctx, mbedtls_md_type_t md_alg,
const unsigned char *hash, size_t hash_len,
diff --git a/include/mbedtls/rsa.h b/include/mbedtls/rsa.h
index 5548f3c..92efa47 100644
--- a/include/mbedtls/rsa.h
+++ b/include/mbedtls/rsa.h
@@ -819,6 +819,7 @@
*
* \note The \p sig buffer must be as large as the size
* of \p ctx->N. For example, 128 Bytes if RSA-1024 is used.
+ * A buffer length of #MBEDTLS_MPI_MAX_SIZE is always safe.
*
* \note For PKCS#1 v2.1 encoding, see comments on
* mbedtls_rsa_rsassa_pss_sign() for details on
@@ -862,6 +863,7 @@
*
* \note The \p sig buffer must be as large as the size
* of \p ctx->N. For example, 128 Bytes if RSA-1024 is used.
+ * A buffer length of #MBEDTLS_MPI_MAX_SIZE is always safe.
*/
int mbedtls_rsa_rsassa_pkcs1_v15_sign( mbedtls_rsa_context *ctx,
int (*f_rng)(void *, unsigned char *, size_t),
@@ -902,6 +904,7 @@
*
* \note The \p sig buffer must be as large as the size
* of \p ctx->N. For example, 128 Bytes if RSA-1024 is used.
+ * A buffer length of #MBEDTLS_MPI_MAX_SIZE is always safe.
*
* \note The \p hash_id in the RSA context is the one used for the
* encoding. \p md_alg in the function call is the type of hash